This is an archive of the discontinued LLVM Phabricator instance.

[WIP][RISCV][CostModel] Add cost model for shuffle
Needs ReviewPublic

Authored by luke957 on Oct 27 2021, 12:47 AM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

In order to make auto-vectorizer work efficiently, correct cost estimate(cost model) is needed. This patch is still a WIP, not only as all kinds of TTI::ShuffleKind need to be handled, but also for the related processes(eg. TargetLoweringBase::getTypeLegalizationCost()).

Diff Detail

Event Timeline

luke957 created this revision.Oct 27 2021, 12:47 AM
luke957 requested review of this revision.Oct 27 2021, 12:47 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 27 2021, 12:47 AM
craig.topper added inline comments.
llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
178

Should this consider LMUL? The ALU likely needs more cycles for LMUL 2 than LMUL 1.

llvm/test/Analysis/CostModel/RISCV/shuffle-broadcast.ll
1

Doesn’t this need -riscv-v-vector-bits-min?

luke957 added inline comments.Oct 27 2021, 4:09 AM
llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
178

Em, I have not much knowledge in this area. Is ALU(as well as cache, pipeline) described in the RISCV spec? Or the design of ALU-like moduls is target independent?

llvm/test/Analysis/CostModel/RISCV/shuffle-broadcast.ll
1

Oh yes, I'll fix this.