Name Strings

SPV_KHR_shader_atomic_counter_ops

Contact

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

Contributors

  • Daniel Koch, NVIDIA

Notice

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

Status

  • Complete

  • Approved by the SPIR Working Group: 2017-05-10

  • Approved by the Khronos Board of Promoters: 2017-06-30

Version

Last Modified Date

2017-07-07

Revision

3

Dependencies

This extension is written against the SPIR-V Specification, Version 1.1 Revision 7.

This extension requires SPIR-V 1.0.

Overview

This extension provides new capability to allow additional Atomic Instructions on the AtomicCounter Storage Class in order to support the GL_ARB_shader_atomic_counter_ops extension in SPIR-V.

The new functionality is enabled under the AtomicStorageOps capability.

Extension Name

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

OpExtension "SPV_KHR_shader_atomic_counter_ops"

New Capabilities

This extension introduces a new capability:

AtomicStorageOps

New Builtins

None.

New Instructions

None.

Token Number Assignments

AtomicStorageOps

4445

Modifications to the SPIR-V Specification, Version 1.1

(Modify Section 3.31, Capability, adding a row to the Capability table)
Capability Depends On Enabled by Extension

4445

AtomicStorageOps
Uses atomic instructions: OpAtomicIAdd, OpAtomicISub, OpAtomicUMin, OpAtomicUMax, OpAtomicAnd, OpAtomicOr, OpAtomicXor, OpAtomicExchange, or OpAtomicCompareExchange.

AtomicStorage

SPV_KHR_shader_atomic_counter_ops

Validation Rules

An OpExtension must be added to the SPIR-V for validation layers to check legal use of this extension:

OpExtension "SPV_KHR_shader_atomic_counter_ops"

Issues

  1. What should we call the capability?

    RESOLVED: AtomicStorageOps. Possible alternatives included AtomicStorageCounterOps or AtomicCounterOps, but this extends the AtomicStorage capability and adds more operations. There are additional operations that still aren’t enabled, but that is a problem for a future extension.

  2. Should OpAtomicSMin and OpAtomicSMax be supported as well?

    RESOLVED: No. The corresponding GLSL built-ins only take uint parameters, so this capability will aim to expose exactly the same set of operations.

  3. What happened to the Universal Validation Rule about AtomicCounter operations?

    RESOLVED: In early versions of SPIR-V (1.0.x for x < 11, and 1.1.y for y < 7) there was a universal validation rule which stated:

    The only instructions that can operate on a pointer to the AtomicCounter Storage Class are

    • OpAtomicLoad

    • OpAtomicIIncrement

    • OpAtomicIDecrement

    Starting with SPIR-V 1.0 version 11 (1.1 version 7) this was moved from a universal validation rule into the AtomicStorage capability.

Revision History

Rev Date Author Changes

1

2017-04-25

Daniel Koch

Initial revision

2

2017-05-12

David Neto

Record approval by SPIR Working Group

3

2017-07-07

Daniel Koch

Record ratification