150 likes | 269 Views
Predicate Execution. 2008/01/10 Presented by Jinho. Performance degradation. 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;. Problem Multiple definition
E N D
Predicate Execution 2008/01/10 Presented by Jinho
Performance degradation 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; • Problem • Multiple definition • Performance degradation due to renaming If-conversion
Phi-Predication for Light-Weight If-Conversion Weihaw Chuang, Brad Calder, Jeanne Ferrante - CGO’03
Instructions Phi-Predication
4 Classes Compiler Transformation
Predicate Predication for Efficient Out-of-order Execution Weihaw Chuang, Brad Calder - ICS’03
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 Main Idea
REN1 • Predicate prediction is completed • REN2 • The predicted predicates and the true predicate values are early-evaluated Predicate Early Evaluation
Flush Predicate Misprediction • Naïve approach • Rename-Replay for Predicate Misprediction • 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 Mispredictions • All instructions are put into the issue queue • Replay selectively Predicate Misprediction Recovery
Flush vs. Rename-replay Pipeline comparison
Examples Selective Replay
Methodology • Trace • David Mosberger’s “utrace.c” • Simulator • Modified SimpleScalar 3.0 to handle IA64 • Benchmarks • Spec2000 Integer and Floating-Point Evaluation
Speedups Comparison
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; Predicate prediction Generally better performance Problem in hard-to-predict branch Phi-prediction mov r1 = 0; mov r5 = 2; cmp.eq p1,p2=r2,r3; phi r4 = (p1)1,r5; Doesn’t need to rename Only for some operations Multiple definition