Feedback Directed Compiling Optimizes Hot Code Sections

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing methods for optimizing executable code struggle to accurately identify hot sections for optimization, leading to inefficient resource usage and performance issues, as they either rely on user input or self-determination by compilers without actual execution data.

Innovation Solution

A feedback-directed compiling method that inserts signatures in the executable code, uses a counter code to track execution frequency, and recompiles the code based on actual usage data to optimize only the hot sections, thereby improving performance without altering the execution properties of the code.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Measurement precision

If compilers use user input or self-determination to identify hot sections, then the compiling process is simpler, but the accuracy of identifying hot sections deteriorates

Engineering Contradiction:
Improveaccuracy of identifying hot sectionsVSAvoidcompiling process complexity
Core Design Contradiction:
Measurement precisionVSDevice complexity

Solution Approach 1:

The system implements feedback by executing the compiled code, measuring actual execution frequency of code sections, and using this measurement feedback to guide the compiler in identifying hot sections. The compiler receives feedback about which code sections are actually executed most frequently and uses this information to optimize those sections in subsequent compilation rounds, thereby improving accuracy without requiring complex user input.

Inventive Principle:
Principle #23Feedback

2Productivity

If the compiler optimizes all code sections, then the optimization process is more thorough, but the execution time and resource consumption increase

Engineering Contradiction:
Improveexecution speedVSAvoidcompilation and execution time
Core Design Contradiction:
ProductivityVSLoss of time

Solution Approach 1:

The system applies local quality by differentiating treatment of different code sections based on their execution frequency. Instead of uniformly optimizing all code, the compiler identifies hot sections (those with high execution frequency) and applies aggressive optimization only to those specific sections. Cold sections are compiled with minimal optimization, thereby achieving high productivity for the critical paths while minimizing overall time consumption.

Inventive Principle:
Principle #3Local quality

3Measurement precision

If the system collects execution data for optimization, then the optimization accuracy improves, but the data collection overhead increases

Engineering Contradiction:
Improveexecution frequency measurement accuracyVSAvoidenergy consumption
Core Design Contradiction:
Measurement precisionVSLoss of energy

Solution Approach 1:

The system implements self-service by having the executed code itself provide the measurement data needed for optimization. The code executes naturally during normal program operation, and the execution frequency is measured passively without requiring separate testing procedures or additional energy-intensive measurement systems. The code serves both its functional purpose and the measurement purpose simultaneously.

Inventive Principle:
Principle #25Self-service

Data Source

PatentUS9547483B1Feedback directed optimized compiling of optimized executable code
Publication Date: 2017.01.17 MAPLEBEAR INC
  • US9547483B1 patent drawing
  • US9547483B1 patent drawing
  • US9547483B1 patent drawing

AI summary

For optimizing executable code, during a first compilation of a source code, a set of signatures is inserted in a first executable code. A signature in the set of signatures includes a combination of executable instructions. During an execution of the first executable in a debugger an instruction to call a counter code is executed from a location of the signature to increment a counter corresponding to the signature. A value of the counter is provided to a compiler to correspond with the location of the signature in the first executable code. The source code is recompiled into a second executable code, optimizing a portion of the second executable code responsive to the value exceeding a threshold. The portion is related to the location of the signature in the first executable code.