Skip to content

[PGO][Offload] Disable PGO on NVPTX #133522

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion clang/lib/Driver/ToolChains/Clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6397,7 +6397,9 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
Args.AddLastArg(CmdArgs, options::OPT_fconvergent_functions,
options::OPT_fno_convergent_functions);

addPGOAndCoverageFlags(TC, C, JA, Output, Args, SanitizeArgs, CmdArgs);
// NVPTX doesn't support PGO or coverage
Copy link
Member

Choose a reason for hiding this comment

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

I'd add the pointer to the failure details mentioning circular data references and, maybe, point for the PR comment with the details.

if (!Triple.isNVPTX())
addPGOAndCoverageFlags(TC, C, JA, Output, Args, SanitizeArgs, CmdArgs);

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

Expand Down
33 changes: 33 additions & 0 deletions clang/test/Driver/cuda-no-pgo-or-coverage.cu
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Check that profiling/coverage arguments doen't get passed down to device-side
// compilation.
//
//
// XRUN: not %clang -### --target=x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 \
// XRUN: -fprofile-generate %s 2>&1 | \
// XRUN: FileCheck --check-prefixes=CHECK,PROF %s
//
// RUN: not %clang -### --target=x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 \
// RUN: -fprofile-instr-generate %s 2>&1 | \
// RUN: FileCheck --check-prefixes=CHECK,PROF %s
//
// RUN: not %clang -### --target=x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 \
// RUN: -coverage %s 2>&1 | \
// RUN: FileCheck --check-prefixes=CHECK,GCOV %s
//
// RUN: not %clang -### --target=x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 \
// RUN: -ftest-coverage %s 2>&1 | \
// RUN: FileCheck --check-prefixes=CHECK,GCOV %s
//
// RUN: not %clang -### --target=x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 \
// RUN: -fprofile-instr-generate -fcoverage-mapping %s 2>&1 | \
// RUN: FileCheck --check-prefixes=CHECK,PROF %s
//
//
// CHECK-NOT: error: unsupported option '-fprofile
// CHECK-NOT: error: invalid argument
// CHECK-DAG: "-fcuda-is-device"
// CHECK-NOT: "-f{{[^"/]*coverage.*}}"
// CHECK-NOT: "-fprofile{{[^"]*}}"
// CHECK: "-triple" "x86_64-unknown-linux-gnu"
// PROF: "-fprofile{{.*}}"
// GCOV: "-coverage-notes-file=
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Header
//
// INSTR_PROF_RAW_HEADER(uint64_t, Magic, __llvm_profile_get_magic())
// INSTR_PROF_RAW_HEADER(uint64_t, Version, Version)
// INSTR_PROF_RAW_HEADER(uint64_t, Version, __llvm_profile_get_version())
// INSTR_PROF_RAW_HEADER(uint64_t, BinaryIdsSize, __llvm_write_binary_ids(NULL))
// INSTR_PROF_RAW_HEADER(uint64_t, DataSize, DataSize)
// INSTR_PROF_RAW_HEADER(uint64_t, CountersSize, CountersSize)
Expand Down
2 changes: 1 addition & 1 deletion offload/test/offloading/gpupgo/pgo1.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// RUN: %target_triple.%basename_t.clang.profraw | \
// RUN: %fcheck-generic --check-prefix="CLANG-PGO"

// REQUIRES: gpu
// REQUIRES: amdgpu
// REQUIRES: pgo

int test1(int a) { return a / 2; }
Expand Down
2 changes: 1 addition & 1 deletion offload/test/offloading/gpupgo/pgo2.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
// RUN: %target_triple.%basename_t.hfdi.profraw \
// RUN: | %fcheck-generic --check-prefix="LLVM-DEVICE"

// REQUIRES: gpu
// REQUIRES: amdgpu
// REQUIRES: pgo

int main() {
Expand Down
Loading