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

Jay Foad via llvm-dev llvm-dev at lists.llvm.org
Mon Jan 11 08:41:22 PST 2021


1) Unfortunately LegacyDivergenceAnalysis has known bugs (e.g.
https://bugs.llvm.org/show_bug.cgi?id=42741) but DivergenceAnalysis
does not work on irreducible control flow (it comes with a wrapper
that falls back to LegacyDivergenceAnalysis if it detects irreducible
control flow). So neither is perfect. Does the new pass manager
currently support either of them?

I think Sameer has looked into
https://bugs.llvm.org/show_bug.cgi?id=42741 in some detail. I'm not
sure if there are other known bugs.

Jay.

Jay.

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.
> 2) The AMDGPU backend has its own inliner (set here). Any ideas for how to do custom inliner cost modeling in the new PM pipelines? Allow targets to override an analysis pass that the inliner uses to get an InlineAdvisor?
> CodeGen/AMDGPU/amdgpu-inline.ll
>
> On Fri, Dec 4, 2020 at 4:44 PM Arthur Eubanks <aeubanks at google.com> wrote:
>>
>> Some indicative failing tests are under the llvm/test/CodeGen/AMDGPU directory when opt's -enable-new-pm flag is set to true by default. They should also be repro'able by adding a corresponding NPM RUN line, e.g. "opt -S -O1 -mtriple=amdgcn-- ..." -> "opt -S -passes='default<O1>' -mtriple=amdgcn-- ...".
>>
>> I see the following AMDGPU-specific failures:
>>   LLVM :: CodeGen/AMDGPU/amdgpu-inline.ll
>>   LLVM :: CodeGen/AMDGPU/infer-addrpace-pipeline.ll
>>   LLVM :: CodeGen/AMDGPU/internalize.ll
>>   LLVM :: CodeGen/AMDGPU/llvm.amdgcn.wavefrontsize.ll
>>   LLVM :: CodeGen/AMDGPU/opt-pipeline.ll
>>   LLVM :: CodeGen/AMDGPU/propagate-attributes-clone.ll
>>   LLVM :: CodeGen/AMDGPU/propagate-attributes-single-set.ll
>>   LLVM :: CodeGen/AMDGPU/simplify-libcalls.ll
>>   LLVM :: CodeGen/AMDGPU/sroa-before-unroll.ll
>>   LLVM :: Transforms/LoopUnswitch/AMDGPU/divergent-unswitch.ll
>>
>> (Also I took a closer look, actually it looks like NVPTX also needs updating, but NVPTXTargetMachine only adds two passes)
>>
>> On Fri, Dec 4, 2020 at 3:48 PM Arthur Eubanks <aeubanks at google.com> wrote:
>>>
>>> Currently AMDGPU is the last target which injects passes into the pipeline but hasn't been updated to work with the new pass manager.
>>>
>>> Recently there was added support for the NPM's equivalent of TargetMachine::adjustPassManager(). (Bug, Phab). BPF and Hexagon have their NPM equivalents implemented already, but AMDGPU has a lot of custom passes added by adjustPassManager and hasn't been updated to work with the NPM.
>>>
>>> Could the maintainers of AMDGPU port the necessary passes to the new pass manager add them to AMDGPUTargetMachine::registerPassBuilderCallbacks()? I'm happy to provide any guidance if necessary. Here's an example of porting a pass and adding it to the pipeline.
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev


More information about the llvm-dev mailing list