KhronosGroup / KhronosGroup/Vulkan-ValidationLayers
No validation warnings despite very obviously incorrect synchronization
- Dominant language
- C++
- Stars
- 1k
- Forks
- 504
- Avg merge
- 11h 35m
- Merged PRs (30d)
- 224
Description
**Environment:**
- OS: Windows 10
- GPU: NVIDIA GeForce RTX 2080 Super
- SDK or header version if building from repo: 1.3.243.0
- Options enabled (synchronization, best practices, etc.): Core, Synchronization, QueueSubmit Synchronization, Thread Safety, Handle Wrapping, Object Lifetime, Stateless Parameter
**Describe the Issue**
A single compute dispatch writes to a buffer.
A render pass then uses that buffer as a source of vertex data. It reads from the same buffer segment that the compute shader writes into.
There is no synchronization between the dispatch and the render pass at all.
Since theoretically the compute and graphics work may overlap, this should be a pretty obvious case of a conflict.
However, validation layers produce no warnings.
I observe the same behavior when the compute dispatch writes to an image, which is later used as a texture inside a render pass (again, without synchronization, and the image uses VK_IMAGE_LAYOUT_GENERAL throughout both the compute and render pass) - validation layers produce no warnings.
**Expected behavior**
I would expect some sort of diagnostic message warning that there is a potential conflict here.
**Additional context**
When discussing this issue, it had been pointed out to me that it would be impossible to produce a useful warning here without analyzing what the shader is actually doing - it's possible to bind a storage buffer or image and never write to them, such cases shouldn't trip up validation.
This explanation does make sense (even though it makes me much less confident in my vulkan code despite it having no validation errors). However, another engineer called out the fact that having no barrier between a compute dispatch producing indirect draws and the actual indirect draw call used to emit warnings, but now also does not. Therefore, it is possible that something had regressed within the validation layers.
I would like to get some clarity on this matter.
Is this the expected behavior for the validation layers?
If yes, please treat this issue as a request to add such diagnostics. I understand this may be challenging, but I would even settle for a conservative configurator option like "assume the content of bound storage images / buffers is always modified". It would be better than potentially writing synchronization bugs!
Contributor guide
Assessment
This issue has not been assessed yet.