This is an archive of the discontinued LLVM Phabricator instance.

[X86] `X86TTIImpl::getInterleavedMemoryOpCostAVX512()`: fallback to scalarization cost computation for mask
ClosedPublic

Authored by lebedev.ri on Oct 30 2021, 11:42 AM.

Details

Summary

I don't really buy that masked interleaved memory loads/stores are supported on X86.
There is zero costmodel test coverage, no actual cost modelling for the generation
of the mask repetition, and basically only two LV tests.
Additionally, i'm not very interested in AVX512.

I don't know if this really helps "soft" block over at
https://reviews.llvm.org/D111460#inline-1075467,
but i think it can't make things worse at least.

When we are being told that there is a masking, instead of
completely giving up and falling back to
fully scalarizing BasicTTIImplBase::getInterleavedMemoryOpCost(),
let's correctly query the cost of masked memory ops,
keep all the pretty shuffle cost modelling,
but scalarize the cost computation for the mask replication.

I think, not scalarizing the shuffles themselves
may adjust the computed costs a bit,
and maybe hopefully just enough to hide the "regressions"
at https://reviews.llvm.org/D111460#inline-1075467
I do mean hide, because the test coverage is non-existent.

Diff Detail

Event Timeline

lebedev.ri created this revision.Oct 30 2021, 11:42 AM
lebedev.ri requested review of this revision.Oct 30 2021, 11:42 AM

Rebased ontop of / incorporated changes from D112877.

lebedev.ri updated this revision to Diff 384430.Nov 3 2021, 7:37 AM

Costmodel test coverage added!

RKSimon accepted this revision.Nov 3 2021, 8:07 AM

LGTM - although its always annoying when a method ends up duplicating so much code from the base implementation :(

This revision is now accepted and ready to land.Nov 3 2021, 8:07 AM

LGTM - although its always annoying when a method ends up duplicating so much code from the base implementation :(

Thank you for speedy review!
Yes, this is not great. I think we could try to invent a new TTI callback for this.

This revision was landed with ongoing or failed builds.Nov 3 2021, 8:15 AM
This revision was automatically updated to reflect the committed changes.