Title: Correct Alignment of a RAS after Call and Return Mispredictions
1Correct Alignment of a RAS after Call and Return
Mispredictions
Veerle Desmet Yiannakis Sazeides Constantinos
Kourouyiannis Koen De Bosschere
University of Cyprus
2Motivation
- Return-Address-Stack (RAS)
- Correct alignment
- Effect deeper pipelines
by Veerle Desmet Ghent University
3Return-Address-Stack (RAS)
main() my_printf() my_function()
my_printf() return
main my_printf() my_function()
my_printf() return
my_printf()
my_function()
my_printf for(condition) printf() return
my_function / fun / return
printf()
RAS
printf / print / return
return from printf
return from printf
function calls push return address on RAS
1
return from my_printf
return from my_printf
return from my_function
returns predicted by popping from RAS
2
return from main
4Mispredictions
recovery
?
checkpoint
fetch
wrong path
Speculative RAS updates due to wrong path calls
5Bottlenecks for RAS performance
Overflow call depth exceeds stack size
RAS
Corruption RAS content overwritten by wrong
path calls
De-alignment unbalanced of call/return
return from printf
return from my_printf
TOS
TOS
return from my_printf
return from main
6Correct Alignment
Checkpoint TOS
1
Wrong path
3
RAS
e.g. 1 misspeculated call
?
return from printf
return from wrong path
return from wrong path
return from my_function
Recovery to checkpointed TOS
4
return from main
7 after Call Mispredictions
Checkpoint TOS
1
RAS
Wrong path
3
return from wrong path
return from wrong path
e.g. 1 misspeculated call
return from printf
return from mispr. call
?
return from my_function
Recovery to checkpointed TOS
4
return from main
8 after Return Mispredictions
Checkpoint TOS
1
RAS
Wrong path
3
e.g. no misspeculated calls or returns
return from printf
?
return from mispr return
return from mispr return
Recovery to checkpointed TOS
4
return from main
9Correct Alignment
Incorrect Alignment
Correct Alignment
Conditional branch misprediction
Return misprediction
Call misprediction
RAS
RAS
RAS
return from printf
return from mispred call
mispred. return addr
10Correct Alignment
Incorrect Alignment
Speedup can be affected by up to 10
Correct Alignment
11A lot of published work
SimpleScalar
SimWattch
HydraScalar
Simca
INCORRECT LOWER PERFORMING
CORRECT
UNCLEAR
Jourdan
Eickemeyer, Hoyt, Hummel, McDonald, McMahan Steely
Yeh, Intel patent
12Bottlenecks for RAS performance
Overflow call depth exceeds stack size
RAS
Corruption RAS content overwritten by wrong
path calls
De-alignment unbalanced of call/return
return from printf
return from my_printf
TOS
TOS
return from my_printf
return from main
13RAS content recovery
Skadron et al. _at_ MICRO 1998
top of stack data
Also checkpoints/recovers top of stack data 2
speedup on average
Incorrect Alignment
Correct Alignment
14Motivation
- Return-Address-Stack (RAS)
- Correct alignment
- Effect deeper pipelines
by Veerle Desmet Ghent University
15Deeper Pipelines
8-entry RAS
16-entry RAS
32-entry RAS
64-entry RAS
Independence on RAS size
On average, reasonable scaling
16But... per benchmark
5 stages
10 stages
32-entry RAS
15 stages
-5
-7
20 stages
25 stages
30 stages
17Corruptions per kilo instructions
32-entry RAS
Backward (tos,1,) more destructive than
forward corruption (31,30,)
RAS
3
4
30
31
tos
1
1
2
corruption distance
18Individual benchmarks
20 stage pipeline
32-entry RAS
19TOS behavior
20 stage pipeline
32-entry RAS
More backward corruption
Mainly forward corruption
time
time
li95
gcc95
20Bottlenecks for RAS performance
Overflow call depth exceeds stack size
RAS
Corruption RAS content overwritten by wrong
path calls
De-alignment unbalanced of call/return
return from printf
return from my_printf
TOS
TOS
return from my_printf
return from main
21TOS Behavior
20 stage pipeline
32-entry RAS
no overflow
overflow
time
time
li95
gcc95
22Summary
- Correct Aligned RAS
- Return misprediction decrease with 40
- Speedup of up to 10
- Deeper Pipelines
- One of the best performing RAS recovery
techniques - Satisfactory on average
- Performance decrease up to 7 for some programs
- May need to checkpoint more content
- Paper
- Possible implementations
- Call uncorruption optimization for free
- How to fix correct alignment in SimpleScalar
23Correct Alignment of a RAS after Call and Return
Mispredictions
Veerle Desmet Yiannakis Sazeides Constantinos
Kourouyiannis Koen De Bosschere
University of Cyprus