VK_EXT_shader_module_identifier

Other Extension Metadata

Last Modified Date

2022-05-16

IP Status

No known IP claims.

Contributors
  • Hans-Kristian Arntzen, Valve
  • Ricardo Garcia, Igalia
  • Piers Daniell, NVIDIA
  • Jan-Harald Fredriksen, Arm
  • Tom Olson, Arm
  • Faith Ekstrand, Collabora

Description

Some applications generate SPIR-V code at runtime. When pipeline caches are primed, either explicitly through e.g. VkPipelineCache mechanisms, or implicitly through driver managed caches, having to re-generate SPIR-V modules is redundant. SPIR-V modules could be cached on disk by an application, but the extra disk size requirement might be prohibitive in some use cases.

This extension adds the ability for an application to query a small identifier associated with a VkShaderModule. On subsequent runs of the application, the same identifier can be provided in lieu of a VkShaderModule object. A pipeline creation call with such a module may succeed if a pipeline could be created without invoking compilation, and information inside the SPIR-V module is not required by the implementation.

VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT must be used if only the identifier is provided, and this use case is intended to work like a non-blocking, speculative compile. Applications can fallback as necessary.

The main motivation for identifying the module itself and not the entire pipeline is that pipeline identifiers change when a driver is updated, but module identifiers are expected to be stable for any particular driver implementation. This approach is helpful for shader pre-compilation systems which can prime pipeline caches ahead of time. When on-disk pipeline caches are updated, the same shader identifiers could lead to a pipeline cache hit.

New Commands

New Structures

New Enum Constants

  • VK_EXT_SHADER_MODULE_IDENTIFIER_EXTENSION_NAME
  • VK_EXT_SHADER_MODULE_IDENTIFIER_SPEC_VERSION
  • VK_MAX_SHADER_MODULE_IDENTIFIER_SIZE_EXT
  • Extending VkStructureType:
    • VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_MODULE_IDENTIFIER_FEATURES_EXT
    • VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_MODULE_IDENTIFIER_PROPERTIES_EXT
    • VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_MODULE_IDENTIFIER_CREATE_INFO_EXT
    • VK_STRUCTURE_TYPE_SHADER_MODULE_IDENTIFIER_EXT

Version History

  • Revision 1, 2022-03-16 (Hans-Kristian Arntzen)
    • Initial draft