Skip to content

Conversation

@TP-David
Copy link
Contributor

Required to print synchronization validation errors
#1657 (comment)

@robertosfield
Copy link
Collaborator

I have merged this PR as a branch for testing and have added definition of VkValidationFeaturesEXT extension to include/vsg/vk/vulkan.h for backwards compatibility with older vulkan headers (1.2.149 and before don't have it.)

When I run with --sync I don't see any warnings, but if I enable the debug/validation layer as well then I see the sync validation errors:

$ vsgviewer models/openstreetmap.vsgt --sync -d
Validation Error: [ SYNC-HAZARD-WRITE-RACING-READ ] | MessageID = 0xccb77929
vkQueueSubmit(): WRITE_RACING_READ hazard detected. vkCmdCopyBuffer (from VkCommandBuffer 0x6033f063fca0 submitted on the current VkQueue 0x6033efe6e370) writes to VkBuffer 0x2a000000002a, which was previously read by vkCmdDrawIndexed (from VkCommandBuffer 0x6033f0618160 submitted on VkQueue 0x6033efeba4b0). 
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_VERTEX_ATTRIBUTE_READ_BIT) at VK_PIPELINE_STAGE_2_VERTEX_ATTRIBUTE_INPUT_BIT.
Vulkan insight: an execution dependency is sufficient to prevent this hazard.
Objects: 2
    [0] VkQueue 0x6033efe6e370
    [1] VkCommandBuffer 0x6033f063fca0

Validation Error: [ SYNC-HAZARD-WRITE-RACING-READ ] | MessageID = 0xccb77929
vkQueueSubmit(): WRITE_RACING_READ hazard detected. vkCmdCopyBuffer (from VkCommandBuffer 0x6033f0691d60 submitted on the current VkQueue 0x6033efe6e370) writes to VkBuffer 0x2a000000002a, which was previously read by vkCmdDrawIndexed (from VkCommandBuffer 0x6033f0661750 submitted on VkQueue 0x6033efeba4b0). 
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_VERTEX_ATTRIBUTE_READ_BIT) at VK_PIPELINE_STAGE_2_VERTEX_ATTRIBUTE_INPUT_BIT.
Vulkan insight: an execution dependency is sufficient to prevent this hazard.
Objects: 2
    [0] VkQueue 0x6033efe6e370
    [1] VkCommandBuffer 0x6033f0691d60

Validation Error: [ SYNC-HAZARD-WRITE-RACING-READ ] | MessageID = 0xccb77929
vkQueueSubmit(): WRITE_RACING_READ hazard detected. vkCmdCopyBuffer (from VkCommandBuffer 0x6033f04385b0 submitted on the current VkQueue 0x6033efe6e370) writes to VkBuffer 0x2a000000002a, which was previously read by vkCmdDrawIndexed (from VkCommandBuffer 0x6033f0618160 submitted on VkQueue 0x6033efeba4b0). 
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_VERTEX_ATTRIBUTE_READ_BIT) at VK_PIPELINE_STAGE_2_VERTEX_ATTRIBUTE_INPUT_BIT.
Vulkan insight: an execution dependency is sufficient to prevent this hazard.
Objects: 2
    [0] VkQueue 0x6033efe6e370
    [1] VkCommandBuffer 0x6033f04385b0

Validation Error: [ SYNC-HAZARD-WRITE-RACING-READ ] | MessageID = 0xccb77929
vkQueueSubmit(): WRITE_RACING_READ hazard detected. vkCmdCopyBuffer (from VkCommandBuffer 0x6033f063fca0 submitted on the current VkQueue 0x6033efe6e370) writes to VkBuffer 0x2a000000002a, which was previously read by vkCmdDrawIndexed (from VkCommandBuffer 0x6033f0477070 submitted on VkQueue 0x6033efeba4b0). 
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_VERTEX_ATTRIBUTE_READ_BIT) at VK_PIPELINE_STAGE_2_VERTEX_ATTRIBUTE_INPUT_BIT.
Vulkan insight: an execution dependency is sufficient to prevent this hazard.
Objects: 2
    [0] VkQueue 0x6033efe6e370
    [1] VkCommandBuffer 0x6033f063fca0

I can now start looking at these issues and testing the PR fixes. I am also wondering about whether we need to extend the use of the VkValidationFeatureEnableEXT entries beyond VK_VALIDATION_FEATURE_ENABLE_SYNCHRONIZATION_VALIDATION_EXT.

typedef enum VkValidationFeatureEnableEXT {
    VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_EXT = 0,
    VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_RESERVE_BINDING_SLOT_EXT = 1,
    VK_VALIDATION_FEATURE_ENABLE_BEST_PRACTICES_EXT = 2,
    VK_VALIDATION_FEATURE_ENABLE_DEBUG_PRINTF_EXT = 3,
    VK_VALIDATION_FEATURE_ENABLE_SYNCHRONIZATION_VALIDATION_EXT = 4,
    VK_VALIDATION_FEATURE_ENABLE_MAX_ENUM_EXT = 0x7FFFFFFF
} VkValidationFeatureEnableEXT;

@robertosfield robertosfield merged commit b17138e into vsg-dev:master Jan 29, 2026
8 checks passed
@robertosfield
Copy link
Collaborator

I have generalized the set up of the VkValidationFeaturesEXT to make it easier to add further enabled/disabled validation features, and then merged this with VSG master with PR #1667.

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.

2 participants