mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 00:38:48 +02:00
nir/opt_loop: always try to peel initial break from loops with unrolling hint
This allows to unroll these loops, even if loop analyze is unable to calculate the iteration count. As always with loops, the throughput stats are meaningless. Totals from 6 (0.00% of 202440) affected shaders: (Navi48) Instrs: 7825 -> 6201 (-20.75%) CodeSize: 37056 -> 30412 (-17.93%) Latency: 21563 -> 16934 (-21.47%) InvThroughput: 144649 -> 77962 (-46.10%) SClause: 139 -> 133 (-4.32%) Copies: 536 -> 388 (-27.61%) Branches: 156 -> 84 (-46.15%) PreVGPRs: 298 -> 296 (-0.67%); split: -1.01%, +0.34% VALU: 2493 -> 2378 (-4.61%); split: -4.65%, +0.04% SALU: 3263 -> 2199 (-32.61%) SMEM: 188 -> 183 (-2.66%) Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40349>
This commit is contained in:
parent
738cc6a7db
commit
806fcc6193
1 changed files with 7 additions and 0 deletions
|
|
@ -356,6 +356,13 @@ should_peel_initial_break(nir_loop *loop)
|
|||
nir_cf_node *if_node = nir_cf_node_next(&header_block->cf_node);
|
||||
nir_if *nif = nir_cf_node_as_if(if_node);
|
||||
|
||||
/* If this loop is supposed to get unrolled, try doing so by peeling
|
||||
* one iteration at a time. This works in cases where loop analysis
|
||||
* is not able to calculate the iteration count.
|
||||
*/
|
||||
if (loop->control & nir_loop_control_unroll)
|
||||
return can_constant_fold(nir_get_scalar(nif->condition.ssa, 0), header_block);
|
||||
|
||||
/* This loop is already in do-while form. */
|
||||
if (loop->do_while)
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue