Static Analysis Model for Data Cache Miss Estimation

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing compilers lack accurate models for data cache behavior, particularly in modern CPU architectures where memory cost is a significant concern, as they fail to effectively model data cache misses and reuse across loop iterations and set-associative caches.

Innovation Solution

A novel static analysis is introduced that models data cache behavior by estimating cache misses and reuses across loop iterations, considering set associativity and outer loops, to guide loop unroll-and-jam transformations and optimize memory usage.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Measurement precision

If compilers use simple memory access models, then compilation is faster and simpler, but cache miss estimation is inaccurate

Engineering Contradiction:
Improvecache miss estimation accuracyVSAvoidcompiler model complexity
Core Design Contradiction:
Measurement precisionVSDevice complexity

Solution Approach 1:

The patent segments the loop nest analysis into hierarchical levels (outer loops, inner loops, basic blocks) and analyzes cache behavior at each level separately. This allows accurate tracking of data cache line fetches and reuses across different loop iterations while maintaining manageable complexity through structured decomposition of the analysis problem.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent introduces specific parameters to track cache behavior including data cache line fetches per iteration, set associativity constraints, and reuse distances. By changing the modeling parameters to explicitly track these cache metrics, the compiler achieves accurate cache miss estimation without requiring complete redesign of the optimization framework.

Inventive Principle:
Principle #35Parameter changes

2Measurement precision

If compilers ignore set associativity constraints, then analysis is simpler, but cache reuse prediction is inaccurate

Engineering Contradiction:
Improvecache reuse prediction accuracyVSAvoidanalysis complexity
Core Design Contradiction:
Measurement precisionVSDevice complexity

Solution Approach 1:

The patent performs preliminary analysis of set associativity constraints before executing the main cache behavior analysis. By pre-computing which cache sets are accessed and their associativity characteristics, the compiler establishes bounds on possible cache reuses early in the analysis, simplifying subsequent predictions while maintaining accuracy.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent creates abstract representations (copies) of cache behavior patterns that can be reused across different loop iterations and memory references. By modeling cache set mappings and associativity constraints as reusable abstract structures, the analysis achieves accurate prediction without re-computing the same constraints repeatedly.

Inventive Principle:
Principle #26Copying

3Productivity

If compilers do not analyze outer loops, then analysis is faster, but inter-iteration cache reuse is missed

Engineering Contradiction:
Improveoptimization effectivenessVSAvoidanalysis time
Core Design Contradiction:
ProductivityVSLoss of time

Solution Approach 1:

The patent extends the analysis from single-loop to multi-loop dimensions by systematically analyzing outer loops and their impact on inner loop cache behavior. This dimensional extension allows detection of cache reuse patterns that span multiple loop iterations while using efficient algorithms to avoid exponential complexity growth.

Inventive Principle:
Principle #17Another dimension (Dimensionality change)

Solution Approach 2:

The patent implements nested analysis where outer loop analysis contains inner loop analysis, which contains basic block analysis. This nested structure allows the compiler to progressively build up cache behavior understanding from the innermost level outward, identifying reuse opportunities across loop boundaries while maintaining analytical tractability through hierarchical organization.

Inventive Principle:
Principle #7Nested doll (Nesting)

Data Source

PatentUS11630654B2Analysis for modeling data cache utilization
Publication Date: 2023.04.18 INTERNATIONAL BUSINESS MACHINE CORPORATION
  • US11630654B2 patent drawing
  • US11630654B2 patent drawing
  • US11630654B2 patent drawing

AI summary

Aspects include modeling data cache utilization for each loop in a loop nest; estimating total data cache lines fetched in one iteration of the loop; and determining the possibility of data cache reuse across loop iterations using data cache lines fetched and associativity constraints. Aspects also include estimating, for memory reference pairs, reuse by one reference of data cache line fetched by another; estimating total number of cache misses for all iterations of the loop; and estimating total number of cache misses of a reference for iterations of a next outer loop as equal to total cache misses for an entire inner loop. Aspects further include estimating memory cost of a loop unroll and jam transformation, without performing the transformation; and extending a data cache model to estimate best unroll-and-jam factors for the loop nest, capable of minimizing total cache misses incurred by the memory references in the loop body.