This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU/SI: Fix two missing NodeNum checks for SISched
Needs RevisionPublic

Authored by axeldavy on Jun 9 2018, 10:45 AM.

Details

Summary

SIScheduleDAGMI::moveLowLatencies was potentially calling isLowLatencyInstruction for SUs with NodeNum >= DAGSize, which is illegal.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=99994

Diff Detail

Repository
rL LLVM

Event Timeline

axeldavy created this revision.Jun 9 2018, 10:45 AM

Missing test?

It was quite hard and a long work to find a test for this issue.

A COPY operation doesn't usually have ExitSU as successor.
The following test (extracted from crashing app) triggers this behaviour on llvm 5 though:

---
name:            sisched-crash
tracksRegLiveness: true
registers:
  - { id: 0, class: vreg_512, preferred-register: '' }
body:             |
  bb.0:
  liveins:
    undef %0.sub0 = V_MOV_B32_e32 -1063317674, implicit %exec
    %0.sub1 = V_MOV_B32_e32 -1069424300, implicit %exec
    %0.sub2 = V_MOV_B32_e32 -1073212503, implicit %exec
    %0.sub3 = V_MOV_B32_e32 -1077848048, implicit %exec
    %0.sub4 = V_MOV_B32_e32 -1081645570, implicit %exec
    %0.sub5 = V_MOV_B32_e32 -1091633047, implicit %exec
    %0.sub6 = V_MOV_B32_e32 1039433088, implicit %exec
    %0.sub7 = V_MOV_B32_e32 1060467916, implicit %exec
    %0.sub8 = V_MOV_B32_e32 1067795870, implicit %exec
    %0.sub9 = COPY %0.sub8
...

I've no clue why this particular sequence of instructions (I tried smaller %0 register, writing fewer subs and it doesn't fail !).

The test doesn't crash though when tested under llvm svn.

I don't see any other way of triggering the 'ExitSU among the successors of a COPY op'.
Maybe the bug is fixed with svn (I have no more time to test with mesa linked to llvm svn), but I'd suggest merge the fix anyway to be more future-proof.

Is this still an issue?

Herald added a project: Restricted Project. · View Herald TranscriptFeb 22 2019, 7:03 AM
Herald added a subscriber: jvesely. · View Herald Transcript

Is this still an issue?

I don't know if the issue can still be triggered, but the fix won't harm.

arsenm accepted this revision.Feb 13 2020, 4:31 PM

Test would be nice

This revision is now accepted and ready to land.Feb 13 2020, 4:31 PM
arsenm requested changes to this revision.Dec 15 2022, 4:05 PM

Please rebase if still relevant

This revision now requires changes to proceed.Dec 15 2022, 4:05 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 15 2022, 4:05 PM
Herald added a subscriber: kosarev. · View Herald Transcript