diff --git a/libxe2/CMakeLists.txt b/libxe2/CMakeLists.txt index 4416f785..9c3aa4b6 100644 --- a/libxe2/CMakeLists.txt +++ b/libxe2/CMakeLists.txt @@ -35,10 +35,17 @@ rad_add_plugin(libxe2 kernels SOURCES ${XE2_SRC}) # add unless its own option says strict, whatever the front end's -ffp-contract (probe fmac.cpp: # t = (s * a) * b; c += t came back fused in 14062 of 65536 lanes, 0 with the option; SIMT kernels # are unaffected either way). Without it an ESIMD epilogue that copies libref's chain is not exact. +# -ze-intel-enable-auto-large-GRF-mode: a kernel's grf_size<256> property never reached the card. +# sycl-post-link records it on the device image (sycl-grf-size), but only the runtime's JIT reads that +# and adds the large-register option; this build compiles AOT at link time with the options here +# alone, so every kernel got 128 registers, and the 256-register ones spilled (prefill attention: 4 +# KiB a thread, 66% of its stall samples on the scoreboard). The auto mode gives a kernel the large +# file when it needs it: the attention kernels get 256 and no spill (probe fa.cpp at 2048 tokens 7.3 +# -> 13.5 TFLOPS, output identical), the w4 GEMMs keep 128 and their eight threads an EU. set(_xe2_sycl -fsycl "-fsycl-targets=${RAD_SYCL_TARGETS}" -ffp-model=precise -ffp-contract=off -Wno-overriding-option -foffload-fp32-prec-div -foffload-fp32-prec-sqrt "SHELL:-Xspirv-translator -spirv-ext=+SPV_INTEL_subgroup_matrix_multiply_accumulate" - "SHELL:-Xsycl-target-backend \"-options -ffp-contract=off\"") + "SHELL:-Xsycl-target-backend \"-options '-ffp-contract=off -ze-intel-enable-auto-large-GRF-mode'\"") target_compile_options(libxe2 PRIVATE ${_xe2_sycl} -fvisibility=hidden) get_filename_component(_xe2_icpx_bin "${CMAKE_CXX_COMPILER}" DIRECTORY) get_filename_component(_xe2_oneapi_lib "${_xe2_icpx_bin}/../lib" ABSOLUTE)