In modern micro-architectures, computation speed is often reduced by cache misses. Cache analysis is therefore imperative to obtain effective optimization. We present an analytical technique based on reuse distances that focuses on efficiently determining the behavior of fully associative caches and extends to set-associative caches. In this technique, the number of cache misses is obtained by counting the number of integer points in a parameterized polytope.
It is well know that this parameterized count can be represented by an Ehrhart polynomial. Previously, interpolation was used to obtain these polynomials, but this technique has some disadvantages, most notably that under certain conditions it fails to produce a solution. Our main contribution is a novel method for calculating Ehrhart polynomials analytically. It extends an existing method, based on Barvinok`s decomposition, for counting the number of points in a non-parameterized polytope. Our technique always produces a solution and is usually faster than interpolation.