Instructions like WAVE_BARRIER and SI_MASKED_UNREACHABLE
are only placeholders to prevent certain unwanted
transformations and will get discarded during assembly emission.
They should not be counted during nop insertion.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Time | Test | |
---|---|---|
2,240 ms | x64 debian > libomp.api::omp_get_wtime.c |
Event Timeline
There was a call to getNumWaitStates in AdvanceCycle. I presumed a zero waitstate here is equivalent to an early return.
Isn't it?
https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp#L365
I think the early return on isMetaInstruction avoids pushing the instruction into EmittedInstrs
I think AdvanceCycle shall do the same as with isMetaInstruction() if getNumWaitStates() returned 0.
The AdvanceCycle will be called by both Post-RA scheduler and hazard recognizer. I am beginning to think that the early return is necessary to prevent adding it into EmittedInstrs.
Alternatively, how about return early when NumWaitStates is zero?
https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp#L366
That's what I mean by "I think AdvanceCycle shall do the same as with isMetaInstruction() if getNumWaitStates() returned 0."
Right, it matters in the post-RA scheduler. For example, if you replace the KILL with WAVE_BARRIER in the test hazard-kill.mir, the scheduler doesn't see the hazard.
Added early return from AdvanceCycle if NumWaitStates is zero.
It is required for Post-RA scheduler.