-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[Flang] [OpenMP] Add semantic checks for detach clause in task #119172
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
Thirumalai-Shaktivel
merged 18 commits into
llvm:main
from
Thirumalai-Shaktivel:llvm/detach_01
May 9, 2025
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
6e491cc
[Flang] [OpenMP] Add semantic checks for detach clause in Task
Thirumalai-Shaktivel fa2b051
Do not check for interger kind
Thirumalai-Shaktivel 569712f
Fix snake_case
Thirumalai-Shaktivel 42cc3e7
Compare symbols instead of name
Thirumalai-Shaktivel a3c6a45
Add OpenMP version based checks
Thirumalai-Shaktivel 019a24c
Fix formatting
Thirumalai-Shaktivel 0348571
Allow detach clause only once
Thirumalai-Shaktivel 2c09c87
Add a test for openmp 52
Thirumalai-Shaktivel e94e30d
Merge branch 'main' into llvm/detach_01
Thirumalai-Shaktivel 94a7504
Merge branch 'main' into llvm/detach_01
Thirumalai-Shaktivel 6fc96f7
Rename a function name
Thirumalai-Shaktivel 59075c1
Remove the check for symbol's nullptr
Thirumalai-Shaktivel 965df85
CheckAllowedClause for OpenMP 50 and 51
Thirumalai-Shaktivel d13d267
Fix the error message string to be in a single line
Thirumalai-Shaktivel 573580e
Add check for shared clause as well
Thirumalai-Shaktivel 5d9be32
Remove a test
Thirumalai-Shaktivel 47fbdc4
Add some more tests
Thirumalai-Shaktivel 596d326
Fix clang-format
Thirumalai-Shaktivel 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
! REQUIRES: openmp_runtime | ||
! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags -fopenmp-version=52 | ||
|
||
! OpenMP Version 5.2: 12.5.2 | ||
! Various checks for DETACH Clause | ||
|
||
program detach01 | ||
use omp_lib, only: omp_event_handle_kind | ||
implicit none | ||
real :: e, x | ||
integer(omp_event_handle_kind) :: event_01, event_02(2) | ||
integer(omp_event_handle_kind), pointer :: event_03 | ||
|
||
type :: t | ||
integer(omp_event_handle_kind) :: event | ||
end type | ||
type(t) :: t_01 | ||
|
||
!ERROR: The event-handle: `e` must be of type integer(kind=omp_event_handle_kind) | ||
!$omp task detach(e) | ||
x = x + 1 | ||
!$omp end task | ||
|
||
!ERROR: If a DETACH clause appears on a directive, then the encountering task must not be a FINAL task | ||
!$omp task detach(event_01) final(.false.) | ||
x = x + 1 | ||
!$omp end task | ||
|
||
!ERROR: A variable: `event_01` that appears in a DETACH clause cannot appear on PRIVATE clause on the same construct | ||
!$omp task detach(event_01) private(event_01) | ||
x = x + 1 | ||
!$omp end task | ||
|
||
!ERROR: A variable: `event_01` that appears in a DETACH clause cannot appear on FIRSTPRIVATE clause on the same construct | ||
!$omp task detach(event_01) firstprivate(event_01) | ||
x = x + 1 | ||
!$omp end task | ||
|
||
!ERROR: A variable: `event_01` that appears in a DETACH clause cannot appear on SHARED clause on the same construct | ||
!$omp task detach(event_01) shared(event_01) | ||
x = x + 1 | ||
!$omp end task | ||
|
||
!ERROR: A variable: `event_01` that appears in a DETACH clause cannot appear on IN_REDUCTION clause on the same construct | ||
!$omp task detach(event_01) in_reduction(+:event_01) | ||
x = x + 1 | ||
!$omp end task | ||
|
||
!ERROR: A variable that is part of another variable (as an array or structure element) cannot appear in a DETACH clause | ||
!$omp task detach(event_02(1)) | ||
x = x + 1 | ||
!$omp end task | ||
|
||
!ERROR: A variable that is part of another variable (as an array or structure element) cannot appear in a DETACH clause | ||
!$omp task detach(t_01%event) | ||
x = x + 1 | ||
!$omp end task | ||
|
||
!ERROR: The event-handle: `event_03` must not have the POINTER attribute | ||
!$omp task detach(event_03) | ||
x = x + 1 | ||
!$omp end task | ||
end program |
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 @@ | ||
! REQUIRES: openmp_runtime | ||
! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags -fopenmp-version=50 | ||
! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags -fopenmp-version=51 | ||
|
||
! OpenMP Version 5.0: 2.10.1 | ||
! Various checks for DETACH Clause | ||
|
||
program detach02 | ||
use omp_lib, only: omp_event_handle_kind | ||
integer(omp_event_handle_kind) :: event_01, event_02 | ||
|
||
!ERROR: At most one DETACH clause can appear on the TASK directive | ||
!$omp task detach(event_01) detach(event_02) | ||
x = x + 1 | ||
!$omp end task | ||
|
||
!ERROR: Clause MERGEABLE is not allowed if clause DETACH appears on the TASK directive | ||
!$omp task detach(event_01) mergeable | ||
x = x + 1 | ||
!$omp end task | ||
end program |
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
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.
what about SHARED?
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.
Good catch, I don't know how I missed this.