[Mlir-commits] [mlir] [MLIR][AMDGPU] Add a wrapper for global LDS load intrinsics in AMDGPU (PR #133498)

Krzysztof Drewniak llvmlistbot at llvm.org
Tue Apr 1 16:42:30 PDT 2025


================
@@ -459,6 +461,29 @@ LogicalResult DPPOp::verify() {
   return success();
 }
 
+LogicalResult GlobalLoadLDSOp::verify() {
+  MemRefType srcType = cast<MemRefType>(getSrc().getType());
+  MemRefType dstType = cast<MemRefType>(getDst().getType());
+
+  if (!memref::isStaticShapeAndContiguousRowMajor(srcType) ||
+      !memref::isStaticShapeAndContiguousRowMajor(dstType))
+    return emitOpError(
+        "source and destination types must have static shape  and contiguous");
+
+  // Check $src and $dst element types are the same.
+  if (srcType.getElementType() != dstType.getElementType())
+    return emitOpError("source and destination element types must match");
+
+  // Check $src and $dst memory spaces.
+  auto srcAddrSpace = llvm::dyn_cast<IntegerAttr>(srcType.getMemorySpace());
----------------
krzysz00 wrote:

... Absolutely do *not* check for integer memory spaces here - they're deprecated.

I'll allow 0, 1, nullptr, or `#gpu.address_space<global>` here - and I think there's a utility for that.

Similarly, LDS is `#gpu.address_space<workgroup>` or maybe 3

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


More information about the Mlir-commits mailing list