Rhys Perry
63b18e9e5b
aco: move return address to a clobbered register
...
It's placed in the preserved registers, but the p_call clobbers it, so
this change removes some special casing.
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Natalie Vock <natalie.vock@gmx.de>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39590 >
2026-02-06 09:49:19 +00:00
Rhys Perry
5f5032bb6a
aco: use lv1/lv2 instead of v1/v2.as_linear()
...
This is just a search+replace then clang-format.
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Acked-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39537 >
2026-01-28 16:46:30 +00:00
Georg Lehmann
531228159f
aco/validate: allow dpp with scalar src1 on gfx11.5+
...
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39516 >
2026-01-27 20:42:50 +00:00
Georg Lehmann
d6356191b9
aco: add fma_mix opcodes with rtz fp16 rounding
...
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38815 >
2026-01-20 14:48:22 +00:00
Rhys Perry
89d06f7db5
aco: add RA validation for p_call
...
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/38811 >
2026-01-16 10:05:43 +00:00
Rhys Perry
d0801c9eb7
aco: always run RA validation during tests
...
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/38811 >
2026-01-16 10:05:43 +00:00
Natalie Vock
0a1911b220
radv,aco: Use function call structure for RT programs
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29580 >
2026-01-14 14:19:07 +00:00
Natalie Vock
7c12603933
aco/lower_to_hw_instr: Preserve linearity of lowered linear VGPRs
...
So subsequent passes like waitcnt insertion can know these are linear.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39157 >
2026-01-12 21:46:50 +00:00
Daniel Schürmann
2d0d5fc104
aco/validate: validate constant bus limit after register allocation based on PhysReg
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39107 >
2026-01-05 14:54:00 +00:00
Daniel Schürmann
0674c9d30e
aco/validate: Validate correct RegisterClasses after lowering to HW instructions
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39107 >
2026-01-05 14:53:59 +00:00
Georg Lehmann
a2b70ce4ec
aco/isel: remove uniform reduce/scan optimization
...
This is now done in NIR, with the exception of exclusive min/max/and/or scans.
But those are not really useful, and if we ever come across them we can
optimize them in NIR using write_invocation_amd.
No Foz-DB changes on Navi21.
Acked-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38902 >
2025-12-15 12:22:32 +00:00
Natalie Vock
575d3adbf5
aco/validate: Validate call instructions
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34531 >
2025-09-15 17:16:21 +00:00
Georg Lehmann
791a57805c
aco: fix ra validation for flat/global/scratch/ds load sbyte_d16
...
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Fixes: 18a53230eb ("aco: don't check dst_bitsize in apply_load_extract")
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36964 >
2025-08-25 10:09:16 +00:00
Georg Lehmann
fc53cf146c
aco: disable wqm for sampled buffer loads when not needed
...
Foz-DB GFX1201:
Totals from 318 (0.40% of 80287) affected shaders:
Instrs: 313039 -> 314064 (+0.33%); split: -0.00%, +0.33%
CodeSize: 1684104 -> 1688212 (+0.24%); split: -0.00%, +0.24%
VGPRs: 15120 -> 15144 (+0.16%)
Latency: 2515023 -> 2518610 (+0.14%); split: -0.06%, +0.20%
InvThroughput: 447468 -> 447615 (+0.03%); split: -0.02%, +0.05%
VClause: 4866 -> 4914 (+0.99%)
SClause: 6564 -> 6559 (-0.08%); split: -0.09%, +0.02%
Copies: 23577 -> 23673 (+0.41%); split: -0.04%, +0.45%
PreSGPRs: 16019 -> 16029 (+0.06%)
VALU: 172157 -> 172143 (-0.01%)
SALU: 52816 -> 53867 (+1.99%)
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35970 >
2025-08-15 07:03:47 +00:00
Georg Lehmann
11cee3d634
aco: use new disable_wqm for p_dual_src_export_gfx11
...
No Foz-DB changes on GFX1201.
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35970 >
2025-08-15 07:03:46 +00:00
Georg Lehmann
0e66f2b2cc
aco: use new disable_wqm for mimg
...
Foz-DB GFX1201:
Totals from 88 (0.11% of 80251) affected shaders:
Instrs: 81954 -> 82218 (+0.32%); split: -0.02%, +0.34%
CodeSize: 451824 -> 452880 (+0.23%); split: -0.02%, +0.25%
Latency: 308818 -> 308746 (-0.02%); split: -0.05%, +0.02%
VClause: 1324 -> 1318 (-0.45%)
Copies: 2795 -> 2784 (-0.39%)
PreSGPRs: 4029 -> 4035 (+0.15%)
SALU: 6563 -> 6809 (+3.75%); split: -0.15%, +3.90%
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35970 >
2025-08-15 07:03:46 +00:00
Georg Lehmann
ca25553b92
aco: add a post-RA pass to disable wqm
...
By disabling WQM post-RA, we don't have RA/spilling mov issues with image_sample
operands that need to be computed in WQM.
We also don't restrict scheduling by inserting exec writes.
The only downside is more scalar ALU usage, but the SALU is almost always underutilized.
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35970 >
2025-08-15 07:03:46 +00:00
Natalie Vock
9707b30965
nir,aco: Add ds_bvh_stack_rtn
...
This is a ds instruction that also overwrites its first input, so
introduce a new ds format with two outputs.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35269 >
2025-07-15 21:34:39 +00:00
Daniel Schürmann
3f35b1329e
aco: allow subdword vector-definitions on some VALU instructions
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35784 >
2025-07-09 14:10:36 +00:00
Rhys Perry
c45482e652
aco: validate that preds/succs match
...
This isn't done in validate_cfg() because that's called less frequently.
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:39 +00:00
Georg Lehmann
94c191e6d9
aco: remove p_v_cvt_pk_u8_f32
...
Now unused.
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35391 >
2025-06-10 07:32:04 +00:00
Daniel Schürmann
b5382faa9c
aco/validate: validate register assignment of vector-aligned operands
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34359 >
2025-05-28 09:24:17 +00:00
Rhys Perry
c04ef28c56
aco: rename ops_fixed_to_def to tied_defs
...
This is less words.
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/34700 >
2025-05-20 15:40:46 +00:00
Georg Lehmann
3f70433ff0
aco: add type information for operands/definitions
...
More information available for use in the optimizer.
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29695 >
2025-05-15 12:17:17 +00:00
Konstantin Seurer
978e9b670e
aco,nir: Add support for new GFX12 ray tracing instructions
...
Adds image_bvh_dual_intersect_ray and image_bvh8_intersect_ray which can
handle the new BVH format. Both instructions write up to 10 VGPRs so
they need to use a vec16 definition in nir.
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34273 >
2025-04-17 20:20:40 +00:00
Natalie Vock
f309d76aab
aco: Add support for multiple ops fixed to defs
...
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34273 >
2025-04-17 20:20:40 +00:00
Georg Lehmann
cac4287aab
aco/validate: fix scalar source validation for DPP and gfx11+ VINTERP
...
Acked-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33969 >
2025-03-12 11:31:54 +00:00
Daniel Schürmann
52253da783
aco: unify get_addr_sgpr_from_waves() and get_addr_vgpr_from_waves() into one function
...
which returns the limit as RegisterDemand.
Also remove the unused get_extra_sgprs() from aco_ir.h.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33644 >
2025-02-21 13:49:41 +00:00
Rhys Perry
ebc7355962
aco: validate operands fixed to definitions
...
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/33444 >
2025-02-11 23:10:37 +00:00
Daniel Schürmann
b64fff7731
aco: remove definition from Pseudo branch instructions
...
They are not needed anymore.
Totals from 7019 (8.84% of 79395) affected shaders: (Navi31)
Instrs: 14805400 -> 14824196 (+0.13%); split: -0.00%, +0.13%
CodeSize: 78079972 -> 78132932 (+0.07%); split: -0.01%, +0.08%
SpillSGPRs: 4485 -> 4515 (+0.67%); split: -0.76%, +1.43%
Latency: 165862000 -> 165836134 (-0.02%); split: -0.02%, +0.00%
InvThroughput: 30061764 -> 30057781 (-0.01%); split: -0.01%, +0.00%
SClause: 392323 -> 392286 (-0.01%); split: -0.01%, +0.00%
Copies: 1012262 -> 1012234 (-0.00%); split: -0.04%, +0.04%
Branches: 365910 -> 365909 (-0.00%); split: -0.00%, +0.00%
PreSGPRs: 360167 -> 355363 (-1.33%)
VALU: 8837197 -> 8837276 (+0.00%); split: -0.00%, +0.00%
SALU: 1402593 -> 1402621 (+0.00%); split: -0.03%, +0.03%
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32037 >
2024-12-06 14:34:03 +00:00
Samuel Pitoiset
185a165a85
aco: fix validation for v_movrels_b32 and friends
...
m0 is the second operand.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32090 >
2024-11-13 15:27:53 +00:00
Rhys Perry
d285333800
aco: add a bit more p_extract/p_insert validation
...
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31762 >
2024-11-06 19:31:20 +00:00
Rhys Perry
07e28dad75
aco: disallow p_extract(,,32,)
...
Nothing uses these.
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31762 >
2024-11-06 19:31:20 +00:00
Samuel Pitoiset
e85fc0f869
aco: fix validation for VOP1 instructions without any dest/src
...
Like v_clrexcp.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31960 >
2024-11-05 07:58:38 +00:00
Georg Lehmann
9bb10b58f3
aco: use v_cvt_pk_u8_f32 for f2u8
...
Foz-DB Navi31:
Totals from 42 (0.05% of 79395) affected shaders:
Instrs: 3253747 -> 3248867 (-0.15%); split: -0.15%, +0.00%
CodeSize: 16690136 -> 16661772 (-0.17%); split: -0.17%, +0.00%
VGPRs: 4176 -> 4128 (-1.15%)
Latency: 18485157 -> 18479752 (-0.03%); split: -0.03%, +0.00%
InvThroughput: 3659404 -> 3658222 (-0.03%); split: -0.03%, +0.00%
Copies: 231891 -> 228145 (-1.62%)
VALU: 1785800 -> 1782054 (-0.21%)
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29532 >
2024-09-02 19:49:20 +00:00
Rhys Perry
db39685e31
aco: validate temporary reachability
...
These errors are nicer to read than the ones from live variable analysis.
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/30440 >
2024-08-21 10:47:20 +00:00
Daniel Schürmann
b0c8c5e42e
aco: implement aco::validate_live_vars()
...
This is intended for passes which manually update live variables
and RegisterDemand, like e.g. the scheduler, and can be enabled
with ACO_DEBUG=validate-livevars.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30182 >
2024-08-14 08:11:48 +00:00
Georg Lehmann
dedfff9dbf
aco: only set latekill in live_var_analysis
...
Cleaner to have this all in one place, in my opinion.
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30368 >
2024-08-12 10:31:09 +00:00
Rhys Perry
911fdce0b6
aco: fix validation of v_s_ opcodes
...
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Fixes: 284b9965e8 ("aco/gfx11.5+: allow sgpr dst for trans ops and use pseudo scalar ops on gfx12")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30477 >
2024-08-05 09:32:24 +00:00
Georg Lehmann
b92134e088
aco: validate temp_rc
...
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30399 >
2024-07-29 18:35:33 +00:00
Daniel Schürmann
043ec096c1
aco/validate: use live-in variables for RA validation
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30120 >
2024-07-16 14:00:49 +00:00
Daniel Schürmann
a497d105e3
aco: move live var information into struct Program
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29713 >
2024-06-14 14:32:35 +00:00
Rhys Perry
de07fd384d
aco/gfx12: disallow SCC and most constants for BUF SOFFSET
...
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29330 >
2024-05-28 10:52:11 +00:00
Rhys Perry
12b4bdc134
aco/gfx12: decrease max_nsa_vgprs for VSAMPLE
...
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29330 >
2024-05-28 10:52:11 +00:00
Georg Lehmann
cc404d45ff
aco: remove perfwarn
...
This didn't do anything useful.
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29270 >
2024-05-21 13:31:23 +00:00
Rhys Perry
74aa6437d6
aco: add GFX11.5+ opcodes
...
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Acked-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29162 >
2024-05-14 20:50:27 +00:00
Georg Lehmann
e2cb9c57a2
aco: use v_interp_p2_f16 opsel
...
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28435 >
2024-04-10 07:49:27 +00:00
Samuel Pitoiset
7a69d78ba2
aco: use SPDX-License-Identifier
...
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28622 >
2024-04-08 15:49:25 +00:00
Rhys Perry
6a195bb521
aco: only allow linear vgpr kills in top-level blocks
...
This is already the case, and requiring it will be useful in the future.
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/27697 >
2024-03-06 12:55:45 +00:00
Rhys Perry
07eab4ab40
aco: require linear vgpr uses to be late kill
...
This also removes some linear VGPR tests which will be replaced soon
anyway.
fossil-db (navi31):
Totals from 107 (0.14% of 79242) affected shaders:
Instrs: 66203 -> 66211 (+0.01%); split: -0.09%, +0.10%
CodeSize: 354644 -> 354588 (-0.02%); split: -0.08%, +0.07%
VGPRs: 4476 -> 4452 (-0.54%); split: -0.80%, +0.27%
Latency: 513863 -> 513877 (+0.00%); split: -0.08%, +0.08%
InvThroughput: 68871 -> 68870 (-0.00%); split: -0.02%, +0.02%
SClause: 1589 -> 1590 (+0.06%)
PreVGPRs: 3404 -> 3415 (+0.32%)
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/27697 >
2024-03-06 12:55:45 +00:00