This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Cost slide in insertelement/extractelement as linear in LMUL
AbandonedPublic

Authored by reames on Aug 23 2023, 7:44 AM.

Details

Summary

We had been costing the slide as if it were fixed cost, regardless of LMUL. This results in significant under-costing of high LMUL inserts and extracts.

Note that the result of this patch is actually an over cost. After my recent D158460, we really should be using index when known to adjust the cost. I'm deferring that to a separate change as there's an analogous change to be made on the insertelement side first.

Diff Detail

Event Timeline

reames created this revision.Aug 23 2023, 7:44 AM
reames requested review of this revision.Aug 23 2023, 7:44 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 23 2023, 7:44 AM
luke accepted this revision.Aug 23 2023, 8:31 AM

LGTM

This revision is now accepted and ready to land.Aug 23 2023, 8:31 AM
reames planned changes to this revision.Aug 24 2023, 1:12 PM

Ran this against SPEC, and got some surprising results. This ends up basically disabling SLP. The reason is that SLP is relying on multiple rounds of vectorization to reach profitable final results, and the intermediate results involve lots of extracts. Increasing the extract costs - correctly - disables vectorization. The intermediate result is locally optimal, but global non-optimal.

Marking this as Plan Changes as a bunch of other work needs to happen before this can land.

reames abandoned this revision.Sep 18 2023, 5:41 PM