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

DWARF version #8394

Open
bpervan opened this issue Aug 20, 2024 · 1 comment
Open

DWARF version #8394

bpervan opened this issue Aug 20, 2024 · 1 comment

Comments

@bpervan
Copy link

bpervan commented Aug 20, 2024

Hi,

I'm not sure if I'm getting everything correctly, so I'm going to put it plain and simple:

is it possible to force a specific DWARF version when cross-compiling Halide kernel? As far as I can see, it is possible to set Halide::Target::Debug feature but this defaults to DWARF v5 (at least for the Halide versions 16 and up).

The issue is that on the other side of the chain, I'm stuck with a customized toolchain based on GCC 7 which supports DWARF up to v4. When building the final executable (linking to the cross-precompiled .o library), the linker basically complains with:

.../v1.0.16-pulp-riscv-gcc-ubuntu-18/bin/../lib/gcc/riscv32-unknown-elf/7.1.1/../../../../riscv32-unknown-elf/bin/ld: Dwarf Error: found dwarf version '5', this reader only handles version 2, 3 and 4 information."

Or to rephrase: To which version of Halide do I have to revert to get debug symbols emitted in compliance with DWARF v4?

@abadams
Copy link
Member

abadams commented Aug 20, 2024

The -debug target flag does three things:

  1. Modifies the pipeline to print information about the args on entry
  2. Adds dwarf information to those parts of the runtime written in c++
  3. Modifies the behavior of the GPU runtime modules to print extra things and add additional synchronization

Note that the -debug target flag will never give you dwarf info for the compiled pipeline. We don't have sensible source locations, unfortunately, due to being an embedded DSL.

If you just want 1, you can just compile the pipeline with -debug and -no_runtime, and link it to a standalone non-debug runtime.

If you want 1, 2, and 3, then you'll need to mess with the Halide build files to add "-gdwarf-4" everywhere -DDEBUG_RUNTIME is set and rebuild libHalide.

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

No branches or pull requests

2 participants