Fix push constant range validation with multiple entry points#866
Open
rjodinchr wants to merge 1 commit into
Open
Fix push constant range validation with multiple entry points#866rjodinchr wants to merge 1 commit into
rjodinchr wants to merge 1 commit into
Conversation
When a program has multiple entry points, and only a subset of them use image/sampler metadata, the SPIR-V shader declares a larger push constant block that accommodates all potential metadata across the program. Previously, the push constant range in the pipeline layout was calculated per entry point in `cvk_entry_point::init()`. This resulted in a mismatch between the declared SPIR-V push constant block size and the pipeline layout's push constant range size on entry points without metadata usage, triggering Vulkan validation layer errors. This commit resolves the issue by: * Moving the complete push constant range calculation from `cvk_entry_point` to `cvk_program::prepare_push_constant_range()`. * Consolidating all potential push constant sources (binary constants, push constant kernel arguments, image metadata, and sampler metadata) upfront across the entire program. * Ensuring the pipeline layout's push constant range consistently covers the maximum declared SPIR-V block size across all entry points. * Updating the POD buffer size assertion in `create_pod_buffer()` to precisely match `m_entry_point->pod_buffer_size()`.
Contributor
Author
|
Note that we do not see that error in the GitHub CI because the VVL we use is too old. |
There was a problem hiding this comment.
Pull request overview
This pull request fixes Vulkan validation errors caused by mismatched push constant range sizes when a single SPIR-V module contains multiple entry points that use different subsets of image/sampler metadata.
Changes:
- Centralizes push constant range computation at the program level to cover the maximum declared SPIR-V push constant block size across all entry points.
- Consolidates push constant contributors (binary push constants, push-constant kernel args, image metadata, sampler metadata) into a single range calculation.
- Tightens the POD buffer size assertion to require an exact match with the entry point’s computed POD buffer size.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/program.hpp | Adds kernel_argument::is_pushconstant() helper for identifying push-constant kernel arguments. |
| src/program.cpp | Moves/expands push constant range calculation to cvk_program::prepare_push_constant_range() and simplifies per-entry-point logic accordingly. |
| src/kernel.hpp | Updates POD buffer size assertion to require equality with m_entry_point->pod_buffer_size(). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a program has multiple entry points, and only a subset of them use image/sampler metadata, the SPIR-V shader declares a larger push constant block that accommodates all potential metadata across the program. Previously, the push constant range in the pipeline layout was calculated per entry point in
cvk_entry_point::init(). This resulted in a mismatch between the declared SPIR-V push constant block size and the pipeline layout's push constant range size on entry points without metadata usage, triggering Vulkan validation layer errors.This commit resolves the issue by:
cvk_entry_pointtocvk_program::prepare_push_constant_range().create_pod_buffer()to precisely matchm_entry_point->pod_buffer_size().