Skip to content

Initial support for NonSemantic.Shader.DebugInfo 101#4220

Merged
dnovillo merged 3 commits intoKhronosGroup:mainfrom
dnovillo:nsdi101
Apr 28, 2026
Merged

Initial support for NonSemantic.Shader.DebugInfo 101#4220
dnovillo merged 3 commits intoKhronosGroup:mainfrom
dnovillo:nsdi101

Conversation

@dnovillo
Copy link
Copy Markdown
Collaborator

This implements NSDI.101 (KhronosGroup/SPIRV-Registry#390) in glslang. It updates SPIRV-Tools and SPIRV-Headers dependencies to bring in the new headers for NSDI.101.

Version promotion

To minimize disruption with existing tools, glslang will always generate an import of NonSemantic.Shader.DebugInfo.100. If the module uses an opcode that requires NSDI.101 (cooperative types and new floating point types), it then changes the import string to .101. The promotion is done by patching the OpExtInstImport instruction's string operand.

The entry point is Builder::requireNonSemanticShaderDebugInfoVersion. Each of the three new emitter functions
calls it unconditionally before emitting the instruction.

New emitters

  • Builder::makeVectorIdDebugType: emits DebugTypeVectorIdEXT. Called from makeCooperativeVectorTypeNV when emitNonSemanticShaderDebugInfo is set.
  • Builder::makeCooperativeMatrixDebugTypeKHR: emits DebugTypeCooperativeMatrixKHR. Replaces the former opaque-composite workaround in makeCooperativeMatrixTypeKHR.
  • Builder::makeFloatDebugType: extended with an optional fpEncoding operand. The three float-8 and bfloat16 type builders (makeBFloat16Type, makeFloatE5M2Type, makeFloatE4M3Type) now handle the new floating point types.

Header rename

This needed to import the new NonSemanticShaderDebugInfo.h from SPIRV-Headers. This means that all the previous C identifiers that had 100 embedded in them needed to change. Those changes are mechanical, there is no functional change there.

I also added a section in README.md to document how to update this headers in future revisions of NSDI.

Tests

I replaced the previous golden output tests spv.debuginfo.coopmatKHR.comp with a new unit test file gtests/SpvDebugInfoTest.cpp. All the NSDI.101 opcodes are tested there.

@dnovillo dnovillo requested a review from jeremy-lunarg April 16, 2026 14:18
@dnovillo dnovillo self-assigned this Apr 16, 2026
@dnovillo
Copy link
Copy Markdown
Collaborator Author

For reference, these are the PRs adding NSDI.101 support:

Comment thread gtests/Spv.FromFile.cpp
@arcady-lunarg
Copy link
Copy Markdown
Contributor

LGTM aside from Jeremy's comment. Before I merge, could you squash this into just two or three commits? One for the rename of the header file and associated enumeration values and the other one for the "initial implementation"? And the tests can go in their own commit or together with the implementation.

@dnovillo
Copy link
Copy Markdown
Collaborator Author

LGTM aside from Jeremy's comment. Before I merge, could you squash this into just two or three commits? One for the rename of the header file and associated enumeration values and the other one for the "initial implementation"? And the tests can go in their own commit or together with the implementation.

Sure. I'll re-do the commits so they are split that way.

Drop the version number from the file name and all C identifiers
No semantic change.
- DebugTypeVectorIdEXT: emitted for OpTypeCooperativeVectorNV types
  whose component count is a SPIR-V Id rather than a literal.
- DebugTypeCooperativeMatrixKHR: emitted for OpTypeCooperativeMatrixKHR
  types, replacing the former opaque-composite workaround.
- Optional FPEncoding operand on DebugTypeBasic: identifies non-standard
  float formats (bfloat16, float8 E4M3, float8 E5M2).

The NonSemantic.Shader.DebugInfo import string is only promoted to .101
when a version-101 opcode is actually emitted.
@dnovillo
Copy link
Copy Markdown
Collaborator Author

LGTM aside from Jeremy's comment. Before I merge, could you squash this into just two or three commits? One for the rename of the header file and associated enumeration values and the other one for the "initial implementation"? And the tests can go in their own commit or together with the implementation.

Sure. I'll re-do the commits so they are split that way.

Done. I split it in two commits: the rename with no functional changes and the new implementation with tests. I also realized that the tests were not covering the coopmat test I removed from Test/ (spec constants with all three use types simultaneously). I added it to the new gtests/ implementation.

PTAL. Thanks.

Copy link
Copy Markdown
Contributor

@jeffbolznv jeffbolznv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I primarily reviewed the spvbuilder changes, I didn't go through the test code.

Comment thread SPIRV/disassemble.cpp Outdated
@dnovillo dnovillo merged commit 0971d79 into KhronosGroup:main Apr 28, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants