[llvm-dev] [GSoC] Prospective student for Unify ways to move code or check if code is safe to be moved

RITHIK SHARMA via llvm-dev llvm-dev at lists.llvm.org
Fri Mar 27 12:08:05 PDT 2020


Hello Whitney,

I spent some good time going through the exact implementation of a few loop
transformation passes in llvm and for others, I tried to quickly get an
idea of what is going inside them with respect to the implementation in
llvm.

I also went through the CodeMoverUtils [1], I really appreciate the effort
of keeping it generic and decoupled from loop though being derived from
loop and aimed to be used for loop transformation. I also analyzed Loop
Fuse pass [2] as a reference as it already uses CodeMoverUtils which helped
me to concrete my understanding of the vision behind the unification of
code motion checks.

LICM [3] does hoisting [4] as well as sinking [5]. I thought about
extending the already available isSafeToMoveBefore [6] for hoisting the
code from loop body to the pre-header. In my opinion, hosting and sinking
are the basic code motions, exposing them in a robust and flexible way will
also help other transformations (maybe other non-loop transformations).

I also saw that Loop Sink pass [7] uses the same checks [8] from LICM and
also found another code hoisting opportunity in Loop Rotation pass where we
once hoist to the pre-header [9]. I also analyzed passes like Loop Unswitch
[10] in the hope for some code motion opportunities but it seems the passes
which are expected to run after LICM are void of them (may not be true for
all). I limited myself to the loop passes in Transform/Scalar and I'm
planning to take a look into other loop passes as well.

Having said that, my concern right now is the proposal whose deadline is
approaching in 4 days, I would like to get a small feedback before the
deadline. I am aiming to prepare a draft by Monday morning (PST) so then I
may have a short window to incorporate the feedback. I also have two
coursework assignment deadlines end of this week which is also demanding
some of my effort other than attending the lectures.

I'll be glad to hear about your expectations for the proposal. I'm planning
to somehow meet them and will also continue to look into loop passes for
more code motion checks after the proposal deadline. Does this look good to
you? In my proposal can I focus on the findings that I'm able to do before
the deadline and keep some buffer for things that I may find later as
identifying all the existing ways for code motion in loop transformations
is a big portion of the proposed project.

1.
https://github.com/llvm/llvm-project/blob/master/llvm/lib/Transforms/Utils/CodeMoverUtils.cpp
2.
https://github.com/llvm/llvm-project/blob/master/llvm/lib/Transforms/Scalar/LoopFuse.cpp
3.
https://github.com/llvm/llvm-project/blob/master/llvm/lib/Transforms/Scalar/LICM.cpp
4.
https://github.com/llvm/llvm-project/blob/master/llvm/lib/Transforms/Scalar/LICM.cpp#L353
5.
https://github.com/llvm/llvm-project/blob/master/llvm/lib/Transforms/Scalar/LICM.cpp#L348
6.
https://github.com/llvm/llvm-project/blob/master/llvm/lib/Transforms/Utils/CodeMoverUtils.cpp#L299
7.
https://github.com/llvm/llvm-project/blob/master/llvm/lib/Transforms/Scalar/LoopSink.cpp
8.
https://github.com/llvm/llvm-project/blob/master/llvm/lib/Transforms/Scalar/LoopSink.cpp#L303
9.
https://github.com/llvm/llvm-project/blob/master/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp#L403
10.
https://github.com/llvm/llvm-project/blob/master/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp

Best,
Rithik



On Tue, 24 Mar 2020 at 23:30, Stefanos Baziotis <stefanos.baziotis at gmail.com>
wrote:

> Np, good luck! :)
>
> - Stefanos
>
> Στις Τρί, 24 Μαρ 2020 στις 8:55 μ.μ., ο/η RITHIK SHARMA <
> rithiksh02 at gmail.com> έγραψε:
>
>> Many thanks, Stefanos! I really appreciate your help :) I heard from
>> Whitney.
>>
>> Best,
>> Rithik
>>
>> On Tue, 24 Mar 2020 at 23:08, Stefanos Baziotis <
>> stefanos.baziotis at gmail.com> wrote:
>>
>>> Hi Rithik,
>>>
>>> I CC'd the 2 other mentors and hopefully you'll get answer. Sorry, but I
>>> don't know of any other way to help. :/
>>> You may also try to contact them privately.
>>>
>>> Best,
>>> Stefanos
>>>
>>>
>>> Στις Τρί, 24 Μαρ 2020 στις 7:35 μ.μ., ο/η RITHIK SHARMA via llvm-dev <
>>> llvm-dev at lists.llvm.org> έγραψε:
>>>
>>>> Ping!
>>>> I'm bit concern about the approaching deadline next week, some pointers
>>>> will be really appreciated and will be very helpful to me.
>>>>
>>>> Best regards,
>>>> Rithik Sharma
>>>>
>>>> On Sun, 22 Mar 2020 at 01:24, RITHIK SHARMA <rithiksh02 at gmail.com>
>>>> wrote:
>>>>
>>>>> Hello,
>>>>>
>>>>> I am an undergrad from India. This summer I'm interested in working on
>>>>> unifying the code motion checks as a GSoC intern with LLVM. I started
>>>>> reading about classical data flow analysis since few months, I see this as
>>>>> a great opportunity to start contributing to LLVM. The idea of unifying all
>>>>> the code motion checks into one place seems very rational and interesting
>>>>> to me. As in the project description LICM was mentioned, I have a basic
>>>>> idea about it and I spent some time to go through its implementation in
>>>>> LLVM. It makes a lot of sense to me to keep all code motion checks at one
>>>>> place, say an analysis pass, I also looked into GVN hoist & sink passes as
>>>>> they also have some code motion logic. I'll start drafting the proposal
>>>>> after your initial feedback/suggestions. I'm really very excited to work on
>>>>> this.
>>>>>
>>>>> Best Regards,
>>>>> Rithik Sharma
>>>>>
>>>> _______________________________________________
>>>> LLVM Developers mailing list
>>>> llvm-dev at lists.llvm.org
>>>> 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/20200328/ff0f9a41/attachment.html>


More information about the llvm-dev mailing list