Cross-file inlining using summaries and global worklist
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing compiler technologies face inefficiencies in cross-module optimization due to limitations in accessing information across modular barriers, leading to suboptimal performance and long compile times, especially when dealing with large applications consisting of thousands of files.
Innovation Solution
A method and apparatus for compiling computer programs that utilize inliner summaries and a globally-sorted working-list based order to determine which call sites should be inlined, allowing for cross-module optimization without directly using intermediate representations, and intelligently managing file I/O operations to minimize compile time and memory usage.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Manufacturing precision
If cross-module optimization is performed by accessing intermediate representations of all modules, then optimization quality improves, but memory usage and compile time increase significantly
Solution Approach 1:
The patent extracts only the essential information needed for inlining decisions from the intermediate representations, creating compact summary data structures that contain call site information, routine information, and inlining metrics without storing complete module representations in memory
Solution Approach 2:
The compilation process is segmented into multiple passes: a summary generation phase that creates lightweight inliner summaries from intermediate representations, and an inlining decision phase that uses only these summaries without loading full intermediate representations into memory
2Manufacturing precision
If cross-module optimization is performed by accessing intermediate representations of all modules, then optimization quality improves, but compile time increases significantly
Solution Approach 1:
The patent performs preliminary actions by generating inliner summaries during the front-end compilation phase, organizing and pre-processing call site and routine information into structured summaries that can be quickly queried during the inlining phase without re-parsing intermediate representations
Solution Approach 2:
Only the necessary information for inlining decisions is extracted and stored in summaries, avoiding the computational overhead of processing complete intermediate representations during the inlining phase
3Quantity of substance
If inlining decisions are made without summary information, then memory usage decreases, but optimization quality deteriorates
Solution Approach 1:
The patent introduces inliner summaries as an intermediary data structure that bridges the gap between complete intermediate representations and minimal memory usage, providing sufficient information for accurate inlining decisions while maintaining compact memory footprint
Solution Approach 2:
The patent changes the representation parameters from full intermediate representations to condensed summaries that retain only the critical parameters needed for inlining decisions, such as call site frequency, routine size, and estimated inlining benefit
4Quantity of substance
If modular compilation is used to reduce memory usage, then memory efficiency improves, but cross-module optimization capability deteriorates
Solution Approach 1:
The inliner summary acts as an intermediary that enables cross-module optimization by providing a standardized, compact representation of call sites and routines that can be generated from modular compilations and used for cross-module inlining decisions without requiring all modules to be loaded into memory simultaneously
Data Source
AI summary
One embodiment disclosed relates to a method of compiling a computer program. A plurality of modules of source code is received, and intermediate representations corresponding to the modules are generated. A set of data from the intermediate representations is extracted to create an inliner summary for each module. Using the inliner summaries and a globally-sorted working-list based order, an inline analysis phase determines which call sites in the modules are to be inlined by substituting code from a called module. The propagation of summaries may be done elaborately, potentially throughout the call-graph. The goodness of call sites may be computed with a view to comparing them and ordering them in a descending order of goodness. Applicants believe the compile-time effectiveness lies in the ability to work consistently with summary information in the inline analysis phase without having to touch the intermediate representation, while maintaining a high degree of run-time performance by continuously updating the summary information.


