[PATCH] D74226: [mlir][spirv] Introduce spv.function

Lei Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 7 08:45:50 PST 2020


antiagainst created this revision.
Herald added subscribers: llvm-commits, Joonsoo, liufengdb, aartbik, herhut, lucyrfox, mgester, arpith-jacob, csigg, nicolasvasilache, shauheen, burmako, jpienaar, rriddle, mehdi_amini, jfb.
Herald added a reviewer: mravishankar.
Herald added a reviewer: nicolasvasilache.
Herald added a project: LLVM.
antiagainst added a reviewer: denis13.

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.function 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.

The operation is explicitly named differently than func op to
avoid potential confusion and symbol collision.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74226

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74226.243180.patch
Type: text/x-patch
Size: 124761 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200207/4e99970d/attachment.bin>


More information about the llvm-commits mailing list