[Mlir-commits] [mlir] [mlir][spirv] Make `CooperativeMatrixType` a `ShapedType` (PR #142784)

Igor Wodiany llvmlistbot at llvm.org
Mon Jun 9 06:25:31 PDT 2025


================
@@ -18,12 +18,21 @@ include "mlir/Dialect/SPIRV/IR/SPIRVBase.td"
 include "mlir/Interfaces/InferTypeOpInterface.td"
 include "mlir/Interfaces/SideEffectInterfaces.td"
 
+class SPIRV_SameCoopMatrix<string lhs, string rhs> : PredOpTrait<
+  "cooperative matrix types match",
+  CPred<"(::llvm::isa<::mlir::spirv::CooperativeMatrixType>($" # lhs # ".getType()) "
+        "&& ::llvm::isa<::mlir::spirv::CooperativeMatrixType>($" # rhs # ".getType()))"
+        "? $" # lhs # ".getType() == $" # rhs # ".getType() : true">
----------------
IgWod-IMG wrote:

I've changed it. I realised I can use `AllTypesMatch` without needing any extra traits, as this one doesn't treat `ShapedTypes` in any different way and just uses `getType()`:

```
class AllTypesMatch<list<string> names> :
    AllMatchSameOperatorTrait<names, "$_self.getType()", "type">;
```

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


More information about the Mlir-commits mailing list