-
Notifications
You must be signed in to change notification settings - Fork 116
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
amdllpc does not preserve debug information #513
Comments
Hi @inequation, What do you want to do with the debug info? Although this is not directly related to your question, note that llvm-objdump doesn't currently produce complete disassemby that would allow you to modify the dump and get a valid elf after re-assembling with llvm-mc. IIRC the |
Hi @kuhar, I'm working on a shader programming educational tool. GCN/RDNA ISA can be intimidating initially for inexperienced programmers, especially long, unrolled loops, and I'm in need of a way to provide some context for the generated disassembly ("where does this massive blob of instructions come from?"). I would have linked a publication about the software I'm writing, but it's a team effort and it hasn't been published yet. :) I'm sure you can see how having that debug info available would be useful in other contexts. I'm fine with parsing the DWARF myself, I just don't know the LLVM/LLPC codebases nearly well enough to know where to start looking to ensure it is actually dumped. |
I agree with @kuhar: it's a known limitation because so far, nobody has done the work of just tracking the debug info through the compile pipeline to make sure it doesn't disappear. Work on this would of course be welcome, otherwise we'll surely get to it eventually, but with no date attached ;) |
I'm fine with working on this myself and contributing the work here, but some guidance would be necessary. For instance, I wasn't able to find my way through all the abstraction layers of LLVM to where bitcode gets lowered to GCN ISA, or where the |
The part in LLPC which adds the necessary LLVM passes to convert IR to an ELF should be this line: llpc/llpc/builder/llpcBuilderContext.cpp Line 264 in d58bd5f
The ELF writing code in LLVM that is specific to the AMDGPU backend should be in the llvm/lib/Target/AMDGPU/MCTargetDesc directory of LLVM: https://github.com/llvm/llvm-project/tree/master/llvm/lib/Target/AMDGPU/MCTargetDescI think AMDGPUTargetStreamer.cpp and AMDGPUAsmPrinter.cpp are the main classes responsible for creating ELF files (please correct me if I’m mistaken). Btw, if you start amdllpc with |
|
…ure use' The previous fix broke compatibility in some AMD internal builds. This commit, in conjunction with the corresponding XGL commit, fixes that. Change-Id: Iec0ee5e489b2a15b8eb30add8ddadddeb0f20fad Pull-Request: GPUOpen-Drivers#513 Author: Tim Renouf <tim.renouf@amd.com> git-pf-change: stg@2087392
Hello there! Long time, no see. I finally got to explore this a bit, and with two hacks inside the LLVM codebase, I was able to generate an ELF with the following debug line info:
And the sequence of line numbers makes sense, comparing it to the source GLSL (available in the attachment to the OP), so this is progress! There are, however, clear problems (empty source file name replaced with
I'm quite sure these are just symptoms of problems that happen somewhere earlier up the pipeline. I'll keep digging, but I'd appreciate any guidance I can get. |
I synced to latest, and of course the patch no longer applied cleanly. Here it is attached, updated to match latest
|
I believe I have a proper fix for half of the issue. See the PR mentioned above (#772). The other half is that source file name gets lost somewhere on the way and becomes empty, which is later interpreted as |
As of current head, this almost works as I need it to! Fixing source file name requires a fix within glslang, which I'll be trying to get in via KhronosGroup/glslang#2321. |
Hello there,
I'm not even sure if I'm posting this issue on the correct project in the suite, so apologies if that isn't the case.
I'm trying to compile a simple Vulkan fragment shader with amdllpc. According to the AMDGPU target user guide, the ELFs produced by it can contain a
.debug
section with DWARF data. However, I can't seem to be able to get it:I've figured out that I need to set
-trim-debug-info=false
not to strip the SPIR-V debug info, and I had a look at the SPIR-V lowering code and it seems like the preserves debug info. I can also in the LLVM bitcode emitted to stdout that some symbols are there. How do I get the DWARF info out?Here's the command line I'm using:
And attached is the stdout output, which contains the GLSL source and all the intermediate stages: outs.log
The text was updated successfully, but these errors were encountered: