A zone-based directory scheme that adapts to large cache sizes
By adopting a region-based cache directory scheme in multi-core computing systems, using reference counting and multi-granularity tracking mechanisms, the directory maintenance difficulty caused by the increase in cache size is solved, and data consistency management efficiency and system performance are improved.
Patent Information
- Application Number
- CN201880088582.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2017-12-18
- Filing Date
- 2018-09-19
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2038-09-19
AI Technical Summary
In multi-core computing systems, as cache size grows, maintaining a line-based cache directory becomes very difficult, resulting in inefficient data consistency management.
Adopt a region-based cache directory scheme, maintain reference counts and multi-granularity tracking mechanisms through each region, dynamically adjust the tracking granularity to reduce the directory size, and optimize the operation of the cache directory through reference counts and sector valid fields.
It effectively reduces the size of the cache directory, improves data consistency management efficiency, reduces probe bandwidth, and improves system performance.
Smart Images

Figure CN111684425B_ABST
Abstract
Description
Background Art
[0001] Related technical description
[0002] Computer systems use main memory that is typically formed from inexpensive and high-density dynamic random access memory (DRAM) chips. However, DRAM chips are subject to relatively long access times. To improve performance, data processors typically include at least one local high-speed memory called a cache. In a multi-core data processor, each data processor core may have its own dedicated first level (L1) cache, while other caches (e.g., second level (L2) cache, third level (L3) cache) are shared by the data processor cores.
[0003] A cache subsystem in a computing system includes a high-speed cache memory configured to store blocks of data. As used herein, a "block" is a group of bytes stored in contiguous memory locations that are treated as a unit for consistency purposes. As used herein, each of the terms "cache block," "block," "cache line," and "line" are interchangeable. In some embodiments, a block may also be a unit of allocation and deallocation in a cache. The number of bytes in a block varies according to design choice and may be of any size. In addition, each of the terms "cache tag," "cache line tag," and "cache block tag" are interchangeable.
[0004] In a multi-node computer system, special precautions must be taken to maintain the consistency of data being used by different processing nodes. For example, if a processor attempts to access data at a certain memory address, it must first determine whether the memory is stored in another cache and has been modified. In order to implement this cache consistency protocol, the cache typically contains multiple status bits to indicate the state of the cache line, thereby maintaining data consistency for the entire system. A common consistency protocol is called the "MOESI" protocol. According to the MOESI protocol, each cache line includes a status bit for indicating which MOESI state the line is in, and the status bit includes a bit indicating the following: the cache line has been modified (M), the cache line is exclusive (E) or shared (S), or the cache line is invalid (I). The occupied (O) state indicates that the line has been modified in one cache, there may be a shared copy in other caches, and the data in the memory is out of date.
[0005] The cache directory is a key building block in high-performance scalable systems. The cache directory is used to track the cache lines currently in use by the system. The cache directory improves both memory bandwidth and probe bandwidth by executing memory requests or probe requests only when needed. Logically, the cache directory resides at the master node of the cache line that enforces the cache consistency protocol. The working principle of the cache directory is inclusive (i.e., the lines present in the central processing unit (CPU) cache must be present in the cache directory). In a cache line-based directory scheme, each cache line is tracked separately. Therefore, the size of the cache directory increases linearly with the total capacity of all CPU cache subsystems in the computing system. Over time, the CPU cache size has grown significantly. Due to this growth, it has become very difficult to maintain a line-based cache directory. BRIEF DESCRIPTION OF THE DRAWINGS
[0006] Advantages of the methods and mechanisms described herein may be better understood by referring to the following description in conjunction with the accompanying drawings, in which:
[0007] Figure 1 is a block diagram of one embodiment of a computing system.
[0008] Figure 2 is a block diagram of one embodiment of a core complex.
[0009] Figure 3 is a block diagram of one implementation of a multi-CPU system.
[0010] Figure 4 is a block diagram of one implementation of a cache directory.
[0011] Figure 5 is a block diagram of another embodiment of a cache directory.
[0012] Figure 6 is a block diagram of another embodiment of a cache directory.
[0013] Figure 7 is a diagram of one implementation that repurposes a cluster validity field in a cache directory entry.
[0014] Figure 8 is a generalized flow chart illustrating one embodiment of a method for maintaining a region-based cache directory.
[0015] Fig. 9 is a generalized flow chart illustrating one embodiment of a method by which a coherent slave handles an invalidation indication from a CPU.
[0016] Fig.10is a generalized flow diagram illustrating one embodiment of a method in which a cache directory tracks accesses to a first region of memory.
[0017] Fig.11 is a generalized flow chart illustrating one embodiment of a method for maintaining an array of cache directories at different levels of granularity.
[0018] Fig.12 is a generalized flow chart illustrating one embodiment of a method for operating a multi-array cache directory.
[0019] Fig.13 is a generalized flow chart illustrating one embodiment of a method in which a cache directory maintains a data structure having entries for recently accessed private regions.
[0020] Fig.14 is a generalized flow chart illustrating one embodiment of a method for maintaining an array of cache directories at different levels of granularity. DETAILED DESCRIPTION
[0021] In the following description, numerous specific details are set forth to provide a thorough understanding of the methods and mechanisms presented herein. However, it will be appreciated by those of ordinary skill in the art that various embodiments may be practiced without these specific details. In some cases, well-known structures, components, signals, computer program instructions, and techniques are not shown in detail to avoid confusion with the methods described herein. It should be understood that in order to make the description clear and simple, the elements shown in the drawings may not be drawn to scale. For example, the size of some elements may be enlarged relative to other elements.
[0022] Various systems, devices, methods, and computer-readable media for implementing a region-based cache directory scheme adapted to large cache sizes are disclosed herein. In one embodiment, a system includes at least a plurality of processing nodes, a memory, and a cache directory. Each processing node includes one or more processors and a cache subsystem. In one embodiment, the cache directory is configured to track portions of memory based on regions, wherein each region includes a plurality of cache lines. The cache directory maintains an entry for each region of memory having at least one cache line cached in any cache subsystem of the system. The cache directory also maintains a reference count for each entry, wherein the reference count is the sum of the number of cache lines cached in the region in all cache subsystems of the system. The cache directory reclaims a given entry in response to the reference count of the given entry reaching zero.
[0023] In one embodiment, the cache directory allocates a first entry for the first region in response to receiving an indication that a first cache line of the first region is being cached by a first cache subsystem of the system. The cache directory also initializes a reference count of the newly allocated first entry to one. The cache directory increments the reference count of the first entry to two in response to receiving an indication that a second cache line of the first region is being cached by a second cache subsystem of the system, wherein the second cache line is not necessarily physically different from the first cache line. For each subsequent cache line of the first region that is cached by the cache subsystem, the cache directory increments the reference count.
[0024] In one embodiment, the cache directory tracks whether a region is private or shared. For example, the cache directory stores a first entry to track a first region. When the first region is private, a first field of the first entry is interpreted as having a first meaning. When the first region is shared, a first field of the first entry is interpreted as having a second meaning different from the first meaning. In one embodiment, when the first region is private, the first field is interpreted as a CPU valid field, and when the first region is shared, the first field is interpreted as a cluster valid field, where a cluster refers to a specific group of CPUs.
[0025] In one embodiment, the cache directory maintains a first array to track portions of memory at a first granularity. The cache directory also maintains a second array to track portions of memory at a second granularity, wherein the second granularity is a finer granularity than the first granularity. In this embodiment, the cache directory performs a search of the first array and the second array in parallel in response to receiving a given memory request. The cache directory generates one or more probes based only on data extracted from matching entries in the second array in response to the search hitting both the first array and the second array.
[0026] In one embodiment, the cache directory monitors the reference count field of the entries in the first array. In one embodiment, the cache directory begins to track the given area with finer granularity in response to detecting that the given area has been converted from private to shared. In this embodiment, the cache directory creates entries in the second array in response to receiving a memory request targeting the given area after detecting that the given area has been converted from private to shared. In one embodiment, the cache directory begins to track the given area based on finer granularity in response to detecting that the reference count of the given area has exceeded a programmable threshold. In this embodiment, the cache directory creates entries in the second array in response to receiving a memory request targeting the given area after detecting that the reference count has exceeded the threshold. In one embodiment, the first array is a region-based array, and the second array is a line-based array.
[0027] Reference now Figure 1 , a block diagram of one embodiment of a computing system 100 is shown. In one embodiment, the computing system 100 includes at least core complexes 105A-105N, an input / output (I / O) interface 120, a bus 125, one or more memory controllers 130, and a network interface 135. In other embodiments, the computing system 100 may include other components and / or the computing system 100 may be arranged in different ways. In one embodiment, each core complex 105A-105N includes one or more general-purpose processors, such as a central processing unit (CPU). It should be noted that a "core complex" may also be referred to as a "processing node" or "CPU" herein. In some embodiments, one or more core complexes 105A-105N may include a data parallel processor with a highly parallel architecture. Examples of data parallel processors include graphics processing units (GPUs), digital signal processors (DSPs), field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), etc. Each processor core within a core complex 105A-105N includes a cache subsystem having one or more cache levels. In one embodiment, each core complex 105A-105N includes a cache (eg, a level 3 (L3) cache) that is shared among multiple processor cores.
[0028] The one or more memory controllers 130 represent any number and type of memory controllers accessible by the core complexes 105A-105N. The one or more memory controllers 130 are coupled to any number and type of memory devices (not shown). For example, the type of memory in the one or more memory devices coupled to the one or more memory controllers 130 may include dynamic random access memory (DRAM), static random access memory (SRAM), NAND flash memory, NOR flash memory, ferroelectric random access memory (FeRAM), etc. The I / O interface 120 represents any number and type of I / O interface (e.g., peripheral component interconnect (PCI) bus, PCI extension (PCI-X), PCIE (PCI Express) bus, Gigabit Ethernet (GBE) bus, universal serial bus (USB)). Various types of peripheral devices may be coupled to the I / O interface 120. Such peripheral devices include (but are not limited to) a display, a keyboard, a mouse, a printer, a scanner, a joystick or other type of game controller, a media recording device, an external storage device, a network interface card, etc.
[0029] In various embodiments, computing system 100 may be any of a server, a computer, a laptop, a mobile device, a game console, a streaming device, a wearable device, or various other types of computing systems or devices. It should be noted that the number of components of computing system 100 may vary from embodiment to embodiment. Figure 1 More or less than the number of each component shown. It should also be noted that the computing system 100 may include Figure 1 Other components not shown. In addition, in other embodiments, the computing system 100 may be connected to Figure 1 The different ways of structuring are shown.
[0030] Now go to Figure 2 , a block diagram of one embodiment of core complex 200 is shown. In one embodiment, core complex 200 includes four processor cores 210A-210D. In other embodiments, core complex 200 may include other numbers of processor cores. It should be noted that a "core complex" may also be referred to herein as a "processing node" or "CPU". In one embodiment, the components of core complex 200 are included in ( Figure 1 ) within the core complex 105A-105N.
[0031] Each processor core 210A-210D includes a cache subsystem for storing data and instructions retrieved from a memory subsystem (not shown). For example, in one embodiment, each core 210A-210D includes a corresponding first level (L1) cache 215A-215D. Each processor core 210A-210D may include or be coupled to a corresponding second level (L2) cache 220A-220D. In addition, in one embodiment, the core complex 200 includes a third level (L3) cache 230 shared by the processor cores 210A-210D. The L3 cache 230 is coupled to a coherent master to access the fabric and memory subsystem. It should be noted that in other embodiments, the core complex 200 may include other types of cache subsystems having other numbers of caches and / or other configurations with different cache hierarchies.
[0032] Reference now Figure 3, a block diagram of an embodiment of a multi-CPU system 300 is shown. In one embodiment, the system includes multiple CPUs 305A-305N. The number of CPUs per system may vary depending on the embodiment. Each CPU 305A-305N may include any number of cores 308A-308N, respectively, wherein the number of cores varies according to the embodiment. Each CPU 305A-305N also includes a corresponding cache subsystem 310A-310N. Each cache subsystem 310A-310N may include any number of levels of cache and any type of cache hierarchy.
[0033] In one embodiment, each CPU 305A-305N is connected to a corresponding consistency master 315A-315N. As used herein, a "consistency master" is defined as an agent that handles traffic flowing through an interconnect structure (e.g., bus / fabric 318) and manages the consistency of the connected CPUs. To manage consistency, the consistency master receives and processes consistency-related messages and probes, and the consistency master generates consistency-related requests and probes. It should be noted that a "consistency master" may also be referred to herein as a "consistency master unit."
[0034] In one embodiment, each CPU 305A-305N is coupled to a pair of coherence slaves via corresponding coherence masters 315A-315N and bus / texture 318. For example, CPU 305A is coupled to coherence slaves 320A-320B via coherence master 315A and bus / texture 318. Coherence slave (CS) 320A is coupled to memory controller (MC) 330A, and coherence slave 320B is coupled to memory controller 330B. Coherence slave 320A is coupled to cache directory (CD) 325A, wherein cache directory 325A includes entries for memory regions having cache lines cached in system 300 of memory accessible via memory controller 330A. It should be noted that cache directory 325A, as well as each of the other cache directories, may also be referred to as a "probe filter." Similarly, the coherency slave 320B is coupled to a cache directory 325B, wherein the cache directory 325B includes entries for memory regions having cache lines cached in the system 300 that are accessible through the memory controller 330B. It should be noted that the example of having two memory controllers per CPU is merely indicative of one embodiment. It should be understood that in other embodiments, each CPU 305A-305N may be connected to a number of memory controllers other than two.
[0035] In a configuration similar to the CPU 305A configuration, the CPU 305B is coupled to the coherence slaves 335A-335B through the coherence master 315B and the bus / texture 318. The coherence slave 335A is coupled to the memory through the memory controller 350A, and the coherence slave 335A is also coupled to the cache directory 345A to manage the coherence of the cache lines corresponding to the memory accessible through the memory controller 350A. The coherence slave 335B is coupled to the cache directory 345B, and the coherence slave 335B is coupled to the memory through the memory controller 365B. For example, the CPU 305N is coupled to the coherence slaves 355A-355B through the coherence master 315N and the bus / texture 318. The coherence slaves 355A-355B are respectively coupled to the cache directories 360A-360B, and the coherence slaves 355A-355B are respectively coupled to the memory through the memory controllers 365A-365B. As used herein, a "coherence slave" is defined as an agent that manages coherence by processing received requests and probes targeting a corresponding memory controller. It should be noted that a "coherence slave" may also be referred to herein as a "coherence slave unit." Additionally, as used herein, a "probe" is defined as a message that is passed from a coherence point to one or more caches in a computer system to determine whether the cache has a copy of a data block and optionally indicate the state that the cache should leave the data block in.
[0036] When a consistency slave receives a memory request targeting its corresponding memory controller, the consistency slave performs a lookup of its corresponding cache directory to determine whether the request targets an area having at least one cache line cached in any cache subsystem. In one embodiment, each cache directory in system 300 tracks an area of memory, wherein an area includes multiple cache lines. The size of the tracked area may vary from one embodiment to another. By tracking at the granularity of an area rather than at the finer granularity of a cache line, the size of each cache directory can be reduced. It should be noted that a "region" may also be referred to as a "page" in this article. When a consistency slave receives a request, the consistency slave determines the area targeted by the request. Then, a lookup of the cache directory is performed for this area. If the lookup results in a hit, the consistency slave sends a probe to one or more CPUs identified in the hit entry. The type of probe generated by the consistency slave depends on the consistency state specified by the hit entry.
[0037] It should be noted that although Figure 3318 to other components that are not shown in the drawings, but in other embodiments, there may be other connections from the bus / texture 318 to other components that are not shown to avoid obscuring the drawings. For example, in another embodiment, the bus / texture 318 includes connections to one or more I / O interfaces and one or more I / O devices.
[0038] Now go to Figure 4 , a block diagram of one embodiment of a cache directory 400 is shown. In one embodiment, the cache directory 400 includes a control unit 405 and an array 410. The array 410 may include any number of entries, wherein the number of entries varies according to the embodiment. In one embodiment, each entry of the array 410 includes a status field 415, a sector valid field 420, a cluster valid field 425, a reference count field 430, and a tag field 435. In other embodiments, the entries of the array 410 may include other fields and / or may be arranged in other suitable ways.
[0039] The state field 415 includes state bits that specify the aggregate state of the region. The aggregate state reflects the most restrictive cache line state for this particular region. For example, even if only one cache line in the entire given region is dirty, the state of the given region is stored as "dirty". In addition, even if only one cache line in the entire given region is shared, the state of the given region is stored as "shared".
[0040] The sector valid field 420 stores a bit vector corresponding to a subset or sector of lines within a region to provide fine-grained tracking. By tracking subsets of lines within a region, the number of unwanted regular consistency probes and individual line probes generated when expanding region invalidation probes can be reduced. As used herein, a "region invalidation probe" is defined as a probe generated by a cache directory in response to a region entry being evicted from the cache directory. When a consistency master receives a region invalidation probe, the consistency master invalidates each cache line of the region that is cached by the local CPU. In addition, a tracker and sector valid bit are included in the region invalidation probe to mitigate probe proliferation at the CPU cache.
[0041] The organization of the subgroups and the number of bits in the sector valid field 420 may vary depending on the implementation. In one implementation, the sector valid field 420 is used to track two lines within a particular zone entry. In another implementation, other numbers of lines may be tracked within each zone entry. In this implementation, the sector valid field 420 may be used to indicate the number of partitions being tracked individually within a zone. Additionally, the offsets stored in the sector valid field 420 may be used to identify the partitions. Each offset identifies the location of a given partition within a given zone. The sector valid field 420 or another field of an entry may also indicate the individual owner and individual status of each partition within a given zone.
[0042] Cluster valid field 425 includes a bit vector for tracking the presence of regions across various CPU cache clusters. For example, in one embodiment, CPUs are grouped together into CPU clusters. The bit vector stored in cluster valid field 425 is used to reduce the probe destination of rule consistency probes and region invalidation probes.
[0043] Reference count field 430 is used to track the number of cache lines of a region's cache somewhere in the system. When a region is accessed for the first time, an entry is placed in table 410 and reference count field 430 is set to one. Over time, each time a cache accesses a cache line from this region, the reference count is incremented. When a cache line from this region is evicted from the cache, the reference count is decremented. Eventually, if the reference count reaches zero, the entry is marked as invalid and the entry can be reused for other regions. By utilizing reference count field 430, the incidence of region invalidation probes can be reduced. When an entry is associated with a region without active subscribers, reference count field 430 allows directory entries to be recycled. In one embodiment, reference count field 430 can be saturated once the reference count crosses a threshold. The threshold can be set to a value that is large enough to handle private access patterns while sacrificing some accuracy when handling widely shared access patterns for communication data. Tag field 435 includes tag bits for identifying entries associated with a particular region.
[0044] Reference now Figure 5 , a block diagram of another embodiment of a cache directory 500 is shown. In one embodiment, the cache directory 500 includes at least a control unit 505 coupled to a region-based array 510 and an auxiliary line-based array 515. The region-based array 510 includes entries for tracking data of a region-based cache. In one embodiment, each entry of the region-based array 510 includes a reference to a data entry for the region that was created by a computing system (e.g., Figure 3A reference count is a reference count that counts the number of accesses to cache lines of a cache subsystem cache of a system 300. In one embodiment, when the reference count of a given region reaches a threshold, an auxiliary line-based array 515 will begin to track the given region based on a line.
[0045] Thus, in one embodiment, when the number of cache lines cached for a given region reaches a threshold, the auxiliary line-based array 515 will begin tracking accesses to individual lines of the given region. Each time a new cache line is accessed from a given region, a new entry is created for the cache line in the auxiliary line-based array 515. In one embodiment, lookups to the region-based array 510 and the line-based array 515 are performed in parallel.
[0046] In one embodiment, only shared regions with reference counts greater than a threshold will be tracked by the auxiliary line-based array 515 on a cache line basis. A shared region is a region with cache lines stored in the cache subsystems of at least two different CPUs. A private region is a region with cache lines that are cached by only a single CPU. Therefore, in one embodiment, for a shared region with a reference count greater than a threshold, there will be one or more entries in the line-based array 515. In this embodiment, for a private region, there will be no entries in the line-based array 515.
[0047] Now go to Figure 6 , a block diagram of another embodiment of a cache directory 600 is shown. In one embodiment, the cache directory 600 includes a control unit 605, a region-based array 610, an auxiliary line-based array 615, and a structure 620 for caching N most recently accessed private pages. It should be noted that N is a positive integer that can vary depending on the embodiment.
[0048] In one embodiment, structure 620 includes a storage location for temporarily caching entries of the last N accessed private pages. When control unit 605 receives a memory request or invalidation request that matches an entry in structure 620, control unit 605 is configured to increment or decrement a reference count, modify a cluster valid field and / or a sector valid field outside arrays 610 and 615, etc. Thus, rather than having to read and write entries in arrays 610 and 615 for each access, accesses to recently accessed private pages 620 can bypass accesses to arrays 610 and 615. Use of structure 620 can help speed up updates to cache directory 600 for these private pages.
[0049] In one embodiment, I / O transactions that do not modify the sector valid bit or the cluster valid bit can benefit from a structure for caching the N most recently accessed private pages 620. Typically, an I / O transaction will only modify the reference count of a given entry, and instead of performing a read and write to the array 610 or 615 each time, the structure 620 can be updated.
[0050] Thus, structure 620 enables efficient access to cache directory 600. In one embodiment, an incoming request performs a lookup to structure 620 before performing a lookup to arrays 610 and 615. In one embodiment, after an incoming request is distributed among coherent slaves (e.g., Figure 3 When a request is received from the input queue of device 320A), control unit 605 determines whether there is a hit or a miss in structure 620. Later, when the request reaches the head of the queue, control unit 605 already knows whether the request is a hit in structure 620. If the request is a hit in structure 620, the lookup of arrays 610 and 615 can be avoided.
[0051] Reference now Figure 7 , a diagram showing an embodiment of the purpose of changing the cluster valid field in the cache directory entry. In one embodiment, entry 705A includes various fields associated with the shared area being tracked by the cache directory. Status field 710A stores shared coding 715A to indicate that the corresponding area is shared. As used herein, a "shared" area refers to an area with cache lines cached by multiple different CPU clusters. When status field 710A stores shared coding 715A, cluster valid field 720A stores a bit vector for indicating which CPU clusters 725A-725N are caching the cache lines of the corresponding area. In this example, cluster valid field 720A groups CPUs together into clusters. In one embodiment, if cluster bits 725A-725N are set to one, this indicates that the CPU cluster stores at least one cache line from the area. In one embodiment, if cluster bits 725A-725N are set to zero, this indicates that none of the CPUs in the cluster stores cache lines from the area. Entry 705A may also include any number of other fields not shown to avoid confusing the accompanying drawings.
[0052] If the cluster valid field 720A remains unchanged even for private regions, then probes need to be sent to all CPUs in the cluster that are identified as caching at least one cache line of that region. Conversely, in one embodiment, if the region is private (i.e., accessed only by a single cluster), the use of the cluster valid field is changed to the owner valid field or the CPU valid field. This allows the cache directory to probe a specific CPU for a private region.
[0053] Therefore, if the area being tracked by entry 705A changes from being a shared area to being a private area, entry 705B shows a change in field compared to the entry 705A of this private area. As shown in entry 705B, state 710B now includes private 715B encoding to represent the private state of the area. Since state 710B has now been changed to private 715B, the previous cluster valid field 720A now becomes CPU valid field 720B. Each bit 735A-735N of the bit vector stored in CPU valid field 720B represents a single CPU in the original cluster. If the given CPU in this cluster caches at least one cache line of the corresponding area, then the specific CPU 735A-735N bit is set to one. Otherwise, if the given CPU in the cluster does not cache any cache line from the area, then the corresponding CPU 735A-735N bit is set to zero.
[0054] By changing the cluster valid field 720A to the CPU valid field 720B, a directed probe can be issued that targets only the CPU that has a cache line from the region. This helps reduce the number of unnecessary probes generated by the cache directory. In one embodiment, if a request targeting a private region (corresponding to entry 705B) is received from a different cluster, this private region becomes a shared region. When this happens, the cluster valid field 720A reverts to its normal operation because the region is now shared.
[0055] Now go to Figure 8 , shows one embodiment of a method 800 for maintaining a region-based cache directory. For discussion purposes, the steps and Figures 9 to 13 However, it should be noted that in various embodiments of the described method, one or more of the described elements are performed simultaneously, in a different order than shown, or omitted entirely. Other additional elements may also be performed as needed. Any of the various systems or devices described herein are configured to implement method 800.
[0056] A cache directory tracks regions of memory having at least one cache line cached in any cache subsystem of a multi-CPU system, wherein each region includes a plurality of cache lines (block 805). The cache directory maintains an entry for each region of memory having at least one cache line cached in any cache subsystem of the system (block 810). The cache directory maintains a reference count for each entry of the cache directory, wherein the reference count is the sum of the number of cache lines of the region cached in all cache subsystems of the system (block 815). In response to receiving a memory request targeting a cache line within a given region, the cache directory sends a probe to each CPU having any cache line of the given region (block 820). In response to a cache line of the corresponding region being cached by a CPU, the cache directory increments a reference count of the given entry (block 825). In response to a cache line of the corresponding region being evicted from a cache subsystem of a CPU, the cache directory decrements a reference count of the given entry (block 830). After block 830, method 800 ends.
[0057] Reference now Fig. 9 , shows one embodiment of a method 900 for a coherent slave to process an invalidation indication from a CPU. The coherent slave receives an invalidation indication from a given CPU indicating that the given CPU no longer caches a particular cache line (block 905). In response to receiving the invalidation indication, the coherent slave determines the region of the particular cache line (block 910). Next, the coherent slave locates a cache directory entry for the identified region (block 915).
[0058] The coherence slave then decrements the reference count in the located cache directory entry for the identified region (block 920). If the reference count is now equal to zero (conditional block 925, "yes" branch), the coherence slave invalidates the entry (block 930). The entry can now be reused to allocate a new entry when a memory request targeting a region without a cache directory entry is received. If the reference count is now still greater than zero (conditional block 925, "no" branch), the coherence slave maintains the valid state of the entry (block 935). After blocks 930 and 935, method 900 ends.
[0059] Now turn to Fig.10, shows one embodiment of a method 1000 for a cache directory to track accesses to a first region of memory. The cache directory receives a first memory request for a first cache line within a first region of memory (block 1005). In response to determining that the first region does not have an entry in the cache directory, a new entry is allocated in the cache directory for the first region, and a reference count of the new entry is initialized to one (block 1010). If the cache directory is full, the cache directory evicts the existing entry to allocate the new entry. The cache directory may utilize any suitable eviction algorithm to determine which entry to evict. Next, the cache directory receives a second memory request for a second cache line within the first region of memory, wherein the second cache line is not necessarily physically different from the first cache line (block 1015). In response to receiving the second memory request for the first region of memory, a reference count of an entry corresponding to the first region of memory is incremented to two (block 1020). After block 1020, the method 1000 ends. It should be noted that the reference count of the entry corresponding to the first region of memory is incremented for each subsequent memory request for any cache line within the first region. Likewise, each time a cache line from the first region is evicted from the cache subsystem, the reference count is decremented.
[0060] Reference now Fig.11 , one embodiment of a method 1100 for maintaining an array of cache directories at different granularity levels is shown. The cache directory maintains entries in a first array to track address ranges of memory at a first granularity (block 1105). In one embodiment, the first granularity is a page of memory. In one embodiment, a page is 4 kilobytes (KB). In other embodiments, the first granularity may correspond to other address range sizes.
[0061] The cache directory maintains a reference count for each entry in the first array to track the number of cache lines of the region somewhere in the system (block 1110). If the reference count for a given entry exceeds a programmable threshold (conditional block 1115, "yes" branch), the cache directory begins tracking the corresponding address range at a second granularity, where the second granularity is a finer granularity than the first granularity. (block 1120). In one embodiment, the second granularity corresponds to a cache line. In one embodiment, a cache line includes 64 bytes. In other embodiments, other cache line sizes may be utilized. If the reference count for a given entry is less than or equal to the programmable threshold (conditional block 1115, "no" branch), the cache directory continues to track the corresponding address range at the first granularity (block 1125). After block 1125, method 1100 returns to block 1110.
[0062] For each new cache line from the corresponding address range cached in the system, the cache directory allocates a new entry in the second array to track this portion of the region at a second granularity (block 1130). If the cache directory is full, the cache directory evicts an entry from the second array to allocate the new entry. The cache directory may utilize any suitable eviction algorithm to determine which entry to evict. After block 1130, method 1100 returns to block 1110.
[0063] Now go to Fig.12 , showing one embodiment of a method 1200 for operating a multi-array cache directory. A memory request is received at a multi-array cache directory of a multi-CPU system (block 1205). The cache directory performs a parallel lookup of a first array and a second array for the memory request (block 1210). In one embodiment, the first array tracks an address range at a first granularity, and the second array tracks an address range at a second granularity, wherein the second granularity is a finer granularity than the first granularity. If the lookup results in a hit to both the first array and the second array (conditional block 1215, "yes" branch), the cache directory generates a probe using a matching entry from the second array (block 1220). If the lookup results in a hit to only the first array (conditional block 1225, "yes" branch), the cache directory generates a probe using a matching entry from the first array (block 1230). If the lookup results in a miss to both the first array and the second array (conditional block 1225, "no" branch), the cache directory allocates a new entry in the first array for the address range of the memory request at the first granularity (block 1235). If the first array is full, the cache directory may evict existing entries from the first array. The cache directory may utilize any suitable technique to determine which existing entry to evict. If the cache directory evicts existing entries from the first array, the cache directory sends an invalidation probe to one or more CPUs having cache lines of the corresponding address range. After blocks 1220, 1230, and 1235, method 1200 ends.
[0064] Reference now Fig.13 , shows one embodiment of a method 1300 of a cache directory maintaining a data structure having entries for recently accessed private regions. The cache directory maintains a data structure to cache entries for the last N accesses to the private region (block 1305). The value of N may vary depending on the implementation. The cache directory also maintains one or more arrays having entries for tracking regions having cache lines cached in any cache subsystem of the multi-CPU system (block 1310).
[0065] Next, a memory request is received at the cache directory (block 1315). In response to receiving the memory request, the cache directory performs a lookup of a data structure having entries for the last N accessed private regions (block 1320). If the lookup results in a hit (conditional block 1325, "yes" branch), the cache directory generates a probe for one or more cache subsystems using the matching entry (block 1330). In addition, the cache directory cancels the lookup of one or more primary cache directory arrays (block 1335). If the lookup results in a miss (conditional block 1325, "no" branch), the cache directory performs one or more lookups of one or more primary cache directory arrays for the request (block 1340). The cache directory may utilize any suitable processing procedure to handle the lookup of the primary cache directory arrays. After blocks 1335 and 1340, method 1300 ends.
[0066] Reference now Fig.14 , one embodiment of a method 1400 for maintaining an array of cache directories at different granularity levels is shown. The cache directory maintains entries in a first array to track address ranges of private regions of memory at a first granularity (block 1405). In one embodiment, the first granularity is a page of memory. In one embodiment, a page is 4KB. In other embodiments, the first granularity may correspond to other address range sizes.
[0067] The cache directory determines whether any of the private regions has been converted to a shared state (conditional block 1410). If any of the private regions has been converted to a shared state (conditional block 1410, "yes" branch), the cache directory begins tracking the corresponding address range at a second granularity, wherein the second granularity is a finer granularity than the first granularity. (block 1415). In one embodiment, the second granularity corresponds to a cache line. In one embodiment, a cache line includes 64 bytes. In other embodiments, other cache line sizes may be utilized. If any of the private regions has not been converted to a shared state (conditional block 1410, "no" branch), the cache directory continues to track the corresponding address range at the first granularity (block 1420). After block 1420, method 1400 returns to block 1410.
[0068] For each new cache line from the corresponding address range cached in the system, the cache directory allocates a new entry in the second array to track this portion of the region at a second granularity (block 1425). If the cache directory is full, the cache directory evicts an entry from the second array to allocate the new entry. The cache directory may utilize any suitable eviction algorithm to determine which entry to evict. After block 1425, method 1400 returns to block 1410.
[0069] In various embodiments, the method and / or mechanism described herein are implemented using the program instructions of the software application. For example, it is envisioned that the program instructions that can be executed by a general-purpose processor or a special-purpose processor. In various embodiments, such program instructions can be represented by a high-level programming language. In other embodiments, the program instructions can be compiled into a binary form, an intermediate form, or other forms from a high-level programming language. Alternatively, program instructions describing the behavior or design of hardware can be written. Such program instructions can be represented by a high-level programming language such as C. Alternatively, a hardware design language (HDL) such as Verilog can be used. In various embodiments, program instructions are stored on any one of a variety of non-temporary computer-readable storage media. The storage medium can be accessed by a computing system during use to provide program instructions to the computing system for program execution. Generally speaking, such a computing system includes at least one or more memories and one or more processors configured to execute program instructions.
[0070] It should be emphasized that the above embodiments are only non-limiting examples of implementations. Once the above disclosure is fully understood, many changes and modifications will become obvious to those skilled in the art. The attached claims are intended to be interpreted as including all such changes and modifications.
Claims
1. A system comprising: a plurality of processing nodes, wherein each processing node includes one or more processors and a cache subsystem; Memory; as well as A cache directory, the cache directory being configured as: maintaining an entry for each region of memory having at least one cache line cached in any cache subsystem of the system, wherein a region includes a plurality of cache lines; maintaining a reference count for each entry of the cache directory, wherein the reference count tracks the number of cache lines of the corresponding region in any cache subsystem of the system; monitoring a reference count field of an entry in the first array; tracking the given region based on a finer granularity in response to detecting that a reference count of the given region has exceeded a threshold; as well as The given entry is reclaimed in response to the reference count of the given entry reaching zero.
2. The system of claim 1, wherein the cache directory is further configured to: allocating a first entry for a first region in response to receiving an indication that a first cache line of the first region is being cached by a first cache subsystem of the system; and The reference count of the first entry is initialized to one.
3. The system of claim 2, wherein the cache directory is further configured to increment the reference count of the first entry in response to receiving an indication that a second cache line of the first region is being cached by a second cache subsystem of the system.
4. The system of claim 1, wherein the cache directory is further configured to: Whether the tracking area is private or shared; interpreting a first field of a first entry as a central processing unit valid field in response to determining that a first region is private, wherein the first entry corresponds to the first region; The first field of the first entry is interpreted as a cluster-valid field in response to detecting a state change of the first region to shared.
5. The system of claim 1, wherein the cache directory is further configured to: maintaining a first array to track portions of a 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 A lookup of the first array and the second array is performed in parallel in response to receiving a given memory request.
6. The system of claim 5, wherein the cache directory is further configured to generate a probe based only on data extracted from a matching entry in the second array in response to the lookup hitting in both the first array and the second array.
7. The system of claim 1, wherein the cache directory is further configured to: An entry is created in the second array in response to receiving a memory request targeting the given region after detecting that the reference count has exceeded the threshold.
8. A method comprising: maintaining in the cache directory an entry for each region of memory having at least one cache line cached in any cache subsystem of the system, wherein a region includes a plurality of cache lines; maintaining a reference count for each entry of the cache directory, wherein the reference count tracks the number of cache lines of the corresponding region in any cache subsystem of the system; monitoring a reference count field of an entry in the first array; tracking the given region based on a finer granularity in response to detecting that a reference count of the given region has exceeded a threshold; as well as The given entry is reclaimed in response to the reference count of the given entry reaching zero.
9. The method of claim 8, further comprising: allocating a first entry for a first region in response to receiving an indication that a first cache line of the first region is being cached by a first cache subsystem of the system; as well as The reference count of the first entry is initialized to one.
10. The method of claim 9, further comprising: The reference count of the first entry is incremented in response to receiving an indication that a second cache line of the first region is being cached by a second cache subsystem of the system.
11. The method of claim 8, further comprising: Whether the tracking area is private or shared; interpreting a first field of a first entry as a central processing unit valid field in response to determining that a first region is private, wherein the first entry corresponds to the first region; The first field of the first entry is interpreted as a cluster-valid field in response to detecting a state change of the first region to shared.
12. The method of claim 8, further comprising: maintaining a first array to track portions of a 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; as well as A lookup of the first array and the second array is performed in parallel in response to receiving a given memory request.
13. The method of claim 12, further comprising: In response to the lookup hitting in both the first array and the second array, a probe is generated based solely on data extracted from matching entries in the second array.
14. The method of claim 8, further comprising: An entry is created in the second array in response to receiving a memory request targeting the given region after detecting that the reference count has exceeded the threshold.
15. An apparatus comprising: A cache directory, the cache directory being configured as: maintaining an entry for each region of memory having at least one cache line cached in any one of a plurality of cache subsystems, wherein a region includes a plurality of cache lines; maintaining a reference count for each entry of the cache directory, wherein the reference count tracks the number of cache lines of the corresponding region in any cache subsystem; monitoring a reference count field of an entry in the first array; tracking the given region based on a finer granularity in response to detecting that a reference count of the given region has exceeded a threshold; as well as The given entry is reclaimed in response to the reference count of the given entry reaching zero.
16. The apparatus of claim 15, wherein the cache directory is further configured to: allocating a first entry for a first region in response to receiving an indication that a first cache line of the first region is being cached by a first cache subsystem of the system; and The reference count of the first entry is initialized to one.
17. The apparatus of claim 16, wherein the cache directory is configured to increment the reference count of the first entry in response to receiving an indication that a second cache line of the first region is being cached by a second cache subsystem of the system.
18. The apparatus of claim 15, wherein the cache directory is configured to: Whether the tracking area is private or shared; interpreting a first field of a first entry as a central processing unit valid field in response to determining that a first region is private, wherein the first entry corresponds to the first region; The first field of the first entry is interpreted as a cluster-valid field in response to detecting a state change of the first region to shared.
19. The apparatus of claim 15, wherein the cache directory is further configured to: maintaining a first array to track portions of a 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 A lookup of the first array and the second array is performed in parallel in response to receiving a given memory request.
20. The apparatus of claim 19, wherein the cache directory is further configured to generate a probe based only on data extracted from a matching entry of the second array in response to the lookup hitting in both the first array and the second array.
