[all-commits] [llvm/llvm-project] f89235: [mlir][SideEffects] Define a set of interfaces and...

River Riddle via All-commits all-commits at lists.llvm.org
Fri Mar 6 14:05:06 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: f8923584da83be461aafab3f45cc41f872fa7d74
      https://github.com/llvm/llvm-project/commit/f8923584da83be461aafab3f45cc41f872fa7d74
  Author: River Riddle <riddleriver at gmail.com>
  Date:   2020-03-06 (Fri, 06 Mar 2020)

  Changed paths:
    M mlir/include/mlir/IR/CMakeLists.txt
    M mlir/include/mlir/IR/OpBase.td
    M mlir/include/mlir/IR/OpDefinition.h
    A mlir/include/mlir/IR/SideEffects.td
    M mlir/lib/IR/CMakeLists.txt
    M mlir/lib/IR/Operation.cpp
    M mlir/lib/Translation/CMakeLists.txt
    A mlir/test/IR/test-side-effects.mlir
    M mlir/test/lib/IR/CMakeLists.txt
    A mlir/test/lib/IR/TestSideEffects.cpp
    M mlir/test/lib/TestDialect/TestDialect.cpp
    M mlir/test/lib/TestDialect/TestOps.td
    M mlir/tools/mlir-opt/mlir-opt.cpp

  Log Message:
  -----------
  [mlir][SideEffects] Define a set of interfaces and traits for defining side effects

This revision introduces the infrastructure for defining side-effects and attaching them to operations. This infrastructure allows for defining different types of side effects, that don't interact with each other, but use the same internal mechanisms. At the base of this is an interface that allows operations to specify the different effect instances that are exhibited by a specific operation instance. An effect instance is comprised of the following:

* Effect: The specific effect being applied.
  For memory related effects this may be reading from memory, storing to memory, etc.

* Value: A specific value, either operand/result/region argument, the effect pertains to.

* Resource: This is a global entity that represents the domain within which the effect is being applied.

MLIR serves many different abstractions, which cover many different domains. Simple effects are may have very different context, for example writing to an in-memory buffer vs a database. This revision defines uses this infrastructure to define a set of initial MemoryEffects. The are effects that generally correspond to memory of some kind; Allocate, Free, Read, Write.

This set of memory effects will be used in follow revisions to generalize various parts of the compiler, and make others more powerful(e.g. DCE).

This infrastructure was originally proposed here:
https://groups.google.com/a/tensorflow.org/g/mlir/c/v2mNl4vFCUM

Differential Revision: https://reviews.llvm.org/D74439


  Commit: 20dca52288adfb64cdeb25fd25fbe0bb8628e7c3
      https://github.com/llvm/llvm-project/commit/20dca52288adfb64cdeb25fd25fbe0bb8628e7c3
  Author: River Riddle <riddleriver at gmail.com>
  Date:   2020-03-06 (Fri, 06 Mar 2020)

  Changed paths:
    M mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
    M mlir/include/mlir/IR/OpBase.td
    M mlir/include/mlir/IR/SideEffects.td
    M mlir/include/mlir/TableGen/Operator.h
    A mlir/include/mlir/TableGen/SideEffects.h
    M mlir/lib/TableGen/CMakeLists.txt
    M mlir/lib/TableGen/Operator.cpp
    A mlir/lib/TableGen/SideEffects.cpp
    A mlir/test/mlir-tblgen/op-side-effects.td
    M mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp

  Log Message:
  -----------
  [mlir][SideEffects] Enable specifying side effects directly on the arguments/results of an operation.

Summary:
New classes are added to ODS to enable specifying additional information on the arguments and results of an operation. These classes, `Arg` and `Res` allow for adding a description and a set of 'decorators' along with the constraint. This enables specifying the side effects of an operation directly on the arguments and results themselves.

Example:
```
def LoadOp : Std_Op<"load"> {
  let arguments = (ins Arg<AnyMemRef, "the MemRef to load from",
                           [MemRead]>:$memref,
                       Variadic<Index>:$indices);
}
```

Differential Revision: https://reviews.llvm.org/D74440


Compare: https://github.com/llvm/llvm-project/compare/7b8341b25771...20dca52288ad


More information about the All-commits mailing list