This is part of the process to remove vector.insertelement/extractelement
from the Vector dialect.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
mlir/include/mlir/Dialect/Vector/IR/VectorOps.td | ||
---|---|---|
703 | Since your objective is to ultimately remove insertelement/extractelement, can you comment on the symmetry breaking property of this PR ? vector.insert can now insert either a scalar or a 0-d vector into a larger vector but vector.extract must extract a scalar and cannot extract a 0-d vector. I don't know yet how this plays in your full design but potential lack of symmetry between insert and extract ops has always been something to think about. Thoughts? |
mlir/include/mlir/Dialect/Vector/IR/VectorOps.td | ||
---|---|---|
703 | That's a good point! The main problem with vector.extract is that the extracted type is inferred from the source type, to the point that is not even represented in the assembly format of the instruction (e.g., vector.extract %0[3, 3, 3]: vector<4x8x16xf32>). We could change its assembly format but that would be a massive change so I would prefer not to go there unless it's strictly necessary. Perhaps we could restrict both vector.extract/insert to only scalars and use vector.broadcast, vector.shape_cast and other shape transforming ops to convert 0-D from/to scalars? |
mlir/test/Dialect/Vector/invalid.mlir | ||
---|---|---|
244 ↗ | (On Diff #530289) | Looks like the diagnostic in VectorOps.cpp is off? I think that it's this one: https://github.com/llvm/llvm-project/blob/678360fd9d8517a978c5f46364a56412d70e15c7/mlir/lib/Dialect/Vector/IR/VectorOps.cpp#L2324-L2326 |
Addressed feedback.
mlir/include/mlir/Dialect/Vector/IR/VectorOps.td | ||
---|---|---|
703 | Let's keep it as is right now and revisit if there is any problem. The broadcast/shape_cast approach described above seems reasonable to me so it's not that we won't be able to represent all the cases in one way or another. |
mlir/include/mlir/Dialect/Vector/IR/VectorOps.td | ||
---|---|---|
697–698 | Am I right to assume that support for values as $position shall come in a different patch? |
mlir/include/mlir/Dialect/Vector/IR/VectorOps.td | ||
---|---|---|
697–698 | Yes, I have that almost done :) |
Please, let me know if there are any other comments. Otherwise, this should be ready to go.
mlir/test/Dialect/Vector/invalid.mlir | ||
---|---|---|
244 ↗ | (On Diff #530289) | [nit] Could you add "expected"? For consistency with other diagnostics and also because that makes it easier for my brain to parse :) |
Am I right to assume that support for values as $position shall come in a different patch?