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
Samuel Pitoiset
c2b1978aa4
aco: rework the way various compilation/validation errors are reported
...
The upcoming change will allow to report all ACO errors (or warnings)
directly to the app via VK_EXT_debug_report. This is similar to what
we already do for reporting various SPIRV->NIR errors.
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:06 +02:00
Samuel Pitoiset
bc723dfda7
aco: rename DEBUG_VALIDATE to DEBUG_VALIDATE_IR
...
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:04 +02:00
Rhys Perry
12b99d2581
aco: fix includes in aco_ir.cpp
...
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3300
Fixes: e75946cfef ('aco: move some setup code into helpers')
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6015 >
2020-07-21 22:15:55 +00:00
Rhys Perry
fcd8f69113
aco: print ACO IR before scheduling instead of after
...
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/6013 >
2020-07-21 19:38:43 +00:00
Rhys Perry
bf4b377b9b
aco: make validate() usable in tests
...
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/6013 >
2020-07-21 19:38:43 +00:00
Rhys Perry
e75946cfef
aco: move some setup code into helpers
...
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/6013 >
2020-07-21 19:38:43 +00:00
Daniel Schürmann
0e47fe3fa2
aco: reorder calls to aco_validate() and cleanup aco_compile_shader()
...
The first call of aco_validate should happen after phi lowering.
Otherwise, subdword restrictions might be violated
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5496 >
2020-06-16 14:46:19 +01:00
Daniel Schürmann
331794495e
aco: rename aco_lower_bool_phis() -> aco_lower_phis()
...
We also lower subdword phis, now.
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4492 >
2020-04-10 07:19:27 +00:00
Rhys Perry
7e6aec6687
radv, aco: collect statistics if requested but executables are not
...
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev >
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2965 >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2965 >
2020-04-03 12:12:08 +00:00
Rhys Perry
507956ed04
aco: add vmem/smem score statistic
...
This isn't perfect (for example, changes might not be too meaningful when
comparing shaders with different control flow) but it should be useful for
evaluating scheduler changes.
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2965 >
2020-04-03 12:12:08 +00:00
Rhys Perry
b1544352c0
aco: add various compiler statistics
...
Adds these statistics:
- hash of code and constant data
- number of instructions
- number of copies from pseudo-instructions
- number of branches
- estimate of cycles spent not waiting in s_waitcnt
- number of vmem/smem "clauses"
- sgpr/vgpr usage before scheduling
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2965 >
2020-04-03 12:12:08 +00:00
Rhys Perry
ad2703653f
radv: add code for exposing compiler statistics
...
Statistics will be added to ACO in later commits.
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2965 >
2020-04-03 12:12:08 +00:00
Rhys Perry
f8f7712666
aco: implement GS copy shaders
...
v5: rebase on float_controls changes
v7: rebase after shader args MR and load/store vectorizer MR
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/2421 >
2020-01-24 13:35:07 +00:00
Rhys Perry
bbac52873f
aco: fix uninitialized data in the binary
...
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-By: Timur Kristóf <timur.kristof@gmail.com >
Fixes: 93c8ebfa78 ('aco: Initial commit of independent AMD compiler')
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3081 >
2020-01-13 13:25:32 +00:00
Connor Abbott
bb78f9b4e4
aco: Use common argument handling
...
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev >
2019-11-25 14:17:51 +01:00
Connor Abbott
b45c54ff8d
aco: Use radv_shader_args in aco_compile_shader()
...
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev >
2019-11-25 14:17:51 +01:00
Timur Kristóf
a01d796de4
aco: Set +wavefrontsize64 for LLVM disassembler in GFX10 wave64 mode.
...
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com >
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev >
2019-10-10 09:57:52 +02:00
Rhys Perry
3c966fd688
aco,radv: rename record_llvm_ir/llvm_ir_string to record_ir/ir_string
...
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev >
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
2019-09-26 11:08:47 +01:00
Rhys Perry
15ea1c5cff
aco: store printed backend IR in binary
...
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev >
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
2019-09-26 11:08:31 +01:00
Rhys Perry
6613b81327
aco,radv/aco: get dissassembly for release builds if requested
...
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev >
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
2019-09-26 11:08:09 +01:00
Daniel Schürmann
93c8ebfa78
aco: Initial commit of independent AMD compiler
...
ACO (short for AMD Compiler) is a new compiler backend with the goal to replace
LLVM for Radeon hardware for the RADV driver.
ACO currently supports only VS, PS and CS on VI and Vega.
There are some optimizations missing because of unmerged NIR changes
which may decrease performance.
Full commit history can be found at
https://github.com/daniel-schuermann/mesa/commits/backend
Co-authored-by: Daniel Schürmann <daniel@schuermann.dev >
Co-authored-by: Rhys Perry <pendingchaos02@gmail.com >
Co-authored-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Co-authored-by: Connor Abbott <cwabbott0@gmail.com >
Co-authored-by: Michael Schellenberger Costa <mschellenbergercosta@googlemail.com >
Co-authored-by: Timur Kristóf <timur.kristof@gmail.com >
Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
2019-09-19 12:10:00 +02:00