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

Fix function definition in debug info, and related cleanups #2807

Merged
merged 4 commits into from
Nov 15, 2023

Conversation

nhaehnle
Copy link
Member

@nhaehnle nhaehnle commented Nov 8, 2023

The debug info support was originally written for the OpenCL debug info extension. We don't actually support kernel SPIR-V, though, and the shader debug info extension has existed for a while now, is produced by glslang and dxc, and is subtly different. The biggest relevant difference is in how function definitions work: the shader debug info extension avoids forward references.

This PR is a sequence of commits that clean up some of the debug info code and ultimately change how function definitions are handled to map the shader debug info extension.

isDefinition is always true, so createMethod could never be called. It
is also unclear how useful calling createMethod is at this point. It
seems the primary difference to createFunction is supporting vtable info
and this-pointer adjustments, but neither concept seems to exist in
NonSemantic.Shader.DebugInfo.100
DebugFunction is always a function definition, never a function
declaration -- those are represented using DebugFunctionDeclaration.

It's also unclear whether shader entry points should be considered "main
subprograms" or not. First of all, it's unclear what that flag means.
Second, entry points aren't exactly like C/C++ main() -- a better
analogy would be the "main" function of a thread created with
pthread_create or similar. Finally, the current test is simply incorrect
because NonSemantic.Shader.DebugInfo.100 doesn't actually reference the
OpFunction from the DebugFunction instruction.
Be honest about the operands of DebugFunction when reading the SPIR-V
and cleanly handle the fact that (unlike in the OpenCL debug info) the
DebugFunction instruction doesn't reference the OpFunction at all.
Setting the LLVM debug metadata can only be done after reading the
DebugFunctionDefinition instruction which links the two.
@nhaehnle nhaehnle requested a review from a team as a code owner November 8, 2023 19:53
@nhaehnle nhaehnle requested a review from jiaolu November 8, 2023 19:53
@amdvlk-admin
Copy link

Test summary for commit a57987c

CTS tests (Failed: 0/138184)
  • Built with version 1.3.5.2
  • Ubuntu navi3x, Srdcvk
    • Passed: 35162/69058 (50.9%)
    • Failed: 0/69058 (0.0%)
    • Not Supported: 33896/69058 (49.1%)
    • Warnings: 0/69058 (0.0%)
    Ubuntu navi2x, Srdcvk
    • Passed: 35242/69126 (51.0%)
    • Failed: 0/69126 (0.0%)
    • Not Supported: 33884/69126 (49.0%)
    • Warnings: 0/69126 (0.0%)

@jiaolu
Copy link
Contributor

jiaolu commented Nov 10, 2023

Thanks, LGTM , it cleans a lot of code.

jiaolu
jiaolu previously approved these changes Nov 10, 2023
Copy link
Contributor

@jiaolu jiaolu left a comment

Choose a reason for hiding this comment

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

LGTM.

The -trim-debug-info option should also trim this more advanced debug
info when set (which is the default).
@amdvlk-admin
Copy link

Test summary for commit 909e511

CTS tests (Failed: 0/138362)
  • Built with version 1.3.5.2
  • Ubuntu navi3x, Srdcvk
    • Passed: 35162/69147 (50.9%)
    • Failed: 0/69147 (0.0%)
    • Not Supported: 33985/69147 (49.1%)
    • Warnings: 0/69147 (0.0%)
    Ubuntu navi2x, Srdcvk
    • Passed: 35242/69215 (50.9%)
    • Failed: 0/69215 (0.0%)
    • Not Supported: 33973/69215 (49.1%)
    • Warnings: 0/69215 (0.0%)

@nhaehnle nhaehnle merged commit b138804 into GPUOpen-Drivers:dev Nov 15, 2023
9 checks passed
@nhaehnle nhaehnle deleted the pub-debuginfo branch November 15, 2023 15:49
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.

4 participants