on the complexity of register coalescing
play

On the Complexity of Register Coalescing F . Bouchez, A. Darte, and - PowerPoint PPT Presentation

Coalescing On the Complexity of Register Coalescing F . Bouchez, A. Darte, and F . Rastello LIP UMR CNRS Inria ENS Lyon UCBL France CGO07, San Jose Coalescing Outline What, Why, and How to Coalesce 1 Basic Formulation The


  1. Coalescing On the Complexity of Register Coalescing F . Bouchez, A. Darte, and F . Rastello LIP UMR CNRS — Inria — ENS Lyon — UCBL France CGO’07, San Jose

  2. Coalescing Outline What, Why, and How to Coalesce 1 Basic Formulation The Different Approaches 2 A Hard Optimization Problem Conclusion: What should we Implement Now? 3

  3. Coalescing What, Why, and How to Coalesce Outline What, Why, and How to Coalesce 1 Basic Formulation The Different Approaches 2 A Hard Optimization Problem Conclusion: What should we Implement Now? 3

  4. Coalescing What, Why, and How to Coalesce Basic Formulation Coalescing: Coloring the Interference/Affinity Graph Coalescing is rename 2 variables into a unique representant MOVE A , B : an affinity between A and B A and B cannot share the same ressource: an interference between A and B a = . . . b = . . . · · · = a d = a c = . . . d = b · · · = c · · · = d

  5. Coalescing What, Why, and How to Coalesce Basic Formulation Coalescing: Coloring the Interference/Affinity Graph Coalescing is rename 2 variables into a unique representant MOVE A , B : an affinity between A and B A and B cannot share the same ressource: an interference between A and B a d = . . . b = . . . · · · = a d a d = a d c = . . . a d = b · · · = c · · · = a d

  6. Coalescing What, Why, and How to Coalesce Basic Formulation Coalescing: Coloring the Interference/Affinity Graph Coalescing is rename 2 variables into a unique representant MOVE A , B : an affinity between A and B A and B cannot share the same ressource: an interference between A and B a d = . . . Coalesce b = . . . · · · = a d a b b a d = a d c = . . . a d = b ad · · · = c c c d · · · = a d

  7. Coalescing What, Why, and How to Coalesce Basic Formulation Many MOVE ... Many MOVE instructions due to register constraints (function call, 2 address instructions, etc.) SSA construction followed by basic SSA destruction C 1 = . . . A = . . . C 2 = . . . B = . . . MOVE R 0, A MOVE R 1, B MOVE C , C 1 MOVE C , C 2 D = f ( A , B ) MOVE D , R 0 C = φ ( C 1 , C 2 ) use C

  8. Coalescing What, Why, and How to Coalesce Basic Formulation Many MOVE ... Many MOVE instructions due to register constraints (function call, 2 address instructions, etc.) SSA construction followed by basic SSA destruction C 1 = . . . A = . . . C 2 = . . . B = . . . MOVE R 0, A MOVE R 1, B MOVE C , C 1 MOVE C , C 2 call f MOVE D , R 0 C = φ ( C 1 , C 2 ) use C

  9. Coalescing What, Why, and How to Coalesce Basic Formulation Many MOVE ... Many MOVE instructions due to register constraints (function call, 2 address instructions, etc.) SSA construction followed by basic SSA destruction C 1 = . . . A = . . . C 2 = . . . B = . . . MOVE R 0, A MOVE R 1, B MOVE C , C 1 MOVE C , C 2 call f MOVE D , R 0 C = φ ( C 1 , C 2 ) use C

  10. Coalescing What, Why, and How to Coalesce Basic Formulation Many MOVE ... to remove Many MOVE instructions due to register constraints (function call, 2 address instructions, etc.) SSA construction followed by basic SSA destruction Our past experience (aggressive) coalescing reg. alloc. pre-sched. sched. during SSA destruction (Iterared) on most benchmarks, a good speedup on some of them, slow down!

  11. Coalescing What, Why, and How to Coalesce The Different Approaches Analysing the slow down... Aggressive coalescing may lead to spilling. Coalescing aware of colorability is conservative . Aggressively coalesce a b c d

  12. Coalescing What, Why, and How to Coalesce The Different Approaches Analysing the slow down... Aggressive coalescing may lead to spilling. Coalescing aware of colorability is conservative . Aggressively coalesce a b b ad c c d

  13. Coalescing What, Why, and How to Coalesce The Different Approaches Analysing the slow down... Aggressive coalescing may lead to spilling. Coalescing aware of colorability is conservative . Aggressively coalesce a b b ad c c d 2-colorable Not 2-colorable

  14. Coalescing What, Why, and How to Coalesce The Different Approaches Analysing the slow down... Aggressive coalescing may lead to spilling. Coalescing aware of colorability is conservative . Conservatively coalesce a a b bd b c c d 2-colorable 2-colorable

  15. Coalescing What, Why, and How to Coalesce The Different Approaches ...and the speedup k -colorability check is hard, but checking the Greedy-k-colorablility is easy. Still, finding the optimal subset of affinities is hard. We do Incremental coalescing... Incremental is not optimal. Decoalescing is better. j b e g a d f i k c m h l

  16. Coalescing What, Why, and How to Coalesce The Different Approaches ...and the speedup k -colorability check is hard, but checking the Greedy-k-colorablility is easy. Still, finding the optimal subset of affinities is hard. We do Incremental coalescing... Incremental is not optimal. Decoalescing is better. j b 1 e g a d f i k c m h l

  17. Coalescing What, Why, and How to Coalesce The Different Approaches ...and the speedup k -colorability check is hard, but checking the Greedy-k-colorablility is easy. Still, finding the optimal subset of affinities is hard. We do Incremental coalescing... Incremental is not optimal. Decoalescing is better. j j b e g a d f i k 1 c m h l

  18. Coalescing What, Why, and How to Coalesce The Different Approaches ...and the speedup k -colorability check is hard, but checking the Greedy-k-colorablility is easy. Still, finding the optimal subset of affinities is hard. We do Incremental coalescing... Incremental is not optimal. Decoalescing is better. j j b e g a d f i k k c m h l 1

  19. Coalescing What, Why, and How to Coalesce The Different Approaches ...and the speedup k -colorability check is hard, but checking the Greedy-k-colorablility is easy. Still, finding the optimal subset of affinities is hard. We do Incremental coalescing... Incremental is not optimal. Decoalescing is better. j j b e g a d f 2 i k k c m h l l

  20. Coalescing What, Why, and How to Coalesce The Different Approaches ...and the speedup k -colorability check is hard, but checking the Greedy-k-colorablility is easy. Still, finding the optimal subset of affinities is hard. We do Incremental coalescing... Incremental is not optimal. Decoalescing is better. j j b e g a d f f i k k c m 2 h l l

  21. Coalescing What, Why, and How to Coalesce The Different Approaches ...and the speedup k -colorability check is hard, but checking the Greedy-k-colorablility is easy. Still, finding the optimal subset of affinities is hard. We do Incremental coalescing... Incremental is not optimal. Decoalescing is better. j j b e g a d f f i k k c m m 2 h l l

  22. Coalescing What, Why, and How to Coalesce The Different Approaches ...and the speedup k -colorability check is hard, but checking the Greedy-k-colorablility is easy. Still, finding the optimal subset of affinities is hard. We do Incremental coalescing... Incremental is not optimal. Decoalescing is better. j j b e g a d 2 f f i k k c c m m h l l

  23. Coalescing What, Why, and How to Coalesce The Different Approaches ...and the speedup k -colorability check is hard, but checking the Greedy-k-colorablility is easy. Still, finding the optimal subset of affinities is hard. We do Incremental coalescing... Incremental is not optimal. Decoalescing is better. j j b e g a a d 1 f f i k k c c m m h l l

  24. Coalescing What, Why, and How to Coalesce The Different Approaches ...and the speedup k -colorability check is hard, but checking the Greedy-k-colorablility is easy. Still, finding the optimal subset of affinities is hard. We do Incremental coalescing... Incremental is not optimal. Decoalescing is better. j j b 2 e g a a d d f f i k k c c m m h l l

  25. Coalescing What, Why, and How to Coalesce The Different Approaches ...and the speedup k -colorability check is hard, but checking the Greedy-k-colorablility is easy. Still, finding the optimal subset of affinities is hard. We do Incremental coalescing... Incremental is not optimal. Decoalescing is better. j j b b e 1 g a a d d f f i k k c c m m h l l

  26. Coalescing What, Why, and How to Coalesce The Different Approaches ...and the speedup k -colorability check is hard, but checking the Greedy-k-colorablility is easy. Still, finding the optimal subset of affinities is hard. We do Incremental coalescing... Incremental is not optimal. Decoalescing is better. j j b b e e g a a d d f f 2 i k k c c m m h l l

  27. Coalescing What, Why, and How to Coalesce The Different Approaches ...and the speedup k -colorability check is hard, but checking the Greedy-k-colorablility is easy. Still, finding the optimal subset of affinities is hard. We do Incremental coalescing... Incremental is not optimal. Decoalescing is better. j j b b e e g g a a d d f f i k k c c m m h 1 l l

  28. Coalescing What, Why, and How to Coalesce The Different Approaches ...and the speedup k -colorability check is hard, but checking the Greedy-k-colorablility is easy. Still, finding the optimal subset of affinities is hard. We do Incremental coalescing... Incremental is not optimal. Decoalescing is better. j j b b e e g g a a d d 0 f f i k k c c m m h h l l

Recommend


More recommend