From 31c8e14df318b1e8c0dd34a00deeadb5f89881da Mon Sep 17 00:00:00 2001 From: Jose Maria Casanova Crespo Date: Fri, 10 Apr 2026 19:27:32 +0200 Subject: [PATCH] broadcom/compiler: MULTOP in branch delay slots doesn't generate RTOP hazard On unconditional branches qpu_set_branch_targets() can fill the delay slots with a copy of the first instructions of the successor block. As the qpu validator is sequential it would detect an incorrect hazard when the MULTOP was copied but the UMUL24 wasn't. This was identified in debug build when running gfxbench5.aztec_ruins_vk. Assisted-by: Claude Opus 4.6 Reviewed-by: Iago Toral Quiroga Part-of: --- src/broadcom/compiler/qpu_validate.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/broadcom/compiler/qpu_validate.c b/src/broadcom/compiler/qpu_validate.c index 3041ed86522..4ab27ea832c 100644 --- a/src/broadcom/compiler/qpu_validate.c +++ b/src/broadcom/compiler/qpu_validate.c @@ -139,8 +139,17 @@ qpu_validate_inst(struct v3d_qpu_validate_state *state, struct qinst *qinst) assert(inst->type == V3D_QPU_INSTR_TYPE_ALU); - if (inst->alu.mul.op == V3D_QPU_M_MULTOP) - state->rtop_valid = true; + if (inst->alu.mul.op == V3D_QPU_M_MULTOP) { + /* On unconditional branches qpu_set_branch_targets() can fill the + * delay slots with a copy of the first instructions of the + * successor block. As the qpu validator is sequential it would + * detect a non real hazard when the MULTOP was copied but the + * UMUL24 wasn't. So we disable the hazard detection mechanism in + * this case. + */ + if (!in_branch_delay_slots(state)) + state->rtop_valid = true; + } if (inst->alu.mul.op == V3D_QPU_M_UMUL24) { if (state->rtop_hazard)