-
Notifications
You must be signed in to change notification settings - Fork 14.4k
[PGO][Offload] Don't define GPU entrypoint on Darwin #132966
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] Don't define GPU entrypoint on Darwin #132966
Conversation
@llvm/pr-subscribers-clang @llvm/pr-subscribers-clang-driver Author: Ethan Luis McDonough (EthanLuisMcDonough) ChangesThis PR partially reverts 83e180c and instead opts to hide the GPU entry point on Darwin platforms. Marking Full diff: https://github.com/llvm/llvm-project/pull/132966.diff 3 Files Affected:
diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChains/Darwin.cpp
index e67997314da36..4c88722730598 100644
--- a/clang/lib/Driver/ToolChains/Darwin.cpp
+++ b/clang/lib/Driver/ToolChains/Darwin.cpp
@@ -1481,15 +1481,11 @@ void Darwin::addProfileRTLibs(const ArgList &Args,
// If we have a symbol export directive and we're linking in the profile
// runtime, automatically export symbols necessary to implement some of the
// runtime's functionality.
- if (hasExportSymbolDirective(Args)) {
- if (ForGCOV) {
- addExportedSymbol(CmdArgs, "___gcov_dump");
- addExportedSymbol(CmdArgs, "___gcov_reset");
- addExportedSymbol(CmdArgs, "_writeout_fn_list");
- addExportedSymbol(CmdArgs, "_reset_fn_list");
- } else {
- addExportedSymbol(CmdArgs, "___llvm_write_custom_profile");
- }
+ if (hasExportSymbolDirective(Args) && ForGCOV) {
+ addExportedSymbol(CmdArgs, "___gcov_dump");
+ addExportedSymbol(CmdArgs, "___gcov_reset");
+ addExportedSymbol(CmdArgs, "_writeout_fn_list");
+ addExportedSymbol(CmdArgs, "_reset_fn_list");
}
// Align __llvm_prf_{cnts,bits,data} sections to the maximum expected page
diff --git a/compiler-rt/lib/profile/InstrProfilingFile.c b/compiler-rt/lib/profile/InstrProfilingFile.c
index 19467429cf4c3..9f75ce5ef97d1 100644
--- a/compiler-rt/lib/profile/InstrProfilingFile.c
+++ b/compiler-rt/lib/profile/InstrProfilingFile.c
@@ -1273,13 +1273,11 @@ COMPILER_RT_VISIBILITY int __llvm_profile_set_file_object(FILE *File,
return 0;
}
-int __llvm_write_custom_profile(const char *Target,
- const __llvm_profile_data *DataBegin,
- const __llvm_profile_data *DataEnd,
- const char *CountersBegin,
- const char *CountersEnd, const char *NamesBegin,
- const char *NamesEnd,
- const uint64_t *VersionOverride) {
+COMPILER_RT_GPU_ENTRYPOINT int __llvm_write_custom_profile(
+ const char *Target, const __llvm_profile_data *DataBegin,
+ const __llvm_profile_data *DataEnd, const char *CountersBegin,
+ const char *CountersEnd, const char *NamesBegin, const char *NamesEnd,
+ const uint64_t *VersionOverride) {
int ReturnValue = 0, FilenameLength, TargetLength;
char *FilenameBuf, *TargetFilename;
const char *Filename;
diff --git a/compiler-rt/lib/profile/InstrProfilingPort.h b/compiler-rt/lib/profile/InstrProfilingPort.h
index 66d697885eaee..ed56beb6577a3 100644
--- a/compiler-rt/lib/profile/InstrProfilingPort.h
+++ b/compiler-rt/lib/profile/InstrProfilingPort.h
@@ -43,8 +43,10 @@
#if defined(__APPLE__)
#define COMPILER_RT_SEG "__DATA,"
+#define COMPILER_RT_GPU_ENTRYPOINT COMPILER_RT_VISIBILITY
#else
#define COMPILER_RT_SEG ""
+#define COMPILER_RT_GPU_ENTRYPOINT
#endif
#ifdef _MSC_VER
|
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.
It worked before your patch right? Is this what it exposed before then?
In 83e180c, I marked |
const char *CountersEnd, const char *NamesBegin, | ||
const char *NamesEnd, | ||
const uint64_t *VersionOverride) { | ||
COMPILER_RT_GPU_ENTRYPOINT int __llvm_write_custom_profile( |
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.
Would probably be more straightforward to just ifdef
this whole block out on apple.
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.
Agreed, that's probably easier and less invasive.
@@ -1273,6 +1273,7 @@ COMPILER_RT_VISIBILITY int __llvm_profile_set_file_object(FILE *File, | |||
return 0; | |||
} | |||
|
|||
#ifdef COMPILER_RT_GPU_ENTRYPOINT |
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.
Can't we just use __APPLE__
?
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.
My reasoning was that it would give us more configuration power if we had a macro that was defined only when we want an entry point. This would give us an easy way to disable the entry point on other platforms if needed. I don't expect that to happen, so I guess we can use __APPLE__
for now.
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/59/builds/14938 Here is the relevant piece of the build log for the reference
|
This PR partially reverts 83e180c and instead opts to hide the GPU entry point on Darwin platforms. Marking
__llvm_write_custom_profile
as used was causing issues on embedded platforms.