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] Emit DebugFunction/Definition for both wrapper and real functions #6966

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

SteveUrquhart
Copy link
Contributor

#6758 unfortunately caused a regression for shaders compiled without -fcgl. This PR extends the original fix and corrects the regression. We now emit DebugFunction and DebugFunctionDefinition pairs for both the wrapper and the main functions, and a DebugEntrypoint that points at the wrapper function. This survives inlining.

@s-perron
Copy link
Collaborator

Lots of tests are failing. Try running the spir-v tests: ninja check-clang-codegenspirv.

@SteveUrquhart
Copy link
Contributor Author

I'm sorry, I have one test left to fix.

@SteveUrquhart
Copy link
Contributor Author

@s-perron, the current failure in CI seems to be coming from an optimizer pass. I've attached the spvasm if we use fcgl or O0, and we see there are now 2 DebugFunctions, one for the wrapper and one for src.main. debug_info_manager.cpp:117 in the optimizer asserts.
assert(
fn_id_to_dbg_fn_.find(fn_id) == fn_id_to_dbg_fn_.end() &&
"Register DebugFunction for a function that already has DebugFunction");
I appreciate your advice on this.
spirv.debug.opline.end.of.shader.O0.spvasm.txt
spirv.debug.opline.end.of.shader.fcgl.spvasm.txt

@s-perron
Copy link
Collaborator

@SteveUrquhart The DebugFunction instructions do not look correct. Both of them have %src_main for their declaration, which is incorrect for two reasons. First they represent different functions, so they should be different. Second, that value should be the result of a DebugFunctionDeclaration, and not the result of the OpFunction.

   %src_main = OpFunction %void None %15
         %10 = OpExtInst %void %1 DebugFunction %8 %5 %6 3 1 %7 %9 FlagIsProtected|FlagIsPrivate 3 %src_main
         %14 = OpExtInst %void %1 DebugFunction %13 %5 %6 3 1 %7 %9 FlagIsProtected|FlagIsPrivate 3 %src_main

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

Successfully merging this pull request may close these issues.

2 participants