<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style class="darkreader darkreader--fallback" media="screen"></style><style class="darkreader darkreader--text" media="screen"></style><style class="darkreader darkreader--invert" media="screen"></style><style class="darkreader darkreader--inline" media="screen">[data-darkreader-inline-bgcolor] {
background-color: var(--darkreader-inline-bgcolor) !important;
}
[data-darkreader-inline-bgimage] {
background-image: var(--darkreader-inline-bgimage) !important;
}
[data-darkreader-inline-border] {
border-color: var(--darkreader-inline-border) !important;
}
[data-darkreader-inline-border-bottom] {
border-bottom-color: var(--darkreader-inline-border-bottom) !important;
}
[data-darkreader-inline-border-left] {
border-left-color: var(--darkreader-inline-border-left) !important;
}
[data-darkreader-inline-border-right] {
border-right-color: var(--darkreader-inline-border-right) !important;
}
[data-darkreader-inline-border-top] {
border-top-color: var(--darkreader-inline-border-top) !important;
}
[data-darkreader-inline-boxshadow] {
box-shadow: var(--darkreader-inline-boxshadow) !important;
}
[data-darkreader-inline-color] {
color: var(--darkreader-inline-color) !important;
}
[data-darkreader-inline-fill] {
fill: var(--darkreader-inline-fill) !important;
}
[data-darkreader-inline-stroke] {
stroke: var(--darkreader-inline-stroke) !important;
}
[data-darkreader-inline-outline] {
outline-color: var(--darkreader-inline-outline) !important;
}</style><style class="darkreader darkreader--user-agent" media="screen">input, textarea, select, button {
background-color: #ffffd8;
}
html, body, input, textarea, select, button {
border-color: #5c5240;
color: #000000;
}
a {
color: #584e3d;
}
table {
border-color: #9d8c6d;
}
::placeholder {
color: #d1ba91;
}
::selection {
background-color: #665b47;
color: #ffffd8;
}
::-moz-selection {
background-color: #665b47;
color: #ffffd8;
}
input:-webkit-autofill,
textarea:-webkit-autofill,
select:-webkit-autofill {
background-color: #fff3bd !important;
color: #000000 !important;
}
::-webkit-scrollbar {
background-color: #ffffcd;
color: #756851;
}
::-webkit-scrollbar-thumb {
background-color: #eed4a5;
}
::-webkit-scrollbar-thumb:hover {
background-color: #cdb78e;
}
::-webkit-scrollbar-thumb:active {
background-color: #756851;
}
::-webkit-scrollbar-corner {
background-color: #ffffd8;
}
* {
scrollbar-color: #eed4a5 #ffffcd;
}</style><style type="text/css" style="">
<!--
p
{margin-top:0;
margin-bottom:0}
-->
</style><style class="darkreader darkreader--sync" media="screen"></style><style type="text/css" id="owaParaStyle">P {margin-top:0;margin-bottom:0;}</style><style class="darkreader darkreader--sync" media="screen"></style><style class="darkreader darkreader--override" media="screen">.jfk-bubble {
background-color: #ffffef !important;
}
.vimvixen-hint {
background-color: #ffffc7 !important;
border-color: #c6b089 !important;
color: #302b21 !important;
}</style><style class="darkreader darkreader--sync" media="screen"></style>
</head>
<body dir="ltr" fpstyle="1" ocsi="0">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">
<div>To facilitate further discussion I have posted a first attempt to get things moving in this direction:</div>
<div><a href="https://reviews.llvm.org/D63890" target="_blank">https://reviews.llvm.org/D63890</a></div>
<div><br>
</div>
<div>To try this patch, one needs to run llc up to machine-cp, then run llc <file> --run-pass=none --run-new-pass=machine-cp ...</div>
<div><br>
</div>
<div>This patch is only an attempt to get things working; the changes made in llc are hacked up and just done to expose running the new pass manager. Moreso I am looking for feedback about the general approach for fitting the CodeGen passes into the new pass
manager.</div>
<div><br>
</div>
<div>Charles<br>
</div>
<div><br>
</div>
<div style="font-family: Times New Roman; color: rgb(0, 0, 0); font-size: 16px; --darkreader-inline-color:#000000;" data-darkreader-inline-color="">
<hr tabindex="-1">
<div id="divRpF133546" style="direction: ltr;"><font style="--darkreader-inline-color:#000000;" data-darkreader-inline-color="" size="2" face="Tahoma" color="#000000"><b>From:</b> Markus Lavin [markus.lavin@ericsson.com]<br>
<b>Sent:</b> Wednesday, June 19, 2019 4:07 AM<br>
<b>To:</b> Zhang, Charles; llvm-dev@lists.llvm.org; Fedor Sergeev<br>
<b>Cc:</b> Magee, Joshua<br>
<b>Subject:</b> Re: [llvm-dev] Using the new pass manager for CodeGen<br>
</font><br>
</div>
<div></div>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); --darkreader-inline-color:#000000;" data-darkreader-inline-color="">
> <span style="color: rgb(50, 49, 48); background-color: rgb(255, 255, 255); display: inline !important; --darkreader-inline-color:#3b3529; --darkreader-inline-bgcolor:#ffffd8;" data-darkreader-inline-colordata-darkreader-inline-bgcolor="">I would love to see
Opt and CodeGen using the same pass manager (as my downstream project has already switched to NewPM in Opt).</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); --darkreader-inline-color:#000000;" data-darkreader-inline-color="">
<span style="color: rgb(50, 49, 48); background-color: rgb(255, 255, 255); display: inline !important; --darkreader-inline-color:#3b3529; --darkreader-inline-bgcolor:#ffffd8;" data-darkreader-inline-colordata-darkreader-inline-bgcolor=""><br>
</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); --darkreader-inline-color:#000000;" data-darkreader-inline-color="">
FWIW I too would love to see CodeGen use the new PM. </div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); --darkreader-inline-color:#000000;" data-darkreader-inline-color="">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); --darkreader-inline-color:#000000;" data-darkreader-inline-color="">
Some months ago I worked on a patch, albeit mostly useful downstream, having BasicAA depend on LazyValueInfo but had to ultimately give up on it. With the old PM used in CodeGen I had lots of problems getting the dependencies right, debugging was difficult
and nobody could really provide answers on exactly how it was supposed to work.<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); --darkreader-inline-color:#000000;" data-darkreader-inline-color="">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); --darkreader-inline-color:#000000;" data-darkreader-inline-color="">
So that said even if there are no performance gains there would definitely be other benefits.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); --darkreader-inline-color:#000000;" data-darkreader-inline-color="">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); --darkreader-inline-color:#000000;" data-darkreader-inline-color="">
-Markus</div>
<div id="appendonsend"></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); --darkreader-inline-color:#000000;" data-darkreader-inline-color="">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size: 11pt; --darkreader-inline-color:#000000;" data-darkreader-inline-color="" face="Calibri, sans-serif" color="#000000"><b>From:</b> llvm-dev <llvm-dev-bounces@lists.llvm.org> on behalf of Fedor Sergeev
via llvm-dev <llvm-dev@lists.llvm.org><br>
<b>Sent:</b> Wednesday, June 19, 2019 12:38 PM<br>
<b>To:</b> Charles.Zhang@sony.com; llvm-dev@lists.llvm.org<br>
<b>Cc:</b> joshua.magee@sony.com<br>
<b>Subject:</b> Re: [llvm-dev] Using the new pass manager for CodeGen</font>
<div> </div>
</div>
<div style="background-color: rgb(255, 255, 255); --darkreader-inline-bgcolor:#ffffd8;" data-darkreader-inline-bgcolor="">
Hi, Charles,<br>
<br>
<div class="x_moz-cite-prefix">On 6/13/19 11:48 PM, via llvm-dev wrote:<br>
</div>
<blockquote type="cite">
<div style="direction: ltr; font-family: Tahoma; color: rgb(0, 0, 0); font-size: 10pt; --darkreader-inline-color:#000000;" data-darkreader-inline-color="">
<div>Hi,</div>
<div><br>
</div>
<div>I am looking into potentially porting CodeGen and some of the passes to using the new pass manager. Two questions:</div>
<div><br>
</div>
<div>1. Has anybody made an attempt in this direction already? Maybe I am missing a branch out there that has started on this already. From what I can tell, there is no work in-tree in CodeGen that is aware of the new pass manager besides some assembly utilities
in BackendUtils.cpp. </div>
</div>
</blockquote>
You are right, there is no activity in-tree in that direction to the best of my knowledge.<br>
And every time I was asking on LLVM devmtg if anybody working on that the answer was - "nay".<br>
<blockquote type="cite">
<div style="direction: ltr; font-family: Tahoma; color: rgb(0, 0, 0); font-size: 10pt; --darkreader-inline-color:#000000;" data-darkreader-inline-color="">
<div>My initial thoughts in this direction were that there would need to be some new pass manager machinery, for example, things like FunctionToMachineFunctionPassAdaptor that handles what MachineFunctionPass::runOnFunction used to do, along with the associated
AnalysisManager plumbing to understand units of MIR.<br>
</div>
</div>
</blockquote>
Generally, what you describe is indeed a proper first step towards getting CodeGen on New-PM rails:<br>
- introduce IRUnits for Machine IR<br>
- provide generic handling for those new units everywhere in New-PM framework<br>
<br>
The next step would be to start moving at least one backend towards it, and thats where the initiative kinda stalls.<br>
I believe people working on CodeGen just do not find enough incentive to start that work.<br>
<br>
<blockquote type="cite">
<div style="direction: ltr; font-family: Tahoma; color: rgb(0, 0, 0); font-size: 10pt; --darkreader-inline-color:#000000;" data-darkreader-inline-color="">
<div></div>
<div><br>
</div>
<div>2. Are there any compile time improvements expected from porting CodeGen passes in the first place? As far as I can tell, the llc pass pipeline seems to be fairly well fixed in terms of phase ordering, and all the analyses are thrown out from opt anyway.</div>
</div>
</blockquote>
I would expect real savings just by reusing non-Machine-IR analyses.<br>
As soon as you use the same llvm state/module/etc for both Opt and CodeGen purposes
<br>
(thats what I believe many do, at least our JIT compiler does that). That will allow you<br>
to reuse analysis manager and thus keep every cached analysis there.<br>
<br>
I would love to see Opt and CodeGen using the same pass manager (as my downstream project has already switched to NewPM in Opt).<br>
<br>
Said that, perhaps analyses are not a current performance bottleneck in CodeGen (I bet instruction selection will always trump anything else).<br>
So this is more about overall consistency of operations rather than crazy performance gains.<br>
<br>
regards,<br>
Fedor.<br>
<br>
<blockquote type="cite">
<div style="direction: ltr; font-family: Tahoma; color: rgb(0, 0, 0); font-size: 10pt; --darkreader-inline-color:#000000;" data-darkreader-inline-color="">
<div></div>
<div>Thanks,<br>
</div>
<div>Charles<br>
</div>
</div>
<br>
<fieldset class="x_mimeAttachmentHeader" target="_blank" rel="noopener noreferrer">
</fieldset>
<pre class="x_moz-quote-pre">_______________________________________________
LLVM Developers mailing list
<a class="x_moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org" style="color: rgb(88, 78, 61); --darkreader-inline-color:#5b513f;" target="_blank" rel="noopener noreferrer" data-darkreader-inline-color="">llvm-dev@lists.llvm.org</a>
<a class="x_moz-txt-link-freetext" href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" style="color: rgb(88, 78, 61); --darkreader-inline-color:#5b513f;" target="_blank" rel="noopener noreferrer" data-darkreader-inline-color="">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a>
</pre>
</blockquote>
<br>
</div>
</div>
</div>
</div>
</body>
</html>