[Question] Clarify UnPack vector size inference: “multiply then divide” looks like a round-trip #22363
Replies: 7 comments
-
|
@krzysz00 @hanhanW |
Beta Was this translation helpful? Give feedback.
-
|
I'm the author of those inferences. It's been some time since I touched the code. IIRC, Due to the upstream change, which is also reasonable to me, we have to provide additional sizes for a few more dimensions; the intention is to support scalable vectorization for unpack ops. It is a placeholder for dynamic value analysis. I.e., the redundancy exists when we talk about non-scalable vectorization. |
Beta Was this translation helpful? Give feedback.
-
|
|
Beta Was this translation helpful? Give feedback.
-
|
@hanhanW
Please let me know if I’ve misunderstood anything. |
Beta Was this translation helpful? Give feedback.
-
|
Most context is correct. I think your missing context is the gap of the sizes for tiling and vectorization. We use lowering config in tiling; they represent unpacked domain tile sizes, i.e., dest shape. There are two steps in vectorization:
|
Beta Was this translation helpful? Give feedback.
-
|
Thanks, that helps—I think I’m getting the picture. My understanding is:
Is that the right way to describe why we see the multiply→divide round trip? . |
Beta Was this translation helpful? Give feedback.
-
|
Yes, you are correct. Feel free to reach out if you have any other questions. :) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
In vector size inference for
linalg::UnPackOp,inferSizesFromIRmultiplies selected dims by inner tile sizes to reconstruct the write vector width, and thengetVectorInputSizesFromDestTilesdivides by the same tiles to derive the read vector sizes. While the intent seems to be “write width reconstruction → read width derivation,” the code reads as a multiply-then-divide round-trip and is hard to follow. I’d like to confirm the intent and propose clarity improvements.Affected Code
multiply (rebuild write vector):
https://github.com/iree-org/iree/blob/main/compiler/src/iree/compiler/Codegen/Utils/Utils.cpp#L1884-L1887
divide (derive read vector):
https://github.com/iree-org/iree/blob/main/compiler/src/iree/compiler/Codegen/Utils/Utils.cpp#L1843-L1846
Questions
Beta Was this translation helpful? Give feedback.
All reactions