This is an archive of the discontinued LLVM Phabricator instance.

[mlir][vector] Clarify OOB semantics for `gather` and `scatter`
ClosedPublic

Authored by kuhar on Mar 10 2023, 12:24 PM.

Details

Summary

Reword the vector gather and scatter op description to make it
well-defined to have out-of-bounds indices when the corresponding mask
bits are false.

Update the code sample to avoid relying on C UB semantics to provide
informal semantics for vector.gather.

This change should be consistent with the existing interpretation of the
semantics in the codebase.

Issue: https://github.com/llvm/llvm-project/issues/60905

Diff Detail

Event Timeline

kuhar created this revision.Mar 10 2023, 12:24 PM
kuhar requested review of this revision.Mar 10 2023, 12:24 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 10 2023, 12:24 PM
kuhar edited the summary of this revision. (Show Details)Mar 10 2023, 12:28 PM
aartbik added inline comments.Mar 10 2023, 12:48 PM
mlir/include/mlir/Dialect/Vector/IR/VectorOps.td
1878

I would make it even stronger by adding.

If a mask bit is not set, the value comes from the pass_thru value regardless of whether the base addressing is out-of-bounds

1947

same, add the not set behavior

kuhar updated this revision to Diff 504263.Mar 10 2023, 12:55 PM
kuhar marked 2 inline comments as done.

Extra clarity

dcaballe accepted this revision.Mar 10 2023, 3:13 PM

Thanks for addressing this! Good discussion!

This revision is now accepted and ready to land.Mar 10 2023, 3:13 PM