Docsity

Monitoring Microarchitectural Events with Hardware Counters for Performance Analysis - Pro, Study notes of Operating Systems

Toggle sidebar
bg1
Online Performance Analysis by Statistical
Sampling of Microprocessor Performance
Counters
Reza Azimi, Michael Stumm,
Reza Azimi, Michael Stumm, and Robert W. Wisniewski
and Robert W. Wisniewski
International Conference on Supercomputing (2005)
International Conference on Supercomputing (2005)
Presented by Fabrice Baijot
Presented by Fabrice Baijot
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d

Partial preview of the text

Download Monitoring Microarchitectural Events with Hardware Counters for Performance Analysis - Pro and more Study notes Operating Systems in PDF only on Docsity!

Online Performance Analysis by StatisticalSampling of Microprocessor PerformanceCounters

Reza Azimi, Michael Stumm, Reza Azimi, Michael Stumm,

and Robert W. Wisniewski and Robert W. Wisniewski

International Conference on Supercomputing (2005) International Conference on Supercomputing (2005)

Presented by Fabrice Baijot Presented by Fabrice Baijot

Overview

► ►

Introduction

Introduction

► ►

System Design

System Design

► ►

The Statistical Stall Breakdown (SSB) Model

The Statistical Stall Breakdown (SSB) Model

► ►

Experimental Results

Experimental Results

► ►

Related Work

Related Work

► ►

Conclusions

Conclusions

Introduction

► ►

Problems with runtime use of HPCs:

Problems with runtime use of HPCs:

Limited number of Limited number of

HPCs HPCs

in PMUs in PMUs

► ►

Limited number of events Limited number of events

Only specific subsets of events can be counted Only specific subsets of events can be counted

together together

► ►

Doing multiple runs of same application with Doing multiple runs of same application with different event subsets not viable (why?) different event subsets not viable (why?)

Introduction

Getting useful metrics requires: Getting useful metrics requires:

► ►

Detailed knowledge of micro Detailed knowledge of micro

architecture architecture

► ►

Combining sets of events for complete picture Combining sets of events for complete picture

PMU programming is only possible in kernel PMU programming is only possible in kernel

mode mode

► ►

Implementing it as a user process incurs too much Implementing it as a user process incurs too much overhead (why?) overhead (why?)

System Design

► ►

Library provides interface to users Library provides interface to users

► ►

Programming interface programs PMUs and configures Programming interface programs PMUs and configures

sampling engine sampling engine

► ►

Sampling engine implements HPC multiplexing and SSB Sampling engine implements HPC multiplexing and SSB

model model

► ►

HPC values can be read directly or logged in per HPC values can be read directly or logged in per

process process

PMU log PMU log

(Section 2, p.2)

System Design

► ►

Default sampling frequency is 200,000 cycles Default sampling frequency is 200,000 cycles

► ►

Sampling engine maintains HPC contexts and Sampling engine maintains HPC contexts and

switches them when OS switches processes switches them when OS switches processes

► ►

Three modes of operation: Three modes of operation:

 

Kernel only Kernel only

 

User only User only

 

Full system Full system

► ►

Address space indicates context Address space indicates context

 

Threads sharing address space are not distinguished Threads sharing address space are not distinguished

The SSB Model

► ►

Stall Stall

means cycle where no instruction

means cycle where no instruction

retires from reorder buffer

retires from reorder buffer

► ►

Each stall speculatively attributed to specific

Each stall speculatively attributed to specific

HW event called a

HW event called a

miss event

miss event

► ►

Stall sources are bottlenecks (why?)

Stall sources are bottlenecks (why?)

(Section 4, p.6)

The SSB Model

► ►

Formula for detecting bottlenecks:

Formula for detecting bottlenecks:

Where Where

Stall

Stall

i i

is the number of stalls caused by is the number of stalls caused by

miss event miss event

i

i

CPI

CPI

C C

is an estimate of the CPI when idealizing is an estimate of the CPI when idealizing

miss events miss events

CPI

CPI

Real Real

is elapsed cycles / instructions retired is elapsed cycles / instructions retired

► ►

CPI CPI

C C

is potential gain when reducing miss

is potential gain when reducing miss

events

events

(section 4, p.5)

Experimental Results

► ►

Basic validation:

Basic validation:

Micro Micro

architecture details difficult to understand architecture details difficult to understand

Sometimes requires access to proprietary Sometimes requires access to proprietary

information information

Consequently, a large set of micro Consequently, a large set of micro

benchmarks benchmarks

were created to monitor specific events in were created to monitor specific events in

isolation isolation

Results gave authors ‘confidence’ that system Results gave authors ‘confidence’ that system

“correctly captures most of the hardware “correctly captures most of the hardware

events” examined events” examined

Experimental Results

► ►

Sampling accuracy:

Sampling accuracy:

Goal is to compare probability of event Goal is to compare probability of event

e

e

occurring in interval occurring in interval

R

R

i i

to probability of event to probability of event

e

e

occurring in a subinterval of occurring in a subinterval of

R

R

ii

(why?) (why?)

Using Using

Kullback Kullback

Leibler Leibler

distance (integral of log distance (integral of log

likelihood) where < 0.2 is deemed acceptable likelihood) where < 0.2 is deemed acceptable

In other words, the distance between the In other words, the distance between the

averages of the sampling distributions should averages of the sampling distributions should

not exceed 15% not exceed 15%

Experimental Results

► ►

Comparing fully counted events to sampling

Comparing fully counted events to sampling

when running gcc:

when running gcc:

Left: avg instr retired/cycle Left: avg instr retired/cycle

Right: avg L1 DCache misses/cycle Right: avg L1 DCache misses/cycle

(Section 6, p.7)

Experimental Results

► ►

Examining events with high KL Examining events with high KL

distance values: distance values:

 

Left: effect of sampling granularity Left: effect of sampling granularity

 

Right: effect of sampling ratio (granularity fixed @ Right: effect of sampling ratio (granularity fixed @

500,000 cycles) 500,000 cycles)

(Section 6, p.8)

 

Conclusions: for infrequent HW events, higher Conclusions: for infrequent HW events, higher

granularity is better, fixed ratio is granularity is better, fixed ratio is

acceptable acceptable

Experimental Results

► ►

Possible application of SSB in runtime

Possible application of SSB in runtime

optimization

optimization

Can focus on minimizing DCache misses Can focus on minimizing DCache misses

Results show that standard optimizations should Results show that standard optimizations should

also try to reduce data cache misses also try to reduce data cache misses

Online availability of SSB information allows Online availability of SSB information allows

runtime optimizer to monitor an application and runtime optimizer to monitor an application and

apply optimizations in a feedback loop apply optimizations in a feedback loop

Experimental Results

► ►

Runtime overhead of SSB gathering and

Runtime overhead of SSB gathering and

logging:

logging:

Increases linearly with sampling frequency Increases linearly with sampling frequency

2% overhead at 20,000 samples per second is 2% overhead at 20,000 samples per second is

suitable for runtime optimizations suitable for runtime optimizations

(Section 6, p.8)