Skip to content

Conversation

@EthanLuisMcDonough
Copy link
Member

After #163011 was merged, the tests in offload/test/offloading/gpupgo broke because the offload plugins were no longer able to find __llvm_prf_nm. This pull request explicitly makes __llvm_prf_nm visible to the host on GPU targets and reverses the changes made in f7e9968.

@llvmbot llvmbot added PGO Profile Guided Optimizations llvm:transforms offload labels Nov 4, 2025
@llvmbot
Copy link
Member

llvmbot commented Nov 4, 2025

@llvm/pr-subscribers-offload

@llvm/pr-subscribers-pgo

Author: Ethan Luis McDonough (EthanLuisMcDonough)

Changes

After #163011 was merged, the tests in offload/test/offloading/gpupgo broke because the offload plugins were no longer able to find __llvm_prf_nm. This pull request explicitly makes __llvm_prf_nm visible to the host on GPU targets and reverses the changes made in f7e9968.


Full diff: https://github.com/llvm/llvm-project/pull/166444.diff

5 Files Affected:

  • (modified) llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp (+4)
  • (modified) offload/test/offloading/gpupgo/pgo_atomic_teams.c (-1)
  • (modified) offload/test/offloading/gpupgo/pgo_atomic_threads.c (-1)
  • (modified) offload/test/offloading/gpupgo/pgo_device_and_host.c (-1)
  • (modified) offload/test/offloading/gpupgo/pgo_device_only.c (-1)
diff --git a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp index b5548d4f24a2f..8c8d16a6e3d25 100644 --- a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp +++ b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp @@ -1944,6 +1944,10 @@ void InstrLowerer::emitNameData() { NamesVar = new GlobalVariable(M, NamesVal->getType(), true, GlobalValue::PrivateLinkage, NamesVal, getInstrProfNamesVarName()); + if (isGPUProfTarget(M)) { + NamesVar->setLinkage(GlobalValue::ExternalLinkage); + NamesVar->setVisibility(GlobalValue::ProtectedVisibility); + } NamesSize = CompressedNameStr.size(); setGlobalVariableLargeSection(TT, *NamesVar); diff --git a/offload/test/offloading/gpupgo/pgo_atomic_teams.c b/offload/test/offloading/gpupgo/pgo_atomic_teams.c index 42d8ae43beba1..b3b72db080392 100644 --- a/offload/test/offloading/gpupgo/pgo_atomic_teams.c +++ b/offload/test/offloading/gpupgo/pgo_atomic_teams.c @@ -18,7 +18,6 @@ // REQUIRES: amdgpu // REQUIRES: pgo -// XFAIL: amdgpu int test1(int a) { return a / 2; } int test2(int a) { return a * 2; } diff --git a/offload/test/offloading/gpupgo/pgo_atomic_threads.c b/offload/test/offloading/gpupgo/pgo_atomic_threads.c index 09a4dc1577822..440a6b533317d 100644 --- a/offload/test/offloading/gpupgo/pgo_atomic_threads.c +++ b/offload/test/offloading/gpupgo/pgo_atomic_threads.c @@ -18,7 +18,6 @@ // REQUIRES: amdgpu // REQUIRES: pgo -// XFAIL: amdgpu int test1(int a) { return a / 2; } diff --git a/offload/test/offloading/gpupgo/pgo_device_and_host.c b/offload/test/offloading/gpupgo/pgo_device_and_host.c index c53e69a25e50d..3e95791ce9a50 100644 --- a/offload/test/offloading/gpupgo/pgo_device_and_host.c +++ b/offload/test/offloading/gpupgo/pgo_device_and_host.c @@ -50,7 +50,6 @@ // REQUIRES: amdgpu // REQUIRES: pgo -// XFAIL: amdgpu int main() { int host_var = 0; diff --git a/offload/test/offloading/gpupgo/pgo_device_only.c b/offload/test/offloading/gpupgo/pgo_device_only.c index 644df6e7b0339..2939af613b6dd 100644 --- a/offload/test/offloading/gpupgo/pgo_device_only.c +++ b/offload/test/offloading/gpupgo/pgo_device_only.c @@ -16,7 +16,6 @@ // REQUIRES: amdgpu // REQUIRES: pgo -// XFAIL: amdgpu int test1(int a) { return a / 2; } int test2(int a) { return a * 2; } 
@jplehr
Copy link
Contributor

jplehr commented Nov 5, 2025

Thanks for putting this up. Let me give it a test drive.

@kevinsala kevinsala requested a review from jhuber6 November 5, 2025 21:56
Copy link
Contributor

@jplehr jplehr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this locally and it fixes the issue for me.
Any concerns @jhuber6?

@EthanLuisMcDonough EthanLuisMcDonough merged commit 38cade7 into llvm:main Nov 10, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

llvm:transforms offload PGO Profile Guided Optimizations

4 participants