-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[HIP][HIPSTDPAR][NFC] Re-order & adapt hipstdpar specific passes
#134753
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 6 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
a988ecf
Re-order & adapt `hipstdpar` specific passes.
AlexVlx 5cd1abb
Fix formatting.
AlexVlx 2765739
Add tests.
AlexVlx 6ac5db0
Merge branch 'main' of https://github.com/llvm/llvm-project into hips…
AlexVlx 9df1e62
Fix typos.
AlexVlx 845807e
Update test.
AlexVlx 0af199a
Apply suggestions.
AlexVlx 202d6b9
Use -NEXT checks.
AlexVlx 87b22b2
Merge branch 'main' of https://github.com/llvm/llvm-project into hips…
AlexVlx 8a5a2c7
Fix test for machines without HIPSTDPAR installed.
AlexVlx 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
11 changes: 11 additions & 0 deletions
11
clang/test/CodeGenHipStdPar/rdc-does-not-enable-hipstdpar.cpp
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,11 @@ | ||
| // Check that if we are compiling with fgpu-rdc amdgpu-enable-hipstdpar is not | ||
| // passed to CC1, to avoid eager, per TU, removal of potentially accessible | ||
| // functions. | ||
|
|
||
| // RUN: %clang -### --hipstdpar --offload-arch=gfx906 %s -nogpulib -nogpuinc \ | ||
| // RUN: 2>&1 | FileCheck -check-prefix=NORDC %s | ||
| // NORDC: {{.*}}"-mllvm" "-amdgpu-enable-hipstdpar" | ||
|
|
||
| // RUN: %clang -### --hipstdpar --offload-arch=gfx906 %s -nogpulib -nogpuinc -fgpu-rdc \ | ||
| // RUN: 2>&1 | FileCheck -check-prefix=RDC %s | ||
| // RDC-NOT: {{.*}}"-mllvm" "-amdgpu-enable-hipstdpar" | ||
21 changes: 21 additions & 0 deletions
21
clang/test/CodeGenHipStdPar/select-accelerator-code-pass-ordering.cpp
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 @@ | ||
| // Test that the accelerator code selection pass only gets invoked after linking | ||
|
|
||
| // Ensure Pass HipStdParAcceleratorCodeSelectionPass is not invoked in PreLink. | ||
| // RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -mllvm -amdgpu-enable-hipstdpar -flto -emit-llvm-bc -fcuda-is-device -fdebug-pass-manager \ | ||
| // RUN: %s -o - 2>&1 | FileCheck --check-prefix=HIPSTDPAR-PRE %s | ||
AlexVlx marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| // HIPSTDPAR-PRE-NOT: Running pass: HipStdParAcceleratorCodeSelectionPass | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Better to use -NEXT checks with the passes before and after it
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This still should use -next checks around where it should run |
||
|
|
||
| // Ensure Pass HipStdParAcceleratorCodeSelectionPass is invoked in PostLink. | ||
| // RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -mllvm -amdgpu-enable-hipstdpar -fcuda-is-device -fdebug-pass-manager -emit-llvm \ | ||
| // RUN: %s -o - 2>&1 | FileCheck --check-prefix=HIPSTDPAR-POST %s | ||
AlexVlx marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| // HIPSTDPAR-POST: Running pass: HipStdParAcceleratorCodeSelection | ||
|
|
||
| #define __device__ __attribute__((device)) | ||
|
|
||
| void foo(float *a, float b) { | ||
| *a = b; | ||
| } | ||
|
|
||
| __device__ void bar(float *a, float b) { | ||
| *a = b; | ||
| } | ||
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.
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.
-NOT checks are hazardous and should be as permissive as possible
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.
In this case it actually has to be "-mllvm" because we only care about it not being passed to the initial from source, per TU compilation; forming the check as you suggest would (erroneously) match the (intentional) passing of the argument via
-plugin-opt, when we do the final lowering from bitcode. This merely tests/validates the change we did inHIPAMDToolChain::addClangTargetOptions.