Commit Graph

1359 Commits

Author SHA1 Message Date
Samuel Pitoiset
69da185793 radv: use the ES type to apply a workaround for NGG on GFX10
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22095>
2023-03-29 02:20:50 +00:00
Samuel Pitoiset
73ac2a22ec radv: use the shader info stage to simplify emitting NGG shaders
Instead of relying on the pipeline.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22095>
2023-03-29 02:20:50 +00:00
Samuel Pitoiset
09d713ee53 radv: stop using the pipeline for emitting PS inputs
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22095>
2023-03-29 02:20:50 +00:00
Samuel Pitoiset
168f282908 radv: add radv_get_last_vgt_shader() helper
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22095>
2023-03-29 02:20:50 +00:00
Samuel Pitoiset
5c3c80be45 radv: emit the GS copy shader outside of radv_pipeline_emit_hw_gs()
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22095>
2023-03-29 02:20:50 +00:00
Samuel Pitoiset
d071e36851 radv: stop using get_vs_output_info() when emitting VS/NGG shaders
It's always the current shader outinfo struct.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22095>
2023-03-29 02:20:50 +00:00
Samuel Pitoiset
e61d68ac8a radv: move {esgs,gsvs}_ring_size to radv_legacy_gs_info
To update the ring info when a geometry shader is bound.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22134>
2023-03-27 18:54:50 +00:00
Samuel Pitoiset
c1c8aa49c8 radv: rename gfx9_gs_info to radv_legacy_gs_info
This was misleading because it's also needed on GFX6-8.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22134>
2023-03-27 18:54:50 +00:00
Samuel Pitoiset
66fec16238 radv: add DI_PT_RECTLIST to si_conv_prim_to_gs_out()
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22105>
2023-03-27 17:29:02 +00:00
Samuel Pitoiset
8f6998ad8a radv: separate the sample shading state between FS and graphics pipeline
Sample shading can be enabled inside the fragment shader and also
per-pipeline. Separate both cases to be able to enable sample shading
by only binding a FS.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22110>
2023-03-27 09:29:12 +00:00
Samuel Pitoiset
774e055823 radv: move uses_user_sample_locations to radv_multisample_state
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22110>
2023-03-27 09:29:11 +00:00
Samuel Pitoiset
4dc40c3b64 radv: move radv_meta_* to a new folder
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22046>
2023-03-27 06:27:49 +00:00
Daniel Schürmann
56b6ca411f radv/rt: Fix VK_KHR_pipeline_executable_properties
We don't provide executable properties for the prolog shader.

Fixes: f123d65e9f ('radv/rt: use prolog for raytracing shaders')
Fixes: dEQP-VK.pipeline.monolithic.shader_module_identifier.pipeline_from_id.ray_tracing_libs.*
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22111>
2023-03-24 19:50:46 +00:00
Daniel Schürmann
3806cd83f2 radv: skip pipeline caching with RADV_DEBUG=shaders
in order to create reproducible cache entries.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22029>
2023-03-24 19:03:29 +00:00
Daniel Schürmann
5051980ff8 radv: remove radv_create_gs_copy_shader()
We can replace the call with radv_shader_nir_to_asm().

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22029>
2023-03-24 19:03:29 +00:00
Samuel Pitoiset
879ddf9720 radv: rework binding shaders to cmdbuf by introducing new helpers
For future work.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22101>
2023-03-24 16:21:49 +00:00
Samuel Pitoiset
af1bc7f4ce radv: remove radv_pipeline::device completely
This is unecessary and this prevents using a ton of functions without
a radv_pipeline object.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22090>
2023-03-24 13:48:40 +00:00
Samuel Pitoiset
d07c81d87e radv: move cs_regalloc_hang_bug to radv_shader_info
This is more like a shader property.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22102>
2023-03-24 12:43:51 +00:00
Timur Kristóf
500f3e0bde radv: Use PRIM_ATTR for PS inputs on GFX11.
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/21409>
2023-03-23 11:49:35 +00:00
Samuel Pitoiset
cd59db8c46 radv: pass radv_shader to radv_shader_need_indirect_descriptor_sets()
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21878>
2023-03-21 20:36:13 +00:00
Samuel Pitoiset
444c5887c2 radv: pass radv_shader to radv_dump_shader_stats()
Preliminary work for moving the shaders array outside of radv_pipeline.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21878>
2023-03-21 20:36:13 +00:00
Samuel Pitoiset
d7c5b6fb94 radv: replace radv_lookup_user_sgpr() by radv_get_user_sgpr()
radv_get_user_sgpr() no longer relies on radv_pipeline which is
another step for moving the shaders array outside of it.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21878>
2023-03-21 20:36:12 +00:00
Samuel Pitoiset
5082b6b034 radv: add support for caching PS epilogs
For PS epilogs created at link time because libraries are still not
cached.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21897>
2023-03-21 13:53:59 +00:00
Samuel Pitoiset
83c20b95dd radv: allow to return the PS epilog binary to the pipeline
To add it to the shaders cache.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21897>
2023-03-21 13:53:59 +00:00
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