Table of Contents
Fetching ...

Fully Symbolic Analysis of Loop Locality: Using Imaginary Reuse to Infer Real Performance

Yifan Zhu, Yekai Pan, Chen Ding, Yanghui Wu

TL;DR

The theory is fully symbolic and derives locality as polynomials, and the compiler analysis supports affine loop nests, which derive cache-performance scaling in quadratic and reciprocal expressions and are more general and precise than empirical scaling rules.

Abstract

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.

Fully Symbolic Analysis of Loop Locality: Using Imaginary Reuse to Infer Real Performance

TL;DR

The theory is fully symbolic and derives locality as polynomials, and the compiler analysis supports affine loop nests, which derive cache-performance scaling in quadratic and reciprocal expressions and are more general and precise than empirical scaling rules.

Abstract

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.
Paper Structure (36 sections, 4 theorems, 12 equations, 12 figures, 3 tables, 1 algorithm)

This paper contains 36 sections, 4 theorems, 12 equations, 12 figures, 3 tables, 1 algorithm.

Key Result

theorem 1

Under Infinite Repeat, Denning Recursion computes the average working-set size correctly.

Figures (12)

  • Figure 1: Infinite repeat creates imaginary reuses which are used in symbolic locality analysis
  • Figure 2: An example of Infinite Repeat, with first-touch accesses (red), real reuses (blue), and imaginary reuses (green)
  • Figure 3: Workflow diagram showing the existing Polygeist pipeline and our Symbolic Locality Compiler, interconnected via MLIR Affine representation.
  • Figure 4: Formal Semantics of Timestamp Space Construction
  • Figure 5: Example Timestamp Space Derivation (Symbols are explained in Example \ref{['exp:local-example']}).
  • ...and 7 more figures

Theorems & Definitions (8)

  • theorem 1: Working-set Correctness
  • proof
  • lemma 1: Zero Footprint
  • definition 1: Backward Reuse Interval
  • theorem 2
  • proof
  • theorem 3
  • proof