-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[PGO][OpenMP] Instrumentation for GPU devices (Revision of #76587) #102691
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
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
24b1a99
Changes from old gpuprof branch
EthanLuisMcDonough 0119889
Add LLVMProfileData as dependency
EthanLuisMcDonough db69873
Merge branch 'main' into gpuprof2
EthanLuisMcDonough 971a70a
Update test requirements
EthanLuisMcDonough f31b0c6
Fix equality check
EthanLuisMcDonough 66af7d6
Merge branch 'main' into gpuprof2
EthanLuisMcDonough fdbbb82
Update test counters
EthanLuisMcDonough 7db568e
Merge branch 'main' into gpuprof2
EthanLuisMcDonough ec9e575
Fix module access
EthanLuisMcDonough File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
//===-------- Profiling.h - OpenMP interface ---------------------- C++ -*-===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef OMPTARGET_DEVICERTL_PROFILING_H | ||
#define OMPTARGET_DEVICERTL_PROFILING_H | ||
|
||
extern "C" { | ||
void __llvm_profile_register_function(void *Ptr); | ||
void __llvm_profile_register_names_function(void *Ptr, long int I); | ||
void __llvm_profile_instrument_memop(long int I, void *Ptr, int I2); | ||
} | ||
|
||
#endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
//===------- Profiling.cpp ---------------------------------------- C++ ---===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#include "Profiling.h" | ||
|
||
#pragma omp begin declare target device_type(nohost) | ||
|
||
extern "C" { | ||
|
||
// Provides empty implementations for certain functions in compiler-rt | ||
// that are emitted by the PGO instrumentation. | ||
void __llvm_profile_register_function(void *Ptr) {} | ||
void __llvm_profile_register_names_function(void *Ptr, long int I) {} | ||
void __llvm_profile_instrument_memop(long int I, void *Ptr, int I2) {} | ||
} | ||
|
||
#pragma omp end declare target |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Do we need to change the name used to profile the select instructions below as well?
Specifically, for this line https://github.com/llvm/llvm-project/pull/102691/files#diff-618e0bf5dc7c44fae29843f3be69506a1b0a1409c7f018c61b0acf593f1c4605R998, should we use
NormalizedNamePtr
instead ofFuncInfo.FuncNameVar
? Maybe it does not matter but I'd like to understand if this is an explicit choice.Thanks so much!
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.
Thanks for reaching out.
instrumentSelects
accepts aGlobalVariable
as an argument, not aValue
. The global variable addrspace cast handling is done insideSelectInstVisitor::instrumentOneSelectInst
:llvm-project/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
Lines 1728 to 1734 in ee764a2
I haven't encountered any errors raised by this snippet, but please let me know if you've been having any issues with it on your end.