<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=""><div class="">- ScheduleDAGInstr is a structure used by the PostMachineScheduler and PostRASchedulerList, so that is fine</div><div class="">- I am not sure I understand your exact goals here. But it sounds like you may either want to write a new scheduler reusing ScheduleDAGInstrs would be good there, you may also look into the MachineTraceMetrics class which computes resources used on the critical path. This currently used to direct some peephole optimizations. Even if it doesn't answer the sort of queries you want to perform it may be an example to learn from on how to use the scheduling model directly.</div><div class=""><br class=""></div><div class="">- Matthias</div><br class=""><div><blockquote type="cite" class=""><div class="">On Jun 9, 2017, at 2:14 PM, 陳韋任 <<a href="mailto:chenwj.cs97g@g2.nctu.edu.tw" class="">chenwj.cs97g@g2.nctu.edu.tw</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; 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;" class=""><div class="gmail_default" style="font-family: arial, helvetica, sans-serif;">+Matthias.</div></div><div class="gmail_extra" style="font-family: Helvetica; font-size: 12px; 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;"><br class=""><div class="gmail_quote">2017-06-10 5:06 GMT+08:00 陳韋任<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:chenwj.cs97g@g2.nctu.edu.tw" target="_blank" class="">chenwj.cs97g@g2.nctu.edu.tw</a>></span>:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div dir="ltr" class=""><div class="gmail_default" style="font-family: arial, helvetica, sans-serif;">Also you might need to check use <span style="white-space: pre-wrap; font-family: arial, sans-serif;" class="">PostRASchedulerList or </span><span style="white-space: pre-wrap; font-family: arial, sans-serif;" class="">PostMachineScheduler,</span></div><div class="gmail_default" style="font-family: arial, helvetica, sans-serif;"><span style="font-family: arial, sans-serif; white-space: pre-wrap;" class="">PostRASchedulerList is considered deprecated as mentioned in [1].</span><span style="white-space: pre-wrap; font-family: arial, sans-serif;" class=""><br class=""></span></div><div class="gmail_default" style="font-family: arial, helvetica, sans-serif;"><span style="font-family: arial, sans-serif; white-space: pre-wrap;" class=""><br class=""></span></div><div class="gmail_default"><font class=""><span style="white-space: pre-wrap;" class="">[1] <a href="http://lists.llvm.org/pipermail/llvm-dev/2017-April/112348.html" target="_blank" class="">http://lists.llvm.org/<wbr class="">pipermail/llvm-dev/2017-April/<wbr class="">112348.html</a></span></font></div><div class="gmail_default"><font class=""><span style="white-space: pre-wrap;" class=""><br class=""></span></font></div><div class="gmail_default"><font class=""><span style="white-space: pre-wrap;" class="">HTH,</span></font></div><div class="gmail_default"><font class=""><span style="white-space: pre-wrap;" class="">chenwj</span></font></div><div class="gmail_default"><font class=""><span style="white-space: pre-wrap;" class=""><br class=""></span></font></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br class=""><div class="gmail_quote">2017-06-10 4:03 GMT+08:00 陳韋任<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:chenwj.cs97g@g2.nctu.edu.tw" target="_blank" class="">chenwj.cs97g@g2.nctu.edu.tw</a>></span>:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div dir="ltr" class=""><div class="gmail_default" style="font-family: arial, helvetica, sans-serif;">Not saying I am totally understand how thing works, but I think you're misleading</div><div class="gmail_default" style="font-family: arial, helvetica, sans-serif;">by the DAG in the class name ScheduleDAGInstrs. I only see MachineInstrs</div><div class="gmail_default" style="font-family: arial, helvetica, sans-serif;">there, no SDNode. And the comment of ScheduleDAGInstrs says,</div><div class="gmail_default" style="font-family: arial, helvetica, sans-serif;"><br class=""></div><div class="gmail_default"><font face="arial, helvetica, sans-serif" class=""> <span class="Apple-converted-space"> </span>/// A ScheduleDAG for scheduling lists of MachineInstr.</font><br class=""></div><div class="gmail_default" style="font-family: arial, helvetica, sans-serif;"><br class=""></div><div class="gmail_default" style="font-family: arial, helvetica, sans-serif;">One place mentioning DAG is relate to constructing the dependency of SUnit,</div><div class="gmail_default" style="font-family: arial, helvetica, sans-serif;">i.e., Value2SUsMap.</div><div class="gmail_default" style="font-family: arial, helvetica, sans-serif;"><br class=""></div><div class="gmail_default" style="font-family: arial, helvetica, sans-serif;">Regards,</div><div class="gmail_default" style="font-family: arial, helvetica, sans-serif;">chenwj</div><div class="gmail_default" style="font-family: arial, helvetica, sans-serif;"><br class=""></div><div class="gmail_default" style="font-family: arial, helvetica, sans-serif;"><br class=""></div></div><div class="gmail_extra"><br class=""><div class="gmail_quote"><div class=""><div class="m_2862693122793099198h5">2017-06-09 23:34 GMT+08:00 Xunhao Li (Alan, CRC) via llvm-dev<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="">llvm-dev@lists.llvm.org</a>></span>:<br class=""></div></div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div class=""><div class="m_2862693122793099198h5"><div lang="EN-US" link="#0563C1" vlink="#954F72" class=""><div class="m_2862693122793099198m_-5780262250419183490m_415516022077746380WordSection1"><p class="MsoNormal">Hi All,<u class=""></u><u class=""></u></p><p class="MsoNormal"><u class=""></u> <u class=""></u></p><p class="MsoNormal">I am trying to construct a small optimization based on ScheduleDAGInstrs that does the following:<u class=""></u><u class=""></u></p><p class="m_2862693122793099198m_-5780262250419183490m_415516022077746380MsoListParagraph"><u class=""></u><span class="">1.<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class="">     <span class="Apple-converted-space"> </span></span></span><u class=""></u>Find candidate nodes in the DAG, and speculatively modify the node (nodes).<u class=""></u><u class=""></u></p><p class="m_2862693122793099198m_-5780262250419183490m_415516022077746380MsoListParagraph"><u class=""></u><span class="">2.<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class="">     <span class="Apple-converted-space"> </span></span></span><u class=""></u>After modification, try to compute the scheduled cycles of the region.<u class=""></u><u class=""></u></p><p class="m_2862693122793099198m_-5780262250419183490m_415516022077746380MsoListParagraph"><u class=""></u><span class="">3.<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class="">     <span class="Apple-converted-space"> </span></span></span><u class=""></u>If the cycle number improves, go back to 1. to find the next candidate node.<u class=""></u><u class=""></u></p><p class="MsoNormal"><u class=""></u> <u class=""></u></p><p class="MsoNormal">I am thinking using SchedulePostRATDList’s top-down algorithm to calculate the cycles needed for the region’s execution. However, it decomposes the schedule DAG while calculating the cycles --- In my case I want to keep the DAG so that we don’t need to construct it again in the following steps.<span class="Apple-converted-space"> </span><u class=""></u><u class=""></u></p><p class="MsoNormal"><u class=""></u> <u class=""></u></p><p class="MsoNormal">So my question is: is there a way (or API) to calculate the scheduled cycles needed for the region, without touching the DAG? Or is there a better way to do so in a ScheduleDAG? Did I missed something?<u class=""></u><u class=""></u></p><p class="MsoNormal"><u class=""></u> <u class=""></u></p><p class="MsoNormal">Thanks in advance. Much appreciated.<u class=""></u><u class=""></u></p></div></div><br class=""></div></div>______________________________<wbr class="">_________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="">llvm-dev@lists.llvm.org</a><br class=""><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/<wbr class="">mailman/listinfo/llvm-dev</a><br class=""><br class=""></blockquote></div><span class="m_2862693122793099198HOEnZb"><font color="#888888" class=""><br class=""><br clear="all" class=""><div class=""><br class=""></div>--<span class="Apple-converted-space"> </span><br class=""><div class="m_2862693122793099198m_-5780262250419183490gmail_signature" data-smartmail="gmail_signature"><div dir="ltr" class=""><div class="">Wei-Ren Chen (陳韋任)<br class="">Homepage:<span class="Apple-converted-space"> </span><a href="https://people.cs.nctu.edu.tw/~chenwj" target="_blank" class="">https://people.cs.nctu.edu.tw/<wbr class="">~chenwj</a></div></div></div></font></span></div></blockquote></div><br class=""><br clear="all" class=""><div class=""><br class=""></div>--<span class="Apple-converted-space"> </span><br class=""><div class="m_2862693122793099198gmail_signature" data-smartmail="gmail_signature"><div dir="ltr" class=""><div class="">Wei-Ren Chen (陳韋任)<br class="">Homepage:<span class="Apple-converted-space"> </span><a href="https://people.cs.nctu.edu.tw/~chenwj" target="_blank" class="">https://people.cs.nctu.edu.tw/<wbr class="">~chenwj</a></div></div></div></div></div></div></blockquote></div><br class=""><br clear="all" class=""><div class=""><br class=""></div>--<span class="Apple-converted-space"> </span><br class=""><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr" class=""><div class="">Wei-Ren Chen (陳韋任)<br class="">Homepage:<span class="Apple-converted-space"> </span><a href="https://people.cs.nctu.edu.tw/~chenwj" target="_blank" class="">https://people.cs.nctu.edu.tw/~chenwj</a></div></div></div></div></div></blockquote></div><br class=""></body></html>