This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU: Move SIWholeQuadMode pass to after machine scheduling
AbandonedPublic

Authored by nhaehnle on Jul 10 2016, 4:41 AM.

Details

Summary

Most of this change is about adjusting the analysis, which can now no longer
rely on SSA form and must use LiveIntervals instead.

WQM-related instructions manipulate EXEC and therefore act as a scheduling
barrier for most instructions. With this change, shaders with a mix of WQM
and exact instructions should be scheduled much better because there is no
EXEC interference. This opens the way for additional improvements.

Diff Detail

Event Timeline

nhaehnle updated this revision to Diff 63420.Jul 10 2016, 4:41 AM
nhaehnle retitled this revision from to AMDGPU: Move SIWholeQuadMode pass to after machine scheduling.
nhaehnle updated this object.
nhaehnle added a subscriber: llvm-commits.
arsenm added inline comments.Jul 11 2016, 1:49 PM
lib/Target/AMDGPU/SIWholeQuadMode.cpp
151

This should be const or moved to a static helper function. I think it will warn as unused in release builds

236

Single quotes around single character

241

ditto

314–315

You can combine these into one assert

553

Can you move the bit test into a helper function in the BI struct, same for everywhere else

arsenm added inline comments.Jul 11 2016, 6:54 PM
lib/Target/AMDGPU/SIWholeQuadMode.cpp
188–191

I think you need to add the corresponding passes with INITIALIZE_PASS_DEPENDENCY

arsenm added inline comments.Jul 11 2016, 7:03 PM
lib/Target/AMDGPU/SIWholeQuadMode.cpp
655

Why are you using SlotIndexes directly? I think in other places LIS->ReplaceMachineInstrInMaps is used

nhaehnle updated this revision to Diff 64246.Jul 17 2016, 3:11 AM
nhaehnle marked 5 inline comments as done.

Rebase on top of recent changes, address review comments.

nhaehnle updated this revision to Diff 64290.Jul 18 2016, 2:44 AM

Remove special handling of SI_KILL (slipped back in after rebase).

arsenm added inline comments.Jul 21 2016, 3:39 PM
lib/Target/AMDGPU/SIWholeQuadMode.cpp
713

You shouldn't need a const_cast (I thought I had a patch that fixed this before)

nhaehnle updated this revision to Diff 65494.Jul 26 2016, 4:17 AM
nhaehnle marked an inline comment as done.

Rebase and address review comments.

nhaehnle updated this revision to Diff 66783.Aug 4 2016, 3:26 AM

Another rebase and ping.

Looks like some comments I wrote earlier were accidentally not sent...

lib/Target/AMDGPU/SIWholeQuadMode.cpp
151

Changed to const. I see no unused warning yet, perhaps that only applies to static functions.

241

Done.

314–315

I'd personally rather not, since they're logically about different things: the first one is about not changing an already marked instruction, the second about making sure that both flags are not set simultaneously.

553

The tests are all quite different, one would need many different helper functions. I think it would make the code harder to follow.

655

Done.

713

Thanks, that got lost in the rebase. Fixed now.

michel.daenzer added inline comments.
lib/Target/AMDGPU/SIWholeQuadMode.cpp
325–326

Also, by using separate assert statements for each condition, it's immediately obvious which condition wasn't satisfied.

This is fine with me: LGTM.

This will save recomputing LiveIntervals an extra time. I also might need this to make SIOptimizeExecMaskingPreRA correct

test/CodeGen/AMDGPU/wqm.ll
516

Intrinsics need updating

nhaehnle abandoned this revision.Jun 23 2020, 4:54 AM