Skip to content

Commit 0c81105

Browse files
[PGO][Offload] Disable PGO on NVPTX (#133522)
1 parent 83c4cb3 commit 0c81105

File tree

5 files changed

+39
-4
lines changed

5 files changed

+39
-4
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6397,7 +6397,9 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
63976397
Args.AddLastArg(CmdArgs, options::OPT_fconvergent_functions,
63986398
options::OPT_fno_convergent_functions);
63996399

6400-
addPGOAndCoverageFlags(TC, C, JA, Output, Args, SanitizeArgs, CmdArgs);
6400+
// NVPTX doesn't support PGO or coverage
6401+
if (!Triple.isNVPTX())
6402+
addPGOAndCoverageFlags(TC, C, JA, Output, Args, SanitizeArgs, CmdArgs);
64016403

64026404
Args.AddLastArg(CmdArgs, options::OPT_fclang_abi_compat_EQ);
64036405

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Check that profiling/coverage arguments doen't get passed down to device-side
2+
// compilation.
3+
//
4+
//
5+
// XRUN: not %clang -### --target=x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 \
6+
// XRUN: -fprofile-generate %s 2>&1 | \
7+
// XRUN: FileCheck --check-prefixes=CHECK,PROF %s
8+
//
9+
// RUN: not %clang -### --target=x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 \
10+
// RUN: -fprofile-instr-generate %s 2>&1 | \
11+
// RUN: FileCheck --check-prefixes=CHECK,PROF %s
12+
//
13+
// RUN: not %clang -### --target=x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 \
14+
// RUN: -coverage %s 2>&1 | \
15+
// RUN: FileCheck --check-prefixes=CHECK,GCOV %s
16+
//
17+
// RUN: not %clang -### --target=x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 \
18+
// RUN: -ftest-coverage %s 2>&1 | \
19+
// RUN: FileCheck --check-prefixes=CHECK,GCOV %s
20+
//
21+
// RUN: not %clang -### --target=x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 \
22+
// RUN: -fprofile-instr-generate -fcoverage-mapping %s 2>&1 | \
23+
// RUN: FileCheck --check-prefixes=CHECK,PROF %s
24+
//
25+
//
26+
// CHECK-NOT: error: unsupported option '-fprofile
27+
// CHECK-NOT: error: invalid argument
28+
// CHECK-DAG: "-fcuda-is-device"
29+
// CHECK-NOT: "-f{{[^"/]*coverage.*}}"
30+
// CHECK-NOT: "-fprofile{{[^"]*}}"
31+
// CHECK: "-triple" "x86_64-unknown-linux-gnu"
32+
// PROF: "-fprofile{{.*}}"
33+
// GCOV: "-coverage-notes-file=

llvm/test/tools/llvm-profdata/malformed-ptr-to-counter-array.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Header
22
//
33
// INSTR_PROF_RAW_HEADER(uint64_t, Magic, __llvm_profile_get_magic())
4-
// INSTR_PROF_RAW_HEADER(uint64_t, Version, Version)
4+
// INSTR_PROF_RAW_HEADER(uint64_t, Version, __llvm_profile_get_version())
55
// INSTR_PROF_RAW_HEADER(uint64_t, BinaryIdsSize, __llvm_write_binary_ids(NULL))
66
// INSTR_PROF_RAW_HEADER(uint64_t, DataSize, DataSize)
77
// INSTR_PROF_RAW_HEADER(uint64_t, CountersSize, CountersSize)

offload/test/offloading/gpupgo/pgo1.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
// RUN: %target_triple.%basename_t.clang.profraw | \
1515
// RUN: %fcheck-generic --check-prefix="CLANG-PGO"
1616

17-
// REQUIRES: gpu
17+
// REQUIRES: amdgpu
1818
// REQUIRES: pgo
1919

2020
int test1(int a) { return a / 2; }

offload/test/offloading/gpupgo/pgo2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
// RUN: %target_triple.%basename_t.hfdi.profraw \
4949
// RUN: | %fcheck-generic --check-prefix="LLVM-DEVICE"
5050

51-
// REQUIRES: gpu
51+
// REQUIRES: amdgpu
5252
// REQUIRES: pgo
5353

5454
int main() {

0 commit comments

Comments
 (0)