intel / intel-xpu-backend-for-triton

OpenAI Triton backend for Intel® GPUs
MIT License
141 stars 43 forks source link

`tl.math.sqrt_rn(x)` runs incorrectly on XPU #847

Open ESI-SYD opened 6 months ago

ESI-SYD commented 6 months ago

tl.math.sqrt_rn(x) runs incorrectly on XPU, seems there is no precise sqrt_rn implemention in libsycl-spir64-unknown-unknown.bc. Remove

   if expr_prec == 'tl.math.sqrt_rn(x)':
        pytest.skip("FIXME: Fail accuracy")

Run

python3 -m pytest --device xpu python/test/unit/language/test_core.py::test_precise_math
etiotto commented 6 months ago

The Intel math library doesn't contain the API named __imf_sqrtf_rn, therefore we cannot at the moment lower the Triton PreciseSqrtOp to that library function and we lower it instead to __imf_sqrtf which does not yield a result with the higher precision that is required.