[libclc] [libclc] Optimize generic CLC fmin/fmax (PR #128506)

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

[libclc] [libclc] Optimize generic CLC fmin/fmax (PR #128506)

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

[libclc] [libclc] Move fdim to CLC library; simplify (PR #137811)

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

[libclc] [libclc] Support the generic address space (PR #137183)

2025-04-29 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck updated https://github.com/llvm/llvm-project/pull/137183 >From 253bbc8cf673dd1d0ca606058dbd26e15cee651a Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Thu, 24 Apr 2025 11:24:30 +0100 Subject: [PATCH 1/2] [libclc] Support the generic address space This commit

[libclc] 6ffccea - [libclc][NFC] Remove binary_decl_tt.inc

2025-04-29 Thread Fraser Cormack via cfe-commits
Author: Fraser Cormack Date: 2025-04-29T15:48:46+01:00 New Revision: 6ffccea1c2b804d530c0f7bf3cc92db42b4432c5 URL: https://github.com/llvm/llvm-project/commit/6ffccea1c2b804d530c0f7bf3cc92db42b4432c5 DIFF: https://github.com/llvm/llvm-project/commit/6ffccea1c2b804d530c0f7bf3cc92db42b4432c5.diff

[libclc] [libclc] Avoid casting NANs & literals to 'gentype' (PR #137824)

2025-04-29 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/137824 By having these already defined as type 'gentype' we can avoid unnecessary casting. >From 662f8881d3da88714231b9a232a6006ae834b3b7 Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Tue, 29 Apr 2025 16:05

[libclc] [libclc] Avoid casting NANs & literals to 'gentype' (PR #137824)

2025-04-29 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck updated https://github.com/llvm/llvm-project/pull/137824 >From abb52892c044ca1883cc41d97c3edf08aafc9746 Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Tue, 29 Apr 2025 16:05:19 +0100 Subject: [PATCH] [libclc] Avoid casting NANs & literals to 'gentype' By hav

[libclc] [libclc] Avoid casting NANs & literals to 'gentype' (PR #137824)

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

[libclc] [libclc] Suppress data-layout warnings during linking (PR #127532)

2025-02-17 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/127532 libclc uses llvm-link to link together all of the individually built libclc builtins files into one module. Some of these builtins files are compiled from source by clang whilst others are converted from LL

[libclc] [libclc] Suppress data-layout warnings during linking (PR #127532)

2025-02-17 Thread Fraser Cormack via cfe-commits
@@ -1,8 +1,4 @@ -#if __clang_major__ >= 7 -target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5" -#else -target datalayout = "e-p:32:32-p1:64

[libclc] [libclc] Fix dependencies on generated convert builtins (PR #127515)

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

[libclc] [libclc] Fix dependencies on generated convert builtins (PR #127515)

2025-02-17 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/127515 In #127378 it was reported that builds without clspv targets enabled were failing after #124727, as all targets had a dependency on a file that only clspv targets generated. A quick fix was merged in #1273

[libclc] [libclc] Improve nextafter behaviour around zero (PR #127469)

2025-02-19 Thread Fraser Cormack via cfe-commits
@@ -13,19 +13,25 @@ const UINT_TYPE sign_bit = (UINT_TYPE)1 \ << (sizeof(INT_TYPE_SCALAR) * 8 - 1); \ const UINT_TYPE sign_bit_mask = sign_bit - (UINT_TYPE)1; \ -INT_TYP

[libclc] [libclc] Improve nextafter behaviour around zero (PR #127469)

2025-02-19 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck updated https://github.com/llvm/llvm-project/pull/127469 >From dbe1d8d133a54d0353fdb466cd59f5931d670bbf Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Mon, 17 Feb 2025 10:17:44 + Subject: [PATCH 1/2] [libclc] Improve nextafter behaviour around zero This

[libclc] [libclc] Improve nextafter behaviour around zero (PR #127469)

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

[libclc] [libclc] Clean up directory search procedure (PR #127783)

2025-02-19 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/127783 During a recent change, the build system accidentally dropped the (theoretical) support for the CLC builtins library to build target-specific builtins from the 'amdgpu' directory, due to a change in variabl

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

2025-02-18 Thread Fraser Cormack via cfe-commits
@@ -12411,16 +12411,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] Use CLC conversion builtins in CLC functions (PR #127628)

2025-02-18 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/127628 This commit is a broad update across libclc to use the CLC conversion builtins in CLC functions, even those with a '__clc' prefix in the generic folder. This better prepares them for an official move to the

[libclc] [libclc] Suppress data-layout warnings during linking (PR #127532)

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

[libclc] [libclc] Suppress data-layout warnings during linking (PR #127532)

2025-02-18 Thread Fraser Cormack via cfe-commits
@@ -1,8 +1,4 @@ -#if __clang_major__ >= 7 -target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5" -#else -target datalayout = "e-p:32:32-p1:64

[libclc] [libclc] Disable external-calls testing for clspv targets (PR #127529)

2025-02-18 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: Just one failure: ``` Timed Out Tests (1): MLIR :: Examples/standalone/test.toy Total Discovered Tests: 131804 Skipped : 48 (0.04%) Unsupported : 2855 (2.17%) Passed : 128580 (97.55%) Expectedly Failed:320 (0.24

[libclc] [libclc] Suppress data-layout warnings during linking (PR #127532)

2025-02-18 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck updated https://github.com/llvm/llvm-project/pull/127532 >From 2004d2a93073273cd7e09fbf6da6de7972412e98 Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Mon, 17 Feb 2025 18:04:08 + Subject: [PATCH] [libclc] Suppress data-layout warnings during linking libc

[libclc] [libclc] Suppress data-layout warnings during linking (PR #127532)

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

[libclc] [libclc] Suppress data-layout warnings during linking (PR #127532)

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

[libclc] [libclc] Use CLC conversion builtins in CLC functions (PR #127628)

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

[libclc] 378c6fb - [libclc][NFC] Rename macro; undef at end of file

2025-02-18 Thread Fraser Cormack via cfe-commits
Author: Fraser Cormack Date: 2025-02-18T14:56:25Z New Revision: 378c6fbe330e6de2feac8a8e3bc0c93ec6aca80d URL: https://github.com/llvm/llvm-project/commit/378c6fbe330e6de2feac8a8e3bc0c93ec6aca80d DIFF: https://github.com/llvm/llvm-project/commit/378c6fbe330e6de2feac8a8e3bc0c93ec6aca80d.diff LOG

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

2025-02-18 Thread Fraser Cormack via cfe-commits
@@ -12411,16 +12411,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

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

2025-02-18 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] Suppress data-layout warnings during linking (PR #127532)

2025-02-18 Thread Fraser Cormack via cfe-commits
@@ -1,8 +1,4 @@ -#if __clang_major__ >= 7 -target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5" -#else -target datalayout = "e-p:32:32-p1:64

[libclc] [libclc] Disable external-calls testing for clspv targets (PR #127529)

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

[libclc] [libclc] Disable external-calls testing for clspv targets (PR #127529)

2025-02-17 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/127529 These targets don't include all OpenCL builtins, so there will always be external calls in the final bytecode module. Fixes #127316. >From 3b172c687e3c276eea4489a39de5ed285c8ddd0e Mon Sep 17 00:00:00 2001

[libclc] [libclc] Move fma to the CLC library (PR #126052)

2025-02-19 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck updated https://github.com/llvm/llvm-project/pull/126052 >From b09ec4e569a2659eca66dc38e35a02a87134c209 Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Tue, 28 Jan 2025 12:19:23 + Subject: [PATCH 1/2] [libclc] Move fma to the CLC library This builtin is a

[libclc] [libclc] Move modf to the CLC library (PR #127828)

2025-02-19 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck updated https://github.com/llvm/llvm-project/pull/127828 >From 34c217f46e81cbceda12ffa47c1825a57706fdc8 Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Wed, 19 Feb 2025 16:25:22 + Subject: [PATCH] [libclc] Move modf to the CLC library The "generic" unary_

[libclc] [libclc] Move modf to the CLC library (PR #127828)

2025-02-19 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/127828 The "generic" unary_(def|decl)_with_ptr files are intended to be re-used by the sincos and fract builtins in the future as they share an identical type signature. >From 09835c009430464426dced5598a5e8a9cae1

[libclc] fb5a87e - [libclc][NFC] Reformat ep_log.cl

2025-02-19 Thread Fraser Cormack via cfe-commits
Author: Fraser Cormack Date: 2025-02-19T15:18:05Z New Revision: fb5a87e1a6febb2a81fd85f800e78c2e6dff5715 URL: https://github.com/llvm/llvm-project/commit/fb5a87e1a6febb2a81fd85f800e78c2e6dff5715 DIFF: https://github.com/llvm/llvm-project/commit/fb5a87e1a6febb2a81fd85f800e78c2e6dff5715.diff LOG

[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

[libclc] [libclc] Improve nextafter behaviour around zero (PR #127469)

2025-02-17 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/127469 This commit improves the behaviour of (__clc_)nextafter around zero. Specifically, the nextafter value of very small negative numbers in the positive direction is now negative zero. Previously we'd return p

[libclc] [libclc] Improve nextafter behaviour around zero (PR #127469)

2025-02-17 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: With this PR and with #126905 I achieved a fully passing OpenCL-CTS conversions run. https://github.com/llvm/llvm-project/pull/127469 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/lis

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

2025-02-17 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: See #127469 for the fix for the other conversion builtins. https://github.com/llvm/llvm-project/pull/126905 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[libclc] [libclc] Move frexp to CLC library; optimize half vecs (PR #127836)

2025-02-19 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/127836 This commit moves the frexp builtin to the CLC library. It simultaneously optimizes the code generated for half vectors, which was previously scalarizing and casting up to float. With this commit it still c

[libclc] [libclc] Move logb/ilogb to CLC library; optimize (PR #128028)

2025-02-25 Thread Fraser Cormack via cfe-commits
@@ -0,0 +1,73 @@ +#if __CLC_FPSIZE == 32 + +_CLC_OVERLOAD _CLC_DEF __CLC_INTN __clc_ilogb(__CLC_GENTYPE x) { + __CLC_UINTN ux = __CLC_AS_UINTN(x); frasercrmck wrote: Yeah, I'm not sure using `frexp` is currently better given that there's no native path for it.

[libclc] libclc: Stop using asm declarations for r600 on amdgcn for get_global_size (PR #128692)

2025-02-25 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck approved this pull request. https://github.com/llvm/llvm-project/pull/128692 ___ 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-02-25 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: ping. Are the discussions above blocking the PR? If clang's internal headers are unsuitable must we fix those before landing this, or temporarily fix the installation of libclc's headers instead? https://github.com/llvm/llvm-project/pull/126908 __

[libclc] [libclc] Move log/log2/log10 to CLC library (PR #128540)

2025-02-25 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck updated https://github.com/llvm/llvm-project/pull/128540 >From 0417fefc8b1d6b65941e48a1c2c4c700f601b38b Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Mon, 24 Feb 2025 17:27:59 + Subject: [PATCH 1/2] [libclc] Move log/log2/log10 to CLC library No changes

[libclc] [libclc] Move log/log2/log10 to CLC library (PR #128540)

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

[libclc] [libclc] Move log/log2/log10 to CLC library (PR #128540)

2025-02-25 Thread Fraser Cormack via cfe-commits
@@ -0,0 +1,339 @@ +/* + * Copyright (c) 2014,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 restri

[libclc] [libclc] Move log/log2/log10 to CLC library (PR #128540)

2025-02-25 Thread Fraser Cormack via cfe-commits
@@ -0,0 +1,339 @@ +/* + * Copyright (c) 2014,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 restri

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

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

[libclc] [libclc] Move fma to the CLC library (PR #126052)

2025-02-24 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck updated https://github.com/llvm/llvm-project/pull/126052 >From 18d67915671a081540abde18b1b6c009ac094a27 Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Tue, 28 Jan 2025 12:19:23 + Subject: [PATCH 1/2] [libclc] Move fma to the CLC library This builtin is a

[libclc] [libclc] Move fma to the CLC library (PR #126052)

2025-02-24 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: > > FYI @rjodinchr this breaks downstream clspv testing. > > ``` > > # | declare !kernel_arg_name !7 float @llvm.fma.f32(float, float, float) #2 > > # | Unsupported llvm intrinsic > > # | UNREACHABLE executed at /clspv/lib/SPIRVProducerPass.cpp:2390! > > ``` > > > > > >

[libclc] [libclc] Move fma to the CLC library (PR #126052)

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

[libclc] [libclc] Remove clspv-specific clc conversions (PR #128500)

2025-02-24 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/128500 The clc and clc+clspv modes produced the same conversions code, so this patch simplifies the process. It further simplifies the internal checks the script makes by assuming the mutual exclusivity. >From ce

[libclc] [libclc] Remove clspv-specific clc conversions (PR #128500)

2025-02-24 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck closed https://github.com/llvm/llvm-project/pull/128500 ___ 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 the CLC library (PR #128506)

2025-02-24 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/128506 Note the CLC versions of these builtins don't offer the vector/scalar forms, for simplicity. The OpenCL layer converts the vector/scalar form to vector/vector. The CLC builtins use clang's __builtin_elemen

[libclc] [libclc] Move fmin/fmax to the CLC library (PR #128506)

2025-02-24 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: Note @arsenm I didn't touch [amdgcn's fmin/fmax](https://github.com/llvm/llvm-project/blob/main/libclc/amdgcn/lib/math/fmin.cl) or [r600's](https://github.com/llvm/llvm-project/blob/main/libclc/r600/lib/math/fmin.cl) as I wasn't sure if any of that could be updated or at le

[libclc] [libclc] Move fmin/fmax to the CLC library (PR #128506)

2025-02-24 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: > These should use the regular builtin fmin / fmax. Do you mean the AMD implementations, or the CLC ones too? Note there's no vector support for `__builtin_fmin` which is why I chose `__builtin_elementwise_min`. They appear to generate the same code so maybe I'm misundersta

[libclc] [libclc] Move nan to the CLC library (PR #128521)

2025-02-24 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/128521 None >From 49a2cb5fc5a098dc16f9e348eba8a93b3433a379 Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Mon, 24 Feb 2025 15:11:07 + Subject: [PATCH] [libclc] Move nan to the CLC library --- libclc/clc

[libclc] [libclc] Move nan to the CLC library (PR #128521)

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

[libclc] [libclc] Move log/log2/log10 to CLC library (PR #128540)

2025-02-24 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/128540 No changes to codegen for AMDGPU/Nvidia targets. Note that for simplicity this commit doesn't try to refactor or optimize the implementations. Notably, each log is only implementated for scalar types; vect

[libclc] [libclc] Define macros for users of gentype.inc (PR #128012)

2025-02-20 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/128012 Several users of (mostly math/) gentype.inc rely on types other than the 'gentype'. This is commonly intN as several maths builtins expose this as a return or paramter type. We were previously explicitly de

[libclc] [libclc] Define macros for users of gentype.inc (PR #128012)

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

[libclc] [libclc] Move logb/ilogb to CLC library; optimize (PR #128028)

2025-02-20 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/128028 This commit moves the logb and ilogb builtins to the CLC library. It simultaneously optimizes them both for vector types and for half types. Vector types were being scalarized in some cases. Half types were

[libclc] [libclc] Remove clspv-specific clc conversions (PR #128500)

2025-02-26 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: > This commit is causing regressions on the OpenCL-CTS with `clvk/clspv`. I > need more time to understand what the issue is exactly. Interesting, I'm sorry about that. I diffed `clc-convert.cl` and `clc-clspv-convert.cl` before this change and they were identical, so the c

[libclc] [libclc] Move sqrt to CLC library (PR #128748)

2025-02-25 Thread Fraser Cormack via cfe-commits
@@ -21,19 +21,17 @@ */ #if __CLC_FPSIZE == 64 -#define __CLC_NAN __builtin_nan("") -#define ZERO 0.0 +#define __CLC_NAN DBL_NAN #elif __CLC_FPSIZE == 32 -#define __CLC_NAN NAN -#define ZERO 0.0f +#define __CLC_NAN FLT_NAN #elif __CLC_FPSIZE == 16 -#define __CLC_NAN (half)NA

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

2025-02-26 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck updated https://github.com/llvm/llvm-project/pull/126078 >From 27f4e94de5cb6f1220ddbd4b0197a44cb831d0fe Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Wed, 5 Feb 2025 10:38:46 + Subject: [PATCH] [libclc] Move __clc_ldexp to CLC library This function was

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

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

[libclc] [libclc] Make CLC library warning-free (PR #128864)

2025-02-26 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/128864 There is a long-standing workaround in the libclc build system that silences a warning about the use of parentheses in bitwise conditional operations. In an effort to remove this workaround, this commit re-

[libclc] [libclc] Make CLC library warning-free (PR #128864)

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

[libclc] [libclc] Move round to CLC library (PR #128721)

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

[libclc] [libclc] Move sqrt to CLC library (PR #128748)

2025-02-25 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/128748 This is fairly straightforward for most targets. AMDGPU provides its own implementation of sqrt for double types. This commit moves this into the implementation of CLC sqrt. It uses weak linkage on the 'de

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

2025-02-25 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: An update on this: in adding a clang elementwise builtin for ldexp (and for clz/ctz) I found it necessary to first refactor the clang diagnostics. I opened a PR for it (https://github.com/llvm/llvm-project/pull/125673) which isn't getting much traction so that's slowing thin

[libclc] [libclc][NFC] Remove unused intrinsics helpers (PR #128708)

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

[libclc] [libclc] Move round to CLC library (PR #128721)

2025-02-25 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/128721 None >From f8a607fc8842d101e54648e3970cfa9aff81e6aa Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Tue, 25 Feb 2025 13:13:09 + Subject: [PATCH] [libclc] Move round to CLC library --- libclc/clc/i

[libclc] [libclc][NFC] Remove unused intrinsics helpers (PR #128708)

2025-02-25 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/128708 We want to move away from using asm declarations to define builtins. >From 76d6da267c5991374579031d402be33da88ed43f Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Tue, 25 Feb 2025 12:48:27 + Subjec

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

2025-02-25 Thread Fraser Cormack via cfe-commits
@@ -2266,8 +2266,10 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { if (CheckVectorElementCallArgs(&SemaRef, TheCall)) return true; if (SemaRef.BuiltinElementwiseTernaryMath( -TheCall, /*CheckForFloatArgs*/ -

[libclc] [libclc] Move log/log2/log10 to CLC library (PR #128540)

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

[libclc] [libclc] Move sqrt to CLC library (PR #128748)

2025-02-27 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck updated https://github.com/llvm/llvm-project/pull/128748 >From f827260918c81053d833db6fe81039b7c0990a2f Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Tue, 25 Feb 2025 12:27:06 + Subject: [PATCH 1/3] [libclc] Move sqrt to CLC library This is fairly strai

[libclc] [libclc] Move sqrt to CLC library (PR #128748)

2025-02-27 Thread Fraser Cormack via cfe-commits
@@ -21,19 +21,17 @@ */ #if __CLC_FPSIZE == 64 -#define __CLC_NAN __builtin_nan("") -#define ZERO 0.0 +#define __CLC_NAN DBL_NAN #elif __CLC_FPSIZE == 32 -#define __CLC_NAN NAN -#define ZERO 0.0f +#define __CLC_NAN FLT_NAN #elif __CLC_FPSIZE == 16 -#define __CLC_NAN (half)NA

[libclc] [libclc] Move sqrt to CLC library (PR #128748)

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

[libclc] [libclc] Move sqrt to CLC library (PR #128748)

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

[libclc] [libclc] Move sqrt to CLC library (PR #128748)

2025-02-27 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck closed https://github.com/llvm/llvm-project/pull/128748 ___ 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 created https://github.com/llvm/llvm-project/pull/129045 This also adds missing half variants to certain targets. It also optimizes some targets' implementations to perform the operation directly in vector types, as opposed to scalarizing. >From 4efd607ca71b9184

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

2025-03-31 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: Just realised I missed the brief - `native_exp2` should use the builtin, `native_exp` should continue to call `native_exp2`. https://github.com/llvm/llvm-project/pull/133696 ___ cfe-commits mailing list cfe-commits@lists.llvm.org ht

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

2025-03-31 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck edited 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][amdgpu] Implement native_exp2 via AMD builtin (PR #133696)

2025-03-31 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: > Just realised I missed the brief - `native_exp2` should use the builtin, > `native_exp` should continue to call `native_exp2`. Done https://github.com/llvm/llvm-project/pull/133696 ___ cfe-commits mailing list cfe-commits@lists.l

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

2025-03-31 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/133696 This came up during a discussion on #129679, which has been split out as a preparatory commit. An example of the AMDGPU codegen is: define <2 x float> @_Z10native_expDv2_f(<2 x float> %x) { %0 =

<    1   2   3   4   5   6   7   8   >