[libclc] [libclc] Explicitly qualify private address spaces (PR #127823)

2025-02-19 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/127823 Doing so provides stability when compiling the builtins in a mode in which unqualified pointers may be interpreted as being in the generic address space, such as in OpenCL 3.0. We eventually want to provid

[clang] [clang] Improve diagnostics for vector builtins (PR #125673)

2025-03-06 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: ping, thanks https://github.com/llvm/llvm-project/pull/125673 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[libclc] [libclc] Reduce bithacking for INF/NAN values (PR #129738)

2025-03-06 Thread Fraser Cormack via cfe-commits
@@ -46,9 +46,7 @@ _CLC_DEF _CLC_OVERLOAD __CLC_GENTYPE __clc_hypot(__CLC_GENTYPE x, __CLC_GENTYPE retval = __clc_sqrt(__clc_mad(fx, fx, fy * fy)) * fx_exp; retval = (ux > PINFBITPATT_SP32 || uy == 0) ? __CLC_AS_GENTYPE(ux) : retval; - retval = (ux == PINFBITPATT_SP32 ||

[libclc] [libclc] Stop installing CLC headers (PR #126908)

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

[libclc] [libclc] Stop installing CLC headers (PR #126908)

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

[libclc] [libclc] Stop installing CLC headers (PR #126908)

2025-03-06 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: /cherry-pick a2b05761724e5243056988d9d6bf1a5a94715b74 https://github.com/llvm/llvm-project/pull/126908 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[libclc] [libclc] Move rsqrt to the CLC library (PR #129045)

2025-02-27 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck updated https://github.com/llvm/llvm-project/pull/129045 >From 4efd607ca71b91847c9271740df7aab4534fe01b Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Thu, 27 Feb 2025 12:48:25 + Subject: [PATCH 1/3] [libclc] Move rsqrt to the CLC library This also adds

[libclc] [libclc] Move rsqrt to the CLC library (PR #129045)

2025-02-27 Thread Fraser Cormack via cfe-commits
@@ -0,0 +1,4 @@ +__attribute__((weak)) _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE +__clc_rsqrt(__CLC_GENTYPE val) { + return __CLC_FP_LIT(1.0) / __clc_sqrt(val); frasercrmck wrote: Good point. Perhaps we just use the elementwise sqrt builtin. I'm not sure I want to t

[libclc] [libclc] Move rsqrt to the CLC library (PR #129045)

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

[libclc] [libclc] Reduce bithacking in CLC frexp (PR #129871)

2025-03-05 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/129871 Also replace some magic constants with named ones. Checking against FP zero and using isnan and isinf functions allows the optimizer to create one unified @llvm.is.fpclass intrinsic. This results in fewer

[libclc] [libclc] Reduce bithacking for INF/NAN values (PR #129738)

2025-03-05 Thread Fraser Cormack via cfe-commits
@@ -86,13 +84,10 @@ _CLC_DEF _CLC_OVERLOAD __CLC_GENTYPE __clc_hypot(__CLC_GENTYPE x, r = c ? s : r; // Check for NaN - c = __clc_isnan(x) || __clc_isnan(y); - r = c ? __CLC_AS_GENTYPE((__CLC_ULONGN)QNANBITPATT_DP64) : r; + r = __clc_isnan(x) || __clc_isnan(y) ? __CLC_

[libclc] [libclc] Reduce bithacking for INF/NAN values (PR #129738)

2025-03-05 Thread Fraser Cormack via cfe-commits
@@ -46,9 +46,7 @@ _CLC_DEF _CLC_OVERLOAD __CLC_GENTYPE __clc_hypot(__CLC_GENTYPE x, __CLC_GENTYPE retval = __clc_sqrt(__clc_mad(fx, fx, fy * fy)) * fx_exp; retval = (ux > PINFBITPATT_SP32 || uy == 0) ? __CLC_AS_GENTYPE(ux) : retval; - retval = (ux == PINFBITPATT_SP32 ||

[libclc] [libclc] Reduce bithacking in CLC frexp (PR #129871)

2025-03-05 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: It's worth noting that alive2 considers this a correct transformation for the before/after IR, for the scalar float/double versions of __clc_frexp for amdgcn. https://github.com/llvm/llvm-project/pull/129871 ___ cfe-commits mailing

[libclc] [libclc] Reduce bithacking in CLC frexp (PR #129871)

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

[libclc] [libclc] Stop installing CLC headers (PR #126908)

2025-03-05 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: It looks that with https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33805 mesa is no longer using the libclc headers. https://github.com/llvm/llvm-project/pull/126908 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [clang] Introduce elementwise clz/ctz builtins (PR #131995)

2025-03-19 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck updated https://github.com/llvm/llvm-project/pull/131995 >From c0eef87f4301a9725b7d81e78875a816d3cdf7cb Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Mon, 3 Feb 2025 16:54:17 + Subject: [PATCH 1/2] [clang] Introduce elementwise clz/ctz builtins These bu

[clang] [clang] Introduce elementwise clz/ctz builtins (PR #131995)

2025-03-19 Thread Fraser Cormack via cfe-commits
@@ -1484,6 +1484,18 @@ def ElementwiseSubSat : Builtin { let Prototype = "void(...)"; } +def ElementwiseClz : Builtin { + let Spellings = ["__builtin_elementwise_clz"]; + let Attributes = [NoThrow, Const, CustomTypeChecking, Constexpr]; + let Prototype = "void(...)"; +} +

[clang] [clang] Introduce elementwise clz/ctz builtins (PR #131995)

2025-03-19 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/131995 These builtins are modeled on the clzg/ctzg builtins, which accept an optional second argument. This second argument is returned if the first argument is 0. >From c0eef87f4301a9725b7d81e78875a816d3cdf7cb Mo

[libclc] [libclc] Skip opt command if opt_flags is empty (PR #130882)

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

[libclc] [libclc] Reduce bithacking in CLC frexp (PR #129871)

2025-03-17 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: > This commit breaks running with clvk & Swiftshader. Not a big deal on my > side. Just wanted to let you know. Oh, what exactly breaks? As in wrong results? https://github.com/llvm/llvm-project/pull/129871 ___ cfe-commits mailing

[libclc] [libclc] Move __clc_(remainder|fmod|remquo) to the CLC library (PR #132054)

2025-03-20 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck updated https://github.com/llvm/llvm-project/pull/132054 >From 1e16ff4926e47b6fd58761ea04ee0535d2112ae4 Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Wed, 19 Mar 2025 14:52:09 + Subject: [PATCH 1/3] [libclc] Move __clc_remainder to CLC library It was al

[libclc] [libclc] Add missing license headers to source IR files (PR #132758)

2025-03-24 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/132758 None >From 8e2c04878b87a7da3929836df2d20c4c4c701312 Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Mon, 24 Mar 2025 15:28:20 + Subject: [PATCH] [libclc] Add missing license headers to source IR fil

[libclc] [libclc] Move fp32 sincos helpers to CLC library (PR #132753)

2025-03-24 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck closed https://github.com/llvm/llvm-project/pull/132753 ___ 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 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-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] Move fp32 sincos helpers to CLC library (PR #132753)

2025-03-24 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/132753 This commit moves most of the sincos helper functions to the CLC library. It simultaneously vectorizes them with the aim to increase performance for vector types by avoiding scalarization. Some helpers for

[libclc] [libclc] Move asinpi/acospi/atanpi to the CLC library (PR #132918)

2025-03-25 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/132918 Similar to d46a6999, this commit simultaneously moves these three functions to the CLC library and optimizes them for vector types by avoiding scalarization. >From 1fb1a82f1dff423d96e803889e831e8aced1aba1 M

[libclc] [libclc] Move asin/acos/atan to the CLC library (PR #132788)

2025-03-24 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/132788 This commit simultaneously moves these three functions to the CLC library and optimizing them for vector types by avoiding scalarization. >From 225400d9dcf9e6bcc08a0b61e062f28f6edfdda6 Mon Sep 17 00:00:00 2

[libclc] [libclc] Skip opt command if opt_flags is empty (PR #130882)

2025-03-18 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/130882 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[libclc] [libclc] Skip opt command if opt_flags is empty (PR #130882)

2025-03-18 Thread Fraser Cormack via cfe-commits
@@ -342,21 +342,32 @@ function(add_libclc_builtin_set) set( builtins_opt_lib_tgt builtins.opt.${ARG_ARCH_SUFFIX} ) - # Add opt target - add_custom_command( OUTPUT ${builtins_opt_lib_tgt}.bc -COMMAND ${opt_exe} ${ARG_OPT_FLAGS} -o ${builtins_opt_lib_tgt}.bc - ${bu

[libclc] [libclc] Reduce bithacking for INF/NAN values (PR #129738)

2025-03-18 Thread Fraser Cormack via cfe-commits
@@ -46,9 +46,7 @@ _CLC_DEF _CLC_OVERLOAD __CLC_GENTYPE __clc_hypot(__CLC_GENTYPE x, __CLC_GENTYPE retval = __clc_sqrt(__clc_mad(fx, fx, fy * fy)) * fx_exp; retval = (ux > PINFBITPATT_SP32 || uy == 0) ? __CLC_AS_GENTYPE(ux) : retval; - retval = (ux == PINFBITPATT_SP32 ||

[clang] [clang] Improve diagnostics for vector builtins (PR #125673)

2025-03-18 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: ping. This PR is blocking the addition of some new elementwise builtins we want for libclc. https://github.com/llvm/llvm-project/pull/125673 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mail

[clang] [clang] Improve diagnostics for vector builtins (PR #125673)

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

[libclc] [libclc] Skip opt command if opt_flags is empty (PR #130882)

2025-03-17 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck commented: I think this makes sense. I can't say for sure that `opt` does absolutely nothing when passed no arguments but logically it makes sense. As for how targets are organized, I wonder if conditionally providing targets adds more complexity, both for the co

[libclc] [libclc] Fix commands in compile_to_bc are executed sequentially (PR #130755)

2025-03-17 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: Am I right in thinking that CMake 3.27's `DEPENDS_EXPLICIT_ONLY` would also fix this? If so it might be worth documenting this explicitly, both in the PR/commit and in the code? We might be able to refactor this in the future, when LLVM updates its minimum version to 3.27.

[libclc] libclc: Add missing gfx950 target (PR #131585)

2025-03-17 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck approved this pull request. https://github.com/llvm/llvm-project/pull/131585 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[libclc] [libclc] Update license headers (PR #132070)

2025-03-20 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: Note that this work is the result of asking the LLVM Foundation about the state of libclc licensing, and their checking with the Foundation's IP lawyer. I've CC'd @kbeyls for confirmation. > I'll just put it out there since my name's on a bunch of these files and it > might

[clang] [clang] Introduce elementwise clz/ctz builtins (PR #131995)

2025-03-19 Thread Fraser Cormack via cfe-commits
@@ -1484,6 +1484,18 @@ def ElementwiseSubSat : Builtin { let Prototype = "void(...)"; } +def ElementwiseClz : Builtin { + let Spellings = ["__builtin_elementwise_clz"]; + let Attributes = [NoThrow, Const, CustomTypeChecking, Constexpr]; + let Prototype = "void(...)"; +} +

[libclc] [libclc] Reduce bithacking in CLC frexp (PR #129871)

2025-03-18 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: That's interesting. As I said alive2 was happy with the before/after IR diff of the AMDGPU version of this builtin. Do you know what might be going on? Is that the fp64 or fp32 test that's failing? https://github.com/llvm/llvm-project/pull/129871

[clang] [clang] Improve diagnostics for vector builtins (PR #125673)

2025-03-18 Thread Fraser Cormack via cfe-commits
@@ -12519,16 +12519,13 @@ def err_builtin_is_within_lifetime_invalid_arg : Error< "%select{non-|function }0pointer argument to '__builtin_is_within_lifetime' " "is not allowed">; -def err_builtin_invalid_arg_type: Error < - "%ordinal0 argument must be " - "%select{a vec

[libclc] [libclc] Move __clc_(remainder|fmod|remquo) to the CLC library (PR #132054)

2025-03-19 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/132054 These functions were already nominally in the CLC namespace; this commit just formally moves them over. Note that 'half' versions of these CLC functions are now provided. Previously the corresponding OpenC

[libclc] [libclc] Update license headers (PR #132070)

2025-03-19 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: Note that this work is the result of asking the LLVM Foundation about the state of libclc licensing, and their checking with the Foundation's IP lawyer. I've CC'd @kbeyls for confirmation. https://github.com/llvm/llvm-project/pull/132070 _

[libclc] [libclc] Update license headers (PR #132070)

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

[libclc] [libclc] add --only-needed to llvm-link when INTERNALIZE flag is set (PR #130871)

2025-03-20 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: You're right, my mistake: even on this repo. I was using `llvm-diff` and only checking the error code. It reports e.g., `function @_Z9__clc_minDv16_DhDh exists only in left module` but still returns `0` so I missed it. This only affects the `builtin.link.*` bytecode librari

[libclc] [libclc] add --only-needed to llvm-link when INTERNALIZE flag is set (PR #130871)

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

[libclc] [libclc] Reduce bithacking in CLC frexp (PR #129871)

2025-03-20 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: It strikes me as a swiftshader bug. If `x` is a denormal/subnormal number and it is being untouched by this function and really reaching this comparison as `0x1.008p-140` then I don't believe it should ever compare true against `0.0`. My reading of flush-to-zero ([here](htt

[libclc] [libclc] Relicense gen_convert.py (PR #132213)

2025-03-20 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/132213 Similar to work done in 82912fd6, this commit re-licenses both the gen_convert.py script, and the it generates. It previously possessed an MIT license, with three additional individual copyrights. The file

[libclc] [libclc] Move lgamma, lgamma_r & tgamma to CLC library (PR #134053)

2025-04-04 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck updated https://github.com/llvm/llvm-project/pull/134053 >From 81675d67f9f182966b86ab630eaa05afe0dc9129 Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Wed, 2 Apr 2025 09:48:43 +0100 Subject: [PATCH 1/2] [libclc] Move lgamma, lgamma_r & tgamma to CLC library

[libclc] [libclc] Fix unresolved reference to missing table (PR #133691)

2025-04-05 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/133691 Splitting the 'ln_tbl' into two in db98e292 wasn't done thoroughly enough as some references to the old table still remained. This commit fixes the unresolved references by updating to the new split table.

[libclc] [libclc] Move log1p/asinh/acosh/atanh to the CLC library (PR #132956)

2025-04-05 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: Thanks for the heads up, @mgorny - we really need this tested in PRs. I've fixed forward in #133691. https://github.com/llvm/llvm-project/pull/132956 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi

[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] Fix unresolved reference to missing table (PR #133691)

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

[libclc] [libclc][amdgpu] Implement native_exp2 via AMD builtin (PR #133696)

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

[libclc] [libclc] add --only-needed to llvm-link when INTERNALIZE flag is set (PR #130871)

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

[libclc] [libclc] Relicense gen_convert.py (PR #132213)

2025-04-05 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck edited https://github.com/llvm/llvm-project/pull/132213 ___ 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 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]: clspv: add a dummy implememtation for mul_hi (PR #134094)

2025-04-05 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: > > It's a shame we've got such an ugly way of "opting out" of builtins, but I > > don't know if it's worth coming up with a nicer one. > > Yes, I don't think it's worth it right now. > > Could you please submit that PR? Sure thing. One thing I wondered is whether the empt

[libclc] [libclc] Pass -fapprox-func when compiling 'native' builtins (PR #133119)

2025-04-05 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/133119 The libclc build system isn't well set up to pass arbitrary options to arbitrary source files in a non-intrusive way. There isn't currently any other motivating example to warrant rewriting the build system

[libclc] [libclc] Update license headers (PR #132070)

2025-04-05 Thread Fraser Cormack via cfe-commits
@@ -1,24 +1,10 @@ -/* - * Copyright (c) 2015 Advanced Micro Devices, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction

[libclc] [libclc] Move fmin & fmax to CLC library (PR #134218)

2025-04-05 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck updated https://github.com/llvm/llvm-project/pull/134218 >From 583261a0d1fc57ddb8ae964cbaf4f044c39d9bf2 Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Thu, 3 Apr 2025 09:29:28 +0100 Subject: [PATCH 1/2] [libclc] Move fmin & fmax to CLC library This is an alt

[libclc] [libclc] Move log1p/asinh/acosh to the CLC library (PR #132956)

2025-03-25 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck updated https://github.com/llvm/llvm-project/pull/132956 >From 490f34c8fa49666cc4e7af228f71908f6102d76a Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Tue, 25 Mar 2025 13:06:05 + Subject: [PATCH 1/3] [libclc] Move log1p/asinh/acosh to the CLC library The

[libclc] [libclc] Move log1p/asinh/acosh/atanh to the CLC library (PR #132956)

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

[libclc] [libclc] Move asinpi/acospi/atanpi to the CLC library (PR #132918)

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

[libclc] [libclc] Fix commands in compile_to_bc are executed sequentially (PR #130755)

2025-03-26 Thread Fraser Cormack via cfe-commits
@@ -256,19 +261,25 @@ function(add_libclc_builtin_set) get_filename_component( file_dir ${file} DIRECTORY ) +string( REPLACE "/" "-" replaced ${file} ) +set( tgt compile_tgt-${ARG_ARCH_SUFFIX}${replaced}) + compile_to_bc( + TARGET ${tgt} TRIPLE ${

[libclc] [libclc] Fix commands in compile_to_bc are executed sequentially (PR #130755)

2025-03-26 Thread Fraser Cormack via cfe-commits
@@ -63,13 +65,15 @@ function(compile_to_bc) ${ARG_DEPENDENCIES} DEPFILE ${ARG_OUTPUT}.d ) + add_custom_target( ${ARG_TARGET} DEPENDS ${ARG_OUTPUT}${TMP_SUFFIX} ) frasercrmck wrote: I don't think the (possibly) "temp" output (in the case of `.ll` f

[libclc] [libclc] Fix commands in compile_to_bc are executed sequentially (PR #130755)

2025-03-26 Thread Fraser Cormack via cfe-commits
@@ -283,7 +294,7 @@ function(add_libclc_builtin_set) set( builtins_comp_lib_tgt builtins.comp.${ARG_ARCH_SUFFIX} ) add_custom_target( ${builtins_comp_lib_tgt} -DEPENDS ${bytecode_files} +DEPENDS ${compile_tgts} frasercrmck wrote: Do we not need to

[libclc] [libclc] Fix commands in compile_to_bc are executed sequentially (PR #130755)

2025-03-26 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck commented: Sorry, I didn't realise I hadn't published this review from last week! https://github.com/llvm/llvm-project/pull/130755 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mai

[libclc] [libclc] Skip opt command if opt_flags is empty (PR #130882)

2025-03-26 Thread Fraser Cormack via cfe-commits
@@ -342,22 +342,32 @@ function(add_libclc_builtin_set) set( builtins_opt_lib_tgt builtins.opt.${ARG_ARCH_SUFFIX} ) - # Add opt target - add_custom_command( OUTPUT ${builtins_opt_lib_tgt}.bc -COMMAND ${opt_exe} ${ARG_OPT_FLAGS} -o ${builtins_opt_lib_tgt}.bc - ${bu

[libclc] [libclc] Fix commands in compile_to_bc are executed sequentially (PR #130755)

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

[clang] [clang] Introduce elementwise clz/ctz builtins (PR #131995)

2025-03-27 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: ping, thanks https://github.com/llvm/llvm-project/pull/131995 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[libclc] [libclc] Move fmod, remainder & remquo to the CLC library (PR #132054)

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

[libclc] [libclc] Pass -fapprox-func when compiling 'native' builtins (PR #133119)

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

[libclc] [libclc] Move pow, powr & pown to the CLC library (PR #133294)

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

[libclc] libclc: frexp: fix implementation regarding denormals (PR #134823)

2025-04-08 Thread Fraser Cormack via cfe-commits
@@ -26,7 +26,7 @@ __clc_frexp(__CLC_GENTYPE x, __CLC_ADDRESS_SPACE __CLC_INTN *ep) { (ai & (__CLC_INTN)MANTBITS_SP32); __CLC_INTN is_inf_nan_or_zero = - x == __CLC_FP_LIT(0.0) || __clc_isinf(x) || __clc_isnan(x); + ai == (__CLC_INTN)0 || __clc_isinf(x) || __

[libclc] 7d32d72 - [libclc][NFC] Remove blank line at end of file

2025-04-10 Thread Fraser Cormack via cfe-commits
Author: Fraser Cormack Date: 2025-04-10T10:02:51+01:00 New Revision: 7d32d72f10445657f598cbdf1bb5f3040373daf5 URL: https://github.com/llvm/llvm-project/commit/7d32d72f10445657f598cbdf1bb5f3040373daf5 DIFF: https://github.com/llvm/llvm-project/commit/7d32d72f10445657f598cbdf1bb5f3040373daf5.diff

[libclc] [NFC][libclc] Merge atomic extension built-ins with identical name into a single file (PR #134489)

2025-04-08 Thread Fraser Cormack via cfe-commits
@@ -0,0 +1,36 @@ +//===--===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apac

[libclc] [NFC][libclc] Merge atomic extension built-ins with identical name into a single file (PR #134489)

2025-04-08 Thread Fraser Cormack via cfe-commits
@@ -6,7 +6,28 @@ // //===--===// -#include +#include +#include + +// cl_khr_global_int32_base_atomics +#define IMPL(TYPE) \ frasercrmck wrote: This doesn't look clang-formatted. https://

[libclc] [NFC][libclc] Merge atomic extension built-ins with identical name into a single file (PR #134489)

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

[libclc] [NFC][libclc] Merge atomic extension built-ins with identical name into a single file (PR #134489)

2025-04-08 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck commented: Just some general comments, most of which apply to multiple files. In principle I like the change, though - thank you. I also think the idea of making overriding based solely on filename is interesting. https://github.com/llvm/llvm-project/pull/134489

[libclc] [NFC][libclc] Merge atomic extension built-ins with identical name into a single file (PR #134489)

2025-04-08 Thread Fraser Cormack via cfe-commits
@@ -6,7 +6,28 @@ // //===--===// -#include +#include +#include + +// cl_khr_global_int32_base_atomics +#define IMPL(TYPE) \ +_CLC_OVERLOAD _CLC_DEF TYPE atom_cmpxchg(volatile global TYPE *p, TYPE cmp, TYP

[libclc] libclc: frexp: fix implementation regarding denormals (PR #134823)

2025-04-08 Thread Fraser Cormack via cfe-commits
@@ -26,7 +26,7 @@ __clc_frexp(__CLC_GENTYPE x, __CLC_ADDRESS_SPACE __CLC_INTN *ep) { (ai & (__CLC_INTN)MANTBITS_SP32); __CLC_INTN is_inf_nan_or_zero = - x == __CLC_FP_LIT(0.0) || __clc_isinf(x) || __clc_isnan(x); + ai == (__CLC_INTN)0 || __clc_isinf(x) || __

[libclc] libclc: frexp: fix implementation regarding denormals (PR #134823)

2025-04-08 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck approved this pull request. https://github.com/llvm/llvm-project/pull/134823 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[libclc] [libclc] Move fmin & fmax to CLC library (PR #134218)

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

[libclc] libclc: clspv: fma: remove fp16 implementation (PR #135002)

2025-04-10 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/135002 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[libclc] libclc: clspv: fma: remove fp16 implementation (PR #135002)

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

[libclc] [libclc] Move shuffle/shuffle2 to the CLC library (PR #135000)

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

[libclc] [NFC][libclc] Merge atomic extension built-ins with identical name into a single file (PR #134489)

2025-04-10 Thread Fraser Cormack via cfe-commits
@@ -0,0 +1,24 @@ +//===--===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apac

[libclc] [NFC][libclc] Merge atomic extension built-ins with identical name into a single file (PR #134489)

2025-04-10 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck commented: Thanks. It seems like a guard mistake in a header has crept into the new headers. Other than that, LGTM. https://github.com/llvm/llvm-project/pull/134489 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[libclc] [NFC][libclc] Merge atomic extension built-ins with identical name into a single file (PR #134489)

2025-04-10 Thread Fraser Cormack via cfe-commits
@@ -0,0 +1,24 @@ +//===--===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apac

[libclc] [NFC][libclc] Merge atomic extension built-ins with identical name into a single file (PR #134489)

2025-04-10 Thread Fraser Cormack via cfe-commits
@@ -0,0 +1,24 @@ +//===--===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apac

[libclc] [NFC][libclc] Merge atomic extension built-ins with identical name into a single file (PR #134489)

2025-04-10 Thread Fraser Cormack via cfe-commits
@@ -0,0 +1,24 @@ +//===--===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apac

[libclc] [NFC][libclc] Merge atomic extension built-ins with identical name into a single file (PR #134489)

2025-04-10 Thread Fraser Cormack via cfe-commits
@@ -239,54 +239,22 @@ #include #include -/* cl_khr_global_int32_base_atomics Extension Functions */ -#include -#include -#include -#include -#include -#include - -/* cl_khr_global_int32_extended_atomics Extension Functions */ -#include -#include -#include -#include

[libclc] [NFC][libclc] Merge atomic extension built-ins with identical name into a single file (PR #134489)

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

[clang] [clang] Introduce elementwise clz/ctz builtins (PR #131995)

2025-04-10 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: Friendly ping https://github.com/llvm/llvm-project/pull/131995 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[libclc] [libclc] Move shuffle/shuffle2 to the CLC library (PR #135000)

2025-04-09 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/135000 This commit moves the shuffle and shuffle2 builtins to the CLC library. In so doing it makes the headers simpler and re-usable for other builtin layers to hook into the CLC functions, if they wish. An addi

[libclc] libclc: frexp: fix implementation regarding denormals (PR #134823)

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

[libclc] [libclc] Move several 'native' builtins to CLC library (PR #129679)

2025-03-31 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck updated https://github.com/llvm/llvm-project/pull/129679 >From aabdf579b3d88e59f8604943573c9beeafb4cf66 Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Tue, 4 Mar 2025 10:03:00 + Subject: [PATCH 1/3] [libclc] Move several 'native' builtins to CLC library

[libclc] c1efd8b - [libclc][NFC] Delete two unused headers

2025-04-01 Thread Fraser Cormack via cfe-commits
Author: Fraser Cormack Date: 2025-04-01T14:54:50+01:00 New Revision: c1efd8b663b7db3c717fae8a1991dcc4b8304c8f URL: https://github.com/llvm/llvm-project/commit/c1efd8b663b7db3c717fae8a1991dcc4b8304c8f DIFF: https://github.com/llvm/llvm-project/commit/c1efd8b663b7db3c717fae8a1991dcc4b8304c8f.diff

[libclc] 00e6d4f - [libclc][NFC] Delete three unused .inc files

2025-04-01 Thread Fraser Cormack via cfe-commits
Author: Fraser Cormack Date: 2025-04-01T17:36:01+01:00 New Revision: 00e6d4fe064bb48e16c1eda018e6ed5e9f99cba9 URL: https://github.com/llvm/llvm-project/commit/00e6d4fe064bb48e16c1eda018e6ed5e9f99cba9 DIFF: https://github.com/llvm/llvm-project/commit/00e6d4fe064bb48e16c1eda018e6ed5e9f99cba9.diff

<    1   2   3   4   5   6   >