Name Strings

SPV_KHR_quad_control

Contact

To report problems with this extension, please open a new issue at:

Contributors

  • Tobias Hector, AMD

  • Nicolai Haehnle, AMD

  • Jeff Bolz, Nvidia

  • Graeme Leese, Broadcom

Notice

Copyright (c) 2024 The Khronos Group Inc. Copyright terms at http://www.khronos.org/registry/speccopyright.html

Status

  • Approved by the SPIR-V Working Group: 2023-12-06

  • Approved by the Khronos Board of Promoters: 2024-01-19

Version

Last Modified Date

2024-01-25

Revision

1

Dependencies

This extension is written against the SPIR-V Specification, Version 1.6, Revision 3, Unified.

This extension requires SPIR-V 1.3.

This extension requires SPV_KHR_maximal_reconvergence.

Overview

This extension adds new quad group operations, and two new execution modes.

The QuadDerivativesKHR execution mode requires that derivatives used to determine implicit lod are always calculated on a per-quad basis. This allows sampling from textures with ImplicitLod operations as long as control flow is uniform within the quad - which the new quad operations can be used to guarantee.

The RequireFullQuadsKHR execution mode requires that helper invocations are spawned for fragment shader invocations, enabling users to explicitly opt-in to helper invocations. Invocations may still be spawned implicitly according to the client API. This is intended to be paired with the MaximallyReconvergesKHR execution mode in SPV_KHR_maximal_reconvergence to provide robust guarantees about uniform control flow within a quad.

Extension Name

To use this extension within a SPIR-V module, the following OpExtension must be present in the module:

OpExtension "SPV_KHR_quad_control"

Modifications to the SPIR-V Specification, Version 1.6.3

3.6 Execution Mode

Modify Section 3.6, "Execution Mode", adding these rows to the table:

Execution Mode Extra Operands Enabling Capabilities

5088

QuadDerivativesKHR
The derivative group must be equivalent to the quad group.

QuadControlKHR

5089

RequireFullQuadsKHR
Helper invocations must be spawned such that all quad groups start with four active invocations. Only valid with the Fragment Execution Model.

QuadControlKHR

3.31 Capabilities

Modify Section 3.31, "Capability", adding these rows to the Capability table:

Capability Implicitly Declares

5087

QuadControlKHR
Uses the QuadDerivativesKHR or RequireFullQuadsKHR execution modes, or the OpGroupNonUniformQuadAllKHR or OpGroupNonUniformQuadAnyKHR instructions.

3.42.24 Non-Uniform Instructions

Modify Section 3.42.24, "Non-Uniform Instructions", adding two new instructions:

OpGroupNonUniformQuadAllKHR

Evaluates a predicate for all active invocations in the quad, resulting in true if predicate evaluates to true for all active invocations in the quad, otherwise the result is false.

Result Type must be a Boolean Type.

Predicate must be a Boolean Type.

Capability:
QuadControlKHR

4

5110

<id>
Result Type

Result <id>

<id>
Predicate

OpGroupNonUniformQuadAnyKHR

Evaluates a predicate for all active invocations in the quad, resulting in true if predicate evaluates to true for any active invocation in the quad, otherwise the result is false.

Result Type must be a Boolean Type.

Predicate must be a Boolean Type.

Capability:
QuadControlKHR

4

5111

<id>
Result Type

Result <id>

<id>
Predicate

Issues

Why do the new quad operations not have execution scopes?

This parameter was deemed redundant for quad operations; the scope is always the quad.

Revision History

Rev Date Author Changes

1

2024-01-25

Tobias Hector

Initial revision