[libclc] libclc: erfc: fix fp32 implementation (PR #132390)

2025-04-05 Thread Romaric Jodin via cfe-commits
https://github.com/rjodinchr updated https://github.com/llvm/llvm-project/pull/132390 >From 95eeda421b4cdc468f828d36146d609e80d195d9 Mon Sep 17 00:00:00 2001 From: Romaric Jodin Date: Fri, 21 Mar 2025 13:51:41 +0100 Subject: [PATCH 1/3] libclc: erfc: fix fp32 implementation On some implementat

[libclc] libclc: erfc: fix fp32 implementation (PR #132390)

2025-04-05 Thread Fraser Cormack via cfe-commits
@@ -131,7 +131,8 @@ _CLC_OVERLOAD _CLC_DEF float erfc(float x) { float ret = 0.0f; float z = as_float(ix & 0xf000); -float r = exp(mad(-z, z, -0.5625f)) * exp(mad(z - absx, z + absx, q)); +float r = exp(-z * z) * exp(mad(z - absx, z + absx, q)); +r *= 0

[libclc] libclc: erfc: fix fp32 implementation (PR #132390)

2025-04-05 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck closed https://github.com/llvm/llvm-project/pull/132390 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[libclc] libclc: erfc: fix fp32 implementation (PR #132390)

2025-04-05 Thread Karol Herbst via cfe-commits
karolherbst wrote: It does, thank you! https://github.com/llvm/llvm-project/pull/132390 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[libclc] libclc: erfc: fix fp32 implementation (PR #132390)

2025-04-05 Thread Romaric Jodin via cfe-commits
https://github.com/rjodinchr created https://github.com/llvm/llvm-project/pull/132390 On some implementation, the current implementation lead to slight accuracy issues. While the maths behing this implementation is correct, it does not take into account the accumulation of errors coming from o

[libclc] libclc: erfc: fix fp32 implementation (PR #132390)

2025-04-05 Thread Romaric Jodin via cfe-commits
https://github.com/rjodinchr edited https://github.com/llvm/llvm-project/pull/132390 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[libclc] libclc: erfc: fix fp32 implementation (PR #132390)

2025-04-05 Thread Romaric Jodin via cfe-commits
rjodinchr wrote: @karolherbst could you try this patch to see if it fixes rusticl as well? https://github.com/llvm/llvm-project/pull/132390 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-comm

[libclc] libclc: erfc: fix fp32 implementation (PR #132390)

2025-04-05 Thread Romaric Jodin via cfe-commits
https://github.com/rjodinchr edited https://github.com/llvm/llvm-project/pull/132390 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[libclc] libclc: erfc: fix fp32 implementation (PR #132390)

2025-04-04 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck approved this pull request. LGTM. It might be worth re-titling the PR to mention FTZ mode? https://github.com/llvm/llvm-project/pull/132390 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/c

[libclc] libclc: erfc: fix fp32 implementation (PR #132390)

2025-03-24 Thread Romaric Jodin via cfe-commits
rjodinchr wrote: > It might be worth re-titling the PR to mention FTZ mode? Sure, I'm not sure what you have in mind, but feel free to do it when submitting it upstream (I cannot do it myself) https://github.com/llvm/llvm-project/pull/132390 ___ cfe-

[libclc] libclc: erfc: fix fp32 implementation (PR #132390)

2025-03-24 Thread Romaric Jodin via cfe-commits
rjodinchr wrote: > Though this does seem to be an improvement so it might be worth merging > anyway. As you say, it fixes things for you and for mesa. Are you both > testing on FTZ implementations, by any chance? Yes, default run of the CTS using clvk ends up running with FTZ. https://github.

[libclc] libclc: erfc: fix fp32 implementation (PR #132390)

2025-03-24 Thread Romaric Jodin via cfe-commits
https://github.com/rjodinchr updated https://github.com/llvm/llvm-project/pull/132390 >From 95eeda421b4cdc468f828d36146d609e80d195d9 Mon Sep 17 00:00:00 2001 From: Romaric Jodin Date: Fri, 21 Mar 2025 13:51:41 +0100 Subject: [PATCH 1/2] libclc: erfc: fix fp32 implementation On some implementat

[libclc] libclc: erfc: fix fp32 implementation (PR #132390)

2025-03-24 Thread Fraser Cormack via cfe-commits
@@ -130,7 +130,8 @@ _CLC_OVERLOAD _CLC_DEF float erf(float x) { // |x| < 6 float z = as_float(ix & 0xf000); -float r = exp(mad(-z, z, -0.5625f)) * exp(mad(z-absx, z+absx, q)); +float r = exp(-z * z) * exp(mad(z - absx, z + absx, q)); +r *= 0x1.23ba94p-1

[libclc] libclc: erfc: fix fp32 implementation (PR #132390)

2025-03-24 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck edited https://github.com/llvm/llvm-project/pull/132390 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[libclc] libclc: erfc: fix fp32 implementation (PR #132390)

2025-03-24 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck commented: Nice one! This appears only to fix the precision issues I see when in FTZ mode. Without FTZ mode, I still see, e.g., ``` 1:erfc fp32 ... ERROR: erfc: -24.674929 ulp error at 0x1.3b8p+3 (0x411dc000): *0x1.9p-145 vs. 0x0p+0 ERR

[libclc] libclc: erfc: fix fp32 implementation (PR #132390)

2025-03-21 Thread Romaric Jodin via cfe-commits
https://github.com/rjodinchr updated https://github.com/llvm/llvm-project/pull/132390 >From 95eeda421b4cdc468f828d36146d609e80d195d9 Mon Sep 17 00:00:00 2001 From: Romaric Jodin Date: Fri, 21 Mar 2025 13:51:41 +0100 Subject: [PATCH] libclc: erfc: fix fp32 implementation On some implementation,

[libclc] libclc: erfc: fix fp32 implementation (PR #132390)

2025-03-21 Thread Romaric Jodin via cfe-commits
rjodinchr wrote: @frasercrmck could you review please? https://github.com/llvm/llvm-project/pull/132390 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits