[Mlir-commits] [mlir] [mlir][Math] Fix 0-rank support for PolynomialApproximation (PR #114826)

Benjamin Maxwell llvmlistbot at llvm.org
Mon Nov 4 08:48:15 PST 2024


================
@@ -43,16 +43,16 @@ using namespace mlir::vector;
 struct VectorShape {
   ArrayRef<int64_t> sizes;
   ArrayRef<bool> scalableFlags;
-
-  bool empty() const { return sizes.empty(); }
+  bool scalar = true;
 };
 
 // Returns vector shape if the type is a vector. Returns an empty shape if it is
 // not a vector.
 static VectorShape vectorShape(Type type) {
   auto vectorType = dyn_cast<VectorType>(type);
   return vectorType
-             ? VectorShape{vectorType.getShape(), vectorType.getScalableDims()}
+             ? VectorShape{vectorType.getShape(), vectorType.getScalableDims(),
+                           /*scalar=*/false}
              : VectorShape{};
 }
----------------
MacDue wrote:

I do find `VectorShape` with `scalar` a little confusing (as there's now two empty shape cases). Maybe instead this could return `std::optional<VectorShape>` (and the helpers be updated to take that too)?

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


More information about the Mlir-commits mailing list