[all-commits] [llvm/llvm-project] 6a69cf: [mlir][spirv] Add a generic `convert-to-spirv` pas...

Angel Zhang via All-commits all-commits at lists.llvm.org
Fri Jun 21 09:31:37 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6a69cfb607bafe2bfe75818cc6290af2565a3198
      https://github.com/llvm/llvm-project/commit/6a69cfb607bafe2bfe75818cc6290af2565a3198
  Author: Angel Zhang <angel.zhang at amd.com>
  Date:   2024-06-21 (Fri, 21 Jun 2024)

  Changed paths:
    A mlir/include/mlir/Conversion/ConvertToSPIRV/ConvertToSPIRVPass.h
    M mlir/include/mlir/Conversion/Passes.h
    M mlir/include/mlir/Conversion/Passes.td
    M mlir/lib/Conversion/CMakeLists.txt
    A mlir/lib/Conversion/ConvertToSPIRV/CMakeLists.txt
    A mlir/lib/Conversion/ConvertToSPIRV/ConvertToSPIRVPass.cpp
    A mlir/test/Conversion/ConvertToSPIRV/arith.mlir
    A mlir/test/Conversion/ConvertToSPIRV/combined.mlir
    A mlir/test/Conversion/ConvertToSPIRV/index.mlir
    A mlir/test/Conversion/ConvertToSPIRV/scf.mlir
    A mlir/test/Conversion/ConvertToSPIRV/simple.mlir
    A mlir/test/Conversion/ConvertToSPIRV/ub.mlir
    A mlir/test/Conversion/ConvertToSPIRV/vector.mlir

  Log Message:
  -----------
  [mlir][spirv] Add a generic `convert-to-spirv` pass (#95942)

This PR implements a MVP version of an MLIR lowering pipeline to SPIR-V.
The goal of adding this pipeline is to have a better test coverage of
SPIR-V compilation upstream, and enable writing simple kernels by hand.
The dialects supported in this version include `arith`, `vector` (only
1-D vectors with size 2,3,4,8 or 16), `scf`, `ub`, `index`, `func` and
`math`. New test cases for the pass are also included in this PR.

**Relevant links**

- [Open MLIR Meeting - YouTube
Video](https://www.youtube.com/watch?v=csWPOQfgLMo)
- [Discussion on LLVM
Forum](https://discourse.llvm.org/t/open-mlir-meeting-12-14-2023-discussion-on-improving-handling-of-unit-dimensions-in-the-vector-dialect/75683)

**Future plans**

- Add conversion patterns for other dialects, e.g. `gpu`, `tensor`, etc.
- Include vector transformation to unroll vectors to 1-D, and handle
those with unsupported sizes.
- Implement multiple-return. SPIR-V does not support multiple return
values since a `spirv.func` can only return zero or one values. It might
be possible to wrap the return values in a `spirv.struct`.
- Add a conversion for `scf.parallel`.



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