mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 22:38:05 +02:00
read-only mirror of https://gitlab.freedesktop.org/mesa/mesa
In general, sinking ALU instructions can negatively impact register pressure, since it extends the live ranges of the sources, although it does shrink the live range of the destination. However, constants do not usually contribute to register pressure. This is not a totally true assumption, but it's pretty good in practice, since... * constants can be rematerialized (backend-dependent) * constants can often be inlined (ISA-dependent) * constants can sometimes be promoted to free uniform registers (ISA-dependent) * constants can live in scalar registers although the ALU destination might need a vector register (and vector registers are assumed to be much more expensive than scalar registers, again ISA-dependent) So, assume that constants have zero effect on register pressure. Now consider an ALU instruction where all but one source is a constant. Then there are two cases: 1. The ALU instruction is moved past when its source was otherwise killed. Then there is no effect on register pressure, since the source live range is extended exactly as much as the destination live range shrinks. 2. The ALU instruction is moved down but its source is still alive where it's moved to. Then register pressure is improved, since the source live range is unchanged while the destination live range shrinks. So, as a heuristic, we always move ALU instructions where n-1 sources are constant. As an inevitable special case, this also (necessarily) moves unary ALU ops, which should be beneficial by the same justification. This is not 100% perfect but it is well-motivated. Results on AGX are decent: total instructions in shared programs: 1796101 -> 1795652 (-0.02%) instructions in affected programs: 326822 -> 326373 (-0.14%) helped: 800 HURT: 371 Inconclusive result (%-change mean confidence interval includes 0). total bytes in shared programs: 11805004 -> 11801424 (-0.03%) bytes in affected programs: 2610630 -> 2607050 (-0.14%) helped: 912 HURT: 462 Inconclusive result (%-change mean confidence interval includes 0). total halfregs in shared programs: 525818 -> 515399 (-1.98%) halfregs in affected programs: 118197 -> 107778 (-8.81%) helped: 2095 HURT: 804 Halfregs are helped. total threads in shared programs: 18916608 -> 18917056 (<.01%) threads in affected programs: 4800 -> 5248 (9.33%) helped: 7 HURT: 0 Threads are helped. Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Reviewed-by: Daniel Schürmann <daniel@schuermann.dev> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24833> |
||
|---|---|---|
| .ci-farms | ||
| .ci-farms-disabled | ||
| .github/workflows | ||
| .gitlab | ||
| .gitlab-ci | ||
| android | ||
| bin | ||
| build-support | ||
| docs | ||
| include | ||
| src | ||
| subprojects | ||
| .clang-format | ||
| .clang-format-ignore | ||
| .clang-format-include | ||
| .dir-locals.el | ||
| .editorconfig | ||
| .git-blame-ignore-revs | ||
| .gitattributes | ||
| .gitignore | ||
| .gitlab-ci.yml | ||
| .graphqlrc.yml | ||
| .mailmap | ||
| CODEOWNERS | ||
| meson.build | ||
| meson_options.txt | ||
| README.rst | ||
| VERSION | ||
`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.