# US 2017/0293571 A1 · Cost-aware cache replacement

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2017/0293571 A1
- Document ID: US20170293571A1
- Status: Published application
- Kind: A1
- Application number: 15/271,167
- Filed: 2016-09-20
- Published: 2017-10-12
- Earliest claimed: 2016-04-08
- Assignees: QUALCOMM Incorporated
- Applicants: QUALCOMM Incorporated
- Inventors: Rami Mohammad A. AL SHEIKH; Shivam PRIYADARSHI; Harold Wade CAIN, III
- Web page: https://patentgrep.com/patent/US20170293571A1

## CPC

- G06F 12/124: {being minimized, e.g. non MRU}
- G06F 12/123: with age lists, e.g. queue, most recently used [MRU] list or least recently used [LRU] list
- G06F 12/127: using additional replacement algorithms
- G06F 12/128: adapted to multidimensional cache systems, e.g. set-associative, multicache, multiset or multilevel
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Systems and methods relate to cost-aware cache management policies. In a cost-aware least recently used (LRU) replacement policy, temporal locality as well as miss cost is taken into account in selecting a cache line for replacement, wherein the miss cost is based on an associated operation type including instruction cache read, data cache read, data cache write, prefetch, and write back. In a cost-aware dynamic re-reference interval prediction (DRRIP) based cache management policy, miss costs associated with operation types pertaining to a cache line are considered for assigning re-reference interval prediction values (RRPV) for inserting the cache line, pursuant to a cache miss and for updating the RRPV upon a hit for the cache line. The operation types comprise instruction cache access, data cache access, prefetch, and write back. These policies improve victim selection, while minimizing cache thrashing and scans.

## Claims

### Claim 1

A method of cache management, the method comprising:
identifying a number of least recently used cache lines in a cache;
determining miss costs associated with the identified number of least recently used cache lines; and
replacing a cache line with a lowest miss cost among the identified number of least recently used cache lines.

### Claim 2 (depends on 1)

The method of claim 1, wherein the number of least recently used cache lines belong to multiple ways of a set of the cache.

### Claim 3 (depends on 2)

The method of claim 2, comprising recording an order of use of the cache lines of the multiple ways in a least recently used (LRU) stack associated with the set, wherein the number of least recently used cache lines corresponds to a portion of the LRU stack.

### Claim 4 (depends on 3)

The method of claim 3, wherein the number of least recently used cache lines is fixed.

### Claim 5 (depends on 3)

The method of claim 3, comprising dynamically selecting the number of least recently used cache lines for follower sets of the cache based on a set dueling between a first leader set with a first number of least recently used cache lines corresponding to a first portion of the LRU stack and a second leader set with a second number of least recently used cache lines corresponding to a second portion of the LRU stack.

### Claim 6 (depends on 5)

The method of claim 5, comprising dynamically selecting the number of least recently used cache lines for the follower sets based on a saturating counter for tracking performances of the first leader set and the second leader set.

### Claim 7 (depends on 1)

The method of claim 1, wherein the miss costs are based on an operation type associated with the cache lines, the operation types in order of highest to lowest cost being instruction cache read, data cache read, data cache write, prefetch, and write back.

### Claim 8

An apparatus comprising:
a cache; and
a cache controller configured to manage the cache, wherein the cache controller is configured to:
identify a number of least recently used cache lines in the cache;
determine miss costs associated with the identified number of least recently used cache lines; and
replace a cache line with a lowest miss cost among the identified number of least recently used cache lines.

### Claim 9 (depends on 8)

The apparatus of claim 8, wherein the number of least recently used cache lines belong to multiple ways of a set of the cache.

### Claim 10 (depends on 9)

The apparatus of claim 9, further comprising a least recently used (LRU) stack associated with the set, wherein the cache controller is further configured to record an order of use of the cache lines of the multiple ways in the LRU stack, wherein the number of least recently used cache lines corresponds to a portion of the LRU stack.

### Claim 11 (depends on 10)

The apparatus of claim 10, wherein the number of least recently used cache lines is fixed.

### Claim 12 (depends on 10)

The apparatus of claim 10, wherein the cache controller is configured to dynamically select the number of least recently used cache lines for follower sets of the cache based on a set dueling between a first leader set with a first number of least recently used cache lines corresponding to a first portion of the LRU stack and a second leader set with a second number of least recently used cache lines corresponding to a second portion of the LRU stack.

### Claim 13 (depends on 12)

The apparatus of claim 12, further comprising a saturating counter configured to track performances of the first leader set and the second leader set, wherein the cache controller is configured to dynamically selecting the number of least recently used cache lines for the follower sets based on the saturating counter.

### Claim 14 (depends on 8)

The apparatus of claim 8, wherein the miss costs are based on an operation type associated with the cache lines, the operation types in order of highest to lowest cost being instruction cache read, data cache read, data cache write, prefetch, and write back.

### Claim 15 (depends on 8)

The apparatus of claim 8, integrated in device selected from the group consisting of a set top box, a music player, a video player, an entertainment unit, a navigation device, a personal digital assistant (PDA), a fixed location data unit, a computer, a laptop, a tablet, a communications device, and a mobile phone.

### Claim 16

A non-transitory computer readable storage medium comprising code, which, when executed by a processor, causes the processor to perform operations for cache management, the non-transitory computer readable storage medium comprising:
code for identifying a number of least recently used cache lines in a cache;
code for determining miss costs associated with the identified number of least recently used cache lines; and
code for replacing a cache line with a lowest miss cost among the identified number of least recently used cache lines.

### Claim 17 (depends on 16)

The non-transitory computer readable storage medium of claim 16, wherein the number of least recently used cache lines belong to multiple ways of a set of the cache.

### Claim 18 (depends on 17)

The non-transitory computer readable storage medium of claim 17, further comprising code for recording an order of use of the cache lines of the multiple ways in a least recently used (LRU) stack associated with the set, wherein the number of least recently used cache lines corresponds to a portion of the LRU stack.

### Claim 19 (depends on 18)

The non-transitory computer readable storage medium of claim 18, wherein the number of least recently used cache lines is fixed.

### Claim 20 (depends on 18)

The non-transitory computer readable storage medium of claim 18, further comprising code for dynamically selecting the number of least recently used cache lines for follower sets of the cache based on a set dueling between a first leader set with a first number of least recently used cache lines corresponding to a first portion of the LRU stack and a second leader set with a second number of least recently used cache lines corresponding to a second portion of the LRU stack.

### Claim 21 (depends on 19)

The non-transitory computer readable storage medium of claim 19, further comprising code for dynamically selecting the number of least recently used cache lines for the follower sets based on a saturating counter for tracking performances of the first leader set and the second leader set.

### Claim 22 (depends on 16)

The non-transitory computer readable storage medium of claim 16, wherein the miss costs are based on an operation type associated with the cache lines, the operation types in order of highest to lowest cost being instruction cache read, data cache read, data cache write, prefetch, and write back.

### Claim 23

A method of cache management, the method comprising:
determining a re-reference interval prediction value (RRPV) for one or more of insertion or hit update of a cache line of a cache, based on miss costs associated with operation types pertaining to the cache line; and
determining a cost-aware dynamic re-reference interval prediction (DRRIP) for the cache line based on the RRPV.

### Claim 24 (depends on 23)

The method of claim 23, wherein the operation types comprise instruction cache access, data cache access, prefetch, and write back.

### Claim 25 (depends on 23)

The method of claim 23, comprising pursuant to a cache miss for a contender cache line, identifying a victim cache line to be replaced, wherein the victim cache line has the highest RRPV among cache lines in the cache.

### Claim 26 (depends on 23)

The method of claim 23, comprising determining the RRPVs of follower sets of the cache based on set-dueling between RRPVs leader sets with RRPVs set based on cost-aware static re-reference interval prediction (SRRIP) and cost-aware bi-modal re-reference interval prediction (BRRIP).

### Claim 27 (depends on 26)

The method of claim 26, comprising assigning an RRPV of “0” or “near-immediate”, associated with least likely to be replaced, for insertion of the cache line pursuant to an instruction cache miss, for cost-aware SRRIP and cost-aware BRRIP.

### Claim 28 (depends on 26)

The method of claim 26, comprising assigning an RRPV of “2” or “far”, associated with more likely to be replaced, for insertion of the cache line pursuant to a data cache miss, for cost-aware BRRIP.

### Claim 29 (depends on 26)

The method of claim 26, comprising adaptively assigning an RRPV of one of: “2” or “far”, associated with more likely to be replaced, or “3” or “distant”, associated with most likely to be replaced, for insertion of the cache line pursuant to a write back of the cache line to the cache, for cost-aware SRRIP.

### Claim 30 (depends on 26)

The method of claim 26, comprising assigning an RRPV of “3” or “distant,” associated with most likely to be replaced, for insertion of the cache line pursuant to a prefetch of the cache line to the cache for cost-aware SRRIP.

### Claim 31 (depends on 26)

The method of claim 26, comprising adaptively assigning an RRPV of “0” or “near-immediate”, associated with least likely to be replaced, or not updating the RRPV, for a hit update of the cache line for cost-aware SRRIP and cost-aware BRRIP.

### Claim 32

An apparatus comprising:
a cache; and
a cache controller configured to manage the cache, wherein the cache controller is configured:
determine a re-reference interval prediction value (RRPV) for one or more of insertion or hit update of a cache line of a cache, based on miss costs associated with operation types pertaining to the cache line; and
determine a cost-aware dynamic re-reference interval prediction (DRRIP) for the cache line based on the RRPV.

### Claim 33 (depends on 32)

The apparatus of claim 32, wherein the operation types comprise instruction cache access, data cache access, prefetch, and write back.

### Claim 34 (depends on 32)

The apparatus of claim 32, wherein the cache controller is configured to identify a victim cache line to be replaced pursuant to a cache miss for a contender cache line, wherein the victim cache line has the highest RRPV among cache lines in the cache.

### Claim 35 (depends on 32)

The apparatus of claim 32, wherein the cache controller is configured to determine the RRPVs of follower sets of the cache based on set-dueling between RRPVs leader sets with RRPVs set based on cost-aware static re-reference interval prediction (SRRIP) and cost-aware bi-modal re-reference interval prediction (BRRIP).

### Claim 36 (depends on 35)

The apparatus of claim 35, wherein the cache controller is further configured to:
assign an RRPV of “0” or “near-immediate”, associated with least likely to be replaced, for insertion of the cache line pursuant to an instruction cache miss, for cost-aware SRRIP and cost-aware BRRIP;
assign an RRPV of “2” or “far”, associated with more likely to be replaced, for insertion of the cache line, pursuant to a data cache miss, for cost-aware BRRIP;
adaptively assign an RRPV of one of: “2” or “far”, associated with more likely to be replaced, or “3” or “distant”, associated with most likely to be replaced, for insertion of the cache line, pursuant to a write back of the cache line to the cache, for cost-aware SRRIP;
assign an RRPV of “3” or “distant,” associated with most likely to be replaced, for insertion of the cache line pursuant to a prefetch of the cache line to the cache, for cost-aware SRRIP;
adaptively assign an RRPV of “0” or “near-immediate”, associated with least likely to be replaced, or not updating the RRPV, for a hit update of the cache line, for cost-aware SRRIP and cost-aware BRRIP; or
a combination thereof.

### Claim 37 (depends on 32)

The apparatus of claim 32, integrated in device selected from the group consisting of a set top box, a music player, a video player, an entertainment unit, a navigation device, a personal digital assistant (PDA), a fixed location data unit, a computer, a laptop, a tablet, a communications device, and a mobile phone.

### Claim 38

A non-transitory computer readable storage medium comprising code, which, when executed by a processor, causes the processor to perform operations for cache management, the non-transitory computer readable storage medium comprising:
code for determining a re-reference interval prediction value (RRPV) for one or more of insertion or hit update of a cache line of a cache, based on miss costs associated with operation types pertaining to the cache line; and
code for determining a cost-aware dynamic re-reference interval prediction (DRRIP) for the cache line based on the RRPV.

### Claim 39 (depends on 38)

The non-transitory computer readable storage medium of claim 38, wherein the operation types comprise instruction cache access, data cache access, prefetch, and write back.

### Claim 40 (depends on 38)

The non-transitory computer readable storage medium of claim 38, further comprising code for identifying a victim cache line to be replaced, pursuant to a cache miss for a contender cache line, wherein the victim cache line has the highest RRPV among cache lines in the cache.

### Claim 41 (depends on 38)

The non-transitory computer readable storage medium of claim 38, further comprising code for determining the RRPVs of follower sets of the cache based on set-dueling between RRPVs leader sets with RRPVs set based on cost-aware static re-reference interval prediction (SRRIP) and cost-aware bi-modal re-reference interval prediction (BRRIP).

### Claim 42 (depends on 41)

The non-transitory computer readable storage medium of claim 41, comprising code for:
assigning an RRPV of “0” or “near-immediate”, associated with least likely to be replaced, for insertion of the cache line pursuant to an instruction cache miss, for cost-aware SRRIP and cost-aware BRRIP;
assigning an RRPV of “2” or “far”, associated with more likely to be replaced, for insertion of the cache line pursuant to a data cache miss, for cost-aware BRRIP;
adaptively assigning an RRPV of one of: “2” or “far”, associated with more likely to be replaced, or “3” or “distant”, associated with most likely to be replaced, for insertion of the cache line pursuant to a write back of the cache line to the cache, for cost-aware SRRIP;
assigning an RRPV of “3” or “distant,” associated with most likely to be replaced, for insertion of the cache line pursuant to a prefetch of the cache line to the cache for cost-aware SRRIP;
adaptively assigning an RRPV of “0” or “near-immediate”, associated with least likely to be replaced, or not updating the RRPV, for a hit update of the cache line for cost-aware SRRIP and cost-aware BRRIP; or
a combination thereof. QC162004
