================
@@ -4573,6 +4569,90 @@ class ConstantMatrixType final : public MatrixType {
   }
 };
 
+/// Represents a cooperative matrix type.
+class CooperativeMatrixType final : public MatrixType {
+protected:
+  friend class ASTContext;
+
+  /// Number of rows and columns.
+  unsigned NumRows;
+  unsigned NumColumns;
+
+  /// Scope and use
+  unsigned Scope;
+  unsigned Use;
+
+  static constexpr unsigned MaxElementsPerDimension = (1 << 20) - 1;
+
+  CooperativeMatrixType(QualType MatrixElementType, unsigned Scope,
+                        unsigned NRows, unsigned NColumns, unsigned Use,
+                        QualType CanonElementType);
+
+  CooperativeMatrixType(TypeClass typeClass, QualType MatrixType,
+                        unsigned Scope, unsigned NRows, unsigned NColumns,
+                        unsigned Use, QualType CanonElementType);
+
+public:
+  /// Returns the number of rows in the matrix.
+  unsigned getNumRows() const { return NumRows; }
+
+  /// Returns the number of columns in the matrix.
+  unsigned getNumColumns() const { return NumColumns; }
+
+  /// Returns the scope of the matrix.
+  unsigned getScope() const { return Scope; }
+
+  /// Returns the use of the matrix.
+  unsigned getUse() const { return Use; }
+
+  /// Returns the number of elements required to embed the matrix into a 
vector.
+  unsigned getNumElementsFlattened() const {
+    return getNumRows() * getNumColumns();
+  }
+
+  /// Returns true if \p NumElements is a valid matrix dimension.
+  static constexpr bool isDimensionValid(size_t NumElements) {
+    return NumElements > 0 && NumElements <= MaxElementsPerDimension;
+  }
+
+  /// Return true if \p Scope is valid
+  static constexpr bool isScopeValid(size_t Scope) {
+    return Scope == 3 /* CLK_COOPERATIVE_MATRIX_SCOPE_SUBGROUP_QCOM */;
----------------
asudarsa-qti wrote:

Resolved in a later commit. Thanks

https://github.com/llvm/llvm-project/pull/213986
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to