5. Vulkan Compute (1.3 / 1.4) and the ash Crate¶
5.1 Latest Stable Versions¶
- Vulkan Specification:
Vulkan 1.4(with fullVulkan 1.3compatibility) ash:0.38.0+1.3.281
5.2 Vulkan (1.2 - 1.4) & ash (0.37 - 0.38.0) Changelog¶
A. Promotion of VK_EXT_subgroup_size_control and VK_KHR_synchronization2 to Vulkan 1.3 Core¶
- What changed:
VK_EXT_subgroup_size_controlwas promoted to Vulkan 1.3 core insidevk::PhysicalDeviceVulkan13Features(subgroup_size_controlandcompute_full_subgroups) andvk::PhysicalDeviceVulkan13Properties(min_subgroup_size,max_subgroup_size,required_subgroup_size_stages).VkPipelineShaderStageRequiredSubgroupSizeCreateInfoEXTwas promoted to the core typevk::PipelineShaderStageRequiredSubgroupSizeCreateInfowithout theEXTsuffix.VK_KHR_synchronization2(vkCmdPipelineBarrier2,VkMemoryBarrier2,VkDependencyInfo) was promoted to Vulkan 1.3 core.
B. Specification Validation Rule VUID-VkPipelineShaderStageCreateInfo-pNext-02756¶
- What changed:
Under the Vulkan 1.3 and 1.4 specifications, chaining
vk::PipelineShaderStageRequiredSubgroupSizeCreateInfowithrequired_subgroup_size = 32onto a compute pipeline stage is only valid when all three conditions hold simultaneously: features13.subgroup_size_control == vk::TRUEprops13.min_subgroup_size <= 32 && props13.max_subgroup_size >= 32props13.required_subgroup_size_stagescontainsvk::ShaderStageFlags::COMPUTE- Why it matters: Checking
features13.subgroup_size_control == vk::TRUEalone without inspectingPhysicalDeviceVulkan13Propertiescan cause pipeline creation failure (VK_ERROR_INITIALIZATION_FAILEDor validation errors) on GPUs that supportsubgroup_size_controlbut havemin_subgroup_size = 64or do not permit subgroup size overrides in theCOMPUTEstage.
C. Dynamic Instance Version Negotiation (Vulkan 1.4 vs 1.3)¶
- What changed: On modern drivers supporting
Vulkan 1.4,entry.try_enumerate_instance_version()returns a runtime loader version>= 1.4.0.
5.3 Adaptations in LuminaMoon Source Code¶
1. Dynamic 1.4.0 / 1.3.0 API Negotiation and Subgroup Property Validation¶
- File:
optimizer/crates/luminav-vulkan/src/context.rs - Implementation:
And Vulkan 1.3 device property verification for Wave32 mode:
let supported_instance_version = unsafe { entry .try_enumerate_instance_version()? .unwrap_or(vk::API_VERSION_1_3) }; let target_api_version = if supported_instance_version >= vk::make_api_version(0, 1, 4, 0) { vk::make_api_version(0, 1, 4, 0) } else { vk::make_api_version(0, 1, 3, 0) };let mut props13 = vk::PhysicalDeviceVulkan13Properties::default(); let mut props2 = vk::PhysicalDeviceProperties2::default().push_next(&mut props13); unsafe { instance.get_physical_device_properties2(pdevice, &mut props2) }; let wave32_supported = features13.subgroup_size_control == vk::TRUE && props13.min_subgroup_size <= 32 && props13.max_subgroup_size >= 32 && props13 .required_subgroup_size_stages .contains(vk::ShaderStageFlags::COMPUTE);
2. Clean Drop Implementation on VulkanContext¶
- File:
optimizer/crates/luminav-vulkan/src/context.rs - Implementation: Streamlined logical device destruction (
self.device.destroy_device(None)) afterdevice_wait_idle()without redundantArc::get_mutbranching.