KhronosGroup / Vulkan-Docs

The Vulkan API Specification and related tools
Other
2.72k stars 453 forks source link

spv::CapabilityGroups isn't supported #2346

Open mhogdahl opened 2 years ago

mhogdahl commented 2 years ago

VK_AMD_shader_ballot adds support for SPV_AMD_shader_ballot, which adds 'OpCapability Groups' and a bunch of OpGroup-instructions.

Feeding spirv code to vkCreateComputePipelines with 'Capability Groups' result in the validation error below. It says 'Unhandled OpCapability' since 'groups' is missing from string_SpvCapability(spirv_validation_helper.cpp::347). I checked in debugger that it was capability 18. Validation fails in CoreChecks::ValidateShaderCapabilitiesAndExtensions because 'groups' doesn't exist in the spirvCapabilities map.

Validation Error: [ VUID-VkShaderModuleCreateInfo-pCode-01090 ] Object 0: handle = 0x7ff84b0, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x2c00a3d6 | vkCreateShaderModule(): A SPIR-V Capability (Unhandled OpCapability) was declared that is not supported by Vulkan. The Vulkan spec states: pCode must not declare any capability that is not supported by the API, as described by the Capabilities section of the SPIR-V Environment appendix (https://vulkan.lunarg.com/doc/view/1.2.198.1/windows/1.2-extensions/vkspec.html#VUID-VkShaderModuleCreateInfo-pCode-01090)

Spirv-disassembly: CP_BallotTest_00000000_00000001.txt

I'm running on a Radeon Vega64, 1.2.198.1 SDK.

Extensions enabled: Id: 2df0 23:51:56.936 | vkCreateDevice with extensions: Id: 2df0 23:51:56.936 | VK_KHR_swapchain Id: 2df0 23:51:56.936 | VK_KHR_shader_draw_parameters Id: 2df0 23:51:56.936 | VK_EXT_shader_viewport_index_layer Id: 2df0 23:51:56.936 | VK_EXT_shader_subgroup_ballot Id: 2df0 23:51:56.936 | VK_AMD_gcn_shader Id: 2df0 23:51:56.936 | VK_AMD_shader_ballot Id: 2df0 23:51:56.936 | VK_AMD_draw_indirect_count Id: 2df0 23:51:56.936 | VK_AMD_rasterization_order Id: 2df0 23:51:56.936 | VK_AMD_shader_info

sfricke-samsung commented 2 years ago

So the spirv_validation_helper.cpp file is generated from the vk.xml that also populates the Vulkan Spec table https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#spirvenv-capabilities

This type of issue has happen before and I will take the action to add it the Vulkan-Docs repo so when it is added and the Validation Layers grab the new headers, it will automatically generate the correct results

Edit: internal tracker

ncesario-lunarg commented 2 years ago

Thanks @sfricke-samsung!

spencer-lunarg commented 8 months ago

update: As mentioned in https://github.com/KhronosGroup/Vulkan-ValidationLayers/issues/6902

in spirv_grammar_generator.py we will need to add

-                if instruction['class'] == 'Non-Uniform':
+                if instruction['class'] == 'Non-Uniform' or instruction['class'] == 'Group':
spencer-lunarg commented 3 months ago

update - there is an internal tracker for this https://gitlab.khronos.org/vulkan/vulkan/-/merge_requests/5012

Moving here as there is nothing to do on the Validation Layers code side and just waiting for a change to the vk.xml