This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Reserve all AGPRs on targets which do not have them
ClosedPublic

Authored by rampitec on Jul 30 2019, 12:18 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

rampitec created this revision.Jul 30 2019, 12:18 PM
This revision is now accepted and ready to land.Jul 30 2019, 12:26 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJul 30 2019, 12:30 PM
bjope added a subscriber: bjope.Aug 21 2020, 6:07 AM
bjope added inline comments.
llvm/trunk/test/CodeGen/AMDGPU/spill-vgpr-to-agpr.ll
2

What is the idea behind this test. This single RUN-line takes more than 50 seconds to run, just to discover a failure?

A little bit annoying when llvm-lit test/CodeGen/AMDGPU/ only takes 11s when removing this particular RUN-line.

arsenm added inline comments.Aug 21 2020, 6:32 AM
llvm/trunk/lib/Target/AMDGPU/SIRegisterInfo.cpp
223

Do we really need to do this? If there are no AGPRs, no AGPRs virtual registers should be created for this to come up

rampitec added inline comments.Aug 21 2020, 11:48 AM
llvm/trunk/lib/Target/AMDGPU/SIRegisterInfo.cpp
223

It is just a safety net. Somebody can use an inline asm with agprs (and sometimes do).

rampitec added inline comments.Aug 21 2020, 11:53 AM
llvm/trunk/test/CodeGen/AMDGPU/spill-vgpr-to-agpr.ll
2

I just have tried it. This run took 4.5 seconds with the debug build. It is still fairly long, but nothing close to 50s.

bjope added inline comments.Aug 21 2020, 12:17 PM
llvm/trunk/test/CodeGen/AMDGPU/spill-vgpr-to-agpr.ll
2

Ehm, ok, sorry! Seem to be something downstream.

Using latest version from upstream master is fast (0.6s).
But on our development track it seem to spend an awful lot of time in "SI post-RA bundler". It must be some modification that we have done downstream, so I'll try to debug that myself.

arsenm added inline comments.Aug 21 2020, 12:18 PM
llvm/trunk/lib/Target/AMDGPU/SIRegisterInfo.cpp
223

This would need a deliberate attempt to diagnose it. This won't stop you from using AGPRs since it still won't stop you from using physical AGPRs. I think this would just break regalloc in an unpredicatable way.

These loops over all registers aren't exactly cheap either, and getReservedRegs is called a few too many times. This should probably be removed

rampitec added inline comments.Aug 21 2020, 12:19 PM
llvm/trunk/lib/Target/AMDGPU/SIRegisterInfo.cpp
223

Well, maybe. It does not give 100% guarantee anyway.