<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        text-align:justify;
        font-size:10.5pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        text-align:justify;
        font-size:8.0pt;
        font-family:"Tahoma",sans-serif;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0in;
        margin-right:0in;
        margin-bottom:0in;
        margin-left:.5in;
        margin-bottom:.0001pt;
        text-align:justify;
        font-size:10.5pt;
        font-family:"Calibri",sans-serif;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma",sans-serif;}
p.msonormal00, li.msonormal00, div.msonormal00
        {mso-style-name:msonormal0;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
p.msochpdefault, li.msochpdefault, div.msochpdefault
        {mso-style-name:msochpdefault;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:10.0pt;
        font-family:"Times New Roman",serif;}
span.balloontextchar0
        {mso-style-name:balloontextchar;
        font-family:"Tahoma",sans-serif;}
span.emailstyle20
        {mso-style-name:emailstyle20;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.emailstyle21
        {mso-style-name:emailstyle21;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.emailstyle22
        {mso-style-name:emailstyle22;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
span.emailstyle23
        {mso-style-name:emailstyle23;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.EmailStyle28
        {mso-style-type:personal;
        font-family:"Tahoma",sans-serif;
        color:black;}
span.EmailStyle29
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:1239442188;
        mso-list-type:hybrid;
        mso-list-template-ids:-1998019238 755557296 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l0:level1
        {mso-level-start-at:18;
        mso-level-number-format:bullet;
        mso-level-text:\F0D8;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;
        mso-fareast-font-family:Calibri;
        mso-bidi-font-family:Tahoma;
        color:black;}
@list l0:level2
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:"Courier New";}
@list l0:level3
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Wingdings;}
@list l0:level4
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Symbol;}
@list l0:level5
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:"Courier New";}
@list l0:level6
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Wingdings;}
@list l0:level7
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Symbol;}
@list l0:level8
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:"Courier New";}
@list l0:level9
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Wingdings;}
@list l1
        {mso-list-id:1965386184;
        mso-list-type:hybrid;
        mso-list-template-ids:1459234750 1678695096 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l1:level1
        {mso-level-start-at:18;
        mso-level-number-format:bullet;
        mso-level-text:\F0D8;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Wingdings;
        mso-fareast-font-family:Calibri;
        mso-bidi-font-family:"Times New Roman";}
@list l1:level2
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:"Courier New";}
@list l1:level3
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Wingdings;}
@list l1:level4
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Symbol;}
@list l1:level5
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:"Courier New";}
@list l1:level6
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Wingdings;}
@list l1:level7
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Symbol;}
@list l1:level8
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:"Courier New";}
@list l1:level9
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Wingdings;}
@list l2
        {mso-list-id:2083869906;
        mso-list-type:hybrid;
        mso-list-template-ids:1980117868 1716407186 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l2:level1
        {mso-level-start-at:18;
        mso-level-number-format:bullet;
        mso-level-text:\F0D8;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Wingdings;
        mso-fareast-font-family:Calibri;
        mso-bidi-font-family:"Times New Roman";}
@list l2:level2
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:"Courier New";}
@list l2:level3
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Wingdings;}
@list l2:level4
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Symbol;}
@list l2:level5
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:"Courier New";}
@list l2:level6
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Wingdings;}
@list l2:level7
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Symbol;}
@list l2:level8
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:"Courier New";}
@list l2:level9
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Wingdings;}
ol
        {margin-bottom:0in;}
ul
        {margin-bottom:0in;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt'>Hi Ehsan,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'>> </span><span style='font-size:10.0pt;font-family:"Tahoma",sans-serif;color:black'>If we see these kind of copies frequently enough, do you think it is worthwhile to work on the algorithm, so these instructions are predicted and taken into account during the scheduling?<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'>if you do see them frequently, then it would be worthwhile to find a way to eliminate them. I’m not sure how easy it would be to predict them though when the MII is computed.  My guess is that you want some solution where the generated schedule doesn’t require the extra copies. Without some more information, it’s hard to see why the algorithm is generating a schedule that requires extra copies so frequently.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'><o:p> </o:p></span></p><p class=MsoNormal align=left style='text-align:left'><span style='font-size:11.0pt'>> </span><span style='font-size:10.0pt;font-family:"Tahoma",sans-serif;color:black'>Or maybe we already do this and I am not aware of it?<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'>In some cases, the pipeliner does attempt to eliminate unnecessary copies.  For Hexagon, or any machine that allows multiple instructions per cycle, the pipeliner attempts to order the generated instructions to minimize copies. For example, Hexagon allows up to 4 instructions to execute “in parallel”.  So, in the same cycle, there can be a use of a register and a definition of that same register (the uses are read first, then the definition occurs). In effect, the use is for the value generated in the previous iteration. Since the pipeliner generates a linear list of instructions (i.e., serial semantics), the final order needs to make sure that the use is generated before the definition. Otherwise, an extra copy is generated.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'><o:p> </o:p></span></p><p class=MsoNormal align=left style='text-align:left'><span style='font-size:11.0pt'>> </span><span style='font-size:10.0pt;font-family:"Tahoma",sans-serif;color:black'>IIUC, these kind of copies will be generated even if we implement SMS after register coalescing. Is this correct?<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'>That is correct.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma",sans-serif;color:black'>> you don’t see it frequently though. Is that correct?</span><span style='font-size:11.0pt'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'>Correct. For Hexagon, we don’t see the extra copies very frequently.  In your earlier example though, it would be interesting to see why the algorithm puts the definition prior to the last use.  If possible, its better to schedule the definition after the last use. Of course, in some cases, that may/may not generate an efficient schedule.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'>Thanks,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'>Brendon<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal align=left style='text-align:left'><b><span style='font-size:11.0pt'>From:</span></b><span style='font-size:11.0pt'> Ehsan Amiri [mailto:ehsan.amiri@huawei.com] <br><b>Sent:</b> Tuesday, June 27, 2017 7:57 AM<br><b>To:</b> Brendon Cahoon <bcahoon@codeaurora.org><br><b>Cc:</b> llvm-dev@lists.llvm.org<br><b>Subject:</b> RE: [llvm-dev] Some questions about software pipeline in LLVM 4.0.0<o:p></o:p></span></p></div></div><p class=MsoNormal align=left style='text-align:left'><o:p> </o:p></p><div><p class=MsoNormal align=left style='text-align:left'><span style='font-size:10.0pt;font-family:"Tahoma",sans-serif;color:black'>Hi Brendon <o:p></o:p></span></p><div><p class=MsoNormal align=left style='text-align:left'><span style='font-size:10.0pt;font-family:"Tahoma",sans-serif;color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal align=left style='text-align:left'><span style='font-size:10.0pt;font-family:"Tahoma",sans-serif;color:black'>Thanks for the answer. I completely agree with your comments. The main reason that I brought up this issue is the following: Inserting a COPY instruction that cannot be eliminated, means that the loop has an instruction that was not taken into account during modulo scheduling analysis. If we see these kind of copies frequently enough, do you think it is worthwhile to work on the algorithm, so these instructions are predicted and taken into account during the scheduling? Or maybe we already do this and I am not aware of it?<o:p></o:p></span></p></div><div><p class=MsoNormal align=left style='text-align:left'><span style='font-size:10.0pt;font-family:"Tahoma",sans-serif;color:black'><o:p> </o:p></span></p><p class=MsoNormal align=left style='text-align:left'><span style='font-size:10.0pt;font-family:"Tahoma",sans-serif;color:black'>Some other remarks/questions:<o:p></o:p></span></p><p class=MsoNormal align=left style='text-align:left'><span style='font-size:10.0pt;font-family:"Tahoma",sans-serif;color:black'><o:p> </o:p></span></p><p class=MsoNormal align=left style='text-align:left'><span style='font-size:10.0pt;font-family:"Tahoma",sans-serif;color:black'>IIUC, these kind of copies will be generated even if we implement SMS after register coalescing. Is this correct?<o:p></o:p></span></p><p class=MsoNormal align=left style='text-align:left'><span style='font-size:10.0pt;font-family:"Tahoma",sans-serif;color:black'><o:p> </o:p></span></p><p class=MsoNormal align=left style='text-align:left'><span style='font-size:10.0pt;font-family:"Tahoma",sans-serif;color:black'>For us, so far we have enabled machine pipeliner for our backend and we see these kind of copy generated frequently for our workloads. Some times multiple copies inserted in a relatively small loop. IIUC, you don’t see it frequently though. Is that correct?<o:p></o:p></span></p><p class=MsoNormal align=left style='text-align:left'><span style='font-size:10.0pt;font-family:"Tahoma",sans-serif;color:black'><o:p> </o:p></span></p><p class=MsoNormal align=left style='text-align:left'><span style='font-size:10.0pt;font-family:"Tahoma",sans-serif;color:black'>Thanks<o:p></o:p></span></p><p class=MsoNormal align=left style='text-align:left'><span style='font-size:10.0pt;font-family:"Tahoma",sans-serif;color:black'>Ehsan<o:p></o:p></span></p><p class=MsoNormal align=left style='text-align:left'><span style='font-size:10.0pt;font-family:"Tahoma",sans-serif;color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal align=left style='text-align:left'><span style='font-size:10.0pt;font-family:"Tahoma",sans-serif;color:black'><o:p> </o:p></span></p></div><div><div><div><div><p class=MsoNormal><span style='color:black'><o:p> </o:p></span></p></div></div></div></div></div></div></body></html>