[clang] [compiler-rt] [llvm] [openmp] [PGO][Offload] Add GPU profiling flags to driver (PR #94268)

2024-06-24 Thread Ethan Luis McDonough via cfe-commits

EthanLuisMcDonough wrote:

> Is this something that specifically requires its own flag? Or could we just 
> do `-Xarch_device -fprofile-generate`.

Right now the `-fprofile-generate-gpu` and `-fprofile-instr-generate-gpu` flags 
make sure that the compiler-rt profiling library is included even if host 
profiling isn't enabled, but your suggestion seems quite nice and compact. I'm 
open to looking into this. Thoughts @jdoerfert?

https://github.com/llvm/llvm-project/pull/94268
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [compiler-rt] [llvm] [openmp] [PGO][Offload] Add GPU profiling flags to driver (PR #94268)

2024-06-24 Thread Joseph Huber via cfe-commits

jhuber6 wrote:

> @jhuber6 The clang format errors are mostly due to my local version of 
> `clang-format` disagreeing with the buildbot's version. Its a bit annoying, 
> but it shouldn't be too much of a problem given I plan on squashing and 
> merging once this gets approved.
> 
> I added new flags for GPU PGO specifically because I didn't want to modify 
> the PGO flags' existing behavior. PGO has a significant runtime cost, so I 
> figured it would be best for the end user experience to only enable PGO on 
> the GPU when it was specifically requested.

Is this something that specifically requires its own flag? Or could we just do 
`-Xarch_device -fprofile-generate`.

https://github.com/llvm/llvm-project/pull/94268
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [compiler-rt] [llvm] [openmp] [PGO][Offload] Add GPU profiling flags to driver (PR #94268)

2024-06-23 Thread Ethan Luis McDonough via cfe-commits

EthanLuisMcDonough wrote:

@jhuber6 The clang format errors are mostly due to my local version of 
`clang-format` disagreeing with the buildbot's version. Its a bit annoying, but 
it shouldn't be too much of a problem given I plan on squashing and merging 
once this gets approved.

I added new flags for GPU PGO specifically because I didn't want to modify the 
PGO flags' existing behavior. PGO has a significant runtime cost, so I figured 
it would be best for the end user experience to only enable PGO on the GPU when 
it was specifically requested.

https://github.com/llvm/llvm-project/pull/94268
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [compiler-rt] [llvm] [openmp] [PGO][Offload] Add GPU profiling flags to driver (PR #94268)

2024-06-23 Thread Joseph Huber via cfe-commits

https://github.com/jhuber6 commented:

Seems to be lots of accidental `clang-format` changes. Why do we need new flags 
for this instead of just using the old ones and changing behavior when the 
target is a known GPU? I.e. SPIR-V, CUDA, or HSA.

https://github.com/llvm/llvm-project/pull/94268
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [compiler-rt] [llvm] [openmp] [PGO][Offload] Add GPU profiling flags to driver (PR #94268)

2024-06-03 Thread via cfe-commits

github-actions[bot] wrote:




:warning: C/C++ code formatter, clang-format found issues in your code. 
:warning:



You can test this locally with the following command:


``bash
git-clang-format --diff 16832eb58563f77d917198ad9f86db1c2ee162c9 
ff0dd62cf1b236f1373fd3b70ec2875c3719ca04 -- 
offload/DeviceRTL/include/Profiling.h offload/DeviceRTL/src/Profiling.cpp 
offload/test/offloading/gpupgo/pgo1.c offload/test/offloading/gpupgo/pgo2.c 
clang/lib/CodeGen/CodeGenPGO.cpp clang/lib/Driver/ToolChain.cpp 
clang/lib/Driver/ToolChains/Clang.cpp 
compiler-rt/include/profile/InstrProfData.inc 
compiler-rt/lib/profile/InstrProfiling.h 
compiler-rt/lib/profile/InstrProfilingBuffer.c 
compiler-rt/lib/profile/InstrProfilingFile.c 
compiler-rt/lib/profile/InstrProfilingInternal.h 
compiler-rt/lib/profile/InstrProfilingWriter.c 
llvm/include/llvm/ProfileData/InstrProf.h 
llvm/include/llvm/ProfileData/InstrProfData.inc 
llvm/lib/ProfileData/InstrProf.cpp 
llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp 
llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp 
offload/include/Shared/Environment.h 
offload/plugins-nextgen/common/include/GlobalHandler.h 
offload/plugins-nextgen/common/src/GlobalHandler.cpp 
offload/plugins-nextgen/common/src/PluginInterface.cpp
``





View the diff from clang-format here.


``diff
diff --git a/offload/plugins-nextgen/common/include/GlobalHandler.h 
b/offload/plugins-nextgen/common/include/GlobalHandler.h
index 6daa8b1b85..1b38ce6521 100644
--- a/offload/plugins-nextgen/common/include/GlobalHandler.h
+++ b/offload/plugins-nextgen/common/include/GlobalHandler.h
@@ -65,13 +65,11 @@ struct __llvm_profile_data {
 };
 
 extern "C" {
-extern int __attribute__((weak))
-__llvm_write_custom_profile(const char *Target,
-const __llvm_profile_data *DataBegin,
-const __llvm_profile_data *DataEnd,
-const char *CountersBegin, const char *CountersEnd,
-const char *NamesBegin, const char *NamesEnd,
-const uint64_t *VersionOverride);
+extern int __attribute__((weak)) __llvm_write_custom_profile(
+const char *Target, const __llvm_profile_data *DataBegin,
+const __llvm_profile_data *DataEnd, const char *CountersBegin,
+const char *CountersEnd, const char *NamesBegin, const char *NamesEnd,
+const uint64_t *VersionOverride);
 }
 
 /// PGO profiling data extracted from a GPU device

``




https://github.com/llvm/llvm-project/pull/94268
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits