Samuel Pitoiset
8e84251cc7
radv: implement fullyCoveredFragmentShaderInputVariable
...
1 means INNER_COVERAGE.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21497 >
2023-03-21 08:44:09 +00:00
Samuel Pitoiset
d750ad19fd
radv: fix NGG streamout with VS and GPL on GFX11
...
With GPL it's not possible to know the primitive topology when
compiling the pre-rasterization stages. For NGG, we use the maximum
number of vertices per prim and rely on the hardware to ignore the
extra bits for points/lines.
Though, this can't work for NGG streamout because the number of
vertices per prim is used to compute a streamout offset. The only
way to solve this is to pass the number of vertices per prim through
a new user SGPR.
This fixes a bunch of streamout tests with Zink/RADV on GFX11.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21833 >
2023-03-20 17:47:03 +00:00
Samuel Pitoiset
0badfd8b20
radv: add helpers for destroying various pipeline types
...
Much cleaner than having a single function for everything.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21894 >
2023-03-20 13:56:32 +00:00
Samuel Pitoiset
abfdc06b01
radv: rename RADV_PIPELINE_LIBRARY to RADV_PIPELINE_RAY_TRACING_LIB
...
This seems more consistent with graphics pipeline libraries and it
avoids any confusion.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21894 >
2023-03-20 13:56:32 +00:00
Tatsuyuki Ishi
22d6556a4b
radv: Fix missing wait of GS copy shader upload for dmashaders.
...
Fixes: 0cde42a506
("radv: Wait for shader uploads asynchronously.")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21985 >
2023-03-18 03:04:15 +00:00
Friedrich Vock
89590c1d84
radv: Add RT shader stage names for executable properties
...
Now that we use raygen shaders, we also need to support RT stages for
executable properties.
Fixes: f123d65e9f
("radv/rt: use prolog for raytracing shaders")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21960 >
2023-03-16 21:28:03 +00:00
Tatsuyuki Ishi
0cde42a506
radv: Wait for shader uploads asynchronously.
...
This introduces tracking of the required semaphore values in pipelines,
which is then propagated to cmd_buffers on bind. Each queue also keeps
track the maximum count it has waited for, so that we can avoid the waiting
overhead once all the shaders are loaded and referenced.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16271 >
2023-03-16 18:02:57 +00:00
Timur Kristóf
27c8131978
radv: Apply swizzle and alpha adjust in radv_nir_lower_vs_inputs.
...
Deal with VS input related things in a single pass instead of
having two different passes.
Fossil DB stats on Rembrandt (GFX10.3):
Totals from 174 (0.13% of 134913) affected shaders:
VGPRs: 7736 -> 7520 (-2.79%)
CodeSize: 354004 -> 353604 (-0.11%); split: -0.17%, +0.06%
MaxWaves: 4196 -> 4248 (+1.24%)
Instrs: 65228 -> 65139 (-0.14%); split: -0.19%, +0.06%
Latency: 265823 -> 265728 (-0.04%); split: -0.12%, +0.08%
InvThroughput: 84629 -> 84644 (+0.02%); split: -0.08%, +0.10%
VClause: 1618 -> 1606 (-0.74%); split: -0.93%, +0.19%
SClause: 1382 -> 1379 (-0.22%); split: -0.36%, +0.14%
Copies: 5586 -> 5566 (-0.36%); split: -0.55%, +0.20%
PreSGPRs: 4994 -> 5037 (+0.86%); split: -0.10%, +0.96%
PreVGPRs: 4948 -> 4955 (+0.14%); split: -0.04%, +0.18%
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com >
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com >
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16805 >
2023-03-15 14:54:27 +00:00
Timur Kristóf
a46acdbc3f
radv: Lower non-dynamic VS inputs in NIR.
...
Add a new RADV specific NIR pass which lowers VS input
loads to AMD specific buffer load instructions.
We do this because we want to remove the RADV specific
VS input handling from the shader compiler back-ends.
Fossil DB stats on Rembrandt (GFX10.3):
Totals from 32507 (24.09% of 134913) affected shaders:
VGPRs: 1245512 -> 1245344 (-0.01%); split: -0.35%, +0.34%
SpillSGPRs: 1068 -> 1102 (+3.18%)
CodeSize: 90333192 -> 90327232 (-0.01%); split: -0.07%, +0.06%
MaxWaves: 881816 -> 881388 (-0.05%); split: +0.23%, -0.28%
Instrs: 17264710 -> 17264562 (-0.00%); split: -0.09%, +0.09%
Latency: 87300501 -> 86586480 (-0.82%); split: -1.07%, +0.25%
InvThroughput: 13700046 -> 13685931 (-0.10%); split: -0.20%, +0.10%
VClause: 361520 -> 361301 (-0.06%); split: -1.32%, +1.26%
SClause: 441018 -> 441505 (+0.11%); split: -0.54%, +0.65%
Copies: 1371477 -> 1373838 (+0.17%); split: -0.57%, +0.75%
Branches: 496639 -> 496611 (-0.01%); split: -0.01%, +0.00%
PreSGPRs: 1122956 -> 1122663 (-0.03%); split: -0.09%, +0.06%
PreVGPRs: 976051 -> 995717 (+2.01%); split: -0.12%, +2.14%
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com >
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com >
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16805 >
2023-03-15 14:54:27 +00:00
Samuel Pitoiset
4d03bf0f9d
radv: allow to cache optimized (LTO) pipelines with GPL
...
This should be working now, except PS epilogs that are still not
added to the cache.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21834 >
2023-03-13 13:35:24 +00:00
Samuel Pitoiset
532d63993f
radv: keep track of the retained NIR shaders sha1 for LTO pipelines
...
Otherwise the per pipeline cache key doesn't consider shaders at all
when they are imported from libs.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21834 >
2023-03-13 13:35:24 +00:00
Samuel Pitoiset
fbc7e8f3df
radv: determine if a graphics pipeline needs a noop FS earlier
...
Also introduce a helper.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21834 >
2023-03-13 13:35:24 +00:00
Samuel Pitoiset
86ab8c33ed
radv: fix the error code when the driver fails to create a PS epilog
...
It would have been returned VK_SUCCESS.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21834 >
2023-03-13 13:35:24 +00:00
Mike Blumenkrantz
e28b982db8
radv: avoid a huge memset in radv_graphics_pipeline_compile()
...
this has a noticeable impact on pipeline creation
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20947 >
2023-03-13 08:11:10 +01:00
Samuel Pitoiset
1c286db14e
radv: zero-initialize radv_shader_info earlier for graphics pipeline
...
This should allow us to remove a big memset when compiling a
graphics pipeline. This is mostly for imported NIR stages which
don't go through radv_pipeline_stage_init().
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20947 >
2023-03-13 08:11:10 +01:00
Samuel Pitoiset
67635bb3e3
radv: zero-initialize radv_shader_args right before declaring them
...
This should allow us to remove a big memset when compiling a
graphics pipeline. This is mostly for imported NIR stages which
don't go through radv_pipeline_stage_init().
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20947 >
2023-03-13 08:11:10 +01:00
Mike Blumenkrantz
c505f892d4
radv: delete radv_graphics_pipeline_compile() asserts
...
validation should catch these by now
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20947 >
2023-03-13 08:11:10 +01:00
Samuel Pitoiset
d1e724b952
radv: do not emit PA_SC_VRS_OVERRIDE_CNTL from the pipeline on GFX11
...
PA_SC_VRS_OVERRIDE_CNTL is emitted when a framebuffer is bound because
it controls the VRS surface enable bit. Though, if a pipeline is bound
after the framebuffer is emitted, it can override the state. Remove it
completely since VRS for flat shading and RADV_FORCE_VRS are disabled.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20333 >
2023-03-08 10:30:48 +00:00
Samuel Pitoiset
c186420b26
radv: add support for VRS attachment on GFX11
...
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20333 >
2023-03-08 10:30:48 +00:00
Daniel Schürmann
d87bbee0be
radv: remove unused parameters from radv_compute_pipeline_compile()
...
Also make this function static.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21764 >
2023-03-07 17:00:50 +00:00
Daniel Schürmann
f1565de4cc
radv: expose radv_pipeline_capture_shaders()
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21764 >
2023-03-07 17:00:50 +00:00
Daniel Schürmann
2fbd495ce7
radv: expose radv_postprocess_nir()
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21764 >
2023-03-07 17:00:50 +00:00
Daniel Schürmann
3e03fe44e7
radv/rt: move stack_sizes into radv_ray_tracing_module
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21667 >
2023-03-06 13:58:54 +00:00
Daniel Schürmann
48edcd03c5
radv/rt: introduce struct radv_ray_tracing_module
...
This is preliminary work for separate shader functions.
The ray_tracing_module is eventually intended as self-contained
pipeline struct per RT group.
For now, these modules only contain the group handles.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21667 >
2023-03-06 13:58:54 +00:00
Timur Kristóf
05e6d945ad
radv: Emulate VGT_ESGS_ITEMSIZE in shaders on GFX9+.
...
Signed-off-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/21434 >
2023-03-03 20:15:10 +00:00
Marek Olšák
4f7e353237
amd: lower multi-component subdword SSBO loads in NIR
...
because the hw and LLVM only support subdword single-component SSBO loads,
and ac_nir_to_llvm splits multi-component loads because of that, which is
inefficient.
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com >
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19399 >
2023-03-03 03:27:40 +00:00
Marek Olšák
82919e2dcb
amd: lower subdword UBO loads in NIR
...
This fixes broken subdword UBO loads with LLVM.
It's only needed for LLVM, but it's done for both LLVM and ACO because
the pass can be fully validated only with ACO and the Vulkan CTS right now.
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com >
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19399 >
2023-03-03 03:27:40 +00:00
Marek Olšák
ccaaf8fe04
amd: massively simplify how info->spi_cu_en is applied
...
Instead of having ac_set_reg_cu_en that sets the register, replace it with
ac_apply_cu_en that only returns the modified register value,
which allows a large simplification in both drivers because a lot of code
becomes duplicated after it's switched to ac_apply_cu_en.
RADV also didn't apply it to a few registers. Fixed.
This removes 82 lines of code in total.
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21641 >
2023-03-03 00:41:48 +00:00
Rhys Perry
dc01f03d1b
radv: remove is_internal pipeline creation parameter
...
Instead, check if the cache is the meta shader cache. This catches the
shaders created by radv_create_radix_sort_u64().
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/21606 >
2023-03-02 16:48:09 +00:00
Samuel Pitoiset
4ec6850210
radv: fix DCC decompress on GFX11
...
The hardware requires one color output to be set by CB registers,
otherwise the DCC decompression does nothing.
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8127
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8175
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8370
Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21629 >
2023-03-02 16:03:31 +00:00
Georg Lehmann
9f155c21c3
amd: d16 uses rtz conversion for 32bit float
...
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21404 >
2023-02-27 09:55:34 +00:00
Georg Lehmann
77252687fa
amd: don't use d16 for integer loads
...
D16 saturates to min/max instead of just truncating.
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21404 >
2023-02-27 09:55:34 +00:00
Georg Lehmann
a00b50d820
nir: change 16bit image dest folding option to per type
...
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21404 >
2023-02-27 09:55:34 +00:00
Marek Olšák
e0c8b24e22
amd/registers: unify VRS combiner definition names between gfx103 and gfx11
...
use gfx11 names
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21525 >
2023-02-24 21:27:24 +00:00
Bas Nieuwenhuizen
ed76833705
radv: Implement & expose VK_EXT_pipeline_library_group_handles.
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21406 >
2023-02-23 22:17:30 +00:00
Samuel Pitoiset
1583b150d6
radv: set VS_OUT_MISC_SIDE_BUS_ENA for clip distances on GFX10.3+
...
On GFX10.3, all auxiliary position exports are optimized, so set it
for clip/cull distances. Both RadeonSI and llpc set it too.
Suggested by Marek.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21439 >
2023-02-22 07:17:33 +00:00
Timur Kristóf
e13074d763
radv: Call nir_lower_array_deref_of_vec in radv_lower_io_to_scalar_early.
...
This fixes an issue when a vector component of an arrayed output has a deref.
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com >
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com >
Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8197
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21028 >
2023-02-17 17:47:47 +00:00
Samuel Pitoiset
78c0fae08c
radv: only skip emitting the pipeline blend state if the FS uses an epilog
...
The blend state is emitted from the command buffer when the FS uses
an epilog (either compiled from a lib with GPL or compiled on-demand).
This shouldn't change anything but it will allow to disable using a
PS epilog when the fragment shader doesn't write any color outputs.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21341 >
2023-02-17 13:19:54 +00:00
Daniel Schürmann
b338d59047
radv: unconditionally enable scratch for RT shaders
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21159 >
2023-02-16 19:37:25 +00:00
Timur Kristóf
74f1b77046
radv: Move VS input lowering to new file: radv_nir_lower_vs_inputs.
...
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com >
Acked-by: Konstantin Seurer <konstantin.seurer@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21358 >
2023-02-16 15:29:37 +00:00
Samuel Pitoiset
214d6d05ed
radv simplify compiling graphics shaders with a mask of active NIR stages
...
Instead of recomputing the same bitfield everywhere.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21237 >
2023-02-13 09:15:37 +00:00
Samuel Pitoiset
8dd0b98786
radv: only initialize shader arguments for the active stages
...
Other stages don't need to be initialized.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21237 >
2023-02-13 09:15:37 +00:00
Samuel Pitoiset
d05a02018b
radv: use last_vgt_api_stage for determining the last stage with XFB
...
It's shorter and cleaner.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21237 >
2023-02-13 09:15:37 +00:00
Samuel Pitoiset
9f8c563e10
radv: fix importing retained NIR shaders when a lib uses the RETAIN bit
...
Fixes couple of GPL regressions with VKCTS, I thought this was test
bugs but it's valid behaviour as long as the libary uses
VK_PIPELINE_CREATE_RETAIN_LINK_TIME_OPTIMIZATION_INFO_BIT_EXT.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21245 >
2023-02-13 08:17:05 +00:00
Samuel Pitoiset
69bd1c0c40
radv: restore uploading shaders individually instead of consecutively
...
The shaders were uploaded consecutively to fit a RGP constraint but
this was more like a workaround. This upload path doesn't work well for
graphics pipeline library and it was the main blocker for GPL caching.
This commit breaks capturing shaders with RGP if the offset between
shaders is too big. Next commit should fix it by using shaders reloc.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21078 >
2023-02-10 13:42:14 +00:00
Samuel Pitoiset
46aee750c6
radv: stop skipping the cache for monolithic graphics pipelines with GPL
...
Only libraries and optimized (LTO) pipelines are still unsupported,
but there is no reason to skip the cache for monolithic pipelines.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21198 >
2023-02-09 08:11:45 +00:00
Samuel Pitoiset
26896616c1
radv: stop skipping the cache for compute/raytracing pipelines with GPL
...
This was a hard solution somewhat.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21198 >
2023-02-09 08:11:45 +00:00
Samuel Pitoiset
53cea404f7
radv: simplify creating a FS epilog from a library
...
It's now compiled in radv_graphics_pipeline_compile().
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21140 >
2023-02-09 07:48:03 +00:00
Samuel Pitoiset
06d17fccfb
radv: make sure to disable MRT compaction when compiling a PS epilog with GPL
...
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21140 >
2023-02-09 07:48:03 +00:00
Samuel Pitoiset
16e4dd3e37
radv: fix disabling MRT compaction for on-demand PS epilogs
...
Some dynamic states require to compile PS epilogs on-demand. In this
case, MRT compaction should be disabled because we don't know the CB
state when compiling the fragment shader.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21140 >
2023-02-09 07:48:03 +00:00