-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[Flang][OpenMP] Add support for proc_bind=primary #99319
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
Conversation
@llvm/pr-subscribers-flang-openmp @llvm/pr-subscribers-flang-parser Author: Kiran Chandramohan (kiranchandramohan) ChangesThe support was missing only in the parser, all other phases handle the primary option for proc_bind. Fixes one of the issues in parsing for gomp/affinity-1.f90. (https://discourse.llvm.org/t/proposal-rename-flang-new-to-flang/69462/60) Full diff: https://github.com/llvm/llvm-project/pull/99319.diff 2 Files Affected:
diff --git a/flang/lib/Parser/openmp-parsers.cpp b/flang/lib/Parser/openmp-parsers.cpp
index 0ea48ce29ca2f..ded9494159193 100644
--- a/flang/lib/Parser/openmp-parsers.cpp
+++ b/flang/lib/Parser/openmp-parsers.cpp
@@ -31,10 +31,11 @@ TYPE_PARSER(construct<OmpDefaultClause>(
"SHARED" >> pure(OmpDefaultClause::Type::Shared) ||
"NONE" >> pure(OmpDefaultClause::Type::None)))
-// 2.5 PROC_BIND (MASTER | CLOSE | SPREAD)
+// 2.5 PROC_BIND (MASTER | CLOSE | SPREAD )
TYPE_PARSER(construct<OmpProcBindClause>(
"CLOSE" >> pure(OmpProcBindClause::Type::Close) ||
"MASTER" >> pure(OmpProcBindClause::Type::Master) ||
+ "PRIMARY" >> pure(OmpProcBindClause::Type::Primary) ||
"SPREAD" >> pure(OmpProcBindClause::Type::Spread)))
// 2.15.5.1 MAP ([ [ALWAYS[,]] map-type : ] variable-name-list)
diff --git a/flang/test/Parser/OpenMP/proc-bind.f90 b/flang/test/Parser/OpenMP/proc-bind.f90
new file mode 100644
index 0000000000000..08bcf69e5e765
--- /dev/null
+++ b/flang/test/Parser/OpenMP/proc-bind.f90
@@ -0,0 +1,14 @@
+! RUN: %flang_fc1 -fdebug-unparse -fopenmp %s | FileCheck --ignore-case %s
+! RUN: %flang_fc1 -fdebug-dump-parse-tree -fopenmp %s | FileCheck --check-prefix="PARSE-TREE" %s
+
+! CHECK: !$OMP PARALLEL PROC_BIND(PRIMARY)
+
+! PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPBlockConstruct
+! PARSE-TREE: OmpBeginBlockDirective
+! PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = parallel
+! PARSE-TREE: OmpClauseList -> OmpClause -> ProcBind -> OmpProcBindClause -> Type = Primary
+subroutine sb1
+ !$omp parallel proc_bind(primary)
+ print *, "Hello"
+ !$omp end parallel
+end subroutine
|
The support was missing only in the parser, all other phases handle the primary option for proc_bind.
8c4208e
to
e0bd56f
Compare
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.
LGTM
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.
LGTM thanks, affinity-1.f90 still has another semantic error but this one is fixed.
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.
LGTM. Thanks for the PR
Summary: The support was missing only in the parser, all other phases handle the primary option for proc_bind. Fixes one of the issues in parsing for gomp/affinity-1.f90. (https://discourse.llvm.org/t/proposal-rename-flang-new-to-flang/69462/60) Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: https://phabricator.intern.facebook.com/D60250854
The support was missing only in the parser, all other phases handle the primary option for proc_bind.
Fixes one of the issues in parsing for gomp/affinity-1.f90. (https://discourse.llvm.org/t/proposal-rename-flang-new-to-flang/69462/60)