[clang] [openmp] [Clang][OpenMP] Fix ordering of processing of map clauses when mapping a struct. (PR #72410)

2023-11-20 Thread Joseph Huber via cfe-commits
@@ -7731,10 +7731,30 @@ class MappableExprsHandler { IsImplicit, Mapper, VarRef, ForDeviceAddr); }; +// Sort all map clauses and make sure all the maps containing array +// sections are processed last. +llvm::SmallVector SortedMapClauses;

[clang] [llvm] [Offload] Initial support for registering offloading entries on COFF targets (PR #72697)

2023-11-21 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 closed https://github.com/llvm/llvm-project/pull/72697 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [openmp] [Clang][OpenMP] Fix ordering of processing of map clauses when mapping a struct. (PR #72410)

2023-11-21 Thread Joseph Huber via cfe-commits
@@ -7731,10 +7731,30 @@ class MappableExprsHandler { IsImplicit, Mapper, VarRef, ForDeviceAddr); }; +// Sort all map clauses and make sure all the maps containing array +// sections are processed last. +llvm::SmallVector SortedMapClauses;

[mlir] [lld] [clang] [llvm] [AMDGPU] Change default AMDHSA Code Object version to 5 (PR #73000)

2023-11-21 Thread Joseph Huber via cfe-commits
@@ -88,7 +88,7 @@ class TargetOptions { COV_5 = 500, }; /// \brief Code object version for AMDGPU. - CodeObjectVersionKind CodeObjectVersion = CodeObjectVersionKind::COV_None; + CodeObjectVersionKind CodeObjectVersion = CodeObjectVersionKind::COV_5; j

[clang] [Clang] Introduce scoped variants of GNU atomic functions (PR #72280)

2023-11-21 Thread Joseph Huber via cfe-commits
jhuber6 wrote: > We're already assigning names to the different scopes; we're just doing it in > the `__MEMORY_SCOPE_*` preprocessor macros. Replacing `_MEMORY_SCOPE_SYSTEM` > in the code with `"system"` doesn't really change the nature of how we assign > names to scopes. > > If these are sup

[clang] [lld] [mlir] [llvm] [AMDGPU] Change default AMDHSA Code Object version to 5 (PR #73000)

2023-11-21 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 approved this pull request. Assuming all the tests pass, this LG and has been a long time coming. Thanks for working on this. https://github.com/llvm/llvm-project/pull/73000 ___ cfe-commits mailing list cfe-commits@lists.llv

[clang] [Clang][NVPTX] Allow passing arguments to the linker while standalone (PR #73030)

2023-11-21 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 created https://github.com/llvm/llvm-project/pull/73030 Summary: We support standalone compilation for the NVPTX architecture using 'nvlink' as our linker. Because of the special handling required to transform input files to cubins, as nvlink expects for some reason, w

[clang] [Clang][NVPTX] Allow passing arguments to the linker while standalone (PR #73030)

2023-11-21 Thread Joseph Huber via cfe-commits
jhuber6 wrote: I have a review up to change the issue I was observing in CMake when building the `libc` project https://github.com/llvm/llvm-project/pull/73030. That is required for this to work when compiling the test suite. https://github.com/llvm/llvm-project/pull/73030

[llvm] [lld] [mlir] [clang] [AMDGPU] Change default AMDHSA Code Object version to 5 (PR #73000)

2023-11-21 Thread Joseph Huber via cfe-commits
@@ -75,8 +75,8 @@ bb.2: store volatile i32 0, ptr addrspace(1) undef ret void } -; DEFAULTSIZE: .amdhsa_private_segment_fixed_size 4112 -; DEFAULTSIZE: ; ScratchSize: 4112 +; DEFAULTSIZE: .amdhsa_private_segment_fixed_size 16 jhuber6 wrote: My understandin

[clang] [Clang][NVPTX] Allow passing arguments to the linker while standalone (PR #73030)

2023-11-21 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 updated https://github.com/llvm/llvm-project/pull/73030 >From ee43e8f9ae90bcd70d46b17cfecb854711a4b1ce Mon Sep 17 00:00:00 2001 From: Joseph Huber Date: Tue, 21 Nov 2023 13:45:10 -0600 Subject: [PATCH] [Clang][NVPTX] Allow passing arguments to the linker while standa

[clang] [Clang] Introduce scoped variants of GNU atomic functions (PR #72280)

2023-11-21 Thread Joseph Huber via cfe-commits
jhuber6 wrote: > Missing change to clang/docs/LanguageExtensions.rst describing the new > builtins. > Will do. > Are there any other projects that we might want to coordinate with here? gcc, > maybe? Unknown, I've never collaborated with anyone outside of LLVM. I know they have handling of G

[clang] [Clang] Introduce scoped variants of GNU atomic functions (PR #72280)

2023-11-22 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 updated https://github.com/llvm/llvm-project/pull/72280 >From b244d36e78cf3e496a41369855e294a6e5765c6d Mon Sep 17 00:00:00 2001 From: Joseph Huber Date: Mon, 6 Nov 2023 07:08:18 -0600 Subject: [PATCH] [Clang] Introduce scoped variants of GNU atomic functions Summary:

[clang] [LinkerWrapper] Accept some needed lld-link linker arguments for COFF targets (PR #72889)

2023-11-22 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 updated https://github.com/llvm/llvm-project/pull/72889 >From d06171561581d9d15c14f756c8999b478e1d769e Mon Sep 17 00:00:00 2001 From: Joseph Huber Date: Mon, 20 Nov 2023 10:12:04 -0600 Subject: [PATCH 1/2] [LinkerWrapper] Accenp some neede COFF linker argument Summar

[clang] [LinkerWrapper] Accept some needed lld-link linker arguments for COFF targets (PR #72889)

2023-11-22 Thread Joseph Huber via cfe-commits
jhuber6 wrote: Do COFF / Windows libraries have a special file magic / handling? I may need to update the extraction code to handle those in a later patch. https://github.com/llvm/llvm-project/pull/72889 ___ cfe-commits mailing list cfe-commits@lists.

[llvm] [clang] [CUDA][HIP] Improve variable registration with the new driver (PR #73177)

2023-11-22 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 created https://github.com/llvm/llvm-project/pull/73177 Summary: This patch adds support for registering texture / surface variables from CUDA / HIP. Additionally, we now properly track the `extern` and `const` flags that are also used in these runtime functions. This

[clang] [LinkerWrapper] Accept some needed lld-link linker arguments for COFF targets (PR #72889)

2023-11-22 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 closed https://github.com/llvm/llvm-project/pull/72889 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [OpenMP][AMDGPU] Do not include 'ockl' implementations in OpenMP (PR #70462)

2023-10-27 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 closed https://github.com/llvm/llvm-project/pull/70462 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [OpenMP] Associate the KernelEnvironment with the GenericKernelTy (PR #70383)

2023-10-29 Thread Joseph Huber via cfe-commits
@@ -4078,8 +4092,20 @@ OpenMPIRBuilder::createTargetInit(const LocationDescription &Loc, bool IsSPMD) { Constant *DebugIndentionLevelVal = ConstantInt::getSigned(Int16, 0); Function *Kernel = Builder.GetInsertBlock()->getParent(); - auto [MinThreadsVal, MaxThreadsVal] =

[clang] [OpenMP] Associate the KernelEnvironment with the GenericKernelTy (PR #70383)

2023-10-29 Thread Joseph Huber via cfe-commits
@@ -339,9 +339,33 @@ Error GenericKernelTy::init(GenericDeviceTy &GenericDevice, ImagePtr = &Image; - PreferredNumThreads = GenericDevice.getDefaultNumThreads(); + // Retrieve kernel environment object for the kernel. + GlobalTy KernelEnv(std::string(Name) + "_kernel_env

[clang] [OpenMP] Associate the KernelEnvironment with the GenericKernelTy (PR #70383)

2023-10-29 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 edited https://github.com/llvm/llvm-project/pull/70383 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [OpenMP] Associate the KernelEnvironment with the GenericKernelTy (PR #70383)

2023-10-29 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 approved this pull request. Lots of churn but looks straightforward enough. Few nits. https://github.com/llvm/llvm-project/pull/70383 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mail

[clang] [Driver] Reject unsupported -mcmodel= (PR #70262)

2023-10-30 Thread Joseph Huber via cfe-commits
jhuber6 wrote: > > This is not being handled for AMDGPU Targets. > > I'm assuming this is an artifact of passing all arguments both the host > target and the offload target? @jhuber6 what's the correct way of filtering > out irrelevant codegen options? I don't know what the desired behavior i

[clang] [AMDGPU] Accept/Ignore any -mcmodel arguments. (PR #70760)

2023-10-31 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 approved this pull request. https://github.com/llvm/llvm-project/pull/70760 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [StackProtector] Do not emit the stack protector on GPU architectures (PR #70799)

2023-10-31 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 created https://github.com/llvm/llvm-project/pull/70799 Summary: This patch changes the code generation to not emit the stack protector metadata on unsupported architectures. The issue was caused by system toolchains emitting stack protector option by default which wou

[clang] [StackProtector] Do not emit the stack protector on GPU architectures (PR #70799)

2023-10-31 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 updated https://github.com/llvm/llvm-project/pull/70799 >From c791e527ee388659b35707816c0a67bee66dd0da Mon Sep 17 00:00:00 2001 From: Joseph Huber Date: Tue, 31 Oct 2023 08:12:01 -0500 Subject: [PATCH] [StackProtector] Do not emit the stack protector on GPU architect

[clang] [StackProtector] Do not emit the stack protector on GPU architectures (PR #70799)

2023-10-31 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 closed https://github.com/llvm/llvm-project/pull/70799 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [StackProtector] Do not emit the stack protector on GPU architectures (PR #70799)

2023-10-31 Thread Joseph Huber via cfe-commits
jhuber6 wrote: > Is there some reason stack protectors don't make sense on GPU targets? Or is > the issue just that the GPU targets in question don't have the necessary > runtime support? It's more of the latter as GPUs don't really have much of a runtime. That's why I didn't want to complete

[llvm] [openmp] [clang] [OpenMP] Introduce the KernelLaunchEnvironment as implicit argument (PR #70401)

2023-10-31 Thread Joseph Huber via cfe-commits
jhuber6 wrote: Small change that affects a lot of tests. LG once these are fixed: ``` MLIR :: Target/LLVMIR/omptarget-region-device-llvm.mlir MLIR :: Target/LLVMIR/omptarget-byref-bycopy-generation-device.mlir MLIR :: Target/LLVMIR/omptarget-declare-target-llvm-device.mlir ``` https://github.com

[openmp] [mlir] [llvm] [clang] [OpenMP] Introduce the KernelLaunchEnvironment as implicit argument (PR #70401)

2023-10-31 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 approved this pull request. LG https://github.com/llvm/llvm-project/pull/70401 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] 47d9fbc - [LinkerWrapper] Add 'Freestanding' config to the LTO pass

2023-11-01 Thread Joseph Huber via cfe-commits
Author: Joseph Huber Date: 2023-11-01T07:47:25-05:00 New Revision: 47d9fbc04b91fb03b6da294e82c2fb4bca6b6343 URL: https://github.com/llvm/llvm-project/commit/47d9fbc04b91fb03b6da294e82c2fb4bca6b6343 DIFF: https://github.com/llvm/llvm-project/commit/47d9fbc04b91fb03b6da294e82c2fb4bca6b6343.diff

[openmp] [clang] [OpenMP] Cleanup and fixes for ABI agnostic DeviceRTL (PR #71234)

2023-11-03 Thread Joseph Huber via cfe-commits
@@ -3086,10 +3139,14 @@ Error AMDGPUKernelTy::launchImpl(GenericDeviceTy &GenericDevice, // Only COV5 implicitargs needs to be set. COV4 implicitargs are not used. if (getImplicitArgsSize() == sizeof(utils::AMDGPUImplicitArgsTy)) { ImplArgs->BlockCountX = NumBlocks; +

[openmp] [clang] [OpenMP] Cleanup and fixes for ABI agnostic DeviceRTL (PR #71234)

2023-11-03 Thread Joseph Huber via cfe-commits
@@ -17468,19 +17468,19 @@ Value *EmitAMDGPUImplicitArgPtr(CodeGenFunction &CGF) { /// Emit code based on Code Object ABI version. /// COV_4: Emit code to use dispatch ptr /// COV_5: Emit code to use implicitarg ptr -/// COV_NONE : Emit code to load a global variable "l

[openmp] [clang] [OpenMP] Cleanup and fixes for ABI agnostic DeviceRTL (PR #71234)

2023-11-03 Thread Joseph Huber via cfe-commits
@@ -88,7 +88,7 @@ class TargetOptions { COV_5 = 500, }; /// \brief Code object version for AMDGPU. - CodeObjectVersionKind CodeObjectVersion = CodeObjectVersionKind::COV_None; + CodeObjectVersionKind CodeObjectVersion = CodeObjectVersionKind::COV_4; j

[clang] [Sema] atomic_compare_exchange: check failure memory order (PR #74959)

2023-12-12 Thread Joseph Huber via cfe-commits
jhuber6 wrote: Did this change anything for the `scoped_atomic_compare_exchange_n` variant I added recently? https://github.com/llvm/llvm-project/pull/74959 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman

[clang] Add SPIRV support to HIPAMD toolchain (PR #75357)

2023-12-13 Thread Joseph Huber via cfe-commits
jhuber6 wrote: Is generic the best name here? I feel like that's going to be heavily overloaded. https://github.com/llvm/llvm-project/pull/75357 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cf

[clang] Add SPIRV support to HIPAMD toolchain (PR #75357)

2023-12-13 Thread Joseph Huber via cfe-commits
jhuber6 wrote: > Is generic the best name here? I feel like that's going to be heavily > overloaded. I'd much prefer a new architecture that just treats "SPIR-V" as a > single architecture. E.g. `--offload-arch=spirv` or something. https://github.com/llvm/llvm-project/pull/75357 _

[clang] Add SPIRV support to HIPAMD toolchain (PR #75357)

2023-12-13 Thread Joseph Huber via cfe-commits
jhuber6 wrote: I feel like we should treat `spirv` in the same way we handle stuff like `sm_90` in the `CudaArch` enum. (We should probably also rename that as it's used for generic offloading now). OpenMP infers the triple from the arch, so in the future when OpenMP can handle SPIR-V we can s

[clang] Add SPIRV support to HIPAMD toolchain (PR #75357)

2023-12-13 Thread Joseph Huber via cfe-commits
jhuber6 wrote: > Perhaps we should consider prefixing it in some way (e.g. `hip-spirv` or > `amd-spirv`) that leaves the door open for some special handling (enable a > particular set of extensions only for amdgpu targeting SPIRV, try to deal > with missing builtins etc.) / flexibility? Unsur

[llvm] [clang] [LLVM] Add file magic detection for SPIR-V files. (PR #75363)

2023-12-13 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 updated https://github.com/llvm/llvm-project/pull/75363 >From 2700151916b0fd91c793930127412af5690c9e41 Mon Sep 17 00:00:00 2001 From: Joseph Huber Date: Wed, 13 Dec 2023 11:35:13 -0600 Subject: [PATCH 1/2] [LLVM] Add file magic detection for SPIR-V files. Summary: Mo

[llvm] [clang] [LLVM] Add file magic detection for SPIR-V files. (PR #75363)

2023-12-13 Thread Joseph Huber via cfe-commits
jhuber6 wrote: Added a test, for whatever reason I had to do a completely clean build to get the test to correctly pick up my changes to `Magic.cpp`, don't know why. https://github.com/llvm/llvm-project/pull/75363 ___ cfe-commits mailing list cfe-comm

[clang] Add SPIRV support to HIPAMD toolchain (PR #75357)

2023-12-13 Thread Joseph Huber via cfe-commits
@@ -209,6 +210,13 @@ void AMDGCN::Linker::ConstructJob(Compilation &C, const JobAction &JA, if (JA.getType() == types::TY_LLVM_BC) return constructLlvmLinkCommand(C, JA, Inputs, Output, Args); + if (Args.getLastArgValue(options::OPT_mcpu_EQ) == "generic") { +llvm::

[clang] [OpenMP] Introduce -fopenmp-force-usm flag (PR #75468)

2023-12-14 Thread Joseph Huber via cfe-commits
@@ -129,6 +129,22 @@ AMDGPUOpenMPToolChain::GetCXXStdlibType(const ArgList &Args) const { void AMDGPUOpenMPToolChain::AddClangSystemIncludeArgs( const ArgList &DriverArgs, ArgStringList &CC1Args) const { HostTC.AddClangSystemIncludeArgs(DriverArgs, CC1Args); + + CC1Args

[clang] [OpenMP] Introduce -fopenmp-force-usm flag (PR #75468)

2023-12-14 Thread Joseph Huber via cfe-commits
@@ -129,6 +129,22 @@ AMDGPUOpenMPToolChain::GetCXXStdlibType(const ArgList &Args) const { void AMDGPUOpenMPToolChain::AddClangSystemIncludeArgs( const ArgList &DriverArgs, ArgStringList &CC1Args) const { HostTC.AddClangSystemIncludeArgs(DriverArgs, CC1Args); + + CC1Args

[clang] [OpenMP] Introduce -fopenmp-force-usm flag (PR #75468)

2023-12-14 Thread Joseph Huber via cfe-commits
@@ -3381,6 +3381,8 @@ def fopenmp_cuda_blocks_per_sm_EQ : Joined<["-"], "fopenmp-cuda-blocks-per-sm="> Flags<[NoArgumentUnused, HelpHidden]>, Visibility<[ClangOption, CC1Option]>; def fopenmp_cuda_teams_reduction_recs_num_EQ : Joined<["-"], "fopenmp-cuda-teams-reduction-recs

[clang] [OpenMP] Introduce -fopenmp-force-usm flag (PR #75468)

2023-12-14 Thread Joseph Huber via cfe-commits
@@ -3381,6 +3381,8 @@ def fopenmp_cuda_blocks_per_sm_EQ : Joined<["-"], "fopenmp-cuda-blocks-per-sm="> Flags<[NoArgumentUnused, HelpHidden]>, Visibility<[ClangOption, CC1Option]>; def fopenmp_cuda_teams_reduction_recs_num_EQ : Joined<["-"], "fopenmp-cuda-teams-reduction-recs

[flang] [clang] [lldb] [libc] [compiler-rt] [clang-tools-extra] [lld] [llvm] [libcxx] [openmp] Gcc 75 libomptarget type convert (PR #75562)

2023-12-15 Thread Joseph Huber via cfe-commits
@@ -47,7 +47,9 @@ PluginAdaptorTy::create(const std::string &Name) { new PluginAdaptorTy(Name, std::move(LibraryHandler))); if (auto Err = PluginAdaptor->init()) return Err; - return PluginAdaptor; jhuber6 wrote: Does putting `std::move` here not

[clang] Revert "[LinkerWrapper] Add 'Freestanding' config to the LTO pass" (PR #75528)

2023-12-15 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 approved this pull request. https://github.com/llvm/llvm-project/pull/75528 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Revert "[LinkerWrapper] Add 'Freestanding' config to the LTO pass" (PR #75528)

2023-12-15 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 closed https://github.com/llvm/llvm-project/pull/75528 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [LinkerWrapper] Forward more arguments to the CPU offloading linker (PR #75757)

2023-12-17 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 created https://github.com/llvm/llvm-project/pull/75757 Summary: The CPU target currently inherits all the libraries from the normal link job to ensure that it has access to the same envrionment that the host does. However, this previously was not respecting argument l

[clang] [clang-linker-wrapper] Re-use type returned from 'PointerType::getUnqual(C)' (NFC) (PR #73374)

2023-11-24 Thread Joseph Huber via cfe-commits
@@ -458,44 +459,39 @@ void createRegisterFatbinFunction(Module &M, GlobalVariable *FatbinDesc, DtorFunc->setSection(".text.startup"); // Get the __cudaRegisterFatBinary function declaration. - auto *RegFatTy = FunctionType::get(PointerType::getUnqual(C)->getPointerTo(),

[clang] [clang-linker-wrapper] Re-use type returned from 'PointerType::getUnqual(C)' (NFC) (PR #73374)

2023-11-24 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 edited https://github.com/llvm/llvm-project/pull/73374 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-linker-wrapper] Re-use type returned from 'PointerType::getUnqual(C)' (NFC) (PR #73374)

2023-11-24 Thread Joseph Huber via cfe-commits
@@ -457,45 +457,42 @@ void createRegisterFatbinFunction(Module &M, GlobalVariable *FatbinDesc, IsHIP ? ".hip.fatbin_unreg" : ".cuda.fatbin_unreg", &M); DtorFunc->setSection(".text.startup"); + auto *PtrTy = PointerType::getUnqual(C); + // Get the

[clang] [clang-linker-wrapper] Re-use type returned from 'PointerType::getUnqual(C)' (NFC) (PR #73374)

2023-11-24 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 approved this pull request. Thanks, this was never properly cleaned up after moving to opaque pointers. https://github.com/llvm/llvm-project/pull/73374 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llv

[llvm] [clang] [CUDA][HIP] Improve variable registration with the new driver (PR #73177)

2023-11-29 Thread Joseph Huber via cfe-commits
jhuber6 wrote: Ping https://github.com/llvm/llvm-project/pull/73177 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][NVPTX] Allow passing arguments to the linker while standalone (PR #73030)

2023-11-29 Thread Joseph Huber via cfe-commits
jhuber6 wrote: Ping https://github.com/llvm/llvm-project/pull/73030 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][OpenMP] Fix missing DI for __kmpc_global_thread_num (PR #73856)

2023-11-29 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 approved this pull request. AFAIK this is the correct way to set debug information for something that doesn't have a valid source location like a lot of generated OpenMP calls. https://github.com/llvm/llvm-project/pull/73856 ___

[clang] [clang][OpenMP] Fix missing DI for __kmpc_global_thread_num (PR #73856)

2023-11-30 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 closed https://github.com/llvm/llvm-project/pull/73856 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Introduce scoped variants of GNU atomic functions (PR #72280)

2023-11-30 Thread Joseph Huber via cfe-commits
jhuber6 wrote: > My primary concerns here are: > > * It being likely these builtins will be superseded by something else > once someone else tries to standardize this. Maybe this isn't a big deal... > but maybe we want to choose names that are less likely to overlap with stuff > anyone e

[clang] [Clang] Introduce scoped variants of GNU atomic functions (PR #72280)

2023-11-30 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 updated https://github.com/llvm/llvm-project/pull/72280 >From ce494cd3f50720b6ba2b8a689f30272c09c06d00 Mon Sep 17 00:00:00 2001 From: Joseph Huber Date: Mon, 6 Nov 2023 07:08:18 -0600 Subject: [PATCH] [Clang] Introduce scoped variants of GNU atomic functions Summary:

[clang] [Driver][LTO] Copy fix empty stats filename to AMDGPU, HIPAMD, MinGW (PR #74178)

2023-12-01 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 commented: Why couldn't you have put this logic in `addLTOOptions`? Seems like it's copy-pasted verbatim at every site now. AMD should handle very similarly to Linux here. They both compile down to LLVM-IR and get sent to `ld.lld`. https://github.com/llvm/llvm-proje

[clang] [openmp] [Clang][OpenMP] Fix mapping of structs to device (PR #75642)

2023-12-21 Thread Joseph Huber via cfe-commits
jhuber6 wrote: > This fails for me on the host and the AMD GPU: GPU: > > ``` > # | :217:1: note: possible intended match here > # | dat.datum[dat.arr[0][0]] = 5 > ``` > > X86: > > ``` > # | :134:1: note: possible intended match here > # | dat.datum[dat.arr[0][0]] = 5461 > ``` > > The location

[clang] [OpenMP][USM] Introduces -fopenmp-force-usm flag (PR #76571)

2023-12-29 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 commented: Needs a test. There should be some difference in codegen we can key off of. https://github.com/llvm/llvm-project/pull/76571 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mai

[clang] [OpenMP][USM] Introduces -fopenmp-force-usm flag (PR #76571)

2023-12-29 Thread Joseph Huber via cfe-commits
jhuber6 wrote: > Is the approach taken in this approach acceptable as opposed to the header > solution I put up earlier? Yes, it's pretty much exactly what I had in mind from my suggestion in the last PR. Thanks. https://github.com/llvm/llvm-project/pull/76571

[llvm] [clang-tools-extra] [openmp] [clang] [PGO][OpenMP] Instrumentation for GPU devices (PR #76587)

2023-12-29 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 edited https://github.com/llvm/llvm-project/pull/76587 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [llvm] [clang] [openmp] [PGO][OpenMP] Instrumentation for GPU devices (PR #76587)

2023-12-29 Thread Joseph Huber via cfe-commits
@@ -428,13 +428,22 @@ std::string getPGOFuncNameVarName(StringRef FuncName, return VarName; } +bool isGPUProfTarget(const Module &M) { + const auto &triple = M.getTargetTriple(); + return triple.rfind("nvptx", 0) == 0 || triple.rfind("amdgcn", 0) == 0 || + triple.r

[openmp] [llvm] [clang] [clang-tools-extra] [PGO][OpenMP] Instrumentation for GPU devices (PR #76587)

2023-12-29 Thread Joseph Huber via cfe-commits
@@ -959,8 +959,14 @@ void CodeGenPGO::emitCounterIncrement(CGBuilderTy &Builder, const Stmt *S, unsigned Counter = (*RegionCounterMap)[S]; - llvm::Value *Args[] = {FuncNameVar, - Builder.getInt64(FunctionHash), + // Make sure that pointer to globa

[openmp] [clang-tools-extra] [llvm] [clang] [PGO][OpenMP] Instrumentation for GPU devices (PR #76587)

2023-12-29 Thread Joseph Huber via cfe-commits
@@ -0,0 +1,21 @@ +//=== Profiling.h - OpenMP interface -- 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: Apa

[openmp] [clang] [llvm] [clang-tools-extra] [PGO][OpenMP] Instrumentation for GPU devices (PR #76587)

2023-12-29 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 commented: Some quick nits, will look more later. https://github.com/llvm/llvm-project/pull/76587 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Add SPIRV support to HIPAMD toolchain (PR #75357)

2024-01-03 Thread Joseph Huber via cfe-commits
jhuber6 wrote: > > How about using `--offload=` which can take a target triple? E.g. > > * `--offload=spirv64-amd` or something like that: pick HIPAMD tool chain. > > * `--offload=spirv64`: pick HIPSPV tool chain. > > > And also remove this > [limitation](https://github.com/llvm/llv

[clang] [OpenMP][USM] Adds test for -fopenmp-force-usm flag (PR #75467)

2024-01-03 Thread Joseph Huber via cfe-commits
jhuber6 wrote: Test should probably show that IR is equivalent to `#pragma omp requires unified_shared_memory` or however that's spelled. Basic documentation should be provided by the help test in the new flag, but we probably have somewhere in the OpenMP docs you could add it to if desired.

[clang] [OpenMP] Change `__tgt_device_image` to point to the image (PR #77003)

2024-01-04 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 created https://github.com/llvm/llvm-project/pull/77003 Summary: We use the OffloadBinary to contain bundled offloading objects used to support many images / targets at the same time. The `__tgt_device_info` struct used to contain a pointer to this underlying binary fo

[lld] [libc] [clang-tools-extra] [compiler-rt] [lldb] [llvm] [flang] [libcxx] [openmp] [clang] [PGO][OpenMP] Instrumentation for GPU devices (PR #76587)

2024-01-04 Thread Joseph Huber via cfe-commits
@@ -163,3 +163,87 @@ Error GenericGlobalHandlerTy::readGlobalFromImage(GenericDeviceTy &Device, return Plugin::success(); } + +bool GenericGlobalHandlerTy::hasProfilingGlobals(GenericDeviceTy &Device, + DeviceImageTy &Image) {

[libc] [clang] [lld] [clang-tools-extra] [compiler-rt] [flang] [lldb] [libcxx] [llvm] [openmp] [PGO][OpenMP] Instrumentation for GPU devices (PR #76587)

2024-01-04 Thread Joseph Huber via cfe-commits
@@ -163,3 +163,87 @@ Error GenericGlobalHandlerTy::readGlobalFromImage(GenericDeviceTy &Device, return Plugin::success(); } + +bool GenericGlobalHandlerTy::hasProfilingGlobals(GenericDeviceTy &Device, + DeviceImageTy &Image) {

[compiler-rt] [lldb] [openmp] [llvm] [clang-tools-extra] [lld] [flang] [clang] [libcxx] [libc] [PGO][OpenMP] Instrumentation for GPU devices (PR #76587)

2024-01-04 Thread Joseph Huber via cfe-commits
@@ -163,3 +163,87 @@ Error GenericGlobalHandlerTy::readGlobalFromImage(GenericDeviceTy &Device, return Plugin::success(); } + +bool GenericGlobalHandlerTy::hasProfilingGlobals(GenericDeviceTy &Device, + DeviceImageTy &Image) {

[compiler-rt] [clang] [clang-tools-extra] [flang] [llvm] [libcxx] [lld] [lldb] [libc] [openmp] [PGO][OpenMP] Instrumentation for GPU devices (PR #76587)

2024-01-04 Thread Joseph Huber via cfe-commits
@@ -58,6 +60,22 @@ class GlobalTy { void setPtr(void *P) { Ptr = P; } }; +typedef void *IntPtrT; jhuber6 wrote: What's the utility of this? https://github.com/llvm/llvm-project/pull/76587 ___ cfe-commits mailing

[lld] [clang-tools-extra] [openmp] [flang] [libc] [libcxx] [llvm] [lldb] [compiler-rt] [clang] [PGO][OpenMP] Instrumentation for GPU devices (PR #76587)

2024-01-04 Thread Joseph Huber via cfe-commits
@@ -58,6 +60,22 @@ class GlobalTy { void setPtr(void *P) { Ptr = P; } }; +typedef void *IntPtrT; +struct __llvm_profile_data { +#define INSTR_PROF_DATA(Type, LLVMType, Name, Initializer) Type Name; +#include "llvm/ProfileData/InstrProfData.inc" +}; + +/// PGO profiling data

[lld] [libcxx] [clang-tools-extra] [compiler-rt] [clang] [flang] [llvm] [libc] [openmp] [lldb] [PGO][OpenMP] Instrumentation for GPU devices (PR #76587)

2024-01-04 Thread Joseph Huber via cfe-commits
@@ -163,3 +163,87 @@ Error GenericGlobalHandlerTy::readGlobalFromImage(GenericDeviceTy &Device, return Plugin::success(); } + +bool GenericGlobalHandlerTy::hasProfilingGlobals(GenericDeviceTy &Device, + DeviceImageTy &Image) {

[libc] [openmp] [compiler-rt] [libcxx] [clang-tools-extra] [lld] [llvm] [clang] [flang] [lldb] [PGO][OpenMP] Instrumentation for GPU devices (PR #76587)

2024-01-04 Thread Joseph Huber via cfe-commits
@@ -163,3 +163,87 @@ Error GenericGlobalHandlerTy::readGlobalFromImage(GenericDeviceTy &Device, return Plugin::success(); } + +bool GenericGlobalHandlerTy::hasProfilingGlobals(GenericDeviceTy &Device, + DeviceImageTy &Image) {

[lld] [lldb] [clang-tools-extra] [compiler-rt] [flang] [llvm] [clang] [libcxx] [openmp] [libc] [PGO][OpenMP] Instrumentation for GPU devices (PR #76587)

2024-01-04 Thread Joseph Huber via cfe-commits
@@ -163,3 +163,87 @@ Error GenericGlobalHandlerTy::readGlobalFromImage(GenericDeviceTy &Device, return Plugin::success(); } + +bool GenericGlobalHandlerTy::hasProfilingGlobals(GenericDeviceTy &Device, + DeviceImageTy &Image) {

[openmp] [lld] [clang-tools-extra] [libcxx] [llvm] [flang] [libc] [clang] [lldb] [compiler-rt] [PGO][OpenMP] Instrumentation for GPU devices (PR #76587)

2024-01-04 Thread Joseph Huber via cfe-commits
@@ -163,3 +163,87 @@ Error GenericGlobalHandlerTy::readGlobalFromImage(GenericDeviceTy &Device, return Plugin::success(); } + +bool GenericGlobalHandlerTy::hasProfilingGlobals(GenericDeviceTy &Device, + DeviceImageTy &Image) {

[clang] [Clang][OpenMP] Fix stdio.h wrapper when glibc includes again (PR #77017)

2024-01-04 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 approved this pull request. TYVM for fixing this. There's a lot of hacky stuff we need to do here to make it work, but it is what it is. Guessing the other wrapped files are fine? I remember having problems with `cytype` and `string` but I hopefully resolved a lot of

[clang-tools-extra] [libc] [lldb] [openmp] [clang] [llvm] [flang] [compiler-rt] [libcxx] [lld] [PGO][OpenMP] Instrumentation for GPU devices (PR #76587)

2024-01-05 Thread Joseph Huber via cfe-commits
@@ -58,6 +60,22 @@ class GlobalTy { void setPtr(void *P) { Ptr = P; } }; +typedef void *IntPtrT; +struct __llvm_profile_data { +#define INSTR_PROF_DATA(Type, LLVMType, Name, Initializer) Type Name; +#include "llvm/ProfileData/InstrProfData.inc" +}; + +/// PGO profiling data

[clang-tools-extra] [libc] [lldb] [openmp] [clang] [llvm] [flang] [compiler-rt] [libcxx] [lld] [PGO][OpenMP] Instrumentation for GPU devices (PR #76587)

2024-01-05 Thread Joseph Huber via cfe-commits
@@ -58,6 +60,22 @@ class GlobalTy { void setPtr(void *P) { Ptr = P; } }; +typedef void *IntPtrT; jhuber6 wrote: Okay. you should use the C++ `using` keyword instead of C's `typedef. https://github.com/llvm/llvm-project/pull/76587 __

[clang] [libc] [lld] [lldb] [clang-tools-extra] [llvm] [compiler-rt] [flang] [libcxx] [openmp] [PGO][OpenMP] Instrumentation for GPU devices (PR #76587)

2024-01-05 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 edited https://github.com/llvm/llvm-project/pull/76587 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [libc] [lld] [lldb] [clang-tools-extra] [llvm] [compiler-rt] [flang] [libcxx] [openmp] [PGO][OpenMP] Instrumentation for GPU devices (PR #76587)

2024-01-05 Thread Joseph Huber via cfe-commits
@@ -163,3 +163,87 @@ Error GenericGlobalHandlerTy::readGlobalFromImage(GenericDeviceTy &Device, return Plugin::success(); } + +bool GenericGlobalHandlerTy::hasProfilingGlobals(GenericDeviceTy &Device, + DeviceImageTy &Image) {

[flang] [clang] [Flang][Driver] Enable gpulibc/nogpulibc options for Flang, which allows linking of GPU LIBC for the fortran and OpenMP runtime (PR #77135)

2024-01-05 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 approved this pull request. Accepting this with Fortran makes sense. This option basically controls whether or not the GPU toolchain will implicitly include the `libcgpu.a` static library via `-lcgpu`. It defaults to on if it finds the `libc` wrapper headers in the `

[flang] [clang] [Flang][Driver] Enable gpulibc/nogpulibc options for Flang, which allows linking of GPU LIBC for the fortran and OpenMP runtime (PR #77135)

2024-01-05 Thread Joseph Huber via cfe-commits
jhuber6 wrote: > Makes sense to me, though this is not my area of expertise. Could you add a > bit more elaborate test? Perhaps something that would check the linker > invocation>? I'm not familiar with how Fortran handles stuff here. It's tested in the `clang` portion at least. The handling

[clang] [OpenMP] Change `__tgt_device_image` to point to the image (PR #77003)

2024-01-05 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 closed https://github.com/llvm/llvm-project/pull/77003 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[flang] [clang] [Flang][Driver] Enable gpulibc/nogpulibc options for Flang, which allows linking of GPU LIBC for the fortran and OpenMP runtime (PR #77135)

2024-01-05 Thread Joseph Huber via cfe-commits
jhuber6 wrote: > I am gonna sign off for the weekend as it's quite late here, so I'll reply in > a little more detail on Monday and update the PR further. but I'd be happy to > add a further flang test, although not too sure what it'd be, so suggestions > are welcome. > > I tested this with a

[clang] [OpenMP] Change `__tgt_device_image` to point to the image (PR #77003)

2024-01-07 Thread Joseph Huber via cfe-commits
@@ -19,8 +19,8 @@ // OPENMP-COFF: @__start_omp_offloading_entries = hidden constant [0 x %struct.__tgt_offload_entry] zeroinitializer, section "omp_offloading_entries$OA" // OPENMP-COFF-NEXT: @__stop_omp_offloading_entries = hidden constant [0 x %struct.__tgt_offload_ent

[clang] 8f76f18 - [OpenMP][Obvious] Fix test failing on BE architectures

2024-01-07 Thread Joseph Huber via cfe-commits
Author: Joseph Huber Date: 2024-01-07T08:38:50-06:00 New Revision: 8f76f1816ea63b7cc28e150ba319ffbfe6351f9e URL: https://github.com/llvm/llvm-project/commit/8f76f1816ea63b7cc28e150ba319ffbfe6351f9e DIFF: https://github.com/llvm/llvm-project/commit/8f76f1816ea63b7cc28e150ba319ffbfe6351f9e.diff

[clang-tools-extra] [flang] [libcxx] [lld] [compiler-rt] [lldb] [clang] [llvm] [libc] [openmp] [PGO][OpenMP] Instrumentation for GPU devices (PR #76587)

2024-01-08 Thread Joseph Huber via cfe-commits
@@ -58,6 +60,22 @@ class GlobalTy { void setPtr(void *P) { Ptr = P; } }; +typedef void *IntPtrT; +struct __llvm_profile_data { +#define INSTR_PROF_DATA(Type, LLVMType, Name, Initializer) Type Name; +#include "llvm/ProfileData/InstrProfData.inc" +}; + +/// PGO profiling data

[clang] [AMDGPU] add function attrbute amdgpu-lib-fun (PR #74737)

2024-01-09 Thread Joseph Huber via cfe-commits
jhuber6 wrote: My use-case is more to be able to write functions like `is_wavefrontsize64()` in regular C++ code. This would require some way to emit builtins for these. I believe the use-case here is a workaround for the issues caused by library ordering? I'm guessing this is related to the p

[clang] [AMDGPU] add function attrbute amdgpu-lib-fun (PR #74737)

2024-01-09 Thread Joseph Huber via cfe-commits
jhuber6 wrote: > I was thinking of implementing libm/libc for nvptx, which would produce an IR > library . We'll still need to keep the functions around if they are not used > explicitly, because we may need them to fulfill libcalls later in the > compilation pipeline. Sort of a libdevice repl

[clang] [AMDGPU] add function attrbute amdgpu-lib-fun (PR #74737)

2024-01-09 Thread Joseph Huber via cfe-commits
@@ -2011,6 +2011,13 @@ def AMDGPUNumVGPR : InheritableAttr { let Subjects = SubjectList<[Function], ErrorDiag, "kernel functions">; } +def AMDGPULibFun : InheritableAttr { jhuber6 wrote: Why isn't this a `TargetSpecificAttr`? We should have one for AMDGPU.

[clang] [AMDGPU] add function attrbute amdgpu-lib-fun (PR #74737)

2024-01-09 Thread Joseph Huber via cfe-commits
@@ -2693,6 +2693,17 @@ An error will be given if: }]; } +def AMDGPULibFunDocs : Documentation { + let Category = DocCatAMDGPUAttributes; + let Content = [{ +The ``amdgpu_lib_fun`` attribute can be applied to a function for AMDGPU target +to indicate it is a library functio

[clang] [AMDGPU] add function attrbute amdgpu-lib-fun (PR #74737)

2024-01-09 Thread Joseph Huber via cfe-commits
jhuber6 wrote: > > An AMDGPU library function is not internalized and can be used to fullfill > > calls generated by LLVM passes or instruction selection. > > I am confused by the description of "internalized". Do you refer to LTO > internalization? You can leverage `llvm.used` to disable LTO

[clang] 56ab966 - [CUDA] Stop adding CUDA features twice

2022-06-29 Thread Joseph Huber via cfe-commits
Author: Joseph Huber Date: 2022-06-29T09:34:09-04:00 New Revision: 56ab966a04dd22570fcb18276e2409c94e82c571 URL: https://github.com/llvm/llvm-project/commit/56ab966a04dd22570fcb18276e2409c94e82c571 DIFF: https://github.com/llvm/llvm-project/commit/56ab966a04dd22570fcb18276e2409c94e82c571.diff

[clang] 34fc1db - [LinkerWrapper] Change wrapping to include jumps for other variables

2022-06-29 Thread Joseph Huber via cfe-commits
Author: Joseph Huber Date: 2022-06-29T14:48:39-04:00 New Revision: 34fc1db9a8b22300a90e71fe7285501e7bcdc90e URL: https://github.com/llvm/llvm-project/commit/34fc1db9a8b22300a90e71fe7285501e7bcdc90e DIFF: https://github.com/llvm/llvm-project/commit/34fc1db9a8b22300a90e71fe7285501e7bcdc90e.diff

[clang] f892ddb - [OpenMP] Add variant extension that applies to declarations

2022-06-29 Thread Joseph Huber via cfe-commits
Author: Joseph Huber Date: 2022-06-29T15:04:26-04:00 New Revision: f892ddb3be640f477fc9acef55e7bd613fc27acf URL: https://github.com/llvm/llvm-project/commit/f892ddb3be640f477fc9acef55e7bd613fc27acf DIFF: https://github.com/llvm/llvm-project/commit/f892ddb3be640f477fc9acef55e7bd613fc27acf.diff

<    1   2   3   4   5   6   7   8   9   10   >