[PATCH] D131118: [LV] Add generic scalarization support for unpredicated scalable vectors

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 15 09:23:59 PDT 2022


reames added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:6870
+          // the generic replicate path which isn't yet implemented.
+          if (!foldTailByMasking())
+            return true;
----------------
david-arm wrote:
> I think you can avoid the scalarisation for SVE here simply by asking for the scalarisation cost of the instruction, similarly to how it's done elsewhere. For SVE this should return Invalid. Alternatively you could add a TTI hook to ask if target should scalarise or not, i.e.
> 
>   if (!foldTailByMasking())
>     return isLegalToScalarize();
> 
> We have always considered it 'illegal' to scalarise for SVE.
You seem to be missing the point of the code.

The costing here is done at two levels: TTI, and LV.  TTI returns invalid costs for a bunch of cases which LV then turns around and decides to scalarize by reasoning about the scalarization cost and scalar op cost directly.

Doing as you suggest here completely prevents the use of the added lowering.  

Adding a TTI hook is feasible, but I don't have a good name/semantic for it.  Any suggestions?  


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131118



More information about the llvm-commits mailing list