Mindful of rfc-blackout-period, please don’t rush replying
Note, I am responding to 3 different threads below + provide a link to a patch implementing the experiment proposed here.
Ack, and thank you for clarifying. I now realize I misinterpreted the consensus, and your post helped clarify the discussion. Apologies for the confusion, and thank you for pointing this out!
To clarify:
- “Restricting the usage of 0D vectors” != “disallowing 0D vectors entirely”. My proposal is about the former, not the latter.
I also considered Kunwar’s counter-proposal, which also supports restricting (not ubiquitously allowing) 0D vectors:
Given all the “likes”, I was under the impression that there’s support for “restricting” the usage of 0-D Vectors. What am I missing here?
Absolutely.
To understand the impact, I propose “sealing” two specific Ops as part of an experiment. This would allow us to collect data points and refine the approach based on concrete results. It’s a lightweight experiment that can be easily reverted if necessary.
Could you elaborate on why this is necessary? From my perspective, supporting rank-0 Tensors and MemRefs at the boundary should suffice, and rank-0 Vectors may not be needed within the dialect. Internally, we control the Vector dialect’s implementation details.
Agreed, and that’s why I’ve sought feedback from other projects:
Feedback from Triton
(from @ThomasRaoux, emphasis by me):
right now triton doesn’t support 0d tensors. The IR can have single element 1d tensors or scalars. For cases where we do a reduction of a 1d tensor, the result would be a scalar. I can’t think of any useful usage of 0d tensors at the moment.
If you have access to Triton Slack, there’s a very short thread in #dev.
Feedback from onnx-mlir
I raised this topic in onnx-mlir/issues/3029, but the feedback there is not comprehensive enough to draw firm conclusions.
if anything, the confusion between scalar, 0-D vectors, or 1D vector with 1 element is tiresome
To gain more insight, I reviewed their codebase:
- There are a few references to “rank 0” tensors, but not many. See this search link.
- For example, their test/mlir/onnx/invalid.mlir includes a case showing that 0-D tensors are not supported universally.
Additionally, I posted in their Slack channel within the Linux Foundation AI and Data Workspace. I haven’t received a response yet.
Other projects
There’s one more project that I am aware of that targets Vector
directly:
It’s part of iree-turbine and IREE folks have already commented in this thread. Perhaps there’s someone specific we could reach out to?
Any other project that we should consider in this discussion?
Finally, here’s the actual experiment that I had in mind when posting this (sharing as an additional data point for the discussion):
As for next steps:
+1
Thank you for all your feedback so far
-Andrzej