<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Oct 10, 2016, at 2:50 PM, Hal Finkel <<a href="mailto:hfinkel@anl.gov" class="">hfinkel@anl.gov</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><br class="Apple-interchange-newline"><hr id="zwchr" style="font-family: arial, helvetica, sans-serif; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; border-left-width: 2px; border-left-style: solid; border-left-color: rgb(16, 16, 255); margin-left: 5px; padding-left: 5px; text-decoration: none; font-family: Helvetica, Arial, sans-serif; font-size: 12pt;" class=""><b class="">From:<span class="Apple-converted-space"> </span></b>"Dangeti Tharun kumar via llvm-dev" <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>><br class=""><b class="">To:<span class="Apple-converted-space"> </span></b><a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class=""><b class="">Cc:<span class="Apple-converted-space"> </span></b>"Santanu Das" <<a href="mailto:cs15mtech11018@iith.ac.in" class="">cs15mtech11018@iith.ac.in</a>><br class=""><b class="">Sent:<span class="Apple-converted-space"> </span></b>Sunday, October 9, 2016 12:09:01 PM<br class=""><b class="">Subject:<span class="Apple-converted-space"> </span></b>[llvm-dev] On Loop Distribution pass<br class=""><br class=""><div dir="ltr" class="">Dear community,<div class=""><br class=""></div><div class="">Our team at IITH have been experimenting with loop-distribution pass in LLVM. We see the following results on few benchmarks.</div><div class=""><br class=""></div><div class=""><span id="gmail-docs-internal-guid-e7e6be9a-aa54-3006-2059-effa9157d485" class=""><div style="margin: 0pt 0px; line-height: 1.38; text-indent: 36pt;" class=""><span style="font-size: 13.3333px; font-family: 'courier new'; vertical-align: baseline; white-space: pre-wrap; background-color: transparent;" class="">clang -O3 -mllvm -enable-loop-distribute -Rpass=loop-distribute file.c</span></div><div style="margin: 0pt 0px; line-height: 1.38; text-indent: 36pt;" class=""><span style="font-size: 13.3333px; font-family: 'courier new'; vertical-align: baseline; white-space: pre-wrap; background-color: transparent;" class=""><span style="font-size: 13.3333px; line-height: 18.4px;" class="">clang -O3 -mllvm -enable-loop-distribute -Rpass-analysis=loop-distribute file.c</span><br class=""></span></div><br class=""><br class=""><div style="margin: 0pt 0px; line-height: 1.38; text-indent: 36pt;" class=""><font face="monospace, monospace" class=""><a href="http://crd.lbl.gov/departments/computer-science/PAR/research/previous-projects/torch-testbed/" target="_blank" style="text-decoration: none;" class=""><span style="font-size: 16px; font-weight: 700; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap; background-color: transparent;" class="">TORCH</span></a><span style="font-size: 16px; font-weight: 700; vertical-align: baseline; white-space: pre-wrap; background-color: transparent;" class="">:</span></font></div><div style="margin: 0pt 0px 0pt 72pt; line-height: 1.38;" class=""><span style="font-size: 16px; vertical-align: baseline; white-space: pre-wrap; background-color: transparent;" class=""><font face="monospace, monospace" class="">There are nearly 488 loops in this benchmark. LLVM was not able to distribute any loop.</font></span></div><font face="monospace, monospace" class=""><br class=""></font><div style="margin: 0pt 0px; line-height: 1.38; text-indent: 36pt;" class=""><font face="monospace, monospace" class=""><a href="https://github.com/shantanuatiith/TSVC_" target="_blank" style="text-decoration: none;" class=""><span style="font-size: 16px; font-weight: 700; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap; background-color: transparent;" class="">TSVC</span></a><span style="font-size: 16px; font-weight: 700; vertical-align: baseline; white-space: pre-wrap; background-color: transparent;" class="">:</span></font></div><div style="margin: 0pt 0px 0pt 72pt; line-height: 1.38;" class=""><font face="monospace, monospace" class=""><span style="font-size: 16px; vertical-align: baseline; white-space: pre-wrap; background-color: transparent;" class="">There are 151 loops coded in plain ‘C’, </span><span style="font-size: 16px; font-weight: 700; vertical-align: baseline; white-space: pre-wrap; background-color: transparent;" class="">none</span><span style="font-size: 16px; vertical-align: baseline; white-space: pre-wrap; background-color: transparent;" class=""> of them got distributed. TSVC has particularly candidates valid for distribution like the one below. The inner loop in this example can be distributed.</span></font></div><font face="monospace, monospace" class=""><br class=""></font><div style="margin: 0pt 0px 0pt 36pt; line-height: 1.38; text-indent: 36pt;" class=""><span style="font-size: 13.3333px; vertical-align: baseline; white-space: pre-wrap; background-color: transparent;" class=""><font color="#444444" face="monospace, monospace" class="">for (int nl = 0; nl < ntimes/2; nl++) {</font></span></div><div style="margin: 0pt 0px 0pt 72pt; line-height: 1.38; text-indent: 36pt;" class=""><span style="font-size: 13.3333px; vertical-align: baseline; white-space: pre-wrap; background-color: transparent;" class=""><font color="#444444" face="monospace, monospace" class="">for (int i = 1; i < LEN; i++) {</font></span></div><div style="margin: 0pt 0px 0pt 108pt; line-height: 1.38; text-indent: 36pt;" class=""><span style="font-size: 13.3333px; vertical-align: baseline; white-space: pre-wrap; background-color: transparent;" class=""><font color="#444444" face="monospace, monospace" class="">a[i] += c[i] * d[i];</font></span></div><div style="margin: 0pt 0px 0pt 108pt; line-height: 1.38; text-indent: 36pt;" class=""><span style="font-size: 13.3333px; vertical-align: baseline; white-space: pre-wrap; background-color: transparent;" class=""><font color="#444444" face="monospace, monospace" class="">b[i] = b[i - 1] + a[i] + d[i];</font></span></div><div style="margin: 0pt 0px 0pt 72pt; line-height: 1.38; text-indent: 36pt;" class=""><span style="font-size: 13.3333px; vertical-align: baseline; white-space: pre-wrap; background-color: transparent;" class=""><font color="#444444" face="monospace, monospace" class="">}</font></span></div><div style="margin: 0pt 0px 0pt 72pt; line-height: 1.38; text-indent: 36pt;" class=""><span style="font-size: 13.3333px; vertical-align: baseline; white-space: pre-wrap; background-color: transparent;" class=""><font color="#444444" face="monospace, monospace" class="">dummy(a, b, c, d, e, aa, bb, cc, 0.);</font></span></div><div style="margin: 0pt 0px 0pt 36pt; line-height: 1.38; text-indent: 36pt;" class=""><span style="font-size: 13.3333px; vertical-align: baseline; white-space: pre-wrap; background-color: transparent;" class=""><font color="#444444" face="monospace, monospace" class=""> }</font></span></div><font face="monospace, monospace" class=""><br class=""></font><div style="margin: 0pt 0px; line-height: 1.38;" class=""><font face="monospace, monospace" class=""><span style="font-size: 16px; vertical-align: baseline; background-color: transparent;" class="">     <a href="http://vhosts.eecs.umich.edu/mibench//" target="_blank" style="font-weight: 700; white-space: pre-wrap; text-decoration: none;" class="">MiBench</a></span><span style="font-size: 16px; font-weight: 700; vertical-align: baseline; white-space: pre-wrap; background-color: transparent;" class="">:</span></font></div><div style="margin: 0pt 0px 0pt 72pt; line-height: 1.38;" class=""><span style="font-size: 16px; vertical-align: baseline; white-space: pre-wrap; background-color: transparent;" class=""><font face="monospace, monospace" class="">There are 6539 loops in MiBench. <b class="">None</b> of the loops were distributed by the loop-distribution pass of LLVM.</font></span></div><font face="monospace, monospace" class=""><br class=""></font><div style="margin: 0pt 0px; line-height: 1.38;" class=""><font face="monospace, monospace" class=""><span style="font-size: 16px; vertical-align: baseline; background-color: transparent;" class="">     <a href="https://github.com/exmatex/CoMD" target="_blank" style="font-weight: 700; white-space: pre-wrap; text-decoration: none;" class="">CoMD</a></span><span style="font-size: 16px; font-weight: 700; vertical-align: baseline; white-space: pre-wrap; background-color: transparent;" class="">:</span></font></div><div style="margin: 0pt 0px 0pt 72pt; line-height: 1.38;" class=""><span style="font-size: 16px; vertical-align: baseline; white-space: pre-wrap;" class=""><font face="monospace, monospace" class="">CoMD is a reference implementation of typical classical molecular dynamics algorithms and workloads.</font></span></div><div style="margin: 0pt 0px 0pt 72pt; line-height: 1.38;" class=""><font face="monospace, monospace" class=""><span style="font-size: 16px; vertical-align: baseline; white-space: pre-wrap;" class="">Out of 112 loops </span><span style="font-size: 16px; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;" class="">none</span><span style="font-size: 16px; vertical-align: baseline; white-space: pre-wrap;" class=""> of them are distributed.</span></font></div><div style="margin: 0pt 0px 0pt 72pt; line-height: 1.38;" class=""><span style="font-size: 16px; font-family: arial; vertical-align: baseline; white-space: pre-wrap;" class=""><br class=""></span></div><div style="margin: 0pt 0px 0pt 72pt; line-height: 1.38;" class=""><span style="font-size: 16px; font-family: arial; vertical-align: baseline; white-space: pre-wrap;" class=""><br class=""></span></div>For the specific loop I have shown above which is straight forward a good distribution candidate, the remark is "<b class="">loop not distributed: memory operations are safe for vectorization [-Rpass-analysis=loop-distribute]</b>". </span></div><div class=""><span class=""><br class=""></span></div><div class=""><span class="">Can someone reason these results and this remark?</span></div><div class=""><span id="DWT390" class=""><br class=""></span></div></div></blockquote><span style="font-family: arial, helvetica, sans-serif; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">The current loop distribution implementation is focused on enabling vectorization. The comment at the top of the file says:</span><br style="font-family: arial, helvetica, sans-serif; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: arial, helvetica, sans-serif; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: arial, helvetica, sans-serif; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">  // This file implements the Loop Distribution Pass.  Its main focus is to</span><br style="font-family: arial, helvetica, sans-serif; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: arial, helvetica, sans-serif; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">  // distribute loops that cannot be vectorized due to dependence cycles.  It</span><br style="font-family: arial, helvetica, sans-serif; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: arial, helvetica, sans-serif; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">  // tries to isolate the offending dependences into a new loop allowing</span><br style="font-family: arial, helvetica, sans-serif; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: arial, helvetica, sans-serif; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">  // vectorization of the remaining parts.</span><br style="font-family: arial, helvetica, sans-serif; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: arial, helvetica, sans-serif; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: arial, helvetica, sans-serif; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Hopefully, this helps explain the diagnostic. Regarding why the loop you highlight is not distributed to enable the vectorization of the a[i] update, I don't know. Adam?</span><br style="font-family: arial, helvetica, sans-serif; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></div></blockquote><div><br class=""></div><div>Yeah, it’s not immediate clear to me why we’re not distributing that.  I think it’s s221() from TSVC.  I will take a look later.</div><div><br class=""></div><div>Adam</div><br class=""><blockquote type="cite" class=""><div class=""><br style="font-family: arial, helvetica, sans-serif; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: arial, helvetica, sans-serif; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class=""> -Hal</span><br style="font-family: arial, helvetica, sans-serif; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span id="gmail-docs-internal-guid-e7e6be9a-aa54-3006-2059-effa9157d485" style="font-family: arial, helvetica, sans-serif; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></span><blockquote style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; border-left-width: 2px; border-left-style: solid; border-left-color: rgb(16, 16, 255); margin-left: 5px; padding-left: 5px; text-decoration: none; font-family: Helvetica, Arial, sans-serif; font-size: 12pt;" class=""><div dir="ltr" class=""><div class=""><span class=""><br class="">I humbly request the community to correct me, if am missing something in my analysis.</span><div class=""><br class=""></div>--<span class="Apple-converted-space"> </span><br class=""><div class="gmail_signature"><div dir="ltr" class=""><div class=""><div dir="ltr" class="">Thank you<div class="">D Tharun kumar</div><div class="">CS15MTECH11002</div><div class="">9948373970</div><div class="">CSE-IITH</div></div></div></div></div></div></div><br class="">_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class=""><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br class=""></blockquote><br style="font-family: arial, helvetica, sans-serif; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: arial, helvetica, sans-serif; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: arial, helvetica, sans-serif; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: arial, helvetica, sans-serif; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">--<span class="Apple-converted-space"> </span></span><br style="font-family: arial, helvetica, sans-serif; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div style="font-family: arial, helvetica, sans-serif; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span name="x" class=""></span>Hal Finkel<br class="">Lead, Compiler Technology and Programming Languages<br class="">Leadership Computing Facility<br class="">Argonne National Laboratory</div></div></blockquote></div><br class=""></body></html>