[clang] [lldb] [llvm] [OpenCL][Clang] Add support for cooperative matrix extension (PR #221328)

via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 8 13:53:48 PDT 2026


================
@@ -4582,6 +4583,123 @@ class ConstantMatrixType final : public MatrixType {
   }
 };
 
+/// Represents an opaque OpenCL cooperative matrix type.
+///
+/// Unlike MatrixType, a cooperative matrix is not an ordinary matrix value.
+/// It is an opaque, distributed object whose shape and role are part of its
+/// type identity.
+class CooperativeMatrixType final : public Type, public llvm::FoldingSetNode {
+protected:
+  friend class ASTContext;
+
+  /// Element type of the cooperative matrix.
+  QualType ElementType;
+
+  /// Number of rows and columns.
+  unsigned NumRows;
+  unsigned NumColumns;
+
+  /// Cooperative matrix scope and use.
+  unsigned Scope;
+  unsigned Use;
+
+  static constexpr unsigned MaxElementsPerDimension = (1 << 20) - 1;
+
+  CooperativeMatrixType(QualType ElementType, unsigned Scope, unsigned NumRows,
----------------
asudarsa-qti wrote:

@svenvh comment: Collapse these into one without TypeClass, as the class is final the second isn't being used.

Reply: Updated in recent commit. Thanks

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


More information about the cfe-commits mailing list