Daniel Schürmann
1187189235
aco: unify different SALU types into single struct SALU_instruction
...
This removes
- SOP1_instruction
- SOP2_instruction
- SOPC_instruction
- SOPK_instruction
- SOPP_instruction
and their corresponding methods.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28370 >
2024-03-28 11:25:43 +00:00
Daniel Schürmann
5d265257a0
aco: remove SOPP_instruction::block member
...
Re-use SOPP_instruction::imm instead.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28370 >
2024-03-28 11:25:43 +00:00
Daniel Schürmann
cef01e817d
aco: use instr_class::branch to identify SOPP branches
...
Also changes the instr_class of s_trap to instr_class::other.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28370 >
2024-03-28 11:25:43 +00:00
Rhys Perry
588b1ce533
aco: split instruction assembly into functions
...
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/27913 >
2024-03-22 10:29:43 +00:00
Rhys Perry
5651aa7644
aco/gfx11: fix scratch ST mode assembly
...
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27913 >
2024-03-22 10:29:43 +00:00
Rhys Perry
24c02dbfa6
aco: improve printing of VOPD instructions
...
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/27485 >
2024-02-08 12:15:23 +00:00
Rhys Perry
6547e17e60
aco: add VOPD format
...
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/23367 >
2024-02-05 10:51:14 +00:00
Qiang Yu
71fd3c2a35
aco: do not fix_exports when separately compiled ngg vs or es
...
For radeonsi not abort when this case, as it does not jump at
last.
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25631 >
2023-10-26 02:01:49 +00:00
Qiang Yu
6eb0910d45
aco: do not fix_exports when program has epilog
...
PS with epilog does not need to fix_exports. And radeonsi use
p_end_with_regs so does not have jump instruction at last.
radeonsi may also have exec restore instruction, so may break
before reach to p_end_with_regs.
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24973 >
2023-10-10 02:36:34 +00:00
Rhys Perry
0e79f76aa5
aco: add fetch_inactive field to DPP instructions
...
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/25525 >
2023-10-04 18:53:43 +00:00
Rhys Perry
26fce534b5
aco: shrink DPP8_instruction
...
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/25525 >
2023-10-04 18:53:43 +00:00
Rhys Perry
ea633c128c
aco/optimizer_postRA: don't combine DPP across exec on GFX8/9
...
GFX8/9 seem to use FI=0 behaviour.
fossil-db (vega10):
Totals from 1 (0.00% of 63053) affected shaders:
Instrs: 542 -> 570 (+5.17%)
CodeSize: 2928 -> 3040 (+3.83%)
Latency: 2087 -> 2118 (+1.49%)
InvThroughput: 1103 -> 1143 (+3.63%)
Affected shader is from Cyberpunk 2077 fossil.
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Cc: 23.2 <mesa-stable>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9784
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25471 >
2023-09-29 18:23:21 +00:00
Rhys Perry
21db2e7017
aco: reset prefetch in the correct block after removing the exit
...
fossil-db (navi31):
Totals from 279 (0.35% of 79332) affected shaders:
(no stat changes)
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Fixes: c778803d67 ("aco/assembler: change prefetch mode on GFX10.3+ during loops if beneficial")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25312 >
2023-09-25 14:18:46 +00:00
Qiang Yu
b5eaec6c80
aco,radv,radeonsi: rename is_monolithic to merged_shader_compiled_separately
...
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24990 >
2023-09-04 10:53:44 +08:00
Samuel Pitoiset
ee8ba0f98f
aco: adjust fix_exports() for VS/TES as NGG and non-monolithic shaders
...
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24907 >
2023-09-01 06:52:40 +00:00
Qiang Yu
c8687a4b09
aco: do not fix_exports when program is prolog
...
Otherwise fix_export() will abort when find no export.
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24712 >
2023-08-31 02:39:16 +00:00
Qiang Yu
4756388038
aco,radeonsi: save const addr to symbol
...
For radeonsi to relocation const data when combine multiple
shader parts to a single one. So the final shader binary will
begin with exec code of all parts then const data.
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24442 >
2023-08-16 02:27:45 +00:00
Qiang Yu
d3333609e6
aco: don't emit s_endpgm for tcs with epilog
...
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24442 >
2023-08-16 02:27:45 +00:00
Samuel Pitoiset
f4ec2e7bb3
radv,aco: move has_epilog to radv_shader_info
...
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24404 >
2023-08-02 16:59:18 +00:00
Daniel Schürmann
7e4870e8e5
amd: Do shader binary alignment for prefetch at memory allocation time.
...
This makes it consistent between drivers and compilers.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23799 >
2023-07-11 12:01:45 +00:00
Daniel Schürmann
437bf4fccb
amd: move end-of-code marker padding to ACO.
...
This makes it consistent between drivers and compilers.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23799 >
2023-07-11 12:01:45 +00:00
Daniel Schürmann
c778803d67
aco/assembler: change prefetch mode on GFX10.3+ during loops if beneficial
...
Totals from 8864 (6.68% of 132726) affected shaders: GFX11
CodeSize: 90776128 -> 90923760 (+0.16%)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23748 >
2023-07-11 07:15:43 +00:00
Daniel Schürmann
b9c5b273b0
aco/assembler: align loops if it reduces the number of cache lines
...
This is especially beneficial on GFX6-9.
Totals from 11229 (8.46% of 132726) affected shaders: GFX11
CodeSize: 109608640 -> 109840916 (+0.21%)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23748 >
2023-07-11 07:15:43 +00:00
Daniel Schürmann
de8ecc127e
aco/assembler: align resume shaders with cache lines
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23748 >
2023-07-11 07:15:43 +00:00
Timur Kristóf
05928f4200
aco: Use ac_hw_stage instead of aco-specific HWStage.
...
The new ac_hw_stage is going to be used by drivers as well.
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Qiang Yu <yuq825@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23597 >
2023-06-23 12:49:04 +00:00
Eric Engestrom
6b21653ab4
aco: reformat according to its .clang-format
...
Signed-off-by: Eric Engestrom <eric@igalia.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23253 >
2023-06-16 19:59:52 +00:00
Daniel Schürmann
f66f274304
aco: implement nir_intrinsic_load_resume_shader_address_amd
...
Similar to p_constaddr but targeting BBs.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22096 >
2023-06-08 00:37:03 +00:00
Qiang Yu
438dcf6d0f
aco/assembler: handle ds_(add|sub)_gs_reg_rtn encoding
...
They are different than normal DS instructions, only
use DATA[0], not use ADDR.
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23094 >
2023-06-02 09:21:59 +00:00
Georg Lehmann
6a53af3fc8
aco: introduce helper to swap valu operands with modifiers
...
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23059 >
2023-05-18 22:57:23 +00:00
Georg Lehmann
2548f28ab3
aco/assembler: support VOP3P with DPP
...
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22698 >
2023-05-12 13:31:15 +00:00
Qiang Yu
65c3d1869d
aco: allow no export instruction for gfx10+ fs
...
radeonsi will generate no export instruction when no
discard and no output.
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22727 >
2023-04-28 11:33:28 +08:00
Qiang Yu
360176b671
aco,radv: support symbol relocation in aco
...
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22727 >
2023-04-28 11:33:28 +08:00
Georg Lehmann
2c49b7babf
aco/assembler: support VOP12C opsel
...
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22069 >
2023-03-30 03:34:34 +00:00
Timur Kristóf
87de5b2b9e
aco: Don't include headers from radv.
...
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21696 >
2023-03-08 04:39:18 +00:00
Georg Lehmann
57557e8815
aco/assembler/gfx11: simplify 16bit VOP12C promotion to VOP3
...
With the shared struct for modifies, this is can be a lot cleaner now.
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21761 >
2023-03-07 22:38:39 +00:00
Georg Lehmann
097a97cc42
aco: remove VOP[123C]P? structs
...
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21023 >
2023-03-07 11:53:23 +00:00
Georg Lehmann
9abe4850ba
aco: Handle NSA with vectors in get_mimg_nsa_dwords.
...
No Foz-DB changes.
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20370 >
2023-01-11 00:00:38 +00:00
Rhys Perry
6872f8d861
aco/gfx11: allow true 16-bit instructions to access v128+
...
It looks like the LLVM assembler promotes true 16-bit instructions to VOP3
in this case.
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/20251 >
2023-01-10 16:01:38 +00:00
Rhys Perry
810ced93f3
aco: align scratch size during assembly
...
This lets us use less scratch if both VGPR spilling and scratch intrinsics
are used.
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/20534 >
2023-01-09 21:46:13 +00:00
Rhys Perry
9e55b3b790
aco/gfx11: update s_code_end padding
...
Match ac_rtld_open().
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Cc: 22.3 <mesa-stable>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20536 >
2023-01-06 16:09:51 +00:00
Rhys Perry
7cecc81683
aco/gfx11: fix s_waitcnt printing
...
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/17710 >
2022-09-30 20:57:02 +00:00
Rhys Perry
aadb7aef01
aco: add VINTERP instruction format
...
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/17333 >
2022-09-26 14:49:56 +00:00
Rhys Perry
55cd74d468
aco: add LDSDIR instruction format
...
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/17333 >
2022-09-26 14:49:56 +00:00
Rhys Perry
4e55b5b851
aco: update assembler for GFX11
...
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/17333 >
2022-09-26 14:49:56 +00:00
Rhys Perry
d8d99c3c4f
aco: add GFX11 opcode numbers
...
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/17333 >
2022-09-26 14:49:56 +00:00
Rhys Perry
2f74df7117
aco: fix assembly of MUBUF-to-LDS loads
...
These have an implicit m0 read and don't write VGPRs.
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/17333 >
2022-09-26 14:49:56 +00:00
Rhys Perry
78779fd63d
aco: add reg() helper to assembler
...
SGPR encoding is slightly different on GFX11.
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/17333 >
2022-09-26 14:49:56 +00:00
Rhys Perry
7a1b522148
aco: rename Interp_instruction to VINTRP_instruction
...
These is clearer since GFX11 adds another interpolation format.
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/17333 >
2022-09-26 14:49:56 +00:00
Rhys Perry
fb13ed6ff0
aco: fix long-jump version of discard early exit
...
It isn't safe to modify the exec mask before the discard block, and the
definition interferes with GFX11 NOP insertion.
Just use s[0:1] instead, since we won't be using it.
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/18125 >
2022-08-25 16:10:53 +00:00
Rhys Perry
dd105f7c1e
aco: fix assembly of vopc_sdwa writing exec
...
We would assemble an instruction writing vcc instead.
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Fixes: 5ffc73896f ("aco/assembler: Fix v_cmpx with SDWA.")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18077 >
2022-08-16 17:31:33 +00:00