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

[codegen/llvm] Emit DWARF debug information for LoweredFunc instances #3420

Merged
merged 1 commit into from
Jul 18, 2019

Conversation

ajtulloch
Copy link
Contributor

Emit DWARF debug information. This allows us to set breakpoints on these generated functions, inspect arguments, show reasonable names in AOT mode in profiling tools, etc. There's a subsequent perf PR upcoming from Bram which augments this with support for Linux perf's jit interface, which makes perf work in JIT scenarios.

The implementation is fairly straightforward - for every LoweredFunc, we emit DWARF information for the function, it's signature, and it's arguments. You can see an example query in:

(lldb) image lookup -r -n myadd1 -v
1 match found in /var/folders/bk/2wcywy612zx2882l0z06y_w1f8bjlv/T/tmpv5ie135z/mylib.so:
        Address: mylib.so[0x0000000000001270] (mylib.so.__TEXT.__text + 0)
        Summary: mylib.so`myadd1 at model.tvm
         Module: file = "/var/folders/bk/2wcywy612zx2882l0z06y_w1f8bjlv/T/tmpv5ie135z/mylib.so", arch = "x86_64"
    CompileUnit: id = {0xffffffff00000000}, file = "/tmp/model.tvm", language = "c"
       Function: id = {0xffffffff00000036}, name = "myadd1", range = [0x0000000114693270-0x00000001146935f6)
       FuncType: id = {0xffffffff00000036}, compiler_type = "int (char *, char *, int)"
         Blocks: id = {0xffffffff00000036}, range = [0x114693270-0x1146935f6)
      LineEntry: [0x0000000114693270-0x000000011469327b): /tmp/model.tvm
         Symbol: id = {0x00000004}, range = [0x0000000114693270-0x0000000114693600), name="myadd1"
       Variable: id = {0xffffffff00000054}, name = "arg1", type = "char *", location = rdi, decl =
       Variable: id = {0xffffffff00000061}, name = "arg2", type = "char *", location = rsi, decl =
       Variable: id = {0xffffffff0000006e}, name = "arg3", type = "int32", location = rdx, decl =

Some more screenshots from Bram:

64649048_712563002535623_1165287093409153024_o

@ajtulloch ajtulloch force-pushed the add-dwarf-debug-information branch 3 times, most recently from aede7bb to b61f2d2 Compare June 23, 2019 01:33
@tqchen
Copy link
Member

tqchen commented Jun 24, 2019

Thanks @ajtulloch please fix the CI error, and also tag a few more reviewers

@ajtulloch ajtulloch force-pushed the add-dwarf-debug-information branch 2 times, most recently from df73805 to 5b1a915 Compare June 24, 2019 19:27
@ajtulloch
Copy link
Contributor Author

cc @yidawang, @tqchen, @jroesch, @eqy

@tqchen tqchen added the status: need update need update based on feedbacks label Jun 27, 2019
@tqchen
Copy link
Member

tqchen commented Jun 28, 2019

@ajtulloch I have retriggered the CI several times and the test consistently failed at the TOPI test, can you look into what happened?

@ajtulloch
Copy link
Contributor Author

@tqchen sure will take a look.

Copy link
Member

@jroesch jroesch left a comment

Choose a reason for hiding this comment

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

LGTM modulo CI

@tqchen
Copy link
Member

tqchen commented Jul 8, 2019

@ajtulloch any leads?

@ajtulloch ajtulloch force-pushed the add-dwarf-debug-information branch from 5b1a915 to dd0555d Compare July 17, 2019 17:24
@ajtulloch
Copy link
Contributor Author

@tqchen I'll just tried emit it only for CodeGenCPU backends.

@tqchen tqchen added status: accepted and removed status: need review status: need update need update based on feedbacks labels Jul 18, 2019
@tqchen tqchen merged commit d82db90 into apache:master Jul 18, 2019
@tqchen
Copy link
Member

tqchen commented Jul 18, 2019

Thanks @ajtulloch @jroesch , this PR is merged

wweic pushed a commit to wweic/tvm that referenced this pull request Aug 9, 2019
wweic pushed a commit to neo-ai/tvm that referenced this pull request Sep 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants