Skip to content

Initial support for NonSemantic.Shader.DebugInfo 101#4220

Open
dnovillo wants to merge 5 commits intoKhronosGroup:mainfrom
dnovillo:nsdi101
Open

Initial support for NonSemantic.Shader.DebugInfo 101#4220
dnovillo wants to merge 5 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.

Only emit version 101 import if the module requires NSDI 101.
Add a README section documenting where the canonical header lives and
how to update it.
@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
INSTANTIATE_TEST_SUITE_P(
Glsl, GlslNonSemanticShaderDebugInfoSpirv13Test,
::testing::ValuesIn(std::vector<std::string>({
"spv.debuginfo.coopmatKHR.comp",
Copy link
Copy Markdown
Contributor

@jeremy-lunarg jeremy-lunarg Apr 22, 2026

Choose a reason for hiding this comment

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

Can this test be removed?

@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.

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.

3 participants