You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[MLIR][OpenMP] Support clause-based representation of operations
Currently, OpenMP operations are defined independently of each other. However,
one property of the OpenMP specification is that many clauses can be applied to
multiple constructs.
Keeping the MLIR representation of clauses consistent across all operations
that can accept them is important, but since this information is scattered into
multiple operation definitions, it is currently prone to divergence as new
features and changes are added to the dialect. Furthermore, centralizing this
information allows for a single source of truth and avoids redundancy in the
dialect.
The proposal in this patch is to make OpenMP clauses independent top level
definitions which can then be passed in a template argument list to OpenMP
operation definitions, just as it's done for traits. Clauses can define these
properties, which are joined together in order to make a default initialization
for the fields of the same name of the OpenMP operation:
- `traits`: Optional. It gets added to the list of traits of the operation.
- `arguments`: Mandatory. It defines how the clause is represented.
- `assemblyFormat`: Optional (though it should almost always be defined). This
is the declarative definition of the printer/parser for the `arguments`. How
these are combined depends on whether this is an optional or required clause.
- `description`: Optional. It's used to populate a `clausesDescription` field,
so each operation definition must still define a `description` itself. That
field is intended to be appended to the end of the `OpenMP_Op`'s `description`.
- `extraClassDeclaration`: Optional. It can define some C++ code to be added to
every OpenMP operation that includes that clause.
In order to give operation definitions fine-grained control over features of a
certain clause might need to be inhibited, the `OpenMP_Clause` class takes
"skipTraits", "skipArguments", "skipAssemblyFormat", "skipDescription" and
"skipExtraClassDeclaration" bit template arguments. These are intended to be
used very sparingly for cases where some of the clauses might collide in some
way otherwise.
0 commit comments