[PATCH] D77195: [mlir] Modify GPU to SPIR-V conversion to respect spv.interface_var_abi attributes if it exists already.
Mahesh Ravishankar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 31 23:58:04 PDT 2020
mravishankar created this revision.
Herald added subscribers: llvm-commits, grosul1, bader, Joonsoo, liufengdb, lucyrfox, mgester, arpith-jacob, csigg, nicolasvasilache, antiagainst, shauheen, burmako, jpienaar, rriddle, mehdi_amini.
Herald added a reviewer: antiagainst.
Herald added a reviewer: herhut.
Herald added a project: LLVM.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D77195
Files:
mlir/lib/Conversion/GPUToSPIRV/ConvertGPUToSPIRV.cpp
Index: mlir/lib/Conversion/GPUToSPIRV/ConvertGPUToSPIRV.cpp
===================================================================
--- mlir/lib/Conversion/GPUToSPIRV/ConvertGPUToSPIRV.cpp
+++ mlir/lib/Conversion/GPUToSPIRV/ConvertGPUToSPIRV.cpp
@@ -349,10 +349,18 @@
if (!gpu::GPUDialect::isKernel(funcOp))
return failure();
- // TODO(antiagainst): we are dictating the ABI by ourselves here; it should be
- // specified outside.
SmallVector<spirv::InterfaceVarABIAttr, 4> argABI;
for (auto argIndex : llvm::seq<unsigned>(0, funcOp.getNumArguments())) {
+ // If the ABI is already specified, use it.
+ auto abiAttr = funcOp.getArgAttrOfType<spirv::InterfaceVarABIAttr>(
+ argIndex, spirv::getInterfaceVarABIAttrName());
+ if (abiAttr) {
+ argABI.push_back(abiAttr);
+ continue;
+ }
+ // todo(ravishankarm): Use the "default ABI". Remove this in a follow up
+ // CL. Staging this to make this easy to revert in case of breakages out of
+ // tree.
Optional<spirv::StorageClass> sc;
if (funcOp.getArgument(argIndex).getType().isIntOrIndexOrFloat())
sc = spirv::StorageClass::StorageBuffer;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77195.254094.patch
Type: text/x-patch
Size: 1157 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200401/18ca9263/attachment.bin>
More information about the llvm-commits
mailing list