[PATCH] D101945: [LV] Add -scalable-vectorization=<option> flag.

Vineet Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 11 05:52:04 PDT 2021


vkmr added a comment.

Thanks @sdesmalen for the patch!
Just a couple of clarifying questions.
Also, all the non-target specific test cases only check for `-scalable-vectorization=on` and with metadata hint enabled (except for one that focuses on width hint). Just for the sake of completeness,  more tests with different values for the flag and its combination with the metadata hint would be nice to have.



================
Comment at: llvm/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h:108
+                      ///  fixed-width vectors when the cost is inconclusive.
+  };
+
----------------
The ordering of `SK_Enabled` and `SK_Preferred` feels non-intuitive. Is it because of the check:
```
case HK_SCALABLE:
    return (Val == SK_Disabled || Val == SK_Preferred);
```
that can only check `Val` to be 0 or 1?


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp:99
       Predicate("vectorize.predicate.enable", FK_Undefined, HK_PREDICATE),
-      Scalable("vectorize.scalable.enable", false, HK_SCALABLE), TheLoop(L),
-      ORE(ORE) {
+      Scalable("vectorize.scalable.enable", SK_Undefined, HK_SCALABLE),
+      TheLoop(L), ORE(ORE) {
----------------
sdesmalen wrote:
> CarolineConcatto wrote:
> > Can vectorize.scalable.enable have the same values as scalable-vectorization?
> > Which values should  LoopVectorizeHints::Hint::validate check?
> So first the variable `Scalable` is initialized with SK_Undefined.
> * Then it looks through the metadata to see if the front-end has set the value (which can only be 'disabled' or 'preferred', which is checked by LoopVectorizeHints::Hint::validate)
> * If it is not set by the metadata, then it will see if the flag is set to force scalable vectorization one way or another.
> * Otherwise, if it is set by the metadata, it can be overriden by the flag only if the value is 'disable'.
> 
> This means it is possible to disable scalable vectorization using a single flag. But otherwise, metadata (because it is more specific) takes precedence over the flag (which is more generic).
If I understand correctly, metadata hints take precedence over this flag unless the flag is set to `off`?
If this is the case and the default value of the flag (for now) is set to `SK_Disabled`, that means the metadata hints won't have an effect if the flag is not explicitly set to `on` or `preferred`, right?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101945



More information about the llvm-commits mailing list