KhronosGroup / Vulkan-ValidationLayers

Vulkan Validation Layers (VVL)
https://vulkan.lunarg.com/doc/sdk/latest/linux/khronos_validation_layer.html
Other
727 stars 396 forks source link

SPIR-V/shader module validation does not support VK_KHR_maintenance5 and needs explicit vkCreateShaderModule() #8226

Open n9H07 opened 3 days ago

n9H07 commented 3 days ago

Environment:

Describe the Issue

SPIR-V/shader module validation does not support VK_KHR_maintenance5 and needs explicit vkCreateShaderModule().

Expected behavior

The specification states:

If the maintenance5 feature is enabled, shader module creation can be omitted entirely. Instead, applications should provide the VkShaderModuleCreateInfo structure directly in to pipeline creation by chaining it to VkPipelineShaderStageCreateInfo. This avoids the overhead of creating and managing an additional object.

Valid Usage ID

For example, without explicit vkCreateShaderModule(), the following checks are missing:

VUID-RuntimeSpirv-storageBuffer8BitAccess-06328(ERROR / SPEC): msgNum: -1143895426 - Validation Error: [ VUID-RuntimeSpirv-storageBuffer8BitAccess-06328 ] | MessageID = 0xbbd18a7e | vkCreateShaderModule(): SPIR-V contains an 8-bit OpVariable with StorageBuffer Storage Class, but storageBuffer8BitAccess was not enabled. %7 = OpVariable %47 12 . The Vulkan spec states: If storageBuffer8BitAccess is VK_FALSE, then objects containing an 8-bit integer element must not have Storage Class of StorageBuffer, ShaderRecordBufferKHR, or PhysicalStorageBuffer (https://vulkan.lunarg.com/doc/view/1.3.283.0/windows/1.3-extensions/vkspec.html#VUID-RuntimeSpirv-storageBuffer8BitAccess-06328) Objects: 0

VUID-VkShaderModuleCreateInfo-pCode-08740(ERROR / SPEC): msgNum: 115483881 - Validation Error: [ VUID-VkShaderModuleCreateInfo-pCode-08740 ] | MessageID = 0x6e224e9 | vkCreateShaderModule(): SPIR-V Capability Int8 was declared, but one of the following requirements is required (VkPhysicalDeviceVulkan12Features::shaderInt8). The Vulkan spec states: If pCode is a pointer to SPIR-V code, and pCode declares any of the capabilities listed in the SPIR-V Environment appendix, one of the corresponding requirements must be satisfied (https://vulkan.lunarg.com/doc/view/1.3.283.0/windows/1.3-extensions/vkspec.html#VUID-VkShaderModuleCreateInfo-pCode-08740) Objects: 0

BestPractices-LocalWorkgroup-Multiple64(WARN / PERF): msgNum: -2073599464 - Validation Performance Warning: [ BestPractices-LocalWorkgroup-Multiple64 ] | MessageID = 0x84676218 | vkCreateComputePipelines(): pCreateInfos[0] [AMD] compute shader with work group dimensions (1, 1, 1), workgroup size (1), is not a multiple of 64. Make the workgroup size a multiple of 64 to obtain best performance across all AMD GPU generations. Objects: 0

spencer-lunarg commented 1 day ago

(on PTO and will double check all these 3 cases next week before next SDK) but this should all be fixed from https://github.com/KhronosGroup/Vulkan-ValidationLayers/pull/8162