mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 04:48:08 +02:00
nir/opt_if: Don't split ALU for single block infinite loops
Some infinite loop cases were already covered by other restrictions (e.g. if the loop had a body), but the case with a single block in the loop body wasn't yet. This prevents an infinite loop when optimizing the shader in dEQP-VK.reconvergence.subgroup_uniform_control_flow_ballot.compute.nesting2.3.2 and various others reconvergence tests. Fixes:0881e90c09("nir: Split ALU instructions in loops that read phis") Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> [v1] Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11476> (cherry picked from commitb951929795)
This commit is contained in:
parent
e8627cc66e
commit
e9e1a89158
2 changed files with 6 additions and 4 deletions
|
|
@ -49,7 +49,7 @@
|
|||
"description": "nir/opt_if: Don't split ALU for single block infinite loops",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "0881e90c09965818b02e359474a6f7446b41d647"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -408,6 +408,10 @@ opt_split_alu_of_phi(nir_builder *b, nir_loop *loop)
|
|||
if (header_block->predecessors->entries != 2)
|
||||
return false;
|
||||
|
||||
nir_block *continue_block = find_continue_block(loop);
|
||||
if (continue_block == header_block)
|
||||
return false;
|
||||
|
||||
nir_foreach_instr_safe(instr, header_block) {
|
||||
if (instr->type != nir_instr_type_alu)
|
||||
continue;
|
||||
|
|
@ -499,8 +503,6 @@ opt_split_alu_of_phi(nir_builder *b, nir_loop *loop)
|
|||
}
|
||||
|
||||
/* Split ALU of Phi */
|
||||
nir_block *const continue_block = find_continue_block(loop);
|
||||
|
||||
b->cursor = nir_after_block(prev_block);
|
||||
nir_ssa_def *prev_value = clone_alu_and_replace_src_defs(b, alu, prev_srcs);
|
||||
|
||||
|
|
@ -683,7 +685,7 @@ opt_simplify_bcsel_of_phi(nir_builder *b, nir_loop *loop)
|
|||
* continue_block from the other bcsel source. Both sources have
|
||||
* already been verified to be phi nodes.
|
||||
*/
|
||||
nir_block *const continue_block = find_continue_block(loop);
|
||||
nir_block *continue_block = find_continue_block(loop);
|
||||
nir_phi_instr *const phi = nir_phi_instr_create(b->shader);
|
||||
nir_phi_src *phi_src;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue