From 8e435deb15124bbf9a7e3340e6cc7975999ed5c5 Mon Sep 17 00:00:00 2001 From: Jon Leech Date: Fri, 30 Aug 2024 02:13:14 -0700 Subject: [PATCH] Change log for August 30, 2024 Vulkan 1.3.295 spec update: Public Issues * Add explicit tag to XML for VK_MAX_PIPELINE_BINARY_KEY_SIZE_KHR in VK_KHR_pipeline_binary (public pull request 2423). * Minor wording change to avoid ambiguity of <> (public pull request 2418). Internal Issues * Deprecate VK_COLOR_SPACE_DOLBYVISION_EXT from VK_EXT_swapchain_colorspace and add a NOTE to VkColorSpaceKHR explaining why (internal issue 3884). * Fix markup in registry schema document to move video tag descriptions to the proper place and avoid mis-grouping of other tag descriptions (internal issue 3978). * Remove structextends="VkPipelineCreateInfoKHR" XML attributes from VkCreate*PipelineCreateInfo structs that were erroneously added with VK_KHR_pipeline_binaries (internal issue 3979). * Add vkCreateRayTracingPipelinesKHR VU and update VkPipelineCreateInfoKHR VU 09604 to disallow pipeline binaries with VK_NV_ray_tracing (internal merge request 6849). New Extensions * VK_KHR_compute_shader_derivatives --- ChangeLog.adoc | 32 ++++ Makefile | 2 +- .../VK_KHR_compute_shader_derivatives.adoc | 71 +++++++++ appendices/glossary.adoc | 12 +- appendices/spirvenv.adoc | 17 ++- chapters/VK_KHR_surface/wsi.adoc | 22 ++- chapters/features.adoc | 27 +++- chapters/limits.adoc | 24 +++ chapters/pipelines.adoc | 10 +- chapters/shaders.adoc | 35 +++-- chapters/synchronization.adoc | 4 +- chapters/textures.adoc | 7 +- .../VK_KHR_compute_shader_derivatives.adoc | 98 +++++++++++++ registry.adoc | 138 +++++++++--------- xml/vk.xml | 47 ++++-- 15 files changed, 421 insertions(+), 125 deletions(-) create mode 100644 appendices/VK_KHR_compute_shader_derivatives.adoc mode change 100755 => 100644 chapters/features.adoc create mode 100644 proposals/VK_KHR_compute_shader_derivatives.adoc mode change 100755 => 100644 xml/vk.xml diff --git a/ChangeLog.adoc b/ChangeLog.adoc index 5e14cb95e..8d7538814 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -14,6 +14,38 @@ appears frequently in the change log. ''' +Change log for August 30, 2024 Vulkan 1.3.295 spec update: + +Public Issues + + * Add explicit tag to XML for + VK_MAX_PIPELINE_BINARY_KEY_SIZE_KHR in VK_KHR_pipeline_binary (public + pull request 2423). + * Minor wording change to avoid ambiguity of + <> (public + pull request 2418). + +Internal Issues + + * Deprecate VK_COLOR_SPACE_DOLBYVISION_EXT from + VK_EXT_swapchain_colorspace and add a NOTE to VkColorSpaceKHR explaining + why (internal issue 3884). + * Fix markup in registry schema document to move video tag descriptions to + the proper place and avoid mis-grouping of other tag descriptions + (internal issue 3978). + * Remove structextends="VkPipelineCreateInfoKHR" XML attributes from + VkCreate*PipelineCreateInfo structs that were erroneously added with + VK_KHR_pipeline_binaries (internal issue 3979). + * Add vkCreateRayTracingPipelinesKHR VU and update VkPipelineCreateInfoKHR + VU 09604 to disallow pipeline binaries with VK_NV_ray_tracing (internal + merge request 6849). + +New Extensions + + * VK_KHR_compute_shader_derivatives + +''' + Change log for August 23, 2024 Vulkan 1.3.294 spec update: Public Issues diff --git a/Makefile b/Makefile index 5748e85ff..881b63716 100644 --- a/Makefile +++ b/Makefile @@ -139,7 +139,7 @@ VERBOSE = # ADOCOPTS options for asciidoc->HTML5 output NOTEOPTS = -a editing-notes -a implementation-guide -PATCHVERSION = 294 +PATCHVERSION = 295 BASEOPTS = ifneq (,$(findstring VKSC_VERSION_1_0,$(VERSIONS))) diff --git a/appendices/VK_KHR_compute_shader_derivatives.adoc b/appendices/VK_KHR_compute_shader_derivatives.adoc new file mode 100644 index 000000000..1c11a5d13 --- /dev/null +++ b/appendices/VK_KHR_compute_shader_derivatives.adoc @@ -0,0 +1,71 @@ +// Copyright 2020-2024 The Khronos Group Inc. +// +// SPDX-License-Identifier: CC-BY-4.0 + +include::{generated}/meta/{refprefix}VK_KHR_compute_shader_derivatives.adoc[] + +=== Other Extension Metadata + +*Last Modified Date*:: + 2024-06-26 +*IP Status*:: + No known IP claims. +*Interactions and External Dependencies*:: + - This extension requires + {spirv}/KHR/SPV_KHR_compute_shader_derivatives.html[`SPV_KHR_compute_shader_derivatives`] + - This extension provides API support for + {GLSLregistry}/khr/GLSL_KHR_compute_shader_derivatives.txt[`GL_KHR_compute_shader_derivatives`] +*Contributors*:: + - Jean-Noe Morissette, Epic Games + - Daniel Koch, NVIDIA + - Pat Brown, NVIDIA + - Stu Smith, AMD + - Jan-Harald Fredriksen, Arm + - Tobias Hector, AMD + - Ralph Potter, Samsung + - Pan Gao, Huawei + - Samuel (Sheng-Wen) Huang, MediaTek + - Graeme Leese, Broadcom + - Hans-Kristian Arntzen, Valve + - Matthew Netsh, Qualcomm + +=== Description + +This extension adds Vulkan support for the +{spirv}/KHR/SPV_KHR_compute_shader_derivatives.html[`SPV_KHR_compute_shader_derivatives`] +SPIR-V extension. + +The SPIR-V extension provides two new execution modes, both of which allow +execution models with defined workgroups to use built-ins that evaluate +derivatives explicitly or implicitly. +Derivatives will be computed via differencing over a 2x2 group of shader +invocations. +The code:DerivativeGroupQuadsKHR execution mode assembles shader invocations +into 2x2 groups, where each group has x and y coordinates of the local +invocation ID of the form (2m+{0,1}, 2n+{0,1}). +The code:DerivativeGroupLinearKHR execution mode assembles shader +invocations into 2x2 groups, where each group has local invocation index +values of the form 4m+{0,1,2,3}. + +The new execution modes are supported in compute shaders and optionally (see +<>) in +mesh and task shaders. + +include::{generated}/interfaces/VK_KHR_compute_shader_derivatives.adoc[] + +=== New SPIR-V Capability + + * <> + * <> + +=== Examples + +None. + +=== Version History + + * Revision 1, 2023-02-27 (Jean-Noe Morissette) + ** Initial draft + ** Add properties and clarify mesh and task support (Daniel Koch) diff --git a/appendices/glossary.adoc b/appendices/glossary.adoc index 776dfe2d4..47817f643 100644 --- a/appendices/glossary.adoc +++ b/appendices/glossary.adoc @@ -412,12 +412,12 @@ Depth/Stencil Resolve Attachment:: endif::VK_VERSION_1_2,VK_KHR_depth_stencil_resolve[] Derivative Group:: - A set of fragment -ifdef::VK_NV_compute_shader_derivatives[] - or compute -endif::VK_NV_compute_shader_derivatives[] - shader invocations that cooperate to compute derivatives, including - implicit derivatives for sampled image operations. + A set of +ifdef::VK_KHR_compute_shader_derivatives,VK_NV_compute_shader_derivatives[compute,] +ifdef::VK_KHR_compute_shader_derivatives[mesh, task,] +ifdef::VK_KHR_compute_shader_derivatives,VK_NV_compute_shader_derivatives[or] + fragment shader invocations that cooperate to compute derivatives, + including implicit derivatives for sampled image operations. Descriptor:: Information about a resource or resource view written into a descriptor diff --git a/appendices/spirvenv.adoc b/appendices/spirvenv.adoc index 7b40244dc..2cc89ae4b 100644 --- a/appendices/spirvenv.adoc +++ b/appendices/spirvenv.adoc @@ -489,6 +489,14 @@ or knowledge of runtime information, such as enabled features. For compute shaders using the code:DerivativeGroupLinearNV execution mode, the product of the dimensions of the local workgroup size must: be a multiple of four + * [[VUID-{refpage}-DerivativeGroupQuadsKHR-10151]] + For compute, mesh, or task shaders using the + code:DerivativeGroupQuadsKHR execution mode, the first two dimensions of + the local workgroup size must: be a multiple of two + * [[VUID-{refpage}-DerivativeGroupLinearKHR-10152]] + For compute, mesh, or task shaders using the + code:DerivativeGroupLinearKHR execution mode, the product of the + dimensions of the local workgroup size must: be a multiple of four * [[VUID-{refpage}-OpGroupNonUniformBallotBitCount-04685]] If code:OpGroupNonUniformBallotBitCount is used, the group operation must: be limited to code:Reduce, code:InclusiveScan, or @@ -980,7 +988,6 @@ ifdef::VK_VERSION_1_1[] buffer, the storage texel buffer through which that memory is accessed must: be dynamically uniform within the invocation group endif::VK_VERSION_1_1[] - * [[VUID-{refpage}-NonUniform-06274]] * [[VUID-{refpage}-None-10148]] If an instruction accesses memory through any resource, ifdef::VK_VERSION_1_1[] @@ -2255,6 +2262,14 @@ endif::VK_KHR_shader_subgroup_rotate[] If <> is not supported, the {StorageClass} of the code:PhysicalStorageBuffer must: not be used if the buffer being accessed is <> +ifdef::VK_KHR_compute_shader_derivatives[] + * [[VUID-{refpage}-meshAndTaskShaderDerivatives-10153]] + If <> is ename:VK_FALSE, the + code:DerivativeGroupLinearKHR and code:DerivativeGroupQuadsKHR execution + modes must: not be used in the code:MeshEXT, code:MeshNV, code:TaskEXT, + or code:TaskNV {ExecutionModel} +endif::VK_KHR_compute_shader_derivatives[] **** -- diff --git a/chapters/VK_KHR_surface/wsi.adoc b/chapters/VK_KHR_surface/wsi.adoc index 8720d2888..c16dd1b0d 100644 --- a/chapters/VK_KHR_surface/wsi.adoc +++ b/chapters/VK_KHR_surface/wsi.adoc @@ -1302,11 +1302,6 @@ ifdef::VK_EXT_swapchain_colorspace[] * ename:VK_COLOR_SPACE_HDR10_ST2084_EXT specifies support for the images in HDR10 (BT2020) color space, encoded according to SMPTE ST2084 Perceptual Quantizer (PQ) specification. - * ename:VK_COLOR_SPACE_DOLBYVISION_EXT specifies support for the images in - Dolby Vision (BT2020) color space, encoded according to SMPTE ST2084 - Perceptual Quantizer (PQ) specification. - The presentation engine is expected to use Dolby's proprietary - techniques to display the image. * ename:VK_COLOR_SPACE_HDR10_HLG_EXT specifies support for the images in HDR10 (BT2020) color space, encoded according to the Hybrid Log Gamma (HLG) specification. @@ -1332,6 +1327,8 @@ ifdef::hidden[] * elink:VkColorSpaceKHR (deprecated aliases) ** etext:VK_COLORSPACE_SRGB_NONLINEAR_KHR <> ** etext:VK_COLOR_SPACE_DCI_P3_LINEAR_EXT <> + * elink:VkColorSpaceKHR (not well-defined) + ** ename:VK_COLOR_SPACE_DOLBYVISION_EXT <> // end::scremoved[] endif::hidden[] endif::VKSC_VERSION_1_0[] @@ -1361,6 +1358,20 @@ endif::VKSC_VERSION_1_0[] [NOTE] ==== +In older versions of the `apiext:VK_EXT_swapchain_colorspace` extension, +ename:VK_COLOR_SPACE_DOLBYVISION_EXT was exposed. +The intent was to indicate the presentation engine shall decode an image +using the SMPTE ST 2084 Perceptual Quantizer (PQ) EOTF, and then apply a +proprietary OOTF to process the image. +However, Dolby Vision profile 8.4 describes an encoding using the Hybrid Log +Gamma (HLG) OETF, and there is no swapchain extension for signaling Dolby +Vision metadata to be used by a proprietary OOTF. +This enum is deprecated but is maintained for backwards compatibility. +==== + +[NOTE] +.Note +==== For a traditional "`Linear`" or non-gamma transfer function color space use ename:VK_COLOR_SPACE_PASS_THROUGH_EXT. ==== @@ -1392,7 +1403,6 @@ the following color spaces: | sRGB | 0.640, 0.330 | 0.300, 0.600 | 0.150, 0.060 | 0.3127, 0.3290 (D65) | sRGB | extended sRGB | 0.640, 0.330 | 0.300, 0.600 | 0.150, 0.060 | 0.3127, 0.3290 (D65) | scRGB | HDR10_ST2084 | 0.708, 0.292 | 0.170, 0.797 | 0.131, 0.046 | 0.3127, 0.3290 (D65) | ST2084 PQ -| DOLBYVISION | 0.708, 0.292 | 0.170, 0.797 | 0.131, 0.046 | 0.3127, 0.3290 (D65) | ST2084 PQ | HDR10_HLG | 0.708, 0.292 | 0.170, 0.797 | 0.131, 0.046 | 0.3127, 0.3290 (D65) | HLG | Adobe RGB | 0.640, 0.330 | 0.210, 0.710 | 0.150, 0.060 | 0.3127, 0.3290 (D65) | Adobe RGB |==== diff --git a/chapters/features.adoc b/chapters/features.adoc old mode 100755 new mode 100644 index 782bd4398..d0c6bf26a --- a/chapters/features.adoc +++ b/chapters/features.adoc @@ -2525,13 +2525,19 @@ include::{generated}/validity/structs/VkPhysicalDeviceCornerSampledImageFeatures -- endif::VK_NV_corner_sampled_image[] -ifdef::VK_NV_compute_shader_derivatives[] -[open,refpage='VkPhysicalDeviceComputeShaderDerivativesFeaturesNV',desc='Structure describing compute shader derivative features that can be supported by an implementation',type='structs'] +ifdef::VK_KHR_compute_shader_derivatives,VK_NV_compute_shader_derivatives[] +[open,refpage='VkPhysicalDeviceComputeShaderDerivativesFeaturesKHR',desc='Structure describing compute shader derivative features that can be supported by an implementation',type='structs',alias="VkPhysicalDeviceComputeShaderDerivativesFeaturesNV"] -- -The sname:VkPhysicalDeviceComputeShaderDerivativesFeaturesNV structure is +The sname:VkPhysicalDeviceComputeShaderDerivativesFeaturesKHR structure is defined as: +include::{generated}/api/structs/VkPhysicalDeviceComputeShaderDerivativesFeaturesKHR.adoc[] + +ifdef::VK_NV_compute_shader_derivatives[] +or the equivalent + include::{generated}/api/structs/VkPhysicalDeviceComputeShaderDerivativesFeaturesNV.adoc[] +endif::VK_NV_compute_shader_derivatives[] This structure describes the following features: @@ -2540,19 +2546,19 @@ This structure describes the following features: structure. * [[features-computeDerivativeGroupQuads]] pname:computeDerivativeGroupQuads indicates that the implementation - supports the code:ComputeDerivativeGroupQuadsNV SPIR-V capability. + supports the code:ComputeDerivativeGroupQuadsKHR SPIR-V capability. * [[features-computeDerivativeGroupLinear]] pname:computeDerivativeGroupLinear indicates that the implementation - supports the code:ComputeDerivativeGroupLinearNV SPIR-V capability. + supports the code:ComputeDerivativeGroupLinearKHR SPIR-V capability. See <> for more information. -:refpage: VkPhysicalDeviceComputeShaderDerivativesFeaturesNVfeatures. +:refpage: VkPhysicalDeviceComputeShaderDerivativesFeaturesKHR. include::{chapters}/features.adoc[tag=features] -include::{generated}/validity/structs/VkPhysicalDeviceComputeShaderDerivativesFeaturesNV.adoc[] +include::{generated}/validity/structs/VkPhysicalDeviceComputeShaderDerivativesFeaturesKHR.adoc[] -- -endif::VK_NV_compute_shader_derivatives[] +endif::VK_KHR_compute_shader_derivatives,VK_NV_compute_shader_derivatives[] ifdef::VK_KHR_fragment_shader_barycentric[] [open,refpage='VkPhysicalDeviceFragmentShaderBarycentricFeaturesKHR',desc='Structure describing barycentric support in fragment shaders that can be supported by an implementation',type='structs'] @@ -8113,6 +8119,11 @@ ifdef::VK_KHR_shader_float16_int8[] <> if `apiext:VK_KHR_shader_float16_int8` is supported. endif::VK_KHR_shader_float16_int8[] +ifdef::VK_KHR_compute_shader_derivatives[] + * <>, if the + `apiext:VK_KHR_compute_shader_derivatives` extension is supported. +endif::VK_KHR_compute_shader_derivatives[] ifdef::VKSC_VERSION_1_0[] ifdef::hidden[] diff --git a/chapters/limits.adoc b/chapters/limits.adoc index dad2ab399..dfe1d48b1 100644 --- a/chapters/limits.adoc +++ b/chapters/limits.adoc @@ -4866,6 +4866,30 @@ include::{generated}/validity/structs/VkPhysicalDeviceRenderPassStripedPropertie endif::VK_ARM_render_pass_striped[] +ifdef::VK_KHR_compute_shader_derivatives[] +[open,refpage='VkPhysicalDeviceComputeShaderDerivativesPropertiesKHR',desc='Structure describing compute shader derivative operations supported by an implementation',type='structs'] +-- +The sname:VkPhysicalDeviceComputeShaderDerivativesPropertiesKHR structure is +defined as: + +include::{generated}/api/structs/VkPhysicalDeviceComputeShaderDerivativesPropertiesKHR.adoc[] + +The members of the +sname:VkPhysicalDeviceComputeShaderDerivativesPropertiesKHR structure +describe the following: + + * [[limits-meshAndTaskShaderDerivatives]] + pname:meshAndTaskShaderDerivatives indicates whether the mesh and task + shader stages support the code:ComputeDerivativeGroupQuadsKHR and + code:ComputeDerivativeGroupLinearKHR SPIR-V capabilities. + +:refpage: VkPhysicalDeviceComputeShaderDerivativesPropertiesKHR +include::{chapters}/limits.adoc[tag=limits_desc] + +include::{generated}/validity/structs/VkPhysicalDeviceComputeShaderDerivativesPropertiesKHR.adoc[] +-- +endif::VK_KHR_compute_shader_derivatives[] + ifdef::VK_EXT_map_memory_placed[] [open,refpage='VkPhysicalDeviceMapMemoryPlacedPropertiesEXT',desc='Structure describing the alignment requirements of placed memory maps for a physical device',type='structs'] -- diff --git a/chapters/pipelines.adoc b/chapters/pipelines.adoc index 35b51424b..10f857807 100644 --- a/chapters/pipelines.adoc +++ b/chapters/pipelines.adoc @@ -6043,6 +6043,10 @@ endif::VKSC_VERSION_1_0[] **** include::{chapters}/commonvalidity/create_ray_tracing_pipelines_common.adoc[] include::{chapters}/commonvalidity/pipeline_create_common.adoc[] + * [[VUID-vkCreateRayTracingPipelinesNV-pNext-10150]] + If a slink:VkPipelineCreateFlags2CreateInfoKHR structure is included in + the pname:pNext chain of any element of pname:pCreateInfos, + ename:VK_PIPELINE_CREATE_2_CAPTURE_DATA_BIT_KHR flag must: not be set **** ifdef::VKSC_VERSION_1_0[] ifdef::hidden[] @@ -8188,7 +8192,6 @@ include::{generated}/api/structs/VkPipelineCreateInfoKHR.adoc[] pname:pNext must: be pointer to a valid instance of slink:VkGraphicsPipelineCreateInfo, ifdef::VK_AMDX_shader_enqueue[slink:VkExecutionGraphPipelineCreateInfoAMDX,] -ifdef::VK_NV_ray_tracing[slink:VkRayTracingPipelineCreateInfoNV,] ifdef::VK_KHR_ray_tracing_pipeline[slink:VkRayTracingPipelineCreateInfoKHR,] or slink:VkComputePipelineCreateInfo **** @@ -8226,9 +8229,8 @@ include::{generated}/validity/structs/VkPipelineBinaryKeyKHR.adoc[] [open,refpage='VK_MAX_PIPELINE_BINARY_KEY_SIZE_KHR',desc='Maximum length of binary key',type='consts'] -- -ename:VK_MAX_PIPELINE_BINARY_KEY_SIZE_KHR is the length in bytes of a -binary key, as returned in -slink:VkPipelineBinaryKeyKHR::pname:keySize. +ename:VK_MAX_PIPELINE_BINARY_KEY_SIZE_KHR is the length in bytes of a binary +key, as returned in slink:VkPipelineBinaryKeyKHR::pname:keySize. include::{generated}/api/enums/VK_MAX_PIPELINE_BINARY_KEY_SIZE_KHR.adoc[] -- diff --git a/chapters/shaders.adoc b/chapters/shaders.adoc index 386181a78..86da4fcec 100644 --- a/chapters/shaders.adoc +++ b/chapters/shaders.adoc @@ -2713,8 +2713,10 @@ invocations in neighboring framebuffer locations [eq]#(x~i~, y~i~)#, where: * [eq]#(y~0~) = (y~1~) = (y~2~ - h) = (y~3~ - h)# * Each invocation has the same layer and sample indices. -ifdef::VK_NV_compute_shader_derivatives[] -In a compute shader, if the code:DerivativeGroupQuadsNV execution mode is +ifdef::VK_KHR_compute_shader_derivatives,VK_NV_compute_shader_derivatives[] +In a +ifdef::VK_KHR_compute_shader_derivatives[mesh, task, or] +compute shader, if the code:DerivativeGroupQuadsKHR execution mode is specified, each invocation in a quad scope instance is formed of invocations with adjacent local invocation IDs [eq]#(x~i~, y~i~)#, where: @@ -2724,7 +2726,9 @@ with adjacent local invocation IDs [eq]#(x~i~, y~i~)#, where: * [eq]#x~0~# and [eq]#y~0~# are integer multiples of 2. * Each invocation has the same [eq]#z# coordinate. -In a compute shader, if the code:DerivativeGroupLinearNV execution mode is +In a +ifdef::VK_KHR_compute_shader_derivatives[mesh, task, or] +compute shader, if the code:DerivativeGroupLinearKHR execution mode is specified, each invocation in a quad scope instance is formed of invocations with adjacent local invocation indices [eq]#(l~i~)#, where: @@ -2732,7 +2736,7 @@ with adjacent local invocation indices [eq]#(l~i~)#, where: * [eq]#(l~0~) = (l~1~ - 1) = (l~2~ - 2) = (l~3~ - 3)# * [eq]#l~0~# is an integer multiple of 4. -endif::VK_NV_compute_shader_derivatives[] +endif::VK_KHR_compute_shader_derivatives,VK_NV_compute_shader_derivatives[] ifdef::VK_VERSION_1_1[] In all shaders, each invocation in a quad scope instance is formed of @@ -2764,9 +2768,10 @@ the same <>. endif::VK_VERSION_1_1[] Fragment -ifdef::VK_NV_compute_shader_derivatives,VK_VERSION_1_1[] +ifdef::VK_KHR_compute_shader_derivatives,VK_NV_compute_shader_derivatives,VK_VERSION_1_1[] +ifdef::VK_KHR_compute_shader_derivatives[, mesh, task,] and compute -endif::VK_NV_compute_shader_derivatives,VK_VERSION_1_1[] +endif::VK_KHR_compute_shader_derivatives,VK_NV_compute_shader_derivatives,VK_VERSION_1_1[] shaders have defined quad scope instances. ifdef::VK_VERSION_1_1[] If the <>. -ifdef::VK_NV_compute_shader_derivatives[] -A derivative group in a compute shader is equivalent to the -<>. -endif::VK_NV_compute_shader_derivatives[] +ifdef::VK_KHR_compute_shader_derivatives,VK_NV_compute_shader_derivatives[] +A derivative group in a +ifdef::VK_KHR_compute_shader_derivatives[mesh, task, or] +compute shader is equivalent to the <>. +endif::VK_KHR_compute_shader_derivatives,VK_NV_compute_shader_derivatives[] Derivatives are calculated assuming that [eq]#P# is piecewise linear and continuous within the derivative group. @@ -3043,13 +3050,15 @@ sufficient invocations to ensure their correct operation; additional <> are launched for framebuffer locations not covered by rasterized fragments if necessary. -ifdef::VK_NV_compute_shader_derivatives[] +ifdef::VK_KHR_compute_shader_derivatives,VK_NV_compute_shader_derivatives[] [NOTE] ==== -In a compute shader, it is the application's responsibility to ensure that +In a +ifdef::VK_KHR_compute_shader_derivatives[mesh, task, or] +compute shader, it is the application's responsibility to ensure that sufficient invocations are launched. ==== -endif::VK_NV_compute_shader_derivatives[] +endif::VK_KHR_compute_shader_derivatives,VK_NV_compute_shader_derivatives[] Derivative operations calculate their results as the difference between the result of [eq]#P# across invocations in the quad. diff --git a/chapters/synchronization.adoc b/chapters/synchronization.adoc index b4cdc98ed..8cf5a4639 100644 --- a/chapters/synchronization.adoc +++ b/chapters/synchronization.adoc @@ -4283,8 +4283,8 @@ Unlike ifdef::VK_VERSION_1_2,VK_KHR_timeline_semaphore[] timeline semaphores, endif::VK_VERSION_1_2,VK_KHR_timeline_semaphore[] -fences or events, waiting for a binary semaphore also unsignals -that semaphore when the wait completes. +fences or events, waiting for a binary semaphore also unsignals that +semaphore when the wait completes. Applications must: ensure that between two such wait operations, the semaphore is signaled again, with execution dependencies used to ensure these occur in order. diff --git a/chapters/textures.adoc b/chapters/textures.adoc index 7cd01552c..c26d6e448 100644 --- a/chapters/textures.adoc +++ b/chapters/textures.adoc @@ -1653,8 +1653,11 @@ D_{\textit{ref}} & = \frac{D_{\textit{ref}}}{q}, & \text{if provided} Derivatives are used for LOD selection. These derivatives are either implicit (in an code:ImplicitLod image -instruction in a fragment shader) or explicit (provided explicitly by shader -to the image instruction in any shader). +instruction in a +ifdef::VK_KHR_compute_shader_derivatives[mesh, task,] +ifdef::VK_KHR_compute_shader_derivatives,VK_NV_compute_shader_derivatives[compute, or] +fragment shader) or explicit (provided explicitly by shader to the image +instruction in any shader). For implicit derivatives image instructions, the derivatives of texel coordinates are calculated in the same manner as diff --git a/proposals/VK_KHR_compute_shader_derivatives.adoc b/proposals/VK_KHR_compute_shader_derivatives.adoc new file mode 100644 index 000000000..aaf4e223a --- /dev/null +++ b/proposals/VK_KHR_compute_shader_derivatives.adoc @@ -0,0 +1,98 @@ +// Copyright 2024 The Khronos Group Inc. +// +// SPDX-License-Identifier: CC-BY-4.0 + += VK_KHR_compute_shader_derivatives +:toc: left +:refpage: https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/ +:sectnums: + +This extension enables applications to use derivative operations from execution models with defined workgroups. + +NOTE: This extension is a promotion (with additions) of +link:{refpage}VK_NV_compute_shader_derivatives.html[VK_NV_compute_shader_derivatives]. +As that extension already shipped before proposal documents existed, this document has been written +retroactively during promotion to KHR. + +The changes relative to `VK_NV_compute_shader_derivatives` are the inclusion of optional +mesh and tash shader support. + + +== Problem Statement + +As some developers replace portions of the graphics pipeline by custom algorithms in compute, certain operations reserved for fragment shaders such as derivatives become a major hurdle to work around. This manifests in particular when using Shader Model 6.6 where derivative and derivative-dependent texture sample operations are required to be supported, but have no equivalent in Vulkan other than a vendor specific extension. + +== Solution Space + +Three options have been considered: + +- Take VK_NV_compute_shader_derivatives as-is. +- Take VK_NV_compute_shader_derivatives and add support for all execution models with defined workgroup size. +- Start afresh + +This proposal focuses on the second option. + +== Proposal + +=== New SPIR-V execution modes + +This extension adds Vulkan support for the {spirv}/KHR/SPV_KHR_compute_shader_derivatives.html[`SPV_KHR_compute_shader_derivatives`] SPIR-V extension. + +The SPIR-V extension provides two new execution modes, both of which allow execution models with defined workgroups to use built-ins that evaluate derivatives explicitly or implicitly. Derivatives will be computed via differencing over a 2x2 group of shader invocations. + + - The 'DerivativeGroupQuadsKHR' execution mode assembles shader invocations into 2x2 groups, where each group has x and y coordinates of the local invocation ID of the form (2m+{0,1}, 2n+{0,1}). + - The 'DerivativeGroupLinearKHR' execution mode assembles shader invocations into 2x2 groups, where each group has local invocation index values of the form 4m+{0,1,2,3}. + +=== Features + +A new feature enables each of the SPIR-V execution modes introduced by this extension: + +[source,c] +---- +typedef struct VkPhysicalDeviceComputeShaderDerivativesFeaturesKHR { + VkStructureType sType; + void* pNext; + VkBool32 computeDerivativeGroupQuads; + VkBool32 computeDerivativeGroupLinear; +} VkPhysicalDeviceComputeShaderDerivativesFeaturesKHR; +---- + +Each value maps to a SPIR-V execution mode: + - computeDerivativeGroupQuads enables the SPIR-V 'DerivativeGroupQuadsKHR' execution mode + - computeDerivativeGroupLinear enables the SPIR-V 'DerivativeGroupLinearKHR' execution mode + +=== Properties + +A new property is added which determines if the new execution modes can be used in mesh and task shaders: + +[source,c] +---- +typedef struct VkPhysicalDeviceComputeShaderDerivativesPropertiesKHR { + VkStructureType sType; + void* pNext; + VkBool32 meshAndTaskShaderDerivatives; +} VkPhysicalDeviceComputeShaderDerivativesPropertiesKHR; +---- + +If this property is 'VK_FALSE', the derivatives are only supported in compute shaders. + +=== GLSL mapping + +The following layout qualifiers from GLSL_KHR_compute_shader_derivatives map to these SPIR-V execution modes: + + - derivative_group_quadsKHR layout qualifier -> DerivativeGroupQuadsKHR Execution Mode + - derivative_group_linearKHR layout qualifier -> DerivativeGroupLinearKHR Execution Mode + +== Issues + +(1) Should we specify that the groups of four shader invocations used for + derivatives in a compute shader are the same groups of four invocations + that form a "quad" in shader subgroups? + +*RESOLVED*: Yes. + +(2) Should we add support for derivatives in mesh and task shaders? + +*RESOLVED*: Yes, as optional features. Add them as an optional feature as they are in SM6.6. + + diff --git a/registry.adoc b/registry.adoc index dcf495d68..cc7e4ef51 100644 --- a/registry.adoc +++ b/registry.adoc @@ -2273,6 +2273,75 @@ API may advertise enablement, though not all forms may be used with tag:spirvextension tags. Each form is described separately below. +== Attributes for API Version Number Enables + + * attr:version - required. + An API feature name, matching a tag:feature attr:name attribute value. + +If the API version is supported, the SPIR-V extension or capability is +enabled. + +== Attributes for API Extension Enables + + * attr:extension - required. + An API extension name, matching an tag:extension attr:name attribute + value. + +If the API extension is supported and enabled, the SPIR-V extension or +capability is enabled. + +== Attributes for API Feature Enables + + * attr:struct - required. + An API feature structure name, matching a tag:struct attr:name attribute + value. + * attr:feature - required. + An API feature name, matching a tag:member tag:name value of the feature + structure. + * attr:requires - required. + A comma-separated list of API feature version numbers and/or extension + names. + * attr:alias - optional. + Another API feature name which is an alias of attr:feature. + Needed when the same feature is provided by two different API versions + or extensions. + +If one of the API feature version numbers or extensions in the attr:requires +list is supported or enabled, respectively; and if the attr:feature name is +enabled in the feature structure, the SPIR-V capability is enabled. + +API feature enables are not supported for tag:spirvextension tags. + +== Attributes for API Property Enables + + * attr:property - required. + An API property structure name, matching a tag:struct attr:name + attribute value. + * attr:member - required. + An API property name, matching a tag:member tag:name value of the + attr:property structure. + * attr:value - required. + A value, matching an API tag:enum tag:name value. + If the property is a bitfield, tag:value must be a bitmask value + belonging to the attr:member bitfield type. + Otherwise, tag:value must be an tag:enum name defined for the + attr:member enumeration type. + * attr:requires - optional. + A comma-separated list of API feature version numbers and/or extension + names. + +If one of the API feature version numbers or extensions in the attr:requires +list is supported or enabled, respectively; and if the attr:member property +contains the tag:value bit, or matches the tag:value, the SPIR-V capability +is enabled. + +API property enables are not supported for tag:spirvextension tags. + +== Contents of tag:enable Tags + +None. + + [[tag-syncstage]] = Sync Stage (tag:syncstage Tag) @@ -2352,6 +2421,7 @@ relationship of Sync elements A comma-separated list of Sync Accesses that are the OR logical equivalence of the parent Sync Element + [[tag-videocodecs]] = Video Codecs (tag:videocodecs Tag) @@ -2460,74 +2530,6 @@ overall precondition is the conjunction of the individual preconditions. ("," and "+" can be used to express disjunction and conjunction, respectively) -== Attributes for API Version Number Enables - - * attr:version - required. - An API feature name, matching a tag:feature attr:name attribute value. - -If the API version is supported, the SPIR-V extension or capability is -enabled. - -== Attributes for API Extension Enables - - * attr:extension - required. - An API extension name, matching an tag:extension attr:name attribute - value. - -If the API extension is supported and enabled, the SPIR-V extension or -capability is enabled. - -== Attributes for API Feature Enables - - * attr:struct - required. - An API feature structure name, matching a tag:struct attr:name attribute - value. - * attr:feature - required. - An API feature name, matching a tag:member tag:name value of the feature - structure. - * attr:requires - required. - A comma-separated list of API feature version numbers and/or extension - names. - * attr:alias - optional. - Another API feature name which is an alias of attr:feature. - Needed when the same feature is provided by two different API versions - or extensions. - -If one of the API feature version numbers or extensions in the attr:requires -list is supported or enabled, respectively; and if the attr:feature name is -enabled in the feature structure, the SPIR-V capability is enabled. - -API feature enables are not supported for tag:spirvextension tags. - -== Attributes for API Property Enables - - * attr:property - required. - An API property structure name, matching a tag:struct attr:name - attribute value. - * attr:member - required. - An API property name, matching a tag:member tag:name value of the - attr:property structure. - * attr:value - required. - A value, matching an API tag:enum tag:name value. - If the property is a bitfield, tag:value must be a bitmask value - belonging to the attr:member bitfield type. - Otherwise, tag:value must be an tag:enum name defined for the - attr:member enumeration type. - * attr:requires - optional. - A comma-separated list of API feature version numbers and/or extension - names. - -If one of the API feature version numbers or extensions in the attr:requires -list is supported or enabled, respectively; and if the attr:member property -contains the tag:value bit, or matches the tag:value, the SPIR-V capability -is enabled. - -API property enables are not supported for tag:spirvextension tags. - -== Contents of tag:enable Tags - -None. - [[examples]] = Examples / FAQ / How Do I? diff --git a/xml/vk.xml b/xml/vk.xml old mode 100755 new mode 100644 index 4e2db1c22..2e0b9b7f5 --- a/xml/vk.xml +++ b/xml/vk.xml @@ -175,7 +175,7 @@ branch of the member gitlab server. #define VKSC_API_VERSION_1_0 VK_MAKE_API_VERSION(VKSC_API_VARIANT, 1, 0, 0)// Patch version should always be set to 0 // Version of this file -#define VK_HEADER_VERSION 294 +#define VK_HEADER_VERSION 295 // Complete version of this file #define VK_HEADER_VERSION_COMPLETE VK_MAKE_API_VERSION(0, 1, 3, VK_HEADER_VERSION) // Version of this file @@ -1463,7 +1463,7 @@ typedef void* MTLSharedEvent_id; const char* pNameNull-terminated entry point name const VkSpecializationInfo* pSpecializationInfo - + VkStructureType sType const void* pNext VkPipelineCreateFlags flagsPipeline creation flags @@ -1602,7 +1602,7 @@ typedef void* MTLSharedEvent_id; float minDepthBounds float maxDepthBounds - + VkStructureType sType const void* pNext VkPipelineCreateFlags flagsPipeline creation flags @@ -4497,12 +4497,18 @@ typedef void* MTLSharedEvent_id; void* pNext VkBool32 cornerSampledImage - - VkStructureType sType + + VkStructureType sType void* pNext VkBool32 computeDerivativeGroupQuads VkBool32 computeDerivativeGroupLinear + + + VkStructureType sType + void* pNext + VkBool32 meshAndTaskShaderDerivatives + VkStructureType sType @@ -4674,7 +4680,7 @@ typedef void* MTLSharedEvent_id; uint32_t intersectionShader const void* pShaderGroupCaptureReplayHandle - + VkStructureType sType const void* pNext VkPipelineCreateFlags flagsPipeline creation flags @@ -4687,7 +4693,7 @@ typedef void* MTLSharedEvent_id; VkPipeline basePipelineHandleIf VK_PIPELINE_CREATE_DERIVATIVE_BIT is set and this value is nonzero, it specifies the handle of the base pipeline this is a derivative of int32_t basePipelineIndexIf VK_PIPELINE_CREATE_DERIVATIVE_BIT is set and this value is not -1, it specifies an index into pCreateInfos of the base pipeline this is a derivative of - + VkStructureType sType const void* pNext VkPipelineCreateFlags flagsPipeline creation flags @@ -8824,7 +8830,7 @@ typedef void* MTLSharedEvent_id; void* pNext VkBool32 shaderEnqueue - + VkStructureType sType const void* pNext VkPipelineCreateFlags flags @@ -18571,7 +18577,7 @@ typedef void* MTLSharedEvent_id; - + @@ -20103,11 +20109,11 @@ typedef void* MTLSharedEvent_id; - + - + @@ -24256,10 +24262,14 @@ typedef void* MTLSharedEvent_id; - + - - + + + + + + @@ -26669,6 +26679,9 @@ typedef void* MTLSharedEvent_id; + + + @@ -27028,6 +27041,12 @@ typedef void* MTLSharedEvent_id; + + + + + +