[libclc] [libclc] Move conversion builtins to the CLC library (PR #124727)

2025-01-28 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: > In fact my setup was busted. In the end it seems to work without change. Thanks! Just for reference, is it just clspv's `check-spirv` you were running to test? Anything else I should be aware of? https://github.com/llvm/llvm-project/pull/124727

[libclc] [libclc] Move sign to the CLC builtins library (PR #115699)

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

[libclc] [libclc] Move conversion builtins to the CLC library (PR #124727)

2025-01-28 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: > I think for `clspv`, we would need to invert the condition to skip > user-facing functions. By that I mean that `clspv` will need all the > `convert_*` functions, and not the `__clc_convert_*_rte`. Then we will need > to update `clspv` to support natively the function with

[libclc] [libclc] Move several integer functions to CLC library (PR #116786)

2025-01-29 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck updated https://github.com/llvm/llvm-project/pull/116786 >From 00f8980411e74a3071e6efbf553f78363ac92bb2 Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Tue, 17 Dec 2024 16:52:51 + Subject: [PATCH] [libclc] Move several integer functions to CLC library Thi

[clang] [clang] Restrict the use of scalar types in vector builtins (PR #119423)

2025-01-29 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: > LLVM Buildbot has detected a new failure on builder > `llvm-clang-aarch64-darwin` running on `doug-worker-4` while building `clang` > at step 6 "test-build-unified-tree-check-all". > > Full details are available at: > https://lab.llvm.org/buildbot/#/builders/190/builds/13

[libclc] [libclc] Move fp16 pragma guards out of header file (PR #122751)

2025-01-14 Thread Fraser Cormack via cfe-commits
@@ -207,10 +207,6 @@ return BUILTIN(x); \ } -#ifdef cl_khr_fp16 - -#pragma OPENCL EXTENSION cl_khr_fp16 : enable - #define _CLC_DEFINE_UNARY_BUILTIN_FP16(FUNCTION) \ _CLC_DEF _CLC

[libclc] [libclc] Move fp16 pragma guards out of header file (PR #122751)

2025-01-14 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck updated https://github.com/llvm/llvm-project/pull/122751 >From 4dd89f2be8e80797a8e921145339ac2716505830 Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Mon, 13 Jan 2025 17:29:06 + Subject: [PATCH 1/2] [libclc] Move fp16 pragma guards out of header file Ha

[libclc] [libclc] Move fp16 pragma guards out of header file (PR #122751)

2025-01-14 Thread Fraser Cormack via cfe-commits
@@ -207,10 +207,6 @@ return BUILTIN(x); \ } -#ifdef cl_khr_fp16 - -#pragma OPENCL EXTENSION cl_khr_fp16 : enable - #define _CLC_DEFINE_UNARY_BUILTIN_FP16(FUNCTION) \ _CLC_DEF _CLC

[libclc] [libclc] Move fp16 pragma guards out of header file (PR #122751)

2025-01-13 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/122751 Having the fp16 pragmas enabled in the header file is risky, as we have some headers that also disable pragmas. We want to be as immune to changes in the order of included header files as possible. This pa

[libclc] [libclc] Move several integer functions to CLC library (PR #116786)

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

[libclc] [libclc] Move smoothstep to CLC and optimize its codegen (PR #123183)

2025-01-16 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/123183 This commit moves the implementation of the smoothstep function to the CLC library, whilst optimizing the codegen. This commit also adds support for 'half' versions of smoothstep, which were previously mis

[libclc] [libclc] Move smoothstep to CLC and optimize its codegen (PR #123183)

2025-01-16 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: Here's an example of the difference in LLVM IR for `smoothstep(double16, double16, double16)`: https://godbolt.org/z/P9sM3Wjjn https://github.com/llvm/llvm-project/pull/123183 ___ cfe-commits mailing list cfe-commits@lists.llvm.or

[libclc] [libclc] Move smoothstep to CLC and optimize its codegen (PR #123183)

2025-01-16 Thread Fraser Cormack via cfe-commits
@@ -0,0 +1,52 @@ +/* frasercrmck wrote: I wasn't sure if the AMD copyright still applies to this copied file, so I kept it. https://github.com/llvm/llvm-project/pull/123183 ___ cfe-commits mailing list cfe-commits@lis

[libclc] [libclc] Move smoothstep to CLC and optimize its codegen (PR #123183)

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

[libclc] [libclc] Move degrees/radians to CLC library & optimize (PR #123222)

2025-01-16 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/123222 Missing half variants were also added. The builtins are now consistently emitted in vector form (i.e., with a splat of the literal to the appropriate vector size). >From abe207cb6b90597a4f90a1db922c63ceb97

[libclc] [libclc] Move degrees/radians to CLC library & optimize (PR #123222)

2025-01-16 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: I wasn't able to verify the `half` variants with the OpenCL CTS for some obscure CTS reason. Given that they're just casting the double literal to half I think they're almost certainly correct. https://github.com/llvm/llvm-project/pull/123222

[libclc] [libclc] Move degrees/radians to CLC library & optimize (PR #123222)

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

[clang] [llvm] [BasicAA] Do not decompose past casts with different index width (PR #119365)

2025-01-09 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: > @frasercrmck BasicAA returns MayAlias for your example. Presumably AMDGPUAA > returns NoAlias because addrspace(3) and addrspace(0) can't alias, or > something like that. Yep, you're right, sorry for the false alarm. Because it's a `amdgpu_kernel` function and `A` (`%incd

[clang] [clang] Restrict use of scalar types in vector builtins (PR #119423)

2025-01-09 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck updated https://github.com/llvm/llvm-project/pull/119423 >From 3f007d702922db63e128e3c0f72dff2f600e0879 Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Tue, 10 Dec 2024 17:41:07 + Subject: [PATCH 1/8] [clang] Fix sub-integer __builtin_elementwise_(add|sub

[clang] [clang] Restrict use of scalar types in vector builtins (PR #119423)

2025-01-09 Thread Fraser Cormack via cfe-commits
@@ -14604,57 +14611,63 @@ bool Sema::PrepareBuiltinElementwiseMathOneArgCall(CallExpr *TheCall) { } bool Sema::BuiltinElementwiseMath(CallExpr *TheCall, bool FPOnly) { - QualType Res; - if (BuiltinVectorMath(TheCall, Res, FPOnly)) -return true; - TheCall->setType(Res);

[clang] [clang] Restrict use of scalar types in vector builtins (PR #119423)

2025-01-09 Thread Fraser Cormack via cfe-commits
@@ -14585,11 +14585,18 @@ void Sema::CheckAddressOfPackedMember(Expr *rhs) { _2, _3, _4)); } +static ExprResult UsualUnaryConversionsNoPromoteInt(Sema &S, Expr *E) { + // Don't promote integer types + if (QualType Ty = E->getType(); S.getASTContext().is

[clang] [clang] Restrict use of scalar types in vector builtins (PR #119423)

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

[libclc] [libclc] Add missing includes to CLC headers (PR #118654)

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

[libclc] [libclc] Move __clc_ldexp to CLC library (PR #126078)

2025-02-13 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: > > I'll go add that builtin and come back to this - thanks. > > What do you think about libclc making use of weak linkage in principle? > > Weak should be handled properly by the targets, the one downside is that it > prevents optimization within a TU because the symbol's in

[libclc] [libclc] Move __clc_ldexp to CLC library (PR #126078)

2025-02-13 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: Oh, also for context, there was https://github.com/llvm/llvm-project/pull/124709 a few weeks ago. So it appears that there are other people interested in moving libclc to the runtimes infrastructure. https://github.com/llvm/llvm-project/pull/126078 _

[libclc] [libclc] Fix int<->float conversion builtins (PR #126905)

2025-02-13 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: > Do we really need to generate source for this? It's harder to reason about. > It looks like the sign bit of the input isn't preserved on underflow to 0 Perhaps we could simply check in the generated source? It shouldn't change all that often. We might want to split it up i

[libclc] [libclc] [cmake] Fix per-target *_convert.cl dependencies (PR #127315)

2025-02-15 Thread Fraser Cormack via cfe-commits
@@ -249,13 +249,19 @@ function(add_libclc_builtin_set) get_filename_component( file_dir ${file} DIRECTORY ) +if( ARG_ARCH STREQUAL spirv OR ARG_ARCH STREQUAL spirv64 ) + set(CONVERT_DEP clspv-generate_convert.cl) +else() + set(CONVERT_DEP generate_conver

[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

<    1   2   3   4   5   6   7   8   >