<div dir="ltr">SGTM. :)<div><br></div><div>Also, you should have per function target attributes from the start.</div><div><br></div><div>-eric</div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Dec 20, 2017 at 11:30 AM Sanjoy Das <<a href="mailto:sanjoy@playingwithpointers.com">sanjoy@playingwithpointers.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Mon, Dec 18, 2017 at 6:26 PM, Eric Christopher <<a href="mailto:echristo@gmail.com" target="_blank">echristo@gmail.com</a>> wrote:<br>
> Instead, is there any reason why TTI for a given Subtarget shouldn't live on<br>
> the Subtarget? Just construct it the same way we do TargetLowering, etc?<br>
<br>
Then stuff that depends on Analysis today will have to depend on<br>
CodeGen, which is probably not ideal.<br>
<br>
I think I'll go with Matthias' idea -- remove the function pointer<br>
indirection altogether, and instead just have a virtual<br>
getTargetTransformInfo(Function&) in TargetMachine.<br>
<br>
I was also wondering if it makes sense to make the llvm::Function<br>
argument optional -- that'll help make XLA's use case slightly cleaner<br>
since we don't (yet) have per-function target attributes.<br>
<br>
-- Sanjoy<br>
<br>
><br>
> -eric<br>
><br>
><br>
> On Fri, Dec 15, 2017 at 10:13 AM Sanjoy Das via llvm-dev<br>
> <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br>
>><br>
>> On Fri, Dec 15, 2017 at 5:30 AM, Hal Finkel <<a href="mailto:hfinkel@anl.gov" target="_blank">hfinkel@anl.gov</a>> wrote:<br>
>> > Are there reasons why we might not want to do this? Other options we<br>
>> > should<br>
>> > consider?<br>
>><br>
>> It does make the TargetMachine -> TargetIRAnalysis path less abstract,<br>
>> but given that all targets have the same pattern of instantiating a<br>
>> TargetIRAnalysis with a Function->TargetTransformInfo hook, the<br>
>> abstraction does not seem particularly useful.<br>
>><br>
>> I might do even a simpler form of the patch though -- instead of<br>
>> returning a function pointer from TargetMachine, just add a virtual<br>
>> function to TargetMachine that creates the TargetTransformInfo<br>
>> directly from a Function.<br>
>><br>
>> -- Sanjoy<br>
>><br>
>> ><br>
>> >  -Hal<br>
>> ><br>
>> >><br>
>> >> [0]:  XLA is a machine learning focussed linear algebra compiler<br>
>> >> <a href="https://www.tensorflow.org/performance/xla/" rel="noreferrer" target="_blank">https://www.tensorflow.org/performance/xla/</a> that uses LLVM for its CPU<br>
>> >> and GPU backends.<br>
>> >><br>
>> >> -- Sanjoy<br>
>> >> _______________________________________________<br>
>> >> LLVM Developers mailing list<br>
>> >> <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
>> >> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
>> ><br>
>> ><br>
>> > --<br>
>> > Hal Finkel<br>
>> > Lead, Compiler Technology and Programming Languages<br>
>> > Leadership Computing Facility<br>
>> > Argonne National Laboratory<br>
>> ><br>
>> _______________________________________________<br>
>> LLVM Developers mailing list<br>
>> <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
>> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>