pan/bi: Implement b2i with MUX
The result_type modifier propagation looks for MUX instructions, so using this canonical b2i implementation allows the sequence b2i(cmp) to be fused. It's also faster on its own: on Valhall, MUX may be implemented as CSEL on the CVT unit, while AND may only be implemented on the SFU unit. So in case this doesn't get fused, we expect 4x better throughput for b2i with this implementation. Similarly, on Bifrost, MUX may be scheduled to either unit (as CSEL on FMA or MUX on ADD), whereas AND may only be scheduled to FMA. Results on Mali-G52: total instructions in shared programs: 2419171 -> 2414814 (-0.18%) instructions in affected programs: 272203 -> 267846 (-1.60%) helped: 767 HURT: 0 helped stats (abs) min: 1.0 max: 138.0 x̄: 5.68 x̃: 2 helped stats (rel) min: 0.12% max: 15.57% x̄: 2.09% x̃: 0.68% 95% mean confidence interval for instructions value: -6.68 -4.68 95% mean confidence interval for instructions %-change: -2.37% -1.82% Instructions are helped. total tuples in shared programs: 1932822 -> 1929234 (-0.19%) tuples in affected programs: 76485 -> 72897 (-4.69%) helped: 380 HURT: 3 helped stats (abs) min: 1.0 max: 138.0 x̄: 9.46 x̃: 1 helped stats (rel) min: 0.14% max: 15.96% x̄: 3.81% x̃: 0.92% HURT stats (abs) min: 1.0 max: 6.0 x̄: 2.67 x̃: 1 HURT stats (rel) min: 0.38% max: 8.57% x̄: 3.80% x̃: 2.44% 95% mean confidence interval for tuples value: -11.30 -7.44 95% mean confidence interval for tuples %-change: -4.27% -3.22% Tuples are helped. total clauses in shared programs: 356094 -> 355992 (-0.03%) clauses in affected programs: 3264 -> 3162 (-3.12%) helped: 80 HURT: 0 helped stats (abs) min: 1.0 max: 9.0 x̄: 1.27 x̃: 1 helped stats (rel) min: 0.81% max: 50.00% x̄: 4.83% x̃: 3.39% 95% mean confidence interval for clauses value: -1.49 -1.06 95% mean confidence interval for clauses %-change: -6.23% -3.43% Clauses are helped. total cycles in shared programs: 167337.10 -> 167329.19 (<.01%) cycles in affected programs: 510.08 -> 502.17 (-1.55%) helped: 80 HURT: 2 helped stats (abs) min: 0.041665999999999315 max: 0.7916659999999993 x̄: 0.10 x̃: 0 helped stats (rel) min: 0.51% max: 13.64% x̄: 2.12% x̃: 1.34% HURT stats (abs) min: 0.041665999999999315 max: 0.0416669999999999 x̄: 0.04 x̃: 0 HURT stats (rel) min: 0.39% max: 2.78% x̄: 1.58% x̃: 1.58% 95% mean confidence interval for cycles value: -0.12 -0.07 95% mean confidence interval for cycles %-change: -2.59% -1.48% Cycles are helped. total arith in shared programs: 73819.54 -> 73669.25 (-0.20%) arith in affected programs: 2840.54 -> 2690.25 (-5.29%) helped: 383 HURT: 3 helped stats (abs) min: 0.041665999999999315 max: 5.75 x̄: 0.39 x̃: 0 helped stats (rel) min: 0.33% max: 18.81% x̄: 4.39% x̃: 0.98% HURT stats (abs) min: 0.041665999999999315 max: 0.25 x̄: 0.11 x̃: 0 HURT stats (rel) min: 0.39% max: 8.96% x̄: 4.04% x̃: 2.78% 95% mean confidence interval for arith value: -0.47 -0.31 95% mean confidence interval for arith %-change: -4.93% -3.71% Arith are helped. total quadwords in shared programs: 1679798 -> 1676259 (-0.21%) quadwords in affected programs: 72826 -> 69287 (-4.86%) helped: 381 HURT: 15 helped stats (abs) min: 1.0 max: 142.0 x̄: 9.35 x̃: 1 helped stats (rel) min: 0.25% max: 18.87% x̄: 4.33% x̃: 1.13% HURT stats (abs) min: 1.0 max: 6.0 x̄: 1.47 x̃: 1 HURT stats (rel) min: 0.30% max: 6.25% x̄: 0.77% x̃: 0.35% 95% mean confidence interval for quadwords value: -10.76 -7.11 95% mean confidence interval for quadwords %-change: -4.71% -3.56% Quadwords are helped. Results on Mali-G57: total instructions in shared programs: 2704193 -> 2699317 (-0.18%) instructions in affected programs: 293366 -> 288490 (-1.66%) helped: 758 HURT: 5 helped stats (abs) min: 1.0 max: 151.0 x̄: 6.45 x̃: 2 helped stats (rel) min: 0.11% max: 22.22% x̄: 2.05% x̃: 0.64% HURT stats (abs) min: 1.0 max: 7.0 x̄: 2.20 x̃: 1 HURT stats (rel) min: 0.22% max: 1.69% x̄: 0.87% x̃: 1.08% 95% mean confidence interval for instructions value: -7.42 -5.36 95% mean confidence interval for instructions %-change: -2.27% -1.79% Instructions are helped. total cycles in shared programs: 141711.73 -> 141711.84 (<.01%) cycles in affected programs: 214.36 -> 214.47 (0.05%) helped: 4 HURT: 42 helped stats (abs) min: 0.015625 max: 0.359375 x̄: 0.20 x̃: 0 helped stats (rel) min: 1.85% max: 12.78% x̄: 9.12% x̃: 10.93% HURT stats (abs) min: 0.015625 max: 0.09375 x̄: 0.02 x̃: 0 HURT stats (rel) min: 0.17% max: 17.65% x̄: 0.84% x̃: 0.34% 95% mean confidence interval for cycles value: -0.02 0.03 95% mean confidence interval for cycles %-change: -1.23% 1.17% Inconclusive result (value mean confidence interval includes 0). total cvt in shared programs: 14479.14 -> 14474.19 (-0.03%) cvt in affected programs: 2877.05 -> 2872.09 (-0.17%) helped: 508 HURT: 209 helped stats (abs) min: 0.015625 max: 0.453125 x̄: 0.02 x̃: 0 helped stats (rel) min: 0.25% max: 16.67% x̄: 1.23% x̃: 0.37% HURT stats (abs) min: 0.015625 max: 0.296875 x̄: 0.03 x̃: 0 HURT stats (rel) min: 0.15% max: 18.18% x̄: 1.70% x̃: 0.34% 95% mean confidence interval for cvt value: -0.01 -0.00 95% mean confidence interval for cvt %-change: -0.57% -0.18% Cvt are helped. total sfu in shared programs: 7875.69 -> 7590.75 (-3.62%) sfu in affected programs: 1567.38 -> 1282.44 (-18.18%) helped: 906 HURT: 0 helped stats (abs) min: 0.0625 max: 8.625 x̄: 0.31 x̃: 0 helped stats (rel) min: 2.38% max: 100.00% x̄: 16.80% x̃: 5.63% 95% mean confidence interval for sfu value: -0.37 -0.26 95% mean confidence interval for sfu %-change: -18.43% -15.17% Sfu are helped. total quadwords in shared programs: 1468152 -> 1465800 (-0.16%) quadwords in affected programs: 37104 -> 34752 (-6.34%) helped: 161 HURT: 2 helped stats (abs) min: 8.0 max: 80.0 x̄: 14.71 x̃: 8 helped stats (rel) min: 1.67% max: 20.00% x̄: 8.05% x̃: 7.69% HURT stats (abs) min: 8.0 max: 8.0 x̄: 8.00 x̃: 8 HURT stats (rel) min: 3.57% max: 3.85% x̄: 3.71% x̃: 3.71% 95% mean confidence interval for quadwords value: -16.29 -12.57 95% mean confidence interval for quadwords %-change: -8.58% -7.22% Quadwords are helped. Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16857>
This commit is contained in:
parent
8f3b62f87e
commit
e57dfed419
|
@ -2797,7 +2797,7 @@ bi_emit_alu(bi_builder *b, nir_alu_instr *instr)
|
|||
case nir_op_b2i8:
|
||||
case nir_op_b2i16:
|
||||
case nir_op_b2i32:
|
||||
bi_lshift_and_to(b, sz, dst, s0, bi_imm_uintN(1, sz), bi_imm_u8(0));
|
||||
bi_mux_to(b, sz, dst, bi_imm_u8(0), bi_imm_uintN(1, sz), s0, BI_MUX_INT_ZERO);
|
||||
break;
|
||||
|
||||
case nir_op_f2b16:
|
||||
|
|
Loading…
Reference in New Issue