119e5b9719a1e1cb0cb7e8e74d7b607633bd3ee0
Since we register allocate in SSA, the number of registers required (register demand) equals to the maximum number of simultaneous live values (register pressure). So if we can reduce register pressure, we are guaranteed to reduce register demand. Even an ineffective heuristic like randomly swapping instructions can only reduce pressure as long as it's conservative. This implements one such heuristic: in each block, schedule backwards, selecting the free instruction that looks like it will reduce liveness the most. In other words, the greedy algorithm to reduce register pressure. At the end of the block, if we haven't actually reduced pressure, we bail. This isn't optimal, but it's well-motivated and optimally handles special cases (like 0-source instructions). This is based on the scheduler I originally wrote for Mali. In my Dolphin ubershader branch, this improved performance at native 4K by 10fps (105fps->115fps) when I measured together with some other optimizations. On top of my current next (which notably includes nir_opt_sink improvements), this commit alone goes (53fps->54fps) which is considerably less impressive :-p shader-db results are a win, but not as large as we might hope. Instruction count win seems to be from the smaller live ranges being easier on RA (fewer swaps / moves). The two shaders affected for thread count are from fifa mobile, which go from 640 threads -> 1024 (full occupancy). In other words... this heuristic does an excellent job in a small subset of shaders. The Dolphin ubershader win was real, though :~) Note these shader-db wins are on top of a branch with the nir_opt_sink improvements. Without that, the stats are much better... The schedulers have some overlap, but they're better together. total instructions in shared programs: 1766635 -> 1763496 (-0.18%) instructions in affected programs: 445855 -> 442716 (-0.70%) helped: 1963 HURT: 350 Instructions are helped. total bytes in shared programs: 11597648 -> 11586924 (-0.09%) bytes in affected programs: 3106230 -> 3095506 (-0.35%) helped: 2003 HURT: 374 Bytes are helped. total halfregs in shared programs: 504609 -> 481980 (-4.48%) halfregs in affected programs: 138322 -> 115693 (-16.36%) helped: 3405 HURT: 311 Halfregs are helped. total threads in shared programs: 18839936 -> 18840704 (<.01%) threads in affected programs: 1280 -> 2048 (60.00%) helped: 2 HURT: 0 Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25052>
`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%