This is an archive of the discontinued LLVM Phabricator instance.

[LSV] Vectorize loads of vectors by turning it into a larger vector
ClosedPublic

Authored by bkramer on Jan 13 2022, 6:00 AM.

Details

Summary

Use shufflevector to do the subvector extracts. This allows a lot more
load merging on AMDGPU and also on NVPTX when <2 x half> is involved.

Diff Detail

Event Timeline

bkramer created this revision.Jan 13 2022, 6:00 AM
bkramer requested review of this revision.Jan 13 2022, 6:00 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 13 2022, 6:00 AM

Thanks, I completely forgot this didn't handle this

llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
1302

Too many spaces before In?

llvm/test/Transforms/LoadStoreVectorizer/NVPTX/4x2xhalf.ll
6

Should use named values in tests

34

Should add a larger variety of tests with more vector widths, particularly some 3 element vectors

bkramer updated this revision to Diff 399671.Jan 13 2022, 7:24 AM

Address review comments

bkramer marked 2 inline comments as done.Jan 13 2022, 7:24 AM
bkramer added inline comments.
llvm/test/Transforms/LoadStoreVectorizer/NVPTX/4x2xhalf.ll
34

Anything in particular you're looking for? Currently the pass also has the limitation of only creating vector sizes that are a power of 2, which means there is no interesting case for 3-element vectors.

arsenm added inline comments.Jan 19 2022, 6:55 AM
llvm/test/Transforms/LoadStoreVectorizer/NVPTX/4x2xhalf.ll
34

Not handling those is of interest itself?

Vectors of pointers are always an interesting source of edge cases

bkramer updated this revision to Diff 401227.Jan 19 2022, 7:08 AM

Add negative tests for non-pow2 vectors and vectors of pointers

bkramer added inline comments.Jan 19 2022, 7:09 AM
llvm/test/Transforms/LoadStoreVectorizer/NVPTX/4x2xhalf.ll
34

I don't think that's a particularly valuable test, but added some.

bkramer updated this revision to Diff 401229.Jan 19 2022, 7:12 AM

Adjust offset in test

arsenm accepted this revision.Jan 25 2022, 6:26 AM
arsenm added inline comments.
llvm/test/Transforms/LoadStoreVectorizer/NVPTX/4x2xhalf.ll
95–96

I would have expected this to vectorize

This revision is now accepted and ready to land.Jan 25 2022, 6:26 AM
bkramer added inline comments.Jan 26 2022, 2:40 AM
llvm/test/Transforms/LoadStoreVectorizer/NVPTX/4x2xhalf.ll
95–96

The pass explicitly disallows pointers of vectors. Shouldn't be hard to turn it on though, I guess it didn't really matter so far.