Conversation
# Conflicts: # wgpu-core/src/device/ray_tracing.rs
| cmd_buf_raw.transition_buffers(&[hal::BufferBarrier { | ||
| buffer: buf, | ||
| usage: hal::StateTransition { | ||
| from: BufferUses::ACCELERATION_STRUCTURE_QUERY, | ||
| to: BufferUses::ACCELERATION_STRUCTURE_QUERY, | ||
| }, | ||
| }]) |
There was a problem hiding this comment.
I think this transition is not doing anything, IIUC we want to transition to BufferUses::ACCELERATION_STRUCTURE_QUERY but do we always know from what state we are transitioning?
[2025-04-24T06:53:16Z ERROR wgpu_test::expectations] Validation Error: vkCmdCopyQueryPoolResults(): WRITE_AFTER_READ hazard detected. vkCmdCopyQueryPoolResults writes to dstBuffer VkBuffer 0xcb1c7c000000001b[(wgpu internal) compaction read-back buffer], which was previously read by vkCmdBuildAccelerationStructuresKHR.
No sufficient synchronization is present to ensure that a write (VK_ACCESS_2_TRANSFER_WRITE_BIT) at VK_PIPELINE_STAGE_2_COPY_BIT does not conflict with a prior read (VK_ACCESS_2_SHADER_READ_BIT) at VK_PIPELINE_STAGE_2_ACCELERATION_STRUCTURE_BUILD_BIT_KHR.
Vulkan insight: an execution dependency is sufficient to prevent this hazard.
Buffer access region: {
offset = 0
size = 8
}
The validation error wants us to transition from SHADER_READ in that case but is it guaranteed that we will always transition from SHADER_READ?
There was a problem hiding this comment.
I'm not sure, I'm not very good at synchronization. The bit that is most confusing about the error is not what we need to transition to (this can be quite easily done) but that the validation layers are claiming that this was passed to vkCmdBuildAccelerationStructuresKHR which this is never passed to. This buffer should only support BufferUses::ACCELERATION_STRUCTURE_QUERY which is equivelent (on Vulkan only) to COPY_DST and so the validation layers should be giving a validation error about invalid uses (I think) but aren't (it's also not passed to this call ever).
There was a problem hiding this comment.
do we always know from what state we are transitioning?
This buffer is blas.compaction_buffer which is only ever used here in a command buffer. The only other use it has is when it is mapped to be read, but that is always after all submissions have finished.
|
After upgrading my vulkan validation layers to 1.4.313.0 I can no longer reproduce the issue. |
# Conflicts: # examples/features/src/ray_cube_compute/mod.rs
|
If you need to update the SDK, can you make a separate PR which does that? |
There are some issues caught by the new sdk that would need to be investigated (e.g: #7696). |
|
Alright, I'll see if I can figure out the upgrade. |
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
Head branch was pushed to by a user without write access
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
Waiting for #7740 which updates the validation layers to fix an issue.Connections
Builds on #7101
Description
Adds BLAS compaction into wgpu (see wgpu-hal changes #7101)
Testing
Adds tests for the added API
Squash or Rebase?
Squash
Checklist
cargo fmt.taplo format.cargo clippy. If applicable, add:--target wasm32-unknown-unknowncargo xtask testto run tests.CHANGELOG.mdentry.