[llvm-dev] AMDGPU and support for the new pass manager

Sameer Sahasrabuddhe via llvm-dev llvm-dev at lists.llvm.org
Mon Jan 11 22:34:55 PST 2021


Adding Simon Moll. Also replaced my work ID with my personal ID because Outlook at work doesn't seem to play well with llvm-dev.

---- On Mon, 11 Jan 2021 22:11:22 +0530 Jay Foad via llvm-dev <llvm-dev at lists.llvm.org> wrote ----

 > On Mon, 4 Jan 2021 at 22:16, Arthur Eubanks via llvm-dev
 > <llvm-dev at lists.llvm.org> wrote:
 > >
 > > I've ported most of the IR passes and added them to AMDGPU's opt pipeline.
 > > There are 2 issues remaining:
 > > 1) LegacyDivergenceAnalysis is used in LoopUnswitch to avoid unswitching loops with divergent condition Values. I'm not sure what the state of the LegacyDivergenceAnalysis vs DivergenceAnalysis is. (Also the new PM only has SimpleLoopUnswitch instead of LoopUnswitch).
 > > Transforms/LoopUnswitch/AMDGPU/divergent-unswitch.ll.

Here's what I understood so far from a general eyeballing of the code:

1. Legacy DA is a wrapper around GPU DA. I could not find any direct use of GPU DA.
2. It is likely that AMDGPU no longer "requires" Legacy DA. The advantage of the Legacy DA is that it can handle irreducible regions, but we usually convert them into loops for AMDGPU anyway. I don't know if we have reached a point where we don't care about legacy DA in this respect.
3. StructurizeCFG under the new pass manager simply skips DA, and consequently cannot skip uniform regions. This essentially disables an optimization when moving to the new pass manager.
4. Similarly, loop unswitching is an optimization and available in its simple form with the new pass manager. But I don't know for sure if it *must* skip loops with divergent values.

So we (the AMDGPU folks) need to figure out how much is our dependency on any DA in the new pass manager. Besides the above optimizations, isn't it required for later target optimizations around SGPR usage? Is it possible to unblock the transition to the new pass manager, and then later restore these optimizations? Also, I am wondering if can focus on making only the new GPU DA available subject to #2 above. 

Sameer.


More information about the llvm-dev mailing list