Name Strings

SPV_EXT_shader_atomic_float_min_max

Contact

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

Contributors

  • Faith Ekstrand, Intel

  • Ben Ashbaugh, Intel

Status

  • Draft

Version

Last Modified Date

2020-10-05

Revision

2

Dependencies

This extension is written against the SPIR-V Specification, Version 1.5 Revision 2.

This extension requires SPIR-V 1.0.

Overview

This extension adds atomic min and max instruction on floating-point numbers.

Extension Name

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

OpExtension "SPV_EXT_shader_atomic_float_min_max"

New Capabilities

This extension introduces new capabilities:

AtomicFloat16MinMaxEXT
AtomicFloat32MinMaxEXT
AtomicFloat64MinMaxEXT

Modifications to the SPIR-V Specification, Version 1.5

Modify Section 3.31, "Capability", adding this row to the Capability table:

Capability Implicitly Declares

5616

AtomicFloat16MinMaxEXT
Uses the OpAtomicFMinEXT or OpAtomicFMaxEXT instruction with 16-bit floating point values.

5612

AtomicFloat32MinMaxEXT
Uses the OpAtomicFMinEXT or OpAtomicFMaxEXT instruction with 32-bit floating point values.

5613

AtomicFloat64MinMaxEXT
Uses the OpAtomicFMinEXT or OpAtomicFMaxEXT instruction with 64-bit floating point values.

(Modify section 3.32.18, Atomic Instructions, adding to the end of the list of instructions)

OpAtomicFMinEXT

Perform the following steps atomically with respect to any other atomic accesses within Scope to the same location:

1) load through Pointer to get an Original Value,

2) get a New Value by which is the float minimum of Original Value and Value, and

3) store the New Value back through Pointer.

Given x and y are two numbers (neither is NaN) and qNaN is an IEEE quiet NaN, sNaN is an IEEE signaling NaN, and NaN is any NaN value, the minimum operation performed as part of OpAtomicFMinEXT has the following semantics:

* min(x, y) = x if x < y and y otherwise,

* min(-0, +0) = min(+0, -0) = +0 or -0,

* min(x, qNaN) = min(qNaN, x) = x,

* min(qNaN, qNaN) = qNaN,

* min(x, sNaN) = min(sNaN, x) = NaN or x, and

* min(NaN, sNaN) = min(sNaN, NaN) = NaN

For cases which generate consume and produce a NaN value, any NaN value may be generated; it may not be the same as the NaN which was consumed.

The instruction’s result is the Original Value.

Result Type must be a floating-point type.

The type of Value must be the same as Result Type. The type of the value pointed to by Pointer must be the same as Result Type.

Memory must be a valid memory Scope.

Capability:
AtomicFloat16MinMaxEXT AtomicFloat32MinMaxEXT AtomicFloat64MinMaxEXT

7

5614

<id> Result type

Result <id>

<id> Pointer

Scope <id> Memory

Memory Semantics <id> Semantics

<id> Value

OpAtomicFMaxEXT

Perform the following steps atomically with respect to any other atomic accesses within Scope to the same location:

1) load through Pointer to get an Original Value,

2) get a New Value by which is the float maximum of Original Value and Value, and

3) store the New Value back through Pointer.

Given x and y are two numbers (neither is NaN) and qNaN is an IEEE quiet NaN, sNaN is an IEEE signaling NaN, and NaN is any NaN value, the maximum operation performed as part of OpAtomicFMaxEXT has the following semantics:

* max(x, y) = x if x < y and y otherwise,

* max(-0, +0) = max(+0, -0) = +0 or -0,

* max(x, qNaN) = max(qNaN, x) = x,

* max(qNaN, qNaN) = qNaN,

* max(x, sNaN) = max(sNaN, x) = NaN or x, and

* max(NaN, sNaN) = max(sNaN, NaN) = NaN

For cases which generate consume and produce a NaN value, any NaN value may be generated; it may not be the same as the NaN which was consumed.

The instruction’s result is the Original Value.

Result Type must be a floating-point type.

The type of Value must be the same as Result Type. The type of the value pointed to by Pointer must be the same as Result Type.

Memory must be a valid memory Scope.

Capability:
AtomicFloat16MinMaxEXT AtomicFloat32MinMaxEXT AtomicFloat64MinMaxEXT

7

5615

<id> Result type

Result <id>

<id> Pointer

Scope <id> Memory

Memory Semantics <id> Semantics

<id> Value

New Instructions

Instructions added under AtomicFloat16MinMaxEXT, AtomicFloat32MinMaxEXT, or AtomicFloat64MinMaxEXT capability:

OpAtomicFMinEXT
OpAtomicFMaxEXT

Validation Rules

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

OpExtension "SPV_EXT_shader_atomic_float_min_max"
  • When using OpAtomicFMinEXT or OpAtomicFMaxEXT only 16-, 32-, or 64-bit floating-point values are allowed.

  • If OpAtomicFMinEXT or OpAtomicFMaxEXT is used with 16-bit floating-point values, the AtomicFloat16MinMaxEXT capability must be declared.

  • If OpAtomicFMinEXT or OpAtomicFMaxEXT is used with 32-bit floating-point values, the AtomicFloat32MinMaxEXT capability must be declared.

  • If OpAtomicFMinEXT or OpAtomicFMaxEXT is used with 64-bit floating-point values, the AtomicFloat64MinMaxEXT capability must be declared.

Issues

None yet.

Revision History

Rev Date Author Changes

1

2020-08-14

Faith Ekstrand

Internal revisions

2

2020-10-05

Ben Ashbaugh

Added fp16 capability