Claims
- 1. A microprocessor, comprising:
a cache memory; a prefetch buffer, coupled to said cache memory, for receiving a prefetched cache line from a system memory; and control logic, coupled to said prefetch buffer, for selectively retiring said prefetched cache line into said cache memory based on accesses to said prefetched cache line substantially contemporaneous with prefetching said prefetched cache line into said prefetch buffer.
- 2. The microprocessor of claim 1, wherein said control logic selectively retires said prefetched cache line into said cache memory in response to a subsequent request to prefetch another cache line into said prefetch buffer.
- 3. The microprocessor of claim 1, further comprising:
a counter, coupled to said control logic, for counting a number of times said prefetched cache line in said prefetch buffer is accessed.
- 4. The microprocessor of claim 3, wherein said control logic selectively retires said prefetched cache line into said cache memory based on said accesses to said prefetched cache line indicated by said number stored in said counter.
- 5. The microprocessor of claim 4, wherein said cache memory comprises an N-way set associative cache memory.
- 6. The microprocessor of claim 5, further comprising:
an address input to said N-way set associative cache memory, for selecting an N-way set in said cache memory.
- 7. The microprocessor of claim 6, further comprising:
N counters, coupled to said control logic, each for counting a number of times a corresponding one of said N ways of said selected set is accessed after said prefetched cache line is prefetched.
- 8. The microprocessor of claim 7, wherein said control logic selectively retires said prefetched cache line into said cache memory based on said number stored in said counter relative to said numbers stored in said N counters.
- 9. The microprocessor of claim 8, wherein said control logic selectively retires said prefetched cache line into said cache memory in response to a subsequent request to prefetch another cache line into said prefetch buffer.
- 10. The microprocessor of claim 8, further comprising:
selection logic, coupled to said N counters, for selecting a smallest of said number of accesses stored in said N counters.
- 11. The microprocessor of claim 10, wherein said control logic retires said prefetched cache line into said cache memory if said number stored in said counter is greater than said smallest number of accesses selected by said selection logic.
- 12. The microprocessor of claim 11, wherein said control logic discards said prefetched cache line if said number stored in said counter is not greater than said smallest number of accesses selected by said selection logic.
- 13. The microprocessor of claim 12, wherein said selection logic also specifies one of said N ways associated with said N counters storing said smallest of said number of accesses.
- 14. The microprocessor of claim 13, wherein said control logic retires said prefetched cache line into said cache memory into said specified one of said N ways associated with said N counters storing said smallest of said number of accesses.
- 15. The microprocessor of claim 10, wherein said control logic retires said prefetched cache line into said cache memory if said number stored in said counter is greater than or equal to said smallest number of accesses selected by said selection logic.
- 16. The microprocessor of claim 15, wherein said control logic discards said prefetched cache line if said number stored in said counter is not greater than or equal to said smallest number of accesses selected by said selection logic.
- 17. The microprocessor of claim 16, wherein said selection logic also specifies one of said N ways associated with said N counters storing said smallest of said number of accesses.
- 18. The microprocessor of claim 17, wherein said control logic retires said prefetched cache line into said cache memory into said specified one of said N ways associated with said N counters storing said smallest of said number of accesses.
- 19. The microprocessor of claim 5, wherein said control logic retires said prefetched cache line into said cache memory in response to invalidation of one of said N ways of said selected set.
- 20. The microprocessor of claim 19, wherein said control logic retires said prefetched cache line into said cache memory into said invalidated of one of said N ways of said selected set.
- 21. The microprocessor of claim 5, wherein said N is 1.
- 22. The microprocessor of claim 5, wherein said N is greater than 1.
- 23. The microprocessor of claim 1, further comprising:
a register, coupled to said control logic, for storing an address of said prefetched cache line.
- 24. The microprocessor of claim 1, wherein said prefetched cache line is prefetched from said system memory in response to a miss of an address in said cache memory.
- 25. The microprocessor of claim 24, wherein said prefetched cache line follows a cache line implicated by said address missing in said cache memory.
- 26. The microprocessor of claim 1, wherein said control logic retires said prefetched cache line into said cache memory if said prefetched cache line is contemporaneously accessed at least as frequently as one or more candidate replacement cache lines in said cache memory.
- 27. The microprocessor of claim 1, wherein said control logic retires said prefetched cache line into said cache memory if said prefetched cache line is accessed prior to generation of a new prefetch request of another cache line into said prefetch buffer.
- 28. An apparatus in a microprocessor for selectively retiring prefetched cache lines into a cache memory of the microprocessor based on accesses to the prefetched cache line, comprising:
a prefetch buffer, for storing a prefetched cache line; a register, coupled to said prefetch buffer, for storing a prefetch address of said prefetched cache line; control logic, coupled to said register, for receiving an access address of memory access operations, and for comparing said prefetch address with said access address; and a counter, coupled to said control logic, for storing a count of accesses to the prefetched cache line, wherein said control logic increments said counter if said access address matches said prefetch address; wherein said control logic selectively retires the prefetched cache line to the cache memory based on said count.
- 29. The apparatus of claim 28, wherein said memory access operations comprise load operations.
- 30. The apparatus of claim 28, wherein said memory access operations comprise store operations.
- 31. The apparatus of claim 28, wherein said memory access operations comprise snoop operations.
- 32. The apparatus of claim 28, wherein said memory access operations comprise a combination of load, store, and/or snoop operations.
- 33. The apparatus of claim 28, further comprising:
a second counter, coupled to said control logic, for storing a second count of accesses to a candidate cache line in the cache memory to be replaced by said prefetched cache line.
- 34. The apparatus of claim 33, wherein said control logic retires said prefetched cache line to the cache memory if said count is greater than said second count.
- 35. The apparatus of claim 34, wherein said control logic overwrites said prefetched cache line in said prefetch buffer with a new prefetched cache line if said count is not greater than said second count.
- 36. The apparatus of claim 35, wherein said candidate cache line comprises one of a plurality of cache lines in a set of the cache memory selected by said prefetch address.
- 37. The apparatus of claim 36, wherein said candidate cache line comprises one of said plurality of cache lines in said set being least frequently accessed.
- 38. The apparatus of claim 36, wherein said candidate cache line comprises one of said plurality of cache lines in said set being least recently accessed.
- 39. An apparatus in a microprocessor for selectively retiring a prefetched cache line into a cache memory of the microprocessor, comprising:
a prefetch buffer, for storing the prefetched cache line; a counter, coupled to said prefetch buffer, for storing a count of accesses to a replacement candidate line in the cache; and control logic, coupled to said counter, for selectively retiring the prefetched cache line to the cache based on said count in said counter.
- 40. The apparatus of claim 39, wherein said control logic retires the prefetched cache line to the cache if said count is zero.
- 41. The apparatus of claim 40, wherein said control logic does not retire the prefetched cache line to the cache if said count is non-zero.
- 42. The apparatus of claim 39, further comprising:
a threshold register, coupled to said control logic, for storing a threshold value.
- 43. The apparatus of claim 42, wherein said control logic retires the prefetched cache line to the cache if said count is greater than said threshold value.
- 44. The apparatus of claim 43, wherein said control logic does not retire the prefetched cache line to the cache if said count is not greater than said threshold value.
- 45. The apparatus of claim 42, wherein said threshold value is programmable.
- 46. The apparatus of claim 39, further comprising:
a register, coupled to said control logic, for storing a value specifying a candidate way of the cache, said candidate way storing said replacement candidate line.
- 47. A method for selectively retiring a prefetched cache line from a prefetch buffer to a cache in a microprocessor, the method comprising:
maintaining a first count of accesses to the prefetched cache line; receiving a request to prefetch a new cache line into the prefetch buffer; determining in response to said receiving said request whether a second count of accesses to a replacement candidate line in the cache is less than said first count; overwriting the prefetched cache line in the prefetch buffer with said new cache line if said second count is less than said first count.
- 48. The method of claim 47, further comprising:
prefetching the prefetched cache line into the prefetch buffer in response to a miss in the cache, prior to said maintaining said first count.
- 49. A method for selectively retiring a prefetched cache line from a prefetch buffer to a cache in a microprocessor, the method comprising:
prefetching the prefetched cache line into the prefetch buffer in response to a miss in the cache; receiving a request to prefetch a new cache line into the prefetch buffer; determining whether a replacement candidate line in the cache is invalid; replacing said replacement candidate line in the cache with the prefetched cache line if said replacement candidate line is invalid.
- 50. The method of claim 49, wherein said determining is performed in response to a request to overwrite the prefetched cache line in the prefetch buffer.
- 51. The method of claim 50, further comprising:
replacing the prefetched cache line in the prefetch buffer without retiring the prefetched cache line into the cache if said replacement candidate line is valid.
- 52. A computer data signal embodied in a transmission medium, comprising:
computer-readable program code for providing a microprocessor, said program code comprising:
first program code for providing a cache memory; second program code for providing a prefetch buffer, coupled to said cache memory, for receiving a prefetched cache line from a system memory; and third program code for providing control logic, coupled to said prefetch buffer, for selectively retiring said prefetched cache line into said cache memory based on accesses to said prefetched cache line substantially contemporaneous with prefetching said prefetched cache line into said prefetch buffer.
PRIORITY INFORMATION
[0001] This application claims priority based on U.S. Provisional Application, Serial No. 60/390054, filed Jun. 18, 2002, entitled METHOD FOR SELECTIVE PREFETCH RETIRE.
Provisional Applications (1)
|
Number |
Date |
Country |
|
60390054 |
Jun 2002 |
US |