<div dir="ltr"><div>Thank You.</div><div><br></div><div>I am currently seeing how LLVM treats remainder loops. For eg with 63 loop iterations i get 3 v16i32 and 15 scalars. I want to use v8 and v4 for 15 remainder instructions. How to do this?</div><div><br></div><div>I am seeing LoopVectorize.cpp but unable to find the code lines that deal with remainder scalar loop iterations.<br></div><div><br></div><div>Please help..</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jul 24, 2018 at 10:54 PM, Friedman, Eli <span dir="ltr"><<a href="mailto:efriedma@codeaurora.org" target="_blank">efriedma@codeaurora.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    <div class="m_3600597296449420259moz-cite-prefix">There currently isn't any
      implementation of epilog loop vectorization (see
      <a class="m_3600597296449420259moz-txt-link-freetext" href="https://reviews.llvm.org/D30247" target="_blank">https://reviews.llvm.org/<wbr>D30247</a>, but it never got merged).<br>
      <br>
      In some cases you might get lucky with loop unrolling plus SLP
      vectorization.<br>
      <br>
      -Eli<div><div class="h5"><br>
      <br>
      On 7/24/2018 10:34 AM, hameeza ahmed wrote:<br>
    </div></div></div>
    <blockquote type="cite"><div><div class="h5">
      
      <div dir="ltr">
        <div>Hello, <br>
        </div>
        <div>I need help here. I am able to adjust the vector width
          through WidestRegister value. When number of iterations=31
          and  I set vector width=32 it gives <16xi32> and
          <8xi32> instructions.</div>
        <div><br>
        </div>
        <div>However if i replicate same behavior with number of
          iterations=63 and  I set vector width=64, no vector
          instructions are emitted. it should do as previous and gives
          <32xi32> and <16xi32> vector instructions.</div>
        <div><br>
        </div>
        <div>How to do this?</div>
        <div>What adjustments are needed?<br>
        </div>
        <div><br>
        </div>
        <div>Please help</div>
        <div><br>
        </div>
        <div>I m trying this but unable to solve.</div>
        <div><br>
        </div>
        <div>Thank You<br>
        </div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Tue, Jul 24, 2018 at 4:44 PM,
          hameeza ahmed <span dir="ltr"><<a href="mailto:hahmed2305@gmail.com" target="_blank">hahmed2305@gmail.com</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div dir="ltr">
              <div>Hello,</div>
              <div>Do i need to change following function;</div>
              <div><br>
              </div>
              <div>unsigned X86TTIImpl::getNumberOfRegiste<wbr>rs(bool
                Vector) {<br>
                  if (Vector && !ST->hasSSE1())<br>
                    return 0;<br>
                <br>
                  if (ST->is64Bit()) {<br>
                    if (Vector && ST->hasAVX512())<br>
                      return 32;<br>
                    return 16;<br>
                  }<br>
                  return 8;<br>
                }</div>
              <div><br>
              </div>
              <div>to <br>
              </div>
              <div><br>
              </div>
              <div>if (ST->is2048Bit()) {<br>
                    if (Vector && ST->hasAVX512())<br>
                      return 1024;<br>
                    return 512;<br>
                  }<br>
                  return 256;<br>
              </div>
              <div><br>
              </div>
              <div><br>
              </div>
              <div>please help...<br>
              </div>
            </div>
            <div class="m_3600597296449420259HOEnZb">
              <div class="m_3600597296449420259h5">
                <div class="gmail_extra"><br>
                  <div class="gmail_quote">On Tue, Jul 24, 2018 at 5:05
                    AM, hameeza ahmed <span dir="ltr"><<a href="mailto:hahmed2305@gmail.com" target="_blank">hahmed2305@gmail.com</a>></span>
                    wrote:<br>
                    <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                      <div dir="ltr">
                        <div>Thank You.</div>
                        <div>Right now to see the effect i did following
                          changes;</div>
                        <div><br>
                        </div>
                        <div>unsigned X86TTIImpl::getRegisterBitWidt<wbr>h(bool
                          Vector) {<br>
                            if (Vector) {<br>
                              if (ST->hasAVX512())<br>
                                return 65536;</div>
                        <div><br>
                        </div>
                        <div>here i changed 512 to 65536. Then in
                          loopvectorize.cpp i did following;</div>
                        <div><br>
                        </div>
                        <div> assert(MaxVectorSize <= 2048 &&
                          "Did not expect to pack so many elements"<br>
                                                        <wbr>  " into
                          one vector!");</div>
                        <div><br>
                        </div>
                        <div>changed 64 to 2048.</div>
                        <div><br>
                        </div>
                        <div>It runs fine. I can see in IR
                          <2048xi32> or <1024xi64> emission.</div>
                        <div><br>
                        </div>
                        <div>But I cannot see the vector mix like in
                          default knl if iterations=15 we see
                          1<8xi32> and rest scalar. so here when i
                          keep iteration=2047 i get all scalar why is
                          that so? similarly in polly as well i cant see
                          vector mixes like its happening for KNL it
                          emits <v16i32>,
                          <v8i32>,<v4i32>...so here it
                          should emit recursively like <v2048i32>
                          <v1024i32>
                          <v512i32>.....<v32i32></div>
                        <div><br>
                        </div>
                        <div>how to do this?</div>
                        <div><br>
                        </div>
                        <div>What am i missing here?</div>
                        <div>what further changes do i need to make?</div>
                        <div><br>
                        </div>
                        <div>Please help...<br>
                        </div>
                        <div><br>
                        </div>
                        <div><br>
                        </div>
                        <div><br>
                        </div>
                        <div><br>
                        </div>
                        <div><br>
                        </div>
                      </div>
                      <div class="m_3600597296449420259m_-4698488175367679473HOEnZb">
                        <div class="m_3600597296449420259m_-4698488175367679473h5">
                          <div class="gmail_extra"><br>
                            <div class="gmail_quote">On Tue, Jul 24,
                              2018 at 1:52 AM, Friedman, Eli <span dir="ltr"><<a href="mailto:efriedma@codeaurora.org" target="_blank">efriedma@codeaurora.org</a>></span>
                              wrote:<br>
                              <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>On
                                  7/23/2018 12:40 PM, hameeza ahmed
                                  wrote:<br>
                                  <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                                    Thank You. I got it. Version issue.<br>
                                    <br>
                                    TTI.getRegisterBitWidth(true)<br>
                                    <br>
                                    How to put my target machine info in
                                    TTI?<br>
                                  </blockquote>
                                  <br>
                                </span>
                                Each target has an implementation, e.g.
                                X86TTIImpl::getRegisterBitWidt<wbr>h.
                                <div class="m_3600597296449420259m_-4698488175367679473m_8841872642354152121HOEnZb">
                                  <div class="m_3600597296449420259m_-4698488175367679473m_8841872642354152121h5"><br>
                                    <br>
                                    -Eli<br>
                                    <br>
                                    -- <br>
                                    Employee of Qualcomm Innovation
                                    Center, Inc.<br>
                                    Qualcomm Innovation Center, Inc. is
                                    a member of Code Aurora Forum, a
                                    Linux Foundation Collaborative
                                    Project<br>
                                    <br>
                                  </div>
                                </div>
                              </blockquote>
                            </div>
                            <br>
                          </div>
                        </div>
                      </div>
                    </blockquote>
                  </div>
                  <br>
                </div>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </div></div></div><span class="HOEnZb"><font color="#888888">
      -- <br>
      You received this message because you are subscribed to the Google
      Groups "Polly Development" group.<br>
      To unsubscribe from this group and stop receiving emails from it,
      send an email to <a href="mailto:polly-dev+unsubscribe@googlegroups.com" target="_blank">polly-dev+unsubscribe@<wbr>googlegroups.com</a>.<br>
      For more options, visit <a href="https://groups.google.com/d/optout" target="_blank">https://groups.google.com/d/<wbr>optout</a>.<br>
    </font></span></blockquote><span class="">
    <p><br>
    </p>
    <pre class="m_3600597296449420259moz-signature" cols="72">-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project</pre>
  </span></div>

</blockquote></div><br></div>