[Mlir-commits] [mlir] [mlir][Ptr] Add the `MemorySpaceAttrInterface` interface and dependencies. (PR #86870)

Tobias Gysi llvmlistbot at llvm.org
Mon Apr 1 01:24:10 PDT 2024


================
@@ -39,8 +39,77 @@ void PtrDialect::initialize() {
 // Pointer API.
 //===----------------------------------------------------------------------===//
 
+// Returns a pair containing:
+// The underlying type of a vector or the type itself if it's not a vector.
+// The number of elements in the vector or an error code if the type is not
+// supported.
+static std::pair<Type, int64_t> getVecOrScalarInfo(Type ty) {
+  if (auto vecTy = dyn_cast<VectorType>(ty)) {
+    auto elemTy = vecTy.getElementType();
+    // Vectors of rank greater than one or with scalable dimensions are not
+    // supported.
+    if (vecTy.getRank() != 1)
+      return {elemTy, -1};
----------------
gysit wrote:

nit: Can you introduce constants for these error codes instead of using integer literals? E.g. kMultiDimensionalVector or similar. 

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


More information about the Mlir-commits mailing list