-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[flang][OpenMP] Parsing support for iterator in DEPEND clause #113622
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 10 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
0c5c452
[flang][OpenMP] Update handling of DEPEND clause
kparzysz eff3d01
[flang][OpenMP] Extract OMP version hint into helper functions, NFC
kparzysz c9cd782
[flang][OpenMP] Parsing support for iterator in DEPEND clause
kparzysz 72c8f7d
undo leftover changes in symbol.h
kparzysz 09e6720
format
kparzysz 952e373
remove leftover include
kparzysz 5c99093
only call ResolveName for unresolved common block names
kparzysz 1672f0b
missed OmpDependenceType -> OmpTaskDependenceType
kparzysz 4482e5d
Merge branch 'users/kparzysz/spr/d01-flang-depend-update' into users/…
kparzysz 556c299
Merge branch 'users/kparzysz/spr/d02-flang-omp-hint' into users/kparz…
kparzysz 97be5c6
convert assertion to todo
kparzysz 1e0a085
use brace initialization
kparzysz 66afb42
Merge branch 'main' into users/kparzysz/spr/d03-flang-depend-iterator
kparzysz 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
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 | ||||
---|---|---|---|---|---|---|
|
@@ -38,6 +38,16 @@ namespace Fortran::semantics { | |||||
CheckAllowedClause(llvm::omp::Y); \ | ||||||
} | ||||||
|
||||||
std::string ThisVersion(unsigned version) { | ||||||
std::string tv{ | ||||||
std::to_string(version / 10) + "." + std::to_string(version % 10)}; | ||||||
return "OpenMP v" + tv; | ||||||
} | ||||||
|
||||||
std::string TryVersion(unsigned version) { | ||||||
return "try -fopenmp-version=" + std::to_string(version); | ||||||
} | ||||||
|
||||||
// 'OmpWorkshareBlockChecker' is used to check the validity of the assignment | ||||||
// statements and the expressions enclosed in an OpenMP Workshare construct | ||||||
class OmpWorkshareBlockChecker { | ||||||
|
@@ -200,14 +210,10 @@ bool OmpStructureChecker::CheckAllowedClause(llvmOmpClause clause) { | |||||
auto clauseName{parser::ToUpperCaseLetters(getClauseName(clause).str())}; | ||||||
auto dirName{parser::ToUpperCaseLetters(getDirectiveName(dir).str())}; | ||||||
|
||||||
std::string thisVersion{ | ||||||
std::to_string(version / 10) + "." + std::to_string(version % 10)}; | ||||||
std::string goodVersion{std::to_string(allowedInVersion)}; | ||||||
|
||||||
context_.Say(dirCtx.clauseSource, | ||||||
"%s clause is not allowed on directive %s in OpenMP v%s, " | ||||||
"try -fopenmp-version=%d"_err_en_US, | ||||||
clauseName, dirName, thisVersion, allowedInVersion); | ||||||
"%s clause is not allowed on directive %s in %s, %s"_err_en_US, | ||||||
clauseName, dirName, ThisVersion(version), | ||||||
TryVersion(allowedInVersion)); | ||||||
} | ||||||
} | ||||||
return CheckAllowed(clause); | ||||||
|
@@ -3283,18 +3289,33 @@ void OmpStructureChecker::Enter(const parser::OmpClause::Depend &x) { | |||||
parser::ToUpperCaseLetters(getDirectiveName(GetContext().directive))); | ||||||
} | ||||||
if (const auto *inOut{std::get_if<parser::OmpDependClause::InOut>(&x.v.u)}) { | ||||||
const auto &designators{std::get<std::list<parser::Designator>>(inOut->t)}; | ||||||
for (const auto &ele : designators) { | ||||||
if (const auto *dataRef{std::get_if<parser::DataRef>(&ele.u)}) { | ||||||
CheckDependList(*dataRef); | ||||||
if (const auto *arr{ | ||||||
std::get_if<common::Indirection<parser::ArrayElement>>( | ||||||
&dataRef->u)}) { | ||||||
CheckArraySection(arr->value(), GetLastName(*dataRef), | ||||||
llvm::omp::Clause::OMPC_depend); | ||||||
for (const auto &object : std::get<parser::OmpObjectList>(inOut->t).v) { | ||||||
if (const auto *name{std::get_if<parser::Name>(&object.u)}) { | ||||||
context_.Say(GetContext().clauseSource, | ||||||
"Common block name ('%s') cannot appear in a DEPEND " | ||||||
"clause"_err_en_US, | ||||||
name->ToString()); | ||||||
} else if (auto *designator{std::get_if<parser::Designator>(&object.u)}) { | ||||||
if (auto *dataRef{std::get_if<parser::DataRef>(&designator->u)}) { | ||||||
CheckDependList(*dataRef); | ||||||
if (const auto *arr{ | ||||||
std::get_if<common::Indirection<parser::ArrayElement>>( | ||||||
&dataRef->u)}) { | ||||||
CheckArraySection(arr->value(), GetLastName(*dataRef), | ||||||
llvm::omp::Clause::OMPC_depend); | ||||||
} | ||||||
} | ||||||
} | ||||||
} | ||||||
if (std::get<std::optional<parser::OmpIteratorModifier>>(inOut->t)) { | ||||||
unsigned version{context_.langOptions().OpenMPVersion}; | ||||||
unsigned allowedInVersion = 50; | ||||||
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.
Suggested change
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. Done |
||||||
if (version < allowedInVersion) { | ||||||
context_.Say(GetContext().clauseSource, | ||||||
"Iterator modifiers are not supported in %s, %s"_warn_en_US, | ||||||
ThisVersion(version), TryVersion(allowedInVersion)); | ||||||
} | ||||||
} | ||||||
} | ||||||
} | ||||||
|
||||||
|
@@ -3367,8 +3388,8 @@ void OmpStructureChecker::Enter(const parser::OmpClause::Lastprivate &x) { | |||||
std::to_string(version / 10) + "." + std::to_string(version % 10)}; | ||||||
context_.Say(GetContext().clauseSource, | ||||||
"LASTPRIVATE clause with CONDITIONAL modifier is not " | ||||||
"allowed in OpenMP v%s, try -fopenmp-version=%d"_err_en_US, | ||||||
thisVersion, allowedInVersion); | ||||||
"allowed in %s, %s"_err_en_US, | ||||||
ThisVersion(version), TryVersion(allowedInVersion)); | ||||||
} | ||||||
} | ||||||
} | ||||||
|
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,10 @@ | ||
!RUN: %not_todo_cmd bbc -emit-hlfir -fopenmp -fopenmp-version=50 -o - %s 2>&1 | FileCheck %s | ||
!RUN: %not_todo_cmd %flang_fc1 -emit-hlfir -fopenmp -fopenmp-version=50 -o - %s 2>&1 | FileCheck %s | ||
|
||
!CHECK: Support for iterator modifiers is not implemented yet | ||
subroutine f00(x) | ||
integer :: x(10) | ||
!$omp task depend(iterator(i = 1:10), in: x(i)) | ||
x = 0 | ||
!$omp end task | ||
end |
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.
Should this be a TODO?
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.
Done.