Patent ID: 8103832

Claim:
A method of prefetching streams of varying prefetch depth, comprising: monitoring a plurality of load requests from a processing unit for data in a prefetch buffer and determining an access pattern associated with the plurality of load requests; adjusting a prefetch depth according to the access pattern; and prefetching data of prefetch depth to the prefetch buffer; wherein in response to an occurrence of a load miss on requested data contained in cache line n, determining whether the cache line n exists in the prefetch buffer, and if the cache line n exists in the prefetch buffer, fetching next cache line n+1 into the prefetch buffer and setting a prefetch on hit flag associated with the cache line n+1 to true if the next cache line n+1 does not exist in the prefetch buffer, and if the cache line n does not exist in the prefetch buffer, checking a history buffer for an address associated with the cache line n and if the history buffer contains the address associated with the cache line n, fetching the cache line n into the prefetch buffer and setting a prefetch on hit flag associated with the cache line n to true, and if the history buffer does not contain the address associated with the cache line n, inserting the address associated with the cache line n and an address associated with the cache line n+1 into the history buffer, and if the next cache line n+1 exists in the prefetch buffer, determining whether the access pattern is single memory stream access pattern or whether the prefetch on hit flag associated with the cache line n+1 is set to true and if the access pattern is single memory access pattern or the prefetch on hit flag associated with the cache line n+1 is set to true or both, fetching cache line n+2 into the prefetch buffer if the cache line n+2 is not in the prefetch buffer, and setting a prefetch on hit flag associated with the cache line n+2 to true, and resetting the prefetch on hit flag associated with the cache line n to false; and if the access pattern is not single memory access pattern and the prefetch on hit flag associated with the cache line n+1 is not set to true, resetting the prefetch on hit flag associated with the cache line n to false.