[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
Wed Apr 1 09:53:42 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG9b31e595d717: [mlir] Modify GPU to SPIR-V conversion to respect spv.interface_var_abiā€¦ (authored by mravishankar).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77195/new/

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.254232.patch
Type: text/x-patch
Size: 1157 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200401/ff023fdf/attachment.bin>


More information about the llvm-commits mailing list