-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[flang] Add parsing of DO CONCURRENT REDUCE clause #92518
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
Changes from 4 commits
6116f8a
86a29a2
fb82dc2
66b0edd
391face
b8980dc
16d8898
b89b037
ae30be5
fb7c8af
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1870,6 +1870,13 @@ struct ProcComponentRef { | |
WRAPPER_CLASS_BOILERPLATE(ProcComponentRef, Scalar<StructureComponent>); | ||
}; | ||
|
||
// R1522 procedure-designator -> | ||
// procedure-name | proc-component-ref | data-ref % binding-name | ||
struct ProcedureDesignator { | ||
UNION_CLASS_BOILERPLATE(ProcedureDesignator); | ||
std::variant<Name, ProcComponentRef> u; | ||
}; | ||
|
||
// R914 coindexed-named-object -> data-ref | ||
struct CoindexedNamedObject { | ||
BOILERPLATE(CoindexedNamedObject); | ||
|
@@ -2236,16 +2243,31 @@ struct ConcurrentHeader { | |
t; | ||
}; | ||
|
||
// OpenACC 3.2 | ||
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. Add references to DO CONCURRENT REDUCE and !$CUF KERNEL DO to the comment. Are these also the same reduction operators as OpenMP's? If so, the OpenMP code should use them too. 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. The OpenMP design stems from ClauseT.h in the LLVM frontend. It allows a unique reduction identifier, so we should keep the current parser. |
||
// 2.5.15: + | * | max | min | iand | ior | ieor | .and. | .or. | .eqv. | .neqv. | ||
struct ReductionOperator { | ||
ENUM_CLASS( | ||
Operator, Plus, Multiply, Max, Min, Iand, Ior, Ieor, And, Or, Eqv, Neqv) | ||
WRAPPER_CLASS_BOILERPLATE(ReductionOperator, Operator); | ||
CharBlock source; | ||
}; | ||
|
||
// R1130 locality-spec -> | ||
// LOCAL ( variable-name-list ) | LOCAL_INIT ( variable-name-list ) | | ||
// REDUCE ( acc-reduction-op : variable-name-list ) | | ||
// SHARED ( variable-name-list ) | DEFAULT ( NONE ) | ||
struct LocalitySpec { | ||
UNION_CLASS_BOILERPLATE(LocalitySpec); | ||
WRAPPER_CLASS(Local, std::list<Name>); | ||
WRAPPER_CLASS(LocalInit, std::list<Name>); | ||
struct Reduce { | ||
TUPLE_CLASS_BOILERPLATE(Reduce); | ||
using Operator = ReductionOperator; | ||
std::tuple<Operator, std::list<Name>> t; | ||
}; | ||
WRAPPER_CLASS(Shared, std::list<Name>); | ||
EMPTY_CLASS(DefaultNone); | ||
std::variant<Local, LocalInit, Shared, DefaultNone> u; | ||
std::variant<Local, LocalInit, Reduce, Shared, DefaultNone> u; | ||
}; | ||
|
||
// R1123 loop-control -> | ||
|
@@ -3180,13 +3202,6 @@ WRAPPER_CLASS(ExternalStmt, std::list<Name>); | |
// R1519 intrinsic-stmt -> INTRINSIC [::] intrinsic-procedure-name-list | ||
WRAPPER_CLASS(IntrinsicStmt, std::list<Name>); | ||
|
||
// R1522 procedure-designator -> | ||
// procedure-name | proc-component-ref | data-ref % binding-name | ||
struct ProcedureDesignator { | ||
UNION_CLASS_BOILERPLATE(ProcedureDesignator); | ||
std::variant<Name, ProcComponentRef> u; | ||
}; | ||
|
||
// R1525 alt-return-spec -> * label | ||
WRAPPER_CLASS(AltReturnSpec, Label); | ||
|
||
|
@@ -4066,17 +4081,9 @@ struct AccObjectListWithModifier { | |
std::tuple<std::optional<AccDataModifier>, AccObjectList> t; | ||
}; | ||
|
||
// 2.5.15: + | * | max | min | iand | ior | ieor | .and. | .or. | .eqv. | .neqv. | ||
struct AccReductionOperator { | ||
ENUM_CLASS( | ||
Operator, Plus, Multiply, Max, Min, Iand, Ior, Ieor, And, Or, Eqv, Neqv) | ||
WRAPPER_CLASS_BOILERPLATE(AccReductionOperator, Operator); | ||
CharBlock source; | ||
}; | ||
|
||
struct AccObjectListWithReduction { | ||
TUPLE_CLASS_BOILERPLATE(AccObjectListWithReduction); | ||
std::tuple<AccReductionOperator, AccObjectList> t; | ||
std::tuple<ReductionOperator, AccObjectList> t; | ||
}; | ||
|
||
struct AccWaitArgument { | ||
|
@@ -4316,7 +4323,7 @@ struct OpenACCConstruct { | |
|
||
struct CUFReduction { | ||
TUPLE_CLASS_BOILERPLATE(CUFReduction); | ||
using Operator = AccReductionOperator; | ||
using Operator = ReductionOperator; | ||
std::tuple<Operator, std::list<Scalar<Variable>>> t; | ||
}; | ||
|
||
|
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.
This code was moved up from below, but that no longer seems to be necessary.