Commit Graph

214536 Commits

Author SHA1 Message Date
Faith Ekstrand 59a89cd762 vulkan/runtime: Add a vk_compile_shaders() helper
This is just a wrapper around ops->compile() for now but we'll extend it
in the next commit to add some validation.

Acked-by: Eric R. Smith <eric.smith@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36647>
2025-11-06 15:27:29 +00:00
Lionel Landwerlin 5c47ac640b vulkan/runtime: implement VK_KHR_pipeline_binary
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Co-Authored-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36647>
2025-11-06 15:27:28 +00:00
Lionel Landwerlin 2e42e03cec vulkan/runtime: track imported stages
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36647>
2025-11-06 15:27:28 +00:00
Lionel Landwerlin 708cc72b11 vulkan/runtime: switch precomp shaders to blake3 hashes
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36647>
2025-11-06 15:27:27 +00:00
Lionel Landwerlin e9c1947ed6 vulkan/runtime: use only blake3_hash to shader key
To match the VK_MAX_PIPELINE_BINARY_KEY_SIZE_KHR of only 32B.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36647>
2025-11-06 15:27:26 +00:00
Lionel Landwerlin e05a9b77b6 vulkan/runtime: split rt shaders hashing from compile
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36647>
2025-11-06 15:27:26 +00:00
Lionel Landwerlin 08ed1c3da2 vulkan/runtime: split graphics shaders hashing from compile
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36647>
2025-11-06 15:27:25 +00:00
Lionel Landwerlin b2d6ead1ee vulkan/runtime: split compute shader hashing from compile
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36647>
2025-11-06 15:27:24 +00:00
Faith Ekstrand 440e71bdbd vulkan/runtime: Add a get_push_range_for_stage() helper
This is already duplicated a few times and we're about to duplicate it
more.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36647>
2025-11-06 15:27:23 +00:00
Lionel Landwerlin 9a5b0bbba4 vulkan/runtime: use stage flags to track valid stages
We'll want to have only hashes in vk_pipeline_stage so the
vk_pipeline_stage_is_null() helper won't work.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36647>
2025-11-06 15:27:23 +00:00
Lionel Landwerlin 8e93938c3f vulkan/runtime: keep the set layouts on the stack until pipeline creation
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36647>
2025-11-06 15:27:21 +00:00
Lionel Landwerlin ab0bcefab1 vulkan/runtime: split precomp shader hashing from precomp loading
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36647>
2025-11-06 15:27:21 +00:00
Lionel Landwerlin cbc8ec2cc4 vulkan/runtime: drop blake3 hash on precomp shaders
In order to implement VK_KHR_pipeline_binary, we need to be able to
build hash from pipeline creation structures without looking at the
cache.

The blake3 hash on precomp shaders prevents that as its loading from
cache and potentially apply transformation to NIR.

Let's stick to the hash generated by vk_pipeline_hash_shader_stage(),
it does not look at NIR (except for internal shaders) and already hash
the same information :
  * shader code (SPIR-V, identifier, hash)
  * robustness state
  * specialization constants
  * pipeline flags
  * entry point name
  * subgroup information

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36647>
2025-11-06 15:27:20 +00:00
Lionel Landwerlin 6279645fed vulkan/runtime: drop some geometry shader hashing
Following bc64ea2815 ("vulkan: fix shader linking with common
pipelines") we're always linking pre-rasterization shaders together
and the shader hashes are hashed together, so there is no point
hashing :
  - a bitfield of active shaders
  - merged tesselation information

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36647>
2025-11-06 15:27:19 +00:00
Lionel Landwerlin fc6d17a290 vulkan/runtime: simplify robustness state hashing
We're doing the same in vk_pipeline_precomp_shader_create().

Also fixes valgrind warning due to uninitialized fields

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: mesa-stable
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36647>
2025-11-06 15:27:19 +00:00
Lionel Landwerlin f56e118ecd vulkan/runtime: split out partitioning logic
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36647>
2025-11-06 15:27:18 +00:00
Faith Ekstrand 69d7fcd613 pan: Move point size and viewport lowering to postprocess
Panvk calls pan_preprocess_nir() from its preprocess hook that it hands
off to the Vulkan pipeline code.  That hook gets called before we have
the opportunity to lower geometry shaders.  This means that we get our
viewports lowered for the VS and then the geometry shader is trying to
work on lowered viewports, which is wrong.  Instead, we want to lower
later and only apply the viewport transform in the shader that runs as
the hardware VS.

Reviewed-by: Olivia Lee <olivia.lee@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38265>
2025-11-06 14:57:32 +00:00
Faith Ekstrand 6c5f981ba8 pan/bi: Move lower_noperspective*() to postprocess()
Reviewed-by: Olivia Lee <olivia.lee@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38265>
2025-11-06 14:57:32 +00:00
Faith Ekstrand 0ccadf7a86 nir: Check the deref mode in lower_point_size()
This is more robust because it ensures that we only ever check the
location on something that we know is an outupt.  Also, if it's an
output then we know (thanks, validation!) that it's a variable.

Reviewed-by: Olivia Lee <olivia.lee@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38265>
2025-11-06 14:57:31 +00:00
Faith Ekstrand 5ed35866c2 nir: Handle lowered I/O in lower_viewport_transform()
While we're here, make the variable handling a little more robust by
checking the deref mode before assuming there's a reachable variable.

Reviewed-by: Olivia Lee <olivia.lee@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38265>
2025-11-06 14:57:31 +00:00
Faith Ekstrand 949a4458ea pan/bi: Call constant folding in postprocess()
The comment explicitly calls out pan_nir_lower_store_component(), which
is in a different function call so it's a bit weird to have it in the
caller.  Also, we already do this in postprocess() on midgard so it
makes more sense to just move it into bifrost.

Reviewed-by: Olivia Lee <olivia.lee@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38265>
2025-11-06 14:57:31 +00:00
Faith Ekstrand 0fae56e100 pan: roll lower_texture() into postprocess()
Every caller of pan_shader_lower_texture() immediatly called
pan_shader_postprocess() and every caller of pan_shader_postprocess()
lowered textures except blend shaders and those don't texture anyway.

Reviewed-by: Olivia Lee <olivia.lee@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38265>
2025-11-06 14:57:30 +00:00
Samuel Pitoiset dcb9ca1aa6 radv/ci: remove RADV_PERFTEST=video_encode,video_code for GFX6-7
It's not supported at all, so no need to force enable all video
extensions.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38280>
2025-11-06 14:35:19 +00:00
Daniel Schürmann f37bdd664d amd/common: rename ac_fake_hw_db.h -> ac_surface_test.h
As the surface tests are the only user now.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37525>
2025-11-06 13:53:07 +00:00
Daniel Schürmann 7e0ba40264 radeonsi: use ac_null_device_create() when AMD_FORCE_FAMILY is set
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37525>
2025-11-06 13:53:07 +00:00
Daniel Schürmann 4d68056e83 radv: delete winsys/null/*
The null device works without winsys, and now can be found in
amd/common/ac_null_device.c.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37525>
2025-11-06 13:53:07 +00:00
Daniel Schürmann 7d6de8b17e amd, radv: create null device without winsys
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37525>
2025-11-06 13:53:07 +00:00
Daniel Schürmann 04ebbc3c41 radv: remove radeon_winsys::get_chip_name() and use info->marketing_name directly
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37525>
2025-11-06 13:53:07 +00:00
Daniel Schürmann 797ddfe4d2 radv/device: return early in radv_CreateDevice() if creating a null device
Also reorder initialization, so that everything required for compilation
is done first.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37525>
2025-11-06 13:53:07 +00:00
Daniel Schürmann 23ef756496 radv/null_device: set more options which affect compilation
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37525>
2025-11-06 13:53:06 +00:00
Daniel Schürmann 4ad9fb9d2e radv/null_device: don't attempt to upload shaders
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37525>
2025-11-06 13:53:06 +00:00
Daniel Schürmann 6c2d614412 radv: hash keep_executable_info into shader key rather than device cache key
for consistency.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37525>
2025-11-06 13:53:06 +00:00
Daniel Schürmann 5ef8930636 radv: skip shader cache if trap handler is enabled
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37525>
2025-11-06 13:53:06 +00:00
Jose Maria Casanova Crespo a58db214bb v3dv: Enable VK_FORMAT_B8G8R8A8_SNORM format
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38278>
2025-11-06 13:34:53 +00:00
Jose Maria Casanova Crespo c0774030d5 v3dv: Enable VK_FORMAT_B8G8R8A8_SINT and VK_FORMAT_B8G8R8A8_UINT formats
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38278>
2025-11-06 13:34:53 +00:00
Jose Maria Casanova Crespo 5d24610d50 v3dv: Enable VK_FORMAT_A2R10G10B10_UINT_PACK32 format
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38278>
2025-11-06 13:34:52 +00:00
Erik Faye-Lund 8e2d054544 zink/ci: document a nightly failure
This started failing at some point between a35a12dd38 and 2f7b1e8453,
but the nightly CI was out for a long time in between, so it's hard to
tell what commit it to blame without bisecting. I'm going to leave that
up to someone else for now.

To complicate things further, it seems like this one only fails in the
nightly runs, but not in pre-merge. So we list it as a flake instead of
a consisten failure.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38279>
2025-11-06 13:11:20 +00:00
Erik Faye-Lund 3e0a9d6402 zink/ci: document a flake
This test has flaked in nightly runs recently:
- https://gitlab.freedesktop.org/mesa/mesa/-/jobs/87346974
- https://gitlab.freedesktop.org/mesa/mesa/-/jobs/87023195
- https://gitlab.freedesktop.org/mesa/mesa/-/jobs/86961007

Let's just document it for now.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38279>
2025-11-06 13:11:20 +00:00
Natalie Vock e3404af0ed aco/ra: Handle call ABI constraints
Make sure no caller temporaries stay in call-clobbered registers during
execution of a function call.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37381>
2025-11-06 12:09:43 +00:00
Natalie Vock 86a8b1753a aco/ra: Handle callee ABI preserved register constraints
Block preserved register ranges while they can't yet be overwritten,
i.e. before p_spill_preserved and after the last p_reload_preserved.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37381>
2025-11-06 12:09:42 +00:00
Natalie Vock 75b89f233f aco/ra: Don't clear fixed operand sources if they were blocked
That would undo the blocking and allow for conflicting assignments.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37381>
2025-11-06 12:09:42 +00:00
Natalie Vock d4013e7432 aco/ra: Skip blocked regs in get_reg_impl
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37381>
2025-11-06 12:09:41 +00:00
Natalie Vock 7ed1aea9c5 aco/ra: Also consider blocked registers as not containing temps
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37381>
2025-11-06 12:09:41 +00:00
Natalie Vock 642b1f0dce aco/ra: Add utility to clear PhysRegInterval
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37381>
2025-11-06 12:09:40 +00:00
Natalie Vock f0c613765c aco: Add preload_preserved pseudo instruction
These are helper instructions for the spill_preserved pass to insert
reloads for registers that are preserved by the ABI, yet
clobbered by the callee shader.

There is one p_reload_preserved instruction at the end of each block.
This allows us to insert reloads early, to alleviate the high latency of
scratch reloads.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37381>
2025-11-06 12:09:39 +00:00
David Rosca 9dbf49de2c radv/video: Support intra only without dpb
For intra only we need to allocate internal dpb.
This was previously implemented for VP9 decode only, using a buffer.
Change it to image so that we don't have to handle it as special
case everywhere.

Reviewed-by: Benjamin Cheng <benjamin.cheng@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38158>
2025-11-06 08:41:34 +00:00
David Rosca bd151bf8b2 radv/video: Add NULL checks for picture parameters
Fixes vk_layer_validation_tests PositiveVideoDecode.* and
PositiveVideoDecode*.InlineSessionParams

Cc: mesa-stable
Reviewed-by: Benjamin Cheng <benjamin.cheng@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38158>
2025-11-06 08:41:34 +00:00
David Rosca 23a3587aa6 radv/video: Correctly handle no feedback query for encode
Fixes vk_layer_validation_tests PositiveVideoEncodeAV1.*

Cc: mesa-stable
Reviewed-by: Benjamin Cheng <benjamin.cheng@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38158>
2025-11-06 08:41:33 +00:00
David Rosca 6a1c6ab95b vulkan/video: Avoid NULL pointers in session parameters
Always copy parameters that are not guarded by a flag, zero init
the structs if not provided by application.

Fixes vk_layer_validation_tests PositiveVideoEncode*.GetEncodedSessionParams

Cc: mesa-stable
Reviewed-by: Benjamin Cheng <benjamin.cheng@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38158>
2025-11-06 08:41:31 +00:00
David Rosca 67c0b7a529 vulkan/video: Add chroma subsampling to video session
Reviewed-by: Benjamin Cheng <benjamin.cheng@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38158>
2025-11-06 08:41:31 +00:00