[Mlir-commits] [mlir] [mlir][Vector] Add support for 0-d shapes in extract-shape_cast folder (PR #116650)

Andrzej WarzyƄski llvmlistbot at llvm.org
Wed Nov 20 11:32:40 PST 2024


banach-space wrote:

> We can discuss on the RFC, but I think we need to have support for 0D vector. Without that the system doesnt seem to be closed. For example, tensor and memrefs allow 0D vectors, but having vectors being an outlier and not supporting 0D vector seems like a gap. 

Thank you for pointing this out! I think it would be helpful to provide concrete examples where avoiding `0D` vectors would lead to practical issues. That would clarify why maintaining consistency with memref and tensor is so critical in this case.

That said, I wonder if strict consistency across these types is always desirable. After all, the reason for having different types (e.g., tensor, memref, vector) is to capture distinct use cases and abstractions, right?

Personally, I see a different kind of inconsistency here. The ability to represent a scalar element in multiple ways (`f32` vs `vector<f32>` vs `vector<1xf32>`) introduces a lot of ambiguity. In my view, requiring `f32` instead of `vector<f32>` throughout the Vector dialect might simplify the system. This would reduce special-casing, avoid potential confusion, and ultimately improve the health and maintainability of the dialect.

I look forward to chatting more once the RFC is ready :)

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


More information about the Mlir-commits mailing list