The placement of matrices when using XOR-based hashing Bavo Nootaert * , Hans Vandierendonck * , Koen De Bosschere * ELIS, Ghent University, Sint-Pietersnieuwstraat 41, 9000 Gent, Belgium ABSTRACT To reduce the number of conflicts in caches, hash function are used. One family of hash function that has been reported to perform well in the presence of stride patterns are based on XOR-ing address bits together. We show that, in contrast to traditional modulo-2 m -based hashing, for XOR- based hashing the placement of stride patterns and matrices has a significant impact on conflicts. KEYWORDS : cache, optimization, stride pattern, XOR-based hash function 1 Introduction Hash functions have been studied with the aim of avoiding conflict misses in caches [Schl93, Gonz97, Toph99]. In scientific programs, stride patterns are common. It is important to choose a hash function so as to map as many strides as possible with few conflicts. Conven- tional bit selection has the disadvantage of mapping even strides onto only one halve of the sets. A well studied alternative are the XOR-based hash functions [Frai85, Gonz97, Vand05], and a special subclass thereof, the polynomial hash functions [Rau91]. These functions are computed using arithmetic over GF(2) and can be evaluated using solely XOR-gates. In [Toph99] benchmarks are used to measure the performance of these hash functions. Analytical studies of XOR-based hash functions are usually limited to vector space pat- terns [Frai85, Vand05]. Analyzing these patterns is rather restrictive, since this class con- tains only certain strides, aligned to certain base addresses. In [Rau91], some properties are proven about the effect of polynomial hash functions on stride patterns starting at base ad- dress 0. Although some of the theorems can be extended to include a different base address [Noot05], they are aimed at determining equivalence among patterns, and generally can- not say whether a particular base address is actually a good choice. Indeed, the number of conflicts varies greatly depending on the alignment of the stride pattern. In Section 2 we model self interference in a matrix using stride patterns. In Section 3 we use this model to show the potential impact of the base address, independent of any particular benchmark.