Static Block Frequency Prediction in Irreducible Loops

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing compilers lack accurate methods for predicting block frequencies in irreducible loops, which are crucial for optimizing computer code execution, leading to suboptimal performance enhancements.

Innovation Solution

A method is introduced to statically determine block frequencies by splitting incoming block mass among multiple loop headers and iteratively updating masses through bottom-up and top-down traversals, using geometric series to refine initial mass assignments and achieve fixed-point convergence.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Measurement precision

If existing compilers use traditional block frequency prediction methods, then the compilation process is simple, but the prediction accuracy for irreducible loops is insufficient leading to suboptimal performance enhancements

Engineering Contradiction:
Improveblock frequency prediction accuracyVSAvoidcompiler optimization complexity
Core Design Contradiction:
Measurement precisionVSDevice complexity

Solution Approach 1:

The incoming block mass is segmented and distributed to multiple loop headers proportionally based on branch frequencies. This segmentation allows accurate frequency prediction in irreducible loops by treating each header's contribution separately rather than as a single undifferentiated mass.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The compiler performs iterative bottom-up and top-down traversals that dynamically update block masses until fixed-point convergence is reached. This dynamic iterative approach adapts the frequency predictions through multiple passes, refining accuracy progressively rather than using a static single-pass method.

Inventive Principle:
Principle #15Dynamics

2Measurement precision

If iterative bottom-up and top-down traversals are performed to update block masses, then block frequency prediction accuracy improves, but the compilation time increases

Engineering Contradiction:
Improveblock frequency prediction accuracyVSAvoidcompilation time
Core Design Contradiction:
Measurement precisionVSLoss of time

Solution Approach 1:

The iterative traversal process uses feedback loops where each pass updates block masses based on the previous pass results. The process continues until fixed-point convergence is detected, meaning the updates become negligible. This feedback mechanism ensures accuracy while providing a clear termination condition to prevent excessive compilation time.

Inventive Principle:
Principle #23Feedback

Solution Approach 2:

The incoming block mass is preliminarily distributed to loop headers using branch frequency ratios before the iterative traversals begin. This preliminary action provides a reasonable initial estimate that reduces the number of iterative passes needed to reach convergence, thereby reducing overall compilation time while maintaining accuracy.

Inventive Principle:
Principle #10Preliminary action

Data Source

PatentUS11829738B2Static block frequency prediction in irreducible loops within computer code
Publication Date: 2023.11.28 INTERNATIONAL BUSINESS MACHINE CORPORATION
  • US11829738B2 patent drawing
  • US11829738B2 patent drawing
  • US11829738B2 patent drawing

AI summary

A block frequency of a block in an irreducible loop in computer code is statically determined. The statically determining includes splitting an incoming block mass among multiple loop headers of the irreducible loop to provide an initial mass for the block. A bottom-up traversal and a top-down traversal of a plurality of loops of the computer code including the irreducible loop are iteratively performed to update a mass of the block. The iteratively performing commences with propagating the initial mass of the block to one or more blocks of one or more loops of the plurality of loops and continues with propagating and updating masses of select blocks of the plurality of loops until a predefined point is reached providing a resulting mass for the block. The block frequency of the block is determined using the resulting mass and is to be used in processing associated with the computer code.