ThinLTO Demand-Driven IPO Infrastructure

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing cross-module optimization technologies, such as Link Time Optimization (LTO) and Lightweight Inter-Procedural Optimization (LIPO), face limitations including high memory requirements, serial compilation bottlenecks, and difficulties in integration with large distributed build systems, limiting their scalability and usability for very large applications.

Innovation Solution

The new architecture, referred to as ThinLTO, addresses these limitations by generating intermediate representation files with function indices and summaries, creating a thin-archive with a combined function map, and performing parallel cross-module optimization with demand-driven import of debug information, allowing for fast function importing and minimal overhead, thus enabling efficient compilation of large programs.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If Link Time Optimization (LTO) is used to perform cross-module optimization, then optimization effectiveness is improved, but memory consumption increases significantly and compilation speed decreases

Engineering Contradiction:
Improveoptimization effectivenessVSAvoidcompilation speed
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The patent divides the monolithic LTO process into separate compilation and linking phases. Each module is compiled independently to an intermediate representation with embedded function metadata, and the linker selectively imports only necessary functions based on call graph analysis. This segmentation enables parallel processing of modules while maintaining optimization effectiveness.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent extracts function metadata and call graph information from the intermediate representation files and stores them in separate data structures. The linker extracts only the necessary function bodies required by the calling module, rather than importing entire modules or all functions, thereby reducing memory consumption and improving compilation speed.

Inventive Principle:
Principle #2Taking out (Extraction)

2Reliability

If Link Time Optimization (LTO) is used to perform cross-module optimization, then optimization effectiveness is improved, but device complexity increases due to serial processing requirements

Engineering Contradiction:
Improveoptimization effectivenessVSAvoidbuild system complexity
Core Design Contradiction:
ReliabilityVSDevice complexity

Solution Approach 1:

The patent segments the compilation process into independent module compilation units that can be processed in parallel. Each module generates its own intermediate representation file with function metadata, allowing the build system to process multiple modules concurrently without complex serialization logic.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent introduces an intermediary intermediate representation format that bridges source code and final executable. This IR format includes embedded function metadata that serves as a mediator between the compiler and linker, enabling the linker to make informed import decisions without requiring complex analysis of the entire program.

Inventive Principle:
Principle #24Intermediary (Mediator)

3Productivity

If Lightweight IPO (LIPO) is used to improve scalability, then compilation speed is improved, but optimization effectiveness is limited due to coarse-grain importing

Engineering Contradiction:
Improvecompilation speedVSAvoidoptimization effectiveness
Core Design Contradiction:
ProductivityVSReliability

Solution Approach 1:

The patent implements dynamic function importing where the linker analyzes the call graph and selectively imports only the functions that are actually needed by each module. This dynamic approach allows fine-grain control over which functions are imported, improving optimization effectiveness while maintaining compilation speed.

Inventive Principle:
Principle #15Dynamics

Solution Approach 2:

The patent changes the granularity parameter of function importing from coarse-grain (entire modules or large function groups) to fine-grain (individual functions based on call graph analysis). This parameter change enables precise control over imported code while maintaining scalability and compilation speed.

Inventive Principle:
Principle #35Parameter changes

4Productivity

If Lightweight IPO (LIPO) is used to improve scalability, then compilation speed is improved, but memory consumption increases due to profile feedback requirements

Engineering Contradiction:
Improvecompilation speedVSAvoidmemory consumption
Core Design Contradiction:
ProductivityVSQuantity of substance

Solution Approach 1:

The patent extracts and stores function metadata (signatures, parameters, return types) directly in the intermediate representation files during compilation. This extraction eliminates the need to load entire module contents or maintain large profile feedback structures in memory during linking, reducing memory consumption while enabling selective function importing.

Inventive Principle:
Principle #2Taking out (Extraction)

Data Source

PatentEP3254190B1A fine-grained demand driven IPO infrastructure
Publication Date: 2020.10.21 GOOGLE LLC
  • EP3254190B1 patent drawingFigure 1
  • EP3254190B1 patent drawingFigure 2
  • EP3254190B1 patent drawingFigure 3

AI summary

Provided are methods and systems for inter-procedural optimization (IPO). A new IPO architecture (referred to as "ThinLTO") is designed to address the weaknesses and limitations of existing IPO approaches, such as traditional Link Time Optimization (LTO) and Lightweight Inter-Procedural Optimization (LIPO), and become a new link-time-optimization standard. With ThinLTO, demand-driven and summary-based fine grain importing maximizes the potential of Cross-Module Optimization (CMO), which enables as much useful CMO as possible. ThinLTO also provides for global indexing, which enables fast function importing; parallelizes some performance-critical but expensive inter-procedural analyses and transformations; utilizes demand-driven, lazy importing of debug information that minimizes memory consumption for the debug build; and allows easy integration of third-party distributed build systems. In addition, ThinLTO may also be implemented using an IPO server, thereby removing the need for the serial step.