v3d: fix scheduling dependency tracking for ALU with small immediates
authorIago Toral Quiroga <itoral@igalia.com>
Wed, 5 Jun 2019 06:53:10 +0000 (08:53 +0200)
committerIago Toral Quiroga <itoral@igalia.com>
Thu, 6 Jun 2019 06:16:43 +0000 (08:16 +0200)
We were not accountint for small immediates in the B mux so the scheduler
was interpreting these are regular register file accesses, which could
lead to additional (incorrect) write-read dependencies.

Shader-db changes:

total instructions in shared programs: 9163664 -> 9137263 (-0.29%)
instructions in affected programs: 3931035 -> 3904634 (-0.67%)
helped: 12457
HURT: 2563

total max-temps in shared programs: 1325787 -> 1325597 (-0.01%)
max-temps in affected programs: 5746 -> 5556 (-3.31%)
helped: 186
HURT: 16
helped stats (abs) min: 1 max: 4 x̄: 1.12 x̃: 1
helped stats (rel) min: 1.45% max: 22.22% x̄: 4.42% x̃: 3.28%
HURT stats (abs)   min: 1 max: 3 x̄: 1.12 x̃: 1
HURT stats (rel)   min: 2.86% max: 10.00% x̄: 5.76% x̃: 5.88%
95% mean confidence interval for max-temps value: -1.04 -0.84
95% mean confidence interval for max-temps %-change: -4.16% -3.07%
Max-temps are helped.

Reviewed-by: Eric Anholt <eric@anholt.net>
src/broadcom/compiler/qpu_schedule.c

index d275940c136024859150232a37e39c95472bafc2..290cfe387807ceed0f0d2e7f2ffbd7c7203da8ed 100644 (file)
@@ -153,7 +153,10 @@ process_mux_deps(struct schedule_state *state, struct schedule_node *n,
                 add_read_dep(state, state->last_rf[n->inst->qpu.raddr_a], n);
                 break;
         case V3D_QPU_MUX_B:
-                add_read_dep(state, state->last_rf[n->inst->qpu.raddr_b], n);
+                if (!n->inst->qpu.sig.small_imm) {
+                        add_read_dep(state,
+                                     state->last_rf[n->inst->qpu.raddr_b], n);
+                }
                 break;
         default:
                 add_read_dep(state, state->last_r[mux - V3D_QPU_MUX_R0], n);