<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p><br>
</p>
<div class="moz-cite-prefix">On 8/13/19 4:24 AM, Florian Hahn via cfe-dev wrote:<br>
</div>
<blockquote type="cite" cite="mid:515D9001-42C1-4E2B-9D1A-EA33EBB7E8F7@apple.com">
Hi,<br class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On Aug 13, 2019, at 09:56, Sjoerd Meijer via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" class="" moz-do-not-send="true">cfe-dev@lists.llvm.org</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div style="font-style: normal; font-variant-caps: normal;
              font-weight: normal; letter-spacing: normal; text-align:
              start; text-indent: 0px; text-transform: none;
              white-space: normal; word-spacing: 0px;
              -webkit-text-stroke-width: 0px; text-decoration: none;
              font-family: Calibri, Arial, Helvetica, sans-serif;
              font-size: 12pt;" class="">
Hi,</div>
<div style="font-style: normal; font-variant-caps: normal;
              font-weight: normal; letter-spacing: normal; text-align:
              start; text-indent: 0px; text-transform: none;
              white-space: normal; word-spacing: 0px;
              -webkit-text-stroke-width: 0px; text-decoration: none;
              font-family: Calibri, Arial, Helvetica, sans-serif;
              font-size: 12pt;" class="">
<br class="">
</div>
<div style="font-style: normal; font-variant-caps: normal;
              font-weight: normal; letter-spacing: normal; text-align:
              start; text-indent: 0px; text-transform: none;
              white-space: normal; word-spacing: 0px;
              -webkit-text-stroke-width: 0px; text-decoration: none;
              font-family: Calibri, Arial, Helvetica, sans-serif;
              font-size: 12pt;" class="">
Sure, I won't mind fixing these other cases too while I am at it.<br class="">
</div>
<div style="font-style: normal; font-variant-caps: normal;
              font-weight: normal; letter-spacing: normal; text-align:
              start; text-indent: 0px; text-transform: none;
              white-space: normal; word-spacing: 0px;
              -webkit-text-stroke-width: 0px; text-decoration: none;
              font-family: Calibri, Arial, Helvetica, sans-serif;
              font-size: 12pt;" class="">
I think my only preference would be to make one functional change at a time (fix one pragma (option) at a time), because this has turned into a little project  on itself and dealing with issues would be easier, unless a big-bang change would be preferred in
 this case for some reason and then I will address them all in D65776.<span class="Apple-converted-space"> </span><br class="">
</div>
<div style="font-style: normal; font-variant-caps: normal;
              font-weight: normal; letter-spacing: normal; text-align:
              start; text-indent: 0px; text-transform: none;
              white-space: normal; word-spacing: 0px;
              -webkit-text-stroke-width: 0px; text-decoration: none;
              font-family: Calibri, Arial, Helvetica, sans-serif;
              font-size: 12pt;" class="">
<br class="">
</div>
</div>
</blockquote>
<div><br class="">
</div>
Addressing it on a patch-per-pragma sounds good, thanks for picking this up!</div>
<div><br class="">
</div>
<div>
<div class=""><br class="">
</div>
<blockquote type="cite" class="">
<div class="">
<div style="font-style: normal; font-variant-caps: normal;
              font-weight: normal; letter-spacing: normal; text-align:
              start; text-indent: 0px; text-transform: none;
              white-space: normal; word-spacing: 0px;
              -webkit-text-stroke-width: 0px; text-decoration: none;
              font-family: Calibri, Arial, Helvetica, sans-serif;
              font-size: 12pt;" class="">
I think one thing we haven't discussed yet is conflicting combinations like:</div>
<div style="font-style: normal; font-variant-caps: normal;
              font-weight: normal; letter-spacing: normal; text-align:
              start; text-indent: 0px; text-transform: none;
              white-space: normal; word-spacing: 0px;
              -webkit-text-stroke-width: 0px; text-decoration: none;
              font-family: Calibri, Arial, Helvetica, sans-serif;
              font-size: 12pt;" class="">
<br class="">
</div>
</div>
</blockquote>
<div><br class="">
</div>
<div>I think we should agree on something like the following as a general rule to deal with such cases: </div>
<div><br class="">
</div>
<div>More specific transformation pragmas (e.g. vector_width) imply the transformation is enabled, as if it was enabled via the corresponding explicit pragma (e.g. vectorize(enable)). If the transformation is explicitly disabled  (e.g. vectorize(disable)),
 that takes precedence over pragmas implicitly enabling it.</div>
<div><br class="">
</div>
<div>We should warn for obvious conflicts (like your second example), but we probably should not not put too much knowledge about the specific parameters into clang. </div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<blockquote type="cite" class="">
<div class="">
<div style="font-style: normal; font-variant-caps: normal;
              font-weight: normal; letter-spacing: normal; text-align:
              start; text-indent: 0px; text-transform: none;
              white-space: normal; word-spacing: 0px;
              -webkit-text-stroke-width: 0px; text-decoration: none;
              font-family: Calibri, Arial, Helvetica, sans-serif;
              font-size: 12pt;" class="">
    vectorize(enable) vectorize_width(1)</div>
</div>
</blockquote>
<div><br class="">
</div>
IMO we should enable the transformation and set vector_width=1 in the metadata. This might not make too much sense (it instructs LoopVectorize to only do interleaving), but I do not think it would be a good idea to add too much logic to validate parameter combinations
 to clang. We can always provide information via optimization remarks from the transforms.<br>
<br>
</div>
</blockquote>
<p><br>
</p>
<p>I agree. The fact that this construct enables interleaving is non-obvious, and that might not be ideal. We do have a separate pragma for that. Nevertheless, we should certainly handle the width = 1 case; in general, the width might be a dependent value (e.g.,
 a non-type template parameter).</p>
<p> -Hal<br>
</p>
<p><br>
</p>
<blockquote type="cite" cite="mid:515D9001-42C1-4E2B-9D1A-EA33EBB7E8F7@apple.com">
<div><br class="">
<blockquote type="cite" class="">
<div class="">
<div style="font-style: normal; font-variant-caps: normal;
              font-weight: normal; letter-spacing: normal; text-align:
              start; text-indent: 0px; text-transform: none;
              white-space: normal; word-spacing: 0px;
              -webkit-text-stroke-width: 0px; text-decoration: none;
              font-family: Calibri, Arial, Helvetica, sans-serif;
              font-size: 12pt;" class="">
<br class="">
</div>
<div style="font-style: normal; font-variant-caps: normal;
              font-weight: normal; letter-spacing: normal; text-align:
              start; text-indent: 0px; text-transform: none;
              white-space: normal; word-spacing: 0px;
              -webkit-text-stroke-width: 0px; text-decoration: none;
              font-family: Calibri, Arial, Helvetica, sans-serif;
              font-size: 12pt;" class="">
Should this enable of disable vectorisation? This is now important when an option implies setting the transformation.  I think it probably makes most sense that enabling/disabling the transformation should take precedence over setting the transformation options,
 and so in this example vectorisation should be enabled. With this logic, the predicate hint is ignored because vectorisation is disabled in this case:<br class="">
</div>
<div style="font-style: normal; font-variant-caps: normal;
              font-weight: normal; letter-spacing: normal; text-align:
              start; text-indent: 0px; text-transform: none;
              white-space: normal; word-spacing: 0px;
              -webkit-text-stroke-width: 0px; text-decoration: none;
              font-family: Calibri, Arial, Helvetica, sans-serif;
              font-size: 12pt;" class="">
<br class="">
</div>
<div style="font-style: normal; font-variant-caps: normal;
              font-weight: normal; letter-spacing: normal; text-align:
              start; text-indent: 0px; text-transform: none;
              white-space: normal; word-spacing: 0px;
              -webkit-text-stroke-width: 0px; text-decoration: none;
              font-family: Calibri, Arial, Helvetica, sans-serif;
              font-size: 12pt;" class="">
<span class="">    vectorize(disable) vectorize_predicate(enable)</span><br class="">
</div>
</div>
</blockquote>
<div><br class="">
</div>
IMO it makes sense for the more explicit pragma (vectorize(disable)) to take precedence over the one that implicitly enables vectorization. We should disable vectorization via metadata.</div>
<div><br class="">
</div>
<div><br class="">
</div>
<div>Cheers,</div>
<div>Florian</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
cfe-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a>
</pre>
</blockquote>
<pre class="moz-signature" cols="72">-- 
Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory</pre>
</body>
</html>