This is an archive of the discontinued LLVM Phabricator instance.

[LV] Respect max VF for interleaved accesses
ClosedPublic

Authored by mssimpso on May 13 2016, 8:48 AM.

Details

Summary

The selection of the vectorization factor currently doesn't consider interleaved accesses. The vectorization factor is based on the maximum safe dependence distance computed by LAA. However, for loops with interleaved groups, we should instead base the vectorization factor on the maximum safe dependence distance divided by the maximum interleave factor among all the interleaved groups. Interleaved accesses not in a group will be scalarized.

I have also added a flag to disable the store-load forwarding optimization in LAA. This is a performance optimization that should not affect correctness. The optimization must be disabled to expose the bug in the included test case. The addition of the flag would be committed in a separate patch.

Diff Detail

Event Timeline

mssimpso updated this revision to Diff 57198.May 13 2016, 8:48 AM
mssimpso retitled this revision from to [LV] Respect max VF for interleaved accesses.
mssimpso updated this object.
mssimpso added reviewers: anemet, sbaranga.
mssimpso added subscribers: mcrosier, llvm-commits.
mssimpso updated this revision to Diff 57209.May 13 2016, 10:12 AM

Fixed a typo in the test case comments.

anemet accepted this revision.May 13 2016, 4:51 PM
anemet edited edge metadata.

LGTM, thanks for starting to untangle this.

Some minor comments below.

lib/Analysis/LoopAccessAnalysis.cpp
70

I think that conflict detection is a better name.

1215–1218

Don't we want to also disable for the ATy != BTy case?

lib/Transforms/Vectorize/LoopVectorize.cpp
859

wow, what made you write this instead of unsigned ... = 1? ;)

5199–5202

I think that this needs a comment something along the line of the description in this review.

We may also want to mention that this is fairly conservative because the dependence distance may be between non-interleaved accesses, etc. (Hopefully this won't lead to any performance degradation.)

This revision is now accepted and ready to land.May 13 2016, 4:51 PM
mssimpso marked 2 inline comments as done.May 16 2016, 7:17 AM
mssimpso added inline comments.
lib/Analysis/LoopAccessAnalysis.cpp
1215–1218

Yes, thanks for catching that!

mssimpso marked 3 inline comments as done.May 16 2016, 8:02 AM

Thanks very much for the review, Adam!

This revision was automatically updated to reflect the committed changes.