Uh oh!
There was an error while loading. Please reload this page.
[MONO] Add JIT_CODE_DEBUG_INFO record functionality for Jitdump - #85107
Conversation
| record.code_index = ++code_index; | ||
| // TODO: write debugInfo and unwindInfo immediately before the JitCodeLoadRecord (while lock is held). | ||
| DebugEntry ent; |
There was a problem hiding this comment.
This should follow the mono coding conventions, see the rest of the file for examples.
There was a problem hiding this comment.
done. let me know if there is anything else
| record.code_index = ++code_index; | ||
| // TODO: write debugInfo and unwindInfo immediately before the JitCodeLoadRecord (while lock is held). | ||
| DebugEntry ent; |
There was a problem hiding this comment.
done. let me know if there is anything else
fanyang-mono
left a comment
There was a problem hiding this comment.
Please go through your change and fix the coding style. I've pointed out a few examples for you.
| guint32 line; | ||
| guint32 discrim; | ||
| char name[]; | ||
| }DebugEntry; |
There was a problem hiding this comment.
| }DebugEntry; | |
| }DebugEntry; |
| guint64 code_addr; | ||
| guint64 nr_entry; | ||
| DebugEntry debug_entry[]; | ||
| }JitCodeDebug; |
There was a problem hiding this comment.
| }JitCodeDebug; | |
| }JitCodeDebug; |
| DebugEntry debug_entry[]; | ||
| }JitCodeDebug; | ||
| static void add_basic_JitCodeDebug_info(JitCodeDebug *record); |
There was a problem hiding this comment.
| staticvoidadd_basic_JitCodeDebug_info(JitCodeDebug*record); | |
| staticvoidadd_basic_JitCodeDebug_info(JitCodeDebug*record); |
There was a problem hiding this comment.
In mono code base, we add a space between the function name and the "(". Please follow this function call style for all the code change in this PR.
| rec.code_addr = (guint64)dmji->code_start; | ||
| rec.header.total_size = sizeof(rec) + sizeof(ent) + 1; | ||
| rec.nr_entry=1; | ||
| for(i=0;i < dmji->num_line_numbers;++i){ |
| loc = mono_debug_lookup_source_location_by_il(jinfo->d.method,dmji->line_numbers[i].il_offset,NULL); | ||
| if(!(loc) |
There was a problem hiding this comment.
| if(!(loc) | |
| if(!loc) |
saitama951
commented
Apr 24, 2023
Thank you for helping me out with the code style. I have made the changes accordingly. |
@fanyang-mono is there any other changes required to be made? |
directhex
commented
May 17, 2023
@vargaz@lambdageek can someone see if this is ready to merge now? |
@fanyang-mono It's creating multiple sets of .map and .dump files in the /tmp/ folder for one particular workload. Error: Perf tool is able to read .map files to do symbol resolution and show the data. And due to this, we are able to see the functions in the profile but not the annotations inside that which requires a .dump file. |
@shivanirmishra The runtime should generate the .dump file. can you cross check that under the I faced a similar issue and fixed the same : #82520 |
shivanirmishra
commented
May 29, 2023
Hi @saitama951, yes runtime is generating the .dump file in the/tmp/ folder. |
saitama951
commented
May 29, 2023
@shivanirmishra the fix should be there in .NET 8 preview 4 or you can cherry pick the commit. |
shivanirmishra
commented
May 31, 2023
@saitama951 |
@shivanirmishra I have fixed the |
shivanirmishra
commented
Jun 12, 2023
Hi @saitama951, thank you for your help. |
fanyang-mono
commented
Jun 12, 2023
/backport to release/7.0-staging |
Started backporting to release/7.0-staging: https://github.com/dotnet/runtime/actions/runs/5248244227 |
shivanirmishra
commented
Jun 13, 2023
@saitama951@fanyang-mono |
saitama951
commented
Jun 13, 2023
@shivanirmishra It seems source code annotation fails on top of the BenchmarkDotnet library. it works for sample programs without the BDN. I have been manually looking into the jitted-so's, everything looks good there as well. |
shivanirmishra
commented
Jun 13, 2023
Thanks @saitama951 For Example: after running the |
fanyang-mono
commented
Jun 13, 2023
Yes, I am working on backporting the fixes to regressions to 7.0 now. |
fanyang-mono
commented
Jun 14, 2023
@shivanirmishra We will get this fix in the next possible servicing release. |
shivanirmishra
commented
Jun 20, 2023
@saitama951@fanyang-mono This is the profile with 100 iterations of some ml.net workload: ![]() This is the profile with 10k iterations of the same workload: ![]() The above profiles are after Any suggestions or ideas for why this is not working with larger overhead? |
saitama951
commented
Jul 4, 2023
@shivanirmishra I have proposed the fix for the issue that you were facing. |
shivanirmishra
commented
Jul 4, 2023
Hi @saitama951@fanyang-mono
Dimension of the matrix: 2000x3 and 3x2000, and running the MultiplyMatrices function once.
![]()
![]() We are not able to see the main function MultiplyMatrices anywhere in the profile. ![]() |
@shivanirmishra have you applied the diff changes ? |
shivanirmishra
commented
Jul 6, 2023
@saitama951 Yes, It's working. |










This is related to #36774 . added support for
JIT_CODE_DEBUG_INFOrecord which helps to annotate source code in perf.Changed the jitdump version to 1 as the perf sources expect version 1
https://github.com/torvalds/linux/blob/master/tools/perf/util/jitdump.h#L25
Example use:-
MONO_ENV_OPTIONS="--jitdump" perf record -k 1 dotnet <path/to/binary>
perf inject --jit -i perf.data -o perf.jit.data
perf report -i perf.jit.data
cc: @fanyang-mono