Question regards to the design of GpuInstructionFusion pass

23 views
Skip to first unread message

t kevin

unread,
Nov 11, 2021, 10:50:38 PM11/11/21
to XLA development
hi dear XLA folks,

I'm trying to understand some GPU optimzation passes. And this piece of code is a myth to me.


fusion.AddPass<GpuInstructionFusion>(/*may_duplicate=*/false);
fusion.AddPass<GpuInstructionFusion>(/*may_duplicate=*/true);

I kinda understand what the `may_duplicate` parameter does and how it affect the fusion pass.
What I can't get is the calling sequence.
Why is GpuInstructionFusion called twice with may_duplicate=false first and then may_duplicate=true.

what is the design philosophy behind this? This code is like almost 5 years old from the initial commit.
I can't extract much information from the git commit log.

Your help is much appreciated.

Thanks a lot.
Kevin

George Karpenkov

unread,
Nov 13, 2021, 1:53:24 PM11/13/21
to t kevin, Sanjoy Das, XLA development
+Sanjoy Das

Hi Kevin,

I'm not the expert on why the code was designed in this way, but my understanding is that it tries hard to do "cheaper" fusions first which do not require rematerializations.

--
You received this message because you are subscribed to the Google Groups "XLA development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xla-dev+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/xla-dev/f4d292e3-9c86-442f-9f88-9432f909f281n%40googlegroups.com.

Sanjoy Das

unread,
Nov 19, 2021, 11:14:33 PM11/19/21
to George Karpenkov, t kevin, XLA development
The commit that introduced this landed before XLA was open sourced so you probably won't find it in the git log, the commit message says:

Before this CL, we do a single fusion pass and duplicate operations deemed non-costly, which readily reaches a local optimum on some graphs. After this CL, we do fixpoint of { a non-duplicative pass, the original fusion pass }, which produces better fusions on some such graphs.

t kevin

unread,
Nov 21, 2021, 7:51:29 PM11/21/21
to Sanjoy Das, George Karpenkov, XLA development
Hi George, Sanjoy

Thanks for the clarification. Much appreciated.
Have a nice day.

Kevin

Sanjoy Das <san...@google.com> 于2021年11月20日周六 下午12:14写道:
Reply all
Reply to author
Forward
0 new messages