<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 Dec 10, 2015, at 9:39 AM, Hal Finkel <<a href="mailto:hfinkel@anl.gov" class="">hfinkel@anl.gov</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: 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: Helvetica; font-size: 12px; font-style: normal; font-variant: 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: Helvetica; font-size: 12px; font-style: normal; font-variant: 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="">----- Original Message -----</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: 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 type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: 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="">From: "Quentin Colombet" <<a href="mailto:qcolombet@apple.com" class="">qcolombet@apple.com</a>><br class="">To: "Derek Schuff" <<a href="mailto:dschuff@google.com" class="">dschuff@google.com</a>><br class="">Cc: "Hal Finkel" <<a href="mailto:hfinkel@anl.gov" class="">hfinkel@anl.gov</a>>, <a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class="">Sent: Wednesday, December 9, 2015 6:14:33 PM<br class="">Subject: Re: [llvm-dev] Allowing virtual registers after register allocation<br class=""><br class=""><br class="">On Dec 9, 2015, at 4:13 PM, Quentin Colombet < <a href="mailto:qcolombet@apple.com" class="">qcolombet@apple.com</a> ><br class="">wrote:<br class=""><br class=""><br class="">Hi,<br class=""><br class=""><br class="">I would actually go the other direction, i.e., stick to physical<br class="">registers but with an infinite number.<br class="">The rational is that after register allocation we broke all the nice<br class="">properties of the pre-alloc virtual registers. For instance, the<br class="">existing liveness algorithm cannot be used on those virtual<br class="">registers.<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: 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: Helvetica; font-size: 12px; font-style: normal; font-variant: 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="">Why? Is this just related to the fact that we've dropped them out of SSA form?</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: 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>The rough answer is yes.</div><div>The more precise answer is that virtual registers are supported out of SSA form, but if you want to use the liveness infrastructure for them (I mean the LiveInterval class and such), you need to maintain the SSA form behind the scene with the VNIs and other related objects. This is usually complicated and error prone. Moreover recomputing that information from scratch in the out of SSA form is not supported and is basically the same as reconstructing SSA (+implict def and fun for sub registers) and that does not seem worth to me.</div><br class=""><blockquote type="cite" class=""><div class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: 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 type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: 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="">On the other hand, all the infrastructure we have in<br class="">place for physical registers would be suited.<br class=""><br class=""><br class="">(modulo supporting a dynamic number of physical registers)<br class=""><br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: 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: Helvetica; font-size: 12px; font-style: normal; font-variant: 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="">But there is lots of code that assumes that it can iterate over all physical registers in some class. My thought had been that you don't want to introduce infinite physical register sets because this assumption of enumerability is broken (as is the assumption that the size does not dynamically change). Thoughts?</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: 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>That is a good point and I imagine that the solution of such problems depends on what the related algorithms are trying to do.</div><div>My thought for enumeration, but again may not be applicable for every cases, was that we stick to the number of physical registers we currently need. The fact that the set is infinite means that you can make it grow as much as you need, but at a given time it has a finite size.</div><div><br class=""></div><div>Honestly, I think that we could get the proper answer only when we see the actual problems.</div><div>Moreover, if we want to stick to virtual registers, what is the point in trying to run post-RA passes anyway?</div><div><br class=""></div><div>In other words, do we actually have to go in either directions: support “infinite” phys reg or add virtual reg support in post-RA passes?</div><div><br class=""></div><div>I am tempted to think no, we don’t, but I don’t know the use cases.</div><div>What post-RA passes with want to run with virtual regs?</div><div><br class=""></div><div>Cheers,</div><div>-Quentin</div><br class=""><blockquote type="cite" class=""><div class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: 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: Helvetica; font-size: 12px; font-style: normal; font-variant: 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: Helvetica; font-size: 12px; font-style: normal; font-variant: 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: Helvetica; font-size: 12px; font-style: normal; font-variant: 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 type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: 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="">Cheers,<br class="">Q.<br class=""><br class="">On Dec 9, 2015, at 4:04 PM, Derek Schuff via llvm-dev <<br class=""><a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a> > wrote:<br class=""><br class=""><br class="">On Wed, Dec 9, 2015 at 3:02 PM Hal Finkel < <a href="mailto:hfinkel@anl.gov" class="">hfinkel@anl.gov</a> > wrote:<br class=""><br class=""><br class="">----- Original Message -----<br class=""><blockquote type="cite" class="">From: "Derek Schuff via llvm-dev" < <a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a> ><br class="">To: <a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class="">Sent: Wednesday, December 9, 2015 4:31:31 PM<br class="">Subject: [llvm-dev] Allowing virtual registers after register<br class="">allocation<br class=""><br class=""><br class="">Hi all,<br class="">Virtual ISAs such as WebAssembly and NVPTX use infinite virtual<br class="">register sets instead of traditional phsyical registers.<br class="">PrologEpilogInserter is run after register allocation and asserts<br class="">that all virtuals have been allocated but doesn't otherwise depend<br class="">on this if scavenging is not needed. We'd like to use the<br class="">target-independent PEI code for WebAssembly, so we're proposing a<br class="">TargetRegisterInfo hook for targets to indicate that they use<br class="">virtual registers in this way (currently called<br class="">usesVirtualRegstersAfterRegAlloc(), other suggestions welcome). The<br class="">code is at <a href="http://reviews.llvm.org/D15394" class="">http://reviews.llvm.org/D15394</a> and an example of the<br class="">intended use for WebAssembly is at <a href="http://reviews.llvm.org/D15344" class="">http://reviews.llvm.org/D15344</a> .<br class=""><br class=""></blockquote><br class="">I think this makes sense, and generally speaking, I think it will be<br class="">good for us to have better support for VM targets without<br class="">fixed-sized register sets.<br class=""><br class="">Bikeshedding: usesVirtualRegstersAfterRegAlloc() - Are you actually<br class="">"allocating" virtual registers, or just using the ones that the<br class="">infrastructure already provides?<br class=""><br class=""><br class="">Not exactly; the actual register allocation does nothing (i.e.<br class="">WebAssemblyPassConfig::createTargetRegisterAllocator() returns<br class="">nullptr) and we just use the regular infrastructure virtual<br class="">registers. However we do run a custom register coloring pass which<br class="">reduces the total number of virtual registers used.<br class=""><br class=""><br class="">Is the answer the same for the NVPTX backend?<br class=""><br class=""><br class="">Yes (at least, they have a null TargetRegisterAllocator too).<br class=""><br class=""><br class="">Maybe something like: targetLacksPhysicalRegissters() would be<br class="">better?<br class=""><br class=""><br class=""><br class="">Maybe. We actually do have "physical" registers called SP and FP<br class="">(returned by TargetRegisterInfo::getFrameRegister() and used by some<br class="">default ISel lowerings and by FrameIndex elimination) but of course<br class="">they aren't really physical registers either.<br class=""><br class=""><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="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev<br class=""><br class=""><br class=""><br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: 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: Helvetica; font-size: 12px; font-style: normal; font-variant: 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: Helvetica; font-size: 12px; font-style: normal; font-variant: 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: Helvetica; font-size: 12px; font-style: normal; font-variant: 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 Finkel</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: 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: Helvetica; font-size: 12px; font-style: normal; font-variant: 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="">Assistant Computational Scientist</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: 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: Helvetica; font-size: 12px; font-style: normal; font-variant: 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="">Leadership Computing Facility</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: 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: Helvetica; font-size: 12px; font-style: normal; font-variant: 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="">Argonne National Laboratory</span></div></blockquote></div><br class=""></body></html>