170 likes | 172 Views
Inducing Heuristics To Decide Whether To Schedule. John Cavazos J Eliot B Moss Architecture and Language Implementation Lab University of Massachusetts, Amherst. Motivation. Instruction Scheduling is important Can improve running time by over 15% Can be expensive
E N D
Inducing Heuristics To Decide Whether To Schedule John Cavazos J Eliot B Moss Architecture and Language Implementation Lab University of Massachusetts, Amherst
Motivation • Instruction Scheduling is important • Can improve running time by over 15% • Can be expensive • Frequently not beneficial • Problem: Can we predict which blocks will benefit from scheduling?
Our Proposal • Use static features to predict when instruction scheduling is beneficial • Use supervised learning to construct a heuristic (filter) • Simple features and learning scheme were successful! • Could be harder for other optimizations
Optimization Filters • Decision process less expensive than OPT process • OPT process optional • OPT process not always be profitable
Use Supervised Learning! • Induces functions automatically • All you need is learning examples • a,…,x,y,z label • a,…,x,y,z are the features • label (true or false) whether to schedule • Minimize errors over training set • Prefers less complicated function
Benefits of Supervised Learning • Heuristic construction is sped up • Determines relative importance of features • Efficient and effective • Good heuristic generated in minutes • Guaranteed theoretically sound • Traditional approach ad-hoc
Inducing a Filterfor Instruction Scheduling • Identify cheap-to-compute features of block • Obtain raw training data for each block: • Features (properties) of the block • Estimated time with and without scheduling • Use supervised learning to induce filter • Rule Induction • Install filter into compiler • Controls which blocks to schedule
Block Timing Estimator • Estimate of cycles to execute block • Simple model of real machine • Determines cost of block in isolation • Absolute cycle count not important • Relative differences important
Labeling using Thresholds • Positive = If Benefit greater than Threshold • Negative = If Benefit less than or equal to 0 • Neutral = If Benefit greater than 0 and less than Threshold
Motivation for Threshold Technique • Simplify supervised learning problem • Remove cases of fine distinction • If a small benefit prefer not to schedule • Remember: Scheduling is costly • Apply scheduling if benefit above threshold.
Cost of Evaluating Filters SB=Scheduled Blocks, SI=Scheduled Instructions F=Heuristic Cost, S=Scheduling Cost, C=Compilation Cost * List Scheduling is 13% to 23% of total compilation time
Future Work withOptimization Filters • Use a filter to control register allocation • Graph Coloring • Effective, but expensive • Linear Scan • Efficient, but not always as effective • Heuristic decides which algorithm to apply
Conclusion • Optimization Filters are successful • Reducing scheduling time by 75% • Preserve 93% of scheduling benefit • Use of supervised learning effective • No previous “hand-coded” heuristic