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

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

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

2025-04-10 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: > I still have a few things to investigate to make sure of what is happening, > but in the meantime would you guys approve to land this patch to make the > implementation more stable whether the device supports denorm or not? > > ``` > - __CLC_INTN is_inf_nan_or_zero = > -

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

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

[libclc] 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-10 Thread Fraser Cormack via cfe-commits
@@ -0,0 +1,24 @@ +//===--===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apac

[libclc] 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

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

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

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

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

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

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

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

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

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

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

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

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

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

2025-04-10 Thread Fraser Cormack via cfe-commits
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] [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] 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] [libclc] Move shuffle/shuffle2 to the CLC library (PR #135000)

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

[libclc] 949bf51 - [libclc][NFC] Fix up inconsistent copyright headers

2025-04-09 Thread Fraser Cormack via cfe-commits
Author: Fraser Cormack Date: 2025-04-09T12:00:08+01:00 New Revision: 949bf518fcc04285f40aa96a1c123bf0141fafd4 URL: https://github.com/llvm/llvm-project/commit/949bf518fcc04285f40aa96a1c123bf0141fafd4 DIFF: https://github.com/llvm/llvm-project/commit/949bf518fcc04285f40aa96a1c123bf0141fafd4.diff

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

2025-04-09 Thread Fraser Cormack via cfe-commits
@@ -6,7 +6,28 @@ // //===--===// -#include +#include +#include + +// cl_khr_global_int32_base_atomics +#define IMPL(TYPE) \ frasercrmck wrote: Oh nice one, yeah. That explains why it isn'

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

2025-04-09 Thread Fraser Cormack via cfe-commits
@@ -6,6 +6,17 @@ // //===--===// +// cl_khr_global_int32_base_atomics frasercrmck wrote: Sorry to go back to this but I think really these should all be `#if` guarded with the appropriate e

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

2025-04-09 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck commented: LGTM other than the last nit. I can confirm there are no codegen changes to any target that I can observe. Thanks again. https://github.com/llvm/llvm-project/pull/134489 ___ cfe-commits mailing list cfe-commit

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

2025-04-09 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] 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: 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] [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] [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
@@ -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
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] 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] 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] 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: 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: 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][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] 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] 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] 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] 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] 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] 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] add --only-needed to llvm-link when INTERNALIZE flag is set (PR #130871)

2025-04-04 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: Interesting - I'm not seeing any change in bytecode modules before and after this change. https://github.com/llvm/llvm-project/pull/130871 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailma

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

2025-04-04 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] Move lgamma, lgamma_r & tgamma to CLC library (PR #134053)

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

[libclc] [libclc] Move rootn to the CLC library; optimize (PR #133735)

2025-04-04 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/133735 The function was already nominally in the CLC namespace; this commit just moves it over. This commit also vectorizes the builtin to avoid scalarization. >From 67b778704e01e1e783cdf635a5fd4ca359f71d22 Mon S

[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: erfc: fix fp32 implementation (PR #132390)

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

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

2025-04-04 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck closed https://github.com/llvm/llvm-project/pull/132758 ___ 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-03 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck edited 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] Move fmin & fmax to CLC library (PR #134218)

2025-04-03 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/3] [libclc] Move fmin & fmax to CLC library This is an alt

[libclc] [libclc]: clspv: add a dummy implememtation for mul_hi (PR #134094)

2025-04-03 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck closed https://github.com/llvm/llvm-project/pull/134094 ___ 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-03 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: fmin/fmax are needed for minmag/maxmag/fract, and fract is needed for sin/cos/tan so these builtins are a bottleneck right now. https://github.com/llvm/llvm-project/pull/134218 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

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

2025-04-03 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/134218 This is an alternative to #128506 which doesn't attempt to change the codegen for fmin and fmax on their way to the CLC library. The amdgcn and r600 custom definitions of fmin/fmax are now converted to cust

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

2025-04-02 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/134053 Also enable half-precision variants of tgamma, which were previously missing. Note that unlike recent work, these builtins are not vectorized as part of this commit. Ultimately all three call into lgamma_r,

[libclc] [libclc] Move sinh, cosh & tanh to the CLC library (PR #134063)

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

[libclc] [libclc] Move native_(exp10|powr|tan) to CLC library (PR #134080)

2025-04-02 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/134080 These are the three remaining native builtins not yet ported. There are elementwise versions of exp10 and tan which correspond to the intrinsics, which may be preferable to the current versions which route

[libclc] [libclc] Move cbrt to the CLC library; vectorize (PR #133940)

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

[libclc] [libclc] Move sinh, cosh & tanh to the CLC library (PR #134063)

2025-04-02 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck updated https://github.com/llvm/llvm-project/pull/134063 >From 498e82e2ec64cf6ba04466ac58fca5769fecdefd Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Wed, 2 Apr 2025 11:06:30 +0100 Subject: [PATCH 1/2] [libclc] Move sinh, cosh & tanh to the CLC library This

[libclc] [libclc] Move sinh, cosh & tanh to the CLC library (PR #134063)

2025-04-02 Thread Fraser Cormack via cfe-commits
@@ -0,0 +1,201 @@ +//===--===// +// +// 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: Apa

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

2025-04-02 Thread Fraser Cormack via cfe-commits
@@ -0,0 +1,73 @@ +//===--===// +// +// 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] [libclc] Move lgamma, lgamma_r & tgamma to CLC library (PR #134053)

2025-04-02 Thread Fraser Cormack via cfe-commits
@@ -0,0 +1,73 @@ +//===--===// +// +// 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] [libclc] Move sinh, cosh & tanh to the CLC library (PR #134063)

2025-04-02 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/134063 This commit also vectorizes the builtins. >From 498e82e2ec64cf6ba04466ac58fca5769fecdefd Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Wed, 2 Apr 2025 11:06:30 +0100 Subject: [PATCH] [libclc] Move sin

[libclc] [libclc] Move cbrt to the CLC library; vectorize (PR #133940)

2025-04-02 Thread Fraser Cormack via cfe-commits
@@ -0,0 +1,135 @@ +//===--===// +// +// 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: Apa

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

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

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

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

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

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

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

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

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

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

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

2025-03-31 Thread Fraser Cormack via cfe-commits
@@ -0,0 +1,3 @@ +_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __clc_native_log(__CLC_GENTYPE val) { + return __clc_native_log2(val) * (1.0f / M_LOG2E_F); frasercrmck wrote: We now apply `-fapprox-func`, as of #133119. If I change this PR to remove the AMDGPU definition

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

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

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

2025-03-31 Thread Fraser Cormack via cfe-commits
@@ -0,0 +1,3 @@ +_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __clc_native_exp(__CLC_GENTYPE val) { + return __clc_native_exp2(val * M_LOG2E_F); frasercrmck wrote: With #133696 merged, I think this is resolved. AMDGPU still has a custom definition of `__clc_native_exp`

[libclc] [libclc][amdgpu] Implement native_exp 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_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 =

[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_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_exp 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_exp via builtin (PR #133696)

2025-03-31 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck updated https://github.com/llvm/llvm-project/pull/133696 >From b927766ee9d6e8a19af3cfcd5a05f7dcd2197ced Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Mon, 31 Mar 2025 11:37:43 +0100 Subject: [PATCH] [libclc][amdgpu] Implement native_exp via AMD builtin This

[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] 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] 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 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

[clang] [SYCL] Basic code generation for SYCL kernel caller offload entry point functions. (PR #133030)

2025-03-27 Thread Fraser Cormack via cfe-commits
@@ -229,6 +229,12 @@ class CodeGenTypes { const CGFunctionInfo &arrangeBuiltinFunctionCall(QualType resultType, const CallArgList &args); + /// A SYCL device kernel function is a free standing function with + /// spir_kern

[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 edited 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-27 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: > set_source_files_properties That's true but since we're compiling with custom commands (I think) the properties won't automatically get picked up. That said, we could perhaps set the properties as you suggest and retrieve them with `get_source_file_property`. We'd still n

[libclc] [libclc] Move atan2/atan2pi to the CLC library (PR #133226)

2025-03-27 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/133226 As with other work in this area, these builtins are now vectorized. A further table has been split into two. There was discrepancy between comments above the table describing the values as "lead" and "tail"

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

2025-03-27 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck updated https://github.com/llvm/llvm-project/pull/132054 >From e480113652a1a371e296192d4e1460af26a8a436 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] Move atan2/atan2pi to the CLC library (PR #133226)

2025-03-27 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck closed https://github.com/llvm/llvm-project/pull/133226 ___ 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-27 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck updated https://github.com/llvm/llvm-project/pull/133119 >From afb5cf51ce0b2de2a3d58dbd493c80173e970fac Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Wed, 26 Mar 2025 16:18:34 + Subject: [PATCH 1/4] [libclc] Pass -fapprox-func when compiling 'native' bu

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

2025-03-27 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck updated https://github.com/llvm/llvm-project/pull/133119 >From afb5cf51ce0b2de2a3d58dbd493c80173e970fac Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Wed, 26 Mar 2025 16:18:34 + Subject: [PATCH 1/3] [libclc] Pass -fapprox-func when compiling 'native' bu

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

2025-03-27 Thread Fraser Cormack via cfe-commits
frasercrmck wrote: I've pushed an update with uses the `COMPILE_OPTIONS` property. It's definitely better, thanks for the suggestion. It would be best if there were `CMakeLists.txt` in each sub-directory which added the properties. However, because we currently have this system where targets

[libclc] [libclc] Move atan2/atan2pi to the CLC library (PR #133226)

2025-03-27 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck updated https://github.com/llvm/llvm-project/pull/133226 >From 497781f9fe1d1750d37a36948be285cdb6c14b04 Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Tue, 25 Mar 2025 18:19:38 + Subject: [PATCH 1/2] [libclc] Move atan2/atan2pi to the CLC library --- li

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

2025-03-27 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck updated https://github.com/llvm/llvm-project/pull/133119 >From afb5cf51ce0b2de2a3d58dbd493c80173e970fac Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Wed, 26 Mar 2025 16:18:34 + Subject: [PATCH 1/2] [libclc] Pass -fapprox-func when compiling 'native' bu

[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 log1p/asinh/acosh/atanh to the CLC library (PR #132956)

2025-03-27 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck closed 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] 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

[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
@@ -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
@@ -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
@@ -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 ${

  1   2   3   4   5   6   >