Transactional Optimization Passes in JIT Compilers

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Current optimizing compilers face challenges in aborting optimization passes without failing the entire compilation, particularly in Just in Time (JIT) compilers, due to issues like memory budget exhaustion or excessive complexity, which can lead to inefficient recompilation or interpretation of code.

Innovation Solution

The introduction of a proposed state pointer system in the intermediate language (IL) representation allows for transactional optimization passes, where changes are made to a proposed state node without altering the current state node, enabling atomicity and allowing failed optimization passes to be backed out while maintaining successful optimizations, thus preventing entire compile failures.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Manufacturing precision

If an optimizing compiler performs multiple optimization passes over IL representation, then code optimization quality improves, but compilation time and resource consumption increase

Engineering Contradiction:
Improveoptimization qualityVSAvoidcompilation time
Core Design Contradiction:
Manufacturing precisionVSLoss of time

Solution Approach 1:

The patent segments the optimization process into discrete, independently manageable passes that operate on the IL representation. Each optimization pass is a separate transaction that can be individually controlled, aborted, or committed without affecting other passes, allowing selective application of optimizations based on resource constraints and performance needs.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent introduces dynamic control mechanisms that allow the compiler to adjust the number and type of optimization passes based on runtime conditions, resource availability, and code characteristics. The system can dynamically abort or commit individual optimization passes, making the compilation process adaptive rather than rigid.

Inventive Principle:
Principle #15Dynamics

2Manufacturing precision

If an optimization pass consumes excessive memory or becomes overly complex, then optimization effectiveness may improve, but the entire compilation process can fail

Engineering Contradiction:
Improveoptimization effectivenessVSAvoidcompilation reliability
Core Design Contradiction:
Manufacturing precisionVSReliability

Solution Approach 1:

The patent implements protective mechanisms before optimization passes execute, including resource budget allocation and complexity thresholds. These pre-established safeguards prevent any single optimization pass from consuming excessive resources or becoming overly complex, thereby protecting the overall compilation process from failure.

Inventive Principle:
Principle #11Beforehand cushioning (Prior cushioning)

Solution Approach 2:

The patent introduces an intermediary transaction management layer between the optimization passes and the compilation process. This intermediary monitors resource consumption and complexity metrics, and can abort individual optimization passes before they cause system-wide failure, isolating problems to specific passes rather than compromising the entire compilation.

Inventive Principle:
Principle #24Intermediary (Mediator)

3Use of energy by moving object

If an optimization pass fails due to memory budget exhaustion or excessive complexity, then resource constraints are enforced, but recompilation or interpretation becomes necessary

Engineering Contradiction:
Improveresource constraint enforcementVSAvoidcompilation efficiency
Core Design Contradiction:
Use of energy by moving objectVSProductivity

Solution Approach 1:

The patent implements mechanisms to discard failed optimization passes and recover the original IL representation state without requiring full recompilation. When an optimization pass fails due to resource constraints, the system can rollback to the previous state and attempt alternative optimizations or fall back to interpretation, preserving productive work already done.

Inventive Principle:
Principle #34Discarding and recovering

Solution Approach 2:

The patent enables dynamic switching between different compilation strategies based on optimization pass outcomes. If an optimization pass fails, the system can dynamically adjust by attempting different optimization passes, reducing optimization levels, or switching to interpretation, thereby maintaining productivity under resource constraints.

Inventive Principle:
Principle #15Dynamics

4Reliability

If the compiler aborts a failed optimization pass, then individual failures are contained, but managing multiple state pointers and nodes increases system complexity

Engineering Contradiction:
Improvefailure containmentVSAvoidstate management complexity
Core Design Contradiction:
ReliabilityVSDevice complexity

Solution Approach 1:

The patent uses copying mechanisms to manage optimization states, creating copies of the IL representation for each optimization pass attempt. This allows the system to maintain multiple state pointers without directly modifying the original representation, simplifying rollback and state management while enabling reliable failure containment through isolated copy-based experimentation.

Inventive Principle:
Principle #26Copying

Data Source

PatentUS10891120B2Performing a compiler optimization pass as a transaction
Publication Date: 2021.01.12 INTERNATIONAL BUSINESS MACHINE CORPORATION
  • US10891120B2 patent drawing
  • US10891120B2 patent drawing
  • US10891120B2 patent drawing

AI summary

Embodiments described herein provide a solution for optimizing a compiling of program code. A proposed state pointer, which corresponds to a current state pointer to a current state node that represents a section of the program code, is added in an intermediate language (IL) representation of the program code. When the optimizing compiler determines that an optimization should be made to a section of code, the current state node is copied to create a proposed state node, which is then referenced by the proposed state pointer. The proposed state node is edited to include the optimization while the current state node remains unchanged. The success of the optimization is evaluated, and an updated IL representation is generated in which any references to nodes that are no longer included in the flow of the former IL representation are removed.