[Mlir-commits] [mlir] [mlir][xegpu] Add definitons of MatrixDescType and related ops. (PR #153273)
Jianhui Li
llvmlistbot at llvm.org
Thu Aug 14 17:49:25 PDT 2025
================
@@ -1101,4 +1101,150 @@ def XeGPU_ConvertLayoutOp: XeGPU_Op<"convert_layout", [Pure, AllTypesMatch<["sou
let hasCanonicalizer = 1;
}
+def isSharedPred : CPred<"isSharedMemory(llvm::cast<mlir::MemRefType>($_self))">;
+class StaticShared1DMemRefOf<list<Type> allowedTypes> :
+ ConfinedType<MemRefRankOf<allowedTypes, [1]>, [HasStaticShapePred, isSharedPred],
+ "statically shaped " # MemRefOf<allowedTypes>.summary # " for shared memory",
+ "mlir::MemRefType">;
+
+class SizeInBits<string name> :
+ StrFunc<"llvm::cast<mlir::ShapedType>($" # name # ".getType()).getNumElements()"
+ "*llvm::cast<mlir::ShapedType>($" # name # ".getType()).getElementTypeBitWidth()">;
+class AllMemSizesMatch<list<string> names> :
+ AllMatchSameOperatorTrait<names, SizeInBits<"_self">.result,
+ "size in bits">;
+
+def XeGPU_CreateMemDescOp: XeGPU_Op<"create_mem_desc", [Pure,
+ AllMemSizesMatch<["source", "mem_desc"]>]> {
+ let summary = "Create a matrix descriptor.";
+ let description = [{
+ Creates a matrix descriptor from a shared local memory (SLM) buffer.
+ The resulting matrix descriptor has to have the same size as the underlying
+ shared local memory.
----------------
Jianhui-Li wrote:
shared local memory => memory. The memory descriptor itself doesn't have to associated with share local memory.
https://github.com/llvm/llvm-project/pull/153273
More information about the Mlir-commits
mailing list