1 / 18

Optimistic Register Coalescing

Optimistic Register Coalescing. Sobeeh Almukhaizim UC San Diego Computer Science & Engineering Based on the work of: J. Park and S. Moon School of Electrical Engineering Seoul National University. Outline. Motivation and problem definition. Register Allocation Copy Coalescing

brook
Download Presentation

Optimistic Register Coalescing

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Optimistic Register Coalescing Sobeeh Almukhaizim UC San Diego Computer Science & Engineering Based on the work of: J. Park and S. Moon School of Electrical Engineering Seoul National University

  2. Outline • Motivation and problem definition. • Register Allocation • Copy Coalescing • Optimistic Coalescing • Aggressive coalescing. • Live range splitting. • Experimental Results and Analyses • Summary

  3. Motivation and problem definition. • Register allocation and copy coalescing. • Goal: Minimize number of registers for a program ( faster execution ). • Live range variables that interfere with each other  interference graph with minimum color k ( number of registers ). • NP-complete  search for heuristics.

  4. Register Allocation • Interference Graph • A node represents a live range • An edge represents concurrent liveness • Coloring Theorem • In a graph G, a node x with degree lower than k will have a color no matter how G-{x} is colored

  5. Register Allocators • Yorktown Allocator (Chaitin et. al) • Spills a node whenever every node is significant • Optimistic Coloring Register Allocator (Briggs et. al) • Delays spill decision later • Differentiates potential-spill and actual-spill

  6. Copy Coalescing • Coalescing in Graph Coloring • Merging two non-interfering nodes • Makes two nodes have the same color • Effective for copy elimination • Copy Coalescing • Merging two non-interfering copy-related nodes • Makes copies meaningless • Includes both negative and positive impact on colorability

  7. Coalescing Impact on Colorability • Negative Impact • Produce higher-degree coalesced nodes • Positive Impact • Reduce the degrees of neighbors by one 2 1 1 2 a b ad b a b ab k=2 1 c d c c d c d Positive Impact Negative Impact

  8. Previous Coalescing Heuristics • Aggressive Coalescing(Chaitin et. al) • Coalesce any non-interfering copy operands • Conservative Coalescing(Briggs et. al) • Coalesce if the coalesced node will not be potentially-spilled • Iterated Coalescing(George and Appel) • Repeat simplification and conservative coalescing Aggressive Conservative Iterated Copy Removal best worst mid Positive Impact big small mid Negative Impact big none none

  9. Optimistic Coalescing • Aggressive Coalescing • Live Range Splitting Motivation of Optimistic Coalescing Copy Removal Aggressive Coalescing Positive Impact Optimistic View Negative Impact Live Range Splitting

  10. d d c 1 h 2 f 3 e 1 g 3 d 2 a 3 b spill k=3 bc 1 h 2 f 3 e 2 g 1 d 3 a 2 b e e g g bc a a f h c f h stack stack Aggressive Coalescing • Advantages of Aggressive Coalescing • Removes many copies • Fully exploits the positive impact • Optimistically, aggressively coalesced node is not necessarily spilled

  11. Live Range Splitting • Compensate for Negative Impact • What to Split • Coalesced live ranges • When to Split • At the color phase before spilling them actually • How to Split • Reproduce the primitive live ranges by undoing coalescing

  12. Example of Live Range Splitting a k=3 e b e stack abcd f d f g c g Graph simplification Aggressive coalescing ab=3 e=1 e=1 d f=2 f=2 c=1 g=3 g=3 Allocation result

  13. Register Allocator Implementation • Base-case allocator • Yorktown allocator with aggressive coalescing • Briggs’ allocators with four different heuristics • with conservative coalescing (conservative) • with iterated coalescing (iterated) • with aggressive coalescing (aggressive) • with optimistic coalescing (optimistic)

  14. Experimental Results Ratio of removed copies Ratio of introduced spill ops

  15. Analysis of Aggressive Coalescing and Spilling • Due to aggressiveness, aggressive coalescing coalesces 66.0% more nodes • Due to optimistic view, aggressive coalescing spills only 5.6% of aggressively coalesced nodes • Due to live range splitting, optimistic coalescing reduces spills by 2.4%

  16. Analysis of Live Range Splitting • Due to live range splitting, 52% of otherwise spilled nodes are colored

  17. Analysis of Positive impact • Due to positive impact, coalescing removes interference edges • Optimistic coalescing exploits 3.8 times more positive impact than iterated coalescing

  18. Summary • Optimistic Coalescing • Aggressive coalescing • Aggressive copy elimination • Positive impact • Optimistic view • Live range splitting • Reduce negative impact

More Related