Rhys Perry
85db025cd7
aco: continue when try_remove_simple_block can't remove a predecessor
...
We should update linear_preds so that the predecessors we can remove are
actually removed.
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35202 >
2025-06-19 10:58:38 +00:00
Rhys Perry
5344abbc56
aco/lower_branches: keep blocks with multiple logical successors
...
It might be the case that both the branch and exec mask write in a
divergent branch block are removed. try_remove_simple_block() might then
try to remove it, but fail because it has multiple logical successors.
Instead, just skip these blocks.
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Backport-to: 25.1
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35202 >
2025-06-19 10:58:38 +00:00
Daniel Schürmann
c1b124ab6c
aco/lower_branches: properly consider exec mask needs of branch targets
...
No fossil changes.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33619 >
2025-03-26 08:45:11 +00:00
Daniel Schürmann
794c2b7e2f
aco/lower_branches: allow other instructions after s_andn2 in break blocks
...
We are about to insert parallelcopies from phis there.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33527 >
2025-02-24 13:11:20 +00:00
Daniel Schürmann
08560b8ff8
aco/lower_branches: stitch linear blocks if there is exactly one successor with one predecessor
...
Totals from 12906 (16.26% of 79395) affected shaders: (Navi31)
Instrs: 22051521 -> 22049488 (-0.01%); split: -0.01%, +0.00%
CodeSize: 116591240 -> 116583920 (-0.01%)
Latency: 196625178 -> 196538410 (-0.04%); split: -0.04%, +0.00%
InvThroughput: 33943045 -> 33930615 (-0.04%); split: -0.04%, +0.00%
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32477 >
2025-01-23 00:11:06 +00:00
Daniel Schürmann
c90ae5f773
aco: delete aco_jump_threading.cpp
...
This is now handled by lower_branches().
Totals from 47236 (59.49% of 79395) affected shaders: (Navi31)
Instrs: 29490400 -> 29490507 (+0.00%)
CodeSize: 152316812 -> 152317248 (+0.00%); split: -0.00%, +0.00%
Latency: 229665459 -> 229665106 (-0.00%); split: -0.00%, +0.00%
InvThroughput: 36870605 -> 36870504 (-0.00%); split: -0.00%, +0.00%
Copies: 1966751 -> 2233467 (+13.56%)
SALU: 3122941 -> 3123048 (+0.00%)
Note, that only about 20 shaders are actually affected.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32477 >
2025-01-23 00:11:06 +00:00
Daniel Schürmann
c677809f25
aco/lower_branches: allow for non-fallthrough loop exits in try_merge_break_with_continue()
...
Totals from 211 (0.27% of 79395) affected shaders: (Navi31)
Instrs: 276961 -> 276545 (-0.15%)
CodeSize: 1404356 -> 1402248 (-0.15%)
Latency: 1344722 -> 1344887 (+0.01%); split: -0.00%, +0.01%
InvThroughput: 165624 -> 165622 (-0.00%); split: -0.00%, +0.00%
Branches: 6149 -> 5987 (-2.63%)
SALU: 25722 -> 25468 (-0.99%)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32477 >
2025-01-23 00:11:06 +00:00
Daniel Schürmann
12656ea5f5
aco: move try_merge_break_with_continue() to lower_branches()
...
Totals from 3 (0.00% of 79395) affected shaders: (Navi31)
Instrs: 12888 -> 12882 (-0.05%)
Latency: 83253 -> 83246 (-0.01%)
InvThroughput: 9251 -> 9249 (-0.02%)
Branches: 483 -> 480 (-0.62%)
SALU: 1329 -> 1326 (-0.23%)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32477 >
2025-01-23 00:11:06 +00:00
Daniel Schürmann
13ad3db43f
aco/lower_branches: implement try_remove_simple_block() in lower_branches()
...
This is mostly the same as in jump_threading, but can handle
multiple predecessors.
Totals from 3523 (4.44% of 79395) affected shaders: (Navi31)
Instrs: 10244892 -> 10244753 (-0.00%); split: -0.00%, +0.00%
CodeSize: 54171500 -> 54168540 (-0.01%); split: -0.01%, +0.00%
Latency: 75070425 -> 75059570 (-0.01%); split: -0.02%, +0.00%
InvThroughput: 11606911 -> 11605767 (-0.01%); split: -0.01%, +0.00%
Branches: 331778 -> 331675 (-0.03%); split: -0.05%, +0.02%
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32477 >
2025-01-23 00:11:06 +00:00
Daniel Schürmann
2b5a893e29
aco/lower_branches: do eliminate_useless_exec_writes_in_block() during branch lowering.
...
Totals from 728 (0.92% of 79395) affected shaders: (Navi31)
Instrs: 452926 -> 452161 (-0.17%)
CodeSize: 2255536 -> 2252504 (-0.13%)
Latency: 1683404 -> 1683470 (+0.00%); split: -0.01%, +0.01%
InvThroughput: 210887 -> 210888 (+0.00%); split: -0.00%, +0.00%
SALU: 77865 -> 77106 (-0.97%)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32477 >
2025-01-23 00:11:06 +00:00
Georg Lehmann
6b35d6f75b
aco: allow p_exit_early_if_not with exec condition
...
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Daniel Schürmann <None>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32731 >
2024-12-30 13:05:23 +00:00
Daniel Schürmann
26a3038b65
aco/lower_branches: remove edges between blocks if there is no direct branch
...
This way, linear predecessors and successors better reflect the
actual control flow which improves wait state insertion and hazard
mitigation.
Totals from 10252 (12.91% of 79395) affected shaders: (Navi31)
Instrs: 18824540 -> 18803823 (-0.11%); split: -0.11%, +0.00%
CodeSize: 99025464 -> 98942028 (-0.08%); split: -0.08%, +0.00%
Latency: 169291854 -> 165781877 (-2.07%); split: -2.07%, +0.00%
InvThroughput: 29701086 -> 29228602 (-1.59%); split: -1.59%, +0.00%
SClause: 510587 -> 510586 (-0.00%)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32389 >
2024-12-12 08:46:22 +00:00
Daniel Schürmann
22ffe72022
aco: move branch lowering optimization into separate file 'aco_lower_branches.cpp'
...
No fossil changes.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32389 >
2024-12-12 08:46:22 +00:00