[cfe-dev] Proposed changes to vectorize_width #pragma

David Sherwood via cfe-dev cfe-dev at lists.llvm.org
Tue Nov 24 01:04:17 PST 2020


Hi,

At the moment the vectorize_width(X) #pragma is used to provide hints to LLVM
about which vectorisation factor to use. The unsigned argument 'X' used to match
the NumElements property in the VectorType class, however VectorType is now
defined in terms of a ElementCount class.

I'd like to propose an extension to the vectorize_width #pragma that now takes
an optional second parameter of 'fixed' or 'scalable' that matches up with
ElementCount. When not specified the default value would be 'fixed'. A few
examples of how this would look like are shown below:


  // Vectorize the loop with <4 x eltty>

  #pragma clang loop vectorize_width(4)

  #pragma clang loop vectorize_width(4, fixed)



  // Vectorize the loop with <vscale x 4 x eltty>

  #pragma clang loop vectorize_width(4, scalable)

As a further extension I'd also like to permit vectorize_width(fixed|scalable) to
allow users to hint at the type of vector used without specifying the
vectorisation factor. Examples of this would be:


  // Vectorize the loop with <N x eltty> for a profitable N

  #pragma clang loop vectorize_width(fixed)



  // Vectorize the loop with <vscale x N x eltty> for a profitable N

  #pragma clang loop vectorize_width(scalable)

Any thoughts you have would be much appreciated!

Kind Regards,
David Sherwood.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20201124/da2ae975/attachment.html>


More information about the cfe-dev mailing list