Compiler apparatus and method for optimizing loops in a computer program
Abstract
A profile-based loop optimizer generates an execution frequency table for each loop that gives more detailed profile data that allows making a more intelligent decision regarding if and how to optimize each loop in the computer program. The execution frequency table contains entries that correlate a number of times a loop is executed each time the loop is entered with a count of the occurrences of each number during the execution of an instrumented instruction stream. The execution frequency table is used to determine whether there is one dominant mode that appears in the profile data, and if so, optimizes the loop according to the dominant mode. The optimizer may perform optimizations by peeling a loop, by unrolling a loop, and by performing both peeling and unrolling on a loop according to the profile data in the execution frequency table for the loop. In this manner the execution time of the resulting code is minimized according to the detailed profile data in the execution frequency tables, resulting in a computer program with loops that are more fully optimized.
Interactive Citation Constellation Global Citation Ranking
Interactive SVG Citation Constellation renders in Rust/WebAssembly. Prior art cited: 15 · Forward citations: 48.
Claims (2 — 1 Independent, 1 Dependent)
- Claim 1Independent Claim
An apparatus comprising: at least one processor; a memory coupled to the at least one processor; a first instruction stream residing in the memory; and a profile-based loop optimizer residing in the memory and executed by the at least one processor, the loop optimizer inserting instrumentation code into the first instruction stream that collects profile data in at least one execution frequency table and thereby generating a second instruction stream, each execution frequency table indicating values representative of the number of times a corresponding loop is executed each time the loop is ent
- Claim 2Depends on #1
The apparatus of claim 1 wherein each execution frequency table includes a plurality of entries, each entry containing: (1) a value representative of the number of times a loop is executed each time the loop is entered; and (2) a count of the occurrences
Technical Overview & Description
Full multi-page specification text is archived at the issuing office. Read complete official specification ↗
Cited By — Indexed Forward Citations (15 of 48 total)
References Cited — Backward Prior Art (15)
Non-Patent Literature (5)
- Cai et al, "Optimal and efficient speculation based partial redundancy elimination", IEEE, pp 91-102, 2003.
- Chen et al, "Dynamic trace selection using performance monitoring hardware sampling", IEEE, pp 79-90, 2003.
- Hall, "Call path profiling", ACM pp 296-306, 1992.
- Joshi et al, "Targeted path profiling: lower overhead path profiling for staged dynamic optimization systems", IEEE, Proc. of the International Symp. CGO, pp 1-12, Sep. 2004.
- Krintz, "Coupling on line and off line profile information to improve program performance", IEEE, pp 69-78, 2003.