[clang] 90bf3ec - [clang-offload-bundler] Add option -list

2021-01-06 Thread Yaxun Liu via cfe-commits
Author: Yaxun (Sam) Liu Date: 2021-01-06T16:23:01-05:00 New Revision: 90bf3ecef4bb1e214a718aebcee730c24199c8ba URL: https://github.com/llvm/llvm-project/commit/90bf3ecef4bb1e214a718aebcee730c24199c8ba DIFF: https://github.com/llvm/llvm-project/commit/90bf3ecef4bb1e214a718aebcee730c24199c8ba.dif

[clang] 1439df0 - [HIP] Fix test rcom-detect.hip

2021-10-13 Thread Yaxun Liu via cfe-commits
Author: Yaxun (Sam) Liu Date: 2021-10-13T15:01:07-04:00 New Revision: 1439df00fc5e6dfffeb6a99e3537f6de2e539785 URL: https://github.com/llvm/llvm-project/commit/1439df00fc5e6dfffeb6a99e3537f6de2e539785 DIFF: https://github.com/llvm/llvm-project/commit/1439df00fc5e6dfffeb6a99e3537f6de2e539785.dif

[clang] a543584 - [HIP][OpenMP] Fix assertion in deferred diag

2021-10-25 Thread Yaxun Liu via cfe-commits
Author: Yaxun (Sam) Liu Date: 2021-10-25T11:07:40-04:00 New Revision: a5435844f0e67c70963a1a743fef41b1a8eac4d3 URL: https://github.com/llvm/llvm-project/commit/a5435844f0e67c70963a1a743fef41b1a8eac4d3 DIFF: https://github.com/llvm/llvm-project/commit/a5435844f0e67c70963a1a743fef41b1a8eac4d3.dif

[clang] 26e492e - [HIP] Warn capture this pointer in device lambda

2021-09-08 Thread Yaxun Liu via cfe-commits
Author: Yaxun (Sam) Liu Date: 2021-09-08T13:45:26-04:00 New Revision: 26e492e134c006c63b3d9f9f9eabdeba014b1d2c URL: https://github.com/llvm/llvm-project/commit/26e492e134c006c63b3d9f9f9eabdeba014b1d2c DIFF: https://github.com/llvm/llvm-project/commit/26e492e134c006c63b3d9f9f9eabdeba014b1d2c.dif

[clang] ab5f2b5 - [HIP] Diagnose -fopenmp-targets for HIP programs

2021-09-15 Thread Yaxun Liu via cfe-commits
Author: Yaxun (Sam) Liu Date: 2021-09-15T13:03:57-04:00 New Revision: ab5f2b505a0751bce41f4cec9afa3c1541d485d0 URL: https://github.com/llvm/llvm-project/commit/ab5f2b505a0751bce41f4cec9afa3c1541d485d0 DIFF: https://github.com/llvm/llvm-project/commit/ab5f2b505a0751bce41f4cec9afa3c1541d485d0.dif

[clang] [HIP] search fatbin symbols for libs passed by -l (PR #104638)

2024-08-16 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu created https://github.com/llvm/llvm-project/pull/104638 For -fgpu-rdc linking, clang needs to collect undefined fatbin symbols and resolve them to the embedded fatbin. This has been done for object files and archive files passed as input files to clang. However,

[clang] [HIP] search fatbin symbols for libs passed by -l (PR #104638)

2024-08-18 Thread Yaxun Liu via cfe-commits
@@ -76,8 +79,75 @@ class HIPUndefinedFatBinSymbols { return GPUBinHandleSymbols; } + // Collect symbols from static libraries specified by -l options. + void processStaticLibraries() { +llvm::SmallVector LibNames; +llvm::SmallVector LibPaths; +llvm::SmallVe

[clang] [HIP] search fatbin symbols for libs passed by -l (PR #104638)

2024-08-18 Thread Yaxun Liu via cfe-commits
@@ -76,8 +79,75 @@ class HIPUndefinedFatBinSymbols { return GPUBinHandleSymbols; } + // Collect symbols from static libraries specified by -l options. + void processStaticLibraries() { +llvm::SmallVector LibNames; +llvm::SmallVector LibPaths; +llvm::SmallVe

[clang] [HIP] search fatbin symbols for libs passed by -l (PR #104638)

2024-08-18 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu updated https://github.com/llvm/llvm-project/pull/104638 >From 3c281d8cfc99674f2a4de0dfe5e1f02e35e68d6d Mon Sep 17 00:00:00 2001 From: "Yaxun (Sam) Liu" Date: Fri, 16 Aug 2024 14:24:08 -0400 Subject: [PATCH] [HIP] search fatbin symbols for libs passed by -l For -fgp

[clang] [HIP] search fatbin symbols for libs passed by -l (PR #104638)

2024-08-18 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu updated https://github.com/llvm/llvm-project/pull/104638 >From 6e6bb355f2cf79f30d01c97b580d4354cbb7e727 Mon Sep 17 00:00:00 2001 From: "Yaxun (Sam) Liu" Date: Fri, 16 Aug 2024 14:24:08 -0400 Subject: [PATCH] [HIP] search fatbin symbols for libs passed by -l For -fgp

[clang] [HIP] search fatbin symbols for libs passed by -l (PR #104638)

2024-08-18 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu closed https://github.com/llvm/llvm-project/pull/104638 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][CodeGen][SPIR-V][AMDGPU] Tweak AMDGCNSPIRV ABI to allow for the correct handling of aggregates passed to kernels / functions. (PR #102776)

2024-08-20 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu approved this pull request. https://github.com/llvm/llvm-project/pull/102776 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Fix amdgpu-arch for dll name on Windows (PR #101350)

2024-08-23 Thread Yaxun Liu via cfe-commits
yxsamliu wrote: ping https://github.com/llvm/llvm-project/pull/101350 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Enable ASAN in amdgpu toolchain for OpenCL (PR #96262)

2024-06-21 Thread Yaxun Liu via cfe-commits
@@ -169,6 +180,11 @@ // COMMON-UNSAFE-MATH-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_finite_only_off.bc" // COMMON-UNSAFE-MATH-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_correctly_rounded_sqrt_off.bc" +// ASAN-SAME: "-fsanitize=address" + +//

[clang] Enable ASAN in amdgpu toolchain for OpenCL (PR #96262)

2024-06-21 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu closed https://github.com/llvm/llvm-project/pull/96262 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [clang][Driver] Add HIPAMD Driver support for AMDGCN flavoured SPIR-V (PR #95061)

2024-06-24 Thread Yaxun Liu via cfe-commits
@@ -147,6 +147,14 @@ getNVIDIAOffloadTargetTriple(const Driver &D, const ArgList &Args, static std::optional getHIPOffloadTargetTriple(const Driver &D, const ArgList &Args) { if (!Args.hasArg(options::OPT_offload_EQ)) { +auto OffloadArchs = Args.getAllArgValues(options::

[clang] [llvm] [clang][Driver] Add HIPAMD Driver support for AMDGCN flavoured SPIR-V (PR #95061)

2024-06-24 Thread Yaxun Liu via cfe-commits
@@ -147,6 +147,14 @@ getNVIDIAOffloadTargetTriple(const Driver &D, const ArgList &Args, static std::optional getHIPOffloadTargetTriple(const Driver &D, const ArgList &Args) { if (!Args.hasArg(options::OPT_offload_EQ)) { +auto OffloadArchs = Args.getAllArgValues(options::

[clang] clang/AMDGPU: Use atomicrmw for ds fmin/fmax builtins (PR #96738)

2024-06-26 Thread Yaxun Liu via cfe-commits
@@ -158,23 +158,85 @@ void test_ds_faddf(local float *out, float src) { } // CHECK-LABEL: @test_ds_fmin -// CHECK: {{.*}}call{{.*}} float @llvm.amdgcn.ds.fmin.f32(ptr addrspace(3) %out, float %src, i32 0, i32 0, i1 false) +// CHECK: atomicrmw fmin ptr addrspace(3) %out, float

[clang] [libc] [llvm] [libc] Implement (v|f)printf on the GPU (PR #96369)

2024-06-26 Thread Yaxun Liu via cfe-commits
@@ -0,0 +1,77 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5 +// RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -emit-llvm -o - %s | FileCheck %s + +extern void varargs_simple(int, ...); + +// CHECK-LABEL: define dso_local vo

[clang] [libc] [llvm] [libc] Implement (v|f)printf on the GPU (PR #96369)

2024-06-26 Thread Yaxun Liu via cfe-commits
@@ -0,0 +1,77 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5 +// RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -emit-llvm -o - %s | FileCheck %s + +extern void varargs_simple(int, ...); + +// CHECK-LABEL: define dso_local vo

[clang] [llvm] [clang][docs] Add preliminary documentation for SPIR-V support in the HIPAMD ToolChain (PR #96657)

2024-06-26 Thread Yaxun Liu via cfe-commits
@@ -284,3 +284,48 @@ Example Usage Base* basePtr = &obj; basePtr->virtualFunction(); // Allowed since obj is constructed in device code } + +SPIR-V Support on HIPAMD ToolChain +== + +The HIPAMD ToolChain supports targetting +`AMDG

[clang] [llvm] [clang][docs] Add preliminary documentation for SPIR-V support in the HIPAMD ToolChain (PR #96657)

2024-06-26 Thread Yaxun Liu via cfe-commits
@@ -284,3 +284,48 @@ Example Usage Base* basePtr = &obj; basePtr->virtualFunction(); // Allowed since obj is constructed in device code } + +SPIR-V Support on HIPAMD ToolChain +== + +The HIPAMD ToolChain supports targetting +`AMDG

[clang] [HIP][Clang][Sema] Fix crash when calling builtins with pointer arguments (PR #95957)

2024-06-26 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu approved this pull request. https://github.com/llvm/llvm-project/pull/95957 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][CodeGen] Remove unnecessary ShouldLinkFiles conditional (PR #96951)

2024-06-27 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu approved this pull request. https://github.com/llvm/llvm-project/pull/96951 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [clang][docs] Add preliminary documentation for SPIR-V support in the HIPAMD ToolChain (PR #96657)

2024-06-28 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu approved this pull request. https://github.com/llvm/llvm-project/pull/96657 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HIP][Clang][CodeGen] Handle hip bin symbols properly. (PR #107458)

2024-09-11 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu approved this pull request. LGTM. Thanks https://github.com/llvm/llvm-project/pull/107458 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HIP] Use original file path for CUID (PR #107734)

2024-09-14 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu closed https://github.com/llvm/llvm-project/pull/107734 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HIP] Use original file path for CUID (PR #107734)

2024-10-09 Thread Yaxun Liu via cfe-commits
@@ -16,15 +18,15 @@ // RUN: %clang -### -x hip --target=x86_64-unknown-linux-gnu -DX=1 --no-offload-new-driver \ // RUN: --offload-arch=gfx906 -c -nogpuinc -nogpulib -fuse-cuid=hash \ -// RUN: %S/Inputs/hip_multiple_inputs/a.cu >%t.out 2>&1 +// RUN: Inputs/hip_multiple_

[clang] [CUDA/HIP] fix propagate -cuid to a host-only compilation. (PR #111650)

2024-10-09 Thread Yaxun Liu via cfe-commits
yxsamliu wrote: This does not seem to be the right fix. I tends to think the test https://github.com/ROCm/hip-tests/tree/amd-staging/samples/2_Cookbook/16_assembly_to_executable needs fix. Since it does not expect host-only compilation to use CUID, it should add `-fuse-cuid=none` to the host-o

[clang] [HIP] fix host min/max in header (PR #82956)

2024-10-11 Thread Yaxun Liu via cfe-commits
yxsamliu wrote: yet another usage of mixed signed/unsigned min https://github.com/ROCm/hipBLASLt/issues/1227 https://github.com/llvm/llvm-project/pull/82956 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman

[clang] [AMDGPU] Allow overload of __builtin_amdgcn_mov/update_dpp (PR #112447)

2024-10-16 Thread Yaxun Liu via cfe-commits
yxsamliu wrote: > This needs some sema type restrictions to make sure it's something sensible +1 also need sema lit test https://github.com/llvm/llvm-project/pull/112447 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cg

[clang] clang/HIP: Remove REQUIRES libgcc from a test (PR #112412)

2024-10-16 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu approved this pull request. https://github.com/llvm/llvm-project/pull/112412 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CUDA/HIP] fix propagate -cuid to a host-only compilation. (PR #111650)

2024-10-10 Thread Yaxun Liu via cfe-commits
yxsamliu wrote: > > This does not seem to be the right fix. I tends to think the test > > https://github.com/ROCm/hip-tests/tree/amd-staging/samples/2_Cookbook/16_assembly_to_executable > > needs fix. Since it does not expect host-only compilation to use CUID, it > > should add `-fuse-cuid=non

[clang] [HIP] Always add -fnative-half-arguments-and-returns cmdline option. (PR #113335)

2024-10-22 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu approved this pull request. https://github.com/llvm/llvm-project/pull/113335 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][HIP] Don't use the OpenCLKernel CC when targeting AMDGCNSPIRV (PR #110447)

2024-10-22 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu approved this pull request. https://github.com/llvm/llvm-project/pull/110447 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Fix amdgpu-arch for dll name on Windows (PR #101350)

2024-10-24 Thread Yaxun Liu via cfe-commits
yxsamliu wrote: ping https://github.com/llvm/llvm-project/pull/101350 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [RFC] Add clang atomic control options and pragmas (PR #102569)

2024-11-04 Thread Yaxun Liu via cfe-commits
yxsamliu wrote: As discussed in the RFC at LLVM discourse, close this PR and open another PR for implementing it as a compound statement attribute https://github.com/llvm/llvm-project/pull/114841 https://github.com/llvm/llvm-project/pull/102569 ___ c

[clang] [RFC] Add clang atomic control options and pragmas (PR #102569)

2024-11-04 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu closed https://github.com/llvm/llvm-project/pull/102569 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Driver][HIP] Add support for mixing AMDGCNSPIRV & concrete `offload-arch`s. (PR #113509)

2024-11-04 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu approved this pull request. https://github.com/llvm/llvm-project/pull/113509 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CUDA] Add support for __grid_constant__ attribute (PR #114589)

2024-11-04 Thread Yaxun Liu via cfe-commits
@@ -1450,6 +1450,13 @@ def CUDAHost : InheritableAttr { } def : MutualExclusions<[CUDAGlobal, CUDAHost]>; +def CUDAGridConstant : InheritableAttr { + let Spellings = [GNU<"grid_constant">, Declspec<"__grid_constant__">]; + let Subjects = SubjectList<[ParmVar]>; + let LangOp

[clang] [Clang] Add support for scoped atomic thread fence (PR #115545)

2024-11-11 Thread Yaxun Liu via cfe-commits
yxsamliu wrote: LGTM https://github.com/llvm/llvm-project/pull/115545 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CUDA][HIP] Fix host/device context in concept (PR #67721)

2024-11-13 Thread Yaxun Liu via cfe-commits
yxsamliu wrote: > Is this still relevant? Yes. The issue still exists and my arguments still hold https://github.com/llvm/llvm-project/pull/67721 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/c

[clang] [llvm] [SPIRV][RFC] Rework / extend support for memory scopes (PR #106429)

2024-09-24 Thread Yaxun Liu via cfe-commits
yxsamliu wrote: > Thank you ever so much for the review @VyacheslavLevytskyy! I will create a > PR for the Translator as well, since there's some handling missing there; I > will refer to it here for future readers. Final check: are you OK with the > OpenCL changes @yxsamliu? LGTM https://gi

[clang] [cuda][[HIP] `__constant__` should imply constant (PR #110182)

2024-09-27 Thread Yaxun Liu via cfe-commits
yxsamliu wrote: > It has nothing to do with writing to those arrays while the kernel is > running. That would indeed be UB. > > > both would still work just the same even with this change, > > No, they will not. Here's the demonstration of the behavior change that > `const` brings to the tabl

[clang] [Clang][HIP] Warn when __AMDGCN_WAVEFRONT_SIZE is used in host code without relying on target-dependent overload resolution (PR #109663)

2024-10-01 Thread Yaxun Liu via cfe-commits
yxsamliu wrote: `__AMDGCN_WAVEFRONT_SIZE__` could also be used in other offloading languages e.g. OpenMP. The check for non-constantness is not specific to HIP. It is a constant when the triple is amdgcn and -target-cpu is specified. Otherwise it should not be treated as constant. I think you

[clang] [Clang][HIP] Warn when __AMDGCN_WAVEFRONT_SIZE is used in host code without relying on target-dependent overload resolution (PR #109663)

2024-10-02 Thread Yaxun Liu via cfe-commits
yxsamliu wrote: One drawback of not defining `__AMDGCN_WAVEFRONT_SIZE__` in host compilation is the impairment of uniformity of source code across host and device sides. Users have to put `#if __HIP_DEVICE_COMPILE__` anywhere they use `__AMDGCN_WAVEFRONT_SIZE__`. Previous experience tells us t

[clang] Add clang atomic control options and attribute (PR #114841)

2024-11-07 Thread Yaxun Liu via cfe-commits
@@ -0,0 +1,19 @@ +//===--- AtomicOptions.def - Atomic Options database -*- C++ -*-===// +// +// 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: Ap

[clang] Add clang atomic control options and attribute (PR #114841)

2024-11-07 Thread Yaxun Liu via cfe-commits
@@ -569,19 +569,21 @@ void AMDGPUTargetCodeGenInfo::setTargetAtomicMetadata( AtomicInst.setMetadata(llvm::LLVMContext::MD_noalias_addrspace, ASRange); } - if (!RMW || !CGF.getTarget().allowAMDGPUUnsafeFPAtomics()) + if (!RMW) return; - // TODO: Introduce new, m

[clang] Add clang atomic control options and attribute (PR #114841)

2024-11-07 Thread Yaxun Liu via cfe-commits
@@ -0,0 +1,30 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify -fcuda-is-device %s +// RUN: %clang_cc1 -fsyntax-only -verify -fcuda-is-device %s \ +// RUN: -fatomic=no_fine_grained_memory:off,no_remote_memory:on,ignore_denormal_mode:on +

[clang] Add clang atomic control options and attribute (PR #114841)

2024-11-07 Thread Yaxun Liu via cfe-commits
@@ -0,0 +1,30 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify -fcuda-is-device %s +// RUN: %clang_cc1 -fsyntax-only -verify -fcuda-is-device %s \ +// RUN: -fatomic=no_fine_grained_memory:off,no_remote_memory:on,ignore_denormal_mode:on +

[clang] Add clang atomic control options and attribute (PR #114841)

2024-11-07 Thread Yaxun Liu via cfe-commits
@@ -1093,6 +1097,169 @@ inline void FPOptions::applyChanges(FPOptionsOverride FPO) { *this = FPO.applyOverrides(*this); } +/// Atomic control options +class AtomicOptionsOverride; +class AtomicOptions { +public: + using storage_type = uint16_t; + + static constexpr unsign

[clang] [llvm] [AMDGPU] Add a type for the named barrier (PR #113614)

2024-10-25 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu approved this pull request. https://github.com/llvm/llvm-project/pull/113614 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [Clang] Put offloading globals in the `.llvm.rodata.offloading` section (PR #111890)

2024-10-25 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/111890 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [amdgpu-arch] Replace use of HSA with reading sysfs directly (PR #116651)

2024-11-18 Thread Yaxun Liu via cfe-commits
yxsamliu wrote: > I feel like this is a workaround. Can we not fix the "limitation of the > driver" and if there is an issue with HSA overhead, shouldn't we file a > ticket? I think there was already a ticket but it cannot be fixed easily. https://github.com/llvm/llvm-project/pull/116651

[clang] [amdgpu-arch] Replace use of HSA with reading sysfs directly (PR #116651)

2024-11-18 Thread Yaxun Liu via cfe-commits
yxsamliu wrote: I think we could use this approach for Linux. amdgpu-arch can still use HIP runtime to detect GPU for both Linux and Windows, so we still have a fallback even if we remove the HSA approach. https://github.com/llvm/llvm-project/pull/116651 ___

[clang] [Clang] Add support for scoped atomic thread fence (PR #115545)

2024-11-18 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu approved this pull request. https://github.com/llvm/llvm-project/pull/115545 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][CodeGen][SPIRV] Translate `amdgpu_flat_work_group_size` into `reqd_work_group_size`. (PR #116820)

2024-11-19 Thread Yaxun Liu via cfe-commits
yxsamliu wrote: > > reqd_work_group_size is for OpenCL reqd_work_group_size attribute and it > > sets exact block size. amdgpu-flat-work-group-size sets a (min, max) range > > for block size. > > HIP launch bounds sets a block size range (1, bound). It cannot be > > represented by reqd_work_gr

[clang] [clang][CodeGen][SPIRV] Translate `amdgpu_flat_work_group_size` into `reqd_work_group_size`. (PR #116820)

2024-11-19 Thread Yaxun Liu via cfe-commits
yxsamliu wrote: > > > > reqd_work_group_size is for OpenCL reqd_work_group_size attribute and > > > > it sets exact block size. amdgpu-flat-work-group-size sets a (min, max) > > > > range for block size. > > > > HIP launch bounds sets a block size range (1, bound). It cannot be > > > > represe

[clang] [amdgpu-arch] Replace use of HSA with reading sysfs directly (PR #116651)

2024-11-18 Thread Yaxun Liu via cfe-commits
yxsamliu wrote: > > > @jhuber6 can you comment on "lot of overhead" and if that matters? Also, > > > not sure why the HSA library dependence is a problem. This seems to be > > > exposing amdgpu-arch to more maintenance overhead. > > > > > > Sometimes the driver will hang and since this is use

[clang] [clang] [NFC] Merge two ifs to a single one (PR #116226)

2024-11-15 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu approved this pull request. https://github.com/llvm/llvm-project/pull/116226 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CUDA] pass -fno-threadsafe-statics to GPU sub-compilations. (PR #117074)

2024-11-20 Thread Yaxun Liu via cfe-commits
yxsamliu wrote: > @yxsamliu -- should I add it for HIP, too? Yes please. I would appreciate that. Thanks. https://github.com/llvm/llvm-project/pull/117074 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/l

[clang] [AMDGPU] Use the AMDGPUToolChain when targeting C/C++ directly (PR #99687)

2024-11-20 Thread Yaxun Liu via cfe-commits
@@ -6405,7 +6424,12 @@ const ToolChain &Driver::getToolChain(const ArgList &Args, TC = std::make_unique(*this, Target, Args); break; case llvm::Triple::AMDHSA: - TC = std::make_unique(*this, Target, Args); + TC = + llvm::any_of(Inputs, +

[clang] [AMDGPU] Use the AMDGPUToolChain when targeting C/C++ directly (PR #99687)

2024-11-14 Thread Yaxun Liu via cfe-commits
@@ -6405,7 +6424,12 @@ const ToolChain &Driver::getToolChain(const ArgList &Args, TC = std::make_unique(*this, Target, Args); break; case llvm::Triple::AMDHSA: - TC = std::make_unique(*this, Target, Args); + TC = + llvm::any_of(Inputs, +

[clang] [clang][CodeGen][SPIRV] Translate `amdgpu_flat_work_group_size` into `reqd_work_group_size`. (PR #116820)

2025-01-06 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/116820 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CUDA][HIP] Fix overriding of constexpr virtual function (PR #121986)

2025-01-07 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu edited https://github.com/llvm/llvm-project/pull/121986 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CUDA][HIP] Fix overriding of constexpr virtual function (PR #121986)

2025-01-07 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu created https://github.com/llvm/llvm-project/pull/121986 In C++20 constexpr virtual function is allowed. In C++17 although non-pure virtual function is not allowed to be constexpr, pure virtual function is allowed to be constexpr and is allowed to be overriden by no

[clang] [CUDA] Increment VTable index for device thunks (PR #124989)

2025-02-03 Thread Yaxun Liu via cfe-commits
yxsamliu wrote: > _ No description provided. _ Pls add a commit message about the issue this PR is addressing and a summary of what it does. https://github.com/llvm/llvm-project/pull/124989 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http

[clang] [CUDA] Increment VTable index for device thunks (PR #124989)

2025-02-03 Thread Yaxun Liu via cfe-commits
@@ -0,0 +1,41 @@ +// RUN: %clang_cc1 -fcuda-is-device -triple amdgcn-amd-amdhsa -target-cpu gfx942 \ +// RUN: -emit-llvm -xhip %s -o - | FileCheck %s --check-prefix=GCN +// RUN: %clang_cc1 -fcuda-is-device -triple spirv64-amd-amdhsa \ +// RUN: -emit-llvm -xhip %s -o - | FileC

[clang] [clang][X86] Support __attribute__((model("small"/"large"))) (PR #124834)

2025-02-03 Thread Yaxun Liu via cfe-commits
@@ -1,64 +1,40 @@ -// RUN: %clang_cc1 -triple aarch64 -verify=expected,aarch64 -fsyntax-only %s +// RUN: %clang_cc1 -triple aarch64 -verify=expected,unsupported -fsyntax-only %s // RUN: %clang_cc1 -triple loongarch64 -verify=expected,loongarch64 -fsyntax-only %s -// RUN: %clang

[clang] [clang][X86] Support __attribute__((model("small"/"large"))) (PR #124834)

2025-02-03 Thread Yaxun Liu via cfe-commits
@@ -2949,15 +2950,32 @@ static void handleSectionAttr(Sema &S, Decl *D, const ParsedAttr &AL) { } } +static bool isValidCodeModelAttr(Sema &S, StringRef Str) { + if (S.Context.getTargetInfo().getTriple().isLoongArch()) { +return Str == "normal" || Str == "medium" || St

[clang] [Clang] Make `-Xarch_` handling generic for all toolchains (PR #125421)

2025-02-03 Thread Yaxun Liu via cfe-commits
@@ -1115,14 +1117,13 @@ def fno_convergent_functions : Flag<["-"], "fno-convergent-functions">, // Common offloading options let Group = offload_Group in { -def offload_arch_EQ : Joined<["--"], "offload-arch=">, Flags<[NoXarchOption]>, yxsamliu wrote: For HI

[clang] [OpenMP][ASan] Enable ASan Instrumentation for AMDGPUOpenMPToolChain. (PR #124754)

2025-02-03 Thread Yaxun Liu via cfe-commits
@@ -1106,8 +1106,12 @@ bool AMDGPUToolChain::shouldSkipSanitizeOption( // For simplicity, we only allow -fsanitize=address SanitizerMask K = parseSanitizerValue(A->getValue(), /*AllowGroups=*/false); - if (K != SanitizerKind::Address) + if (K != SanitizerKind::Address) {

[clang] Add clang atomic control options and attribute (PR #114841)

2025-02-04 Thread Yaxun Liu via cfe-commits
@@ -0,0 +1,19 @@ +//===--- AtomicOptions.def - Atomic Options database -*- C++ -*-===// +// +// 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: Ap

[clang] Add clang atomic control options and attribute (PR #114841)

2025-02-04 Thread Yaxun Liu via cfe-commits
@@ -1096,6 +1100,177 @@ inline void FPOptions::applyChanges(FPOptionsOverride FPO) { *this = FPO.applyOverrides(*this); } +/// Atomic control options +class AtomicOptionsOverride; +class AtomicOptions { +public: + using storage_type = uint16_t; + + static constexpr unsign

[clang] Add clang atomic control options and attribute (PR #114841)

2025-02-04 Thread Yaxun Liu via cfe-commits
@@ -1096,6 +1100,177 @@ inline void FPOptions::applyChanges(FPOptionsOverride FPO) { *this = FPO.applyOverrides(*this); } +/// Atomic control options +class AtomicOptionsOverride; +class AtomicOptions { +public: + using storage_type = uint16_t; + + static constexpr unsign

[clang] [Clang] Make `-Xarch_` handling generic for all toolchains (PR #125421)

2025-02-04 Thread Yaxun Liu via cfe-commits
@@ -1115,14 +1117,13 @@ def fno_convergent_functions : Flag<["-"], "fno-convergent-functions">, // Common offloading options let Group = offload_Group in { -def offload_arch_EQ : Joined<["--"], "offload-arch=">, Flags<[NoXarchOption]>, yxsamliu wrote: For HI

[clang] Add clang atomic control options and attribute (PR #114841)

2025-02-04 Thread Yaxun Liu via cfe-commits
@@ -5404,6 +5404,115 @@ third argument, can only occur at file scope. a = b[i] * c[i] + e; } +Extensions for controlling atomic code generation += + +The ``[[clang::atomic]]`` statement attribute enables users to control ho

[clang] [OpenMP][ASan] Enable ASan Instrumentation for AMDGPUOpenMPToolChain. (PR #124754)

2025-02-04 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu approved this pull request. https://github.com/llvm/llvm-project/pull/124754 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Add clang atomic control options and attribute (PR #114841)

2025-01-31 Thread Yaxun Liu via cfe-commits
@@ -4972,3 +4972,59 @@ def NoTrivialAutoVarInit: InheritableAttr { let Documentation = [NoTrivialAutoVarInitDocs]; let SimpleHandler = 1; } + +def Atomic : StmtAttr { + let Spellings = [Clang<"atomic">]; + let Args = [ +EnumArgument<"NoRemoteMemory", "NoRemoteMemoryTy

[clang] Add clang atomic control options and attribute (PR #114841)

2025-01-31 Thread Yaxun Liu via cfe-commits
yxsamliu wrote: > The changes should definitely come with a release note in > `clang/docs/ReleaseNotes.rst`, but this also seems like it maybe should get > wider documentation in the language extensions manual. I mentioned a need for > attribute documentation, that could be simple docs which p

[clang] Add clang atomic control options and attribute (PR #114841)

2025-02-05 Thread Yaxun Liu via cfe-commits
@@ -764,6 +764,73 @@ void Parser::ParseGNUAttributeArgs( ScopeLoc, Form); } +void Parser::ParseAtomicAttribute( yxsamliu wrote: I've simplified ParseAtomicAttribute by introducing a lambda that handles parsing a single option (inc

[clang] Add clang atomic control options and attribute (PR #114841)

2025-02-05 Thread Yaxun Liu via cfe-commits
@@ -5958,6 +5968,58 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, RenderFloatingPointOptions(TC, D, OFastEnabled, Args, CmdArgs, JA); + if (Arg *AtomicArg = Args.getLastArg(options::OPT_fatomic_EQ)) { yxsamliu wrote: Refactored the cod

[clang] [Clang] Add __has_target_builtin macro (PR #126324)

2025-02-10 Thread Yaxun Liu via cfe-commits
@@ -1797,55 +1798,62 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) { diag::err_feature_check_malformed); return II && HasExtension(*this, II->getName()); }); - } else if (II == Ident__has_builtin) { --

[clang] [Clang] Add __has_target_builtin macro (PR #126324)

2025-02-10 Thread Yaxun Liu via cfe-commits
@@ -357,6 +357,7 @@ void Preprocessor::RegisterBuiltinMacros() { Ident__has_builtin = RegisterBuiltinMacro("__has_builtin"); Ident__has_constexpr_builtin = RegisterBuiltinMacro("__has_constexpr_builtin"); + Ident__has_target_builtin = RegisterBuiltinMacro("__has_targ

[clang] [Clang] Add __has_target_builtin macro (PR #126324)

2025-02-10 Thread Yaxun Liu via cfe-commits
yxsamliu wrote: need release note https://github.com/llvm/llvm-project/pull/126324 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Add __has_target_builtin macro (PR #126324)

2025-02-10 Thread Yaxun Liu via cfe-commits
@@ -357,6 +357,7 @@ void Preprocessor::RegisterBuiltinMacros() { Ident__has_builtin = RegisterBuiltinMacro("__has_builtin"); Ident__has_constexpr_builtin = RegisterBuiltinMacro("__has_constexpr_builtin"); + Ident__has_target_builtin = RegisterBuiltinMacro("__has_targ

[clang] [Driver][HIP] Do not pass -dependency-file flag for HIP Device offloading (PR #125646)

2025-02-10 Thread Yaxun Liu via cfe-commits
@@ -0,0 +1,13 @@ +// RUN: %clang -### -nogpuinc -nogpulib --offload-arch=gfx1030 --offload-arch=gfx1100 --offload-arch=gfx1101 -MD -MF tmp.d %s 2>&1 | FileCheck %s yxsamliu wrote: adding `-target x86_64-pc-linux-gnu` probably fix the buildbot failure https://g

[clang] [CUDA] Increment VTable index for device thunks (PR #124989)

2025-02-10 Thread Yaxun Liu via cfe-commits
yxsamliu wrote: > I'm out of my depth here and will leave it up to @yxsamliu. It seems reasonable to me, but I would like @rjmccall to take a look. https://github.com/llvm/llvm-project/pull/124989 ___ cfe-commits mailing list cfe-commits@lists.llvm.or

[clang] Add clang atomic control options and attribute (PR #114841)

2025-02-06 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu edited https://github.com/llvm/llvm-project/pull/114841 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Add clang atomic control options and attribute (PR #114841)

2025-02-06 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu edited https://github.com/llvm/llvm-project/pull/114841 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [AMDGPU] Do not enable GPU sanitizers by default (PR #126090)

2025-02-06 Thread Yaxun Liu via cfe-commits
yxsamliu wrote: This may break ROCm santizer builds since whether santizer is on should be determined by -fsanitize only, i.e. by default -fgpu-sanitize should be on. https://github.com/llvm/llvm-project/pull/126090 ___ cfe-commits mailing list cfe-co

[clang] Add clang atomic control options and attribute (PR #114841)

2025-02-06 Thread Yaxun Liu via cfe-commits
@@ -5404,6 +5404,151 @@ third argument, can only occur at file scope. a = b[i] * c[i] + e; } +Extensions for controlling atomic code generation += + +The ``[[clang::atomic]]`` statement attribute enables users to control ho

[clang] [Driver][HIP] Do not pass -dependency-file flag for HIP Device offloading (PR #125646)

2025-02-05 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu approved this pull request. https://github.com/llvm/llvm-project/pull/125646 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Add clang atomic control options and attribute (PR #114841)

2025-02-05 Thread Yaxun Liu via cfe-commits
@@ -5404,6 +5404,151 @@ third argument, can only occur at file scope. a = b[i] * c[i] + e; } +Extensions for controlling atomic code generation += + +The ``[[clang::atomic]]`` statement attribute enables users to control ho

[clang] [Driver][ROCm][OpenMP] Fix default ockl linking for OpenMP. (PR #126186)

2025-02-07 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu approved this pull request. https://github.com/llvm/llvm-project/pull/126186 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][NFC] Introduce `--offloadlib` positive flag for `nogpulib` and alias to `--no-offloadlib` (PR #126567)

2025-02-11 Thread Yaxun Liu via cfe-commits
@@ -5618,10 +5618,18 @@ def nogpuinc : Flag<["-"], "nogpuinc">, Group, def nohipwrapperinc : Flag<["-"], "nohipwrapperinc">, Group, HelpText<"Do not include the default HIP wrapper headers and include paths">; def : Flag<["-"], "nocudainc">, Alias; -def nogpulib : Flag<["-"]

[clang] [Clang][NFC] Introduce `--offloadlib` positive flag for `nogpulib` and alias to `--no-offloadlib` (PR #126567)

2025-02-11 Thread Yaxun Liu via cfe-commits
@@ -7088,7 +7088,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, } // Forward -nogpulib to -cc1. - if (Args.hasArg(options::OPT_nogpulib)) + if (!Args.hasFlag(options::OPT_offloadlib, options::OPT_no_offloadlib, true)) CmdArgs.push_back("-nogpuli

[clang] [Clang] Add __has_target_builtin macro (PR #126324)

2025-02-11 Thread Yaxun Liu via cfe-commits
@@ -96,6 +101,37 @@ the header file to conditionally make a function constexpr whenever the constant evaluation of the corresponding builtin (for example, ``std::fmax`` calls ``__builtin_fmax``) is supported in Clang. +``__has_target_builtin`` + +

[clang] Add clang atomic control options and attribute (PR #114841)

2025-01-29 Thread Yaxun Liu via cfe-commits
@@ -0,0 +1,19 @@ +//===--- AtomicOptions.def - Atomic Options database -*- C++ -*-===// +// +// 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: Ap

[clang] Reland "[HIP] Use original file path for CUID" (#108771) (PR #111885)

2025-01-29 Thread Yaxun Liu via cfe-commits
yxsamliu wrote: ping https://github.com/llvm/llvm-project/pull/111885 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

<    9   10   11   12   13   14   15   16   17   >