KhronosGroup / KhronosGroup/SPIRV-Tools

[spirv-val] `OpConstantNull` refused for OpExtInst DebugTypeBasic

Open
#5,897 3 comments 0 reactions 0 assignees View on GitHub
component:validation
Dominant language
C++
Stars
1.4k
Forks
709
Avg merge
1d 22h
Merged PRs (30d)
28

Description

Hello!

Not sure if this is a validation issue, or a spec issue, or a desirable behavior, but if I do:

```
%flag = OpConstantNull %uint
OpExtInst %void %-- DebugTypeBasic %-- %-- %-- %flag
```

I get a validation error because `%flag` is not an `OpConstant`.
This matches the [spec](https://htmlpreview.github.io/?https://github.com/KhronosGroup/SPIRV-Registry/blob/main/nonsemantic/NonSemantic.Shader.DebugInfo.100.html#DebugTypeBasic) which only mentions `OpConstant`.

Question is shall `OpConstantNull %uint` be considered to be the same as `OpConstant %uint 0`?
Or is that difference there by design?

(related to https://github.com/KhronosGroup/SPIRV-Tools/pull/5846 and https://github.com/llvm/llvm-project/issues/118011)

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the `spirv-val` diagnostic for the shown `OpConstantNull` and compare it with the DebugTypeBasic specification linked in the issue. Review the related pull request #5846 and LLVM issue #118011 for context. Done means the project has an agreed answer on whether this operand is valid and the validator/specification behavior is aligned with that decision.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.