predicate execution 2008/01/10 presented by jinho
TRANSCRIPT
Predicate Execution2008/01/10
Presented by Jinho
If-conversion
Performance degradationmov r1 = 0;if( r2 == r3 ) mov r1 = 1;else mov r1 = 2;mov r4 = r1;
mov r1 = 0;cmp.eq p1,p2=r2,r3;(p1) mov r1 = 1;(p2) mov r1 = 2;mov r4 = r1;
ProblemMultiple definition
Performance degradation due to re-naming
Phi-Predication for Light-Weight If-ConversionWeihaw Chuang, Brad Calder, Jeanne Ferrante - CGO’03
Phi-Predication
Instructions
Compiler Transformation
4 Classes
Predicate Predication for Efficient Out-of-order ExecutionWeihaw Chuang, Brad Calder - ICS’03
Main Idea
Predicate Predictor◦Predicates were branches before if-conversion◦Value prediction instead of branch prediction
Implementation◦Separate from branch predictor
Only for branch history table No needs for the return-address stack or the
branch target buffer
Predicate Early Evaluation
REN1◦Predicate prediction is completed
REN2◦The predicted predicates and the true predicate
values are early-evaluated
Predicate Misprediction Recovery
Flush Predicate Misprediction◦Naïve approach
Rename-Replay for Predicate Mispredic-tion◦Instructions on false predicates are not put into
the issue queue◦Replay from predicate early evaluation◦Instructions are stored in recovery queue(RecQ)
Selective-Replay for Predicate Mispredic-tions◦All instructions are put into the issue queue◦Replay selectively
Pipeline comparison
Flush vs. Rename-replay
Selective Replay
Examples
Evaluation
Methodology◦Trace
David Mosberger’s “utrace.c”◦Simulator
Modified SimpleScalar 3.0 to handle IA64◦Benchmarks
Spec2000 Integer and Floating-Point
Comparison
Speedups
Wrap-up
Multiple definition
Solution?
mov r1 = 0;if( r2 == r3 ) mov r1 = 1;else mov r1 = 2;mov r4 = r1;
mov r1 = 0;cmp.eq p1,p2=r2,r3;(p1) mov r1 = 1;(p2) mov r1 = 2;mov r4 = r1;
mov r1 = 0;mov r5 = 2;cmp.eq p1,p2=r2,r3;phi r4 = (p1)1,r5;
Phi-prediction
Doesn’t need to renameOnly for some operations
Predicate predictionGenerally better performanceProblem in hard-to-predict branch