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

DebugFunction has a function as its operand which results in spirv-val "not defined ID" error #3102

Closed
jaebaek opened this issue Dec 16, 2019 · 3 comments · Fixed by #3104
Closed
Assignees

Comments

@jaebaek
Copy link
Contributor

jaebaek commented Dec 16, 2019

DebugFunction must be located before a function definition based on the layout rule in the debug info spec:

"All other debugging instructions should be located between section 9
(All type declarations (OpTypeXXX instructions), all constant instructions, and
all global variable declarations …​) and section 10 (All function declaration)
per the core SPIR-V specification."

However, DebugFunction has a function id as one of its operands which results in "not defined ID" error when we run spirv-val

; Function information
%main_info = OpExtInst %void %DbgExt DebugFunction %main_name %main_type_info %dbg_src 6 1 %comp_unit %main_linkage_name FlagIsPublic 7 %main

       %main = OpFunction %void None %16

outputs

error: line 54: ID 2[%main] has not been defined
  %44 = OpExtInst %void %1 DebugFunction %14 %42 %35 6 1 %36 %15 FlagIsProtected|FlagIsPrivate 7 %main
@alan-baker
Copy link
Contributor

You could just have the DebugFunction occur after the OpFunctionEnd and it would satisfy the use/def rules. If the debug extension specifically allows new forward references, then the validator should be relaxed.

@alan-baker
Copy link
Contributor

I guess the spec intended to allow forward references based on the that text.

@jaebaek
Copy link
Contributor Author

jaebaek commented Jan 2, 2020

Yeah, I guess we must allow forward references to OpFunction from DebugFunction.

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

Successfully merging a pull request may close this issue.

2 participants