Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[spirv-val] OpConstantNull refused for OpExtInst DebugTypeBasic #5897

Open
Keenuts opened this issue Nov 28, 2024 · 3 comments
Open

[spirv-val] OpConstantNull refused for OpExtInst DebugTypeBasic #5897

Keenuts opened this issue Nov 28, 2024 · 3 comments

Comments

@Keenuts
Copy link
Contributor

Keenuts commented Nov 28, 2024

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 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 #5846 and llvm/llvm-project#118011)

@Keenuts
Copy link
Contributor Author

Keenuts commented Dec 3, 2024

@alan-baker I believe this is a validation error, probably a simple oversight on the added code, but in case I'm missing something?

@Keenuts
Copy link
Contributor Author

Keenuts commented Dec 3, 2024

Started to look into a code change for this, and seems there are quite a few tests cases where we check OpConstantNull is refused.
Example:

%ext = OpExtInstImport "NonSemantic.ClspvReflection.5"
%int = OpTypeInt 32 0
%null = OpConstantNull %int
%decl = OpExtInst %void %ext Kernel %foo %foo_name %null

This test expects a validation error to show because %null is not an OpConstant.
Those instruction indeed have a line like:

XX must be a 32-bit unsigned integer **OpConstant** composed with the bits of *some-table*.

Some extension have a valid flag with a value = to 0 (Kernel Property Flags) for ex.
I suspect if we apply the spec to the letter, OpConstantNull shall be rejected since it's another opcode? (Which is sad given the spec says OpConstantNull %int = 0)

@alan-baker
Copy link
Contributor

I think strictly speaking, yes, it is disallowed. That might have been an oversight to simply disallow spec constants. There probably isn't much to gain by allowing it though unless every consumer handles OpConstantNull already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants