Add a bottom-up pre-RA list scheduler that aims to reduce register pressure, roughly the same as we use on Midgard to great effect. It uses a simple heuristic: greedily select instructions that have reduce liveness. To avoid regressions, the algorithm throws away schedules that increase maximum number of lives (used as an estimate of register pressure -- if we had SSA form, this would be exact). We might be better off using Sarkar. But for something I could type out in an afternoon, I'll happily accept a >50% reduction in spills. Instruction count is regressed due to extra moves around the blend shader ABI in some cases, at least on Bifrost this is mostly hidden by the clause scheduler. Thread count and spills/fills are both much improved here. There are numerous opportunities for future improvements to pre-RA scheduling: * Better heuristics? (Something more global than liveness alone) * Reducing false dependencies with memory access * Improve ILP for message-passing instructions? This is a tradeoff. * Simplify the code if we have SSA in the future. But for now, I think this is well worth it already. v2: Various clean-ups and memory leak fix (Icecream95). Reduce false dependencies to eliminate spilling in more shaders. shader-db stats on Mali-G52: total instructions in shared programs: 2438841 -> 2439698 (0.04%) instructions in affected programs: 1206421 -> 1207278 (0.07%) helped: 3113 HURT: 4011 helped stats (abs) min: 1.0 max: 50.0 x̄: 3.25 x̃: 2 helped stats (rel) min: 0.13% max: 44.83% x̄: 4.09% x̃: 2.11% HURT stats (abs) min: 1.0 max: 18.0 x̄: 2.73 x̃: 2 HURT stats (rel) min: 0.11% max: 57.14% x̄: 3.86% x̃: 2.07% 95% mean confidence interval for instructions value: 0.02 0.22 95% mean confidence interval for instructions %-change: 0.23% 0.54% Instructions are HURT. total tuples in shared programs: 1927077 -> 1946583 (1.01%) tuples in affected programs: 1118627 -> 1138133 (1.74%) helped: 2874 HURT: 6295 helped stats (abs) min: 1.0 max: 82.0 x̄: 3.51 x̃: 2 helped stats (rel) min: 0.17% max: 33.33% x̄: 4.60% x̃: 3.57% HURT stats (abs) min: 1.0 max: 47.0 x̄: 4.70 x̃: 3 HURT stats (rel) min: 0.20% max: 50.00% x̄: 5.16% x̃: 4.32% 95% mean confidence interval for tuples value: 2.00 2.25 95% mean confidence interval for tuples %-change: 1.97% 2.23% Tuples are HURT. total clauses in shared programs: 356053 -> 357793 (0.49%) clauses in affected programs: 151578 -> 153318 (1.15%) helped: 2196 HURT: 3813 helped stats (abs) min: 1.0 max: 49.0 x̄: 2.16 x̃: 1 helped stats (rel) min: 0.18% max: 69.01% x̄: 10.26% x̃: 8.33% HURT stats (abs) min: 1.0 max: 25.0 x̄: 1.70 x̃: 1 HURT stats (rel) min: 0.57% max: 66.67% x̄: 10.64% x̃: 8.33% 95% mean confidence interval for clauses value: 0.22 0.36 95% mean confidence interval for clauses %-change: 2.68% 3.33% Clauses are HURT. total cycles in shared programs: 167761.17 -> 167922.04 (0.10%) cycles in affected programs: 24494.21 -> 24655.08 (0.66%) helped: 862 HURT: 3054 helped stats (abs) min: 0.041665999999999315 max: 53.0 x̄: 0.69 x̃: 0 helped stats (rel) min: 0.28% max: 76.81% x̄: 5.65% x̃: 3.03% HURT stats (abs) min: 0.041665999999999315 max: 2.0416659999999993 x̄: 0.25 x̃: 0 HURT stats (rel) min: 0.26% max: 41.18% x̄: 4.91% x̃: 3.92% 95% mean confidence interval for cycles value: -0.04 0.12 95% mean confidence interval for cycles %-change: 2.36% 2.81% Inconclusive result (value mean confidence interval includes 0). total arith in shared programs: 73875.37 -> 74393.17 (0.70%) arith in affected programs: 43142.42 -> 43660.21 (1.20%) helped: 3632 HURT: 5443 helped stats (abs) min: 0.041665999999999315 max: 1.2083360000000027 x̄: 0.15 x̃: 0 helped stats (rel) min: 0.22% max: 100.00% x̄: 6.70% x̃: 4.76% HURT stats (abs) min: 0.041665999999999315 max: 2.0416659999999993 x̄: 0.19 x̃: 0 HURT stats (rel) min: 0.00% max: 166.67% x̄: 5.91% x̃: 4.08% 95% mean confidence interval for arith value: 0.05 0.06 95% mean confidence interval for arith %-change: 0.65% 1.07% Arith are HURT. total texture in shared programs: 11936 -> 11936 (0.00%) texture in affected programs: 0 -> 0 helped: 0 HURT: 0 total vary in shared programs: 4180.88 -> 4180.88 (0.00%) vary in affected programs: 0 -> 0 helped: 0 HURT: 0 total ldst in shared programs: 137551 -> 137028 (-0.38%) ldst in affected programs: 834 -> 311 (-62.71%) helped: 13 HURT: 0 helped stats (abs) min: 15.0 max: 53.0 x̄: 40.23 x̃: 53 helped stats (rel) min: 19.15% max: 100.00% x̄: 68.11% x̃: 76.81% 95% mean confidence interval for ldst value: -50.49 -29.98 95% mean confidence interval for ldst %-change: -84.37% -51.84% Ldst are helped. total quadwords in shared programs: 1684883 -> 1692021 (0.42%) quadwords in affected programs: 949463 -> 956601 (0.75%) helped: 3981 HURT: 5098 helped stats (abs) min: 1.0 max: 86.0 x̄: 3.53 x̃: 3 helped stats (rel) min: 0.18% max: 33.33% x̄: 5.82% x̃: 4.48% HURT stats (abs) min: 1.0 max: 50.0 x̄: 4.15 x̃: 3 HURT stats (rel) min: 0.17% max: 50.00% x̄: 5.11% x̃: 3.85% 95% mean confidence interval for quadwords value: 0.67 0.90 95% mean confidence interval for quadwords %-change: 0.17% 0.47% Quadwords are HURT. total threads in shared programs: 53276 -> 53653 (0.71%) threads in affected programs: 581 -> 958 (64.89%) helped: 445 HURT: 68 helped stats (abs) min: 1.0 max: 1.0 x̄: 1.00 x̃: 1 helped stats (rel) min: 100.00% max: 100.00% x̄: 100.00% x̃: 100.00% HURT stats (abs) min: 1.0 max: 1.0 x̄: 1.00 x̃: 1 HURT stats (rel) min: 50.00% max: 50.00% x̄: 50.00% x̃: 50.00% 95% mean confidence interval for threads value: 0.68 0.79 95% mean confidence interval for threads %-change: 75.70% 84.53% Threads are helped. total preloads in shared programs: 116312 -> 116312 (0.00%) preloads in affected programs: 0 -> 0 helped: 0 HURT: 0 total loops in shared programs: 128 -> 128 (0.00%) loops in affected programs: 0 -> 0 helped: 0 HURT: 0 total spills in shared programs: 92 -> 37 (-59.78%) spills in affected programs: 55 -> 0 helped: 13 HURT: 0 total fills in shared programs: 658 -> 190 (-71.12%) fills in affected programs: 468 -> 0 helped: 13 HURT: 0 Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16378> |
||
---|---|---|
.gitlab/issue_templates | ||
.gitlab-ci | ||
android | ||
bin | ||
build-support | ||
docs | ||
include | ||
src | ||
subprojects | ||
.dir-locals.el | ||
.editorconfig | ||
.gitattributes | ||
.gitignore | ||
.gitlab-ci.yml | ||
.mailmap | ||
.travis.yml | ||
CODEOWNERS | ||
README.rst | ||
VERSION | ||
meson.build | ||
meson_options.txt |
README.rst
`Mesa <https://mesa3d.org>`_ - The 3D Graphics Library ====================================================== Source ------ This repository lives at https://gitlab.freedesktop.org/mesa/mesa. Other repositories are likely forks, and code found there is not supported. Build & install --------------- You can find more information in our documentation (`docs/install.rst <https://mesa3d.org/install.html>`_), but the recommended way is to use Meson (`docs/meson.rst <https://mesa3d.org/meson.html>`_): .. code-block:: sh $ mkdir build $ cd build $ meson .. $ sudo ninja install Support ------- Many Mesa devs hang on IRC; if you're not sure which channel is appropriate, you should ask your question on `OFTC's #dri-devel <irc://irc.oftc.net/dri-devel>`_, someone will redirect you if necessary. Remember that not everyone is in the same timezone as you, so it might take a while before someone qualified sees your question. To figure out who you're talking to, or which nick to ping for your question, check out `Who's Who on IRC <https://dri.freedesktop.org/wiki/WhosWho/>`_. The next best option is to ask your question in an email to the mailing lists: `mesa-dev\@lists.freedesktop.org <https://lists.freedesktop.org/mailman/listinfo/mesa-dev>`_ Bug reports ----------- If you think something isn't working properly, please file a bug report (`docs/bugs.rst <https://mesa3d.org/bugs.html>`_). Contributing ------------ Contributions are welcome, and step-by-step instructions can be found in our documentation (`docs/submittingpatches.rst <https://mesa3d.org/submittingpatches.html>`_). Note that Mesa uses gitlab for patches submission, review and discussions.