Name Strings

SPV_NV_shader_sm_builtins

Contact

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

Contributors

  • Daniel Koch, NVIDIA

  • Jeff Bolz, NVIDIA

Status

  • Complete

Version

Last Modified Date

2019-05-28

Revision

1

Dependencies

This extension is written against the SPIR-V Specification, Version 1.4 Revision 1.

This extension requires SPIR-V 1.3.

Overview

This extension adds several new shader builtins that are available under the ShaderSMBuiltinsNV capability.

The new builtins provide the ability to query information about the number of warps and streaming multiprocessors (SMs) in a system, and the ability to identify the warp and SM that a shader invocation is executing on.

This SPIR-V extension provides support for the GLSL GL_NV_shader_sm_builtins extension.

Extension Name

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

OpExtension "SPV_NV_shader_sm_builtins"

Modifications to the SPIR-V Specification, Version 1.4

Validation Rules

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

OpExtension "SPV_NV_shader_sm_builtins"

Builtin

(Modify Section 3.21, Builtin, adding rows to the Builtin table)
Builtin Enabling Capabilities

5374

WarpsPerSMNV
The maximum number of warps executing simultaneously on a streaming multiprocessor.

ShaderSMBuiltinsNV

5375

SMCountNV
The number of streaming multiprocessors on the physical device.

ShaderSMBuiltinsNV

5376

WarpIDNV
An integer index in the range [0, WarpsPerSMNV) such that the execution of two warps with the same warp ID and the same SM ID do not overlap.

ShaderSMBuiltinsNV

5377

SMIDNV
An integer index in the range [0, SMCountNV) uniquely identifying which streaming multiprocessor the invocation is executing on.

ShaderSMBuiltinsNV

Capabilities

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

Capability Depends On

5373

ShaderSMBuiltinsNV
Enables the WarpsPerSMNV, SMCountNV, WarpIDNV, and SMIDNV builtin decorations.

Shader

Issues

  1. Does this extension really require SPIR-V 1.3?

    RESOLVED: Not directly, but it’s assuming that the rest of the subgroup functionality is already present, otherwise it would have included more builtins, etc. For simplicity, we’ll just say it requires SPIR-V 1.3.

  2. Why are we using the the term "ID" instead of "Index"?

    RESOLVED: We choose ID to match the GLSL and GL extensions.

Revision History

Rev Date Author Changes

1

2019-05-28

Daniel Koch

Internal revisions