Interactive Performance Profiling and Debugging Kevin Pouget - - PowerPoint PPT Presentation

interactive performance profiling and debugging
SMART_READER_LITE
LIVE PREVIEW

Interactive Performance Profiling and Debugging Kevin Pouget - - PowerPoint PPT Presentation

Interactive Performance Profiling and Debugging Kevin Pouget Jean-Fran cois M ehaut, Miguel Santana Universit e Grenoble Alpes / LIG, STMicroelectronics, France Nano2017-DEMA project Nano2017/Dema Meeting, Grenoble June 24 th , 2016


slide-1
SLIDE 1

Interactive Performance Profiling and Debugging

Kevin Pouget Jean-Fran¸ cois M´ ehaut, Miguel Santana

Universit´ e Grenoble Alpes / LIG, STMicroelectronics, France Nano2017-DEMA project

Nano2017/Dema Meeting, Grenoble June 24th, 2016

Kevin Pouget Interactive Performance Profiling and Debugging Dema Meeting 1 / 9

slide-2
SLIDE 2

Introduction Introduction

Profiling today

gprof

◮ compile-time instrumentation of function calls ◮ whole execution

perf stat

◮ OS hooks for hardware counters ◮ whole execution or attach/detach

papi

◮ OS hooks for hardware counters ◮ manual code instrumentation

trace-based post-mortem analyzers

◮ runtime library instrumentation Kevin Pouget Interactive Performance Profiling and Debugging Dema Meeting 2 / 9

slide-3
SLIDE 3

Introduction Introduction

Profiling today

gprof

◮ compile-time instrumentation of function calls ◮ whole execution

perf stat

◮ OS hooks for hardware counters ◮ whole execution or attach/detach

papi

◮ OS hooks for hardware counters ◮ manual code instrumentation

trace-based post-mortem analyzers

◮ runtime library instrumentation Kevin Pouget Interactive Performance Profiling and Debugging Dema Meeting 2 / 9

slide-4
SLIDE 4

Introduction Introduction

Profiling today

gprof

◮ compile-time instrumentation of function calls ◮ whole execution

perf stat

◮ OS hooks for hardware counters ◮ whole execution or attach/detach

papi

◮ OS hooks for hardware counters ◮ manual code instrumentation

trace-based post-mortem analyzers

◮ runtime library instrumentation

No efficient way to interactively profile regions of interest

Kevin Pouget Interactive Performance Profiling and Debugging Dema Meeting 2 / 9

slide-5
SLIDE 5

Introduction Introduction

Profiling today

No efficient way to interactively profile regions of interest

Source-level interactive debuggers

Kevin Pouget Interactive Performance Profiling and Debugging Dema Meeting 2 / 9

slide-6
SLIDE 6

Introduction Introduction

Profiling today

No efficient way to interactively profile regions of interest

Source-level interactive debuggers

Extensive control over the process execution Powerful (and intuitive ?) command-line user interface

Kevin Pouget Interactive Performance Profiling and Debugging Dema Meeting 2 / 9

slide-7
SLIDE 7

Introduction Introduction

Profiling today

No efficient way to interactively profile regions of interest

Source-level interactive debuggers

Extensive control over the process execution Powerful (and intuitive ?) command-line user interface Ability to dynamically compile and insert code in the process

Kevin Pouget Interactive Performance Profiling and Debugging Dema Meeting 2 / 9

slide-8
SLIDE 8

Introduction Introduction

Profiling today

No efficient way to interactively profile regions of interest

Source-level interactive debuggers

Extensive control over the process execution Powerful (and intuitive ?) command-line user interface Ability to dynamically compile and insert code in the process Let’s combine them into an interactive profiling tool!

Kevin Pouget Interactive Performance Profiling and Debugging Dema Meeting 2 / 9

slide-9
SLIDE 9

Introduction Introduction

Profiling today

No efficient way to interactively profile regions of interest

Source-level interactive debuggers

Extensive control over the process execution Powerful (and intuitive ?) command-line user interface Ability to dynamically compile and insert code in the process Let’s combine them into an interactive profiling tool!a

aonly sequential executions / at language-level for now. Kevin Pouget Interactive Performance Profiling and Debugging Dema Meeting 2 / 9

slide-10
SLIDE 10

Functional and Performance Source-level Debugging Functional and Performance Source-level Debugging

Functional Interactive debugging

Navigate in the application execution Study its current memory state and execution paths Test and verify debugging hypothesis

Kevin Pouget Interactive Performance Profiling and Debugging Dema Meeting 3 / 9

slide-11
SLIDE 11

Functional and Performance Source-level Debugging Functional and Performance Source-level Debugging

Functional Interactive debugging

Navigate in the application execution Study its current memory state and execution paths Test and verify debugging hypothesis

Performance Interactive Debugging

Navigate in the application execution Profile specific function/region execution Test and verify debugging hypothesis

Kevin Pouget Interactive Performance Profiling and Debugging Dema Meeting 3 / 9

slide-12
SLIDE 12

Functional and Performance Source-level Debugging Functional and Performance Source-level Debugging

Functional Interactive debugging

Navigate in the application execution Study its current memory state and execution paths Test and verify debugging hypothesis

Performance Interactive Debugging

Navigate in the application execution Profile specific function/region execution Test and verify debugging hypothesis

Kevin Pouget Interactive Performance Profiling and Debugging Dema Meeting 3 / 9

slide-13
SLIDE 13

Functional and Performance Source-level Debugging Functional and Performance Source-level Debugging

Functional Interactive debugging

Navigate in the application execution Study its current memory state and execution paths Test and verify debugging hypothesis

Performance Interactive Debugging

Navigate in the application execution Profile specific function/region execution Test and verify debugging hypothesis Experimentation prototype developed as a GDB Python extension

Kevin Pouget Interactive Performance Profiling and Debugging Dema Meeting 3 / 9

slide-14
SLIDE 14

Interactive Code Profiling Interactive Code Profiling

What to profile?

During the normal execution:

◮ the whole ◮ a function execution ◮ a region (from line ... to line ... — breakpoints involved) ◮ manual start and stops Kevin Pouget Interactive Performance Profiling and Debugging Dema Meeting 4 / 9

slide-15
SLIDE 15

Interactive Code Profiling Interactive Code Profiling

What to profile?

During the normal execution:

◮ the whole ◮ a function execution ◮ a region (from line ... to line ... — breakpoints involved) ◮ manual start and stops

Outside of the normal execution:

◮ we’ll discuss it a bit later Kevin Pouget Interactive Performance Profiling and Debugging Dema Meeting 4 / 9

slide-16
SLIDE 16

Interactive Code Profiling Interactive Code Profiling

What to profile?

During the normal execution Outside of the normal execution

What is measured?

/proc/PID/... values (mem usage, context switches, ...) perf stat counters

◮ LD PRELOAD patch to support on-demand counter dump ◮ task-clock, context-switches, cpu-migrations, page-faults, cycles,

instructions, branches, ...

gprof counters

◮ preliminary and on-going (inspection of glibc profiling counters) ◮ call-graph, time per function, ...

function/address execution count (breakpoints involved)

Kevin Pouget Interactive Performance Profiling and Debugging Dema Meeting 4 / 9

slide-17
SLIDE 17

Interactive Code Profiling Interactive Code Profiling

What to profile?

During the normal execution Outside of the normal execution

What is measured?

/proc/PID/... values (mem usage, context switches, ...) perf stat counters gprof counters function/address execution count (breakpoints involved) What to do with nesting?

Kevin Pouget Interactive Performance Profiling and Debugging Dema Meeting 4 / 9

slide-18
SLIDE 18

Interactive Code Profiling Interactive Code Profiling

What to do with nesting?

Kevin Pouget Interactive Performance Profiling and Debugging Dema Meeting 5 / 9

slide-19
SLIDE 19

Interactive Code Profiling Interactive Code Profiling

What to do with nesting?

Kevin Pouget Interactive Performance Profiling and Debugging Dema Meeting 5 / 9

slide-20
SLIDE 20

Interactive Code Profiling Interactive Code Profiling

What to do with nesting?

Kevin Pouget Interactive Performance Profiling and Debugging Dema Meeting 5 / 9

slide-21
SLIDE 21

Interactive Code Profiling Interactive Code Profiling

What to do with nesting?

Kevin Pouget Interactive Performance Profiling and Debugging Dema Meeting 5 / 9

slide-22
SLIDE 22

Interactive Code Profiling Interactive Code Profiling

What to do with nesting? ... and multiple hits ?

Kevin Pouget Interactive Performance Profiling and Debugging Dema Meeting 5 / 9

slide-23
SLIDE 23

Interactive Code Profiling Interactive Code Profiling

What to do with nesting? ... and multiple hits ? ... and concurrent hits ?

Kevin Pouget Interactive Performance Profiling and Debugging Dema Meeting 5 / 9

slide-24
SLIDE 24

Interactive Code Profiling Interactive Code Profiling

Profiling outside of the normal execution based on GDB/GCC dynamic compilation feature

Kevin Pouget Interactive Performance Profiling and Debugging Dema Meeting 6 / 9

slide-25
SLIDE 25

Interactive Code Profiling Interactive Code Profiling

Profiling outside of the normal execution based on GDB/GCC dynamic compilation feature (gdb) profile interactive

◮ -repeat:10 ◮ -code:

fct(param1, param2, ...)

= ⇒ generates: /* start profiling */ for(int i = 0; i < 10; i++) fct(param1, param2, ...); /* stop profiling */

Kevin Pouget Interactive Performance Profiling and Debugging Dema Meeting 6 / 9

slide-26
SLIDE 26

Interactive Code Profiling Interactive Code Profiling

Profiling outside of the normal execution based on GDB/GCC dynamic compilation feature (gdb) profile interactive

◮ -repeat:10 ◮ -code:

fct(param1, param2, ...)

◮ -app: runs the whole app, with same command-line args Kevin Pouget Interactive Performance Profiling and Debugging Dema Meeting 6 / 9

slide-27
SLIDE 27

Interactive Code Profiling Interactive Code Profiling

Profiling outside of the normal execution based on GDB/GCC dynamic compilation feature (gdb) profile interactive

◮ -repeat:10 ◮ -code:

fct(param1, param2, ...)

◮ -app: runs the whole app, with same command-line args ◮ -flags -O1,-O2,-O3: compiles and benchmarks with different cflags Kevin Pouget Interactive Performance Profiling and Debugging Dema Meeting 6 / 9

slide-28
SLIDE 28

Interactive Code Profiling Interactive Code Profiling

Profiling outside of the normal execution based on GDB/GCC dynamic compilation feature (gdb) profile interactive

◮ -repeat:10 ◮ -code:

fct(param1, param2, ...)

◮ -app: runs the whole app, with same command-line args ◮ -flags -O1,-O2,-O3: compiles and benchmarks with different cflags ◮ -file src.c: specifies where to find the code to run Kevin Pouget Interactive Performance Profiling and Debugging Dema Meeting 6 / 9

slide-29
SLIDE 29

Interactive Code Profiling Interactive Code Profiling

Profiling outside of the normal execution based on GDB/GCC dynamic compilation feature (gdb) profile interactive

◮ -repeat:10 ◮ -code:

fct(param1, param2, ...)

◮ -app: runs the whole app, with same command-line args ◮ -flags -O1,-O2,-O3: compiles and benchmarks with different cflags ◮ -file src.c: specifies where to find the code to run

“side-effect” free code only

◮ at least no dependency on overwritten values Kevin Pouget Interactive Performance Profiling and Debugging Dema Meeting 6 / 9

slide-30
SLIDE 30

Interactive Code Profiling Interactive Code Profiling

What to do with the measurements?

raw display aggregation graph plot

Kevin Pouget Interactive Performance Profiling and Debugging Dema Meeting 7 / 9

slide-31
SLIDE 31

Interactive Code Profiling Interactive Code Profiling

What to do with the measurements?

raw display aggregation graph plot | function profile[compute_forces_crust_mantle_dev] | ================================================= | min_flt: 13 | cycles: 113,705,103 | branch-misses 110,791 | task-clock: 39.381 | branches: 10,622,409 | instructions: 188,404,850 | stalled-cycles-frontend: 50,032,346 | stalled-cycles-backend: 15,004,422 | ... |

Kevin Pouget Interactive Performance Profiling and Debugging Dema Meeting 7 / 9

slide-32
SLIDE 32

Interactive Code Profiling Interactive Code Profiling

What to do with the measurements?

raw display aggregation graph plot | cycles avg: 11553677 | min: 13549 | max: 218766806 | ----------------------------- | stalled-cycles-backend avg: 1517803 | min: 1178455 | max: 26184303 | ----------------------------- | instructions avg: 19149774 | min: 18745 | max: 367804777 | ...

Kevin Pouget Interactive Performance Profiling and Debugging Dema Meeting 7 / 9

slide-33
SLIDE 33

Interactive Code Profiling Interactive Code Profiling

What to do with the measurements?

raw display aggregation graph plot

Kevin Pouget Interactive Performance Profiling and Debugging Dema Meeting 7 / 9

slide-34
SLIDE 34

Conclusion and future work Conclusion and future work

Fine-grained control of profiling regions Ability to incorporate new counters and profiling tools

Kevin Pouget Interactive Performance Profiling and Debugging Dema Meeting 8 / 9

slide-35
SLIDE 35

Conclusion and future work Conclusion and future work

Fine-grained control of profiling regions Ability to incorporate new counters and profiling tools Interactivity through GDB/GCC dynamic compilation

Kevin Pouget Interactive Performance Profiling and Debugging Dema Meeting 8 / 9

slide-36
SLIDE 36

Conclusion and future work Conclusion and future work

Fine-grained control of profiling regions Ability to incorporate new counters and profiling tools Interactivity through GDB/GCC dynamic compilation Compare our profiling results with other tools Profile real-world applications to demonstrate usability

◮ Specfem3D kernels Kevin Pouget Interactive Performance Profiling and Debugging Dema Meeting 8 / 9

slide-37
SLIDE 37

Conclusion and future work Conclusion and future work

Fine-grained control of profiling regions Ability to incorporate new counters and profiling tools Interactivity through GDB/GCC dynamic compilation Compare our profiling results with other tools Profile real-world applications to demonstrate usability

◮ Specfem3D kernels

Extend to multithreaded environments Integrate with mcGDB and its programming models (OpenMP)

◮ focus on task/task-graph execution ? Kevin Pouget Interactive Performance Profiling and Debugging Dema Meeting 8 / 9

slide-38
SLIDE 38

Interactive Performance Profiling and Debugging

Kevin Pouget Jean-Fran¸ cois M´ ehaut, Miguel Santana

Universit´ e Grenoble Alpes / LIG, STMicroelectronics, France Nano2017-DEMA project

Nano2017/Dema Meeting, Grenoble June 24th, 2016

Kevin Pouget Interactive Performance Profiling and Debugging Dema Meeting 9 / 9