Skip to content

nir_to_tgsi: TGSI register allocation

Emma Anholt requested to merge anholt/mesa:ntt-ra into main

Replacement for !14158 (closed).

    Allocating NIR registers ends up being required for drivers like r600 and
    nv30, which don't do their own allocation (except in some cases on r600
    where sb is used).
    
    Rather than add a NIR register liveness impl
    (https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14158), switch
    from NIR-based liveness to just doing the same channel-based liveness
    logic that the NIR registers needed at the TGSI level.  The actual
    liveness code here basically comes straight out of
    brw_vec4_live_variables.cpp.
    
    Since we do the liveness in TGSI now, it also means we don't need to be
    careful about not reading SSA values from later TGSI instructions (which
    may be useful for doing some greedy instruction in generating TGSI
    instructions).
    
    softpipe:
    total temps in shared programs: 563136 -> 332833 (-40.90%)
    temps in affected programs: 552348 -> 322045 (-41.70%)
    
    i915g:
    total instructions in shared programs: 400719 -> 380730 (-4.99%)
    instructions in affected programs: 284760 -> 264771 (-7.02%)
    total tex_indirect in shared programs: 12289 -> 12290 (<.01%)
    tex_indirect in affected programs: 4 -> 5 (25.00%)
    total temps in shared programs: 32172 -> 22086 (-31.35%)
    temps in affected programs: 30647 -> 20561 (-32.91%)
    LOST:   0
    GAINED: 148

    r300:
    total instructions in shared programs: 1472463 -> 1459286 (-0.89%)
    instructions in affected programs: 507009 -> 493832 (-2.60%)
    total temps in shared programs: 212143 -> 201678 (-4.93%)
    temps in affected programs: 78007 -> 67542 (-13.42%)
    
    softpipe:
    total temps in shared programs: 517071 -> 294387 (-43.07%)
    temps in affected programs: 509324 -> 286640 (-43.72%)
Edited by Emma Anholt

Merge request reports

Loading