Skip to content

aco: calculate register demand per instruction as maximum necessary to execute the instruction

Previously, the register demand per instruction was calculated as the number of
    live variables in the register file after executing an instruction plus additional
    temporary registers, necessary during the execution of the instruction.
    With this change, now it also includes all variables which are live right before
    executing an instruction, i.e. killed Operands.
    
    Care has been taken so that the invariant
    
    register_demand[idx] = register_demand[idx - 1] - get_temp_registers(prev_instr)
                            + get_live_changes(instr) + get_temp_registers(instr)
    
    still holds.
    
    Slight changes in scheduling:
    
    Totals from 316 (0.40% of 79395) affected shaders: (GFX11)
    Instrs: 301329 -> 300777 (-0.18%); split: -0.31%, +0.12%
    CodeSize: 1577976 -> 1576204 (-0.11%); split: -0.21%, +0.10%
    SpillSGPRs: 448 -> 447 (-0.22%)
    Latency: 1736349 -> 1726182 (-0.59%); split: -2.01%, +1.42%
    InvThroughput: 243894 -> 243883 (-0.00%); split: -0.03%, +0.03%
    VClause: 6134 -> 6280 (+2.38%); split: -1.04%, +3.42%
    SClause: 6142 -> 6137 (-0.08%); split: -0.13%, +0.05%
    Copies: 14037 -> 14032 (-0.04%); split: -0.56%, +0.52%
    Branches: 3284 -> 3283 (-0.03%)
    VALU: 182750 -> 182718 (-0.02%); split: -0.04%, +0.03%
    SALU: 18522 -> 18538 (+0.09%)

Interacts with !29729 and !29730

Merge request reports