Skip to content
  1. Mar 15, 2021
  2. Feb 23, 2021
    • Mehdi Amini's avatar
      Move the MLIR integration tests as a subdirectory of test (NFC) · 99b0032c
      Mehdi Amini authored
      This does not change the behavior directly: the tests only run when
      `-DMLIR_INCLUDE_INTEGRATION_TESTS=ON` is configured. However running
      `ninja check-mlir` will not run all the tests within a single
      lit invocation. The previous behavior would wait for all the integration
      tests to complete before starting to run the first regular test. The
      test results were also reported separately. This change is unifying all
      of this and allow concurrent execution of the integration tests with
      regular non-regression and unit-tests.
      
      Differential Revision: https://reviews.llvm.org/D97241
      99b0032c
  3. Feb 11, 2021
  4. Feb 09, 2021
  5. Feb 04, 2021
  6. Feb 02, 2021
    • Michał Górny's avatar
      [MLIR] [CMake] Support building MLIR standalone · 2aa1af9b
      Michał Górny authored
      Add the necessary bits to CMakeLists to make it possible to configure
      MLIR against installed LLVM, and build it with minimal need for LLVM
      source tree.  The latter is only necessary to run unittests, and if it
      is missing then unittests are skipped with a warning.
      
      This change includes the necessary changes to tests, in particular
      adding some missing substitutions and defining missing variables
      for lit.site.cfg.py substitution.
      
      Reviewed By: stephenneuendorffer
      
      Differential Revision: https://reviews.llvm.org/D85464
      
      
      
      Co-authored-by: default avatarIsuru Fernando <isuruf@gmail.com>
      2aa1af9b
  7. Jan 29, 2021
  8. Jan 18, 2021
  9. Dec 02, 2020
  10. Nov 24, 2020
  11. Nov 22, 2020
    • Stella Laurenzo's avatar
      [mlir][Python] Support finding pybind11 from the python environment. · f4f8a67a
      Stella Laurenzo authored
      * Makes `pip install pybind11` do the right thing with no further config.
      * Since we now require a version of pybind11 greater than many LTS OS installs (>=2.6), a more convenient way to get a recent version is preferable.
      * Also adds the version spec to find_package so it will skip older versions that may be lying around.
      * Tested the full matrix of old system install, no system install, pip install and no pip install.
      
      Differential Revision: https://reviews.llvm.org/D91903
      f4f8a67a
  12. Nov 17, 2020
    • Alex Zinenko's avatar
      [mlir] Add basic support for attributes in ODS-generated Python bindings · c5a6712f
      Alex Zinenko authored
      In ODS, attributes of an operation can be provided as a part of the "arguments"
      field, together with operands. Such attributes are accepted by the op builder
      and have accessors generated.
      
      Implement similar functionality for ODS-generated op-specific Python bindings:
      the `__init__` method now accepts arguments together with operands, in the same
      order as in the ODS `arguments` field; the instance properties are introduced
      to OpView classes to access the attributes.
      
      This initial implementation accepts and returns instances of the corresponding
      attribute class, and not the underlying values since the mapping scheme of the
      value types between C++, C and Python is not yet clear. Default-valued
      attributes are not supported as that would require Python to be able to parse
      C++ literals.
      
      Since attributes in ODS are tightely related to the actual C++ type system,
      provide a separate Tablegen file with the mapping between ODS storage type for
      attributes (typically, the underlying C++ attribute class), and the
      corresponding class name. So far, this might look unnecessary since all names
      match exactly, but this is not necessarily the cases for non-standard,
      out-of-tree attributes, which may also be placed in non-default namespaces or
      Python modules. This also allows out-of-tree users to generate Python bindings
      without having to modify the bindings generator itself. Storage type was
      preferred over the Tablegen "def" of the attribute class because ODS
      essentially encodes attribute _constraints_ rather than classes, e.g. there may
      be many Tablegen "def"s in the ODS that correspond to the same attribute type
      with additional constraints
      
      The presence of the explicit mapping requires the change in the .td file
      structure: instead of just calling the bindings generator directly on the main
      ODS file of the dialect, it becomes necessary to create a new file that
      includes the main ODS file of the dialect and provides the mapping for
      attribute types. Arguably, this approach offers better separability of the
      Python bindings in the build system as the main dialect no longer needs to know
      that it is being processed by the bindings generator.
      
      Reviewed By: stellaraccident
      
      Differential Revision: https://reviews.llvm.org/D91542
      c5a6712f
  13. Nov 10, 2020
  14. Nov 07, 2020
  15. Nov 05, 2020
  16. Nov 04, 2020
  17. Oct 26, 2020
    • George Mitenkov's avatar
      [MLIR][mlir-spirv-cpu-runner] A SPIR-V cpu runner prototype · 89808ce7
      George Mitenkov authored
      This patch introduces a SPIR-V runner. The aim is to run a gpu
      kernel on a CPU via GPU -> SPIRV -> LLVM conversions. This is a first
      prototype, so more features will be added in due time.
      
      - Overview
      The runner follows similar flow as the other runners in-tree. However,
      having converted the kernel to SPIR-V, we encode the bind attributes of
      global variables that represent kernel arguments. Then SPIR-V module is
      converted to LLVM. On the host side, we emulate passing the data to device
      by creating in main module globals with the same symbolic name as in kernel
      module. These global variables are later linked with ones from the nested
      module. We copy data from kernel arguments to globals, call the kernel
      function from nested module and then copy the data back.
      
      - Current state
      At the moment, the runner is capable of running 2 modules, nested one in
      another. The kernel module must contain exactly one kernel function. Also,
      the runner supports rank 1 integer memref types as arguments (to be scaled).
      
      - Enhancement of JitRunner and ExecutionEngine
      To translate nested modules to LLVM IR, JitRunner and ExecutionEngine were
      altered to take an optional (default to `nullptr`) function reference that
      is a custom LLVM IR module builder. This allows to customize LLVM IR module
      creation from MLIR modules.
      
      Reviewed By: ftynse, mravishankar
      
      Differential Revision: https://reviews.llvm.org/D86108
      89808ce7
  18. Oct 05, 2020
  19. Oct 04, 2020
    • Stephen Neuendorffer's avatar
      [RFC] Factor out repetitive cmake patterns for llvm-style projects · e9b87f43
      Stephen Neuendorffer authored
      New projects (particularly out of tree) have a tendency to hijack the existing
      llvm configuration options and build targets (add_llvm_library,
      add_llvm_tool).  This can lead to some confusion.
      
      1) When querying a configuration variable, do we care about how LLVM was
      configured, or how these options were configured for the out of tree project?
      2) LLVM has lots of defaults, which are easy to miss
      (e.g. LLVM_BUILD_TOOLS=ON).  These options all need to be duplicated in the
      CMakeLists.txt for the project.
      
      In addition, with LLVM Incubators coming online, we need better ways for these
      incubators to do things the "LLVM way" without alot of futzing.  Ideally, this
      would happen in a way that eases importing into the LLVM monorepo when
      projects mature.
      
      This patch creates some generic infrastructure in llvm/cmake/modules and
      refactors MLIR to use this infrastructure.  This should expand to include
      add_xxx_library, which is by far the most complicated bit of building a
      project correctly, since it has to deal with lots of shared library
      configuration bits.  (MLIR currently hijacks the LLVM infrastructure for
      building libMLIR.so, so this needs to get refactored anyway.)
      
      Differential Revision: https://reviews.llvm.org/D85140
      e9b87f43
  20. Aug 05, 2020
    • Alex Zinenko's avatar
      [mlir] Initial version of C APIs · 75f239e9
      Alex Zinenko authored
          Introduce an initial version of C API for MLIR core IR components: Value, Type,
          Attribute, Operation, Region, Block, Location. These APIs allow for both
          inspection and creation of the IR in the generic form and intended for wrapping
          in high-level library- and language-specific constructs. At this point, there
          is no stability guarantee provided for the API.
      
      Reviewed By: stellaraccident, lattner
      
      Differential Revision: https://reviews.llvm.org/D83310
      75f239e9
  21. Jul 09, 2020
    • Stella Laurenzo's avatar
      Initial boiler-plate for python bindings. · 722475a3
      Stella Laurenzo authored
      Summary:
      * Native '_mlir' extension module.
      * Python mlir/__init__.py trampoline module.
      * Lit test that checks a message.
      * Uses some cmake configurations that have worked for me in the past but likely needs further elaboration.
      
      Subscribers: mgorny, mehdi_amini, rriddle, jpienaar, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, stephenneuendorffer, Joonsoo, grosul1, Kayjukh, jurahul, msifontes
      
      Tags: #mlir
      
      Differential Revision: https://reviews.llvm.org/D83279
      722475a3
  22. Jun 15, 2020
    • aartbik's avatar
      [mlir] [integration_test] Make integration tests default OFF · 8d73ab8d
      aartbik authored
      Summary:
      Previous submit of new tests accidentally made this ON.
      The tests should be opt-in.
      
      To build with MLIR integration tests enabled, pass the following
      
      cmake .... \
      -DMLIR_INCLUDE_INTEGRATION_TESTS=ON \
      ....
      
      Reviewers: mehdi_amini
      
      Subscribers: mgorny, mehdi_amini, rriddle, jpienaar, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, stephenneuendorffer, Joonsoo, grosul1, frgossen, Kayjukh, jurahul, msifontes
      
      Tags: #mlir
      
      Differential Revision: https://reviews.llvm.org/D81878
      8d73ab8d
    • aartbik's avatar
      [mlir] [integration-test] [VectorOps] Start an integration test directory for MLIR · 91801a7c
      aartbik authored
      Summary:
      This CL introduces an integration test directory for MLIR in general, with
      vector dialect integration tests in particular as a first working suite. To
      run all the integration tests (and currently just the vector suite):
      
      $ cmake --build . --target check-mlir-integration
      [0/1] Running the MLIR integration tests
      Testing Time: 0.24s
      Passed: 22
      
      The general call is to contribute to this integration test directory with more
      tests and other suites, running end-to-end examples that may be too heavy for
      the regular test directory, but should be tested occasionally to verify the
      health of MLIR.
      
      Background discussion at:
      https://llvm.discourse.group/t/vectorops-rfc-add-suite-of-integration-tests-for-vector-dialect-operations/1213/
      
      Reviewers: nicolasvasilache, reidtatge, andydavis1, rriddle, ftynse, mehdi_amini, jpienaar, stephenneuendorffer
      
      Reviewed By: nicolasvasilache, stephenneuendorffer
      
      Subscribers: mgorny, mehdi_amini, rriddle, jpienaar, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, stephenneuendorffer, Joonsoo, grosul1, frgossen, Kayjukh, jurahul, msifontes
      
      Tags: #mlir
      
      Differential Revision: https://reviews.llvm.org/D81626
      91801a7c
  23. Jun 05, 2020
    • Wen-Heng (Jack) Chung's avatar
      [mlir][gpu] Introduce mlir-rocm-runner. · 2fd6403a
      Wen-Heng (Jack) Chung authored
      Summary:
      `mlir-rocm-runner` is introduced in this commit to execute GPU modules on ROCm
      platform. A small wrapper to encapsulate ROCm's HIP runtime API is also inside
      the commit.
      
      Due to behavior of ROCm, raw pointers inside memrefs passed to `gpu.launch`
      must be modified on the host side to properly capture the pointer values
      addressable on the GPU.
      
      LLVM MC is used to assemble AMD GCN ISA coming out from
      `ConvertGPUKernelToBlobPass` to binary form, and LLD is used to produce a shared
      ELF object which could be loaded by ROCm HIP runtime.
      
      gfx900 is the default target be used right now, although it could be altered via
      an option in `mlir-rocm-runner`. Future revisions may consider using ROCm Agent
      Enumerator to detect the right target on the system.
      
      Notice AMDGPU Code Object V2 is used in this revision. Future enhancements may
      upgrade to AMDGPU Code Object V3.
      
      Bitcode libraries in ROCm-Device-Libs, which implements math routines exposed in
      `rocdl` dialect are not yet linked, and is left as a TODO in the logic.
      
      Reviewers: herhut
      
      Subscribers: mgorny, tpr, dexonsmith, mehdi_amini, rriddle, jpienaar, shauheen, antiagainst, nicolasvasilache, csigg, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, stephenneuendorffer, Joonsoo, grosul1, frgossen, Kayjukh, jurahul, llvm-commits
      
      Tags: #mlir, #llvm
      
      Differential Revision: https://reviews.llvm.org/D80676
      2fd6403a
  24. May 28, 2020
    • Wen-Heng (Jack) Chung's avatar
      [mlir][gpu][mlir-cuda-runner] Refactor ConvertKernelFuncToCubin to be generic. · 061fb8eb
      Wen-Heng (Jack) Chung authored
      Make ConvertKernelFuncToCubin pass to be generic:
      
      - Rename to ConvertKernelFuncToBlob.
      - Allow specifying triple, target chip, target features.
      - Initializing LLVM backend is supplied by a callback function.
      - Lowering process from MLIR module to LLVM module is via another callback.
      - Change mlir-cuda-runner to adopt the revised pass.
      - Add new tests for lowering to ROCm HSA code object (HSACO).
      - Tests for CUDA and ROCm are kept in separate directories.
      
      Differential Revision: https://reviews.llvm.org/D80142
      061fb8eb
  25. May 18, 2020
  26. May 02, 2020
    • Stephen Neuendorffer's avatar
      [MLIR] add dependencies for all tablegen targets on 'mlir-headers' · 7add6b6b
      Stephen Neuendorffer authored
      In cmake, dependencies on generated files require some sophistication in the build system.  At build time, files are parsed to determine which headers they depend on and these dependencies are injected into the build system.  This works well with ninja, but has some constraints with the makefile generator.  According to the cmake documentation, this only works reliably within the same directory.
      
      This patch expands the usage of mlir-headers to include all generated headers and adds an mlir-generic-headers target which triggers generation of dialect-independent headers.  These targets are used to express dependencies on generated headers.  This is mostly handled in AddMLIR.cmake and only a few CMakeLists.txt files need to change.
      
      Differential Revision: https://reviews.llvm.org/D79242
      7add6b6b
  27. Apr 12, 2020
  28. Mar 14, 2020
  29. Mar 06, 2020
    • Valentin Churavy's avatar
      [MLIR] Add support for libMLIR.so · 7c64f6bf
      Valentin Churavy authored
      Putting this up mainly for discussion on
      how this should be done. I am interested in MLIR from
      the Julia side and we currently have a strong preference
      to dynamically linking against the LLVM shared library,
      and would like to have a MLIR shared library.
      
      This patch adds a new cmake function add_mlir_library()
      which accumulates a list of targets to be compiled into
      libMLIR.so.  Note that not all libraries make sense to
      be compiled into libMLIR.so.  In particular, we want
      to avoid libraries which primarily exist to support
      certain tools (such as mlir-opt and mlir-cpu-runner).
      
      Note that the resulting libMLIR.so depends on LLVM, but
      does not contain any LLVM components.  As a result, it
      is necessary to link with libLLVM.so to avoid linkage
      errors. So, libMLIR.so requires LLVM_BUILD_LLVM_DYLIB=on
      
      FYI, Currently it appears that LLVM_LINK_LLVM_DYLIB is broken
      because mlir-tblgen is linked against libLLVM.so and
      and independent LLVM components.
      
      Previous version of this patch broke depencies on TableGen
      targets.  This appears to be because it compiled all
      libraries to OBJECT libraries (probably because cmake
      is generating different target names).  Avoiding object
      libraries results in correct dependencies.
      
      (updated by Stephen Neuendorffer)
      
      Differential Revision: https://reviews.llvm.org/D73130
      7c64f6bf
  30. Feb 29, 2020
    • Stephen Neuendorffer's avatar
      Revert "[MLIR] Add support for libMLIR.so" · dd046c96
      Stephen Neuendorffer authored
      This reverts commit e17d9c11.
      It breaks the build.
      dd046c96
    • Valentin Churavy's avatar
      [MLIR] Add support for libMLIR.so · e17d9c11
      Valentin Churavy authored
      Putting this up mainly for discussion on
      how this should be done. I am interested in MLIR from
      the Julia side and we currently have a strong preference
      to dynamically linking against the LLVM shared library,
      and would like to have a MLIR shared library.
      
      This patch adds a new cmake function add_mlir_library()
      which accumulates a list of targets to be compiled into
      libMLIR.so.  Note that not all libraries make sense to
      be compiled into libMLIR.so.  In particular, we want
      to avoid libraries which primarily exist to support
      certain tools (such as mlir-opt and mlir-cpu-runner).
      
      Note that the resulting libMLIR.so depends on LLVM, but
      does not contain any LLVM components.  As a result, it
      is necessary to link with libLLVM.so to avoid linkage
      errors. So, libMLIR.so requires LLVM_BUILD_LLVM_DYLIB=on
      
      FYI, Currently it appears that LLVM_LINK_LLVM_DYLIB is broken
      because mlir-tblgen is linked against libLLVM.so and
      and independent LLVM components.
      
      Previous version of this patch broke depencies on TableGen
      targets.  This appears to be because it compiled all
      libraries to OBJECT libraries (probably because cmake
      is generating different target names).  Avoiding object
      libraries results in correct dependencies.
      
      (updated by Stephen Neuendorffer)
      
      Differential Revision: https://reviews.llvm.org/D73130
      e17d9c11
  31. Feb 28, 2020
    • Stephen Neuendorffer's avatar
      Revert "[MLIR] Add support for libMLIR.so" · c6f3fc49
      Stephen Neuendorffer authored
      This reverts commit 1246e867.
      c6f3fc49
    • Valentin Churavy's avatar
      [MLIR] Add support for libMLIR.so · 1246e867
      Valentin Churavy authored
      Putting this up mainly for discussion on
      how this should be done. I am interested in MLIR from
      the Julia side and we currently have a strong preference
      to dynamically linking against the LLVM shared library,
      and would like to have a MLIR shared library.
      
      This patch adds a new cmake function add_mlir_library()
      which accumulates a list of targets to be compiled into
      libMLIR.so.  Note that not all libraries make sense to
      be compiled into libMLIR.so.  In particular, we want
      to avoid libraries which primarily exist to support
      certain tools (such as mlir-opt and mlir-cpu-runner).
      
      Note that the resulting libMLIR.so depends on LLVM, but
      does not contain any LLVM components.  As a result, it
      is necessary to link with libLLVM.so to avoid linkage
      errors. So, libMLIR.so requires LLVM_BUILD_LLVM_DYLIB=on
      
      FYI, Currently it appears that LLVM_LINK_LLVM_DYLIB is broken
      because mlir-tblgen is linked against libLLVM.so and
      and independent LLVM components
      
      (updated by Stephen Neuendorffer)
      
      Differential Revision: https://reviews.llvm.org/D73130
      1246e867
    • Stephen Neuendorffer's avatar
      [MLIR] Refactor handling of dialect libraries · 58695528
      Stephen Neuendorffer authored
      Instead of creating extra libraries we don't really need, collect a
      list of all dialects and use that instead.
      
      Differential Revision: https://reviews.llvm.org/D75221
      58695528
  32. Feb 19, 2020
  33. Feb 14, 2020
  34. Jan 25, 2020
Loading