-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[OpenMP] Add definitions for DECLARE_INDUCTION and related clauses #166235
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
Add definitions for DECLARE_INDUCTION, COLLECTOR, and INDUCTOR to OMP.td.
|
@llvm/pr-subscribers-flang-semantics @llvm/pr-subscribers-flang-openmp Author: Krzysztof Parzyszek (kparzysz) ChangesAdd definitions for DECLARE_INDUCTION, COLLECTOR, and INDUCTOR to OMP.td. Full diff: https://github.com/llvm/llvm-project/pull/166235.diff 5 Files Affected:
diff --git a/flang/include/flang/Lower/OpenMP/Clauses.h b/flang/include/flang/Lower/OpenMP/Clauses.h
index 688d01704370d..3eff90b95a20d 100644
--- a/flang/include/flang/Lower/OpenMP/Clauses.h
+++ b/flang/include/flang/Lower/OpenMP/Clauses.h
@@ -204,6 +204,7 @@ using At = tomp::clause::AtT<TypeTy, IdTy, ExprTy>;
using Bind = tomp::clause::BindT<TypeTy, IdTy, ExprTy>;
using Capture = tomp::clause::CaptureT<TypeTy, IdTy, ExprTy>;
using Collapse = tomp::clause::CollapseT<TypeTy, IdTy, ExprTy>;
+using Collector = tomp::clause::CollectorT<TypeTy, IdTy, ExprTy>;
using Compare = tomp::clause::CompareT<TypeTy, IdTy, ExprTy>;
using Contains = tomp::clause::ContainsT<TypeTy, IdTy, ExprTy>;
using Copyin = tomp::clause::CopyinT<TypeTy, IdTy, ExprTy>;
@@ -239,6 +240,7 @@ using If = tomp::clause::IfT<TypeTy, IdTy, ExprTy>;
using Inbranch = tomp::clause::InbranchT<TypeTy, IdTy, ExprTy>;
using Inclusive = tomp::clause::InclusiveT<TypeTy, IdTy, ExprTy>;
using Indirect = tomp::clause::IndirectT<TypeTy, IdTy, ExprTy>;
+using Inductor = tomp::clause::InductorT<TypeTy, IdTy, ExprTy>;
using Init = tomp::clause::InitT<TypeTy, IdTy, ExprTy>;
using Initializer = tomp::clause::InitializerT<TypeTy, IdTy, ExprTy>;
using InReduction = tomp::clause::InReductionT<TypeTy, IdTy, ExprTy>;
diff --git a/flang/lib/Lower/OpenMP/Clauses.cpp b/flang/lib/Lower/OpenMP/Clauses.cpp
index 0f60b47991004..2575b7081039b 100644
--- a/flang/lib/Lower/OpenMP/Clauses.cpp
+++ b/flang/lib/Lower/OpenMP/Clauses.cpp
@@ -249,8 +249,10 @@ MAKE_EMPTY_CLASS(Groupprivate, Groupprivate);
MAKE_INCOMPLETE_CLASS(AdjustArgs, AdjustArgs);
MAKE_INCOMPLETE_CLASS(AppendArgs, AppendArgs);
+MAKE_INCOMPLETE_CLASS(Collector, Collector);
MAKE_INCOMPLETE_CLASS(GraphId, GraphId);
MAKE_INCOMPLETE_CLASS(GraphReset, GraphReset);
+MAKE_INCOMPLETE_CLASS(Inductor, Inductor);
MAKE_INCOMPLETE_CLASS(Replayable, Replayable);
MAKE_INCOMPLETE_CLASS(Transparent, Transparent);
diff --git a/flang/lib/Semantics/check-omp-structure.cpp b/flang/lib/Semantics/check-omp-structure.cpp
index d7db15dd37949..91308281f2cb6 100644
--- a/flang/lib/Semantics/check-omp-structure.cpp
+++ b/flang/lib/Semantics/check-omp-structure.cpp
@@ -5466,6 +5466,7 @@ CHECK_SIMPLE_CLAUSE(Affinity, OMPC_affinity)
CHECK_SIMPLE_CLAUSE(AppendArgs, OMPC_append_args)
CHECK_SIMPLE_CLAUSE(Bind, OMPC_bind)
CHECK_SIMPLE_CLAUSE(Capture, OMPC_capture)
+CHECK_SIMPLE_CLAUSE(Collector, OMPC_collector)
CHECK_SIMPLE_CLAUSE(Compare, OMPC_compare)
CHECK_SIMPLE_CLAUSE(Contains, OMPC_contains)
CHECK_SIMPLE_CLAUSE(Default, OMPC_default)
@@ -5487,6 +5488,7 @@ CHECK_SIMPLE_CLAUSE(Holds, OMPC_holds)
CHECK_SIMPLE_CLAUSE(Inbranch, OMPC_inbranch)
CHECK_SIMPLE_CLAUSE(Inclusive, OMPC_inclusive)
CHECK_SIMPLE_CLAUSE(Indirect, OMPC_indirect)
+CHECK_SIMPLE_CLAUSE(Inductor, OMPC_inductor)
CHECK_SIMPLE_CLAUSE(Initializer, OMPC_initializer)
CHECK_SIMPLE_CLAUSE(Init, OMPC_init)
CHECK_SIMPLE_CLAUSE(Link, OMPC_link)
diff --git a/llvm/include/llvm/Frontend/OpenMP/ClauseT.h b/llvm/include/llvm/Frontend/OpenMP/ClauseT.h
index d7f0e3a3d49da..a86dca06f8ecd 100644
--- a/llvm/include/llvm/Frontend/OpenMP/ClauseT.h
+++ b/llvm/include/llvm/Frontend/OpenMP/ClauseT.h
@@ -446,7 +446,12 @@ struct CollapseT {
N v;
};
-// V5.2: [15.8.3] `extended-atomic` clauses
+// [6.0:266]
+template <typename T, typename I, typename E> //
+struct CollectorT {
+ using IncompleteTrait = std::true_type;
+};
+
template <typename T, typename I, typename E> //
struct CompareT {
using EmptyTrait = std::true_type;
@@ -736,6 +741,12 @@ struct IndirectT {
OPT(InvokedByFptr) v;
};
+// [6.0:265-266]
+template <typename T, typename I, typename E> //
+struct InductorT {
+ using IncompleteTrait = std::true_type;
+};
+
// V5.2: [14.1.2] `init` clause
template <typename T, typename I, typename E> //
struct InitT {
@@ -1324,8 +1335,9 @@ using EmptyClausesT = std::variant<
template <typename T, typename I, typename E>
using IncompleteClausesT =
- std::variant<AdjustArgsT<T, I, E>, AppendArgsT<T, I, E>, GraphIdT<T, I, E>,
- GraphResetT<T, I, E>, MatchT<T, I, E>, OtherwiseT<T, I, E>,
+ std::variant<AdjustArgsT<T, I, E>, AppendArgsT<T, I, E>,
+ CollectorT<T, I, E>, GraphIdT<T, I, E>, GraphResetT<T, I, E>,
+ InductorT<T, I, E>, MatchT<T, I, E>, OtherwiseT<T, I, E>,
ReplayableT<T, I, E>, TransparentT<T, I, E>, WhenT<T, I, E>>;
template <typename T, typename I, typename E>
diff --git a/llvm/include/llvm/Frontend/OpenMP/OMP.td b/llvm/include/llvm/Frontend/OpenMP/OMP.td
index 208609f64f418..bebab9ba63488 100644
--- a/llvm/include/llvm/Frontend/OpenMP/OMP.td
+++ b/llvm/include/llvm/Frontend/OpenMP/OMP.td
@@ -123,6 +123,8 @@ def OMPC_Collapse : Clause<[Spelling<"collapse">]> {
let clangClass = "OMPCollapseClause";
let flangClass = "ScalarIntConstantExpr";
}
+def OMPC_Collector : Clause<[Spelling<"collector">]> {
+}
def OMPC_Compare : Clause<[Spelling<"compare">]> {
let clangClass = "OMPCompareClause";
}
@@ -264,6 +266,8 @@ def OMPC_Inclusive : Clause<[Spelling<"inclusive">]> {
def OMPC_Indirect : Clause<[Spelling<"indirect">]> {
let flangClass = "OmpIndirectClause";
}
+def OMPC_Inductor : Clause<[Spelling<"inductor">]> {
+}
def OMPC_Init : Clause<[Spelling<"init">]> {
let clangClass = "OMPInitClause";
let flangClass = "OmpInitClause";
@@ -749,6 +753,14 @@ def OMP_Critical : Directive<[Spelling<"critical">]> {
let association = AS_Block;
let category = CA_Executable;
}
+def OMP_DeclareInduction : Directive<[Spelling<"declare_induction">]> {
+ let allowedOnceClauses = [
+ VersionedClause<OMPC_Collector, 60>,
+ VersionedClause<OMPC_Inductor, 60>,
+ ];
+ let association = AS_None;
+ let category = CA_Declarative;
+}
def OMP_DeclareMapper : Directive<[Spelling<"declare mapper", 1, 52>,
Spelling<"declare_mapper", 60>]> {
let requiredClauses = [
|
Stylie777
left a comment
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
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/27/builds/18611 Here is the relevant piece of the build log for the reference |
…lvm#166235) Add definitions for DECLARE_INDUCTION, COLLECTOR, and INDUCTOR to OMP.td.
Add definitions for DECLARE_INDUCTION, COLLECTOR, and INDUCTOR to OMP.td.