<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;
      charset=windows-1252">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 8/7/19 12:25 AM, Sjoerd Meijer via
      cfe-dev wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:VI1PR08MB3341D4A8796389887BF0BFCFFCD40@VI1PR08MB3341.eurprd08.prod.outlook.com">
      <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>
      <div style="font-family: Calibri, Arial, Helvetica, sans-serif;
        font-size: 12pt; color: rgb(0, 0, 0);">
        <span>We have recently added support for a new loop pragma
          'vectorize_predicate' [1].<br>
        </span>
        <div>During review of the LLVM part that does the actual
          transformation [2], the<br>
        </div>
        <div>question was raised if 'vectorize_predicate' should imply
          'vectorize(enable)'.<br>
        </div>
        <div>I agree that this is indeed what users would most likely
          expect and so I<br>
        </div>
        <div>created a patch for that [3].<br>
        </div>
        <div><br>
        </div>
        <div>During review of [3], Florian mentioned bug report [4]
          supporting the case that<br>
        </div>
        <div>users indeed expect that more specific pragmas such as e.g.
          vectorize_width(4)<br>
        </div>
        <div>should imply vectorize(enable), but this is currently not
          the case.  But our<br>
        </div>
        <div>docs for example mention: "The following example implicitly
          enables<br>
        </div>
        <div>vectorization and interleaving by specifying a vector width
          and interleaving<br>
        </div>
        <div>count", and so we have an inconsistency in the docs and
          implementation. But as<br>
        </div>
        <div>I have e.g. no clue what the behaviour could be of
          "vectorize(disable)<br>
        </div>
        <div>vectorize_predicate(enable)", I would say the docs are
          right and the<br>
        </div>
        <div>implementation is wrong.<br>
        </div>
        <div><br>
        </div>
        <div>Michael mentioned that the situation with for example loop
          unroll pragmas<br>
        </div>
        <div>'unroll(enable) unroll_count(4)' is not very different.
          Pragma 'unroll_count'<br>
        </div>
        <div>also does not set 'llvm.loop.unroll.enable', but it is
          handled by the<br>
        </div>
        <div>LoopUnroll pass itself and so we end up with checks like
          this:<br>
        </div>
        <div><br>
        </div>
        <div>    bool ExplicitUnroll = PragmaCount > 0 ||
          PragmaFullUnroll ||<br>
        </div>
        <div>                          PragmaEnableUnroll ||
          UserUnrollCount;<br>
        </div>
        <div><br>
        </div>
        <div>And again, this is very similar to 'vectorize_width', and
          we have different<br>
        </div>
        <div>checks to see if vectorization is enabled.<br>
        </div>
        <div><br>
        </div>
        <div>Because of the many inconsistencies, we came to the
          conclusion in [3] that we<br>
        </div>
        <div>don't know how know how to (best) implement that setting an
          transformation<br>
        </div>
        <div>option implies setting the transformation.<br>
        </div>
        <div><br>
        </div>
        <div>My proposal would be that the transformation options imply
          the transformations<br>
        </div>
        <div>by setting the enable flag of that transformation. Thus,
          vectorize options<br>
        </div>
        <div>vectorize_width, vectorize_predicate, etc., set
          vectorize(enable), and unroll<br>
        </div>
        <div>option unroll count set unroll(enable).<br>
        </div>
      </div>
    </blockquote>
    I second this.  The complexities of which pragmas enable which
    transforms should be handled entirely in Clang, with Clang
    responsible for emitting a consistent set of metadata flags to
    LLVM.  <br>
    <blockquote type="cite"
cite="mid:VI1PR08MB3341D4A8796389887BF0BFCFFCD40@VI1PR08MB3341.eurprd08.prod.outlook.com">
      <div style="font-family: Calibri, Arial, Helvetica, sans-serif;
        font-size: 12pt; color: rgb(0, 0, 0);">
        <div>
        </div>
        <div><br>
        </div>
        <div>Any thoughts on this welcome.<br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>[1] <a class="moz-txt-link-freetext" href="https://reviews.llvm.org/rL366989">https://reviews.llvm.org/rL366989</a><br>
        </div>
        <div>[2] <a class="moz-txt-link-freetext" href="https://reviews.llvm.org/D65197">https://reviews.llvm.org/D65197</a><br>
        </div>
        <div>[3] <a class="moz-txt-link-freetext" href="https://reviews.llvm.org/D65776">https://reviews.llvm.org/D65776</a><br>
        </div>
        <span>[4] <a href="https://bugs.llvm.org/show_bug.cgi?id=27643"
            id="LPlnk126071" moz-do-not-send="true">
            https://bugs.llvm.org/show_bug.cgi?id=27643</a></span><br>
      </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>
  </body>
</html>