[clang] [compiler-rt] [llvm] [PGO][HIP] Fix HIP device profile collection and sections emission (PR #202095)
Yaxun Liu via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 11 12:02:46 PDT 2026
================
@@ -1407,6 +1420,26 @@ void CGNVCUDARuntime::emitOffloadProfilingSections() {
M, PtrTy, /*isConstant=*/false, llvm::GlobalValue::ExternalLinkage,
llvm::ConstantPointerNull::get(PtrTy), Name);
CGM.addCompilerUsedGlobal(OffloadProfShadow);
+
+ auto AddSectionShadow = [&](StringRef Kind, const Twine &DeviceName) {
+ std::string ShadowName =
+ (Twine("__llvm_profile_shadow_") + Kind + "_" + CUIDHash + "_" +
+ Twine(OffloadProfSectionShadows.size()))
+ .str();
+ auto *Shadow = new llvm::GlobalVariable(
+ M, PtrTy, /*isConstant=*/false, llvm::GlobalValue::ExternalLinkage,
+ llvm::ConstantPointerNull::get(PtrTy), ShadowName);
+ CGM.addCompilerUsedGlobal(Shadow);
+ OffloadProfSectionShadows.push_back({Shadow, DeviceName.str()});
+ };
+
+ for (auto &&I : EmittedKernels) {
----------------
yxsamliu wrote:
Added the matching CodeGen-side comment.
https://github.com/llvm/llvm-project/pull/202095
More information about the cfe-commits
mailing list