[Mlir-commits] [mlir] [mlir][spirv]: Add ImageSsupport in ABI Lowering (PR #150996)

Jack Frankland llvmlistbot at llvm.org
Tue Jul 29 02:42:58 PDT 2025


================
@@ -58,7 +58,17 @@ createGlobalVarForEntryPointArgument(OpBuilder &builder, spirv::FuncOp funcOp,
         spirv::PointerType::get(spirv::StructType::get(varType), *storageClass);
   }
   auto varPtrType = cast<spirv::PointerType>(varType);
-  auto varPointeeType = cast<spirv::StructType>(varPtrType.getPointeeType());
+  Type pointeeType = varPtrType.getPointeeType();
+
+  // Images are an opaque type and so we can just return a pointer to an image.
+  // Note that currently only sampled images are supported in the SPIR-V
+  // lowering.
+  if (isa<spirv::SampledImageType>(pointeeType))
+    return builder.create<spirv::GlobalVariableOp>(
----------------
FranklandJack wrote:

Ah excellent point!

https://github.com/llvm/llvm-project/pull/150996


More information about the Mlir-commits mailing list