From ab0175564b3746aa3707ba955a3e816a6d62ffa5 Mon Sep 17 00:00:00 2001 From: claude Date: Wed, 28 Oct 2026 00:06:22 +0100 Subject: [PATCH] libxe2: ESIMD kernels compiled with the vector compiler's -ffp-contract=off The vector compiler that builds ESIMD kernels forms a mad from a multiply and an add unless its own API option says strict, whatever the front end's -ffp-contract: probe fmac.cpp's t = (s * a) * b; c += t came back fused in 14062 of 65536 lanes, 0 with the option, and the SIMT kernels are unaffected either way. An ESIMD epilogue that copies libref's chain (the w2a8 head's group terms) was therefore exact only where no fusion happened to change a rounding. ctest -L sycl on the B65: 3/3 (device_test_sycl, kbench, kbench_moe). Co-Authored-By: Claude Opus 5.5 --- libxe2/CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libxe2/CMakeLists.txt b/libxe2/CMakeLists.txt index 0ad0552e..4416f785 100644 --- a/libxe2/CMakeLists.txt +++ b/libxe2/CMakeLists.txt @@ -31,9 +31,14 @@ rad_add_plugin(libxe2 kernels SOURCES ${XE2_SRC}) # on the compile line alone it changes nothing on the card. # SPV_INTEL_subgroup_matrix_multiply_accumulate: DPAS on operands in registers (xe2_common.h's # dpas_f16), for kernels that decode a weight straight into the B operand. +# -options -ffp-contract=off: the ESIMD kernels' vector compiler forms mads from a multiply and an +# 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. 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:-Xspirv-translator -spirv-ext=+SPV_INTEL_subgroup_matrix_multiply_accumulate" + "SHELL:-Xsycl-target-backend \"-options -ffp-contract=off\"") 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)