36
Introduction to Performance Analysis on Intel® Core™ 2 Duo Processors Software and Solutions Group David Levinthal, Sr SW Engineer Nov 30, 2006 Intel, Itanium, Xeon, Core, VTune and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries Copyright Copyright © 2006, Intel Corporation 2006, Intel Corporation

Introduction to Performance Analysis on Intel® Core™ 2 Duo ...assets.devx.com/goparallel/17775.pdf · (MOB) Load Store Addr FP Integer Div/Mul Shift/Rotate SIMD SIMD Integer Arithmetic

  • Upload
    dinhdan

  • View
    221

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Introduction to Performance Analysis on Intel® Core™ 2 Duo ...assets.devx.com/goparallel/17775.pdf · (MOB) Load Store Addr FP Integer Div/Mul Shift/Rotate SIMD SIMD Integer Arithmetic

Introduction to Performance Analysis on Intel® Core™ 2 Duo Processors

Software and Solutions GroupDavid Levinthal, Sr SW Engineer

Nov 30, 2006

Intel, Itanium, Xeon, Core, VTune and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries Copyright Copyright ©© 2006, Intel Corporation2006, Intel Corporation

Page 2: Introduction to Performance Analysis on Intel® Core™ 2 Duo ...assets.devx.com/goparallel/17775.pdf · (MOB) Load Store Addr FP Integer Div/Mul Shift/Rotate SIMD SIMD Integer Arithmetic

2

Agenda

• Tuning Overview

• Processor Overview

• Methodology

Intel, Itanium, Xeon, Core, VTune and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries

Page 3: Introduction to Performance Analysis on Intel® Core™ 2 Duo ...assets.devx.com/goparallel/17775.pdf · (MOB) Load Store Addr FP Integer Div/Mul Shift/Rotate SIMD SIMD Integer Arithmetic

3

Next Generation Micro ArchitectureIntel® Core™2 Duo Processor

FSB

Shared L2 = 4MB

CPU-0Core

CPU-1Core

CPU-0L1D=32KB

CPU-0L1I=32KB

L0/L1 DTLBPMH

CPU-1L1D=32KB

CPU-1L1I=32KB

L0/L1 DTLBPMH

Page 4: Introduction to Performance Analysis on Intel® Core™ 2 Duo ...assets.devx.com/goparallel/17775.pdf · (MOB) Load Store Addr FP Integer Div/Mul Shift/Rotate SIMD SIMD Integer Arithmetic

4

Disclaimer: This block diagram is for example purposes only. Significant hardware blocks have been arranged or omitted for clarity. Some resources (Bus Unit, L2 Cache, etc…) are shared between cores.

Branch Target Buffer

Microcode Sequencer

Register AllocationTable (RAT)

32 KBInstruction Cache

Next IP

InstructionDecode

(4 issue)

Fetch / Decode

Retire

Re-Order Buffer (ROB) – 96 entry

IA Register Set

To L2 Cache

Po

rtP

ort

Po

rtP

ort

Bus Unit

Rese

rvati

on

Sta

tio

ns

(RS

)3

2 e

ntr

y

Sch

ed

ule

r /

Dis

patc

h P

ort

s

32 KBData Cache

Execute

Po

rt

FP Add

SIMDIntegerArithmetic

MemoryOrderBuffer(MOB)

Load

StoreAddr

FP Div/MulInteger

Shift/RotateSIMD

SIMD

IntegerArithmetic

IntegerArithmetic

Po

rt

StoreData

More PortsMore SIMD

Architecture Block Diagram

Page 5: Introduction to Performance Analysis on Intel® Core™ 2 Duo ...assets.devx.com/goparallel/17775.pdf · (MOB) Load Store Addr FP Integer Div/Mul Shift/Rotate SIMD SIMD Integer Arithmetic

5

Four Component HW Prefetcher

• L1 Cache Prefetch (first in Intel® Core™Duo Processor)– DCU or Streaming prefetcher

• DCU = Data Cache Unit

– IP prefetch• Repeated stride load at frequently executed IP

• L2 Prefetch (similar to Pentium® 4 processor)

Page 6: Introduction to Performance Analysis on Intel® Core™ 2 Duo ...assets.devx.com/goparallel/17775.pdf · (MOB) Load Store Addr FP Integer Div/Mul Shift/Rotate SIMD SIMD Integer Arithmetic

6

A Few Basic Events

HW prefetch L2$lines evictedL2_LINES_OUT.SELF.PREFETCH

$lines in for RFO (no HW pref)BUS_TRANS_RFO

demanded L2$Lines evictedL2_LINES_OUT.SELF.DEMAND

writebacks (no NT writes)BUS_TRANS_WB

L2$lines in for hw prefetchL2_LINES_IN.SELF.PREFETCH

whole line reads from memBUS_TRANS_BRD

L2$lines in for rfo, load, sw prefetchL2_LINES_IN.SELF.DEMANDwhole $lines to memBUS_TRANS_BURST

Non Temporal Stores executedMMX2_PRE_MISS.STORESbus trans to memoryBUS_TRANS_MEM

SW prefetch to L2 instMMX2_PRE_MISS.T2all bus transactionsBUS_TRANS_ANY

SW prefetch to L1 instMMX2_PRE_MISS.T1INST_RETIRED.STORES

L2 demand missesPMEM_LOAD_RETIRED.L2_LINE_MISSINST_RETIRED.LOADS

all busy bus cycles due to writesBUS_DRDY_CLOCKS.THIS_AGENTPINST_RETIRED.ANY_P

all busy bus cyclesBUS_DRDY_CLOCKS.ALL_AGENTSCPU_CLK_UNHALTED

DescriptionPEVENTDescriptionPEVENT

Memory BW = 64*Bus_Trans_Mem*freq/Cpu_Clk_Unhalted

Page 7: Introduction to Performance Analysis on Intel® Core™ 2 Duo ...assets.devx.com/goparallel/17775.pdf · (MOB) Load Store Addr FP Integer Div/Mul Shift/Rotate SIMD SIMD Integer Arithmetic

7

Methodology Overview

•The traditional view of performance tuning on X86 processors has focused on instruction retirement

•The OOO engine has always been viewed as an impenetrable and incomprehensible beast

•This is perhaps not the best perspective

Page 8: Introduction to Performance Analysis on Intel® Core™ 2 Duo ...assets.devx.com/goparallel/17775.pdf · (MOB) Load Store Addr FP Integer Div/Mul Shift/Rotate SIMD SIMD Integer Arithmetic

8

Methodology Overview

• Methodology developed by studying FP loop dominated apps– Anything that is applicable beyond this limited range is an unintended

benefit– But if you can’t do these…you’re toast

• This style of optimization has 2 components– Minimizing instruction count

• A sort of “tree height” minimization

– Minimizing deviations from ideal execution• Generically thought of as “stall cycles”

– Treating both equally is critical

Page 9: Introduction to Performance Analysis on Intel® Core™ 2 Duo ...assets.devx.com/goparallel/17775.pdf · (MOB) Load Store Addr FP Integer Div/Mul Shift/Rotate SIMD SIMD Integer Arithmetic

9

Stalls, Execution Imperfection and Performance Analysis

• Stall cycles are used to indicate less than perfect execution– An architectural decomposition of “stalls” can be used to guide

the selection of architectural events– The IP correlation of “stalls” and arch events then guides the

optimization effort

• Stalls have 4 basic components in an OOO Engine– Execution stalls

• (Waiting on input/Scoreboard, L2 miss, BW, DTLB, etc)– Mispredicted branch pipeline flushing– FE stalls

• Execution stage instruction starvation (Front End)– Cycles wasted executing instructions that are not retired

Page 10: Introduction to Performance Analysis on Intel® Core™ 2 Duo ...assets.devx.com/goparallel/17775.pdf · (MOB) Load Store Addr FP Integer Div/Mul Shift/Rotate SIMD SIMD Integer Arithmetic

10

X86 Cycle Accounting and SW Optimization

• Cpu_clk_unhalted = “stalls” + non_ret_dispatch + ret_dispatch

Traditional Stall Removal

Reduce Branch MispredictionsPGO

Improve Optimization to Reduce Instruction Count,Split Loops to Increase ILP

Resource_stalls.br_miss_clearwill estimate stalls due to Pipeline Flush

Page 11: Introduction to Performance Analysis on Intel® Core™ 2 Duo ...assets.devx.com/goparallel/17775.pdf · (MOB) Load Store Addr FP Integer Div/Mul Shift/Rotate SIMD SIMD Integer Arithmetic

11

Branch Target Buffer

Microcode Sequencer

Register AllocationTable (RAT)

32 KBInstruction Cache

Next IP

InstructionDecode

(4 issue)

Fetch / Decode

Uop Flow

Retire

Re-Order Buffer (ROB) – 96 entry

IA Register Set

To L2 Cache

Po

rtP

ort

Po

rtP

ort

Bus Unit

Rese

rvati

on

Sta

tio

ns

(RS

)3

2 e

ntr

y

Sch

ed

ule

r /

Dis

patc

h P

ort

s

32 KBData Cache

Execute

Po

rt

FP Add

SIMDIntegerArithmetic

MemoryOrderBuffer(MOB)

Load

StoreAddr

FP Div/MulInteger

Shift/RotateSIMD

SIMD

IntegerArithmetic

IntegerArithmetic

Po

rt

StoreData

Resource_Stallsmeasures here

transfer from Decode “issue”

Page 12: Introduction to Performance Analysis on Intel® Core™ 2 Duo ...assets.devx.com/goparallel/17775.pdf · (MOB) Load Store Addr FP Integer Div/Mul Shift/Rotate SIMD SIMD Integer Arithmetic

12

Branch Target Buffer

Microcode Sequencer

Register AllocationTable (RAT)

32 KBInstruction Cache

Next IP

InstructionDecode

(4 issue)

Fetch / Decode

Uop Flow

Retire

Re-Order Buffer (ROB) – 96 entry

IA Register Set

To L2 Cache

Po

rtP

ort

Po

rtP

ort

Bus Unit

Rese

rvati

on

Sta

tio

ns

(RS

)3

2 e

ntr

y

Sch

ed

ule

r /

Dis

patc

h P

ort

s

32 KBData Cache

Execute

Po

rt

FP Add

SIMDIntegerArithmetic

MemoryOrderBuffer(MOB)

Load

StoreAddr

FP Div/MulInteger

Shift/RotateSIMD

SIMD

IntegerArithmetic

IntegerArithmetic

Po

rt

StoreData

Rs_uops_dispatchedmeasures at Execution “dispatch”

Page 13: Introduction to Performance Analysis on Intel® Core™ 2 Duo ...assets.devx.com/goparallel/17775.pdf · (MOB) Load Store Addr FP Integer Div/Mul Shift/Rotate SIMD SIMD Integer Arithmetic

13

Branch Target Buffer

Microcode Sequencer

Register AllocationTable (RAT)

32 KBInstruction Cache

Next IP

InstructionDecode

(4 issue)

Fetch / Decode

Uop Flow

Retire

Re-Order Buffer (ROB) – 96 entry

IA Register Set

To L2 Cache

Po

rtP

ort

Po

rtP

ort

Bus Unit

Rese

rvati

on

Sta

tio

ns

(RS

)3

2 e

ntr

y

Sch

ed

ule

r /

Dis

patc

h P

ort

s

32 KBData Cache

Execute

Po

rt

FP Add

SIMDIntegerArithmetic

MemoryOrderBuffer(MOB)

Load

StoreAddr

FP Div/MulInteger

Shift/RotateSIMD

SIMD

IntegerArithmetic

IntegerArithmetic

Po

rt

StoreData

Uops_retiredmeasures at Retirement

Page 14: Introduction to Performance Analysis on Intel® Core™ 2 Duo ...assets.devx.com/goparallel/17775.pdf · (MOB) Load Store Addr FP Integer Div/Mul Shift/Rotate SIMD SIMD Integer Arithmetic

14

Measuring Efficiency in the Execution Stage

•OOO engine optimizes instruction dispatch to execution units from Reservation Station

– They wait there until their inputs are available

• RS_UOPS_DISPATCHED measures number of uops dispatched from RS on each cycle

The Single Most Important PMU Event!

Page 15: Introduction to Performance Analysis on Intel® Core™ 2 Duo ...assets.devx.com/goparallel/17775.pdf · (MOB) Load Store Addr FP Integer Div/Mul Shift/Rotate SIMD SIMD Integer Arithmetic

15

Branch Target Buffer

Microcode Sequencer

Register AllocationTable (RAT)

32 KBInstruction Cache

Next IP

InstructionDecode

(4 issue)

Fetch / Decode

Execution is What Matters

Retire

Re-Order Buffer (ROB) – 96 entry

IA Register Set

To L2 Cache

Po

rtP

ort

Po

rtP

ort

Bus Unit

Rese

rvati

on

Sta

tio

ns

(RS

)3

2 e

ntr

y

Sch

ed

ule

r /

Dis

patc

h P

ort

s

32 KBData Cache

Execute

Po

rt

FP Add

SIMDIntegerArithmetic

MemoryOrderBuffer(MOB)

Load

StoreAddr

FP Div/MulInteger

Shift/RotateSIMD

SIMD

IntegerArithmetic

IntegerArithmetic

Po

rt

StoreData

Rs_uops_dispatchedcan measure stalls

here

Page 16: Introduction to Performance Analysis on Intel® Core™ 2 Duo ...assets.devx.com/goparallel/17775.pdf · (MOB) Load Store Addr FP Integer Div/Mul Shift/Rotate SIMD SIMD Integer Arithmetic

16

VTune™ Analyzer Edit Event

Page 17: Introduction to Performance Analysis on Intel® Core™ 2 Duo ...assets.devx.com/goparallel/17775.pdf · (MOB) Load Store Addr FP Integer Div/Mul Shift/Rotate SIMD SIMD Integer Arithmetic

17

Some Features of the PMU

Event #umaskUSR

OSE

PC

INT

EN

INVCMASK

Value to be compared against Invert from GE to LT

Enable Counters

APIC InteruptEnable

Pin Control

Count on changing edge

Count Ring 3 execution

Count Ring 0 execution

Setting CMASK = 1 and INV = 1 for RS_uops_dispatchedCounts Cycles Where

NO UOPS WERE DISPATCHED == StallsRS_UOPS_DISPATCHED.CYCLES_NONE

Page 18: Introduction to Performance Analysis on Intel® Core™ 2 Duo ...assets.devx.com/goparallel/17775.pdf · (MOB) Load Store Addr FP Integer Div/Mul Shift/Rotate SIMD SIMD Integer Arithmetic

18

A Methodology?

Total Cycles ~ CPU_CLK_UNHALTED

RS_UOPS_DISPATCH:cmask=1

RS_UOPS_DISPATCH:cmask=1:inv=1

CPU_CLK_UNHALTED can be decomposed into execution and stall cycles in the OOO engine

Requires >99% CPU Utilization

OR User PL only/sampling

EVENTS COUNT EVEN DURING HALTED CYCLES

Page 19: Introduction to Performance Analysis on Intel® Core™ 2 Duo ...assets.devx.com/goparallel/17775.pdf · (MOB) Load Store Addr FP Integer Div/Mul Shift/Rotate SIMD SIMD Integer Arithmetic

19

The Distribution of uops/cycleRS_UOPS_DISPATCHED:cmask=1:inv=1

RS_UOPS_DISPATCHED:cmask=2:inv=1

RS_UOPS_DISPATCHED:cmask=3:inv=1

RS_UOPS_DISPATCHED:cmask=4:inv=1

RS_UOPS_DISPATCHED:cmask=5:inv=1

RS_UOPS_DISPATCHED:cmask=6:inv=1

RS_UOPS_DISPATCHED:cmask=7:inv=1

Subtract the N-1 value

uops dispatched per cycle

02000000000400000000060000000008000000000

1000000000012000000000140000000001600000000018000000000

0 2 4 6 8

Series1

Stall Cycles

Distributionof theInstructionLevelParallelism (example:a[i] = exp(x[i]); in a simple loop)

Page 20: Introduction to Performance Analysis on Intel® Core™ 2 Duo ...assets.devx.com/goparallel/17775.pdf · (MOB) Load Store Addr FP Integer Div/Mul Shift/Rotate SIMD SIMD Integer Arithmetic

20

Branch Target Buffer

Microcode Sequencer

Register AllocationTable (RAT)

32 KBInstruction Cache

Next IP

InstructionDecode

(4 issue)

Fetch / Decode

Architecture Block Diagram

Retire

Re-Order Buffer (ROB) – 96 entry

IA Register Set

To L2 Cache

Po

rtP

ort

Po

rtP

ort

Bus Unit

Rese

rvati

on

Sta

tio

ns

(RS

)3

2 e

ntr

y

Sch

ed

ule

r /

Dis

patc

h P

ort

s

32 KBData Cache

Execute

Po

rt

FP Add

SIMDIntegerArithmetic

MemoryOrderBuffer(MOB)

Load

StoreAddr

FP Div/MulInteger

Shift/RotateSIMD

SIMD

IntegerArithmetic

IntegerArithmetic

Po

rt

StoreData

Resource_Stallsmeasures here

Page 21: Introduction to Performance Analysis on Intel® Core™ 2 Duo ...assets.devx.com/goparallel/17775.pdf · (MOB) Load Store Addr FP Integer Div/Mul Shift/Rotate SIMD SIMD Integer Arithmetic

21

Components of Resource _Stalls• Uop flow to OOO engine blocked by downstream

cause• Resource_Stalls.BR_MISS_CLEAR

– pipeline stalls due to flushing mispredicted branchesCombine in Resource_stalls.CLEAR

mispredicted branch followed by fp inst

• Resource_Stalls.ROB_FULL96 instructions in ROB

• Resource_Stalls.LD_STAll Store or Load buffers in use

• Resource_Stalls.RS_FULL32 instructions waiting for inputs

in Reservation Station

Page 22: Introduction to Performance Analysis on Intel® Core™ 2 Duo ...assets.devx.com/goparallel/17775.pdf · (MOB) Load Store Addr FP Integer Div/Mul Shift/Rotate SIMD SIMD Integer Arithmetic

22

Branch Target Buffer

Microcode Sequencer

Register AllocationTable (RAT)

32 KBInstruction Cache

Next IP

InstructionDecode

(4 issue)

Fetch / Decode

Architecture Block Diagram

Retire

Re-Order Buffer (ROB) – 96 entry

IA Register Set

To L2 Cache

Po

rtP

ort

Po

rtP

ort

Bus Unit

Rese

rvati

on

Sta

tio

ns

(RS

)3

2 e

ntr

y

Sch

ed

ule

r /

Dis

patc

h P

ort

s

32 KBData Cache

Execute

Po

rt

FP Add

SIMDIntegerArithmetic

MemoryOrderBuffer(MOB)

Load

StoreAddr

FP Div/MulInteger

Shift/RotateSIMD

SIMD

IntegerArithmetic

IntegerArithmetic

Po

rt

StoreData

Uops_retired measures flow at retirement

Page 23: Introduction to Performance Analysis on Intel® Core™ 2 Duo ...assets.devx.com/goparallel/17775.pdf · (MOB) Load Store Addr FP Integer Div/Mul Shift/Rotate SIMD SIMD Integer Arithmetic

23

Retirement or Dispatch? Which Function to work on first?

"Stalls" at Retirement vs Dispatch

0

0.2

0.4

0.6

0.8

1

0 0.2 0.4 0.6 0.8 1

Cycles(Disp_uops=0)

Cyc

les(

Ret

_uops=

0)

For loops, difference is due to OOO executionFewer False Positives When “Stalls” Are

Measured at Dispatch

Page 24: Introduction to Performance Analysis on Intel® Core™ 2 Duo ...assets.devx.com/goparallel/17775.pdf · (MOB) Load Store Addr FP Integer Div/Mul Shift/Rotate SIMD SIMD Integer Arithmetic

24

Cycle Accounting on X86

•Cycles = rs_uops_dispatched.cycles_none + rs_uops_dispatched:cmask=1

“stalls” + dispatch– An equality by definition

• Cycles ~ CPU_CLK_UNHALTED.CORE– For cpu intensive applications/sampling

Page 25: Introduction to Performance Analysis on Intel® Core™ 2 Duo ...assets.devx.com/goparallel/17775.pdf · (MOB) Load Store Addr FP Integer Div/Mul Shift/Rotate SIMD SIMD Integer Arithmetic

25

Cycle Accounting on X86• Dispatch ~ cycles_dispatch_retiring_uops +

cycles_dispatch_non_retiring_uops– Assumes no overlap of retired/non retired uops

• Worst Case Senario

• Non retired uops = rs_uops_dispatched –(uops_retired.any + Uops_retired.fused)

– Non retired uop cycles ~ non retired uops/avg_uops_per_cycle

• Fractional Wasted Work =rs_uops_dispatched /(uops_retired.any + uops_retired.fused) - 1

Page 26: Introduction to Performance Analysis on Intel® Core™ 2 Duo ...assets.devx.com/goparallel/17775.pdf · (MOB) Load Store Addr FP Integer Div/Mul Shift/Rotate SIMD SIMD Integer Arithmetic

26

Pulling Cycle Accounting Together

Cycle Accounting

0

0.2

0.4

0.6

0.8

1

1.2

Executing

Stalls

Stall Cycles = Cycles with NO uops Dispatched= RS_UOPS_DISPATCH.CYCLES_NONE

Illustrative Example Only, Not Real Data

Page 27: Introduction to Performance Analysis on Intel® Core™ 2 Duo ...assets.devx.com/goparallel/17775.pdf · (MOB) Load Store Addr FP Integer Div/Mul Shift/Rotate SIMD SIMD Integer Arithmetic

27

Decomposing Stalls: Elephants First

Pipeline Flush = Resource_Stalls.Br_Miss_Clear/cyclesL2 Hits = ( MEM_LOAD_RETIRED.L1D_LINE_MISS -

MEM_LOAD_RETIRED.L2_LINE_MISS )* 10/cyclesDTLB/L2 Miss = event count* penalty/cyclesFE + Scoreboard = Stalls – all of the above

Stall Decomposition

0

0.2

0.4

0.6

0.8

1

1.2

1 2

Executing

FE + Scoreboard

Pipeline FlushDTLB

L2 Hits

L2 MissesStall Total

Illustrative Example Only, Not Real Data

Page 28: Introduction to Performance Analysis on Intel® Core™ 2 Duo ...assets.devx.com/goparallel/17775.pdf · (MOB) Load Store Addr FP Integer Div/Mul Shift/Rotate SIMD SIMD Integer Arithmetic

28

Decomposing Unstalled CyclesDecomposing Unstalled Cycles

0.75

0.8

0.85

0.9

0.95

1

1.05

1

Uops Retiring

OOO Bursts

Non_retired

Stalls

Non_Retired = (( 1 – (Uops_retired.any+Uops_retired.fused)/RS_Uops_Dispatched) *

RS_Uops_Dispatched:cmask=1 / CPU_CLK_UNHALTED.CORE

OOO Bursts = Uops_Retired.Any.cycles_none- Stalls – Non_Retired

Illustrative Example Only, Not Real Data

Page 29: Introduction to Performance Analysis on Intel® Core™ 2 Duo ...assets.devx.com/goparallel/17775.pdf · (MOB) Load Store Addr FP Integer Div/Mul Shift/Rotate SIMD SIMD Integer Arithmetic

29

Pulling it All Together

Risks Over-counting / Minimizing FE + Scoreboard

But Offers a Guide to Execution Inefficiencies

Cycle Decomposition

0

0.2

0.4

0.6

0.8

1

1.2

1

Uops Retiring

OOO Bursts

Non_retired

FE +ScoreboardPipeline Flush

DTLB

L2 Hits

L2 Misses

Illustrative Example Only, Not Real Data

Page 30: Introduction to Performance Analysis on Intel® Core™ 2 Duo ...assets.devx.com/goparallel/17775.pdf · (MOB) Load Store Addr FP Integer Div/Mul Shift/Rotate SIMD SIMD Integer Arithmetic

30

Architectural Pitfalls: The Ants

~6ILD_STALLSLength Changing Prefix (16 bit imm)

~20Load_Blocks.UNTIL_RETIREload from 2 cachelines with preceding store(not in L1D

~22Load_Blocks.UNTIL_RETIREload from 2 cachelines (not in L1D)

~6Load_Blocks. Overlap_Storestore to known address precedes load offset by N*4096

~6Load_Blocks.Overlap_Storestore forwarding 4 bytes from middle of 8

~5Load_Blocks.ADRstore to unknown addr preceeds load

Approx. PenaltyPerformance CounterIssue

Contribute to “FE + Scoreboard”

Page 31: Introduction to Performance Analysis on Intel® Core™ 2 Duo ...assets.devx.com/goparallel/17775.pdf · (MOB) Load Store Addr FP Integer Div/Mul Shift/Rotate SIMD SIMD Integer Arithmetic

31

The Big 4 Revisited

•CPU_CYCLES -> CPU_CLK_UNHALTED.CORE

•BACK_END_BUBBLE.ALL ->RS_UOPS_DISPATCHED.CYCLES_NONE

•BUS_MEMORY.ALL.SELF ->BUS_TRANS_ANY.SELF

•DEAR_LATENCY_GT_64 ->MEM_LOAD_RETIRED.L2_LINE_MISS

CYCLES, STALLS, UNPREFETCHED LOADS and BANDWIDTH

Page 32: Introduction to Performance Analysis on Intel® Core™ 2 Duo ...assets.devx.com/goparallel/17775.pdf · (MOB) Load Store Addr FP Integer Div/Mul Shift/Rotate SIMD SIMD Integer Arithmetic

32

More Detailed Event Selection Hierarchy

2,000,000RESOURCE_STALLS.BR_MISS_CLEAR

Branch Dominated

100,000BUS_TRANS_ANY.ALL_AGENTS

100,000BUS_TRANS_ANY.SELF

Loops

2,000,000INST_RETIRED.ANY_P

10,000MEM_LOAD_RETIRED.L2_LINE_MISS

2,000,000RS_UOPS_DISPATCHED

2,000,000UOPS_RETIRED.ANY + UOPS_RETIRED.FUSED

2,000,000RS_UOPS_DISPATCHED.CYCLES_NONE

2,000,000CPU_CLK_UNHALTED.CORE

Sample After ValueFIRST PASS EVENTS

SAV values selected so ratio of samples ~ absorbs penalty

Page 33: Introduction to Performance Analysis on Intel® Core™ 2 Duo ...assets.devx.com/goparallel/17775.pdf · (MOB) Load Store Addr FP Integer Div/Mul Shift/Rotate SIMD SIMD Integer Arithmetic

33

Event Hierarchy

SAV values selected so ratio of samples ~ absorbs penalty

EX: L1 miss/L2_hit penalty is 10 cycles

200,000LOAD_BLOCK.STORE_OVERLAP

200,000ILD_STALLS

200,000BR_CALL_MISSP_EXEC

200,000BR_CALL_EXEC

2,000,000BR_CND_EXEC

2,000,000BR_CND_MISSP_EXEC

200,000MEM_LOAD_RETIRED.L1_LINE_MISS

10,000MEM_LOAD_RETIRED.L2_MISS

20,000MEM_LOAD_RETIRED.DTLB_MISS

Sample After ValueSECOND LEVEL EVENTS

Page 34: Introduction to Performance Analysis on Intel® Core™ 2 Duo ...assets.devx.com/goparallel/17775.pdf · (MOB) Load Store Addr FP Integer Div/Mul Shift/Rotate SIMD SIMD Integer Arithmetic

34

A loop Methodology?

• Identify hot functions and raise optimization– Fix alignments, split loops to enhance vectorization

• Identify BW limited functions– Merge BW loops with FP limited loops

• Identify L2 misses and add sw prefetch

• Optimize flow through OOO Engine– Use loop splitting to assist here

Page 35: Introduction to Performance Analysis on Intel® Core™ 2 Duo ...assets.devx.com/goparallel/17775.pdf · (MOB) Load Store Addr FP Integer Div/Mul Shift/Rotate SIMD SIMD Integer Arithmetic

35

Summary

•Intel® Core™2 processor is very good for loops– 2 simd instr/cycle– Short pipeline

•Intel® Core™2 processor PMU is very good– Bandwidth is simple and clear

• Though address bus utilization is perhaps not

– More Precise Events• Instr_retired and its components• LLC miss

– Execution Inefficiency for loops can be estimated

Page 36: Introduction to Performance Analysis on Intel® Core™ 2 Duo ...assets.devx.com/goparallel/17775.pdf · (MOB) Load Store Addr FP Integer Div/Mul Shift/Rotate SIMD SIMD Integer Arithmetic