Skip to content

Commit

Permalink
Merge pull request #37682 from vchuravy/vc/perf_jitevents
Browse files Browse the repository at this point in the history
Enable Perf JITEvents by default
  • Loading branch information
vchuravy authored Oct 2, 2020
2 parents 5fbe9d1 + b2220ed commit 36effbe
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Make.inc
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ endif
USE_OPROFILE_JITEVENTS ?= 0

# Set to 1 to enable profiling with perf
USE_PERF_JITEVENTS ?= 0
USE_PERF_JITEVENTS ?= 1

# assume we don't have LIBSSP support in our compiler, will enable later if likely true
HAVE_SSP := 0
Expand Down
8 changes: 8 additions & 0 deletions doc/src/manual/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,14 @@ event listener for just-in-time (JIT) profiling.
(`USE_INTEL_JITEVENTS` set to `1` in the build configuration), or
* [OProfile](http://oprofile.sourceforge.net/news/) (`USE_OPROFILE_JITEVENTS` set to `1`
in the build configuration).
* [Perf](https://perf.wiki.kernel.org) (`USE_PERF_JITEVENTS` set to `1`
in the build configuration). This integration is enabled by default.

### `ENABLE_GDBLISTENER`

If set to anything besides `0` enables GDB registration of Julia code on release builds.
On debug builds of Julia this is always enabled. Recommended to use with `-g 2`.


### `JULIA_LLVM_ARGS`

Expand Down
3 changes: 2 additions & 1 deletion doc/src/manual/profile.md
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,8 @@ Or similary with `perf` :
```
$ ENABLE_JITPROFILING=1 perf record -o /tmp/perf.data --call-graph dwarf ./julia /test/fastmath.jl
$ perf report --call-graph -G
$ perf inject --jit --input /tmp/perf.data --output /tmp/perf-jit.data
$ perf report --call-graph -G -i /tmp/perf-jit.data
```
There are many more interesting things that you can measure about your program, to get a comprehensive list
Expand Down
7 changes: 3 additions & 4 deletions src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7728,10 +7728,9 @@ extern "C" void jl_init_llvm(void)
std::string DL = jl_data_layout.getStringRepresentation() + "-ni:10:11:12:13";
jl_data_layout.reset(DL);

// Register GDB event listener
#ifdef JL_DEBUG_BUILD
jl_ExecutionEngine->RegisterJITEventListener(JITEventListener::createGDBRegistrationListener());
#endif
// Register GDB event listener
if(jl_using_gdb_jitevents)
jl_ExecutionEngine->RegisterJITEventListener(JITEventListener::createGDBRegistrationListener());

#ifdef JL_USE_INTEL_JITEVENTS
if (jl_using_intel_jitevents)
Expand Down
11 changes: 11 additions & 0 deletions src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,8 @@ char jl_using_oprofile_jitevents = 0; // Non-zero if running under OProfile
char jl_using_perf_jitevents = 0;
#endif

char jl_using_gdb_jitevents = 0;

int isabspath(const char *in) JL_NOTSAFEPOINT
{
#ifdef _OS_WINDOWS_
Expand Down Expand Up @@ -692,6 +694,15 @@ void _julia_init(JL_IMAGE_SEARCH rel)
}
#endif

#if defined(JL_DEBUG_BUILD)
jl_using_gdb_jitevents = 1;
# else
const char *jit_gdb = getenv("ENABLE_GDBLISTENER");
if (jit_gdb && atoi(jit_gdb)) {
jl_using_gdb_jitevents = 1;
}
#endif

if ((jl_options.outputo || jl_options.outputbc || jl_options.outputasm) &&
(jl_options.code_coverage || jl_options.malloc_log)) {
jl_error("cannot generate code-coverage or track allocation information while generating a .o, .bc, or .s output file");
Expand Down
1 change: 1 addition & 0 deletions src/julia_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,7 @@ extern char jl_using_oprofile_jitevents;
#ifdef JL_USE_PERF_JITEVENTS
extern char jl_using_perf_jitevents;
#endif
extern char jl_using_gdb_jitevents;
extern size_t jl_arr_xtralloc_limit;

// -- init.c -- //
Expand Down

4 comments on commit 36effbe

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

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

Executing the daily package evaluation, I will reply here when finished:

@nanosoldier runtests(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

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

Your package evaluation job has completed - possible new issues were detected. A full report can be found here. cc @maleadt

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

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

Executing the daily benchmark build, I will reply here when finished:

@nanosoldier runbenchmarks(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

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

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @ararslan

Please sign in to comment.