-
Notifications
You must be signed in to change notification settings - Fork 14.8k
[Flang][OpenMP] Increase detection capability for requires usm (and others) #162971
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
Closed
+38
−11
Closed
Changes from all commits
Commits
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
! RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s | ||
! RUN: %flang_fc1 -emit-hlfir -fopenmp -fopenmp-is-target-device %s -o - | FileCheck %s | ||
! RUN: bbc -fopenmp -emit-hlfir %s -o - | FileCheck %s | ||
! RUN: bbc -fopenmp -fopenmp-is-target-device -emit-hlfir %s -o - | FileCheck %s | ||
|
||
! Verify that we pick up USM and apply it correctly when it is specified | ||
! outside of the program. | ||
|
||
!CHECK: module attributes { | ||
!CHECK-SAME: omp.requires = #omp<clause_requires unified_shared_memory> | ||
module declare_mod | ||
implicit none | ||
!$omp requires unified_shared_memory | ||
contains | ||
end module | ||
|
||
program main | ||
use declare_mod | ||
implicit none | ||
!$omp target | ||
!$omp end target | ||
end program |
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.
Can we optimise this by collecting the
ModuleOps
in aDenseSet
and then fire thegenOpenMPRequires
calls to prevent duplicate calls for the same Module?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 might be misunderstanding what you mean or how bridge works, but won't we only ever invoke this on a single module (the one bridge is currently lowering) at a time and it'll invoke this at the end of that modules lowering on the requires symbols held within the currently being lowered file as part of the finalization process?
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.
Sorry, I'm not too familiar with how bridge works as well. I am just going by the loop
for (auto sym : globalOmpRequiresSymbol)
. Ifsym1
andsym2
are from the same module, do we need two calls togenOpenMPRequires
or can we just have one?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.
Currently we'd need to invoke it per symbol we gather, as the symbols are from various different scopes within the lowered file that could but don't necessarily contain a requires directive
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.
Okay, thanks for clearing that.