Skip to content

Commit 38cade7

Browse files
[PGO][Offload] Fix missing names bug in GPU PGO (llvm#166444)
After llvm#163011 was merged, the tests in [`offload/test/offloading/gpupgo`](https://github.com/llvm/llvm-project/compare/main...EthanLuisMcDonough:llvm-project:gpupgo-names-fix-pr?expand=1#diff-f769f6cebd25fa527bd1c1150cc64eb585c41cb8a8b325c2bc80c690e47506a1) 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.
1 parent b9e22cc commit 38cade7

File tree

5 files changed

+4
-4
lines changed

5 files changed

+4
-4
lines changed

llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1944,6 +1944,10 @@ void InstrLowerer::emitNameData() {
19441944
NamesVar = new GlobalVariable(M, NamesVal->getType(), true,
19451945
GlobalValue::PrivateLinkage, NamesVal,
19461946
getInstrProfNamesVarName());
1947+
if (isGPUProfTarget(M)) {
1948+
NamesVar->setLinkage(GlobalValue::ExternalLinkage);
1949+
NamesVar->setVisibility(GlobalValue::ProtectedVisibility);
1950+
}
19471951

19481952
NamesSize = CompressedNameStr.size();
19491953
setGlobalVariableLargeSection(TT, *NamesVar);

offload/test/offloading/gpupgo/pgo_atomic_teams.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
// REQUIRES: amdgpu
2020
// REQUIRES: pgo
21-
// XFAIL: amdgpu
2221

2322
int test1(int a) { return a / 2; }
2423
int test2(int a) { return a * 2; }

offload/test/offloading/gpupgo/pgo_atomic_threads.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
// REQUIRES: amdgpu
2020
// REQUIRES: pgo
21-
// XFAIL: amdgpu
2221

2322
int test1(int a) { return a / 2; }
2423

offload/test/offloading/gpupgo/pgo_device_and_host.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050

5151
// REQUIRES: amdgpu
5252
// REQUIRES: pgo
53-
// XFAIL: amdgpu
5453

5554
int main() {
5655
int host_var = 0;

offload/test/offloading/gpupgo/pgo_device_only.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
// REQUIRES: amdgpu
1818
// REQUIRES: pgo
19-
// XFAIL: amdgpu
2019

2120
int test1(int a) { return a / 2; }
2221
int test2(int a) { return a * 2; }

0 commit comments

Comments
 (0)