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][Bufferize] Rename TestBufferPlacement to TestFinalizingBufferize · 773ad135
      Sean Silva authored
      BufferPlacement is no longer part of bufferization. However, this test
      is an important test of "finalizing" bufferize passes.
      A "finalizing" bufferize conversion is one that performs a "full"
      conversion and expects all tensors to be gone from the program. This in
      particular involves rewriting funcs (including block arguments of the
      contained region), calls, and returns. The unique property of finalizing
      bufferization passes is that they cannot be done via a local
      transformation with suitable materializations to ensure composability
      (as other bufferization passes do). For example, if a call is
      rewritten, the callee needs to be rewritten otherwise the IR will end up
      invalid. Thus, finalizing bufferization passes require an atomic change
      to the entire program (e.g. the whole module).
      
      This new designation makes it clear also that it shouldn't be testing
      bufferization of linalg ops, so the tests have been updated to not use
      linalg.generic ops. (linalg.copy is still used as the "copy" op for
      copying into out-params)
      
      Differential Revision: https://reviews.llvm.org/D89979
      773ad135
    • 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
    • Mehdi Amini's avatar
      Undef the `DEFINE_C_API_STRUCT` macro after using it in the MLIR C API header (NFC) · 9be3c01e
      Mehdi Amini authored
      Leaking macros isn't a good practice when defining headers. This
      requires to duplicate the macro definition in every header though, but
      that seems like a better tradeoff right now.
      
      Differential Revision: https://reviews.llvm.org/D90633
      9be3c01e
    • 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
    • Frederik Gossen's avatar
      Revert "[MLIR] Use `llvm::is_one_of` in walk templates" · 6b74a5aa
      Frederik Gossen authored
      This reverts commit 56299b1e.
      Cannot build with gcc/g++ 7.5.0.
      6b74a5aa
    • Stella Laurenzo's avatar
      NFC: Wrap lines in Python.md. · 895ae487
      Stella Laurenzo authored
      895ae487
    • 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
    • Mehdi Amini's avatar
      Use `--allow-unused-prefixes=false` by default for FileCheck in MLIR testsuite · 72ddd559
      Mehdi Amini authored
      This option catches unexpected mismatch when a prefix is given to
      FileCheck on the command line but never matches a single line in the
      test.
      
      See http://lists.llvm.org/pipermail/llvm-dev/2020-October/146162.html
      for more info.
      
      Differential Revision: https://reviews.llvm.org/D90501
      72ddd559
    • 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
    • Arthur Eubanks's avatar
      Use uint64_t for branch weights instead of uint32_t · 10f2a0d6
      Arthur Eubanks authored
      CallInst::updateProfWeight() creates branch_weights with i64 instead of i32.
      To be more consistent everywhere and remove lots of casts from uint64_t
      to uint32_t, use i64 for branch_weights.
      
      Reviewed By: davidxl
      
      Differential Revision: https://reviews.llvm.org/D88609
      10f2a0d6
    • 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
Loading