[Mlir-commits] [mlir] 9b31e59 - [mlir] Modify GPU to SPIR-V conversion to respect

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Apr 1 09:35:22 PDT 2020


Author: MaheshRavishankar
Date: 2020-04-01T09:34:49-07:00
New Revision: 9b31e595d717f70f1a5d95542bb71e6f053439f0

URL: https://github.com/llvm/llvm-project/commit/9b31e595d717f70f1a5d95542bb71e6f053439f0
DIFF: https://github.com/llvm/llvm-project/commit/9b31e595d717f70f1a5d95542bb71e6f053439f0.diff

LOG: [mlir] Modify GPU to SPIR-V conversion to respect
spv.interface_var_abi attributes if it exists already.

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

Added: 
    

Modified: 
    mlir/lib/Conversion/GPUToSPIRV/ConvertGPUToSPIRV.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Conversion/GPUToSPIRV/ConvertGPUToSPIRV.cpp b/mlir/lib/Conversion/GPUToSPIRV/ConvertGPUToSPIRV.cpp
index 0a5408e4c8c8..5d380a2f3aa2 100644
--- a/mlir/lib/Conversion/GPUToSPIRV/ConvertGPUToSPIRV.cpp
+++ b/mlir/lib/Conversion/GPUToSPIRV/ConvertGPUToSPIRV.cpp
@@ -349,10 +349,18 @@ LogicalResult GPUFuncOpConversion::matchAndRewrite(
   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;


        


More information about the Mlir-commits mailing list