Module: Mesa
Branch: master
Commit: 87ed614c478aca6683663fc3997b9892f1363600
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=87ed614c478aca6683663fc3997b9892f1363600

Author: Iago Toral Quiroga <[email protected]>
Date:   Fri Mar 12 09:29:07 2021 +0100

broadcom/compiler: flag wrtmuc with a read dependency on last_tmu_config

Instead of using a write depdency. We use last_tmu_config to ensure ordering
of instructions participating in different TMU sequences. To this end,
all sequence terminators flag a write dependency on last_tmu_config, but
wrtmuc is not a sequence terminator, so we can be more flexible by flagging
it as a read depedency. This would prevent it to be moved into a previous
sequence (since it cannot be moved past the previous sequence terminator due
to the read depedency), but it allows it to be reordered with instructions in
the same sequence, which allows us to pair it up more effectively. Particularly,
it allows to pair up a wrtmuc with the sequence terminator of the same sequence,
turning code like this:

nop                  ; mov  tmut, r0     ; thrsw; wrtmuc (tex[0].p0 | 0x3)
nop                  ; nop               ; wrtmuc (tex[0].p1 | 0x0)
nop                  ; mov  tmus, r1

Into this:

nop                  ; mov  tmut, r0     ; thrsw; wrtmuc (tex[0].p0 | 0x3)
nop                  ; mov  tmus, r1     ; wrtmuc (tex[0].p1 | 0x0)

total instructions in shared programs: 13755738 -> 13735183 (-0.15%)
instructions in affected programs: 2510921 -> 2490366 (-0.82%)
helped: 10963
HURT: 485
Instructions are helped.

total max-temps in shared programs: 2322828 -> 2322020 (-0.03%)
max-temps in affected programs: 11303 -> 10495 (-7.15%)
helped: 608
HURT: 19
Max-temps are helped.

total sfu-stalls in shared programs: 31545 -> 31494 (-0.16%)
sfu-stalls in affected programs: 235 -> 184 (-21.70%)
helped: 62
HURT: 11
Sfu-stalls are helped.

total inst-and-stalls in shared programs: 13787283 -> 13766677 (-0.15%)
inst-and-stalls in affected programs: 2525187 -> 2504581 (-0.82%)
helped: 10989
HURT: 477
Inst-and-stalls are helped.

v2: add a comment explaining the read depdency (Piñeiro).

Reviewed-by: Alejandro Piñeiro <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9555>

---

 src/broadcom/compiler/qpu_schedule.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/broadcom/compiler/qpu_schedule.c 
b/src/broadcom/compiler/qpu_schedule.c
index ee1b728468c..7034bbd3fd4 100644
--- a/src/broadcom/compiler/qpu_schedule.c
+++ b/src/broadcom/compiler/qpu_schedule.c
@@ -386,8 +386,12 @@ calculate_deps(struct schedule_state *state, struct 
schedule_node *n)
                 add_write_dep(state, &state->last_tmu_write, n);
         }
 
+        /* Allow wrtmuc to be reordered with other instructions in the
+         * same TMU sequence by using a read dependency on the last TMU
+         * sequence terminator.
+         */
         if (inst->sig.wrtmuc)
-                add_write_dep(state, &state->last_tmu_config, n);
+                add_read_dep(state, state->last_tmu_config, n);
 
         if (inst->sig.ldtlb | inst->sig.ldtlbu)
                 add_write_dep(state, &state->last_tlb, n);

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to