Samuel Pitoiset
9692ef41a3
aco: implement bitfield_extract for 8-bit/16-bit
...
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35199 >
2025-05-29 12:24:59 +00:00
Samuel Pitoiset
8596150ae8
aco: implement bitfield_reverse for types other than 32-bits
...
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34583 >
2025-05-28 09:52:12 +00:00
Daniel Schürmann
5b4d284493
aco/isel: use vector-aligned operands for image_bvh64_intersect_ray
...
Totals from 93 (0.12% of 79377) affected shaders: (Navi48)
MaxWaves: 1376 -> 1368 (-0.58%)
Instrs: 3583500 -> 3581861 (-0.05%); split: -0.05%, +0.00%
CodeSize: 18792300 -> 18785296 (-0.04%); split: -0.04%, +0.00%
VGPRs: 8652 -> 8592 (-0.69%); split: -1.25%, +0.55%
Latency: 20861347 -> 20834407 (-0.13%); split: -0.17%, +0.04%
InvThroughput: 4032604 -> 4028020 (-0.11%); split: -0.14%, +0.03%
VClause: 90507 -> 90525 (+0.02%); split: -0.01%, +0.03%
Copies: 279429 -> 277839 (-0.57%); split: -0.58%, +0.01%
Branches: 100260 -> 100251 (-0.01%)
PreVGPRs: 8949 -> 8771 (-1.99%)
VALU: 1955635 -> 1954053 (-0.08%); split: -0.08%, +0.00%
SALU: 477347 -> 477329 (-0.00%); split: -0.01%, +0.01%
VOPD: 69 -> 61 (-11.59%)
Totals from 93 (0.12% of 79377) affected shaders: (Navi31)
MaxWaves: 1376 -> 1374 (-0.15%)
Instrs: 3442606 -> 3440344 (-0.07%); split: -0.07%, +0.00%
CodeSize: 17801008 -> 17790476 (-0.06%); split: -0.07%, +0.01%
VGPRs: 8652 -> 8556 (-1.11%); split: -1.25%, +0.14%
Latency: 20590943 -> 20542279 (-0.24%); split: -0.27%, +0.03%
InvThroughput: 3978133 -> 3969497 (-0.22%); split: -0.25%, +0.03%
VClause: 91784 -> 91769 (-0.02%); split: -0.05%, +0.03%
Copies: 277177 -> 275263 (-0.69%); split: -0.70%, +0.01%
Branches: 100098 -> 100092 (-0.01%); split: -0.02%, +0.01%
PreVGPRs: 9021 -> 8843 (-1.97%)
VALU: 2001794 -> 1999893 (-0.09%); split: -0.10%, +0.00%
SALU: 419504 -> 419559 (+0.01%); split: -0.01%, +0.02%
VOPD: 77 -> 64 (-16.88%)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34359 >
2025-05-28 09:24:17 +00:00
Rhys Perry
c50f9541e4
aco/tests: Add tests for vector-aligned operands
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34359 >
2025-05-28 09:24:17 +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
Daniel Schürmann
9091c3bf5b
aco/ra: add affinities for MIMG vector-aligned operands
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34359 >
2025-05-28 09:24:17 +00:00
Daniel Schürmann
fb689f133e
aco/ra: handle register assignment of vector-aligned operands
...
Vector-aligned operands are handled by temporarily allocating
a vector-SSA value for the duration of the instruction.
On completion of the register assignment, the individual
operands are assigned to the reserved register space and,
if necessary, parallelcopies are emitted.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34359 >
2025-05-28 09:24:17 +00:00
Daniel Schürmann
92b1154397
aco/ra: Always rename copy-kill operands, even if the temporary doesn't match
...
This makes it independent of whether the operand already got renamed or not.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34359 >
2025-05-28 09:24:17 +00:00
Daniel Schürmann
4fad3514a9
aco/ra: only change registers of already handled operands in update_renames()
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34359 >
2025-05-28 09:24:17 +00:00
Daniel Schürmann
51a2e1eb94
aco/ra: don't use kill-flags as indicator in get_reg_create_vector()
...
We are about to re-use this function for vector-aligned operands.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34359 >
2025-05-28 09:24:17 +00:00
Daniel Schürmann
3d8b355f22
aco/assembler: support vector-aligned operands on MIMG instructions
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34359 >
2025-05-28 09:24:17 +00:00
Daniel Schürmann
8cb1700c74
aco/print_ir: print parenthesis around vector-aligned operands
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34359 >
2025-05-28 09:24:16 +00:00
Daniel Schürmann
6aabcb02a1
aco/print_ir: only print 'lateKill' if requested via print_kill flag
...
Also only print lateKill for actually killed operands.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34359 >
2025-05-28 09:24:16 +00:00
Daniel Schürmann
a9645fdd89
aco: introduce concept of vector-aligned Operands
...
Operand::isVectorAligned indicates that the Operand is part of a vector
consisting of multiple operands. Therefore, it must reside in a register
aligned with the next Operand.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34359 >
2025-05-28 09:24:16 +00:00
Daniel Schürmann
a4fa3935fd
aco/live_var_analysis: set same lateKill flags for same operands
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34359 >
2025-05-28 09:24:16 +00:00
Daniel Schürmann
ee0ee282b9
aco: simplify Operand() constructor
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34359 >
2025-05-28 09:24:16 +00:00
Rhys Perry
072e6d1ab5
aco/tests: add tests for tied definitions
...
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Some of these would have failed before the rewrite.
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:47 +00:00
Rhys Perry
b341a12526
aco/ra: rewrite handling of tied definitions
...
The old version worked by precoloring both the operand and definition to
whatever register the operand was at the time. This didn't allow moving
the operand/definition after precoloring them, or two tied operands with
the same temporary.
The new version works by temporarily making the operands late kill and
creating a copy if the temporary is live-through or used as another tied
operand. Then we can simply later make the operands early kill again and
assign the definitions to the operand's register.
This way, we can move the operand to make space and the new location will
not intersect with any other definition and won't cause the operand and
definition registers to mismatch.
fossil-db (gfx1201):
Totals from 2253 (2.84% of 79377) affected shaders:
Instrs: 1634747 -> 1630799 (-0.24%); split: -0.27%, +0.03%
CodeSize: 8688148 -> 8672348 (-0.18%); split: -0.20%, +0.02%
VGPRs: 106500 -> 106512 (+0.01%)
Latency: 11385480 -> 11382965 (-0.02%); split: -0.04%, +0.01%
InvThroughput: 1754430 -> 1754326 (-0.01%); split: -0.01%, +0.00%
SClause: 38954 -> 38964 (+0.03%); split: -0.01%, +0.04%
Copies: 110772 -> 110800 (+0.03%); split: -0.02%, +0.04%
Branches: 29093 -> 29092 (-0.00%)
VALU: 902011 -> 902008 (-0.00%)
SALU: 260175 -> 260203 (+0.01%); split: -0.01%, +0.02%
fossil-db (navi31):
Totals from 2 (0.00% of 79377) affected shaders:
Latency: 1766 -> 1765 (-0.06%)
InvThroughput: 3219 -> 3215 (-0.12%)
fossil-db (navi21):
Totals from 14 (0.02% of 79377) affected shaders:
(no affected stats)
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:47 +00:00
Rhys Perry
cdf3767001
aco: set copy-kill for tied operands with the same temporary
...
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:47 +00:00
Rhys Perry
f783f5df6d
aco/ra: move optimize_encoding earlier
...
We have to handle tied definitions after optimize_encoding, but a rewrite
of that will need the register file from before clearing the killed
operands.
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:47 +00:00
Rhys Perry
fd05181a26
aco/ra: replace skip_renaming with copy_kill
...
This will be used in the next commit.
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
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
0257644130
aco: assume sram ecc is enabled on Vega20
...
There are D16 load issues on Vega20 that are expected if sram ecc is enabled.
It's a professional class chip and I found mentions of it supporting ecc,
so assume it's enabled.
Maybe this could be improved by querying ecc info from the kernel, but
I'm not sure which query should be used.
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13189
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12393
Cc: mesa-stable
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35045 >
2025-05-20 08:24:21 +00:00
Georg Lehmann
cd4c0bc58e
aco: don't use constant_bits when not applying constants
...
This is incorrect for 16bit integer operands.
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35020 >
2025-05-19 13:05:48 +00:00
Georg Lehmann
f98d20fec6
aco: replace get_operand_size with get_operand_type
...
To not use constant_bits everywhere.
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35020 >
2025-05-19 13:05:48 +00:00
Georg Lehmann
e1b35a2721
aco/optimizer: only use get_operand_size for alu
...
It's only used once for pseudo instructions anyway, and that's trivial.
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35020 >
2025-05-19 13:05:48 +00:00
Georg Lehmann
7d59bd399a
aco/optimizer: optimize packed fneg with negative constant
...
We shouldn't rely on constant propagation always creating
positive 1.0 constants.
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35020 >
2025-05-19 13:05:48 +00:00
Georg Lehmann
fa3f207035
aco: swap operands without instructions
...
For future work.
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35020 >
2025-05-19 13:05:48 +00:00
Daniel Schürmann
64eed6807a
aco/isel: move visit_intrinsic() into separate file
...
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34977 >
2025-05-16 11:01:19 +00:00
Daniel Schürmann
8aae636e38
aco/isel: move visit_alu_instr() into separate file
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34977 >
2025-05-16 11:01:19 +00:00
Daniel Schürmann
5342576789
aco/isel: rename aco_instruction_selection.cpp -> aco_isel_nir.cpp
...
Also remove some unused includes and unnecessary static specifiers.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34977 >
2025-05-16 11:01:19 +00:00
Daniel Schürmann
b6442669c1
aco/isel: move select_ps_epilog() into separate file
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34977 >
2025-05-16 11:01:19 +00:00
Daniel Schürmann
776384d99d
aco/isel: move select_ps_prolog() into separate file
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34977 >
2025-05-16 11:01:19 +00:00
Daniel Schürmann
c3ef927e31
aco/isel: move select_vs_prolog() into separate file
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34977 >
2025-05-16 11:01:19 +00:00
Daniel Schürmann
c4ec430c26
aco/isel: move select_rt_prolog() into separate file
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34977 >
2025-05-16 11:01:19 +00:00
Daniel Schürmann
4d910ca301
aco/isel: move select_trap_handler_shader() into separate file
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34977 >
2025-05-16 11:01:19 +00:00
Daniel Schürmann
146ce57f2d
aco/isel: move control-flow helper functions into separate file
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34977 >
2025-05-16 11:01:19 +00:00
Daniel Schürmann
59f314a9a6
aco/isel: move some helper functions into a separate file
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34977 >
2025-05-16 11:01:19 +00:00
Daniel Schürmann
62a92417ef
aco: move instruction selection files to /compiler/instruction selection/ subfolder
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34977 >
2025-05-16 11:01:19 +00:00
Daniel Schürmann
85a4ec32e8
aco: rename aco_instruction_selection_setup.cpp -> aco_isel_setup.cpp
...
Also remove unused includes.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34977 >
2025-05-16 11:01:19 +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
Rhys Perry
e7a7d9ea2e
aco: fix wait_entry::join() when changing vmem_types
...
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
This is a bitmask, not a boolean.
No fossil-db changes.
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/34935 >
2025-05-14 11:22:13 +00:00
Rhys Perry
171920ceed
aco/gfx115: consider point sample acceleration
...
Like 15428e0d786939a5c7629a9978947c8a9112ce96 in LLVM.
fossil-db (gfx1150):
Totals from 909 (1.14% of 79653) affected shaders:
Instrs: 5840489 -> 5840705 (+0.00%); split: -0.00%, +0.00%
CodeSize: 31133460 -> 31134296 (+0.00%); split: -0.00%, +0.00%
Latency: 52982280 -> 53438577 (+0.86%); split: -0.00%, +0.86%
InvThroughput: 10841454 -> 10942682 (+0.93%); split: -0.00%, +0.93%
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Backport-to: 25.0
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34935 >
2025-05-14 11:22:13 +00:00
Daniel Schürmann
83fcd0e908
aco/insert_exec_mask: don't create unnecessary loop-header and -exit phis after demote
...
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
No fossil changes.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33479 >
2025-05-09 17:20:29 +00:00
Daniel Schürmann
7adad4fc0e
aco/isel: assert that terminate intrinsics don't appear in loops
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33479 >
2025-05-09 17:20:29 +00:00
Daniel Schürmann
46f6c73d36
aco/isel: remove check for empty exec mask on uniform continues
...
This could only happen after terminate_if inside loops.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33479 >
2025-05-09 17:20:29 +00:00
Daniel Schürmann
2b0536e921
aco: remove block_kind_continue_or_break workaround and tests
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33479 >
2025-05-09 17:20:29 +00:00
Georg Lehmann
f1c066b353
aco/optimizer: remove instr_usedef_labels completely
...
Some changes because omod/clamp/insert no longer remove label_extract.
Foz-DB GFX1201:
Totals from 15 (0.02% of 79789) affected shaders:
Instrs: 15328 -> 15299 (-0.19%)
CodeSize: 76416 -> 76292 (-0.16%)
Latency: 62306 -> 62288 (-0.03%)
InvThroughput: 6165 -> 6148 (-0.28%)
Copies: 710 -> 709 (-0.14%)
VALU: 7908 -> 7892 (-0.20%)
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34858 >
2025-05-09 14:23:25 +00:00
Georg Lehmann
eb6f5202ac
aco/optimizer: remove label_usedef
...
No Foz-DB changes on NAvi21 and GFX1201.
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34858 >
2025-05-09 14:23:25 +00:00
Georg Lehmann
ffe11c0235
aco/optimizer: create fma without label_usedef
...
Foz-DB GFX1201:
Totals from 1 (0.00% of 79789) affected shaders:
Instrs: 1492 -> 1485 (-0.47%)
CodeSize: 7436 -> 7384 (-0.70%)
Latency: 2738 -> 2743 (+0.18%)
InvThroughput: 364 -> 365 (+0.27%)
SClause: 50 -> 56 (+12.00%)
Copies: 101 -> 100 (-0.99%)
PreSGPRs: 32 -> 31 (-3.12%)
VALU: 700 -> 701 (+0.14%)
SALU: 351 -> 350 (-0.28%)
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34858 >
2025-05-09 14:23:25 +00:00