[PATCH] D73437: [mlir][spirv] Convert linalg.generic for reduction to SPIR-V ops

Lei Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 26 14:36:44 PST 2020


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

This commit adds a pattern to lower linalg.generic for reduction
to spv.GroupNonUniform* ops. Right now this only supports integer
reduction on 1-D input memref. Shader entry point ABI is queried
to make sure that the input memref's shape matches the local
workgroup's invocation configuration. This makes sure that the
workload fits in one local workgroup so that we can leverage
SPIR-V group non-uniform operations.

linglg.generic is a structured op that preserves the right level
of information. It is easier to recognize reduction at this level
than performing analysis on loops.

This commit also exposes `getElementPtr` in SPIRVLowering.h given
that it's a generally useful utility function.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D73437

Files:
  mlir/include/mlir/Conversion/LinalgToSPIRV/LinalgToSPIRV.h
  mlir/include/mlir/Conversion/LinalgToSPIRV/LinalgToSPIRVPass.h
  mlir/include/mlir/Dialect/SPIRV/SPIRVAtomicOps.td
  mlir/include/mlir/Dialect/SPIRV/SPIRVLowering.h
  mlir/include/mlir/Dialect/SPIRV/TargetAndABI.h
  mlir/lib/Conversion/CMakeLists.txt
  mlir/lib/Conversion/LinalgToSPIRV/CMakeLists.txt
  mlir/lib/Conversion/LinalgToSPIRV/LinalgToSPIRV.cpp
  mlir/lib/Conversion/LinalgToSPIRV/LinalgToSPIRVPass.cpp
  mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.cpp
  mlir/lib/Dialect/SPIRV/SPIRVLowering.cpp
  mlir/lib/Dialect/SPIRV/TargetAndABI.cpp
  mlir/test/Conversion/LinalgToSPIRV/linalg-to-spirv.mlir
  mlir/tools/mlir-opt/CMakeLists.txt

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73437.240453.patch
Type: text/x-patch
Size: 30939 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200126/8bf2c61f/attachment.bin>


More information about the llvm-commits mailing list