# US 11,119,926 B2 · Region based directory scheme to adapt to large cache sizes

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

- Number: US 11,119,926 B2
- Document ID: US11119926B2
- Status: Granted
- Kind: B2
- Application number: 15/846,008
- Filed: 2017-12-18
- Published: 2019-06-20
- Granted: 2021-09-14
- Earliest claimed: 2017-12-18
- Assignees: Advanced Micro Devices, Inc.
- Applicants: Advanced Micro Devices, Inc.
- Inventors: Vydhyanathan Kalyanasundharam; Kevin M. Lepak; Amit P. Apte; Ganesh Balakrishnan; Eric Christopher Morton; Elizabeth M. Cooper; Ravindra N. Bhargava
- Web page: https://patentgrep.com/patent/US11119926B2

## CPC

- G06F 12/0817: using directory methods
- G06F 12/0811: with multilevel cache hierarchies
- G06F 12/0831: using a bus scheme, e.g. with bus monitoring or watching means
- G06F 12/0871: Allocation or management of cache space
- G06F 12/128: adapted to multidimensional cache systems, e.g. set-associative, multicache, multiset or multilevel
- G06F 2212/283: Plural cache memories
- G06F 2212/604: Details relating to cache allocation
- G06F 2212/621: Coherency control relating to peripheral accessing, e.g. from DMA or I/O device
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Systems, apparatuses, and methods for maintaining a region-based cache directory are disclosed. A system includes multiple processing nodes, with each processing node including a cache subsystem. The system also includes a cache directory to help manage cache coherency among the different cache subsystems of the system. In order to reduce the number of entries in the cache directory, the cache directory tracks coherency on a region basis rather than on a cache line basis, wherein a region includes multiple cache lines. Accordingly, the system includes a region-based cache directory to track regions which have at least one cache line cached in any cache subsystem in the system. The cache directory includes a reference count in each entry to track the aggregate number of cache lines that are cached per region. If a reference count of a given entry goes to zero, the cache directory reclaims the given entry.

## Claims

### Claim 1

A system comprising:
a plurality of processing nodes, wherein each processing node comprises one or more processors and a cache subsystem;
a memory; and
a cache directory configured to:
maintain an entry for each region of memory which has at least one cache line cached in any cache subsystem of the system, wherein a region comprises a plurality of cache lines;
maintain an aggregate state for each entry of the cache directory;
track whether regions are shared or private, wherein a shared region has one or more cache lines stored by multiple clusters and a private region has cache lines stored by only a single cluster;
interpret a first field of a first entry corresponding to a first region as a cluster valid field that indicates which clusters store a cache line of the first region, responsive to detecting a change in status of the first region from private to shared; and
interpret a first field of the first entry as a central processing unit valid field that indicates which central processing units of a cluster store a cache line of the first region, responsive to determining the first region is private.

### Claim 2 (depends on 1)

The system as recited in claim 1, wherein the cache directory is further configured to:
allocate a first entry for the first region responsive to receiving an indication that a first cache line of the first region is being cached by a first cache subsystem of the system;
initialize a reference count of the first entry to one; and
increment the reference count of the first entry responsive to receiving an indication that a second cache line of the first region is being cached by a second cache subsystem of the system.

### Claim 3 (depends on 1)

The system as recited in claim 1, wherein a cluster comprises a group of processors.

### Claim 4 (depends on 1)

The system as recited in claim 1, wherein the cache directory is further configured to:
maintain a first array to track portions of memory at a first granularity;
maintain a second array to track portions of memory at a second granularity, wherein the second granularity is a finer granularity than the first granularity;
perform lookups to the first and second arrays in parallel in response to receiving a given memory request; and
generate a probe based only on data extracted from a matching entry of the second array responsive to the lookups hitting in both the first and second arrays.

### Claim 5 (depends on 1)

The system as recited in claim 1, the cache directory is further configured to maintain the aggregate state for a corresponding region as:
a dirty coherency state if any cache line of the plurality of cache lines in the corresponding region has a dirty coherency state; and
a shared coherency state if any cache line of the plurality of cache lines in the corresponding region has a shared coherency state.

### Claim 6 (depends on 1)

The system as recited in claim 1, wherein the cache directory is further configured to:
monitor reference count fields of entries in a first array;
start tracking a given region on a finer granularity basis responsive to detecting a reference count for the given region has exceeded a threshold; and
create an entry in a second array responsive to receiving a memory request targeting the given region after detecting that the reference count has exceeded the threshold.

### Claim 7

A method comprising:
maintaining, in a cache directory, an entry for each region of memory which has at least one cache line cached in any cache subsystem of a system, wherein a region comprises a plurality of cache lines;
maintaining an aggregate state for each entry of the cache directory
tracking whether regions are shared or private, wherein a shared region has one or more cache lines stored by multiple clusters and a private region has cache lines stored by only a single cluster;
interpreting a first field of a first entry corresponding to a first region as a cluster valid field that indicates which clusters store a cache line of the first region, responsive to detecting a change in status of the first region from private to shared; and
interpreting a first field of the first entry as a central processing unit valid field that indicates which central processing units of a cluster store a cache line of the first region, responsive to determining the first region is private.

### Claim 8 (depends on 7)

The method as recited in claim 7, further comprising:
allocating a first entry for the first region responsive to receiving an indication that a first cache line of the first region is being cached by a first cache subsystem of the system;
initializing a reference count of the first entry to one; and
incrementing the reference count of the first entry responsive to receiving an indication that a second cache line of the first region is being cached by a second cache subsystem of the system.

### Claim 9 (depends on 8)

The method as recited in claim 8, wherein a cluster comprises a group of processors.

### Claim 10 (depends on 7)

The method as recited in claim 7, further comprising:
maintaining a first array to track portions of memory at a first granularity;
maintaining a second array to track portions of memory at a second granularity, wherein the second granularity is a finer granularity than the first granularity; and
performing lookups to the first and second arrays in parallel in response to receiving a given memory request; and
generating a probe based only on data extracted from a matching entry of the second array responsive to the lookups hitting in both the first and second arrays.

### Claim 11 (depends on 7)

The method as recited in claim 7, wherein the method further comprises maintaining the aggregate state for a corresponding region as:
a dirty coherency state if any cache line of the plurality of cache lines in the corresponding region has a dirty coherency state; and
a shared coherency state if any cache line of the plurality of cache lines in the corresponding region has a shared coherency state.

### Claim 12 (depends on 7)

The method as recited in claim 7, further comprising:
monitoring reference count fields of entries in a first array;
starting tracking a given region on a finer granularity basis responsive to detecting a reference count for the given region has exceeded a threshold; and
creating an entry in a second array responsive to receiving a memory request targeting the given region after detecting that the reference count has exceeded the threshold.

### Claim 13

An apparatus comprising:
a cache directory configured to:
maintain an entry for each region of memory which has at least one cache line cached in any of a plurality of cache subsystems, wherein a region comprises a plurality of cache lines;
maintain an aggregate state for each entry of the cache directory
track whether regions are shared or private, wherein a shared region has one or more cache lines stored by multiple clusters and a private region has cache lines stored by only a single cluster;
interpret a first field of a first entry corresponding to a first region as a cluster valid field that indicates which clusters store a cache line of the first region, responsive to detecting a change in status of the first region from private to shared; and
interpret a first field of the first entry as a central processing unit valid field that indicates which central processing units of a cluster store a cache line of the first region, responsive to determining the first region is private.

### Claim 14 (depends on 13)

The apparatus as recited in claim 13, wherein the cache directory is further configured to:
allocate a first entry for the first region responsive to receiving an indication that a first cache line of the first region is being cached by a first cache subsystem of the system;
initialize a reference count of the first entry to one; and
increment the reference count of the first entry responsive to receiving an indication that a second cache line of the first region is being cached by a second cache subsystem of the system.

### Claim 15 (depends on 14)

The apparatus as recited in claim 14, wherein a cluster comprises a group of processors.

### Claim 16 (depends on 13)

The apparatus as recited in claim 13, wherein the cache directory is further configured to:
maintain a first array to track portions of memory at a first granularity;
maintain a second array to track portions of memory at a second granularity, wherein the second granularity is a finer granularity than the first granularity; and
perform lookups to the first and second arrays in parallel in response to receiving a given memory request; and
generate a probe based only on data extracted from a matching entry of the second array responsive to the lookups hitting in both the first and second arrays.

### Claim 17 (depends on 13)

The apparatus as recited in claim 13, wherein the cache directory is further configured to maintain the aggregate state for a corresponding region as:
a dirty coherency state if any cache line of the plurality of cache lines in the corresponding region has a dirty coherency state; and
a shared coherency state if any cache line of the plurality of cache lines in the corresponding region has a shared coherency state.
