This is an archive of the discontinued LLVM Phabricator instance.

[TTI] Add a hook for specifying per-target defaults for Interleaved Accesses
ClosedPublic

Authored by sbaranga on Aug 10 2015, 5:31 AM.

Details

Summary

This adds a hook to TTI which enables us to selectively turn on by default
interleaved access vectorization for targets on which we have have performed
the required benchmarking.

Diff Detail

Event Timeline

sbaranga updated this revision to Diff 31659.Aug 10 2015, 5:31 AM
sbaranga retitled this revision from to [TTI] Add a hook for specifying per-target defaults for Interleaved Accesses.
sbaranga updated this object.
sbaranga added a subscriber: llvm-commits.

Hi Silviu,

Do you plan to enable this for ARM/AArch64 soon?

lib/Transforms/Vectorize/LoopVectorize.cpp
3886

Why the use of getNumOccurrences?

Hi Silviu,

Do you plan to enable this for ARM/AArch64 soon?

Hi Renato,

I think we are very close. As far as I can see we only need a slight tuning of the cost model (increase the cost of insert/extract element for both backends).

Cheers,
Silviu

sbaranga added inline comments.Aug 10 2015, 6:07 AM
lib/Transforms/Vectorize/LoopVectorize.cpp
3886

We want to use EnableInterleavedMemAccess only when the user has specified this option on the command line, otherwise we want to use the target defaults.

As far as I can tell, we need to use getNumOccurences to do that.

rengolin added inline comments.Aug 10 2015, 6:10 AM
lib/Transforms/Vectorize/LoopVectorize.cpp
3886

But EnableInterleavedMemAccess is a boolean, so just using it as before should work, no?

if (EnableInterleavedMemAccesses ||
    TTI->enableInterleavedAccessVectorization())
  InterleaveInfo.analyzeInterleaving(Strides);
sbaranga added inline comments.Aug 10 2015, 6:15 AM
lib/Transforms/Vectorize/LoopVectorize.cpp
3886

I think the behaviour here is slightly different. With the above implementation you wouldn't be able to disable interleaved accesses for targets which have enabled it by default. On the other hand, we could when using getNumOccurences.

rengolin added inline comments.Aug 10 2015, 6:26 AM
lib/Transforms/Vectorize/LoopVectorize.cpp
3886

So, setting -no-enable-interleaved-mem-accesses would make that count to zero?

sbaranga added inline comments.Aug 10 2015, 6:47 AM
lib/Transforms/Vectorize/LoopVectorize.cpp
3886

Should -no-enable-interleaved-mem-accesses work?

I thought it was -enable-interleaved-mem-accesses=false, in which case the counter is 1 (and UseInterleaved is false).
And if we don't pass it in the counter is 0 and UseInterleaved is the target default.

rengolin accepted this revision.Aug 10 2015, 6:53 AM
rengolin added a reviewer: rengolin.
rengolin added inline comments.
lib/Transforms/Vectorize/LoopVectorize.cpp
3886

Right, makes sense.

This revision is now accepted and ready to land.Aug 10 2015, 6:53 AM
sbaranga closed this revision.Aug 10 2015, 7:51 AM

Thanks, r244449