[all-commits] [llvm/llvm-project] fec244: [MLIR][OpenMP] Support clause-based representation...

Sergio Afonso via All-commits all-commits at lists.llvm.org
Fri May 17 03:58:27 PDT 2024


  Branch: refs/heads/users/skatrak/mlir-clauses-02-base
  Home:   https://github.com/llvm/llvm-project
  Commit: fec244fb8403d1ebcabe30cd27cf23b1839b0b65
      https://github.com/llvm/llvm-project/commit/fec244fb8403d1ebcabe30cd27cf23b1839b0b65
  Author: Sergio Afonso <safonsof at amd.com>
  Date:   2024-05-17 (Fri, 17 May 2024)

  Changed paths:
    M mlir/include/mlir/Dialect/OpenMP/OpenMPOpBase.td

  Log Message:
  -----------
  [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.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list