Re: Non Power of 2 Cache Sizes



Sander Vesik <sander@xxxxxxxxxxxxxxxxxxx> writes:
>Terje Mathisen <terje.mathisen@xxxxxxxxxxxxx> wrote:
>>
>> All caches use (extremely simple) hash functions. Doing mod(prime)
>> instead of mod(2^n) just reduces the number of bad interactions. :-)
>
>using mod for the hash is probably fundamentaly wrong way to
>go about it though.

Why?

Apart from being simple to implement, the mod approach has the
following benefits:

- Its performance effects (in particular, the worst-case performance)
are relatively easy to understand, making it easy to avoid them.

- Spatial locality performs well with it. If I have, e.g., a 4KB way
size, then I know that I can access a 4KB array without incurring any
conflict misses. If, OTOH, i had a random-style hash function, even
two cache lines that are adjacent in virtual address space could
conflict with each other. BTW, that's one of the benefits of using
page colouring over arbitrary page mapping: It performs better in the
presence of spatial locality. Of course, with enough associativity in
the cache, it does not matter.

- anton
--
M. Anton Ertl Some things have to be seen to be believed
anton@xxxxxxxxxxxxxxxxxxxxxxxxxx Most things have to be believed to be seen
http://www.complang.tuwien.ac.at/anton/home.html
.



Relevant Pages

  • Re: WeakRef Hash
    ... I only need to support and =, not the whole range of Hash functions. ... def initialize(cache = Hash.new) ... I'm still interested in seeing a WeakRefHash though, if anyone has rolled something similar in the past... ...
    (comp.lang.ruby)
  • Re: Re: Re: No Heartbeat - CPR Dont Help
    ... >the latest zone files but instead is recieving the outdated file from a copy ... >its cache or else see the solutions on the following support pages. ... \downloaded programs folder. ... to be the only one that contains hrtbeat.inf, all conflict. ...
    (microsoft.public.games.zone)
  • Re: Complex sub-block (bank) indexing
    ... Using Prime Numbers for Cache Indexing to Eliminate Conflict Misses ... you probably need to have the same cache line size everywhere, so prime cache line sizes are a stretch too far given compatibility concerns. ...
    (comp.arch)
  • Re: Evaluation of caches
    ... evaluation of different cache implementations. ... conflict cache misses that occur when benchmarks ... set of applications. ... applications and has a short section on associativity. ...
    (comp.dsp)
  • Re: Alpha 21264? L2 cache (was Re: Off-chip cache considerations?)
    ... >> the off-chip POWER cache is eDRAM, but they don't seem to charge a great ... >skewing function to reduce conflict misses. ...
    (comp.arch)