[PATCH] D114528: [LV] Make sure VF doesn't exceed compile time known TC

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 13 02:15:48 PST 2021


fhahn added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:6085
+                         "exceeding the constant trip count: "
                       << ConstTripCount << "\n");
+    return ElementCount::getFixed(PowerOf2Floor(ConstTripCount));
----------------
fhahn wrote:
> ebrevnov wrote:
> > dmgreen wrote:
> > > fhahn wrote:
> > > > Shouldn't this be `PowerOf2Floor(ConstTripCount)`? 
> > > I think this is saying "the trip count is "ConstTripCount", so we are rounding that down to a power of 2 (left as an exercise to the reader)."
> > > 
> > > It may be better to be clearer about the values it will use though. Having what it thinks the original ConstTripCount printed somewhere does sound useful.
> > > I think this is saying "the trip count is "ConstTripCount", so we are rounding that down to a power of 2 (left as an exercise to the reader)."
> > While I agree this is valid interpretation I did mean to provide resulting value. So the printing PowerOf2Floor(ConstTripCount) here sounds reasonable to me. Do you think we should change wording?
> > 
> > > 
> > > It may be better to be clearer about the values it will use though. Having what it thinks the original ConstTripCount printed somewhere does sound useful.
> > It is printed out at the beginning of computeFeasibleMaxVF.
> > 
> > While I agree this is valid interpretation I did mean to provide resulting value. So the printing PowerOf2Floor(ConstTripCount) here sounds reasonable to me. Do you think we should change wording?
> 
> I think the wording is fine when printing `ClampedConstTripCount`. As you said, the original trip count is printed earlier. It could also be included in the message `(known trip count: ...)` or something similar, but I am not sure if it adds a lot of additional info.
IIUC there was some consensus to use `ClampedConstTripCount` in the message and maybe include `ConstTripCount` in addition to that. But it looks like the committed version has not been updated accordingly and just prints the `ConstTripCount`. Did I miss anything?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114528/new/

https://reviews.llvm.org/D114528



More information about the llvm-commits mailing list