[all-commits] [llvm/llvm-project] d3e781: [mlir][spirv] Introduce spv.func

Lei Zhang via All-commits all-commits at lists.llvm.org
Wed Feb 12 05:01:08 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: d3e7816d85460c75d3d49eeef91551215382974a
      https://github.com/llvm/llvm-project/commit/d3e7816d85460c75d3d49eeef91551215382974a
  Author: Lei Zhang <antiagainst at google.com>
  Date:   2020-02-12 (Wed, 12 Feb 2020)

  Changed paths:
    M mlir/include/mlir/Dialect/GPU/GPUOps.td
    M mlir/include/mlir/Dialect/SPIRV/SPIRVLowering.h
    M mlir/include/mlir/Dialect/SPIRV/SPIRVOps.h
    M mlir/include/mlir/Dialect/SPIRV/SPIRVOps.td
    M mlir/include/mlir/Dialect/SPIRV/SPIRVStructureOps.td
    M mlir/include/mlir/IR/Function.h
    M mlir/include/mlir/IR/FunctionSupport.h
    M mlir/lib/Conversion/GPUToSPIRV/ConvertGPUToSPIRV.cpp
    M mlir/lib/Conversion/GPUToSPIRV/ConvertGPUToSPIRVPass.cpp
    M mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRVPass.cpp
    M mlir/lib/Dialect/SPIRV/SPIRVDialect.cpp
    M mlir/lib/Dialect/SPIRV/SPIRVLowering.cpp
    M mlir/lib/Dialect/SPIRV/SPIRVOps.cpp
    M mlir/lib/Dialect/SPIRV/Serialization/Deserializer.cpp
    M mlir/lib/Dialect/SPIRV/Serialization/Serializer.cpp
    M mlir/lib/Dialect/SPIRV/Transforms/LowerABIAttributesPass.cpp
    M mlir/lib/IR/Function.cpp
    M mlir/test/Conversion/GPUToSPIRV/load-store.mlir
    M mlir/test/Conversion/GPUToSPIRV/simple.mlir
    M mlir/test/Conversion/LinalgToSPIRV/linalg-to-spirv.mlir
    M mlir/test/Conversion/StandardToSPIRV/std-to-spirv.mlir
    M mlir/test/Dialect/SPIRV/Serialization/arithmetic-ops.mlir
    M mlir/test/Dialect/SPIRV/Serialization/array.mlir
    M mlir/test/Dialect/SPIRV/Serialization/atomic-ops.mlir
    M mlir/test/Dialect/SPIRV/Serialization/barrier.mlir
    M mlir/test/Dialect/SPIRV/Serialization/bit-ops.mlir
    M mlir/test/Dialect/SPIRV/Serialization/cast-ops.mlir
    M mlir/test/Dialect/SPIRV/Serialization/composite-op.mlir
    M mlir/test/Dialect/SPIRV/Serialization/constant.mlir
    M mlir/test/Dialect/SPIRV/Serialization/entry-point.mlir
    M mlir/test/Dialect/SPIRV/Serialization/execution-mode.mlir
    M mlir/test/Dialect/SPIRV/Serialization/function-call.mlir
    M mlir/test/Dialect/SPIRV/Serialization/global-variable.mlir
    M mlir/test/Dialect/SPIRV/Serialization/glsl-ops.mlir
    M mlir/test/Dialect/SPIRV/Serialization/group-ops.mlir
    M mlir/test/Dialect/SPIRV/Serialization/logical-ops.mlir
    M mlir/test/Dialect/SPIRV/Serialization/loop.mlir
    M mlir/test/Dialect/SPIRV/Serialization/memory-ops.mlir
    M mlir/test/Dialect/SPIRV/Serialization/module.mlir
    M mlir/test/Dialect/SPIRV/Serialization/non-uniform-ops.mlir
    M mlir/test/Dialect/SPIRV/Serialization/phi.mlir
    M mlir/test/Dialect/SPIRV/Serialization/selection.mlir
    M mlir/test/Dialect/SPIRV/Serialization/spec-constant.mlir
    M mlir/test/Dialect/SPIRV/Serialization/struct.mlir
    M mlir/test/Dialect/SPIRV/Serialization/terminator.mlir
    M mlir/test/Dialect/SPIRV/Serialization/undef.mlir
    M mlir/test/Dialect/SPIRV/Transforms/abi-load-store.mlir
    M mlir/test/Dialect/SPIRV/Transforms/abi-simple.mlir
    M mlir/test/Dialect/SPIRV/Transforms/inlining.mlir
    M mlir/test/Dialect/SPIRV/Transforms/layout-decoration.mlir
    M mlir/test/Dialect/SPIRV/control-flow-ops.mlir
    M mlir/test/Dialect/SPIRV/ops.mlir
    M mlir/test/Dialect/SPIRV/structure-ops.mlir

  Log Message:
  -----------
  [mlir][spirv] Introduce spv.func

Thus far we have been using builtin func op to model SPIR-V functions.
It was because builtin func op used to have special treatment in
various parts of the core codebase (e.g., pass pipelines, etc.) and
it's easy to bootstrap the development of the SPIR-V dialect. But
nowadays with general op concepts and region support we don't have
such limitations and it's time to tighten the SPIR-V dialect for
completeness.

This commits introduces a spv.func op to properly model SPIR-V
functions. Compared to builtin func op, it can provide the following
benefits:

* We can control the full op so we can integrate SPIR-V information
  bits (e.g., function control) in a more integrated way and define
  our own assembly form and enforcing better verification.
* We can have a better dialect and library boundary. At the current
  moment only functions are modelled with an external op. With this
  change, all ops modelling SPIR-V concpets will be spv.* ops and
  registered to the SPIR-V dialect.
* We don't need to special-case func op anymore when creating
  ConversionTarget declaring SPIR-V dialect as legal. This is quite
  important given we'll see more and more conversions in the future.

In the process, bumps a few FuncOp methods to the FunctionLike trait.

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




More information about the All-commits mailing list