<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Jan 9, 2018, at 6:31 AM, Tsung-Yu Hsieh via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69);" class="">Hi everyone<span style="font-stretch:normal;line-height:normal;font-family:".PingFang TC"" class="">,</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69); min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69);" class="">I'm quite new to LLVM <i class="">and doing a  Q-learning  </i><span style="font-stretch:normal;line-height:normal;font-family:".PingFang TC"" class="">(</span><i class="">just a hobby</i><span style="font-stretch:normal;line-height:normal;font-family:".PingFang TC"" class="">)</span><i class=""> on register allocation for LLVM. RegAllocRL is based on</i></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69);" class=""><i class="">RegAllocBase</i><span style="font-stretch:normal;line-height:normal;font-family:".PingFang TC"" class="">,</span><i class=""> RegAllocBasic and add some feature to implement Q-learning algorithm. </i></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69);" class=""><i class="">I</i><span style="font-stretch:normal;line-height:normal;font-family:".PingFang TC"" class="">’</span><i class="">ve currently run as MachineFunctionPass and things seem to work in simple case. In order to make progress on training</i><span style="font-stretch:normal;line-height:normal;font-family:".PingFang TC"" class="">,</span><i class=""> </i></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69);" class=""><i class="">I have questions and want to get some help:</i></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69); min-height: 14px;" class=""><i class=""></i></div><ol class=""><li style="margin:0px;font-stretch:normal;line-height:normal;font-family:"Helvetica Neue";color:rgb(69,69,69)" class=""><i class="">Is there any file data format used in LLVM to store information in each compilation step </i><span style="font-stretch:normal;line-height:normal;font-family:".PingFang TC"" class="">?</span><i class=""> As I know</i><span style="font-stretch:normal;line-height:normal;font-family:".PingFang TC"" class="">,</span><i class=""> the Pass can not run several time in one compilation step</i><span style="font-stretch:normal;line-height:normal;font-family:".PingFang TC"" class="">,</span><i class=""> which means that I have to export data to file before compilation step finished and load from it in the next iteration. </i></li><li style="margin:0px;font-stretch:normal;line-height:normal;font-family:"Helvetica Neue";color:rgb(69,69,69)" class=""> For training q-learning parameters<span style="font-stretch:normal;line-height:normal;font-family:".PingFang TC"" class="">,</span> it would be necessary to run reg allocation pass several iterations to converge. Now<span style="font-stretch:normal;line-height:normal;font-family:".PingFang TC"" class="">,</span> I train by compiling the target program once in each iteration and it will cost time. I wonder if I can train by  running the specific reg pass several time to optimize my parameters <span style="font-stretch:normal;line-height:normal;font-family:".PingFang TC"" class="">?</span></li></ol></div></div></blockquote><div>We have the .mir file format to save/restore machine functions. See also <a href="http://llvm.org/docs/MIRLangRef.html" class="">http://llvm.org/docs/MIRLangRef.html</a> so something like</div><div>llc -stop-before=greedy something.ll -o something.mir</div><div>llc -run-pass=greedy something.mir</div><div><br class=""></div><div>should allow you to run the greedy allocator separately. Note though that the MIR serialization is only a 95% solution today and doesn't handle all programs (though it should be easy to extend/improve it, patches welcome :)</div><div><br class=""></div><div>- Matthias</div></div><br class=""></body></html>