From 24ecc9cbcc1c5d03ff4f65d05d62cc805aa6665b Mon Sep 17 00:00:00 2001 From: Jose Maria Casanova Crespo Date: Sun, 8 Feb 2026 15:44:21 +0100 Subject: [PATCH] broadcom/compiler: Add v8dot and setnnmode scheduler dependencies. As nnmode register is read by v8dot instruction we need to add dependencies between setnnmode instructions and v8dot via the nnmode register, so they are scheduled correcty using last_nn_mode virtual register.. Add a last_nn_mode virtual register to the scheduler state and create: - Write dependencies for all SETNNMODE variants - Read dependencies for V8DOT. This follows the same pattern as the existing MULTOP/UMUL24 rtop tracking. Assisted-by: Claude Opus 4.6 Reviewed-by: Iago Toral Quiroga Part-of: --- src/broadcom/compiler/qpu_schedule.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/broadcom/compiler/qpu_schedule.c b/src/broadcom/compiler/qpu_schedule.c index e6702c3ccce..dbf047a7ad3 100644 --- a/src/broadcom/compiler/qpu_schedule.c +++ b/src/broadcom/compiler/qpu_schedule.c @@ -86,6 +86,7 @@ struct schedule_state { struct schedule_node *last_rtop; struct schedule_node *last_unifa; struct schedule_node *last_setmsf; + struct schedule_node *last_nn_mode; enum direction dir; /* Estimated cycle when the current instruction would start. */ uint32_t time; @@ -418,6 +419,16 @@ calculate_deps(struct schedule_state *state, struct schedule_node *n) add_read_dep(state, state->last_setmsf, n); break; + case V3D_QPU_A_SETNNMODE_UU: + case V3D_QPU_A_SETNNMODE_SU: + case V3D_QPU_A_SETNNMODE_US: + case V3D_QPU_A_SETNNMODE_SS: + /* SETNNMODE sets the sign nnmode register. It must be set + * before any v8dot that depends on the mode setting. It + * applies from the current instruction. + */ + add_write_dep(state, &state->last_nn_mode, n); + break; default: break; } @@ -436,6 +447,12 @@ calculate_deps(struct schedule_state *state, struct schedule_node *n) */ add_read_dep(state, state->last_rtop, n); break; + case V3D_QPU_M_V8DOT: + /* V8DOT reads the NN mode to determine sign interpretation + * of the 8-bit dot product inputs. + */ + add_read_dep(state, state->last_nn_mode, n); + break; default: break; }