A Dynamic Programming Approach to Optimal Integrated Code Generation - PowerPoint PPT Presentation

About This Presentation
Title:

A Dynamic Programming Approach to Optimal Integrated Code Generation

Description:

Beyond basic block level. Time-space profiles as connector ... Feasible for medium sized basic blocks. Potential for extensions. Alternative to ILP ... – PowerPoint PPT presentation

Number of Views:221
Avg rating:3.0/5.0
Slides: 24
Provided by: andrzejb6
Category:

less

Transcript and Presenter's Notes

Title: A Dynamic Programming Approach to Optimal Integrated Code Generation


1
A Dynamic Programming Approach to Optimal
Integrated Code Generation
  • Christoph Keßler
  • Andrzej Bednarski
  • Linköping University (Sweden)

2
Outline
  • Code generation
  • Our integrated approach
  • Implementation and results
  • Current and future work
  • Conclusion

3
Code Generation
IR-level Instruction scheduling
IR-level Reg. Alloc
IR-level Reg. Alloc
IR
IR-level Instruction scheduling
Instruction selection
Instruction selection
Instruction selection
Instruction selection
Target code
Target-level Instruction scheduling
Target-level Reg. Alloc
Target-level Reg. Alloc
Target-level Instruction scheduling
4
Related Work
  • Heuristics
  • Optimal approaches
  • ILP
  • Dynamic programming
  • Branch-and-bound
  • Enumeration
  • Constraint logic programming

5
Integrated Code Generation
IR-level Instruction scheduling
IR-level Reg. Alloc
IR-level Reg. Alloc
IR
IR-level Instruction scheduling
Instruction selection
Instruction selection
Integrated Code generation
Instruction selection
Instruction selection
Target code
Target-level Instruction scheduling
Target-level Reg. Alloc
Target-level Reg. Alloc
Target-level Instruction scheduling
6
Integrated Approach
  • Christoph Keßlers previous work
  • Scheduling by topological sorting
  • Dynamic programming
  • Selection DAG
  • Time profile
  • Extended selection DAG
  • Basic block scope of code generation

7
Topological Sorting
8
Selection Tree
9
Selection DAG
  • Merge multiple instances of same zero indegree
    set z in one selection node
  • Selection DAG
  • Selection DAG is leveled in n1 levels
  • Each schedule S corresponds to one path in the
    selection DAG

10
Selection DAG
11
Towards Time Optimization
  • Machine model
  • Generic superscalar/VLIW architecture
  • Single/Multiple issue
  • From IR level to target level
  • Instruction selection
  • Register allocation (homogenous)
  • Imitate instruction dispatcher behaviour

12
Time Profile
  • Window of the instructions scheduled last for
    each unit that may still influence future
    scheduling decisions

t
e
f
-
c
d
-
-
-
b
-
-
a
u3
u2
u1
13
Extended Selection Node
  • An extended selection node (z, t, P), summarizes
    all schedules of scheduled(z) that end with the
    time profile (t, P).
  • Pruning (formal proof in the paper)

t
e
f
-
t
t
c
d
-
e
f
-
a
f
-
-
-
b
c
d
a
c
d
e
-
-
a
-
-
b
-
-
b
u3
u2
u1
u3
u2
u1
u3
u2
u1
14
Extended Selection DAG
Level 0
Level 1
Level 2
...
15
Solution Space
  • Group the extended selection nodes in each level
    according to execution time
  • Construct solution space in order of increasing
    time
  • Postpones the combinatorial explosion

16
Implementation
  • C
  • LEDA
  • XML based architecture description language
  • LCC as Cfront-end

17
Results Random DAGs
18
Results Random DAGs
19
Results FIR Filter
Basic Block DAG nodes Time archi. 1 Time archi. 2
BB1 16 3.5s 4.0s
BB2 16 8.0s 9.5s
BB3 30 32150.2s 44044.9s
20
Results Matrix Multiplication
Basic Block DAG nodes Time archi. 1 Time archi. 2
BB2 30 105.0s 141.8s
BB2 (unrolled) 40 608.5s 947.2s
21
Results Jacobi Grid Relax.
Basic Block DAG nodes Time archi. 1 Time archi. 2
Loop body (5) 40 115.8s 131.8s
Loop body (9) 53 13613.2s 20051.5s
22
Current and Future Work
  • Time-space profile for irregular register sets
  • Speculative instruction selection
  • Extensions of architecture description language
  • Beyond basic block level
  • Time-space profiles as connector descriptions

23
Conclusion
  • Goal fully integrated code generation
  • Dynamic programming approach
  • Time profiles to compress the solution space
  • Improved order of solution space construction
  • Feasible for medium sized basic blocks
  • Potential for extensions
  • Alternative to ILP
  • Home page www.ida.liu.se/chrke/optimist
Write a Comment
User Comments (0)
About PowerShow.com