[PATCH] D57779: [SLP] Add support for throttling.
Dinar Temirbulatov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 29 17:39:55 PDT 2021
dtemirbulatov marked 2 inline comments as done.
dtemirbulatov added inline comments.
================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:6680-6681
Changed = true;
- }
+ } else if (SLPThrottleBudget > 0 &&
+ R.getTreeCost(true, UserCost) < -SLPCostThreshold) {
+ R.vectorizeTree();
----------------
ABataev wrote:
> ABataev wrote:
> > Why `SLPThrottleBudget > 0`? What if `SLPThrottleBudget` equals 0?
> Why we can't do something like this:
> ```
> int NumAttempts = 0;
> do {
> if (R.isTreeTinyAndNotFullyVectorizable())
> break;
>
> R.computeMinimumValueSizes();
> InstructionCost Cost = R.getTreeCost();
> InstructionCost UserCost = 0;
> ....
> if (Cost < -SLPCostThreshold) {
> LLVM_DEBUG(dbgs() << "SLP: Vectorizing list at cost:" << Cost << ".\n");
> R.getORE()->emit(OptimizationRemark(SV_NAME, "VectorizedList",
> cast<Instruction>(Ops[0]))
> << "SLP vectorized with cost " << ore::NV("Cost", Cost)
> << " and with tree size "
> << ore::NV("TreeSize", R.getTreeSize()));
>
> R.vectorizeTree();
> // Move to the next bundle.
> I += VF - 1;
> NextInst = I + 1;
> Changed = true;
> break;
> }
> ...
> /// Do throttling here.
> ++NumAttempts;
> } while (NumAttempts < SLPThrottleBudget);
> ```
We are doing partial vectorization and we have to know UserCost to make the correct partial tree cut.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D57779/new/
https://reviews.llvm.org/D57779
More information about the llvm-commits
mailing list