[Lldb-commits] [clang] [lldb] [llvm] [OpenCL][Clang] Add support for cooperative matrix extension (PR #221328)
Dmitry Sidorov via lldb-commits
lldb-commits at lists.llvm.org
Thu Sep 24 06:35:37 PDT 2026
================
@@ -4546,6 +4547,112 @@ 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,
+ unsigned NumColumns, unsigned Use,
+ QualType CanonicalType)
+ : Type(Type::CooperativeMatrix, CanonicalType,
+ ElementType->getDependence()),
+ ElementType(ElementType), NumRows(NumRows), NumColumns(NumColumns),
+ Scope(Scope), Use(Use) {}
+
+public:
+ /// Returns the element type.
+ QualType getElementType() const { return ElementType; }
+
+ /// Returns the number of rows.
+ unsigned getNumRows() const { return NumRows; }
+
+ /// Returns the number of columns.
+ unsigned getNumColumns() const { return NumColumns; }
+
+ /// Returns the cooperative matrix scope.
+ unsigned getScope() const { return Scope; }
+
+ /// Returns the cooperative matrix use.
+ unsigned getUse() const { return Use; }
+
+ /// Returns true if \p NumElements is a valid cooperative matrix dimension.
+ static constexpr bool isDimensionValid(size_t NumElements) {
----------------
MrSidims wrote:
+1 to remove the checks and MaxElementsPerDimension and getMaxElementsPerDimension.
https://github.com/llvm/llvm-project/pull/221328
More information about the lldb-commits
mailing list