Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SYNC-HAZARD-READ_AFTER_WRITE: false positive with VK_EXT_fragment_shader_interlock #4387

Open
csmartdalton opened this issue Aug 5, 2022 · 4 comments
Labels
Synchronization Synchronization Validation Object Issue

Comments

@csmartdalton
Copy link

Describe the Issue

I'm hitting SYNC-HAZARD-READ_AFTER_WRITE in the validation layers for VK_LAYER_KHRONOS_validation, while using the VK_EXT_fragment_shader_interlock interlock extension.

Specific use case:

  1. Issue a draw that stores to an image from inside the interlock
  2. Issue a second draw that then loads the same image from inside the interlock
..\..\src\tests\test_utils\ANGLETest.cpp(65): error: RendererVk.cpp:834 (DebugUtilsMessenger): [ SYNC-HAZARD-READ_AFTER_WRITE ] Validation Error: [ SYNC-HAZARD-READ_AFTER_WRITE ] Object 0: handle = 0x7f000000007f, type = VK_OBJECT_TYPE_IMAGE_VIEW; | MessageID = 0x4cb75b2d | vkCmdDraw: Hazard READ_AFTER_WRITE for VkImageView 0x7f000000007f[], in VkCommandBuffer 0x1ff0a57eca0[], and VkPipeline 0x880000000088[], VkDescriptorSet 0x8a000000008a[], type: VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, imageLayout: VK_IMAGE_LAYOUT_GENERAL, binding #1, index 0. Access info (usage: SYNC_FRAGMENT_SHADER_SHADER_STORAGE_READ, prior_usage: SYNC_FRAGMENT_SHADER_SHADER_STORAGE_WRITE, write_barriers: 0, command: vkCmdDraw, seq_no: 13, reset_no: 1).
                            Object: 0x7f000000007f (type = Image View(14))

One workaround is to also store to the image during draw #(2), after it has been loaded. This can even be done in a branch that never executes:

imageLoad(...);

// Inserting the following block fixes the validation error.
if (myUniformThatEquals0 != 0.0) // Never executes
    imageStore(...);

This appears to be a false positive because the interlock provides the necessary synchronization and ordering guarantees.

Other experiments:

  • All tests pass (on NVIDIA and Intel both) if I just turn off validation layers
  • All tests fail again (on NVIDIA and Intel both) if I turn off validation layers and don't use the interlock

Environment:

@ncesario-lunarg
Copy link
Contributor

@jeremyg-lunarg @jzulauf-lunarg any thoughts? I don't have a good grasp as to why this modification to the shader would have this effect. I also didn't realize sync validation was hooking into the shader module state at all?

@jzulauf-lunarg
Copy link
Contributor

Sync Val is labeled as "limited extension support"... add this to the list of extension needing support.

@ncesario-lunarg ncesario-lunarg added Incomplete Missing Validation VUs to be added Synchronization Synchronization Validation Object Issue labels Aug 18, 2022
@ncesario-lunarg
Copy link
Contributor

Thanks for taking a look @jzulauf-lunarg, are we tracking this somewhere already (i.e., "missing extension support in sync validation")? I wasn't able to find a related issue or project.

@jzulauf-lunarg
Copy link
Contributor

It would probably be easier list what we do support than what we don't. I don't see a clear list of it anywhere.

@jeremyg-lunarg jeremyg-lunarg removed the Incomplete Missing Validation VUs to be added label Sep 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Synchronization Synchronization Validation Object Issue
Projects
None yet
Development

No branches or pull requests

4 participants