Что такое findslide.org?

FindSlide.org - это сайт презентаций, докладов, шаблонов в формате PowerPoint.


Для правообладателей

Обратная связь

Email: Нажмите что бы посмотреть 

Яндекс.Метрика

Презентация на тему Linear scan. Register allocation

November 29, 2005Christopher TuttleIntroductionRegister Allocation: The problem of mapping an unbounded number of virtual registers to physical ones Good register allocation is necessary for performanceSeveral SPEC benchmarks benefit an order of magnitude from good allocationCore memory
November 29, 2005Christopher TuttleLinear Scan Register AllocationMassimiliano Poletto (MIT)and Vivek Sarkar (IBM Watson) November 29, 2005Christopher TuttleIntroductionRegister Allocation: The problem of mapping an unbounded number November 29, 2005Christopher TuttleMotivationOn-line compilers need generate code quicklyJust-In-Time compilationDynamic code generation November 29, 2005Christopher TuttleDefinitionsLive interval: A sequence of instructions, outside of which November 29, 2005Christopher TuttleYe Olde Graph ColoringModel allocation as a graph coloring November 29, 2005Christopher TuttleLinear Scan AlgorithmCompute live variable analysisWalk through intervals in November 29, 2005Christopher TuttleExample With Two Registers1. Active = < A > November 29, 2005Christopher TuttleExample With Two Registers1. Active = < A >2. November 29, 2005Christopher TuttleExample With Two Registers1. Active = < A >2. November 29, 2005Christopher TuttleExample With Two Registers1. Active = < A >2. November 29, 2005Christopher TuttleExample With Two Registers1. Active = < A >2. November 29, 2005Christopher TuttleEvaluation OverviewEvaluate both compile-time and run-time performanceTwo ImplementationsICODE dynamic November 29, 2005Christopher TuttleCompile-Time on ICODE ‘CUsage Counts, Linear Scan, and Graph November 29, 2005Christopher TuttleCompile-Time on SUIFLinear Scan allocation is around twice as November 29, 2005Christopher TuttlePathological CasesN live variable ranges interfering over the entire November 29, 2005Christopher TuttleCompile-Time Bottom LineLinear Scan is faster than Binpacking and November 29, 2005Christopher TuttleRun-Time on ICODE ‘CUsage Counts, Linear Scan, and Graph November 29, 2005Christopher TuttleRun-Time on SUIF / SPECUsage Counts, Linear Scan, Graph November 29, 2005Christopher TuttleEvaluation SummaryLinear Scan is faster than Binpacking and Graph November 29, 2005Christopher TuttleConclusionsLinear Scan is a faster alternative to Graph Coloring November 29, 2005Christopher TuttleQuestions?
Слайды презентации

Слайд 2 November 29, 2005
Christopher Tuttle
Introduction
Register Allocation: The problem of

November 29, 2005Christopher TuttleIntroductionRegister Allocation: The problem of mapping an unbounded

mapping an unbounded number of virtual registers to physical

ones
Good register allocation is necessary for performance
Several SPEC benchmarks benefit an order of magnitude from good allocation
Core memory (and even caches) are slow relative to registers
Register allocation is expensive
Most algorithms are variations on Graph Coloring
Non-trivial algorithms require liveness analysis
Allocators can be quadratic in the number of live intervals

Слайд 3 November 29, 2005
Christopher Tuttle
Motivation
On-line compilers need generate code

November 29, 2005Christopher TuttleMotivationOn-line compilers need generate code quicklyJust-In-Time compilationDynamic code

quickly
Just-In-Time compilation
Dynamic code generation in language extensions (‘C)
Interactive environments

(IDEs, etc.)
Sacrifice code speed for a quicker compile.
Find a faster allocation algorithm
Compare it to the best allocation algorithms

Слайд 4 November 29, 2005
Christopher Tuttle
Definitions
Live interval: A sequence of

November 29, 2005Christopher TuttleDefinitionsLive interval: A sequence of instructions, outside of

instructions, outside of which a variable v is never

live.
(For this paper, intervals are assumed to be contiguous)
Spilling: Variables are spilled when they are stored on the stack
Interference: Two live ranges interfere if they are simultaneously live in a program.

Слайд 5 November 29, 2005
Christopher Tuttle
Ye Olde Graph Coloring

Model allocation

November 29, 2005Christopher TuttleYe Olde Graph ColoringModel allocation as a graph

as a graph coloring problem
Nodes represent live ranges
Edges represent

interferences
Colorings are safe allocations
Order V2 in live variables

(See Chaitin82 on PLDI list)



Слайд 6 November 29, 2005
Christopher Tuttle
Linear Scan Algorithm
Compute live variable

November 29, 2005Christopher TuttleLinear Scan AlgorithmCompute live variable analysisWalk through intervals

analysis
Walk through intervals in order:
Throw away expired live intervals.
If

there is contention, spill the interval that ends furthest in the future.
Allocate new interval to any free register

Complexity: O(V log R) for V vars and R registers

Слайд 7 November 29, 2005
Christopher Tuttle
Example With Two Registers
1. Active

November 29, 2005Christopher TuttleExample With Two Registers1. Active = < A >

= < A >


Слайд 8 November 29, 2005
Christopher Tuttle
Example With Two Registers
1. Active

November 29, 2005Christopher TuttleExample With Two Registers1. Active = < A

= < A >
2. Active = < A, B

>



Слайд 9 November 29, 2005
Christopher Tuttle
Example With Two Registers
1. Active

November 29, 2005Christopher TuttleExample With Two Registers1. Active = < A

= < A >
2. Active = < A, B

>
3. Active = < A, B > ; Spill = < C >



Слайд 10 November 29, 2005
Christopher Tuttle
Example With Two Registers
1. Active

November 29, 2005Christopher TuttleExample With Two Registers1. Active = < A

= < A >
2. Active = < A, B

>
3. Active = < A, B > ; Spill = < C >
4. Active = < D, B > ; Spill = < C >



Слайд 11 November 29, 2005
Christopher Tuttle
Example With Two Registers
1. Active

November 29, 2005Christopher TuttleExample With Two Registers1. Active = < A

= < A >
2. Active = < A, B

>
3. Active = < A, B > ; Spill = < C >
4. Active = < D, B > ; Spill = < C >
5. Active = < D, E > ; Spill = < C >



Слайд 12 November 29, 2005
Christopher Tuttle
Evaluation Overview
Evaluate both compile-time and

November 29, 2005Christopher TuttleEvaluation OverviewEvaluate both compile-time and run-time performanceTwo ImplementationsICODE

run-time performance
Two Implementations
ICODE dynamic ‘C compiler; (already had efficient

allocators)
Benchmarks from the previously used ICODE suite (all small)
Compare against tuned graph-coloring and usage counts
Also evaluate a few pathological program examples
Machine SUIF
Selected benchmarks from SPEC92 and SPEC95
Compare against graph-coloring, usage counts, and second-chance binpacking
Compare both metrics on both implementations



Слайд 13 November 29, 2005
Christopher Tuttle
Compile-Time on ICODE ‘C
Usage Counts,

November 29, 2005Christopher TuttleCompile-Time on ICODE ‘CUsage Counts, Linear Scan, and

Linear Scan, and Graph Coloring shown
Linear Scan allocation is

always faster than Graph Coloring

Слайд 14 November 29, 2005
Christopher Tuttle
Compile-Time on SUIF
Linear Scan allocation

November 29, 2005Christopher TuttleCompile-Time on SUIFLinear Scan allocation is around twice

is around twice as fast than Binpacking
(Binpacking is known

to be slower than Graph Coloring)

Слайд 15 November 29, 2005
Christopher Tuttle
Pathological Cases
N live variable ranges

November 29, 2005Christopher TuttlePathological CasesN live variable ranges interfering over the

interfering over the entire program execution
Other pathological cases omitted

for brevity; see Figure 6.

Слайд 16 November 29, 2005
Christopher Tuttle
Compile-Time Bottom Line
Linear Scan
is

November 29, 2005Christopher TuttleCompile-Time Bottom LineLinear Scan is faster than Binpacking

faster than Binpacking and Graph Coloring
works in dynamic code

generation (ICODE)
scales more gracefully than Graph Coloring


… but does it generate good code?

Слайд 17 November 29, 2005
Christopher Tuttle
Run-Time on ICODE ‘C
Usage Counts,

November 29, 2005Christopher TuttleRun-Time on ICODE ‘CUsage Counts, Linear Scan, and

Linear Scan, and Graph Coloring shown
Dynamic kernels do not

have enough register pressure to illustrate differences

Слайд 18 November 29, 2005
Christopher Tuttle
Run-Time on SUIF / SPEC
Usage

November 29, 2005Christopher TuttleRun-Time on SUIF / SPECUsage Counts, Linear Scan,

Counts, Linear Scan, Graph Coloring and Binpacking shown
Linear Scan

makes a fair performance trade-off (5% - 10% slower than G.C.)

Слайд 19 November 29, 2005
Christopher Tuttle
Evaluation Summary
Linear Scan
is faster

November 29, 2005Christopher TuttleEvaluation SummaryLinear Scan is faster than Binpacking and

than Binpacking and Graph Coloring
works in dynamic code generation

(ICODE)
scales more gracefully than Graph Coloring
generates code within 5-10% of Graph Coloring

Implementation alternatives evaluated in paper
Fast Live Variable Analysis
Spilling Hueristics


Слайд 20 November 29, 2005
Christopher Tuttle
Conclusions
Linear Scan is a faster

November 29, 2005Christopher TuttleConclusionsLinear Scan is a faster alternative to Graph

alternative to Graph Coloring for register allocation

Linear Scan generates

faster code than similar algorithms (Binpacking, Usage Counts)

Where can we go from here?
Reduce register interference with live range splitting
Use register move coalescing to free up extra registers


  • Имя файла: linear-scan-register-allocation.pptx
  • Количество просмотров: 129
  • Количество скачиваний: 0