[PATCH] D98509: [LV] Calculate max feasible scalable VF.

Paul Walker via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 17 03:19:47 PDT 2021


paulwalker-arm added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:5826-5829
+  unsigned WidestRegister = ComputeScalableMaxVF
+                                ? TTI.getMaxScalableBitsPerBlock()
+                                : TTI.getRegisterBitWidth(true);
 
----------------
This doesn't look particularly clean to my eye.  I guess my immediate question is why `WidestRegister` is not a `TypeSize` given that would truly represent the size.

The same question can be asked of `getRegisterBitWidth` but perhaps that is a heavily used function?   If so then what about introducing an explicit `getVectorRegisterBitWidth` that returns TypeSize plus allowing it to take a parameter that specifies whether the query is against fixed or scalable vectors.

I can see why you're asking for `ScalableBitsPerBlock` because you want to make sure you're able to safely divide this by the largest element count, but here I think using `TypeSize.isKnownMultipleOf(SizeOfLargestElt)` makes that intent clearer for all vector types.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98509



More information about the llvm-commits mailing list