broadcom/compiler: fix postponed TMU spills with multiple writes

If we are spilling a register that is used in the middle of a TMU
sequence, we postpone the spill until the TMU sequence finishes,
at which point we inject the spill and rewrite the original
instruction to write to the new temp.

However, this doesn't work if the register is written multiple
times during the TMU sequence. In that scenario, we need to ensure
that all writes are rewritten to use the new temp, not just the last
one.

Cc: mesa-stable
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17201>
This commit is contained in:
Iago Toral Quiroga
2022-06-22 08:29:42 +02:00
committed by Marge Bot
parent 0bc65b1d81
commit 98420408d0

View File

@@ -676,12 +676,19 @@ v3d_spill_reg(struct v3d_compile *c, int *acc_nodes, int spill_temp)
* with a new temp though.
*/
if (start_of_tmu_sequence) {
if (postponed_spill) {
postponed_spill->dst =
postponed_spill_temp;
}
if (!postponed_spill ||
vir_get_cond(inst) == V3D_QPU_COND_NONE) {
postponed_spill_temp =
vir_get_temp(c);
add_node(c,
postponed_spill_temp.index,
c->nodes.info[spill_node].class_bits);
}
postponed_spill = inst;
postponed_spill_temp =
vir_get_temp(c);
add_node(c,
postponed_spill_temp.index,
c->nodes.info[spill_node].class_bits);
} else {
v3d_emit_tmu_spill(c, inst,
postponed_spill_temp,