-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[PGO][Offload] Profile profraw generation for GPU instrumentation #76587 #93365
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] Profile profraw generation for GPU instrumentation #76587 #93365
Conversation
TargetFilename = | ||
(char *)COMPILER_RT_ALLOCA(FilenameLength + TargetLength + 2); | ||
|
||
/* Prepend "TARGET." to current filename */ |
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 we make this handle file names with directory components? Otherwise, I end up with errors like:
LLVM Profile Error: Failed to open file : amdgcn-amd-amdhsa./home/jdenny/tmp/default_15853421304062701701_0.profraw
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.
Seems to be fixed now. Thanks.
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.
LG, one minor comment
if (PDeathSig == 1) | ||
lprofRestoreSigKill(); | ||
return -1; | ||
} |
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.
Move this up to the beginning.
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/30/builds/15627 Here is the relevant piece of the build log for the reference
|
…vm#76587 (llvm#93365) This pull request is the second part of an ongoing effort to extends PGO instrumentation to GPU device code and depends on llvm#76587. This PR makes the following changes: - Introduces `__llvm_write_custom_profile` to PGO compiler-rt library. This is an external function that can be used to write profiles with custom data to target-specific files. - Adds `__llvm_write_custom_profile` as weak symbol to libomptarget so that it can write the collected data to a profraw file. - Adds `PGODump` debug flag and only displays dump when the aforementioned flag is set
Hi @EthanLuisMcDonough, this unfortunately breaks
on one for our bots. I think you're missing Please fix or revert for now. Thank you! |
Hi @EthanLuisMcDonough ! As @dtellenbach noted earlier, this PR is breaking two tests on our bots. Could you fix it as soon as possible? I will come back and revisit by 2pm PST today. If I don't hear back from you, I will revert this PR. Really appreciate your attention to the issue! |
Hi @dtellenbach and @qiongsiwu. Thank you for letting me know about this. I'm currently investigating the issue and trying to reproduce the issue locally on darwin. I'm going to try and fix this as soon as possible. |
…vm#76587 (llvm#93365) This pull request is the second part of an ongoing effort to extends PGO instrumentation to GPU device code and depends on llvm#76587. This PR makes the following changes: - Introduces `__llvm_write_custom_profile` to PGO compiler-rt library. This is an external function that can be used to write profiles with custom data to target-specific files. - Adds `__llvm_write_custom_profile` as weak symbol to libomptarget so that it can write the collected data to a profraw file. - Adds `PGODump` debug flag and only displays dump when the aforementioned flag is set
This pull request fixes an issue that was introduced in #93365. `__llvm_write_custom_profile` visibility was causing issues on Darwin. This function needs to be publicly accessible in order to be accessed by libomptarget, so this pull request makes `__llvm_write_custom_profile` an explicitly exported symbol on Darwin. Tested on M3 and X86 macs.
…vm#76587 (llvm#93365) This pull request is the second part of an ongoing effort to extends PGO instrumentation to GPU device code and depends on llvm#76587. This PR makes the following changes: - Introduces `__llvm_write_custom_profile` to PGO compiler-rt library. This is an external function that can be used to write profiles with custom data to target-specific files. - Adds `__llvm_write_custom_profile` as weak symbol to libomptarget so that it can write the collected data to a profraw file. - Adds `PGODump` debug flag and only displays dump when the aforementioned flag is set
This pull request is the third part of an ongoing effort to extends PGO instrumentation to GPU device code and depends on #93365. This PR makes the following changes: - Allows PGO flags to be supplied to GPU targets - Pulls version global from device - Modifies `__llvm_write_custom_profile` and `lprofWriteDataImpl` to allow the PGO version to be overridden
…#94268) This pull request is the third part of an ongoing effort to extends PGO instrumentation to GPU device code and depends on llvm/llvm-project#93365. This PR makes the following changes: - Allows PGO flags to be supplied to GPU targets - Pulls version global from device - Modifies `__llvm_write_custom_profile` and `lprofWriteDataImpl` to allow the PGO version to be overridden
@EthanLuisMcDonough I think your patch effectively introduces a dependency on libc because In compiler-rt it's not safe to make that assumption because it potentially breaks embedded platforms. IMO it's also bad practice to force used symbols into a static archive. Would you please take another look and at least make the functionality dependent on offloading or something similar? Thanks a lot! |
Thank you for bringing this to my attention. I'll make sure to look into a fix for this. |
This pull request is the second part of an ongoing effort to extends PGO instrumentation to GPU device code and depends on #76587. This PR makes the following changes:
__llvm_write_custom_profile
to PGO compiler-rt library. This is an external function that can be used to write profiles with custom data to target-specific files.__llvm_write_custom_profile
as weak symbol to libomptarget so that it can write the collected data to a profraw file.PGODump
debug flag and only displays dump when the aforementioned flag is set