Skip to content
  1. Nov 04, 2020
    • mikeurbach's avatar
      [MLIR] Move eraseArguments and eraseResults to FunctionLike · 2e36e0da
      mikeurbach authored
      Previously, they were only defined for `FuncOp`.
      
      To support this, `FunctionLike` needs a way to get an updated type
      from the concrete operation. This adds a new hook for that purpose,
      called `getTypeWithoutArgsAndResults`.
      
      For now, `FunctionLike` continues to assume the type is
      `FunctionType`, and concrete operations that use another type can hide
      the `getType`, `setType`, and `getTypeWithoutArgsAndResults` methods.
      
      Reviewed By: rriddle
      
      Differential Revision: https://reviews.llvm.org/D90363
      2e36e0da
  2. Nov 03, 2020
  3. Nov 02, 2020
    • River Riddle's avatar
      [mlir] Optimize Op definitions and registration to optimize for code size · b870d9ec
      River Riddle authored
      This revision refactors the base Op/AbstractOperation classes to reduce the amount of generated code size when defining a new operation. The current scheme involves taking the address of functions defined directly on Op and Trait classes. This is problematic because even when these functions are empty/unused we still result in these functions being defined in the main executable. In this revision, we switch to using SFINAE and template type filtering to remove remove functions that are not needed/used. For example, if an operation does not define a custom `print` method we shouldn't define a templated `printAssembly` method for it. The same applies to parsing/folding/verification/etc. This dropped MLIR code size for a large downstream library by ~10%(~1 mb in an opt build).
      
      Differential Revision: https://reviews.llvm.org/D90196
      b870d9ec
    • Benjamin Kramer's avatar
      [MLIR] Work around an ICE in GCC 7. · 5ece2115
      Benjamin Kramer authored
      Looks like we have a blind spot in the testing matrix.
      
      AsyncRegionRewriter.cpp: In member function ‘virtual void {anonymous}::GpuAsyncRegionPass::runOnFunction()’:
      AsyncRegionRewriter.cpp:113:16: internal compiler error: in replace_placeholders_r, at cp/tree.c:2804
         if (getFunction()
             ~~~~~~~~~~~~~
                 .getRegion()
                 ~~~~~~~~~~~~
                 .walk(Callback{OpBuilder{&getContext()}})
                 ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      5ece2115
    • Rahul Joshi's avatar
      [MLIR] Introduce std.global_memref and std.get_global_memref operations. · c254b0bb
      Rahul Joshi authored
      - Add standard dialect operations to define global variables with memref types and to
        retrieve the memref for to a named global variable
      - Extend unit tests to test verification for these operations.
      
      Differential Revision: https://reviews.llvm.org/D90337
      c254b0bb
    • Sean Silva's avatar
      [mlir] Add func-bufferize pass. · 52b0fe64
      Sean Silva authored
      This is the most basic possible finalizing bufferization pass, which I
      also think is sufficient for most new use cases. The more concentrated
      nature of this pass also greatly clarifies the invariants that it
      requires on its input to safely transform the program (see the
      pass description in Passes.td).
      
      With this pass, I have now upstreamed practically all of the
      bufferizations from npcomp (the exception being std.constant, which can
      be upstreamed when std.global_memref lands:
      https://llvm.discourse.group/t/rfc-global-variables-in-mlir/2076/16 )
      
      Differential Revision: https://reviews.llvm.org/D90205
      52b0fe64
    • Thomas Raoux's avatar
    • Stella Laurenzo's avatar
      [mlir][CAPI] Add APIs for mlirOperationGetName and Identifier. · b85f2f5c
      Stella Laurenzo authored
      Reviewed By: ftynse
      
      Differential Revision: https://reviews.llvm.org/D90583
      b85f2f5c
    • Frederik Gossen's avatar
      Revert "[MLIR] Support walks over regions and blocks" · 327bf5c2
      Frederik Gossen authored
      This reverts commit dbae3d50.
      Cannot build with gcc/g++ 7.5.0.
      327bf5c2
    • Stella Laurenzo's avatar
      [mlir][Python] Context managers for Context, InsertionPoint, Location. · af66cd17
      Stella Laurenzo authored
      * Finishes support for Context, InsertionPoint and Location to be carried by the thread using context managers.
      * Introduces type casters and utilities so that DefaultPyMlirContext and DefaultPyLocation in method signatures does the right thing (allows explicit or gets from the thread context).
      * Extend the rules for the thread context stack to handle nesting, appropriately inheriting and clearing depending on whether the context is the same.
      * Refactors all method signatures to follow the new convention on trailing parameters for defaulting parameters (loc, ip, context). When the objects are carried in the thread context, this allows most explicit uses of these values to be elided.
      * Removes the style guide section on putting accessors to construct global objects on the PyMlirContext: this style fails to make good use of the new facility since it is often the only thing remaining needing an MlirContext.
      * Moves Module parse/creation from mlir.ir.Context to static methods on mlir.ir.Module.
      * Moves Context.create_operation to a static Operation.create method.
      * Moves Type parsing from mlir.ir.Context to static methods on mlir.ir.Type.
      * Moves Attribute parsing from mlir.ir.Context to static methods on mlir.ir.Attribute.
      * Move Location factory methods from mlir.ir.Context to static methods on mlir.ir.Location.
      * Refactors the std dialect fake "ODS" generated code to take advantage of the new scheme.
      
      Differential Revision: https://reviews.llvm.org/D90547
      af66cd17
  4. Oct 31, 2020
  5. Oct 30, 2020
    • Sean Silva's avatar
      [mlir] Add BufferResultsToOutParams pass. · b8665742
      Sean Silva authored
      This pass allows removing getResultConversionKind from
      BufferizeTypeConverter. This pass replaces the AppendToArgumentsList
      functionality. As far as I could tell, the only use of this functionlity
      is to perform the transformation that is implemented in this pass.
      
      Future patches will remove the getResultConversionKind machinery from
      BufferizeTypeConverter, but sending this patch for individual review for
      clarity.
      
      Differential Revision: https://reviews.llvm.org/D90071
      b8665742
    • ergawy's avatar
      [MLIR][SPIRV] Start module combiner. · 90a8260c
      ergawy authored
      This commit adds a new library that merges/combines a number of spv
      modules into a combined one. The library has a single entry point:
      combine(...).
      
      To combine a number of MLIR spv modules, we move all the module-level ops
      from all the input modules into one big combined module. To that end, the
      combination process can proceed in 2 phases:
      
        (1) resolving conflicts between pairs of ops from different modules
        (2) deduplicate equivalent ops/sub-ops in the merged module. (TODO)
      
      This patch implements only the first phase.
      
      Reviewed By: antiagainst
      
      Differential Revision: https://reviews.llvm.org/D90477
      90a8260c
    • Sean Silva's avatar
      [mlir] Move some linalg patterns around. · 30e130c3
      Sean Silva authored
      The bufferization patterns are moved to the .cpp file, which is
      preferred in the codebase when it makes sense.
      
      The LinalgToStandard patterns are kept a header because they are
      expected to be used individually. However, they are moved to
      LinalgToStandard.h which is the file corresponding to where they are
      defined.
      
      This also removes TensorCastOpConverter, which is handled by
      populateStdBufferizePatterns now. Eventually, the constant op lowering
      will be handled as well, but it there are currently holdups on moving
      it (see https://reviews.llvm.org/D89916).
      
      Differential Revision: https://reviews.llvm.org/D90254
      30e130c3
    • Geoffrey Martin-Noble's avatar
      Revert "[MLIR][SPIRV] Start module combiner." · 1142eaed
      Geoffrey Martin-Noble authored
      This reverts commit 27324f28.
      
      Shared libs build is broken linking lib/libMLIRSPIRVModuleCombiner.so:
      
      ```
      ModuleCombiner.cpp:
        undefined reference to `mlir::spirv::ModuleOp::addressing_model()
      ```
      
      https://buildkite.com/mlir/mlir-core/builds/8988#e3d966b9-ea43-492e-a192-b28e71e9a15b
      1142eaed
    • ergawy's avatar
      [MLIR][SPIRV] Start module combiner. · 27324f28
      ergawy authored
      This commit adds a new library that merges/combines a number of spv
      modules into a combined one. The library has a single entry point:
      combine(...).
      
      To combine a number of MLIR spv modules, we move all the module-level ops
      from all the input modules into one big combined module. To that end, the
      combination process can proceed in 2 phases:
      
        (1) resolving conflicts between pairs of ops from different modules
        (2) deduplicate equivalent ops/sub-ops in the merged module. (TODO)
      
      This patch implements only the first phase.
      
      Reviewed By: antiagainst
      
      Differential Revision: https://reviews.llvm.org/D90477
      27324f28
    • Mehdi Amini's avatar
      Revert "[MLIR][SPIRV] Start module combiner" · b3430ed0
      Mehdi Amini authored
      This reverts commit 316593ce.
      Build is broken with:
      
      TestModuleCombiner.cpp:(.text._ZN12_GLOBAL__N_122TestModuleCombinerPass14runOnOperationEv+0x195): undefined reference to `mlir::spirv::combine(llvm::MutableArrayRef<mlir::spirv::ModuleOp>, mlir::OpBuilder&, llvm::function_ref<void (mlir::spirv::ModuleOp, llvm::StringRef, llvm::StringRef)>)'
      b3430ed0
    • ergawy's avatar
      [MLIR][SPIRV] Start module combiner · 316593ce
      ergawy authored
      This commit adds a new library that merges/combines a number of spv
      modules into a combined one. The library has a single entry point:
      combine(...).
      
      To combine a number of MLIR spv modules, we move all the module-level ops
      from all the input modules into one big combined module. To that end, the
      combination process can proceed in 2 phases:
      
        (1) resolving conflicts between pairs of ops from different modules
        (2) deduplicate equivalent ops/sub-ops in the merged module. (TODO)
      
      This patch implements only the first phase.
      
      Reviewed By: antiagainst
      
      Differential Revision: https://reviews.llvm.org/D90022
      316593ce
    • Eugene Zhulenev's avatar
      [mlir] Implement lowering to LLVM of async.execute ops with token dependencies · f507aa17
      Eugene Zhulenev authored
      Add support for lowering `async.execute` operations with token dependencies
      
      Example:
      
      ```
      %dep = ... : !async.token
      %token = async.execute[%dep] {
      ...
      }
      ```
      
      Token dependencies lowered to `async.await` operations inside the outline coroutine body.
      
      Reviewed By: herhut, mehdi_amini, ftynse
      
      Differential Revision: https://reviews.llvm.org/D89958
      f507aa17
    • Tres Popp's avatar
      511484f2
    • River Riddle's avatar
      [mlir][ASM] Refactor how attribute/type aliases are specified. · a463ea50
      River Riddle authored
      Previously they were separated into "instance" and "kind" aliases, and also required that the dialect know ahead of time all of the instances that would have a corresponding alias. This approach was very clunky and not ergonomic to interact with. The new approach is to provide the dialect with an instance  of an attribute/type to provide an alias for, fully replacing the original split approach.
      
      Differential Revision: https://reviews.llvm.org/D89354
      a463ea50
    • Mehdi Amini's avatar
      Fix "incorrect" assertions in Linalg/EDSC/Builders.cpp (NFC) · c23cb8b0
      Mehdi Amini authored
      It is semantically equivalent, but the intent was really lost there.
      This fixes a warning/error from MSVC as well, see PR48013
      c23cb8b0
    • Stella Laurenzo's avatar
      Add InsertionPoint and context managers to the Python API. · c645ea5e
      Stella Laurenzo authored
      * Removes index based insertion. All insertion now happens through the insertion point.
      * Introduces thread local context managers for implicit creation relative to an insertion point.
      * Introduces (but does not yet use) binding the Context to the thread local context stack. Intent is to refactor all methods to take context optionally and have them use the default if available.
      * Adds C APIs for mlirOperationGetParentOperation(), mlirOperationGetBlock() and mlirBlockGetTerminator().
      * Removes an assert in PyOperation creation that was incorrectly constraining. There is already a TODO to rework the keepAlive field that it was guarding and without the assert, it is no worse than the current state.
      
      Differential Revision: https://reviews.llvm.org/D90368
      c645ea5e
  6. Oct 29, 2020
Loading