This is an archive of the discontinued LLVM Phabricator instance.

[SLP][TTI] Refactoring of `getShuffleCost` `Args` to work like `getArithmeticInstrCost`
ClosedPublic

Authored by vporpo on Apr 21 2022, 2:19 PM.

Details

Summary

Before this patch Args was used to pass a broadcat's arguments by SLP.
This patch changes this. Args is now used for passing the operands of
the shuffle.

Diff Detail

Event Timeline

vporpo created this revision.Apr 21 2022, 2:19 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 21 2022, 2:19 PM
vporpo requested review of this revision.Apr 21 2022, 2:19 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 21 2022, 2:19 PM

I committed the new tests I had under rG091c2f953dd6, if you don't mind rebasing.

llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
2607

I think I would go for Args.size() > 0 && isa<LoadInst>(Args[0]). The second operand may be undef, but a broadcast is going to be coming from the first operand for any shuffle close to canonical.

vporpo marked an inline comment as done.Apr 26 2022, 8:51 AM
vporpo updated this revision to Diff 425235.Apr 26 2022, 8:52 AM

Rebased and addressed comment.

vporpo added inline comments.Apr 26 2022, 8:58 AM
llvm/test/Analysis/CostModel/AArch64/shuffle-load.ll
38–44

These look like big drops in cost. As far as I can tell ld1r does support broadcasting 16-bit float so it looks correct. @dmgreen could you confirm this?

dmgreen accepted this revision.Apr 26 2022, 10:21 AM

Thanks. LGTM

llvm/test/Analysis/CostModel/AArch64/shuffle-load.ll
38–44

Yeah that sounds OK to me. FP16 was added in Arm8.2-a, and before that the costs are sometimes a little funny, because the types are not legal. For a broadcast load a ld1r isnt affected by the type though (just the size), so it should be OK to treat them as cheap.

This revision is now accepted and ready to land.Apr 26 2022, 10:21 AM
This revision was landed with ongoing or failed builds.Apr 26 2022, 11:12 AM
This revision was automatically updated to reflect the committed changes.