Vulkan-Docs/doc/specs/vulkan/appendices/VK_EXT_shader_subgroup_vote.txt

152 lines
4.4 KiB
Plaintext
Raw Normal View History

Change log for January 23, 2017 Vulkan 1.0.39 spec update: * Bump API patch number and header version number to 39 for this update. Github Issues: * Clarified that only accesses via the specified buffer/image subresource ranges are included in the access scopes (public issue 306). * Add missing valid usage statements for flink:vkCreateComputePipelines and flink:vkCreateGraphicsPipelines (public issue 427). Internal Issues: * Add a Note to the <<invariance,Invariance>> appendix about a difference between OpenGL and Vulkan with regards to how primitives derived from offsets are handled (internal issue 355). * Add the +<<VK_KHR_get_physical_device_properties2>>+, +<<VK_KHR_maintenance1>>+, and +<<VK_KHR_shader_draw_parameters>>+ extensions (internal issue 448). * Add the +<<VK_EXT_shader_subgroup_vote>>+ and +<<VK_EXT_shader_subgroup_ballot>>+ extensions (internal issue 449). * Update the texture level-of-detail equation in the <<textures-scale-factor,Scale Factor Operation>> section to better approximate the ellipse major and minor axes (internal issue 547). * Forbid non-explicitly allowed uses of interface decorations in the introduction to the <<interfaces,Shader Interfaces>> chapter (internal issue 607). * Replace use of MathJax with KaTeX, for improved load-time performance as well as avoiding the scrolling-and-scrolling behavior due to MathJax asynchronous rendering when loading at an anchor inside the spec. This change also requires moving to HTML5 output for the spec instead of XHTML, and there is a visible difference in that the chapter navigation index is now in a scrollable sidebar instead of at the top of the document. We may or may not retain the nav sidebar based on feedback (internal issue 613). * Improve consistency of markup and formatting in extension appendices (internal issue 631). Other Issues: * Add explicit valid usage statements to slink:VkImageCopy requiring that the source and destination layer ranges be contained in their respective source and destination images. * Add valid usage language for swapchain of flink:vkAcquireNextImage. If the swapchain has been replaced, then it should not be passed to flink:vkAcquireNextImage. * Add a valid usage statement to flink:vkCreateImageView, that the image must have been created with an appropriate usage bit set. * Noted that slink:VkDisplayPresentInfoKHR is a valid extension of slink:VkPresentInfoKHR in the <<wsi_swapchain,WSI Swapchain>> section. * Update valid usage for flink:vkCmdSetViewport and flink:vkCmdSetScissor to account for the multiple viewport feature. If the feature is not enabled, the parameters for these functions have required values that are defined in the <<features-features-multiViewport,multiple viewports>> section of the spec but were not reflected in the valid usage text for these functions. * Add the +<<VK_EXT_swapchain_colorspace>>+ extension defining common color spaces.
2017-01-17 20:11:25 -08:00
[[VK_EXT_shader_subgroup_vote]]
== VK_EXT_shader_subgroup_vote
*Name String*::
VK_EXT_shader_subgroup_vote
*Extension Type*::
Device extension
*Registered Extension Number*::
66
*Status*::
Draft
*Last Modified Date*::
2016-11-28
*Revision*::
1
*IP Status*::
No known IP claims.
*Dependencies*::
- This extension is written against version 1.0 of the Vulkan API.
- This extension requires Vulkan 1.0.
- This extension requires the
https://www.khronos.org/registry/spir-v/extensions/KHR/SPV_KHR_subgroup_vote.html[+SPV_KHR_subgroup_vote+]
SPIR-V extension.
- This extension requires the
https://www.opengl.org/registry/specs/ARB/shader_group_vote.txt[+GL_ARB_shader_group_vote+]
extension for GLSL source languages.
*Contributors*::
- Neil Henning, Codeplay
- Daniel Koch, NVIDIA Corporation
*Contact*::
- Daniel Koch (dkoch 'at' nvidia.com)
*Overview*::
+
--
This extension adds support for the following SPIR-V extension in Vulkan:
* SPV_KHR_subgroup_vote
This extension provides new SPIR-V instructions:
* code:OpSubgroupAllKHR,
* code:OpSubgroupAnyKHR, and
* code:OpSubgroupAllEqualKHR.
to compute the composite of a set of boolean conditions across a group of
shader invocations that are running concurrently (a _subgroup_).
These composite results may be used to execute shaders more efficiently on a
slink:VkPhysicalDevice.
When using GLSL source-based shader languages, the following shader
functions from GL_ARB_shader_group_vote can map to these SPIR-V
instructions:
* code:anyInvocationARB() -> code:OpSubgroupAnyKHR,
* code:allInvocationsARB() -> code:OpSubgroupAllKHR, and
* code:allInvocationsEqualARB() -> code:OpSubgroupAllEqualKHR.
The subgroup across which the boolean conditions are evaluated is
implementation-dependent, and this extension provides no guarantee over how
individual shader invocations are assigned to subgroups.
In particular, a subgroup has no necessary relationship with the compute
shader _local workgroup_ -- any pair of shader invocations in a compute
local workgroup may execute in different subgroups as used by these
instructions.
Compute shaders operate on an explicitly specified group of threads (a local
workgroup), but many implementations will also group non-compute shader
invocations and execute them concurrently.
When executing code like
[source,{basebackend@docbook:c++:cpp}]
----------------------------------------
if (condition) {
result = do_fast_path();
} else {
result = do_general_path();
}
----------------------------------------
where code:condition diverges between invocations, an implementation might
first execute code:do_fast_path() for the invocations where code:condition
is true and leave the other invocations dormant.
Once code:do_fast_path() returns, it might call code:do_general_path() for
invocations where code:condition is false and leave the other invocations
dormant.
In this case, the shader executes *both* the fast and the general path and
might be better off just using the general path for all invocations.
This extension provides the ability to avoid divergent execution by
evaluating a condition across an entire subgroup using code like:
[source,{basebackend@docbook:c++:cpp}]
----------------------------------------
if (allInvocationsARB(condition)) {
result = do_fast_path();
} else {
result = do_general_path();
}
----------------------------------------
The built-in function code:allInvocationsARB() will return the same value
for all invocations in the group, so the group will either execute
code:do_fast_path() or code:do_general_path(), but never both.
For example, shader code might want to evaluate a complex function
iteratively by starting with an approximation of the result and then
refining the approximation.
Some input values may require a small number of iterations to generate an
accurate result (code:do_fast_path) while others require a larger number
(code:do_general_path).
In another example, shader code might want to evaluate a complex function
(code:do_general_path) that can be greatly simplified when assuming a
specific value for one of its inputs (code:do_fast_path).
--
=== New Object Types
None.
=== New Enum Constants
None.
=== New Enums
None.
=== New Structures
None.
=== New Functions
None.
=== New Built-In Variables
None.
=== New SPIR-V Capabilities
* <<spirvenv-capabilities-table-subgroupvote,SubgroupVoteKHR>>
=== Issues
None.
=== Version History
* Revision 1, 2016-11-28 (Daniel Koch)
- Initial draft