mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 16:08:04 +02:00
nir: allow nir_lower_phis_to_scalar() on more src types
Rather than only lowering if all srcs are scalarizable we instead check that at least one src is scalarizable. We change undef type to return false otherwise it will cause regressions when it is the only scalarizable src. total instructions in shared programs: 13219105 -> 13024547 (-1.47%) instructions in affected programs: 1153797 -> 959239 (-16.86%) helped: 581 HURT: 74 total cycles in shared programs: 333968972 -> 324807922 (-2.74%) cycles in affected programs: 129809402 -> 120648352 (-7.06%) helped: 571 HURT: 131 total spills in shared programs: 57947 -> 29130 (-49.73%) spills in affected programs: 53364 -> 24547 (-54.00%) helped: 351 HURT: 0 total fills in shared programs: 51310 -> 25468 (-50.36%) fills in affected programs: 44882 -> 19040 (-57.58%) helped: 351 HURT: 0 Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:
parent
6053499f2e
commit
f48527e51a
1 changed files with 13 additions and 3 deletions
|
|
@ -75,10 +75,15 @@ is_phi_src_scalarizable(nir_phi_src *src,
|
|||
return should_lower_phi(nir_instr_as_phi(src_instr), state);
|
||||
|
||||
case nir_instr_type_load_const:
|
||||
case nir_instr_type_ssa_undef:
|
||||
/* These are trivially scalarizable */
|
||||
return true;
|
||||
|
||||
case nir_instr_type_ssa_undef:
|
||||
/* The caller of this function is going to OR the results and we don't
|
||||
* want undefs to count so we return false.
|
||||
*/
|
||||
return false;
|
||||
|
||||
case nir_instr_type_intrinsic: {
|
||||
nir_intrinsic_instr *src_intrin = nir_instr_as_intrinsic(src_instr);
|
||||
|
||||
|
|
@ -150,11 +155,16 @@ should_lower_phi(nir_phi_instr *phi, struct lower_phis_to_scalar_state *state)
|
|||
*/
|
||||
entry = _mesa_hash_table_insert(state->phi_table, phi, (void *)(intptr_t)1);
|
||||
|
||||
bool scalarizable = true;
|
||||
bool scalarizable = false;
|
||||
|
||||
nir_foreach_phi_src(src, phi) {
|
||||
/* This loop ignores srcs that are not scalarizable because its likely
|
||||
* still worth copying to temps if another phi source is scalarizable.
|
||||
* This reduces register spilling by a huge amount in the i965 driver for
|
||||
* Deus Ex: MD.
|
||||
*/
|
||||
scalarizable = is_phi_src_scalarizable(src, state);
|
||||
if (!scalarizable)
|
||||
if (scalarizable)
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue