From 535e91679a53620a984fd474d531d686ea670eb4 Mon Sep 17 00:00:00 2001 From: ssjia Date: Wed, 15 Oct 2025 09:06:48 -0700 Subject: [PATCH] [ET-VK][ez] Make pipeline executable properties be controlled by a different macro Prevent the following validation layer errors when building with VULKAN_DEBUG ``` Validation Error: [ VUID-VkComputePipelineCreateInfo-None-09497 ] | MessageID = 0xde3918a7 vkCreateComputePipelines(): pCreateInfos[0].flags has VkPipelineCreateFlagBits values (VK_PIPELINE_CREATE_CAPTURE_STATISTICS_BIT_KHR|VK_PIPELINE_CREATE_CAPTURE_INTERNAL_REPRESENTATIONS_BIT_KHR) that requires the extensions VK_KHR_pipeline_executable_properties. The Vulkan spec states: If the pNext chain does not include a VkPipelineCreateFlags2CreateInfo structure, flags must be a valid combination of VkPipelineCreateFlagBits values (https://vulkan.lunarg.com/doc/view/1.4.321.0/mac/antora/spec/latest/chapters/pipelines.html#VUID-VkComputePipelineCreateInfo-None-09497) Validation 0 vkCreateComputePipelines(): pCreateInfos[0].flags has VkPipelineCreateFlagBits values (VK_PIPELINE_CREATE_CAPTURE_STATISTICS_BIT_KHR|VK_PIPELINE_CREATE_CAPTURE_INTERNAL_REPRESENTATIONS_BIT_KHR) that requires the extensions VK_KHR_pipeline_executable_properties. The Vulkan spec states: If the pNext chain does not include a VkPipelineCreateFlags2CreateInfo structure, flags must be a valid combination of VkPipelineCreateFlagBits values (https://vulkan.lunarg.com/doc/view/1.4.321.0/mac/antora/spec/latest/chapters/pipelines.html#VUID-VkComputePipelineCreateInfo-None-09497) Validation Error: [ VUID-VkComputePipelineCreateInfo-None-09497 ] | MessageID = 0xde3918a7 vkCreateComputePipelines(): pCreateInfos[0].flags has VkPipelineCreateFlagBits values (VK_PIPELINE_CREATE_CAPTURE_STATISTICS_BIT_KHR|VK_PIPELINE_CREATE_CAPTURE_INTERNAL_REPRESENTATIONS_BIT_KHR) that requires the extensions VK_KHR_pipeline_executable_properties. The Vulkan spec states: If the pNext chain does not include a VkPipelineCreateFlags2CreateInfo structure, flags must be a valid combination of VkPipelineCreateFlagBits values (https://vulkan.lunarg.com/doc/view/1.4.321.0/mac/antora/spec/latest/chapters/pipelines.html#VUID-VkComputePipelineCreateInfo-None-09497) Validation 0 vkCreateComputePipelines(): pCreateInfos[0].flags has VkPipelineCreateFlagBits values (VK_PIPELINE_CREATE_CAPTURE_STATISTICS_BIT_KHR|VK_PIPELINE_CREATE_CAPTURE_INTERNAL_REPRESENTATIONS_BIT_KHR) that requires the extensions VK_KHR_pipeline_executable_properties. The Vulkan spec states: If the pNext chain does not include a VkPipelineCreateFlags2CreateInfo structure, flags must be a valid combination of VkPipelineCreateFlagBits values (https://vulkan.lunarg.com/doc/view/1.4.321.0/mac/antora/spec/latest/chapters/pipelines.html#VUID-VkComputePipelineCreateInfo-None-09497) ``` Differential Revision: [D84716453](https://our.internmc.facebook.com/intern/diff/D84716453/) [ghstack-poisoned] --- backends/vulkan/runtime/api/Context.cpp | 9 +++------ backends/vulkan/runtime/api/Context.h | 9 +++------ backends/vulkan/runtime/vk_api/Adapter.cpp | 5 +++-- backends/vulkan/runtime/vk_api/Pipeline.cpp | 5 +++-- backends/vulkan/test/vulkan_compute_api_test.cpp | 5 +++-- 5 files changed, 15 insertions(+), 18 deletions(-) diff --git a/backends/vulkan/runtime/api/Context.cpp b/backends/vulkan/runtime/api/Context.cpp index adb8409d28c..326391424df 100644 --- a/backends/vulkan/runtime/api/Context.cpp +++ b/backends/vulkan/runtime/api/Context.cpp @@ -288,9 +288,8 @@ Context* context() { return context.get(); } -#ifdef VULKAN_DEBUG - -#ifdef VK_KHR_pipeline_executable_properties +#if defined(VK_KHR_pipeline_executable_properties) && \ + defined(ETVK_INSPECT_PIPELINES) VkPipeline Context::get_shader_pipeline( const vkapi::ShaderInfo& shader, @@ -502,9 +501,7 @@ void Context::print_shader_executable_properties( } } -#endif // VK_KHR_pipeline_executable_properties - -#endif // VULKAN_DEBUG +#endif // VK_KHR_pipeline_executable_properties && ETVK_INSPECT_PIPELINES } // namespace api } // namespace vkcompute diff --git a/backends/vulkan/runtime/api/Context.h b/backends/vulkan/runtime/api/Context.h index 9c7301b9971..5764cb6a894 100644 --- a/backends/vulkan/runtime/api/Context.h +++ b/backends/vulkan/runtime/api/Context.h @@ -234,9 +234,8 @@ class Context final { void flush(); -#ifdef VULKAN_DEBUG - -#ifdef VK_KHR_pipeline_executable_properties +#if defined(VK_KHR_pipeline_executable_properties) && \ + defined(ETVK_INSPECT_PIPELINES) VkPipeline get_shader_pipeline( const vkapi::ShaderInfo& shader, @@ -260,9 +259,7 @@ class Context final { const vkapi::ShaderInfo& shader, const vkapi::SpecVarList& spec_constants); -#endif // VK_KHR_pipeline_executable_properties - -#endif // VULKAN_DEBUG +#endif // VK_KHR_pipeline_executable_properties && ETVK_INSPECT_PIPELINES }; bool available(); diff --git a/backends/vulkan/runtime/vk_api/Adapter.cpp b/backends/vulkan/runtime/vk_api/Adapter.cpp index aa76b202882..e0b2f1c978b 100644 --- a/backends/vulkan/runtime/vk_api/Adapter.cpp +++ b/backends/vulkan/runtime/vk_api/Adapter.cpp @@ -113,9 +113,10 @@ VkDevice create_logical_device( #ifdef VK_KHR_shader_integer_dot_product VK_KHR_SHADER_INTEGER_DOT_PRODUCT_EXTENSION_NAME, #endif /* VK_KHR_shader_integer_dot_product */ -#if defined(VK_KHR_pipeline_executable_properties) && defined(VULKAN_DEBUG) +#if defined(VK_KHR_pipeline_executable_properties) && \ + defined(ETVK_INSPECT_PIPELINES) VK_KHR_PIPELINE_EXECUTABLE_PROPERTIES_EXTENSION_NAME, -#endif /* VK_KHR_pipeline_executable_properties */ +#endif /* VK_KHR_pipeline_executable_properties && ETVK_INSPECT_PIPELINES */ }; std::vector enabled_device_extensions; diff --git a/backends/vulkan/runtime/vk_api/Pipeline.cpp b/backends/vulkan/runtime/vk_api/Pipeline.cpp index 994b46b8c76..6fa85924223 100644 --- a/backends/vulkan/runtime/vk_api/Pipeline.cpp +++ b/backends/vulkan/runtime/vk_api/Pipeline.cpp @@ -298,10 +298,11 @@ ComputePipeline::ComputePipeline( }; VkPipelineCreateFlags flags = 0u; -#if defined(VULKAN_DEBUG) && defined(VK_KHR_pipeline_executable_properties) +#if defined(VK_KHR_pipeline_executable_properties) && \ + defined(ETVK_INSPECT_PIPELINES) flags = VK_PIPELINE_CREATE_CAPTURE_STATISTICS_BIT_KHR | VK_PIPELINE_CREATE_CAPTURE_INTERNAL_REPRESENTATIONS_BIT_KHR | flags; -#endif /* VULKAN_DEBUG && VK_KHR_pipeline_executable_properties */ +#endif // VK_KHR_pipeline_executable_properties && ETVK_INSPECT_PIPELINES const VkComputePipelineCreateInfo compute_pipeline_create_info{ VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, // sType diff --git a/backends/vulkan/test/vulkan_compute_api_test.cpp b/backends/vulkan/test/vulkan_compute_api_test.cpp index 189562178a7..7e3d957afdb 100644 --- a/backends/vulkan/test/vulkan_compute_api_test.cpp +++ b/backends/vulkan/test/vulkan_compute_api_test.cpp @@ -102,14 +102,15 @@ TEST_F(VulkanComputeAPITest, print_adapter) { std::cout << *(context()->adapter_ptr()) << std::endl; } -#if defined(VULKAN_DEBUG) && defined(VK_KHR_pipeline_executable_properties) +#if defined(VK_KHR_pipeline_executable_properties) && \ + defined(ETVK_INSPECT_PIPELINES) TEST_F(VulkanComputeAPITest, print_shader_executable_properties) { context()->print_shader_executable_properties( VK_KERNEL(binary_add_nobroadcast__test_half), {0}); } -#endif // VULKAN_DEBUG && VK_KHR_pipeline_executable_properties +#endif // VK_KHR_pipeline_executable_properties && ETVK_INSPECT_PIPELINES std::vector get_reference_strides( const std::vector& sizes,