Learning Policies for Local Instruction Scheduling
Execution speed of programs on modern computer architectur es is sensitive, by a factor of two or more, to the order in which instructions are presented to t he processor. To realize potential execution efficiency, it is now customary for an optimizing compiler to employ a heuristic algorithm for instruction scheduling. These algorithms are currently hand-crafted. We show how to cast the local instruction scheduling problem as a machine learning task, so that one obtains a heur istic scheduling algorithm automatically. Our empirical results demonstrate that just a few features are a dequate for competence at this task for a real modern processor, and that any of several supervised learni ng methods perform nearly optimally with respect to the features used. The learning goal is to minimize the cyc les needed for each basic block, in isolation and assuming all memory accesses hit in the cache. We found th at competence at this task resulted in good measured execution times for entire scheduled programs. In the end, we essentially match the performance of commercial compilers for the same processor, and offer some evidence that our learned heuristics are nearly optimal.