12.07.2015 Views

Non-linear memory layout transformations and data prefetching ...

Non-linear memory layout transformations and data prefetching ...

Non-linear memory layout transformations and data prefetching ...

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

2.4 Cache replacement policies 17cache line within an 128-byte sector that contains the <strong>data</strong> needed. There is also a softwarecontrolled mechanism that fetches <strong>data</strong> into the caches using prefetch instructions. The hardwareinstruction fetcher reads instructions that are likely to be executed along the path predicted bythe branch target buer (BTB) into instruction streaming buers.Although usually benecial, <strong>prefetching</strong>, especially aggressive <strong>prefetching</strong> may reduce performance.In some cases prefetched <strong>data</strong> or instructions may not actually be used, but will stillconsume system resources - <strong>memory</strong> b<strong>and</strong>width <strong>and</strong> cache space. It is possible that a prefetchwill result in useless instructions or <strong>data</strong> replacing other instructions or <strong>data</strong> in the cache thatwill soon be needed. This eect is referred to as cache pollution. The eects of cache pollutionmost often increase as <strong>prefetching</strong> becomes more aggressive. Another prevalent eect ofaggressive <strong>prefetching</strong> is bus contention. Bus contention occurs when multiple <strong>memory</strong> accesseshave to compete to transfer <strong>data</strong> on the system bus. This eect can create a scenario where adem<strong>and</strong>-fetch is forced to wait for the completion of a useless prefetch, further increasing thenumber of cycles the processor is kept idle.On average, hardware <strong>prefetching</strong> benets performance <strong>and</strong> works with existing applications,without requiring extensive study of prefetch instructions. However it may not be optimal forany particular program especially for irregular access patterns <strong>and</strong> has a start-up penalty beforethe hardware prefetcher triggers <strong>and</strong> begins initiating fetches. This start-up delay has a largereect for short arrays when hardware <strong>prefetching</strong> generates a request for <strong>data</strong> beyond the endof an array (not actually utilized). There is a software alternative to hardware <strong>prefetching</strong>,the compiler-controlled <strong>prefetching</strong> - the compiler requests the <strong>data</strong> before it is needed. Thistechnique can improve <strong>memory</strong> access time signicantly, even irregular access patterns, if thecompiler is well implemented <strong>and</strong> can avoid references that are likely to be cache misses. Howeverit requires new instructions to be added which results to issuing port b<strong>and</strong>width overhead.2.4 Cache replacement policiesWhen a cache miss occurs, the desired <strong>data</strong> element should be retrieved from <strong>memory</strong> <strong>and</strong>placed in a cache location, according to the cache mapping organization. This may result in theeviction of another blocked <strong>data</strong> stored in the same location. In direct mapping, there existsonly a single c<strong>and</strong>idate. In set associative <strong>and</strong> fully associative mappings more than one cachelines are c<strong>and</strong>idate for eviction. The cache line selection is critical, as it aects performance.Which block should be replaced is determined by a replacement policy:The primary strategies used in practice are:• R<strong>and</strong>om: C<strong>and</strong>idate cache lines are r<strong>and</strong>omly selected. It counts on the principle ofuniform propagation of cache line allocation due to fortuity of selection. This strategy issimple to implement in hardware, but passes over the locality of references.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!