ir3/legalize: apply initial GS/TCS sync in legalize
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

When applying the sync flags after legalize, we might run into the issue
of the first instruction not supporting (ss)/(sy). We cannot insert a
nop at that point anymore since jump targets have already been
calculated. Fix this by applying the sync flags during legalize, where
all other sync flags are also applied.

Signed-off-by: Job Noorman <jnoorman@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35653>
This commit is contained in:
Job Noorman 2025-06-20 11:57:12 +02:00 committed by Marge Bot
parent e51fa32aac
commit bc10c812d6
2 changed files with 9 additions and 12 deletions

View file

@ -5880,18 +5880,6 @@ ir3_compile_shader_nir(struct ir3_compiler *compiler,
*/
IR3_PASS(ir, ir3_legalize, so, &max_bary);
/* Set (ss)(sy) on first TCS and GEOMETRY instructions, since we don't
* know what we might have to wait on when coming in from VS chsh.
*/
if (so->type == MESA_SHADER_TESS_CTRL || so->type == MESA_SHADER_GEOMETRY) {
struct ir3_block *first_block = ir3_start_block(ir);
if (!list_is_empty(&first_block->instr_list)) {
struct ir3_instruction *first_instr = list_first_entry(
&first_block->instr_list, struct ir3_instruction, node);
first_instr->flags |= IR3_INSTR_SS | IR3_INSTR_SY;
}
}
if (ctx->compiler->gen >= 7 && so->type == MESA_SHADER_COMPUTE) {
struct ir3_instruction *end = ir3_find_end(so->ir);
struct ir3_instruction *lock =

View file

@ -423,6 +423,15 @@ ir3_merge_pred_legalize_states(struct ir3_legalize_state *state,
&state->needs_ss_or_sy_scalar_war,
&pstate->needs_ss_or_sy_scalar_war);
}
gl_shader_stage stage = block->shader->type;
if (stage == MESA_SHADER_TESS_CTRL || stage == MESA_SHADER_GEOMETRY) {
if (block == ir3_start_block(block->shader)) {
state->force_ss = true;
state->force_sy = true;
}
}
}
static bool