-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[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
[PGO][Offload] Disable PGO on NVPTX #133522
Conversation
@llvm/pr-subscribers-offload @llvm/pr-subscribers-pgo Author: Ethan Luis McDonough (EthanLuisMcDonough) ChangesFull diff: https://github.com/llvm/llvm-project/pull/133522.diff 5 Files Affected:
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 26fa234dd4e9b..5f45cf0865b9e 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -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
+ if (!Triple.isNVPTX())
+ addPGOAndCoverageFlags(TC, C, JA, Output, Args, SanitizeArgs, CmdArgs);
Args.AddLastArg(CmdArgs, options::OPT_fclang_abi_compat_EQ);
diff --git a/clang/test/Driver/cuda-no-pgo-or-coverage.cu b/clang/test/Driver/cuda-no-pgo-or-coverage.cu
new file mode 100644
index 0000000000000..b84587e1e182b
--- /dev/null
+++ b/clang/test/Driver/cuda-no-pgo-or-coverage.cu
@@ -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=
diff --git a/llvm/test/tools/llvm-profdata/malformed-ptr-to-counter-array.test b/llvm/test/tools/llvm-profdata/malformed-ptr-to-counter-array.test
index 49c5ae9b0931d..83cf76f68fb63 100644
--- a/llvm/test/tools/llvm-profdata/malformed-ptr-to-counter-array.test
+++ b/llvm/test/tools/llvm-profdata/malformed-ptr-to-counter-array.test
@@ -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)
diff --git a/offload/test/offloading/gpupgo/pgo1.c b/offload/test/offloading/gpupgo/pgo1.c
index c8011cbae83c0..af6d8e806cd37 100644
--- a/offload/test/offloading/gpupgo/pgo1.c
+++ b/offload/test/offloading/gpupgo/pgo1.c
@@ -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; }
diff --git a/offload/test/offloading/gpupgo/pgo2.c b/offload/test/offloading/gpupgo/pgo2.c
index b75b0beaffdec..b67a63bc8fc3d 100644
--- a/offload/test/offloading/gpupgo/pgo2.c
+++ b/offload/test/offloading/gpupgo/pgo2.c
@@ -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() {
|
@llvm/pr-subscribers-clang-driver Author: Ethan Luis McDonough (EthanLuisMcDonough) ChangesFull diff: https://github.com/llvm/llvm-project/pull/133522.diff 5 Files Affected:
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 26fa234dd4e9b..5f45cf0865b9e 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -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
+ if (!Triple.isNVPTX())
+ addPGOAndCoverageFlags(TC, C, JA, Output, Args, SanitizeArgs, CmdArgs);
Args.AddLastArg(CmdArgs, options::OPT_fclang_abi_compat_EQ);
diff --git a/clang/test/Driver/cuda-no-pgo-or-coverage.cu b/clang/test/Driver/cuda-no-pgo-or-coverage.cu
new file mode 100644
index 0000000000000..b84587e1e182b
--- /dev/null
+++ b/clang/test/Driver/cuda-no-pgo-or-coverage.cu
@@ -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=
diff --git a/llvm/test/tools/llvm-profdata/malformed-ptr-to-counter-array.test b/llvm/test/tools/llvm-profdata/malformed-ptr-to-counter-array.test
index 49c5ae9b0931d..83cf76f68fb63 100644
--- a/llvm/test/tools/llvm-profdata/malformed-ptr-to-counter-array.test
+++ b/llvm/test/tools/llvm-profdata/malformed-ptr-to-counter-array.test
@@ -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)
diff --git a/offload/test/offloading/gpupgo/pgo1.c b/offload/test/offloading/gpupgo/pgo1.c
index c8011cbae83c0..af6d8e806cd37 100644
--- a/offload/test/offloading/gpupgo/pgo1.c
+++ b/offload/test/offloading/gpupgo/pgo1.c
@@ -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; }
diff --git a/offload/test/offloading/gpupgo/pgo2.c b/offload/test/offloading/gpupgo/pgo2.c
index b75b0beaffdec..b67a63bc8fc3d 100644
--- a/offload/test/offloading/gpupgo/pgo2.c
+++ b/offload/test/offloading/gpupgo/pgo2.c
@@ -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() {
|
@llvm/pr-subscribers-clang Author: Ethan Luis McDonough (EthanLuisMcDonough) ChangesFull diff: https://github.com/llvm/llvm-project/pull/133522.diff 5 Files Affected:
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 26fa234dd4e9b..5f45cf0865b9e 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -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
+ if (!Triple.isNVPTX())
+ addPGOAndCoverageFlags(TC, C, JA, Output, Args, SanitizeArgs, CmdArgs);
Args.AddLastArg(CmdArgs, options::OPT_fclang_abi_compat_EQ);
diff --git a/clang/test/Driver/cuda-no-pgo-or-coverage.cu b/clang/test/Driver/cuda-no-pgo-or-coverage.cu
new file mode 100644
index 0000000000000..b84587e1e182b
--- /dev/null
+++ b/clang/test/Driver/cuda-no-pgo-or-coverage.cu
@@ -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=
diff --git a/llvm/test/tools/llvm-profdata/malformed-ptr-to-counter-array.test b/llvm/test/tools/llvm-profdata/malformed-ptr-to-counter-array.test
index 49c5ae9b0931d..83cf76f68fb63 100644
--- a/llvm/test/tools/llvm-profdata/malformed-ptr-to-counter-array.test
+++ b/llvm/test/tools/llvm-profdata/malformed-ptr-to-counter-array.test
@@ -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)
diff --git a/offload/test/offloading/gpupgo/pgo1.c b/offload/test/offloading/gpupgo/pgo1.c
index c8011cbae83c0..af6d8e806cd37 100644
--- a/offload/test/offloading/gpupgo/pgo1.c
+++ b/offload/test/offloading/gpupgo/pgo1.c
@@ -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; }
diff --git a/offload/test/offloading/gpupgo/pgo2.c b/offload/test/offloading/gpupgo/pgo2.c
index b75b0beaffdec..b67a63bc8fc3d 100644
--- a/offload/test/offloading/gpupgo/pgo2.c
+++ b/offload/test/offloading/gpupgo/pgo2.c
@@ -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() {
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with a comment nit.
@@ -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 |
There was a problem hiding this comment.
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.
No description provided.