nir/loop_analyze: also set force_unroll if the array_size is larger than max_trip_count
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

Loop peeling can reduce the trip_count. It is also not
necessary that the array_size exactly matches the trip_count.

Totals from 54 (0.06% of 84383) affected shaders: (Navi48)

MaxWaves: 758 -> 884 (+16.62%)
Instrs: 284511 -> 343292 (+20.66%)
CodeSize: 1524940 -> 1837996 (+20.53%)
VGPRs: 5904 -> 5544 (-6.10%)
Scratch: 18432 -> 0 (-inf%)
Latency: 7317179 -> 7186789 (-1.78%); split: -1.80%, +0.02%
InvThroughput: 1646024 -> 1545357 (-6.12%); split: -6.19%, +0.08%
VClause: 5840 -> 6867 (+17.59%); split: -1.92%, +19.50%
SClause: 6959 -> 7935 (+14.03%)
Copies: 25516 -> 31310 (+22.71%); split: -4.87%, +27.58%
Branches: 9205 -> 10571 (+14.84%); split: -3.25%, +18.09%
PreSGPRs: 5586 -> 5394 (-3.44%); split: -3.67%, +0.23%
PreVGPRs: 5087 -> 4674 (-8.12%); split: -8.18%, +0.06%
VALU: 145243 -> 174719 (+20.29%)
SALU: 53128 -> 67594 (+27.23%); split: -0.00%, +27.23%
VMEM: 8911 -> 10221 (+14.70%); split: -1.41%, +16.11%
SMEM: 8519 -> 9509 (+11.62%)
VOPD: 419 -> 796 (+89.98%)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39778>
This commit is contained in:
Daniel Schürmann 2026-02-04 09:58:36 +01:00 committed by Marge Bot
parent b5439c4fbf
commit e362011cca

View file

@ -1308,7 +1308,7 @@ force_unroll_array_access(loop_info_state *state, nir_deref_instr *deref,
{
unsigned array_size = find_array_access_via_induction(state, deref, NULL);
if (array_size) {
if ((array_size == state->loop->info->max_trip_count) &&
if ((array_size >= state->loop->info->max_trip_count) &&
nir_deref_mode_must_be(deref, nir_var_shader_in |
nir_var_shader_out |
nir_var_shader_temp |