<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Thu, Jul 6, 2017 at 12:53 PM Keane, Erich <<a href="mailto:erich.keane@intel.com">erich.keane@intel.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-US" link="blue" vlink="purple">
<div class="m_-1715908832685017835WordSection1">
<p class="MsoNormal"><a name="m_-1715908832685017835__MailEndCompose"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></a></p>
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Eric Christopher [mailto:<a href="mailto:echristo@gmail.com" target="_blank">echristo@gmail.com</a>]
<br>
<b>Sent:</b> Thursday, July 6, 2017 12:48 PM</span></p></div></div><div lang="EN-US" link="blue" vlink="purple"><div class="m_-1715908832685017835WordSection1"><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"><br>
<b>To:</b> Keane, Erich <<a href="mailto:erich.keane@intel.com" target="_blank">erich.keane@intel.com</a>>; Richard Smith <<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>>; Eric Christopher <<a href="mailto:echristo@google.com" target="_blank">echristo@google.com</a>><br>
<b>Cc:</b> Clang Dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>><br>
<b>Subject:</b> Re: [cfe-dev] Setting a FunctionDecl as 'uncallable':<u></u><u></u></span></p></div></div><div lang="EN-US" link="blue" vlink="purple"><div class="m_-1715908832685017835WordSection1"><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">On Thu, Jul 6, 2017 at 12:11 PM Keane, Erich <<a href="mailto:erich.keane@intel.com" target="_blank">erich.keane@intel.com</a>> wrote:<u></u><u></u></p>
</div></div></div></div></div><div lang="EN-US" link="blue" vlink="purple"><div class="m_-1715908832685017835WordSection1"><div><div>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">The difference as far as I can tell is that the dispatch is done at Load/Runtime. It checks on “CPUID”
to determine which function to call. As far as I can tell, target simply sends optimization hints to the backend, right?</span><u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
</blockquote>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div></div></div></div><div lang="EN-US" link="blue" vlink="purple"><div class="m_-1715908832685017835WordSection1"><div><div><div>
<p class="MsoNormal">You can set up automagic dispatch using ifunc or the rest of that (they do in gcc), just a lot of that functionality isn't wired up.<u></u><u></u></p>
</div></div></div></div></div><div lang="EN-US" link="blue" vlink="purple"><div class="m_-1715908832685017835WordSection1"><div><div><div><p class="MsoNormal"><b><i><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">[Keane, Erich] I’m currently implementing in terms of ifunc, though I’m not sure what you mean here? Are we missing some functionality of ‘target’ that
would make it a lot more similar?</span></i></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u><u></u></span></p>
</div></div></div></div></div><div lang="EN-US" link="blue" vlink="purple"><div class="m_-1715908832685017835WordSection1"><div><div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">I think this is intended to be a superset of the ‘target’ functionality.</span><u></u><u></u></p>
<p class="MsoNormal"><a name="m_-1715908832685017835_m_8456024836182317345__MailEndCompose"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"> </span><u></u><u></u></a></p>
</div>
</div>
</blockquote>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div></div></div></div><div lang="EN-US" link="blue" vlink="purple"><div class="m_-1715908832685017835WordSection1"><div><div><div>
<p class="MsoNormal">At a function definition level it's exactly the same :)<u></u><u></u></p>
</div></div></div></div></div><div lang="EN-US" link="blue" vlink="purple"><div class="m_-1715908832685017835WordSection1"><div><div><div><p class="MsoNormal"><b><i><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">[Keane, Erich] The difference is that this allows multiple definitions of the same function, which does not seem to be the case in target. Am I missing
something else here? </span></i></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div></div></div></div></div></div><div lang="EN-US" link="blue" vlink="purple"><div class="m_-1715908832685017835WordSection1"><div><div><div>
<p class="MsoNormal">At any rate, please do keep me on reviews for this. I don't believe the mechanics in general should be any different.<u></u><u></u></p>
</div></div></div></div></div><div lang="EN-US" link="blue" vlink="purple"><div class="m_-1715908832685017835WordSection1"><div><div><div><p class="MsoNormal"><b><i><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">[Keane, Erich] I definitely will! I was hoping to do ‘in progress’ reviews once I’m confident with the direction.</span></i></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u><u></u></span></p>
</div></div></div></div></div><div lang="EN-US" link="blue" vlink="purple"><div class="m_-1715908832685017835WordSection1"><div><div>
<div>
<p class="MsoNormal"><u></u> </p></div></div></div></div></div></blockquote><div><br></div><div>FWIW here's what our support is based upon:</div><div><br></div><div><a href="https://gcc.gnu.org/wiki/FunctionMultiVersioning">https://gcc.gnu.org/wiki/FunctionMultiVersioning</a><br></div><div><br></div><div>I just stopped at "create your own dispatch function".</div><div><br></div><div>-eric</div><div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="blue" vlink="purple"><div class="m_-1715908832685017835WordSection1"><div><div><div><p class="MsoNormal"><u></u></p>
</div>
<div>
<p class="MsoNormal">-eric<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Eric Christopher [mailto:<a href="mailto:echristo@gmail.com" target="_blank">echristo@gmail.com</a>]
<br>
<b>Sent:</b> Thursday, July 6, 2017 12:02 PM<br>
<b>To:</b> Keane, Erich <<a href="mailto:erich.keane@intel.com" target="_blank">erich.keane@intel.com</a>>; Richard Smith <<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>>; Eric Christopher <<a href="mailto:echristo@google.com" target="_blank">echristo@google.com</a>><br>
<b>Cc:</b> Clang Dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span><u></u><u></u></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"><br>
<b>Subject:</b> Re: [cfe-dev] Setting a FunctionDecl as 'uncallable':</span><u></u><u></u></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<p class="MsoNormal">It's pretty much exactly attribute target :)<u></u><u></u></p>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">I'll definitely want to know if there are any differences in use between them.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">-eric<u></u><u></u></p>
</div>
</div>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<div>
<p class="MsoNormal">On Thu, Jul 6, 2017 at 11:43 AM Keane, Erich via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">I’m using the ‘emit’ functionality from attribute-target to get the target-cpu emitted properly, however
I hadn’t realized it allowed multiple function definitions. I’ll look into that one as well.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Thanks Richard!</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">-Erich</span><u></u><u></u></p>
<p class="MsoNormal"><a name="m_-1715908832685017835_m_8456024836182317345_m_9204802846049474"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"> </span><u></u><u></u></a></p>
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">
</span><a href="mailto:metafoo@gmail.com" target="_blank"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">metafoo@gmail.com</span></a><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> [mailto:</span><a href="mailto:metafoo@gmail.com" target="_blank"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">metafoo@gmail.com</span></a><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">]
<b>On Behalf Of </b>Richard Smith<br>
<b>Sent:</b> Thursday, July 6, 2017 11:41 AM<br>
<b>To:</b> Keane, Erich <</span><a href="mailto:erich.keane@intel.com" target="_blank"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">erich.keane@intel.com</span></a><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">>; Eric Christopher
<</span><a href="mailto:echristo@google.com" target="_blank"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">echristo@google.com</span></a><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">><br>
<b>Cc:</b> Clang Dev <</span><a href="mailto:cfe-dev@lists.llvm.org" target="_blank"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">cfe-dev@lists.llvm.org</span></a><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">>; Reid Kleckner
<</span><a href="mailto:rnk@google.com" target="_blank"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">rnk@google.com</span></a><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">></span><u></u><u></u></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"><br>
<b>Subject:</b> Re: [cfe-dev] Setting a FunctionDecl as 'uncallable':</span><u></u><u></u></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<p class="MsoNormal">+echristo This sounds similar to attribute target. Perhaps some of the work there could be reused?<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<p class="MsoNormal">On 6 Jul 2017 11:32 am, "Keane, Erich via cfe-dev" <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<u></u><u></u></p>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Thanks! I’ll look into enable_if and others.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">To spoil my RFC:</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">__attribute__((cpu_specific(atom)))</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">void foo(){} // atom specific impl</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">__attribute__((cpu_specific(p3)))</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">void foo(){} // p3 specific impl</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">__attribute__((cpu_dispatch(atom, p3)))</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">void foo(){}; // dispatch function.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Each ‘foo’ implementation is emitted with different name mangling. They are generally ALL considered
the same function, Function Pointers, references, etc will all be to the ‘dispatch’ version of the function.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><br>
The dispatch function will be implemented in terms of an iFunc.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">-Erich</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"> </span><u></u><u></u></p>
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Reid Kleckner [mailto:<a href="mailto:rnk@google.com" target="_blank">rnk@google.com</a>]
<br>
<b>Sent:</b> Thursday, July 6, 2017 11:25 AM<br>
<b>To:</b> Keane, Erich <<a href="mailto:erich.keane@intel.com" target="_blank">erich.keane@intel.com</a>><br>
<b>Cc:</b> <a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<b>Subject:</b> Re: [cfe-dev] Setting a FunctionDecl as 'uncallable':</span><u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<div>
<p class="MsoNormal">My first guess would be that you want to modify overload resolution. I think the CUDA host/device attributes are involved there. You can also look at the implementation of __attribute__((enable_if))
as well.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">However, do we really need a FunctionDecl for every subtarget specialization? How does a user trigger specialization? Can they do something like take a specialization and instantiate
a class template with it?<u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<p class="MsoNormal">On Thu, Jul 6, 2017 at 9:31 AM, Keane, Erich via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<u></u><u></u></p>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<p class="MsoNormal">Hi all-<br>
I'm working on an attribute implementation (RFC coming once I get a better idea about the implementation details, cpu_dispatch/cpu_specific from ICC) that permits multiple definitions of a function. All definitions of the function ARE emitted, however with
different name-mangling. 1 version of the function keeps the normal name-mangling/linking, so all call-expressions should call THAT one.<br>
<br>
My question is: Is there a way to mark a FunctionDecl as 'don't find me in lookup' such that it never ends up being a "Callee"? Or should I be figuring out how to change the lookup-results here?<br>
<br>
Thanks,<br>
Erich<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><u></u><u></u></p>
</blockquote>
</div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
</div>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><u></u><u></u></p>
</blockquote>
</div>
</div>
</div>
</div>
<p class="MsoNormal">_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><u></u><u></u></p>
</blockquote>
</div>
</div>
</div>
</blockquote>
</div></div></div></div></blockquote></div></div>