From 3f50d72ec562135a012aa9925610dc71161e495a Mon Sep 17 00:00:00 2001 From: Faith Ekstrand Date: Fri, 29 Mar 2024 09:10:34 -0500 Subject: [PATCH] nak: Don't do a scope break cascade for nir_jump_halt Fixes: 9312356d999f ("nak/nir: Add a control-flow lowering pass") Acked-by: Alyssa Rosenzweig Reviewed-by: M Henning Part-of: --- src/nouveau/compiler/nak_nir_lower_cf.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/nouveau/compiler/nak_nir_lower_cf.c b/src/nouveau/compiler/nak_nir_lower_cf.c index 6bd81b0e584..2319a1c5fdf 100644 --- a/src/nouveau/compiler/nak_nir_lower_cf.c +++ b/src/nouveau/compiler/nak_nir_lower_cf.c @@ -97,7 +97,6 @@ jump_target_scope_type(nir_jump_type jump_type) switch (jump_type) { case nir_jump_break: return SCOPE_TYPE_LOOP_BREAK; case nir_jump_continue: return SCOPE_TYPE_LOOP_CONT; - case nir_jump_halt: return SCOPE_TYPE_SHADER; default: unreachable("Unknown jump type"); } @@ -268,8 +267,18 @@ lower_cf_list(nir_builder *b, nir_def *esc_reg, struct scope *parent_scope, nir_cf_extract(&instrs, start, end); b->cursor = nir_cf_reinsert(&instrs, b->cursor); - if (jump != NULL) - break_scopes(b, esc_reg, parent_scope, jump->type); + if (jump != NULL) { + if (jump->type == nir_jump_halt) { + /* Halt instructions map to OpExit on NVIDIA hardware and + * exited lanes never block a bsync. + */ + nir_instr_remove(&jump->instr); + nir_builder_instr_insert(b, &jump->instr); + } else { + /* Everything else needs a break cascade */ + break_scopes(b, esc_reg, parent_scope, jump->type); + } + } break; }