[llvm-dev] The state-of-art at Instruction selection

Quentin Colombet via llvm-dev llvm-dev at lists.llvm.org
Mon Feb 22 10:42:53 PST 2021



> On Feb 22, 2021, at 10:40 AM, Quentin Colombet via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> 
> Hi Yao,
> 
>> On Feb 19, 2021, at 5:59 AM, yao zhongxiao via llvm-dev <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote:
>> 
>> Dear LLVMer
>> 
>> I read the Instruction selection in LLVM recently.
>> I find the most important two frameworks "SelectionDAG" and "GlobalISel".
>> As far as I know, the "SelectionDAG" is the default framework and GlobalISel is ongoing now!
>> 
>> Can someone give some detailed information about the Instruction selection frameworks?
>> such as(including but not limited to) :
>> 1. What's the plan for "GlobalISel" to replace the "SelectionDAG"?
> 
> The plan is for GlobalISel to replace SelectionDAG in the future. The main hurdle for GlobalISel adoption right now is that the work around  providing better tablegen support is progressing at a slow pace.
> That’s not a blocker, but that means more hand written code for adopters.
> 
>> 2. GlobalISel uses its own instruction pattern matcher,  
>>    how will the target instruction description be with tablegen, especially the DAG type in tablegen?
> 
> GlobalISel has an importer mechanism that automatically reuse the existing SDISel patterns from tablegen. The importer is not complete though and in particular, some patterns are currently not possible to import or require a bit of help from the developer (see the documentation around GINodeEquiv).
> 
> You can see what is currently supported or not for your target by using -debug-only gisel-emitter and -warn-on-skipped-patterns on your tablegen command when generating the selection tables.
> This could be improved of course!
> 
> As far as describing the types and such, GISel uses LLT. The main place where you have to do that is in the LegalizerInfo where you describe what is and what is not legal. Take a look at llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp for example.
> 
> Take a look at the tutorial we made a few years ago for more details about how to do the targeting:
> 2017 LLVM Developers’ Meeting: J. Bogner & A. Nandakumar & D. Sanders “Tutorial: GlobalISel ” <https://www.youtube.com/watch?v=Zh4R40ZyJ2k>
> 
> And more recently:
> 2019 LLVM Developers’ Meeting: V. Keles & D. Sanders “Generating Optimized Code with GlobalISel” <https://www.youtube.com/watch?v=8427bl_7k1g>
> 
>> 3. "SelectionDAG" is the framework in the trunk, 
>>      what's the suggestion to following the upcoming "GlobalISel" if we maintain a downstream project?
> 
> I would recommend to use GlobalISel. It is faster, more testable, more flexible, and offers optimization opportunities that are just impossible with SDISel.
> The downsides are missing proper tablegen support and it can be rough on the edges since it hasn’t been as widely use yet. Both these downsides will improve as time goes by and as always, patch welcome :).
> 
>> 4. Can someone share some detailed docs or design paper except the following docs
>>     https://llvm.org/docs/GlobalISel/index.html <https://llvm.org/docs/GlobalISel/index.html>
> 
> I think the closest thing to a design/spec doc that is not completely out of date is probably this talk:
> 2016 LLVM Developers’ Meeting: A. Bougacha & Q. Colombet & T. Northover “Global Instr.." <https://www.youtube.com/watch?v=6tfb344A7w8&t=11s>
> 

Actually this one may be more accurate:
2017 LLVM Developers’ Meeting: “GlobalISel: Past, Present, and Future ” <https://www.youtube.com/watch?v=McByO0QgqCY&t=845s>
> If you have specific questions feel free to reach out.
> 
> Cheers,
> -Quentin
> 
>>     
>> 
>> Thanks.
>> 
>> -- 
>> Name: zhongxiao yao
>> Email: zhongxiao.yzx at gmail.com <mailto:zhongxiao.yzx at gmail.com>_______________________________________________
>> LLVM Developers mailing list
>> llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev <https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev>
> 
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev <https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210222/e00ba09c/attachment.html>


More information about the llvm-dev mailing list