This series replaces my previous series (https://patchwork.freedesktop.org/series/48138/) that did similar things. Rather than trying to do everything with only local information in nir_opt_algebraic, this series adds a new optimization pass. This new pass looks at how various parameters of a nir_op_flrp are used in other nir_op_flrp instructions to make better choices.
You can compare the results across this whole series, below, with the similar results in the previous series. At least for Intel GPUs, this series does quite a bit better. There are a couple extra loops and a couple lost SIMD16 shaders on Iron Lake, but the trade off is an extra 35 (+32 overall) SIMD16 shaders on Iron Lake and an 38 SIMD16 shaders on GM45. It also shouldn't break the whole universe for non-Intel GPUs. :) Neither of the tested Intel GPUs have an FMA instruction, so I don't know how this series will affect GPUs that lack LRP but have FMA. I did some testing on Ice Lake, which lacks LRP but has FMA, and the results were mixed but generally positive. There is some driver support missing for the FMA on Ice Lake, so those results are not likely to be representative of the final result. I have another series waiting to go out that improves LRP and FMA generation for all of the Intel platforms that support LRP and FMA. That series caused a bunch of regressions on the non-LRP platforms, so this series needs to land first. This series, along with a few patches that didn't pan out, is available at: https://cgit.freedesktop.org/~idr/mesa/log/?h=lower-flrp Iron Lake total instructions in shared programs: 7774533 -> 7676404 (-1.26%) instructions in affected programs: 4436203 -> 4338074 (-2.21%) helped: 19242 HURT: 924 helped stats (abs) min: 1 max: 155 x̄: 5.16 x̃: 3 helped stats (rel) min: 0.11% max: 86.96% x̄: 2.85% x̃: 1.89% HURT stats (abs) min: 1 max: 8 x̄: 1.29 x̃: 1 HURT stats (rel) min: 0.08% max: 6.52% x̄: 1.22% x̃: 1.01% 95% mean confidence interval for instructions value: -4.95 -4.79 95% mean confidence interval for instructions %-change: -2.71% -2.61% Instructions are helped. total cycles in shared programs: 177757572 -> 177292132 (-0.26%) cycles in affected programs: 100318508 -> 99853068 (-0.46%) helped: 18971 HURT: 1407 helped stats (abs) min: 2 max: 930 x̄: 25.18 x̃: 12 helped stats (rel) min: <.01% max: 94.58% x̄: 1.24% x̃: 0.55% HURT stats (abs) min: 2 max: 98 x̄: 8.71 x̃: 6 HURT stats (rel) min: <.01% max: 4.11% x̄: 0.33% x̃: 0.14% 95% mean confidence interval for cycles value: -23.31 -22.37 95% mean confidence interval for cycles %-change: -1.16% -1.09% Cycles are helped. total loops in shared programs: 850 -> 854 (0.47%) loops in affected programs: 0 -> 4 helped: 0 HURT: 4 HURT stats (abs) min: 1 max: 1 x̄: 1.00 x̃: 1 HURT stats (rel) min: 0.00% max: 0.00% x̄: 0.00% x̃: 0.00% 95% mean confidence interval for loops value: 1.00 1.00 95% mean confidence interval for loops %-change: 0.00% 0.00% Loops are HURT. LOST: 3 GAINED: 52 GM45 total instructions in shared programs: 4766579 -> 4715273 (-1.08%) instructions in affected programs: 2372653 -> 2321347 (-2.16%) helped: 9929 HURT: 467 helped stats (abs) min: 1 max: 155 x̄: 5.23 x̃: 3 helped stats (rel) min: 0.11% max: 86.96% x̄: 2.78% x̃: 1.86% HURT stats (abs) min: 1 max: 8 x̄: 1.28 x̃: 1 HURT stats (rel) min: 0.08% max: 6.25% x̄: 1.19% x̃: 1.00% 95% mean confidence interval for instructions value: -5.05 -4.82 95% mean confidence interval for instructions %-change: -2.67% -2.54% Instructions are helped. total cycles in shared programs: 121450872 -> 121161308 (-0.24%) cycles in affected programs: 61826744 -> 61537180 (-0.47%) helped: 9846 HURT: 759 helped stats (abs) min: 2 max: 930 x̄: 30.12 x̃: 12 helped stats (rel) min: <.01% max: 93.33% x̄: 1.30% x̃: 0.58% HURT stats (abs) min: 2 max: 98 x̄: 9.27 x̃: 6 HURT stats (rel) min: <.01% max: 4.11% x̄: 0.33% x̃: 0.13% 95% mean confidence interval for cycles value: -28.06 -26.55 95% mean confidence interval for cycles %-change: -1.23% -1.14% Cycles are helped. total loops in shared programs: 629 -> 631 (0.32%) loops in affected programs: 0 -> 2 helped: 0 HURT: 2 total fills in shared programs: 93 -> 94 (1.08%) fills in affected programs: 81 -> 82 (1.23%) helped: 0 HURT: 1 LOST: 55 GAINED: 55 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev