[libclc] [libclc] Have all targets build all CLC functions (PR #124779)

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

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

2025-02-10 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: > There are a couple of things I thought I'd leave to the PR discussion, like: > > * Should we standardise the diagnostics a bit better? Specifically with > regards to whether the possibility of "vector" needs to be made explicit when > we say `a floating point type`, `a

[libclc] [libclc] Allow default path when looking for llvm-spirv (PR #126071)

2025-02-06 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck commented: I get where this is coming from, thanks. However, note that with this change, the priority is changed so that `llvm-spirv` will be picked up from the PATH environment variable *before* `LLVM_TOOLS_BINARY_DIR`. See the documentation for [find_program]

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

2025-02-06 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: > The amdgpu customization should be removed. This is legacy code from before > we had the ldexp intrinsic. Regular __builtin_ldexp* should work now Good to know, thanks. No one else in libclc is using `__builtin_ldexp`, so in its current form it'd still have to be some sort

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

2025-02-06 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/126078 This function was already conceptually in the CLC namespace - this just formally moves it over. Note however that this commit marks a change in how libclc functions may be overridden by targets. Until now

[libclc] [libclc] Allow default path when looking for llvm-spirv (PR #126071)

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

[libclc] [libclc] Have all targets build all CLC functions (PR #124779)

2025-02-06 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck updated https://github.com/llvm/llvm-project/pull/124779 >From 06dec25da892c6b32f1c3c9f99ab31035165101e Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Tue, 28 Jan 2025 16:17:14 + Subject: [PATCH] [libclc] Have all targets build all CLC functions This rem

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

2025-02-06 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: > > Would we ideally have an `__builtin_elementwise_ldexp` to target the vector > > intrinsics directly? > > Yes 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? https://github.com/llvm/llvm-pr

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

2025-02-05 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: > This PR has me thinking about a related problem. > > In HLSL we have elementwise builtins like `__builtin_hlsl_elementwise_frac`. > We do not add the `CustomTypeChecking` attribute to these builtins. This puts > us down the variadic type check rules for scalar inputs to th

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

2025-02-11 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck updated https://github.com/llvm/llvm-project/pull/124727 >From c0252c8da6fb4ae68699a7e6fc38ed7c643338e8 Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Mon, 11 Nov 2024 15:46:56 + Subject: [PATCH 1/2] [libclc] Move conversion builtins to the CLC library T

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

2025-02-11 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck closed 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 sign to the CLC builtins library (PR #115699)

2025-02-11 Thread Fraser Cormack via cfe-commits
@@ -0,0 +1,21 @@ +// TYPE sign(TYPE x) { +// if (isnan(x)) { +// return 0.0F; +// } +// if (x > 0.0F) { +// return 1.0F; +// } +// if (x < 0.0F) { +// return -1.0F; +// } +// return x; /* -0.0 or +0.0 */ +// } +_CLC_DEF _CLC_OVERLOAD __CLC_GENTYPE __clc_s

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

2025-02-11 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck updated https://github.com/llvm/llvm-project/pull/115699 >From 44adfb0225e0f96462bdf79371e9d16a37595c0c Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Thu, 7 Nov 2024 12:40:56 + Subject: [PATCH] [libclc] Move sign to the CLC builtins library This patch n

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

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

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

2025-02-12 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/126905 While working on moving the conversion builtins to the CLC library in 25c05541 it was discovered that many weren't passing the OpenCL-CTS tests. As it happens, the clspv-specific code for conversion impleme

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

2025-02-12 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: CC @rjodinchr. I remember you saying you're OOO so no pressure, but perhaps you could verify this commit with clspv? For clarity, the remaining failures I see are, e.g., ``` Error for vector size 1 found at 0x0001: *-0x0p+0 vs 0x0p+0 Input value: -0x1.02p-25 (conve

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

2025-02-12 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/126908 The libclc headers are an implementation detail and are not intended to be used by others as OpenCL headers. The only artifacts of libclc we want to publish are the LLVM bytecode libraries. As the headers

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

2025-02-12 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: CC @KarolHerbst. 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 conversion builtins to the CLC library (PR #124727)

2025-02-12 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: I'm seeing several (82 out of 1045) conversions failures in the OpenCL-CTS. It's in saturating conversions from floating-point types to integers, and in regular float-to-float conversions. It isn't a result of this PR as they are already present on `main`. I will merge this

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

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

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

2025-01-29 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck edited 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 sign to the CLC builtins library (PR #115699)

2025-01-29 Thread Fraser Cormack via cfe-commits
@@ -0,0 +1,21 @@ +// TYPE sign(TYPE x) { +// if (isnan(x)) { +// return 0.0F; +// } +// if (x > 0.0F) { +// return 1.0F; +// } +// if (x < 0.0F) { +// return -1.0F; +// } +// return x; /* -0.0 or +0.0 */ +// } +_CLC_DEF _CLC_OVERLOAD __CLC_GENTYPE __clc_s

[libclc] [libclc] Move (add|sub)_sat to CLC; optimize (PR #124903)

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

[libclc] [libclc] Move (add|sub)_sat to CLC; optimize (PR #124903)

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

[libclc] [libclc] Move (add|sub)_sat to CLC; optimize (PR #124903)

2025-01-29 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/124903 Using the __builtin_elementwise_(add|sub)_sat functions allows us to directly optimize to the desired intrinsic, and avoid scalarization for vector types. >From f4570c42ea9adf6b10a911fd57d3152ad6f5c1e4 Mon

[libclc] [libclc] Remove use of symlinks (PR #125069)

2025-01-30 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: FYI/CC @rjodinchr @karolherbst https://github.com/llvm/llvm-project/pull/125069 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[libclc] [libclc] Remove use of symlinks (PR #125069)

2025-01-30 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/125069 Symlinks are problematic on some systems. They aren't strictly necessary as we already have build infrastructure to 'alias' multiple targets' source directories together, as nvptx/nvptx64 has been doing. T

[libclc] [libclc] Remove use of symlinks (PR #125069)

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

[libclc] [libclc] Remove use of symlinks (PR #125069)

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

[clang] [clang] Fix sub-integer __builtin_elementwise_(add|sub)_sat (PR #119423)

2024-12-11 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: > I thought bitreverse/popcount are only supposed to work with unsigned types? Good question. The [documentation](https://clang.llvm.org/docs/LanguageExtensions.html) doesn't mention they're only for signed types, as `abs` does, for example. So if there is such a restrictio

[clang] [clang] Fix sub-integer __builtin_elementwise_(add|sub)_sat (PR #119423)

2024-12-11 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: I just realised this is also a problem with the `bitreverse` and `popcount` builtins on signed types for the same reason. https://github.com/llvm/llvm-project/pull/119423 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https

[libclc] [libclc] Optimize ceil/fabs/floor/rint/trunc (PR #119596)

2024-12-11 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/119596 These functions all map to the corresponding LLVM intrinsics, but the vector intrinsics weren't being generated. The intrinsic mapping from CLC vector function to vector intrinsic was working correctly, but

[libclc] [libclc] Optimize ceil/fabs/floor/rint/trunc (PR #119596)

2024-12-11 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: CC @rjodinchr, @karolherbst https://github.com/llvm/llvm-project/pull/119596 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix sub-integer __builtin_elementwise_(add|sub)_sat (PR #119423)

2024-12-10 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/119423 These builtins would unconditionally perform the usual arithmetic conversions on promotable scalar integer arguments. This meant in practice that char and short arguments were promoted to int, and the opera

[clang] [clang] Fix sub-integer __builtin_elementwise_(add|sub)_sat (PR #119423)

2024-12-12 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: > Even with this fix, the behavior with mixed types still seems really > confusing, especially if you mix signed/unsigned inputs. Can we address that > somehow? I totally agree. The (elementwise) builtins won't let you mix `ext_vector_type`s of different signs or element s

[libclc] [libclc] Optimize ceil/fabs/floor/rint/trunc (PR #119596)

2024-12-12 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck updated https://github.com/llvm/llvm-project/pull/119596 >From 68df2622a3ca1b98a0cbf1fc9e6200e12fecbb2e Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Wed, 11 Dec 2024 17:28:38 + Subject: [PATCH 1/2] [libclc] Optimize ceil/fabs/floor/rint/trunc These fun

[libclc] [libclc] Optimize ceil/fabs/floor/rint/trunc (PR #119596)

2024-12-12 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: > LGTM. I'm not sure how this all ends up expanding, I was expecting to see the > elementwise builtins used. Yes, I suspect that this code originates from before the builtins were available? The builtins would probably make more sense, tbh. The current method is that we hav

[libclc] [libclc] Optimize ceil/fabs/floor/rint/trunc (PR #119596)

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

[libclc] [libclc] Optimize ceil/fabs/floor/rint/trunc (PR #119596)

2024-12-12 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: > > which in its header uses this strange **asm** method of calling LLVM > > intrinsics directly. > > That's something that's always surprised me it works. It's rather unsafe (you > can bypass immarg validation for instance). Plus asm callsites get infected > with overly co

[clang] [clang] Fix sub-integer __builtin_elementwise_(add|sub)_sat (PR #119423)

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

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

2024-12-18 Thread Fraser Cormack via cfe-commits
@@ -6,7 +6,7 @@ // CHECK: %conv2 = fptrunc double %hlsl.dot to float // CHECK: ret float %conv2 float builtin_bool_to_float_type_promotion ( float p0, bool p1 ) { - return __builtin_hlsl_dot ( p0, p1 ); + return __builtin_hlsl_dot ( (double)p0, (double)p1 );

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

2024-12-18 Thread Fraser Cormack via cfe-commits
@@ -68,15 +66,18 @@ void test_builtin_elementwise_add_sat(float f1, float f2, double d1, double d2, long long int i2, si8 vi1, si8 vi2, unsigned u1, unsigned u2, u4 vu1, u4 vu2,

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

2024-12-18 Thread Fraser Cormack via cfe-commits
@@ -6,7 +6,7 @@ // CHECK: %conv2 = fptrunc double %hlsl.dot to float // CHECK: ret float %conv2 float builtin_bool_to_float_type_promotion ( float p0, bool p1 ) { - return __builtin_hlsl_dot ( p0, p1 ); + return __builtin_hlsl_dot ( (double)p0, (double)p1 );

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

2024-12-18 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

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

2024-12-18 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] Move several integer functions to CLC library (PR #116786)

2024-12-17 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck updated https://github.com/llvm/llvm-project/pull/116786 >From 65713ca581a83261e888feb7a96c76d1525d223b 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

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

2024-12-17 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: @arsenm are you happy for this to be merged? 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

[clang] [clang] Fix sub-integer __builtin_elementwise_(add|sub)_sat (PR #119423)

2024-12-18 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: RFC: https://discourse.llvm.org/t/rfc-change-behaviour-of-elementwise-builtins-on-scalar-integer-types/83725. I don't expect anyone to say anything at all, tbh, especially during the holidays. > If people aren't using the edge cases, they won't notice if we start > error'i

[libclc] [libclc] Optimize ceil/fabs/floor/rint/trunc (PR #119596)

2024-12-13 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck closed https://github.com/llvm/llvm-project/pull/119596 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[libclc] [libclc] Route int bitselect through CLC; add half (PR #123653)

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

[libclc] [libclc] Route select through __clc_select (PR #123647)

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

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

2025-01-22 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck updated https://github.com/llvm/llvm-project/pull/115699 >From 8144673e0338acefe13fac0c20bbaba0412b8239 Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Thu, 7 Nov 2024 12:40:56 + Subject: [PATCH 1/4] [libclc] Move sign to the CLC builtins library This pat

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

2025-01-22 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck edited 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 several integer functions to CLC library (PR #116786)

2025-01-22 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: The updated version of this patch removes the SPIR-V header workarounds, and optimizes the `upsample` and `mul_hi` implementations for vector types. All the integer functions in this patch now avoid scalarization. https://github.com/llvm/llvm-project/pull/116786 ___

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

2025-01-22 Thread Fraser Cormack via cfe-commits
@@ -0,0 +1,21 @@ +#ifndef __CLC_INTEGER_CLC_CLZ_H__ +#define __CLC_INTEGER_CLC_CLZ_H__ + +#if defined(CLC_CLSPV) || defined(CLC_SPIRV) +// clspv and spir-v targets provide their own OpenCL-compatible clz +#define __clc_clz clz frasercrmck wrote: @arsenm I've upda

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

2025-01-22 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck edited 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] Don't rely on pragma guards in headers (PR #122751)

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

[libclc] [libclc] Don't rely on fp16 pragma guards in headers (PR #122751)

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

[libclc] [libclc] Don't rely on fp16 pragma guards in headers (PR #122751)

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

[libclc] [libclc] Don't rely on fp16 pragma guards in headers (PR #122751)

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

[libclc] [libclc] Move nextafter to the CLC library (PR #124097)

2025-01-23 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/124097 There were two implementations of this - one that implemented nextafter in software, and another that called a clang builtin. No in-tree targets called the builtin, so all targets build the software version

[libclc] [libclc] Move nextafter to the CLC library (PR #124097)

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

[libclc] [libclc] Optimize isfpclass-like CLC builtins (PR #124145)

2025-01-23 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/124145 Using __builtin_isfpclass helps us to avoid scalarization in the vector forms of __clc_is(finite|inf|nan|normal) (and thus their OpenCL counterparts). >From 738122e2345bc750dfa40774f56ba5415b61750e Mon Sep

[libclc] [libclc] Optimize isfpclass-like CLC builtins (PR #124145)

2025-01-23 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: > How does using isfpclass avoid scalarization here? I think it's somewhat > preferably to use the named operations here, they are subtly different since > they canonicalize the input unlike is.fpclass The builtins we were using before, like `__builtin_isnan`, don't take vec

[libclc] [libclc] Optimize isfpclass-like CLC builtins (PR #124145)

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

[libclc] 8b7bfb4 - [libclc] Rename include guards. NFC.

2025-01-20 Thread Fraser Cormack via cfe-commits
Author: Fraser Cormack Date: 2025-01-20T11:26:02Z New Revision: 8b7bfb417a220822ddd8231e58dcd785d8d96aed URL: https://github.com/llvm/llvm-project/commit/8b7bfb417a220822ddd8231e58dcd785d8d96aed DIFF: https://github.com/llvm/llvm-project/commit/8b7bfb417a220822ddd8231e58dcd785d8d96aed.diff LOG

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

2025-01-20 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: ping 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] Route int bitselect through CLC; add half (PR #123653)

2025-01-20 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/123653 The half variants were missing. The integer bitselect builtins weren't going through __clc_bitselect due to an oversight when the CLC version was introduced. >From d885c214c83bae79fa6d66c5c223e0d6ae972f3b M

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

2025-01-20 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck updated https://github.com/llvm/llvm-project/pull/115699 >From 9c5f79e720d0701d17f9d128b358320401baf666 Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Thu, 7 Nov 2024 12:40:56 + Subject: [PATCH 1/2] [libclc] Move sign to the CLC builtins library This pat

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

2025-01-20 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: @arsenm I've just updated this PR. It still moves the `sign` implementation to the CLC library but now also optimizes it for vector types. There's no control flow nor scalarizing for vectors. I trust this will be a good enough default for the scalar form (on GPUs) though I s

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

2025-01-20 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck updated https://github.com/llvm/llvm-project/pull/115699 >From 9c5f79e720d0701d17f9d128b358320401baf666 Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Thu, 7 Nov 2024 12:40:56 + Subject: [PATCH 1/3] [libclc] Move sign to the CLC builtins library This pat

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

2025-01-20 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: I'll look into undoing the CMake changes and building the dependent CLC functions for SPIR-V targets later on. https://github.com/llvm/llvm-project/pull/115699 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.ll

[libclc] [libclc] Move mad to the CLC library (PR #123607)

2025-01-20 Thread Fraser Cormack via cfe-commits
@@ -0,0 +1,4 @@ +_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __clc_mad(__CLC_GENTYPE a, __CLC_GENTYPE b, + __CLC_GENTYPE c) { + return a * b + c; frasercrmck wrote: Good idea - done. The default is `ON` so we shouldn't exp

[libclc] [libclc] Route select through __clc_select (PR #123647)

2025-01-20 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/123647 This was missed during the introduction of select. This also unifies the various .inc files used for each, as they were essentially identical. The __clc_select function is now also built for SPIR-V targets.

[libclc] [libclc] Move mad to the CLC library (PR #123607)

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

[libclc] [libclc] Optimize CLC vector is(un)ordered builtins (PR #124546)

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

[libclc] [libclc] Optimize CLC vector relational builtins (PR #124537)

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

[libclc] [libclc] Optimize CLC vector is(un)ordered builtins (PR #124546)

2025-01-27 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/124546 These are similar to 347fb208, but these builtins are expressed in terms of other builtins. The LLVM IR generated features the same fcmp ord/uno comparisons as before, but consistently in vector form. >Fro

[libclc] [libclc] Optimize CLC vector is(un)ordered builtins (PR #124546)

2025-01-27 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: Apologies for the noise - these arguably should have been part of #124537. https://github.com/llvm/llvm-project/pull/124546 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-c

[libclc] [libclc] Optimize CLC vector relational builtins (PR #124537)

2025-01-27 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/124537 Clang knows how to perform relational operations on OpenCL vectors, so we don't need to use the Clang builtins. The builtins we were using didn't support vector types, so we were previously scalarizing. Th

[libclc] [libclc] Optimize isfpclass-like CLC builtins (PR #124145)

2025-01-27 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck updated https://github.com/llvm/llvm-project/pull/124145 >From 0186cf20e0abb8c5bca9e830d2b6d4e425c7bcc9 Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Thu, 23 Jan 2025 12:24:49 + Subject: [PATCH] [libclc] Optimize isfpclass-like CLC builtins Using __buil

[libclc] [libclc] Optimize CLC vector any/all builtins (PR #124568)

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

[libclc] [libclc] Move copysign to CLC library; optimize & fix (PR #124598)

2025-01-27 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/124598 This commit moves the implementation of the copysign builtin to the CLC library. It simultaneously optimizes it for vector types by avoiding scalarization. It does so by using the __builtin_elementwise_copy

[libclc] [libclc] Move copysign to CLC library; fix & optimize (PR #124598)

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

[libclc] [libclc] Move copysign to CLC library; fix & optimize (PR #124598)

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

[libclc] [libclc] Optimize isfpclass-like CLC builtins (PR #124145)

2025-01-27 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck updated https://github.com/llvm/llvm-project/pull/124145 >From 66f750c34d702f762540c5e3fcca688766d7b165 Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Thu, 23 Jan 2025 12:24:49 + Subject: [PATCH] [libclc] Optimize isfpclass-like CLC builtins Using __buil

[libclc] [libclc] Optimize CLC vector any/all builtins (PR #124568)

2025-01-27 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/124568 By using the vector reduction buitins we can avoid scalarization. Targets that don't support vector reductions will scalarize later on anyway. The vector reduction builtins should be well-enough supported b

[libclc] [libclc] Move copysign to CLC library; fix & optimize (PR #124598)

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

[libclc] [libclc][NFC] Move key math headers to CLC (PR #124739)

2025-01-28 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck closed https://github.com/llvm/llvm-project/pull/124739 ___ 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: CC @rjodinchr - are you able to test this PR out for your needs, by any chance? It's quite intrusive so I'd like to be extra sure I haven't broken anything. https://github.com/llvm/llvm-project/pull/124727 ___ cfe-commits mailing li

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

2025-01-28 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/124727 This commit moves the implementations of conversion builtins to the CLC library. It keeps the dichotomy of regular vs. clspv implementations of the conversions. However, for the sake of a consistent interface

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

2025-01-28 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck updated https://github.com/llvm/llvm-project/pull/124727 >From c87a1e7c0bd087241f4c9d16d9d115654e2bd85f Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Thu, 7 Nov 2024 12:40:56 + Subject: [PATCH 1/6] [libclc] Move sign to the CLC builtins library This pat

[libclc] [libclc][NFC] Move key math headers to CLC (PR #124739)

2025-01-28 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/124739 None >From bb84fecc07aaaf1c191109651113e2618132a9ce Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Tue, 28 Jan 2025 12:44:47 + Subject: [PATCH] [libclc][NFC] Move key math headers to CLC --- .../

[libclc] [libclc][NFC] Move key math headers to CLC (PR #124739)

2025-01-28 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: This should help to take the "noise" out of any future PRs that move maths-related code to the CLC library. https://github.com/llvm/llvm-project/pull/124739 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.

[libclc] libclc: clspv: add missing clc_isnan.cl dependency (PR #124614)

2025-01-28 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: Sorry about that! Should `spirv/SOURCES` and `spirv64/SOURCES` receive the same thing? https://github.com/llvm/llvm-project/pull/124614 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/l

[libclc] libclc: clspv: add missing clc_isnan.cl dependency (PR #124614)

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

[libclc] [libclc] Optimize isfpclass-like CLC builtins (PR #124145)

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

[libclc] [libclc] Have all targets build all CLC functions (PR #124779)

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

[libclc] [libclc] Have all targets build all CLC functions (PR #124779)

2025-01-28 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/124779 This removes all remaining SPIR-V workarounds for CLC functions, in an effort to streamline the CLC implementation and prevent further issues that #124614 had to fix. This commit fixes the same issue for th

[libclc] bb95335 - [libclc][NFC] Clang-format includes

2025-01-28 Thread Fraser Cormack via cfe-commits
Author: Fraser Cormack Date: 2025-01-28T18:00:25Z New Revision: bb95335982774c187984c4465202242b9d70cdb3 URL: https://github.com/llvm/llvm-project/commit/bb95335982774c187984c4465202242b9d70cdb3 DIFF: https://github.com/llvm/llvm-project/commit/bb95335982774c187984c4465202242b9d70cdb3.diff LOG

<    1   2   3   4   5   6   >