[Mlir-commits] [mlir] [mlir][memref][spirv] Add SPIR-V Image Lowering (PR #150978)
Jack Frankland
llvmlistbot at llvm.org
Tue Jul 29 06:34:41 PDT 2025
================
@@ -575,6 +575,83 @@ static Type convertMemrefType(const spirv::TargetEnv &targetEnv,
}
spirv::StorageClass storageClass = attr.getValue();
+ // Images are a special case since they are an opaque type from which elements
+ // may be accessed via image specific ops or directly through a texture
+ // pointer.
+ if (storageClass == spirv::StorageClass::Image) {
+ const int64_t rank = type.getRank();
+ if (rank < 1 || rank > 3) {
+ LLVM_DEBUG(llvm::dbgs()
+ << type << " illegal: cannot lower memref of rank " << rank
+ << " to a SPIR-V Image\n");
+ return nullptr;
+ }
+
+ const auto dim = [rank]() {
----------------
FranklandJack wrote:
Yeah agreed, again this is me trying to be clever. I've removed the macro but I've kept the anonymous lambda since it avoids and uninitialized variable and is actually less lines of code since we don't need all the break statements, hope this is an acceptable compromise :)
https://github.com/llvm/llvm-project/pull/150978
More information about the Mlir-commits
mailing list