6b2eda6b729215ca61617943dc540a8c690f2f72
On Bifrost and Valhall, push uniforms are loaded into Fast Access Uniform Random Access Memory (FAU-RAM). FAU-RAM is organized as an array of 64-bit slots. A given tuple (Bifrost) or instruction (Valhall) may access at most a single 64-bit slot. If an instruction requires uniforms from multiple 64-bit slots, a uniform-to-register move must be inserted to avoid the hazard. However, if an instruction requires a pair of 32-bit uniforms from the same 64-bit slot, no move is required. To reduce the number of moves we emit, this commit adds an optimization pass that reorders pushed uniforms, trying to group uniforms used by the same instruction. The pass works by creating a graph of pushed uniforms, where edges denote the "both 32-bit uniforms required by the same instruction" relationship. We perform depth-first search on this graph to find the connected components, where each connected component is a cluster of uniforms that are used together. We then select pairs of uniforms from each connected component. The remaining unpaired uniforms (from components of odd sizes) are paired together arbitrarily. In principle, we should weight the graph by number of occurences and choose pairs that maximize the total selected edge weight. This is left for future work, as it is nontrivial -- selecting these edges optimally appears to be NP-hard at first blush. Implementation note: As position and varying shaders share FAU on Bifrost, extra care is taken with a `push_offset` shader stage info parameter that ensures varying shaders do not reorder uniforms selected by the previous position shader. total instructions in shared programs: 2503343 -> 2451758 (-2.06%) instructions in affected programs: 1553309 -> 1501724 (-3.32%) helped: 14256 HURT: 8 helped stats (abs) min: 1.0 max: 80.0 x̄: 3.62 x̃: 3 helped stats (rel) min: 0.06% max: 36.36% x̄: 7.31% x̃: 6.67% HURT stats (abs) min: 1.0 max: 2.0 x̄: 1.38 x̃: 1 HURT stats (rel) min: 1.30% max: 12.50% x̄: 4.99% x̃: 3.85% 95% mean confidence interval for instructions value: -3.66 -3.58 95% mean confidence interval for instructions %-change: -7.41% -7.20% Instructions are helped. total tuples in shared programs: 2008399 -> 1969627 (-1.93%) tuples in affected programs: 1146344 -> 1107572 (-3.38%) helped: 12867 HURT: 147 helped stats (abs) min: 1.0 max: 61.0 x̄: 3.03 x̃: 2 helped stats (rel) min: 0.17% max: 42.86% x̄: 6.79% x̃: 4.65% HURT stats (abs) min: 1.0 max: 3.0 x̄: 1.20 x̃: 1 HURT stats (rel) min: 0.29% max: 20.00% x̄: 2.12% x̃: 1.19% 95% mean confidence interval for tuples value: -3.03 -2.93 95% mean confidence interval for tuples %-change: -6.82% -6.57% Tuples are helped. total clauses in shared programs: 408005 -> 401708 (-1.54%) clauses in affected programs: 90760 -> 84463 (-6.94%) helped: 6006 HURT: 164 helped stats (abs) min: 1.0 max: 9.0 x̄: 1.08 x̃: 1 helped stats (rel) min: 0.45% max: 33.33% x̄: 12.44% x̃: 14.29% HURT stats (abs) min: 1.0 max: 1.0 x̄: 1.00 x̃: 1 HURT stats (rel) min: 1.64% max: 25.00% x̄: 9.81% x̃: 5.26% 95% mean confidence interval for clauses value: -1.03 -1.01 95% mean confidence interval for clauses %-change: -12.03% -11.66% Clauses are helped. total cycles in shared programs: 203308.37 -> 202737.83 (-0.28%) cycles in affected programs: 19264.71 -> 18694.17 (-2.96%) helped: 3024 HURT: 41 helped stats (abs) min: 0.041665999999999315 max: 2.5416680000000014 x̄: 0.19 x̃: 0 helped stats (rel) min: 0.17% max: 33.33% x̄: 3.83% x̃: 2.83% HURT stats (abs) min: 0.041665999999999315 max: 0.125 x̄: 0.06 x̃: 0 HURT stats (rel) min: 0.30% max: 5.88% x̄: 1.41% x̃: 0.93% 95% mean confidence interval for cycles value: -0.19 -0.18 95% mean confidence interval for cycles %-change: -3.89% -3.64% Cycles are helped. total arith in shared programs: 76265.67 -> 74669.25 (-2.09%) arith in affected programs: 45001.50 -> 43405.08 (-3.55%) helped: 12945 HURT: 97 helped stats (abs) min: 0.041665999999999315 max: 2.5416680000000014 x̄: 0.12 x̃: 0 helped stats (rel) min: 0.17% max: 50.00% x̄: 8.06% x̃: 4.88% HURT stats (abs) min: 0.041665999999999315 max: 0.125 x̄: 0.05 x̃: 0 HURT stats (rel) min: 0.21% max: 33.33% x̄: 2.16% x̃: 0.96% 95% mean confidence interval for arith value: -0.12 -0.12 95% mean confidence interval for arith %-change: -8.16% -7.81% Arith are helped. total quadwords in shared programs: 1796563 -> 1766803 (-1.66%) quadwords in affected programs: 948830 -> 919070 (-3.14%) helped: 12078 HURT: 219 helped stats (abs) min: 1.0 max: 42.0 x̄: 2.49 x̃: 2 helped stats (rel) min: 0.10% max: 33.33% x̄: 5.57% x̃: 5.26% HURT stats (abs) min: 1.0 max: 4.0 x̄: 1.21 x̃: 1 HURT stats (rel) min: 0.33% max: 6.67% x̄: 2.00% x̃: 1.14% 95% mean confidence interval for quadwords value: -2.46 -2.38 95% mean confidence interval for quadwords %-change: -5.52% -5.36% Quadwords are helped. Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14163>
`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.
Description
Languages
C
75.5%
C++
17.2%
Python
2.7%
Rust
1.8%
Assembly
1.5%
Other
1%