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

Igor Wodiany llvmlistbot at llvm.org
Tue Jul 29 02:21:35 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>(
----------------
IgWod-IMG wrote:

I think this should use the new builder API: https://discourse.llvm.org/t/psa-opty-create-now-with-100-more-tab-complete/87339. This should be a good example: https://github.com/llvm/llvm-project/pull/149929

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


More information about the Mlir-commits mailing list