<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=utf-8"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Helvetica;
        panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@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;}
@font-face
        {font-family:"Book Antiqua";
        panose-1:2 4 6 2 5 3 5 3 3 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        color:black;}
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.MsoPlainText, li.MsoPlainText, div.MsoPlainText
        {mso-style-priority:99;
        mso-style-link:"Plain Text Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        color:black;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
span.PlainTextChar
        {mso-style-name:"Plain Text Char";
        mso-style-priority:99;
        mso-style-link:"Plain Text";
        font-family:"Calibri","sans-serif";}
span.apple-converted-space
        {mso-style-name:apple-converted-space;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        color:black;}
span.EmailStyle22
        {mso-style-type:personal-reply;
        font-family:"Book Antiqua","serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></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 bgcolor=white lang=EN-IE link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Book Antiqua","serif";color:#1F497D'>Although currently out of tree, the Movidius SHAVE compiler also makes extensive use of Itineraries. It has some fairly complex scheduling requirements that I have so far not figured out how to express with the SchedMachineModel approach.  It too is a VLIW processor, with predication and no instruction interlocking, so computing the correct scheduling is not just important for performance it is critical for correct code generation.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Book Antiqua","serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Book Antiqua","serif";color:#1F497D'>Curiously enough, a few months ago I posed a similar question, but the other way around regarding how to rewrite our scheduler to avoid using the itineraries - this thread has sort of answered that question </span><span style='font-size:12.0pt;font-family:Wingdings;color:#1F497D'>J</span><span style='font-size:12.0pt;font-family:"Book Antiqua","serif";color:#1F497D'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Book Antiqua","serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Book Antiqua","serif";color:#1F497D'>Thanks,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Book Antiqua","serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Book Antiqua","serif";color:#1F497D'>            Martin O’Riordan - Movidius Ltd.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Book Antiqua","serif";color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext'> llvm-dev [mailto:llvm-dev-bounces@lists.llvm.org] <b>On Behalf Of </b>Anshuman Dasgupta via llvm-dev<br><b>Sent:</b> 09 November 2015 22:19<br><b>To:</b> llvm-dev@lists.llvm.org; dpalermo@codeaurora.org<br><b>Subject:</b> Re: [llvm-dev] Is there a way to convert between SchedMachineModel and Itineraries?<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal style='margin-bottom:12.0pt'>> Not many people work with either the machine model or itineraries.<br><br>Andrew's right; not too many people on the list work with the itineraries It was authored for the Hexagon backend and I believe the R600 uses it as well.<br><br>How complex are the bundling rules in your VLIW target? Is that documented somewhere? The complexity will determine whether I'd recommend using the DFA packetizer.<br><br>-Anshu<o:p></o:p></p><p class=MsoPlainText>-- <o:p></o:p></p><p class=MsoPlainText>Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, <o:p></o:p></p><p class=MsoPlainText>hosted by The Linux Foundation<o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><br><br>On 11/9/2015 2:52 PM, Andrew Trick via llvm-dev wrote:<o:p></o:p></span></p></div><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><o:p> </o:p></span></p><div><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'>On Nov 9, 2015, at 10:49 AM, Rail Shafigulin <<a href="mailto:rail@esenciatech.com">rail@esenciatech.com</a>> wrote:<o:p></o:p></span></p></div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><o:p> </o:p></span></p><div><div><div><div><p class=MsoNormal><span style='font-size:9.0pt;font-family:"Helvetica","sans-serif"'>On Mon, Nov 9, 2015 at 10:31 AM, Hal Finkel<span class=apple-converted-space> </span><<a href="mailto:hfinkel@anl.gov" target="_blank">hfinkel@anl.gov</a>><span class=apple-converted-space> </span>wrote:<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:9.0pt;font-family:"Helvetica","sans-serif"'>----- Original Message -----<br>> From: "Rail Shafigulin via llvm-dev" <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>><br>> To: "llvm-dev" <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>><br>> Sent: Monday, November 9, 2015 10:09:07 AM<br>> Subject: Re: [llvm-dev] Is there a way to convert between SchedMachineModel   and Itineraries?<br>><br>><br>> Anybody? Does anyone at all know how to do it?<br><br>There is no direct conversion. Although they are similar models, they are different. The strength of Itineraries lies in modeling pipelines with complex hazards (especially those that are not fully pipelined, or have other similar ordering constraints). SchedMachineModel can't do that. Unless you need to represent those kinds of constraints, SchedMachineModel is preferred. We'd like to move toward using SchedMachineModel for most things.<br><br> -Hal<o:p></o:p></span></p><div><p class=MsoNormal><span style='font-size:9.0pt;font-family:"Helvetica","sans-serif"'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-size:9.0pt;font-family:"Helvetica","sans-serif"'>Thanks for the reply Hal. I thought my thread was dead. <o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:9.0pt;font-family:"Helvetica","sans-serif"'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-size:9.0pt;font-family:"Helvetica","sans-serif"'>I was recommended to use SchedMachineModel for my VLIW, which is what I've done (it took me a month to learn tblgen and write the scheduling model and one more month do get my head around LLVM. My experience with compilers is limited to a class I took in college a year ago). The scheduling part seems to be working (at least this is what my limited testing shows). However current DFAPacketizer is based on itineraries (DFAPacketizer.cpp, lines 66-73). I was hoping there is a way to convert between these two representations so that I wouldn't have to rewrite the packetizer. Unfortunately my experience with compilers is very limited and I still have a lot to learn. <o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:9.0pt;font-family:"Helvetica","sans-serif"'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-size:9.0pt;font-family:"Helvetica","sans-serif"'>Right now I have two options. In both of the cases there are significant drawbacks.<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:9.0pt;font-family:"Helvetica","sans-serif"'>1. Rewrite the scheduling model using itineraries. Unfortunately there is very little help available on this topic, I even asked on the IRC channel and nobody seems to know how it is done, since everyone is moving towards the SchedMachineModel.<o:p></o:p></span></p></div></div></div></div></div></blockquote><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><o:p> </o:p></span></p></div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'>Not many people work with either the machine model or itineraries.<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'>Be careful! I think the DFAPacketizer will only be effective on a very simple itinerary (which could easily have been expressed in the new machine model instead). I’ve heard stories of it “blowing up” on large itineraries. I have no direct experience with it.<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><br><br><o:p></o:p></span></p><div><div><div><div><div><p class=MsoNormal><span style='font-size:9.0pt;font-family:"Helvetica","sans-serif"'>2. Write a new packetizer which will use the SchedMachineModel, however, as I said before, I have a very limited experience with compilers and this looks like some major work. I'm not afraid of it, it is just there is not much information and help available.<o:p></o:p></span></p></div></div></div></div></div><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'>This looks like an opportunity for you to learn something interesting. Generating a state machine from a set of constraints is fairly straightforward. The only difficultly lies in limiting the total number of states so you don’t end up with a giant table. If you were able to express those constraints in the machine model they must not be too complicated.<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'>If your state machine is really just modeling the number of functional units that can be used by a given VLIW bundle, then you don’t need to generate a state machine at all. All you need are counters. MachineScheduler can do this for you. It already has some support for scheduling instruction groups for a simple in-order machine (without plugging in your own scheduler at all). Currently, this isn’t fully implemented—it isn’t modeling multiple functional units per cycle. But that would be *very* easy to fix and is something I could help with. It’s just that no one has asked for it.<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'>Andy<o:p></o:p></span></p></div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><br><br><o:p></o:p></span></p><div><div><div><div><div><p class=MsoNormal><span style='font-size:9.0pt;font-family:"Helvetica","sans-serif"'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-size:9.0pt;font-family:"Helvetica","sans-serif"'>I would greatly appreciate any help on this<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:9.0pt;font-family:"Helvetica","sans-serif"'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-size:9.0pt;font-family:"Helvetica","sans-serif"'>Rail<o:p></o:p></span></p></div></div></div></div></div></div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><br><br><br><br><o:p></o:p></span></p><pre>_______________________________________________<o:p></o:p></pre><pre>LLVM Developers mailing list<o:p></o:p></pre><pre><a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><o:p></o:p></pre><pre><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><o:p></o:p></pre></blockquote><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><o:p> </o:p></span></p></div></body></html>