Request IEEE fp32 division for SYCL kernels - #752
Merged
Conversation
The SYCL compiler defaults to a fast floating-point model in which fp32 division is allowed several ULP of error and `a / b` is lowered to `a * rcp(b)`. Kernels built this way return results that differ from the eager PyTorch ones in the last bit, which breaks kernel tests that compare against PyTorch exactly. Add -foffload-fp32-prec-div and -foffload-fp32-prec-sqrt, matching how PyTorch builds its own XPU kernels in torch-xpu-ops. These affect the offload backend and only take effect when passed to both the device compile and the device link step, so per-kernel `sycl-flags` in build.toml cannot substitute for them. Verified with the activation kernel on Intel Arc Pro B60: its silu_and_mul and mul_and_silu operators go from 42 failures to a fully passing suite, with no change in measured throughput.
jiqing-feng
force-pushed
the
xpu-fp32-prec-div
branch
from
August 10, 2026 03:33
425f337 to
9782793
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
-foffload-fp32-prec-divand-foffload-fp32-prec-sqrtto the SYCL buildflags, matching how PyTorch builds its own XPU kernels in
torch-xpu-ops.Without them the compiler defaults to a fast floating-point model in which fp32
division is allowed several ULP of error and
a / bis lowered toa * rcp(b).Kernels built this way return results that differ from the eager PyTorch ones in
the last bit, which breaks kernel tests that compare against PyTorch exactly.
These flags affect the offload backend and only take effect when passed to both
the device compile and the device link step, so the per-kernel
sycl-flagsinbuild.tomlcannot substitute for them. Applied to thetorchandtvm_ffipreambles alike.
Validation
Verified with
kernels-community/activationon Intel Arc Pro B60 withtorch 2.13.0+xpuand oneAPI 2026.0. Itssilu_and_mulandmul_and_siluoperators go from 42 failures to a fully passing suite (396 cases), with no
change in measured throughput.