Static Block Frequency Prediction in Irreducible Loops
Find Innovative SolutionsGenerate 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
Engineering 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
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.
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.
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
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.
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.
Data Source
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.


