Commit graph

359 commits

Author SHA1 Message Date
Rhys Perry
a780345e01 aco: fix compact_relocate_vars fallback with scc/exec/m0 precolored regs
This probably doesn't fix anything in practice. I don't think this path is
ever taken for SGPRs except for pseudo-scalar transcendental instructions,
and those don't have any precolored operands/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/34343>
2025-04-29 15:15:10 +00:00
Rhys Perry
f6581b41c4 aco/ra: don't require alignment for NPOT SGPR temporaries
Aligning these can create situations where register allocation is
impossible. Only pseudo-instructions can use these, and they don't require
any alignment.

I'm not sure if these temporaries actually happen in practice. This
probably only affects the get_reg()'s compact_relocate_vars fallback path,
which doesn't usually happen for SGPRs.

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/34343>
2025-04-29 15:15:10 +00:00
Rhys Perry
623230a6ef aco/ra: change sorting in compact_relocate_vars
D16 MIMG or pseudo-scalar transcendental instructions might give lower
limits to the maximum register available for their definitions, so just
try to place them earlier.

This is also part of fixing compact_relocate_vars with aligned NPOT
def/killed-op space (the second part is the later commit which changes
get_stride()).

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/34343>
2025-04-29 15:15:10 +00:00
Rhys Perry
3c021b79b4 aco/ra: use a correct stride for subdword get_reg_impl
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
fossil-db (gfx1201):
Totals from 3 (0.00% of 79377) affected shaders:
Instrs: 1312 -> 1308 (-0.30%)
CodeSize: 7112 -> 7096 (-0.22%)
Latency: 5381 -> 5382 (+0.02%)
InvThroughput: 753 -> 752 (-0.13%)
Copies: 69 -> 68 (-1.45%)
VALU: 836 -> 835 (-0.12%)

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/34679>
2025-04-25 14:43:41 +00:00
Rhys Perry
ae6d4f1195 aco/ra: update_renames() before add_subdword_definition()
The register file tests here should be done after update_renames().

Normally, get_reg() wouldn't have to move anything to make space for a 1-3
byte definition. This was encountered with skip_optimistic_path=true and a
get_reg_impl() bug (fixed in a later commit) which caused suboptimal
register assignment.

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/34679>
2025-04-25 14:43:41 +00:00
Natalie Vock
ee0f784858 aco/ra: Don't consider precolored ops/defs in get_reg_impl
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
Rhys Perry
80fef30531 aco/ra: fix free register counting when moving variables
info.bounds might be smaller than the bounds available for the moved
variables.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Fixes: 626aa7b648 ("aco: workaround GFX9 hardware bug for D16 image instructions")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34158>
2025-03-25 15:14:16 +00:00
Georg Lehmann
d1dca26941 aco/ra: disallow vcc definitions for pseudo scalar trans instrs
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Foz-DB GFX1201:
Totals from 30 (0.04% of 79600) affected shaders:
Instrs: 58843 -> 58820 (-0.04%); split: -0.10%, +0.06%
CodeSize: 302228 -> 301944 (-0.09%); split: -0.13%, +0.04%
Latency: 204566 -> 204432 (-0.07%); split: -0.09%, +0.02%
InvThroughput: 136918 -> 136919 (+0.00%); split: -0.00%, +0.00%
SClause: 1241 -> 1249 (+0.64%); split: -0.56%, +1.21%

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>

Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34006>
2025-03-14 13:53:55 +00:00
Natalie Vock
d5a2666ad9 aco/ra: Assert operands only clear their own id
This is useful for debugging register assignment, as this case would
usually result in RA silently assigning the same register to multiple
temps at the same time.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29576>
2025-02-28 16:00:48 +00:00
Natalie Vock
b8bcc8e5c5 aco/ra: Handle temps fixed to different regs in different operands
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29576>
2025-02-28 16:00:48 +00:00
Natalie Vock
7a4775b396 aco/ra: Add option to skip renaming for parallelcopies
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29576>
2025-02-28 16:00:48 +00:00
Natalie Vock
b339bcfa38 aco/ra: Use struct for parallelcopies
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29576>
2025-02-28 16:00:48 +00:00
Natalie Vock
3f182bc1fa aco/ra: Use iterators for linear VGPR copy extraction
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29576>
2025-02-28 16:00:48 +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
d946a753e3 aco/ra: unconditionally call undo_renames
There's no real reason to not do this more.

fossil-db (navi21):
Totals from 2615 (3.29% of 79377) affected shaders:
Instrs: 4729505 -> 4729484 (-0.00%); split: -0.00%, +0.00%
CodeSize: 25210992 -> 25210036 (-0.00%); split: -0.00%, +0.00%
Latency: 31572966 -> 31572435 (-0.00%); split: -0.00%, +0.00%
InvThroughput: 6918552 -> 6918560 (+0.00%); split: -0.00%, +0.00%
VClause: 132152 -> 132116 (-0.03%); split: -0.03%, +0.00%
SClause: 98595 -> 98575 (-0.02%); split: -0.04%, +0.02%

fossil-db (polaris10):
Totals from 1039 (1.68% of 61794) affected shaders:
Instrs: 708761 -> 708766 (+0.00%); split: -0.00%, +0.00%
CodeSize: 3588772 -> 3588792 (+0.00%); split: -0.00%, +0.00%
Latency: 7458892 -> 7459513 (+0.01%); split: -0.00%, +0.01%
InvThroughput: 3494669 -> 3494722 (+0.00%); split: -0.00%, +0.00%
VClause: 16754 -> 16737 (-0.10%)
SClause: 18190 -> 18156 (-0.19%); split: -0.49%, +0.31%

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
Rhys Perry
b94b4188a6 aco/ra: reverse renaming of operands outside update_renames
This lets us remove some special casing from update_renames and make it
simpler. Doing this in update_renames was also fragile, since the
parallelcopies vector is not final when update_renames is called, so it
might not have been safe to do so in the end.

No fossil-db changes.

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
Georg Lehmann
65506e635b aco/ra: don't write to scc/ttmp with s_fmac
Fixes: 4bd229ac50 ("aco/gfx11.5: select SOP2 float instructions")

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32545>
2024-12-11 12:51:18 +00:00
Georg Lehmann
0b9e2a5427 aco/ra: disallow s_cmpk with scc operand
Fixes: 2d6b0a4177 ("aco/optimizer: Optimize SOPC with literal to SOPK.")

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32545>
2024-12-11 12:51:18 +00:00
Georg Lehmann
fe0c72caec aco/ra: don't write to exec/ttmp with mulk/addk/cmovk
ttmp sgprs are readonly outside of trap handlers, so the instructions were
probably skipped. RA should also never create additional exec writes.

Fixes: e06773281b ("aco/ra: Optimize some SOP2 instructions with literal to SOPK.")

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32545>
2024-12-11 12:51:18 +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
Daniel Schürmann
1ff9a0fe80 aco: remove Pseudo_instruction::tmp_in_scc
This information is redundant, now.

No fossil-changes.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32217>
2024-11-20 11:04:32 +00:00
Daniel Schürmann
a1a4a6061c aco/ra: explicitly assign scratch SGPR for linear phis
We are about to remove the branch definitions which previously
served this purpose. Also remove Block::scc_live_out.
Some changes due to round-robin RA.

Totals from 939 (1.18% of 79395) affected shaders: (Navi31)

Instrs: 5038786 -> 5038611 (-0.00%); split: -0.01%, +0.00%
CodeSize: 26153412 -> 26152904 (-0.00%); split: -0.00%, +0.00%
Latency: 41649989 -> 41650120 (+0.00%); split: -0.00%, +0.00%
InvThroughput: 6447508 -> 6447536 (+0.00%); split: -0.00%, +0.00%
SClause: 131319 -> 131276 (-0.03%); split: -0.03%, +0.00%
Copies: 359362 -> 359256 (-0.03%); split: -0.05%, +0.02%
SALU: 639275 -> 639169 (-0.02%); split: -0.03%, +0.01%
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32217>
2024-11-20 11:04:32 +00:00
Daniel Schürmann
17da551133 aco/ra: use bitset for sgpr_operands_alias_defs
We cannot rely on SGPR Temps being fully aligned to 64 SGPRs.

Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32217>
2024-11-20 11:04:32 +00:00
Daniel Schürmann
a04e096339 aco/ra: set Pseudo_instruction::scratch_sgpr to SCC if it doesn't need to be preserved
Also ensure that 'needs_scratch_reg' is always true if SCC might be overwritten.
Few changes, because some p_split_vector get SCC as scratch reg assigned,
and thus, can inhibit some postRA optimizations.

Totals from 3 (0.00% of 79395) affected shaders: (Navi31)
Instrs: 10501 -> 10500 (-0.01%); split: -0.02%, +0.01%
CodeSize: 51580 -> 51520 (-0.12%); split: -0.12%, +0.01%
Latency: 84166 -> 84174 (+0.01%)
InvThroughput: 13109 -> 13111 (+0.02%)
SALU: 859 -> 860 (+0.12%)

Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32217>
2024-11-20 11:04:32 +00:00
Daniel Schürmann
ef47cce51c aco/ra: always block register file for precolored operands
so that they don't accidentally get renamed.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31387>
2024-10-22 12:29:18 +00:00
Daniel Schürmann
18e7e8d8f0 aco/ra: make use of Precolored flag
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31387>
2024-10-22 12:29:18 +00:00
Daniel Schürmann
e2705a9d85 aco: set Precolored flag before register allocation
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31387>
2024-10-22 12:29:18 +00:00
Daniel Schürmann
19583023a2 aco/ra: remove unnecessary check for duplicate precolored operands
An instruction can have at most one operand precolored to the same register.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31362>
2024-10-07 07:00:20 +00:00
Daniel Schürmann
9b2c4c4644 aco/ra: manually fill killed operands when required
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31362>
2024-10-07 07:00:20 +00:00
Daniel Schürmann
b530b67c73 aco/ra: add RegisterFile::fill_killed_operands(Instruction*) helper
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31362>
2024-10-07 07:00:20 +00:00
Daniel Schürmann
30e7644e5f aco: simplify Definition constructors
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31362>
2024-10-07 07:00:19 +00:00
Rhys Perry
96e7cd89ea aco: fix is_vector_intact for GFX11 BVH
fossil-db (navi31):
Totals from 44 (0.06% of 79395) affected shaders:
Instrs: 1539111 -> 1539109 (-0.00%); split: -0.00%, +0.00%
CodeSize: 7880452 -> 7880380 (-0.00%); split: -0.00%, +0.00%
Latency: 7578794 -> 7578844 (+0.00%); split: -0.00%, +0.00%
InvThroughput: 1450872 -> 1450876 (+0.00%); split: -0.00%, +0.00%
VClause: 40014 -> 40010 (-0.01%)
Copies: 116005 -> 116001 (-0.00%); split: -0.01%, +0.01%
VALU: 854630 -> 854626 (-0.00%); split: -0.00%, +0.00%

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/31346>
2024-10-03 17:55:56 +00:00
Rhys Perry
24c60be1ad aco: create vector affinities for phi operands
fossil-db (navi21):
Totals from 2934 (3.70% of 79395) affected shaders:
Instrs: 8368484 -> 8365630 (-0.03%); split: -0.05%, +0.01%
CodeSize: 46032152 -> 45998480 (-0.07%); split: -0.09%, +0.01%
VGPRs: 200360 -> 200280 (-0.04%); split: -0.12%, +0.08%
Latency: 85556147 -> 85562615 (+0.01%); split: -0.09%, +0.10%
InvThroughput: 19066462 -> 19065173 (-0.01%); split: -0.09%, +0.09%
VClause: 209834 -> 209783 (-0.02%); split: -0.14%, +0.12%
SClause: 261811 -> 261826 (+0.01%); split: -0.00%, +0.01%
Copies: 727502 -> 724394 (-0.43%); split: -0.56%, +0.13%
Branches: 291083 -> 291120 (+0.01%); split: -0.01%, +0.03%
VALU: 5564021 -> 5560975 (-0.05%); split: -0.07%, +0.02%
SALU: 1100996 -> 1100942 (-0.00%); split: -0.02%, +0.02%

fossil-db (navi31):
Totals from 34207 (43.08% of 79395) affected shaders:
MaxWaves: 1036893 -> 1036781 (-0.01%); split: +0.01%, -0.02%
Instrs: 21977229 -> 21884600 (-0.42%); split: -0.47%, +0.05%
CodeSize: 112680884 -> 112298404 (-0.34%); split: -0.38%, +0.04%
VGPRs: 1590832 -> 1615912 (+1.58%); split: -0.25%, +1.83%
Latency: 142542601 -> 142670271 (+0.09%); split: -0.12%, +0.21%
InvThroughput: 19481055 -> 19434110 (-0.24%); split: -0.44%, +0.20%
VClause: 462865 -> 462558 (-0.07%); split: -0.20%, +0.13%
SClause: 619822 -> 619685 (-0.02%); split: -0.02%, +0.00%
Copies: 1704870 -> 1610889 (-5.51%); split: -5.89%, +0.38%
Branches: 518238 -> 518241 (+0.00%); split: -0.01%, +0.01%
VALU: 12230157 -> 12136112 (-0.77%); split: -0.82%, +0.05%
SALU: 2444075 -> 2444099 (+0.00%); split: -0.01%, +0.01%
VOPD: 3443 -> 3476 (+0.96%); split: +1.80%, -0.84%

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11186
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31346>
2024-10-03 17:55:56 +00:00
Rhys Perry
1e60509135 aco: stop using instructions in ra_ctx::vectors
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/31346>
2024-10-03 17:55:56 +00:00
Georg Lehmann
8a43b1e7da aco/ra: do not reuse killed vcc
VCC should only be used if nessecary, to keep it free for instructions
that need/prefer it.

Foz-DB Navi31:
Totals from 132 (0.17% of 79395) affected shaders:
Instrs: 832538 -> 832608 (+0.01%); split: -0.03%, +0.04%
CodeSize: 4310888 -> 4301792 (-0.21%); split: -0.22%, +0.01%
Latency: 6238465 -> 6239198 (+0.01%); split: -0.04%, +0.05%
InvThroughput: 5332353 -> 5336363 (+0.08%); split: -0.03%, +0.10%
Copies: 59420 -> 59392 (-0.05%); split: -0.11%, +0.06%
VALU: 459318 -> 459187 (-0.03%); split: -0.03%, +0.00%
SALU: 109208 -> 109081 (-0.12%); split: -0.14%, +0.03%
VOPD: 6426 -> 6557 (+2.04%); split: +2.10%, -0.06%

Foz-DB Navi21:
Totals from 386 (0.49% of 79395) affected shaders:
Instrs: 3254046 -> 3252423 (-0.05%); split: -0.05%, +0.00%
CodeSize: 17839104 -> 17680580 (-0.89%); split: -0.89%, +0.00%
Latency: 24424322 -> 24426242 (+0.01%); split: -0.01%, +0.01%
InvThroughput: 10140681 -> 10143882 (+0.03%); split: -0.01%, +0.04%
SClause: 80731 -> 80738 (+0.01%); split: -0.01%, +0.02%
Copies: 293719 -> 293593 (-0.04%); split: -0.27%, +0.23%
Branches: 126625 -> 126626 (+0.00%); split: -0.00%, +0.00%
VALU: 2086026 -> 2086029 (+0.00%)
SALU: 502641 -> 501012 (-0.32%); split: -0.33%, +0.00%

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30902>
2024-09-09 19:48:22 +00:00
Rhys Perry
999362f895 aco: have get_subdword_definition_info update DefInfo
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/30761>
2024-09-03 21:14:27 +00:00
Rhys Perry
16ff51bb37 aco/ra: use DefInfo for get_reg_specified
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/30761>
2024-09-03 21:14:27 +00:00
Rhys Perry
1e6741bf6b aco/ra: fix sub-dword get_reg_specified in some cases
For example, v6b MIMG can have sdw_def_info={4, 6}. This now has similar
behaviour as the DefInfo constructor.

fossil-db (navi31):
Totals from 5 (0.01% of 79395) affected shaders:
CodeSize: 29460 -> 29408 (-0.18%); split: -0.29%, +0.11%
Latency: 22133 -> 21934 (-0.90%); split: -2.51%, +1.61%
InvThroughput: 2953 -> 2963 (+0.34%); split: -0.03%, +0.37%
Copies: 410 -> 409 (-0.24%); split: -1.95%, +1.71%
VALU: 3242 -> 3241 (-0.03%); split: -0.25%, +0.22%

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Fixes: 56345b8c61 ("aco: allow reading/writing upper halves/bytes when possible")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30761>
2024-09-03 21:14:27 +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
Daniel Schürmann
6ada0170c4 aco/ra: use arena allocator for hash maps
Also change Key types to uint32_t instead of unsigned.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30898>
2024-09-02 15:31:52 +00:00
Daniel Schürmann
709f60e71d aco/ra: use auto for std container iterators
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30898>
2024-09-02 15:31:52 +00:00
Daniel Schürmann
534031761a aco/ra: avoid rename map lookups in most cases
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30898>
2024-09-02 15:31:52 +00:00
Daniel Schürmann
72464e24b4 aco/ra: add add_rename() helper
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30898>
2024-09-02 15:31:51 +00:00
Georg Lehmann
8f3bb1fb2e aco/ra: always reuse def register for literal copy
Foz-DB Vega10:
Totals from 4056 (6.43% of 63053) affected shaders:
Instrs: 5540797 -> 5540760 (-0.00%); split: -0.00%, +0.00%
CodeSize: 29680912 -> 29680812 (-0.00%); split: -0.00%, +0.00%
SGPRs: 307808 -> 307680 (-0.04%)
Latency: 82483179 -> 82484437 (+0.00%); split: -0.00%, +0.00%
InvThroughput: 45546645 -> 45547091 (+0.00%); split: -0.00%, +0.00%
SClause: 185641 -> 185648 (+0.00%); split: -0.00%, +0.01%
Copies: 642229 -> 642214 (-0.00%); split: -0.01%, +0.01%
SALU: 643132 -> 643107 (-0.00%); split: -0.01%, +0.01%

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30932>
2024-09-02 11:09:55 +00:00
Georg Lehmann
5fb54d1fde aco/ra: fix copying 64bit literal to sgprs
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30932>
2024-09-02 11:09:55 +00:00
Georg Lehmann
364764356c aco/ra: use parallelcopy to copy literal instead of s_mov
This can result in smaller code size.

Foz-DB Vega10:
Totals from 4745 (7.53% of 63053) affected shaders:
CodeSize: 33014176 -> 33007088 (-0.02%); split: -0.02%, +0.00%
Copies: 690055 -> 704738 (+2.13%)

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30932>
2024-09-02 11:09:55 +00:00
Georg Lehmann
607cf5a8e9 aco/ra: unconditionally replace literal with sgpr when promoting to VOP3
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30932>
2024-09-02 11:09:55 +00:00
Daniel Schürmann
162876c875 aco/ra: use live-in variables directly rather than computing them
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30120>
2024-07-16 14:00:49 +00:00
Georg Lehmann
cd9187a1e1 aco/ra: fix affinity for s_addk
The first, non SCC def matters.

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Fixes: 39380d475a ("aco: add affinities for possible sopk optimizations")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29943>
2024-07-10 13:36:00 +00:00