================
@@ -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) {
----------------
asudarsa-qti wrote:
We have done considerable checking during the Sema phase. I suppose that is
sufficient?
https://github.com/llvm/llvm-project/pull/221328
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits