[clang] [Offloading][NFC] Move creation of offloading entries from OpenMP (PR #70116)

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

[clang] [NFC][Clang] Make GetSDLFromOffloadArchive and SDLSearch static (PR #70201)

2023-10-25 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 approved this pull request. All of this code can be deleted once we move HIP to the new driver. https://github.com/llvm/llvm-project/pull/70201 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cg

[clang] [Offloading][NFC] Move creation of offloading entries from OpenMP (PR #70116)

2023-10-25 Thread Joseph Huber via cfe-commits
jhuber6 wrote: > Maybe a clang documentation can be added for this generic offloading > toolchain for OpenMP/CUDA/HIP. Could be a brief description about the > offloading entries and registration mechanism in the beginning then buffy it > up later. We have https://clang.llvm.org/docs/Offloadi

[clang] [Offloading][NFC] Move creation of offloading entries from OpenMP (PR #70116)

2023-10-25 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 closed https://github.com/llvm/llvm-project/pull/70116 ___ 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-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] [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] [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] [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] [llvm] [LLVM] Add `__builtin_readsteadycounter` intrinsic and builtin for realtime clocks (PR #81331)

2024-02-12 Thread Joseph Huber via cfe-commits
jhuber6 wrote: > Are we assuming any particular relationship to __builtin_readcyclecounter in > terms of scales etc? > > __builtin_readsteadycounter could be used to access x86 MPERF clock counters, > but to access the corresponding APERF clock we'd then need a > __builtin_readvariablecounter

[clang] [llvm] [LLVM] Add `__builtin_readsteadycounter` intrinsic and builtin for realtime clocks (PR #81331)

2024-02-12 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 updated https://github.com/llvm/llvm-project/pull/81331 >From 30341079e795c2668588b791f2c97b44006e7a04 Mon Sep 17 00:00:00 2001 From: Joseph Huber Date: Fri, 9 Feb 2024 16:13:42 -0600 Subject: [PATCH] [WIP][LLVM] Add `__builtin_readsteadycounter` intrinsic and buiilt

[clang] f5fd0de - [LinkerWrapper][NFC] Rename 'all' to 'generic' for architecture agnostic IR

2024-02-12 Thread Joseph Huber via cfe-commits
Author: Joseph Huber Date: 2024-02-12T08:15:48-06:00 New Revision: f5fd0deb2371d0bae3bef2563f50e005a140fc6d URL: https://github.com/llvm/llvm-project/commit/f5fd0deb2371d0bae3bef2563f50e005a140fc6d DIFF: https://github.com/llvm/llvm-project/commit/f5fd0deb2371d0bae3bef2563f50e005a140fc6d.diff

[clang] [llvm] [LLVM] Add `__builtin_readsteadycounter` intrinsic and builtin for realtime clocks (PR #81331)

2024-02-12 Thread Joseph Huber via cfe-commits
jhuber6 wrote: > New intrinsic sounds right - a constant frequency counter is a different > thing to a variable frequency counter. > > "Steady" implies unchanging, so I'd agree with `readfixedfreqtimer` or > similar. I think `steady` has sufficient context here, (i.e. https://en.cppreference

[clang] [llvm] [LLVM] Add `__builtin_readsteadycounter` intrinsic and builtin for realtime clocks (PR #81331)

2024-02-12 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 updated https://github.com/llvm/llvm-project/pull/81331 >From 50c0bacb8c33ff0c3caf5554bd198904839a2d2c Mon Sep 17 00:00:00 2001 From: Joseph Huber Date: Fri, 9 Feb 2024 16:13:42 -0600 Subject: [PATCH] [WIP][LLVM] Add `__builtin_readsteadycounter` intrinsic and buiilt

[clang] [llvm] [LLVM] Add `__builtin_readsteadycounter` intrinsic and builtin for realtime clocks (PR #81331)

2024-02-12 Thread Joseph Huber via cfe-commits
@@ -2764,6 +2764,37 @@ Query for this feature with ``__has_builtin(__builtin_readcyclecounter)``. Note that even if present, its use may depend on run-time privilege or other OS controlled state. +``__builtin_readsteadycounter`` +-- + +``__builtin_

[clang] [llvm] [LLVM] Add `__builtin_readsteadycounter` intrinsic and builtin for realtime clocks (PR #81331)

2024-02-12 Thread Joseph Huber via cfe-commits
@@ -104,6 +104,7 @@ std::string SDNode::getOperationName(const SelectionDAG *G) const { case ISD::ATOMIC_STORE: return "AtomicStore"; case ISD::PCMARKER: return "PCMarker"; case ISD::READCYCLECOUNTER: return "ReadCycleCounter"; +

[clang] [llvm] [LLVM] Add `__builtin_readsteadycounter` intrinsic and builtin for realtime clocks (PR #81331)

2024-02-12 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 updated https://github.com/llvm/llvm-project/pull/81331 >From 4a0ee4be9690e0665ca93d63ffdd2dea404fd72d Mon Sep 17 00:00:00 2001 From: Joseph Huber Date: Fri, 9 Feb 2024 16:13:42 -0600 Subject: [PATCH] [LLVM] Add `__builtin_readsteadycounter` intrinsic and buiiltin S

[clang] [llvm] [LLVM] Add `__builtin_readsteadycounter` intrinsic and builtin for realtime clocks (PR #81331)

2024-02-12 Thread Joseph Huber via cfe-commits
jhuber6 wrote: > Add to release notes? Done https://github.com/llvm/llvm-project/pull/81331 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [LLVM] Add `__builtin_readsteadycounter` intrinsic and builtin for realtime clocks (PR #81331)

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

[clang] [clang][CodeGen] Shift relink option implementation away from module cloning (PR #81693)

2024-02-14 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 approved this pull request. Looks fine. https://github.com/llvm/llvm-project/pull/81693 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HIP] Allow partial linking for `-fgpu-rdc` (PR #81700)

2024-02-14 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 commented: This makes sense overall, though it's very complicated. Generally we just need to make sure these things are private to one group of files. There's a lot more to parse here compared to the `linker-wrapper`. Do any of these tests check when called with `-r`

[clang] fa9e297 - [ClangPackager] Fix passing in multiple instances of `file`

2024-02-14 Thread Joseph Huber via cfe-commits
Author: Joseph Huber Date: 2024-02-14T22:11:21-06:00 New Revision: fa9e297b8b63dacb962d99814e698658ad71f946 URL: https://github.com/llvm/llvm-project/commit/fa9e297b8b63dacb962d99814e698658ad71f946 DIFF: https://github.com/llvm/llvm-project/commit/fa9e297b8b63dacb962d99814e698658ad71f946.diff

[clang] [libc] [llvm] [openmp] [libc] Rework the GPU build to be a regular target (PR #81921)

2024-02-15 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 created https://github.com/llvm/llvm-project/pull/81921 Summary: This is a massive patch because it reworks the entire build and everything that depends on it. This is not split up because various bots would fail otherwise. I will attempt to describe the necessary chan

[clang] [libc] [llvm] [openmp] [libc] Rework the GPU build to be a regular target (PR #81921)

2024-02-15 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 updated https://github.com/llvm/llvm-project/pull/81921 >From 5fdaa384ebc962429950b79098dee0581c74f4f3 Mon Sep 17 00:00:00 2001 From: Joseph Huber Date: Tue, 13 Feb 2024 21:08:02 -0600 Subject: [PATCH] [libc] Rework the GPU build to be a regular target Summary: This

[clang] [libc] [llvm] [openmp] [libc] Rework the GPU build to be a regular target (PR #81921)

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

[clang] [libc] [llvm] [openmp] [libc] Rework the GPU build to be a regular target (PR #81921)

2024-02-15 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 updated https://github.com/llvm/llvm-project/pull/81921 >From 613402be5f027c7f5494513772d0f17dd046a3e8 Mon Sep 17 00:00:00 2001 From: Joseph Huber Date: Tue, 13 Feb 2024 21:08:02 -0600 Subject: [PATCH] [libc] Rework the GPU build to be a regular target Summary: This

[clang] [libc] [llvm] [openmp] [libc] Rework the GPU build to be a regular target (PR #81921)

2024-02-15 Thread Joseph Huber via cfe-commits
@@ -533,15 +542,14 @@ endfunction(add_integration_test) set(LIBC_HERMETIC_TEST_COMPILE_OPTIONS ${LIBC_COMPILE_OPTIONS_DEFAULT} jhuber6 wrote: Yeah there's a lot of logic that's moved and broken after rebasing. Trying to figure out what's changed. https://githu

[clang] [libc] [llvm] [openmp] [libc] Rework the GPU build to be a regular target (PR #81921)

2024-02-15 Thread Joseph Huber via cfe-commits
@@ -1,12 +1,9 @@ set(libc_archive_targets "") + list(APPEND added_archive_targets ${archive_1}) jhuber6 wrote: Don't know how that got there, I'll fix it. https://github.com/llvm/llvm-project/pull/81921 ___ cfe-commi

[clang] [libc] [llvm] [openmp] [libc] Rework the GPU build to be a regular target (PR #81921)

2024-02-15 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 updated https://github.com/llvm/llvm-project/pull/81921 >From caf0ee274f353b6adb23c455121ec2102c260de0 Mon Sep 17 00:00:00 2001 From: Joseph Huber Date: Tue, 13 Feb 2024 21:08:02 -0600 Subject: [PATCH] [libc] Rework the GPU build to be a regular target Summary: This

[clang] [libc] [llvm] [openmp] [libc] Rework the GPU build to be a regular target (PR #81921)

2024-02-15 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 updated https://github.com/llvm/llvm-project/pull/81921 >From d0f782f4db249f6be08dba5060ee403974c95fdf Mon Sep 17 00:00:00 2001 From: Joseph Huber Date: Tue, 13 Feb 2024 21:08:02 -0600 Subject: [PATCH] [libc] Rework the GPU build to be a regular target Summary: This

[clang] [libc] [llvm] [openmp] [libc] Rework the GPU build to be a regular target (PR #81921)

2024-02-15 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 updated https://github.com/llvm/llvm-project/pull/81921 >From 3c4a7ea70941fbf3c8a47c0715423ae38cc25a68 Mon Sep 17 00:00:00 2001 From: Joseph Huber Date: Tue, 13 Feb 2024 21:08:02 -0600 Subject: [PATCH] [libc] Rework the GPU build to be a regular target Summary: This

[clang] [llvm] [mlir] [openmp] [OpenMP] Remove `register_requires` global constructor (PR #80460)

2024-02-16 Thread Joseph Huber via cfe-commits
jhuber6 wrote: ping https://github.com/llvm/llvm-project/pull/80460 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Add 'CLANG_ALLOW_IMPLICIT_RPATH' to enable toolchain use of -rpath (PR #82004)

2024-02-16 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 created https://github.com/llvm/llvm-project/pull/82004 Summary: The original discussion in https://reviews.llvm.org/D118493 was that `clang` should not be adding `-rpath` implicitly for toolchains. The main motivation behind that change was the 'Fedora' toolchain disa

[clang] [Clang] Add 'CLANG_ALLOW_IMPLICIT_RPATH' to enable toolchain use of -rpath (PR #82004)

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

[clang] [Clang] Add 'CLANG_ALLOW_IMPLICIT_RPATH' to enable toolchain use of -rpath (PR #82004)

2024-02-16 Thread Joseph Huber via cfe-commits
jhuber6 wrote: > I don't think a CMake option is the right way to go here. For example, I > doubt we would actually use this CMake option in Fedora if this patch is > committed. Does Fedora only use default configurations when building its packages? > Does gcc use rpath for libgomp? That's i

[clang] [Clang] Add 'CLANG_ALLOW_IMPLICIT_RPATH' to enable toolchain use of -rpath (PR #82004)

2024-02-16 Thread Joseph Huber via cfe-commits
jhuber6 wrote: > > Does Fedora only use default configurations when building its packages? > > We try to stick to the defaults as much as possible. Having an implicit rpath > by default causes issues when building other RPMs with clang, and typically, > if we need to change something in order

[clang] [Clang] Add 'CLANG_ALLOW_IMPLICIT_RPATH' to enable toolchain use of -rpath (PR #82004)

2024-02-16 Thread Joseph Huber via cfe-commits
jhuber6 wrote: > > We could make this logic more complicated by checking the system > > automatically `execute_command(lsb_release)` or something. > > I think this is too complicated and fragile. If we want to do something > specifically to support the distro use case, I think we should do thi

[clang] [Clang] Add 'CLANG_ALLOW_IMPLICIT_RPATH' to enable toolchain use of -rpath (PR #82004)

2024-02-16 Thread Joseph Huber via cfe-commits
jhuber6 wrote: > > I believe right now the `rtlib-rpath` points to the path > > `${CLANG_BINARY}../lib/${HOST_TRIPLE}/`. I think it's definitely reasonable > > to not put this on system libraries if that's a solution, since we can > > generally assume it's a global installation and already cov

[clang] [libc] [llvm] [openmp] [libc] Rework the GPU build to be a regular target (PR #81921)

2024-02-16 Thread Joseph Huber via cfe-commits
@@ -135,86 +147,20 @@ function(_get_common_test_compile_options output_var flags) # list(APPEND compile_options "-Wglobal-constructors") # endif() endif() - if (LIBC_TARGET_ARCHITECTURE_IS_GPU) -# TODO: Set these flags -# list(APPEND compile_options "-nogp

[clang] [libc] [llvm] [openmp] [libc] Rework the GPU build to be a regular target (PR #81921)

2024-02-16 Thread Joseph Huber via cfe-commits
@@ -135,86 +147,20 @@ function(_get_common_test_compile_options output_var flags) # list(APPEND compile_options "-Wglobal-constructors") # endif() endif() - if (LIBC_TARGET_ARCHITECTURE_IS_GPU) -# TODO: Set these flags -# list(APPEND compile_options "-nogp

[clang] [Clang] Add 'CLANG_ALLOW_IMPLICIT_RPATH' to enable toolchain use of -rpath (PR #82004)

2024-02-16 Thread Joseph Huber via cfe-commits
jhuber6 wrote: > Could we have the upstream default be to install a clang.cfg file in bin/ > which has -fimplicit-openmp-rpath (or whatever the hoption is)? Configuration files as far as I'm aware can't do toolchain / language specific stuff, so it's a little weaker than being able to just res

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

2024-02-16 Thread Joseph Huber via cfe-commits
@@ -2067,6 +2067,10 @@ Constant *ConstantExpr::getBitCast(Constant *C, Type *DstTy, Constant *ConstantExpr::getAddrSpaceCast(Constant *C, Type *DstTy, bool OnlyIfReduced) { + // Skip cast if types are identical jhuber

[clang] [libc] [llvm] [openmp] [libc] Rework the GPU build to be a regular target (PR #81921)

2024-02-16 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 updated https://github.com/llvm/llvm-project/pull/81921 >From c4758c8663307708e5ac653a8692e595f4b1f4cc Mon Sep 17 00:00:00 2001 From: Joseph Huber Date: Tue, 13 Feb 2024 21:08:02 -0600 Subject: [PATCH] [libc] Rework the GPU build to be a regular target Summary: This

[clang] [libc] [llvm] [openmp] [libc] Rework the GPU build to be a regular target (PR #81921)

2024-02-17 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 updated https://github.com/llvm/llvm-project/pull/81921 >From 63e4205a9f5cc3ea8a4ce0730b01d78b6c9bde42 Mon Sep 17 00:00:00 2001 From: Joseph Huber Date: Tue, 13 Feb 2024 21:08:02 -0600 Subject: [PATCH] [libc] Rework the GPU build to be a regular target Summary: This

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