This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Don't implement GCNHazardRecognizer::PreEmitNoops(SUnit *)
ClosedPublic

Authored by foad on May 6 2020, 3:29 AM.

Details

Summary

When called from the post-RA scheduler, hazards have already been
handled by getHazardType returning NoopHazard, so PreEmitNoops always
returns zero. Remove it. NFC.

Historical note: PreEmitNoops was added to the hazard recognizer
interface as an optional feature to support dispatch group formation on
the POWER target:
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20131202/197470.html
So it seems right that we shouldn't need to implement it.

We do still implement the other overload PreEmitNoops(MachineInstr *)
because that is used by the PostRAHazardRecognizer pass.

Diff Detail

Event Timeline

foad created this revision.May 6 2020, 3:29 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 6 2020, 3:29 AM
arsenm accepted this revision.May 6 2020, 7:03 AM

Was this actually emitting nops or dead?

This revision is now accepted and ready to land.May 6 2020, 7:03 AM
foad added a comment.May 6 2020, 7:36 AM

Was this actually emitting nops or dead?

It was called but it always returned zero.

rampitec added inline comments.May 6 2020, 8:07 AM
llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp
232

Do we still need this variable? I am not sure, it is initialized as false, but is there an alive path after this change?

This revision was automatically updated to reflect the committed changes.
foad marked 2 inline comments as done.May 6 2020, 9:16 AM
foad added inline comments.
llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp
232

Yes I think we still need this to select different behaviour in getWaitStatesSince. For the post-RA scheduler usage, the variable just defaults to false. For standalone usage, PreEmitNoops sets it to true. I am still working on further cleanups in this area.