Daniel Schürmann
a128d444cb
aco: use monotonic_buffer_resource for instructions
...
As monotonic_buffer_resource is not thread-safe,
we use a thread_local instance which gets allocated once.
This change reduces the compile time spent in ACO by
approximately 10%.
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18112 >
2022-09-28 09:25:20 +00:00
Rhys Perry
bd40e1b012
aco: fix hash statistic
...
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Fixes: 897561b7b9 ("aco: add aco_postprocess_shader() helper")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17954 >
2022-08-10 11:56:29 +00:00
Samuel Pitoiset
270cc39648
aco: add support for compiling PS epilogs
...
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17485 >
2022-07-18 18:40:02 +00:00
Samuel Pitoiset
df8fb721a5
radv,aco: rename radv_aco_build_prolog to radv_aco_build_shader_part
...
Will be re-used for PS epilogs.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17485 >
2022-07-18 18:40:02 +00:00
Samuel Pitoiset
897561b7b9
aco: add aco_postprocess_shader() helper
...
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17485 >
2022-07-18 18:40:02 +00:00
Dave Airlie
68642e2c26
aco: drop radv_shader.h include
...
This shouldn't be used anymore
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16445 >
2022-07-01 01:34:19 +00:00
Dave Airlie
9fe2b6b748
aco/radv: provide a vs prolog callback from aco to radv.
...
Avoid building the radv binary in aco, just callback with the
necessary info.
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16445 >
2022-07-01 01:34:19 +00:00
Dave Airlie
2dce77c239
aco/radv: provide a callback from aco shader building to build binary
...
This moves the radv specific code into radv, and calls back from
aco into radv.
This should allow easier radeonsi integration later.
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16445 >
2022-07-01 01:34:19 +00:00
Dave Airlie
e5ec50b3c7
aco: refactor the radv binary builder out of the core aco fn.
...
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16445 >
2022-07-01 01:34:19 +00:00
Samuel Pitoiset
6cab999d6a
radv,aco: rename radv_prolog_binary/radv_shader_prolog to shader_part
...
The same structures and functions will be re-used for PS epilogs.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17084 >
2022-06-21 08:04:50 +00:00
Rhys Perry
be4c1a5f52
radv,aco: disable shader cache when ACO debug options are used
...
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com >
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14594 >
2022-06-02 14:45:55 +00:00
Dave Airlie
a179e1aede
aco/radv: drop radv_nir_compiler_options from aco.
...
Add a new aco input and options structs, then convert from radv
pieces on submit.
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16521 >
2022-05-17 06:15:25 +00:00
Marek Olšák
39800f0fa3
amd: change chip_class naming to "enum amd_gfx_level gfx_level"
...
This aligns the naming with PAL.
Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Acked-by: Pierre-Eric Pellou-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16469 >
2022-05-13 14:56:22 -04:00
Dave Airlie
c44d5d61ce
aco: remove radv vs prolog key from aco internals.
...
This creates an aco specific key, and converts radv to it.
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16342 >
2022-05-11 19:07:11 +00:00
Dave Airlie
04c07a2413
aco/radv: convert to aco shader info at the radv level.
...
This removes the radv shader info type from aco completely.
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16342 >
2022-05-11 19:07:11 +00:00
Samuel Pitoiset
2bf25e6f6e
radv,aco: keep track of the prolog disassembly if necessary
...
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13376 >
2022-01-04 07:50:07 +00:00
Samuel Pitoiset
e836174077
aco: do not print prologs disassembly if no disassembler
...
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13376 >
2022-01-04 07:50:07 +00:00
Samuel Pitoiset
8ec6824335
radv,aco: decouple shader_info/options from radv_shader_args
...
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13287 >
2021-10-22 07:10:40 +00:00
Samuel Pitoiset
aac4e1f822
aco: do not return an empty string when disassembly is not supported
...
Fixes dEQP-VK.pipeline.executable_properties.* on GFX6-7 when
clrxdisasm isn't found. Other generations are also affected if RADV
is built without LLVM.
Cc: 21.3 mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Reviewed-by: Tony Wasserka <tony.wasserka@gmx.de >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13333 >
2021-10-15 09:48:29 +02:00
Rhys Perry
f4ea2d7887
aco: implement aco_compile_vs_prolog
...
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11717 >
2021-10-13 05:13:10 +00:00
Rhys Perry
80841196b2
radv: implement dynamic vertex input state using vertex shader prologs
...
This doesn't actually use the functionality or implement prolog
compilation yet.
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11717 >
2021-10-13 05:13:10 +00:00
Samuel Pitoiset
1585629db2
radv: move ac_shader_config to radv_shader_binary instead of legacy
...
This will allow us to avoid postprocessing binaries when they are
loaded from the shaders cache.
LLVM binaries already contain the shader config as part of the ELF,
so it's duplicated and increase the cache entry by 48 bytes. Though,
I don't think that should matter for LLVM.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12992 >
2021-10-11 12:25:41 +00:00
Samuel Pitoiset
d993b59941
aco: constify radv_shader_{info,args}
...
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13192 >
2021-10-08 14:14:50 +02:00
Tony Wasserka
3c1802accd
radv: Disable shader disassembly when no disassembler is available
...
ACO relies on LLVM to disassemble AMD shaders for ISAs newer than GFX7,
so disassembly needs to be skipped when LLVM is not enabled.
For vkGetPipelineExecutableInternalRepresentationsKHR and vkGetShaderInfoAMD,
the disassembly will not be reported anymore if it can't be generated.
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11319 >
2021-10-01 10:40:18 +02:00
Samuel Pitoiset
82193fa58c
radv: cleanup uses of VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT
...
Use the pipeline key instead of this mess.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13067 >
2021-09-28 08:25:26 +02:00
Daniel Schürmann
1e2639026f
aco: Format.
...
Manually adjusted some comments for more intuitive line breaks.
Reviewed-by: Tony Wasserka <tony.wasserka@gmx.de >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11258 >
2021-07-12 21:27:31 +00:00
Daniel Schürmann
3f9e986d33
aco: add missing Licenses and remove Authors from files
...
Reviewed-by: Tony Wasserka <tony.wasserka@gmx.de >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11271 >
2021-07-12 12:09:31 +00:00
Daniel Schürmann
59fdaa1985
aco: reorder and cleanup #includes
...
Reviewed-by: Tony Wasserka <tony.wasserka@gmx.de >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11271 >
2021-07-12 12:09:31 +00:00
Timur Kristóf
0e4747d3fb
aco: Introduce a new, post-RA optimizer.
...
This commit adds the skeleton of a new ACO post-RA optimizer,
which is intended to be a simple pass called after RA, and
is meant to do code changes which can only be done
after RA.
It is currently empty, the actual optimizations will be added
in their own commits. It only has a DCE pass, which deletes
some dead code generated by the spiller.
Fossil DB results on Sienna Cichlid:
Totals from 375 (0.25% of 149839) affected shaders:
CodeSize: 2933056 -> 2907192 (-0.88%)
Instrs: 534154 -> 530706 (-0.65%)
Latency: 12088064 -> 12084907 (-0.03%); split: -0.03%, +0.00%
InvThroughput: 4433454 -> 4432421 (-0.02%); split: -0.02%, +0.00%
Copies: 81649 -> 78203 (-4.22%)
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/7779 >
2021-05-28 12:14:53 +00:00
Rhys Perry
776ba40115
aco: add and use Program::progress
...
This is used when printing the program and to avoid updating register
demand during post-RA liveness 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/10315 >
2021-04-21 11:09:33 +00:00
Rhys Perry
e2cdbb25c7
aco: add ACO_DEBUG=liveinfo
...
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9599 >
2021-03-19 11:27:05 +00:00
Rhys Perry
38b2e13766
aco: remove vmem/smem score statistics
...
Replaced by the Latency statistic.
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/8994 >
2021-03-11 16:31:19 +00:00
Rhys Perry
a0243f5c47
aco: add ACO_DEBUG=perfinfo
...
This prints the program with each instruction's contribution to it's
latency and various factors for the calculation of the Inverse Throughput
statistic.
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/8994 >
2021-03-11 16:31:19 +00:00
Rhys Perry
23ecceb160
aco: add latency and inverse throughput statistics
...
Latency is estimanted duration of a single wave, ignoring others in the
CU. It is similar to the old cycles statistic except it it's more accurate
and considers memory operations.
The InvThroughput statistic is a combination of MaxWaves, Latency and the
portion of the wave's execution which does not use various resources.
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/8994 >
2021-03-11 16:31:19 +00:00
Rhys Perry
7c7e8942f8
radv,aco: remove aco_compiler_statistics
...
This removes a pointer from radv_shader_binary_legacy::data.
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9411 >
2021-03-05 17:01:16 +00:00
Daniel Schürmann
112f389261
aco: don't abort() if disassembly fails
...
We used that to catch assembly errors in the past,
but now, there are too many hardware features we
use in ACO that are not supported by the LLVM disassembler,
that it is not really suited anymore as a debugging tool.
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8921 >
2021-02-12 19:00:18 +00:00
James Park
a2c981f8d0
aco: Use u_memstream instead of POSIX memstream
...
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7785 >
2020-12-01 11:08:21 +00:00
James Park
8259cfaa65
aco: Replace indexed array initialization
...
Use std::array instead to make MSVC happy.
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7785 >
2020-12-01 11:08:21 +00:00
Rhys Perry
3dfbed2a87
aco: create s_clause on GFX10+
...
This seems to give no measurable benefit to Strange Brigade or Shadow of
Mordor, but it's simple to do, helps in theory and all other compilers do
it.
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5919 >
2020-10-29 15:08:05 +00:00
Rhys Perry
ecdcf22d5d
aco: switch aco_print_asm to a FILE *
...
Streams are really stateful and (IMO) difficult to read for non-trivial
usage. This is also more consistent with NIR and the rest of ACO.
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/7166 >
2020-10-28 17:32:32 +00:00
James Park
af8d488ea5
util,ac,aco,radv: Cross-platform memstream API
...
POSIX memstream is not available on Windows.
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7143 >
2020-10-19 03:37:42 -07:00
Samuel Pitoiset
e3e8d13ada
radv: move compiler statistics to ACO
...
They are really specific to ACO.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7061 >
2020-10-14 15:09:34 +00:00
Samuel Pitoiset
408195ec53
aco: remove useless occurences of radv_nir_compiler_options
...
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7061 >
2020-10-14 15:09:34 +00:00
Samuel Pitoiset
6db3df5c2f
aco: dump the program if the disassembler failed
...
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6979 >
2020-10-09 08:19:46 +02:00
Samuel Pitoiset
ebf2576862
radv,aco: disable opts if VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT
...
Sounds useful to determine if ACO breaks a specific pipeline
because of various optimizations.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6487 >
2020-09-04 06:59:45 +00:00
Samuel Pitoiset
502b9daa7a
aco: add ACO_DEBUG=novn,noopt,nosched for debugging purposes
...
To disable value numbering, optimizations and scheduling.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6470 >
2020-08-27 10:23:51 +00:00
Timur Kristóf
0d194a70c6
aco: Fix unused variable warning by adding ASSERTED.
...
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/6436 >
2020-08-24 15:55:06 +02:00
Samuel Pitoiset
8fd2f5c16d
radv: add a small interface for creating the trap handler shader
...
Similar to the GS copy shader except that NIR is unused because
the shader is written directly using ACO IR.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6384 >
2020-08-24 11:08:24 +00:00
Samuel Pitoiset
a0814a873d
aco: skip unnecessary compiler pass for the trap handler program
...
The shader is written by hands with assigned registers, so most of
the pass are unnecessary.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6384 >
2020-08-24 11:08:24 +00:00
Samuel Pitoiset
e901b901cb
radv,aco: report ACO errors/warnings back via VK_EXT_debug_report
...
To help developers.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6318 >
2020-08-20 08:15:08 +02:00