[PATCH] D89031: [SVE] Add support to vectorize_width loop pragma for scalable vectors

Sjoerd Meijer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 16 02:08:44 PST 2020


SjoerdMeijer added a comment.

> This approach should be fully complementary to `vectorize_with` so that it would be possible to have:
>
>   // Use scalable vectors, but leave it to the cost-model to choose the most efficient N in <vscale x N x eltty>.
>   // If the pragma is not specified, it defaults to vectorize_style(fixed).
>   #pragma clang loop vectorize_style(scalable)
>   
>   // Use <4 x eltty>
>   #pragma clang loop vectorize_width(4, fixed)
>   
>   // Use <vscale x 4 x eltty>
>   #pragma clang loop vectorize_width(4, scalable)
>   
>   // If vectorize_style(scalable) is specified, then use <vscale x 4 x eltty>, otherwise <4 x eltty>
>   #pragma clang loop vectorize_width(4)                           // uses <4 x eltty>
>   #pragma clang loop vectorize_width(4) vectorize_style(scalable) // uses <vscale x 4 x eltty>
>   
>   // Conflicting options, clang should print diagnostic and error or ignore the hint.
>   #pragma clang loop vectorize_width(4, fixed) vectorize_style(scalable)
>
> I hope that gives a bit more context.

Ok, thanks for clarifying that!

If:

  // Use <vscale x 4 x eltty>
  #pragma clang loop vectorize_width(4, scalable)

is equivalent to:

  // uses <vscale x 4 x eltty>
  #pragma clang loop vectorize_width(4) vectorize_style(scalable)

then I think that illustrates that I don't see the point of extending `vectorize_width` because we still can't express scalable vectorisation for:

  // <VF x eltty>
  #pragma clang loop vectorize_predicate(enable)

and also for `interleave_count(4)`?

Again, when the idea is to have vectorize_style anyway, wouldn't it be easier not to bother extending vectorize_width and just go for vectorize_style? It allows you to specify fixed/scalable vectorisation in one way, and avoids having conflicting options.

The other thing I thought about: this is extending an existing user-facing pragma, and notifying the list would probably be best thing to do.


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

https://reviews.llvm.org/D89031



More information about the cfe-commits mailing list