<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div>One typo fixed inline<br>
</div>
<div dir="ltr">
<blockquote class="quotableTextTraining" style="border-color: rgb(200, 200, 200); border-left: 3px solid rgb(200, 200, 200); padding-left: 1ex; margin-left: 0.8ex; color: rgb(102, 102, 102);">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Thanks for bringing this up here. We have discussed this already on <a href="https://reviews.llvm.org/D89031" id="LPlnk844168">
https://reviews.llvm.org/D89031</a> and a bit offline, and it would be good to get some other opinions on this too.</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
What we achieve with this extension is that we can toggle fixed/scalable vectorisation. The proposal is to add this property to vectorize_width, because it kind of defines the VectorType which consists of the elementcount and the scalable/fixed part, which
 sounds reasonable. However, there are other loop pragmas that (implicitly) enable vectorisation:</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
#pragma clang loop interleave_count(some-number)</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
or</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
#pragma clang loop vectorize_predicate(enable)</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
for which you may want to toggle fixed|scalable vectorisation. If this is correct, then I think the current proposal/implementation is incomplete and/or inconsistent.</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
I think your own suggestion was to introduce a vectorization_style(enable|disable) at some point, </div>
</blockquote>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
I meant vectorization_style(fixed|scalable) <br>
</div>
<blockquote class="quotableTextTraining" style="border-color: rgb(200, 200, 200); border-left: 3px solid rgb(200, 200, 200); padding-left: 1ex; margin-left: 0.8ex; color: rgb(102, 102, 102);">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
but my proposal would be to use that instead of adjusting vectorize_width as that would address the issue incompleteness/inconsistency issue. Besides this, but more subjective, I don't see all the new combinations of vectorize_width() as making things clearer:<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
vectorize_width(VF)</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
vectorize_width(VF, fixed|scalable)<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
vectorize_width(fixed|scalable)<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Probably the implementation of adding vectorization_style(enable|disable) is easier and less contentious than adjusting an existing one, so all together I don't see why the approach of adjusting vectorize_wdith would be preferred. But I might be wrong, might
 be missing something, so welcome other views on this.<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Cheers,</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Sjoerd.<br>
</div>
</blockquote>
<div id="x_appendonsend"></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> cfe-dev <cfe-dev-bounces@lists.llvm.org> on behalf of David Sherwood via cfe-dev <cfe-dev@lists.llvm.org><br>
<b>Sent:</b> 24 November 2020 09:04<br>
<b>To:</b> cfe-dev@lists.llvm.org <cfe-dev@lists.llvm.org><br>
<b>Subject:</b> [cfe-dev] Proposed changes to vectorize_width #pragma</font>
<div> </div>
</div>
<div style="word-wrap:break-word" lang="EN-GB">
<div class="x_x_WordSection1">
<p class="x_x_MsoNormal" style="margin-top: 0px; margin-bottom: 0px;margin:0cm; font-size:11pt; font-family:"Calibri",sans-serif">
Hi,</p>
<p class="x_x_MsoNormal" style="margin-top: 0px; margin-bottom: 0px;margin:0cm; font-size:11pt; font-family:"Calibri",sans-serif">
 </p>
<p class="x_x_MsoNormal" style="margin-top: 0px; margin-bottom: 0px;margin:0cm; font-size:11pt; font-family:"Calibri",sans-serif">
At the moment the vectorize_width(X) #pragma is used to provide hints to LLVM</p>
<p class="x_x_MsoNormal" style="margin-top: 0px; margin-bottom: 0px;margin:0cm; font-size:11pt; font-family:"Calibri",sans-serif">
about which vectorisation factor to use. The unsigned argument ‘X’ used to match</p>
<p class="x_x_MsoNormal" style="margin-top: 0px; margin-bottom: 0px;margin:0cm; font-size:11pt; font-family:"Calibri",sans-serif">
the NumElements property in the VectorType class, however VectorType is now</p>
<p class="x_x_MsoNormal" style="margin-top: 0px; margin-bottom: 0px;margin:0cm; font-size:11pt; font-family:"Calibri",sans-serif">
defined in terms of a ElementCount class.</p>
<p class="x_x_MsoNormal" style="margin-top: 0px; margin-bottom: 0px;margin:0cm; font-size:11pt; font-family:"Calibri",sans-serif">
 </p>
<p class="x_x_MsoNormal" style="margin-top: 0px; margin-bottom: 0px;margin:0cm; font-size:11pt; font-family:"Calibri",sans-serif">
I’d like to propose an extension to the vectorize_width #pragma that now takes</p>
<p class="x_x_MsoNormal" style="margin-top: 0px; margin-bottom: 0px;margin:0cm; font-size:11pt; font-family:"Calibri",sans-serif">
an optional second parameter of ‘fixed’ or ‘scalable’ that matches up with</p>
<p class="x_x_MsoNormal" style="margin-top: 0px; margin-bottom: 0px;margin:0cm; font-size:11pt; font-family:"Calibri",sans-serif">
ElementCount. When not specified the default value would be ‘fixed’. A few</p>
<p class="x_x_MsoNormal" style="margin-top: 0px; margin-bottom: 0px;margin:0cm; font-size:11pt; font-family:"Calibri",sans-serif">
examples of how this would look like are shown below:</p>
<p class="x_x_MsoNormal" style="margin-top: 0px; margin-bottom: 0px;margin:0cm; font-size:11pt; font-family:"Calibri",sans-serif">
 </p>
<p class="x_x_MsoPlainText" style="margin-top: 0px; margin-bottom: 0px;margin:0cm; font-size:11pt; font-family:"Calibri",sans-serif">
  // Vectorize the loop with <4 x eltty></p>
<p class="x_x_MsoPlainText" style="margin-top: 0px; margin-bottom: 0px;margin:0cm; font-size:11pt; font-family:"Calibri",sans-serif">
  #pragma clang loop vectorize_width(4)</p>
<p class="x_x_MsoPlainText" style="margin-top: 0px; margin-bottom: 0px;margin:0cm; font-size:11pt; font-family:"Calibri",sans-serif">
  #pragma clang loop vectorize_width(4, fixed)</p>
<p class="x_x_MsoPlainText" style="margin-top: 0px; margin-bottom: 0px;margin:0cm; font-size:11pt; font-family:"Calibri",sans-serif">
 </p>
<p class="x_x_MsoPlainText" style="margin-top: 0px; margin-bottom: 0px;margin:0cm; font-size:11pt; font-family:"Calibri",sans-serif">
  // Vectorize the loop with <vscale x 4 x eltty></p>
<p class="x_x_MsoPlainText" style="margin-top: 0px; margin-bottom: 0px;margin:0cm; font-size:11pt; font-family:"Calibri",sans-serif">
  #pragma clang loop vectorize_width(4, scalable)</p>
<p class="x_x_MsoNormal" style="margin-top: 0px; margin-bottom: 0px;margin:0cm; font-size:11pt; font-family:"Calibri",sans-serif">
 </p>
<p class="x_x_MsoNormal" style="margin-top: 0px; margin-bottom: 0px;margin:0cm; font-size:11pt; font-family:"Calibri",sans-serif">
As a further extension I’d also like to permit vectorize_width(fixed|scalable) to</p>
<p class="x_x_MsoNormal" style="margin-top: 0px; margin-bottom: 0px;margin:0cm; font-size:11pt; font-family:"Calibri",sans-serif">
allow users to hint at the type of vector used without specifying the</p>
<p class="x_x_MsoNormal" style="margin-top: 0px; margin-bottom: 0px;margin:0cm; font-size:11pt; font-family:"Calibri",sans-serif">
vectorisation factor. Examples of this would be:</p>
<p class="x_x_MsoNormal" style="margin-top: 0px; margin-bottom: 0px;margin:0cm; font-size:11pt; font-family:"Calibri",sans-serif">
 </p>
<p class="x_x_MsoPlainText" style="margin-top: 0px; margin-bottom: 0px;margin:0cm; font-size:11pt; font-family:"Calibri",sans-serif">
  // Vectorize the loop with <N x eltty> for a profitable N</p>
<p class="x_x_MsoPlainText" style="margin-top: 0px; margin-bottom: 0px;margin:0cm; font-size:11pt; font-family:"Calibri",sans-serif">
  #pragma clang loop vectorize_width(fixed)</p>
<p class="x_x_MsoPlainText" style="margin-top: 0px; margin-bottom: 0px;margin:0cm; font-size:11pt; font-family:"Calibri",sans-serif">
 </p>
<p class="x_x_MsoPlainText" style="margin-top: 0px; margin-bottom: 0px;margin:0cm; font-size:11pt; font-family:"Calibri",sans-serif">
  // Vectorize the loop with <vscale x N x eltty> for a profitable N</p>
<p class="x_x_MsoPlainText" style="margin-top: 0px; margin-bottom: 0px;margin:0cm; font-size:11pt; font-family:"Calibri",sans-serif">
  #pragma clang loop vectorize_width(scalable)</p>
<p class="x_x_MsoNormal" style="margin-top: 0px; margin-bottom: 0px;margin:0cm; font-size:11pt; font-family:"Calibri",sans-serif">
 </p>
<p class="x_x_MsoNormal" style="margin-top: 0px; margin-bottom: 0px;margin:0cm; font-size:11pt; font-family:"Calibri",sans-serif">
Any thoughts you have would be much appreciated!</p>
<p class="x_x_MsoNormal" style="margin-top: 0px; margin-bottom: 0px;margin:0cm; font-size:11pt; font-family:"Calibri",sans-serif">
 </p>
<p class="x_x_MsoNormal" style="margin-top: 0px; margin-bottom: 0px;margin:0cm; font-size:11pt; font-family:"Calibri",sans-serif">
Kind Regards,</p>
<p class="x_x_MsoNormal" style="margin-top: 0px; margin-bottom: 0px;margin:0cm; font-size:11pt; font-family:"Calibri",sans-serif">
David Sherwood.</p>
</div>
</div>
</div>
</body>
</html>