Download presentation

Presentation is loading. Please wait.

Published byChloe Nail Modified about 1 year ago

1
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
2 Motivation and problem definition. Register Allocation Copy Coalescing Optimistic Coalescing Aggressive coalescing. Live range splitting. Experimental Results and Analyses Summary Outline

3
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
4 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 Register Allocation

5
5 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 Register Allocators

6
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
7 Coalescing Impact on Colorability Negative Impact –Produce higher-degree coalesced nodes Positive Impact –Reduce the degrees of neighbors by one a c b dd ab c 2 1 Negative Impact ab c ad d b c k=2 Positive Impact 2 1 1

8
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 AggressiveConservativeIterated Copy Removalbestworstmid Positive Impactmidsmallbig Negative Impactbignone

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

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

11
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
12 a b c f d g e k=3 e=1 f=2 g=3 Aggressive coalescing abcd e f g ab=3 c=1 f=2 d g=3 e=1 stack Graph simplification Allocation result Example of Live Range Splitting

13
13 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) Register Allocator Implementation

14
14 Ratio of removed copiesRatio of introduced spill ops Experimental Results

15
15 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% Analysis of Aggressive Coalescing and Spilling

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

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

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

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google