This is an archive of the discontinued LLVM Phabricator instance.

[mlir][Vector][NFC] Small vector masking clean-up
ClosedPublic

Authored by dcaballe on Mar 31 2023, 12:46 PM.

Details

Summary

We stored static (int) and dynamic (Value) iteration space dims separately
and then merged them by creating constant ops for the static ones. This
merge happened multiple times during vectorization. This PR changes that
to perform the merge once and store in the state instead of the dynamic
values in isolation.

Diff Detail

Event Timeline

dcaballe created this revision.Mar 31 2023, 12:46 PM
Herald added a project: Restricted Project. · View Herald Transcript
dcaballe requested review of this revision.Mar 31 2023, 12:46 PM
dcaballe retitled this revision from [mlir][Vector] Small vector masking clean-up to [mlir][Vector][NFC] Small vector masking clean-up.Mar 31 2023, 12:49 PM
dcaballe added a reviewer: hanchung.
dcaballe updated this revision to Diff 510104.Mar 31 2023, 12:52 PM

Fix commit

Thanks for the clean-up, makes sense! Just a couple minor comments, otherwise LGTM!

mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
199–203

Why arith.constant_index rather than arith.constant?

Also, I see that you use the term "value sizes", but aren't these "(static and dynamic) dim sizes" instead? Probably just my limited understanding, but "Value" to me is an implementation detail (IIUC, "Value" in this context means "mlir::Value" corresponding to either arith.constant or tensor.dim Ops).

Naming is hard 😂 .

294–295

Forgot to update this comment?

dcaballe updated this revision to Diff 510596.Apr 3 2023, 1:47 PM
dcaballe marked 2 inline comments as done.

Address feedback

dcaballe added inline comments.Apr 3 2023, 1:49 PM
mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
199–203

Good catch! I thought we were also printing the ConstantIndex especialization as arith.constant_index. That's not the case. Fixed.

I'm remarking Value here because static dim sizes are also stored as int64_t elements by this class so this method is actually generating arith.constant ops for them (and tensor.dim for dynamic sizes).

ThomasRaoux accepted this revision.Apr 3 2023, 2:21 PM
This revision is now accepted and ready to land.Apr 3 2023, 2:21 PM
This revision was automatically updated to reflect the committed changes.