Skip to content

Fix push constant range validation with multiple entry points#866

Open
rjodinchr wants to merge 1 commit into
kpet:mainfrom
rjodinchr:pr/fix-pc-range-vvl
Open

Fix push constant range validation with multiple entry points#866
rjodinchr wants to merge 1 commit into
kpet:mainfrom
rjodinchr:pr/fix-pc-range-vvl

Conversation

@rjodinchr
Copy link
Copy Markdown
Contributor

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().

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()`.
@rjodinchr
Copy link
Copy Markdown
Contributor Author

Note that we do not see that error in the GitHub CI because the VVL we use is too old.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant