[Paper Review] Fully Symbolic Analysis of Loop Locality: Using Imaginary Reuse to Infer Real Performance
The paper introduces a fully symbolic locality theory that derives cache-related polynomials using imaginary reuses to handle cold starts, enabling fast cache-miss predictions for affine loops and a wide kernel set. It presents a two-pass compiler analysis and demonstrates high accuracy against cache simulations.
This paper presents a new theory of locality and its compiler support. The theory is fully symbolic and derives locality as polynomials, and the compiler analysis supports affine loop nests. They derive cache-performance scaling in quadratic and reciprocal expressions and are more general and precise than empirical scaling rules. Evaluated on a benchmark suite of 41 scientific kernels and tensor operations, the compiler requires an average of 41 seconds to derive the locality polynomials. After derivation, predicting the cache miss count for any given input size and cache configuration takes less than a millisecond. Across all tests--with and without loop fusion--the accuracy in the data movement prediction is 99.6\%, compared to simulated set-associative L1 data cache.
Motivation & Objective
- Motivate a complete, algebraic characterization of locality that scales across machine and program parameters.
- Develop a symbolic framework that yields cache-size and miss-polynomials for affine loop nests.
- Introduce imaginary reuses to resolve cold-start misses and enable a linear-time derivation under Infinite Repeat.
- Provide a compiler workflow to convert affine programs into parametric polytopes and generate RI distributions.
- Evaluate accuracy and performance on 41 scientific kernels and tensor operations, with loop fusion considered.
Proposed method
- Define reuse intervals (RIs) and derive cache-polynomials from RI distributions via Denning Recursion.
- Introduce Infinite Repeat with Imaginary Reuses to handle first-touch accesses and avoid divergence.
- Prove Working-set Correctness and RI Sum Invariance to validate symbolic results.
- Translate affine loops into parametric polytopes using Integer Set Programming and Barvinok counting to obtain RI distributions as piecewise quasi-polynomials.
- Approximate LRU cache behavior by mapping miss ratios to the working-set-based polynomials, and adjust for cold-start misses.
- Justify a two-pass compiler analysis within an MLIR-based symbolic locality framework.

Experimental results
Research questions
- RQ1How can locality be characterized algebraically as polynomials in cache size and RI distributions for affine loops?
- RQ2Can imaginary reuses resolve the cold-start miss dilemma and yield correct working-set and miss-polynomial predictions?
- RQ3What is the computational cost of deriving locality polynomials, and how accurate are they compared to hardware simulations?
- RQ4How can the affine MLIR representation be used to compute complete RI distributions with Barvinok counting?
- RQ5What is the impact of loop fusion on predicted data movement and locality polynomials?
Key findings
- Cache-miss polynomials can be derived in linear time from RI distributions using the new algebraic locality theory.
- Imaginary reuses resolve the cold-start dilemma and preserve Denning Recursion correctness under Infinite Repeat.
- The RI Sum Invariance provides a practical symbolic test to verify RI values and portions consistency.
- Across 41 kernels and tensor operations, the method predicts cache misses with high accuracy against set-associative L1 simulations (up to 99.6% data movement prediction).
- Loop fusion affects locality polynomials and scaling, illustrating the framework’s ability to compare fused vs unfused configurations.

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.