[PATCH] D144491: [VPlan] Use isUniformAfterVec in VPReplicateRecipe::execute.
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 19 10:11:46 PDT 2023
fhahn marked 5 inline comments as done.
fhahn added inline comments.
================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:9609
- // A store of a loop varying value to a loop invariant address only
- // needs only the last copy of the store.
- if (isa<StoreInst>(UI) && !getOperand(1)->hasDefiningRecipe()) {
+ // A store of a loop varying value to a uniform address only needs only the
+ // last copy of the store.
----------------
Ayal wrote:
> Ayal wrote:
> > only needs a single only...
>
Fixed, thanks!
================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:9612
+ if (isa<StoreInst>(UI) &&
+ vputils::isUniformAfterVectorization(getOperand(1))) {
auto Lane = VPLane::getLastLaneForVF(State.VF);
----------------
Ayal wrote:
> Ayal wrote:
> > Ayal wrote:
> > > This is a bit fragile considering that isUniformAfterVectorization() in general also represents lane-varying values whose first lane need only be used, as in vector stores - see `isUniformDecision `.
> > This patch is fine - effectively considering Replicate recipe invariants as "uniform addresses" in addition to current isLiveIns (aka !hasDefiningRecipe).
> >
> > Above comment (independent of this patch) refers to vputils which introduced "onlyFirstLaneUsed" to handle the "AfterVectorization" part, and its isUniformAfterVectorization() should be renamed isUniform(). In fact, it currently checks isInvariant(), i.e., same value across all loop iterations. This could be improved to "uniform" - same value across lanes (per part) as in D148841, and possibly also to same value across lanes*parts (per vectorized iteration) - but the latter refers to UF.
> Also, regarding isUniform - in addition to recipe-less LiveIns and uniform Replicate recipes, uniform values may also be provided by non-Replicate recipes placed in vec/pre-headers and by WidenGEP recipe (though broadcasted into a vector).
> Above comment (independent of this patch) refers to vputils which introduced "onlyFirstLaneUsed" to handle the "AfterVectorization" part, and its isUniformAfterVectorization() should be renamed isUniform(). In fact, it currently checks isInvariant(), i.e., same value across all loop iterations. This could be improved to "uniform" - same value across lanes (per part) as in D148841, and possibly also to same value across lanes*parts (per vectorized iteration) - but the latter refers to UF.
Let me do the renaming as follow-up. I think we shouldn't need any additional work to benefit from D148841 here; uniformity should be propagated to replicate recipes?
> Also, regarding isUniform - in addition to recipe-less LiveIns and uniform Replicate recipes, uniform values may also be provided by non-Replicate recipes placed in vec/pre-headers and by WidenGEP recipe (though broadcasted into a vector).
This will be addressed by fixing the TODO in `isDefinedOutsideVectorRegions`, will do as follow-up once I have a suitable test case.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D144491/new/
https://reviews.llvm.org/D144491
More information about the llvm-commits
mailing list