Skip to content
  • Marek Olšák's avatar
    radeonsi: fix hang caused by for loop with exec=0 in LS and ES · b6b6d1ff
    Marek Olšák authored
    LLVM expects that exec != 0 when entering loops and generates this code
    that becomes an infinite loop if exec == 0:
    
    BB5_1:
        vcc_lo = (inverted terminating condition)
        s_and_b32 vcc_lo, exec_lo, vcc_lo
        s_cbranch_vccnz BB5_3    // jump if vcc != 0 (break statement)
        // ... loop body ...
        s_branch BB5_1
    BB5_3:
    
    For non-monolithic VS before TCS, VS before GS, and TES before GS,
    we set exec = (thread enabledmask), which sets 0 for HS-only and GS-only
    waves, causing the infinite loop condition above.
    
    Fix it as follows:
    - set exec = ~0 at the beginning
    - wrap the whole shader (LS and ES) in a conditional block, so that HS-only
      and GS-only waves jump over it and never enter such a loop
    
    The TES before GS hang can be reproduced by gfxbench:
        testfw_app --gfx egl -w 1920 -h 1080 --gl_api gles -t gl_tess
    
    Fixes: 68d6d097
    
     - radeonsi/gfx9: add GFX9 and VEGA10 enums
    
    Acked-by: default avatarPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
    Part-of: <mesa/mesa!8344>
    b6b6d1ff