An extended victim directory management method and system for cache coherency directories

CN123011993APending Publication Date: 2026-10-30SUN YAT SEN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611190458.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-06
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

仅按普通替换策略处理目录项,容易让高价值的一致性元数据过早离开主目录

Benefits of technology

[0016]本申请实施例至少包括以下有益效果:本申请的用于缓存一致性目录的拓展受害者目录管理方法及系统,首先在主一致性目录旁设置用于保存被替换目录项的拓展受害者目录;接着将主一致性目录与拓展受害者目录在同一请求处理窗口内并行或近似并行探测;当访问请求在主一致性目录缺失但拓展受害者目录命中时,定位主一致性目录中与该访问请求映射冲突的冲突项;进而对拓展受害者目录命中项和主一致性目录冲突项计算第一保留优先级,根据第一保留优先级执行命中项提升、冲突项降级或交换,使高价值目录项更容易重新进入主一致性目录;当主一致性目录和拓展受害者目录双未命中时,根据主一致性目录槽位状态和拓展受害者目录空闲状态,执行新项插入、冲突项降级或低价值项回收。本申请通过主一致性目录与拓展受害者目录协同管理一致性元数据,能够减少目录替换引发的全局失效、广播探测或远程重取,并提高远程缓存副本的有效保留率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123011993A_ABST
    Figure CN123011993A_ABST
Patent Text Reader

Abstract

The application discloses an extension victim directory management method and system for cache consistency directory, comprising adding an extension victim directory beside a main consistency directory; receiving an access request, querying the main consistency directory and the extension victim directory in parallel according to the access request; if the access request hits the main consistency directory, updating a sharer set; if the access request hits the extension victim directory, obtaining a hit item in the extension victim directory and a conflict item in the main consistency directory, calculating a first reservation priority of the hit item and the conflict item, and performing hit item promotion, conflict item degradation or exchange according to the first reservation priority; if the access request does not hit the main consistency directory and the extension victim directory, performing new item insertion, conflict item degradation or low value item recovery according to a main consistency directory slot state and an extension victim directory idle state, which can reduce global invalidation, broadcast detection or remote re-fetch caused by directory replacement, and can be widely applied to the technical field of computers.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to an extended victim directory management method and system for cache consistency directories. Background Technology

[0002] Directory-based cache coherency protocols typically use a home directory to record the status of cache lines and the set of sharers. As multi-GPU, multi-chip GPU, many-core processor, and heterogeneous computing systems scale up, the number of remote cache replicas increases, and the number of active cache lines the directory needs to track also increases. Limited by chip area, power consumption, and access latency, the on-chip home directory capacity often cannot be expanded indefinitely. Therefore, in scenarios with high-concurrency remote access, address mapping conflicts, or hotspot sharing, the home directory may be frequently replaced.

[0003] If home directory replacement simply discards still-active directory entries, the system will lose accurate sharer information. To maintain consistency, the system may need to immediately invalidate the shared copy of the replaced directory entry record, or use broadcast, multicast probing, or remote data retrieval in subsequent accesses. These operations may not necessarily stem from actual data conflicts, but they consume interconnect bandwidth and increase access latency.

[0004] Traditional cache replacement strategies are typically designed for data block reusability, such as LRU (Least Recently Used), FIFO (First In First Out), or random replacement. However, the value of a consistent directory entry depends not only on data reuse but also on the number of sharers of that entry, the probability of subsequent participation in consistent transactions, and the potential failures or probing costs triggered after replacement. Treating directory entries with only a standard replacement strategy can easily cause high-value consistent metadata to leave the main directory prematurely. Summary of the Invention

[0005] The main objective of this application is to propose an extended victim directory management method and system for cache consistency directories, which can reduce global failures, broadcast probes or remote retrieval caused by directory replacement, and improve the effective retention rate of remote cache copies.

[0006] To achieve the above objectives, one aspect of this application proposes an extended victim directory management method for a cache consistency directory, the method comprising the following steps: Add an extended victim directory next to the primary consistency directory; Receive an access request, and query the primary consistency directory and the extended victim directory in parallel according to the access request; If the access request hits the primary consistency directory, update the sharer set; If the access request hits the extended victim directory, the hit item in the extended victim directory and the conflict item in the primary consistency directory are obtained. The first retention priority of the hit item and the conflict item is calculated, and then the hit item is promoted, the conflict item is downgraded or swapped according to the first retention priority. If the access request does not hit the primary consistency directory and the extended victim directory, new items are inserted, conflicting items are downgraded, or low-value items are recycled based on the slot status of the primary consistency directory and the idle status of the extended victim directory.

[0007] In some embodiments, calculating the first retention priority of the hit item and the conflict item specifically includes: Obtain the number of sharers for the hit item and the conflict item, and calculate the first retention priority based on the number of sharers; Alternatively, obtain the number of sharers, number of hits, remote access ratio, estimated replacement cost, and age metric of the hit and conflict items, and perform a weighted summation of the number of sharers, the number of hits, the remote access ratio, the estimated replacement cost, and the age metric to obtain the first retention priority.

[0008] In some embodiments, the step of promoting hit items, downgrading conflicting items, or swapping items based on the first retention priority specifically includes: If the conflict item is invalid, the hit item is promoted to the primary consistency directory, and the hit item is released from its original position in the extended victim directory; If the first retention priority of the hit item is greater than or equal to the first retention priority of the conflict item, the hit item is promoted to the primary consistency directory, and the conflict item is demoted to the extended victim directory. If the first retention priority of the hit item is less than the first retention priority of the conflict item, the hit item is retained in the extended victim directory, and the set of sharers of the extended victim directory is updated.

[0009] In some embodiments, the step of inserting new items, downgrading conflicting items, or reclaiming low-value items based on the slot status of the primary consistency directory and the idle status of the extended victim directory specifically includes: If the target slot in the primary consistency directory contains an invalid entry, a new directory entry for the access request is allocated in the primary consistency directory. If all target slots in the primary consistency directory are valid items, a candidate conflicting item is determined in the primary consistency directory. If there are free entries in the extended victim directory, the candidate conflict entry is downgraded to the extended victim directory, and a new directory entry for the access request is inserted into the primary consistency directory. If there are no empty items in the extended victim directory, identify the items to be reclaimed and then reclaim those items. If the reclaimed item includes a valid sharer, perform invalidation, downgrade, write-back, broadcast probe, or release.

[0010] In some embodiments, determining the recyclable item specifically includes: Identify candidate recycling items in the expanded victim list; The directory entry with the smallest number of sharers among the new directory entry, the candidate conflict entries, and the candidate reclaimed entries is identified as the reclaimed entry.

[0011] In some embodiments, determining the recyclable item specifically includes: Identify candidate recycling items in the expanded victim list; Calculate the second retention priority corresponding to the new directory entry, the candidate conflict entry, and the candidate recycling entry, and then determine the directory entry with the lowest second retention priority as the recycling entry; If the second retention priority corresponding to the new directory entry, the candidate conflict entry, and the candidate recycling entry is the same, the directory entry with the oldest age among the new directory entry, the candidate conflict entry, and the candidate recycling entry is determined as the recycling entry.

[0012] In some embodiments, determining the recyclable item specifically includes: Identify candidate recycling items in the expanded victim list; The new directory entry, the candidate conflict entry, and the candidate reclaimed entries are identified as the reclaimed entries if they have no valid sharer, no protocol extension status, or have not been matched within a preset period.

[0013] To achieve the above objectives, another aspect of this application proposes an extended victim directory management system for a cache consistency directory, comprising: The directory extension module is used to add an extended victim directory alongside the primary consistency directory; The request receiving and parallel probing module is used to receive access requests and query the primary consistency directory and the extended victim directory in parallel according to the access requests. The first management module is used to update the sharer set if the access request hits the main consistency directory; The second management module is used to obtain the hit item in the extended victim directory and the conflict item in the primary consistency directory if the access request hits the extended victim directory, calculate the first retention priority of the hit item and the conflict item, and then promote the hit item, downgrade or swap the conflict item according to the first retention priority. The third management module is used to insert new items, downgrade conflicting items, or reclaim low-value items based on the slot status of the primary consistency directory and the idle status of the extended victim directory if the access request does not hit the primary consistency directory and the extended victim directory.

[0014] To achieve the above objectives, another aspect of this application provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the method described above.

[0015] To achieve the above objectives, another aspect of the embodiments of this application proposes a computer program product, including a computer program that, when executed by a processor, implements the aforementioned method.

[0016] The embodiments of this application include at least the following beneficial effects: The extended victim directory management method and system for cache consistency directories of this application first sets up an extended victim directory next to the primary consistency directory to store replaced directory entries; then, the primary consistency directory and the extended victim directory are probed in parallel or near parallel within the same request processing window; when an access request is missing in the primary consistency directory but hit in the extended victim directory, the conflicting entry in the primary consistency directory that conflicts with the mapping of the access request is located; then, a first retention priority is calculated for the hit entries in the extended victim directory and the conflicting entries in the primary consistency directory, and the hit entries are promoted, the conflicting entries are downgraded or swapped according to the first retention priority, making it easier for high-value directory entries to re-enter the primary consistency directory; when both the primary consistency directory and the extended victim directory are hit, new entries are inserted, conflicting entries are downgraded or low-value entries are recycled according to the slot status of the primary consistency directory and the idle status of the extended victim directory. This application, by co-managing consistency metadata through the primary consistency directory and the extended victim directory, can reduce global failures, broadcast probes or remote retrievals caused by directory replacement, and improve the effective retention rate of remote cache replicas. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the embodiments of this application are described below. It should be understood that the drawings described below are only for the purpose of clearly illustrating some embodiments of the technical solutions in this application. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0018] Figure 1 This is a schematic diagram of the system architecture provided in one embodiment of this application; Figure 2 A flowchart illustrating the steps of an extended victim directory management method for a cache consistency directory, provided in one embodiment of this application. Figure 3 A flowchart illustrating an embodiment of the extended victim directory management method provided in this application; Figure 4 A schematic diagram of the structure of an extended victim directory management system for a cache consistency directory provided in one embodiment of this application; Figure 5 This is a schematic diagram of the hardware structure of an electronic device provided in one embodiment of this application. Detailed Implementation

[0019] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of this application and are not intended to limit it. In the following description, when referring to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with those of this application; they are merely examples of apparatuses and methods consistent with some aspects of the embodiments of this application as detailed in the appended claims.

[0020] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.

[0021] Directory-based cache coherency protocols typically use a home directory to record the status of cache lines and the set of sharers. As multi-GPU, multi-chip GPU, many-core processor, and heterogeneous computing systems scale up, the number of remote cache replicas increases, and the number of active cache lines the directory needs to track also increases. Limited by chip area, power consumption, and access latency, the on-chip home directory capacity often cannot be expanded indefinitely. Therefore, in scenarios with high-concurrency remote access, address mapping conflicts, or hotspot sharing, the home directory may be frequently replaced.

[0022] If home directory replacement simply discards still-active directory entries, the system will lose accurate sharer information. To maintain consistency, the system may need to immediately invalidate the shared copy of the replaced directory entry record, or use broadcast, multicast probing, or remote data retrieval in subsequent accesses. These operations may not necessarily stem from actual data conflicts, but they consume interconnect bandwidth and increase access latency.

[0023] Traditional cache replacement strategies are typically designed for data block reusability, such as LRU (Least Recently Used), FIFO (First In First Out), or random replacement. However, the value of a consistent directory entry depends not only on data reuse but also on the number of sharers of that entry, the probability of subsequent participation in consistent transactions, and the potential failures or probing costs triggered after replacement. Treating directory entries with only a standard replacement strategy can easily cause high-value consistent metadata to leave the main directory prematurely.

[0024] Existing directory management methods have the following main drawbacks: (1) Limited main directory capacity leads to premature replacement of active directory entries. In multi-core GPU or multi-GPU systems, the number of remote cache replicas is large, and the number of active shared cache lines may exceed the on-chip main directory capacity. When regular group-associative directories are in conflict, missing, or have insufficient capacity, they can only replace directory entries, which can easily lead to the loss of information about still active sharers.

[0025] (2) Directory replacement may trigger global failures or broadcast probes unrelated to actual writes. To maintain consistency, systems often need to fail shared copies of records before losing directory entries, or use more conservative broadcast / multicast probes on subsequent accesses. These operations are not triggered by actual data conflicts, but they consume cross-core interconnect bandwidth.

[0026] (3) Conventional replacement strategies do not measure the “value of consistent metadata”. The value of a consistent directory entry depends on whether it will participate in subsequent consistent transactions, whether there are many sharers, and whether the replacement will cause costly failures. Replacing directory entries based solely on LRU, FIFO, or random strategies can easily cause high-value directory entries to leave the main directory.

[0027] In view of this, this application proposes an extended victim directory management method for a cache consistency directory. First, an extended victim directory is set up next to the primary consistency directory to store replaced directory entries. Then, the primary consistency directory and the extended victim directory are probed in parallel or near-parallel within the same request processing window. When an access request is missing from the primary consistency directory but hit in the extended victim directory, conflicting entries in the primary consistency directory that conflict with the access request's mapping are located. A first retention priority is calculated for hit entries in the extended victim directory and conflicting entries in the primary consistency directory. Based on the first retention priority, hit entries are promoted, conflicting entries are downgraded, or swapped, making it easier for high-value directory entries to re-enter the primary consistency directory. When both the primary consistency directory and the extended victim directory are hit, new entries are inserted, conflicting entries are downgraded, or low-value entries are reclaimed based on the slot status of the primary consistency directory and the idle status of the extended victim directory. This application, by collaboratively managing consistency metadata through the primary consistency directory and the extended victim directory, can reduce global failures, broadcast probes, or remote retrievals caused by directory replacement and improve the effective retention rate of remote cache replicas.

[0028] This application's embodiments are applicable to processing systems that require maintaining consistency of cache replicas across multiple processing nodes. Taking a multi-core GPU as an example, the system comprises multiple GPU cores, each core including a compute unit, a local L1 cache, a local L2 cache, a storage partition, and a cross-core interconnect interface. To reduce NUMA remote access overhead, the system allows a core to cache remote data in its local L2 cache or other remote cache structures. The directory controller of the home core is responsible for recording which cores hold copies of the target cache lines. In such systems, the on-chip directory area is limited, and the home consistency directory typically adopts a set-associative structure. When the number of active shared cache lines exceeds the directory capacity, or when multiple addresses map to the same set and a conflict occurs, the home directory replaces existing directory entries. If the replaced directory entry still corresponds to an active remote replica, the system may need to immediately initiate a failure or use a more conservative probing method in subsequent accesses to avoid subsequent consistency errors.

[0029] Reference Figure 1 This is a schematic diagram of the system architecture provided in one embodiment of this application, as shown below. Figure 1 As shown, the system includes, but is not limited to, a primary consistency directory, an extended victim directory, a parallel detection module, a conflict location module, a retention priority assessment module, a promotion / demotion / swap control module, a capacity reclamation and consistency processing module, and a directory scheduling boundary unit. Wherein: The primary consistency directory stores the currently prioritized directory entries and can adopt a group-associative structure; the directory entries store the consistency metadata required by the underlying consistency protocol.

[0030] Extend the victim directory to store directory entries that have been replaced, downgraded, or cannot be directly accommodated from the main directory due to conflicts with the main directory. This directory can be in a fully associative, set-associative, content-addressable memory (CAM), or near-fully associative structure.

[0031] The parallel probing module is used to simultaneously query the primary consistency directory and the extended victim directory when an access request arrives, and output results such as primary directory hit, extended victim directory hit, and both not hit.

[0032] The conflict item location module is used to locate the mapping group of the target address in the home directory and the current conflict item for requests that are not hit in the home directory but are hit in the extended victim directory.

[0033] The retention priority assessment module is used to calculate the retention priority of a directory entry based on the number of directory entry sharers, status field, recent access count, remote access ratio, age information, or replacement cost estimate.

[0034] The promotion / demotion / exchange control module is used to promote high-value directory items in the extended victim directory to the main directory or demote low-value conflict items in the main directory to the extended victim directory based on the retention priority comparison results.

[0035] The recycling and consistency processing module is used to select low-value directory items for release, invalidation, write-back, broadcast probe, or other consistency processing as specified in the protocol when the capacity of the expanded victim directory is insufficient.

[0036] The directory scheduling boundary unit is used to limit the triggering conditions and action boundaries of the extended victim directory: within the access request processing window, it identifies the main directory as missing and the extended victim directory as hit, locates the main directory mapping conflict item, and decides whether to promote, demote or swap based on the retention priority; this unit does not use the recall transaction when the tagfilter entry is released as a necessary triggering condition, nor does it perform precise index / bitmap representation switching within the same directory item.

[0037] Reference Figure 2 , Figure 2 This is a flowchart illustrating the steps of an extended victim directory management method for a cache consistency directory according to an embodiment of this application. This application proposes an extended victim directory management method for a cache consistency directory, which may include, but is not limited to, the following steps S101 to S105: Step S101: Add an extended victim directory next to the primary consistency directory; Specifically, a collaborative structure is set up between the primary consistency directory and the extended victim directory, so that consistency directory entries that are replaced, downgraded, or cannot be directly inserted into the primary consistency directory can continue to be preserved and participate in home directory arbitration.

[0038] It should be noted that, unlike ordinary cached data (victimcache), the objects stored in this embodiment are consistency metadata required to save, read, and migrate the underlying consistency protocol, and the necessary content is determined by the underlying consistency protocol. When an access request arrives, the directory controller probes the main directory and extended victim directories in parallel, and decides whether to promote, demote, swap, or reclaim directory entries based on the hit location and retention priority.

[0039] Step S102: Receive the access request and query the primary consistency directory and the extended victim directory in parallel according to the access request; Specifically, access requests are received from compute cores, cache controllers, or interconnect ports; these requests can be remote reads, writes, atomic operations, replacement notifications, directory queries, or consistency transactions. For the embodiments of this application, the request type is primarily used to determine whether a directory query and update of the sharer set are necessary, rather than focusing on synchronization boundaries as an independent core. Then, within the access request processing window, the primary consistency directory and extended victim directories are probed in parallel or near parallel to identify cases such as primary directory hits, extended victim directory hits, and double misses.

[0040] Step S103: If the access request hits the primary consistency directory, update the sharer set; Step S104: If the access request hits the extended victim directory, obtain the hit items in the extended victim directory and the conflicting items in the primary consistency directory, calculate the first retention priority of the hit items and the conflicting items, and then promote the hit items and demote or swap the conflicting items according to the first retention priority. Step S105: If the access request does not hit the primary consistency directory and the extended victim directory, insert new items, downgrade conflicting items, or reclaim low-value items according to the slot status of the primary consistency directory and the idle status of the extended victim directory.

[0041] Specifically, the access request is sent to both the main directory lookup path and the extended victim directory lookup path simultaneously. If the main directory is hit, the main directory entry is used first to complete the protocol processing; if the main directory is not hit but the extended victim directory is hit, the conflicting entry in the main directory that conflicts with the target address mapping is located, and a first retention priority is calculated for the hit entry in the extended victim directory and the conflicting entry in the main directory. Based on the first retention priority, promotion, demotion, swapping, or in-place update is performed to make it easier for high-value directory entries to re-enter the main directory; if neither is hit, new entry insertion, conflicting entry demotion, or low-value entry recycling is performed based on the main directory slot status, the free status of the extended victim directory, and the candidate retention priority.

[0042] For example, such as Figure 3The diagram shows a flowchart of the extended victim directory management method. When the directory controller receives an access request from target address A, it performs the following operations: (1) Query the primary consistency directory according to the directory lookup rules corresponding to the target address A, and determine whether there is a matching directory entry; (2) Query the extended victim directory according to the directory lookup rules corresponding to the target address A, and determine whether there is a matching directory entry; (3) If the main directory is hit, the request is processed according to the underlying protocol, and the sharer set, status field and reserved statistics field are updated. The sharer set can be a node bitmap, a core bitmap, a compressed bit vector, a list of sharer IDs or a group vector. (4) If the main directory is not hit but the extended victim directory is hit, then read the hit item E_v in the extended victim directory and locate the conflict item E_m in the main directory that conflicts with the mapping of A; (5) If neither the main directory nor the extended victim directory is matched, the new directory item allocation process will begin.

[0043] It should be noted that parallel probing can be performed within the same directory controller pipeline, or the main directory can be prioritized and the extended victim directory can be checked subsequently. Furthermore, in this embodiment, the supplementary checks still belong to the same access request processing window. Before performing subsequent processing for directory missing requests, the controller identifies whether the target address is still stored in the extended victim directory, and decides whether to perform promotion, demotion, or swap accordingly.

[0044] As an optional implementation, the step of calculating the first retention priority of hits and conflicts can be further divided into the following steps S1041 or S1042: Step S1041: Obtain the number of sharers for hit items and conflicting items, and calculate the first retention priority based on the number of sharers; Alternatively, in step S1042, obtain the number of sharers, number of hits, remote access ratio, replacement cost estimate, and age metric for hit and conflict items, and perform a weighted summation of the number of sharers, number of hits, remote access ratio, replacement cost estimate, and age metric to obtain the first retention priority.

[0045] Specifically, the first retention priority is used to determine which directory entry is more suitable to reside in the home directory. In some optional embodiments, the number of sharers (sharer_num) can be used as the basic metric, i.e.: Score(e) = sharer_num(e); Where 'e' represents a directory entry, 'Score(e)' represents the first retention priority of the directory entry, and 'sharer_num(e)' represents the number of sharers recorded in the directory entry. The more sharers, the higher the cost of failure messages, probe messages, or remote retrieval that may be triggered after the directory entry is replaced. Moreover, once replaced, it may cause more replicas to fail or more broadcast probes. Therefore, its first retention priority is higher, and it should be kept in the main directory.

[0046] In other alternative embodiments, recent hit counts, remote access ratios, age metrics, or replacement cost estimates can be overlaid and weighted to calculate the first retention priority, i.e.: Score(e) = w_s sharer_num(e)+w_h hit_recent(e)+w_r remote_ratio(e)+w_c cost_est(e)-w_a age(e); Here, hit_recent(e) represents the number of recent hits or access activity; remote_ratio(e) represents the proportion of remote accesses involved in the directory entry; cost_est(e) represents the estimated failure or probe cost that may result from replacing the directory entry; age(e) represents the time the directory entry has not been accessed or the replacement age; w_s, w_h, w_r, w_c, and w_a are non-negative weights that can be determined by hardware configuration registers or design-time parameters.

[0047] It should be noted that if hardware simplification is required, only the number of sharers (sharer_num) can be used; if higher prediction accuracy is needed, the combined metrics mentioned above can be used. The retention priority Score(e) is used to compare the residency value of different directory entries between the main directory and the extended victim directory, and is not used to switch the same directory entry from an exact index representation to a bitmap representation or a grouped representation. Even if an implementation supports both compressed sharer vectors and bitmap sharer sets, the role of Score(e) is still to guide the scheduling of directory entry locations.

[0048] As an optional implementation, the step of promoting hit items, downgrading conflicting items, or exchanging them based on the first retention priority can be further divided into the following steps S1043 to S1045: Step S1043: If the conflict item is invalid, promote the hit item to the primary consistency directory and release the hit item from its original position in the extended victim directory. Step S1044: If the first retention priority of the hit item is greater than or equal to the first retention priority of the conflicting item, promote the hit item to the primary consistency directory and demote the conflicting item to the extended victim directory. Step S1045: If the first retention priority of the hit item is lower than the first retention priority of the conflicting item, retain the hit item in the extended victim directory and update the sharer set of the extended victim directory.

[0049] For example, if target address A does not hit the main directory but hits the extended victim directory, the controller obtains the hit item E_v in the extended victim directory and the conflict item E_m in the main directory that conflicts with the mapping of A. The hit item E_v is not processed after a background recall, but participates in conflict item comparison and dwell location scheduling within the directory processing window triggered by the current access request.

[0050] The controller performs the following steps: (1) Calculate the first retention priority Score(E_v) of the hit item E_v and the first retention priority Score(E_m) of the conflict item E_m; (2) If the conflicting item E_m is invalid, the hit item E_v will be promoted to the main directory and its original location in the extended victim directory will be released; (3) If the first retention priority Score(E_v) of the hit item E_v is greater than or equal to the first retention priority Score(E_m) of the conflict item E_m, then the hit item E_v is promoted to the main directory and the conflict item E_m is demoted to the extended victim directory, thus achieving the exchange between the two. (4) If the first retention priority score(E_v) of the hit item E_v is less than the first retention priority score(E_m) of the conflicting item E_m, then keep the hit item E_v in the extended victim directory and only update its sharer set and retention statistics field in the extended victim directory; (5) Data responses, state updates, or sharer set updates required to execute the underlying consensus protocol.

[0051] This process allows recently accessed directory entries with a wide sharing scope to return to the main directory, while low-value directory entries are downgraded to extended victim directories, thereby increasing the probability of high-value metadata residing in the main directory. This process does not require initiating a recall transaction or releasing tagfilte entries beforehand; its goal is to restore the main directory residency of high-value directory metadata on the directory hit path.

[0052] It should be noted that during migration, the necessary state for consistency arbitration, the set of sharers, and the retention priority information in the directory entry must remain consistent. The migration changes the storage location of the directory entry, but does not change the consistency arbitration identity of the home controller for that cache line.

[0053] As an optional implementation, the step of inserting new items, downgrading conflicting items, or reclaiming low-value items based on the slot status of the primary consistency directory and the idle status of the extended victim directory can be further divided into the following steps S1051 to S1055: Step S1051: If there is an invalid entry in the target slot of the primary consistency directory, allocate a new directory entry for the access request in the primary consistency directory; Step S1052: If all target slots in the primary consistency directory are valid items, determine a candidate conflicting item in the primary consistency directory; Step S1053: When there are free entries in the extended victim directory, downgrade the candidate conflict entry to the extended victim directory and insert the new directory entry for the access request into the primary consistency directory; Step S1054: When there are no free items in the expanded victim directory, identify the items to be reclaimed and then reclaim them. Step S1055: If the reclaimed items include valid sharers, perform invalidation, downgrade, write-back, broadcast probe, or release.

[0054] For example, such as Figure 3 As shown, if target address A fails to hit both the main directory and the extended victim directory, the controller executes the following process based on the target slot status of the main directory: (1) If there is an invalid item in the target slot of the main directory, then a new directory item will be allocated directly in the main directory; (2) If all target slots in the main directory are valid, select one candidate conflict item E_n; (3) If there are free entries in the extended victim directory, the candidate conflict entry E_n is downgraded to the extended victim directory, and a new directory entry with target address A is inserted in the main directory; (4) If there are no free items in the extended victim directory, compare the second retention priority of the new directory items, candidate conflict items and candidate reclaim items in the extended victim directory, and select the low-value items for reclamation; (5) If the reclaimed item still has a valid sharer, then invalidation, degradation, write-back, broadcast probe or safe release shall be performed in accordance with the underlying consistency protocol.

[0055] Furthermore, in a simplified implementation, when the conflicting entry in the main directory is valid and there is space in the extended victim directory, the new entry can be directly inserted into the extended victim directory without immediately replacing the conflicting entry in the main directory. This strategy is suitable for scenarios where the number of sharers of the conflicting entry in the main directory is high, and the new entry has not yet shown high activity.

[0056] As an optional implementation, the step of determining the recyclable items can be further divided into the following steps A10541 to A10542: Step A10541: Identify candidate reclaim items in the expanded victim list; Step A10542: Determine the directory entry with the smallest number of sharers among the new directory entry, candidate conflict entries, and candidate reclaimed entries as the reclaimed entry.

[0057] As an optional implementation, the step of determining the recyclable items can be further divided into the following steps B10541 to B10543: Step B10541: Identify candidate reclaim items in the expanded victim list; Step B10542: Calculate the second retention priority corresponding to the new catalog item, candidate conflict items, and candidate reclaim items, and then determine the catalog item with the lowest second retention priority as the reclaim item; Step B10543: If the second retention priority of the new catalog item, the candidate conflict item, and the candidate reclaimed item are all the same, determine the catalog item with the oldest age among the new catalog item, the candidate conflict item, and the candidate reclaimed item as the reclaimed item.

[0058] As an optional implementation, the step of determining the recyclable items can be further divided into the following steps C10541 to C10542: Step C10541: Identify candidate reclaim items in the expanded victim list; Step C10542: Determine whether a new directory entry, a candidate conflict entry, or a candidate reclaimed entry is a reclaimed entry if it has no valid sharer, no protocol extension status, or has not been matched within a preset period.

[0059] Specifically, when the expanded victim directory capacity is insufficient and new directory entries must be inserted, any of the following strategies can be used to select reclaimed items: (1) Select the directory entry with the smallest number of sharer_num among the new directory entries, candidate conflict entries, and candidate reclaimed entries as the reclaimed entry; (2) Calculate the second retention priority Score(e) corresponding to the new catalog item, candidate conflict item and candidate reclaimed item according to the above method, and select the catalog item with the smallest second retention priority Score(e) as the reclaimed item; (3) If the second retention priority Score(e) are the same, select the catalog item with the oldest age as the item to be recycled; (4) Prioritize the recovery of directory entries that have no valid sharers, no protocol extension status, or have not been recently hit; (5) Adopt a low-cost hardware strategy that combines grouped approximation LRU with the number of sharers.

[0060] Once a reclaimed item is determined, if the directory entry still records a valid sharer, the controller performs the necessary processing according to the underlying consistency protocol to ensure that the release of the directory metadata does not compromise consistency.

[0061] It should be further noted that the embodiments of this application can save any directory state fields required by the underlying protocol, such as shared state, exclusive state, dirty state, reserved state, or other protocol extended states. However, the embodiments of this application do not require delaying write request invalidation to the synchronization boundary, nor do they require uniformly emptying the set of pending invalidations during release or memoryfence. The core of the embodiments of this application is the retention, migration, and exchange of directory entries between the main directory and the extended victim directory. If a system simultaneously implements a "lazy cache invalidation" mechanism, the extended victim directory can serve as the metadata storage carrier for this mechanism; however, even without implementing lazy cache invalidation, the embodiments of this application can still be used independently to reduce unnecessary invalidations and remote cache retrieval caused by directory replacement.

[0062] It is understood that in the above embodiments, the extended victim directory is not a transaction buffer for incomplete snoops, but a consistent metadata retention structure under directory capacity pressure. It stores consistent directory metadata that can continue to participate in home directory arbitration, not cached data, nor a recall buffer used only to release tagfilter entries. Directory entry swapping is triggered by a missing home directory and a hit in the extended victim directory, not by a recall transaction when the tagfilter releases entries for a new transaction. The number of sharers in the retention priority is used to select the residence location between the home directory and the extended victim directory, rather than determining whether the same directory entry adopts an exact index mode or a bitmap mode.

[0063] The extended victim directory management method for cache consistency directory according to embodiments of this application has been described above. It can be recognized that, compared with existing directory management methods, embodiments of this application have the following advantages: I. Reduce global failures caused by directory replacement. In this embodiment, when a main directory entry is replaced, it is first migrated to the extended victim directory, so that the information of still active sharers is retained, avoiding an immediate global failure due to the loss of directory metadata.

[0064] Second, increase the retention probability of high-value entries in the main directory. This application's embodiments utilize the number of sharers or the replacement cost derived from the number of sharers to evaluate the value of directory items, making it easier for entries with a large sharing scope and a high probability of subsequent consistent transactions to remain in the main directory.

[0065] 3. Reduce cross-core interconnect control traffic. Because active directory entries are preserved, subsequent accesses can continue to use accurate sharer information, reducing broadcast snoops, multicast probes, conservative failures, and remote data retrieval.

[0066] IV. Increasing the effective capacity of the directory under a fixed storage budget. Embodiments of this application can divide some entries that were originally allocated entirely to the main directory into extended victim directories, making the directory system more resilient when facing conflict replacements, without necessarily increasing the total number of directory entries.

[0067] V. Compatible with existing directory-based consistency protocols. The embodiments of this application change the storage location and migration strategy of directory entries, but do not change the consistency principle that each cached line is arbitrated by the home directory controller. Therefore, it can be combined with HMG, REC, hierarchical directories, compressed directories or other directory-based protocols.

[0068] Furthermore, in addition to the above embodiments, this application can also make the following modifications: (1) The extended victim directory can be a fully associative CAM, or a group associative structure, a grouped CAM, a hash structure, or an approximately fully associative structure with overflow chains.

[0069] (2) It can be used in conjunction with address range merging directories, hierarchical directories, compressed sharer vectors, broadcast filters or other directory capacity optimization mechanisms.

[0070] (2) It can save the extended state fields of the underlying protocol, but does not require the use of a synchronous boundary lazy failure mechanism; for systems that use an instant failure protocol, unnecessary failures can also be reduced by retaining the replaced directory entries.

[0071] (4) In some implementations, the extended victim directory can be enabled only for remote cache directory entries, while the original replacement strategy of the main directory can be directly adopted for local private cache lines or directories without sharers, so as to reduce hardware overhead.

[0072] (5) In some implementations, a hysteresis threshold can be set for the retention priority Score(e). The swap will only be performed when Score(E_v) is higher than Score(E_m) by a preset difference, so as to reduce frequent back-and-forth migrations.

[0073] (6) In some implementations, the migration between the home directory and the extended victim directory can be completed in multiple cycles; during the migration, the directory entry is marked as being migrated and the home directory controller prevents repeated migrations of the same address or performs temporary forwarding.

[0074] (7) In some implementations, the extended victim directory can be combined with the compressed sharer vector or hierarchical sharer field, but the use of the number of sharers in the Score calculation is still limited to the scheduling of directory entry residence locations.

[0075] Reference Figure 4 This application also provides an extended victim directory management system for a cache consistency directory, comprising: The directory extension module is used to add an extended victim directory alongside the primary consistency directory; The request receiving and parallel probing module is used to receive access requests and query the primary consistency directory and extended victim directory in parallel based on the access requests; The first management module is used to update the sharer set if an access request hits the primary consistency directory. The second management module is used to obtain the hit items in the extended victim directory and the conflicting items in the main consistency directory if the access request hits the extended victim directory, calculate the first retention priority of the hit items and the conflicting items, and then promote the hit items and demote or swap the conflicting items according to the first retention priority. The third management module is used to insert new items, downgrade conflicting items, or reclaim low-value items based on the slot status of the primary consistency directory and the idle status of the extended victim directory if the access request does not hit the primary consistency directory and the extended victim directory.

[0076] It is understood that the content of the above method embodiments is applicable to this system embodiment. The specific functions implemented in this system embodiment are the same as those in the above method embodiments, and the beneficial effects achieved are also the same as those achieved in the above method embodiments.

[0077] This application also provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the above-described method. This electronic device can be any smart terminal, including tablet computers, in-vehicle computers, etc.

[0078] It is understood that the content of the above method embodiments is applicable to this device embodiment. The specific functions implemented by this device embodiment are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.

[0079] Please see Figure 5 , Figure 5The hardware structure of an electronic device according to another embodiment is illustrated. The electronic device includes: The processor 1001 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this application. The memory 1002 can be implemented as a read-only memory (ROM), static storage device, dynamic storage device, or random access memory (RAM). The memory 1002 can store the operating system and other applications. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 1002 and is called and executed by the processor 1001 using the methods described in the embodiments of this application. Input / output interface 1003 is used to implement information input and output; The communication interface 1004 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.). Bus 1005 transmits information between various components of the device (e.g., processor 1001, memory 1002, input / output interface 1003, and communication interface 1004); The processor 1001, memory 1002, input / output interface 1003 and communication interface 1004 are connected to each other within the device via bus 1005.

[0080] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described method.

[0081] It is understood that the content of the above method embodiments is applicable to this storage medium embodiment. The specific functions implemented in this storage medium embodiment are the same as those in the above method embodiments, and the beneficial effects achieved are also the same as those achieved in the above method embodiments.

[0082] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method.

[0083] It is understood that the content of the above method embodiments is applicable to the embodiments of this program product. The specific functions implemented by the embodiments of this program product are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.

[0084] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

[0085] The embodiments described in this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided by the embodiments of this application. As those skilled in the art will know, with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of this application are also applicable to similar technical problems.

[0086] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of this application, and may include more or fewer steps than shown, or combine certain steps, or different steps.

[0087] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0088] Those skilled in the art will understand that all or some of the steps in the methods disclosed above, as well as the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, or suitable combinations thereof.

[0089] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0090] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.

[0091] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of the units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0092] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0093] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0094] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes multiple instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing programs, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0095] The preferred embodiments of the present application have been described above with reference to the accompanying drawings, but this does not limit the scope of the claims of the present application. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and substance of the embodiments of the present application shall be within the scope of the claims of the present application.

Claims

1. An extended victim directory management method for a cache consistency directory, characterized in that, The method includes the following steps: Add an extended victim directory next to the primary consistency directory; Receive an access request, and query the primary consistency directory and the extended victim directory in parallel according to the access request; If the access request hits the primary consistency directory, update the sharer set; If the access request hits the extended victim directory, the hit item in the extended victim directory and the conflict item in the primary consistency directory are obtained. The first retention priority of the hit item and the conflict item is calculated, and then the hit item is promoted, the conflict item is downgraded or swapped according to the first retention priority. If the access request does not hit the primary consistency directory and the extended victim directory, new items are inserted, conflicting items are downgraded, or low-value items are recycled based on the slot status of the primary consistency directory and the idle status of the extended victim directory.

2. The method according to claim 1, characterized in that, The calculation of the first retention priority of the hit item and the conflict item specifically includes: Obtain the number of sharers for the hit item and the conflict item, and calculate the first retention priority based on the number of sharers; Alternatively, obtain the number of sharers, number of hits, remote access ratio, estimated replacement cost, and age metric of the hit and conflict items, and perform a weighted summation of the number of sharers, the number of hits, the remote access ratio, the estimated replacement cost, and the age metric to obtain the first retention priority.

3. The method according to claim 1, characterized in that, The step of promoting hit items, downgrading conflicting items, or swapping them according to the first retention priority specifically includes: If the conflict item is invalid, the hit item is promoted to the primary consistency directory, and the hit item is released from its original position in the extended victim directory; If the first retention priority of the hit item is greater than or equal to the first retention priority of the conflict item, the hit item is promoted to the primary consistency directory, and the conflict item is demoted to the extended victim directory. If the first retention priority of the hit item is less than the first retention priority of the conflict item, the hit item is retained in the extended victim directory, and the set of sharers of the extended victim directory is updated.

4. The method according to claim 1, characterized in that, The process of inserting new items, downgrading conflicting items, or reclaiming low-value items based on the slot status of the primary consistency directory and the idle status of the extended victim directory specifically includes: If the target slot in the primary consistency directory contains an invalid entry, a new directory entry for the access request is allocated in the primary consistency directory. If all target slots in the primary consistency directory are valid items, a candidate conflicting item is determined in the primary consistency directory. If there are free entries in the extended victim directory, the candidate conflict entry is downgraded to the extended victim directory, and a new directory entry for the access request is inserted into the primary consistency directory. If there are no empty items in the extended victim directory, identify the items to be reclaimed and then reclaim those items. If the reclaimed item includes a valid sharer, perform invalidation, downgrade, write-back, broadcast probe, or release.

5. The method according to claim 4, characterized in that, The determination of the reclaimed items specifically includes: Identify candidate recycling items in the expanded victim list; The directory entry with the smallest number of sharers among the new directory entry, the candidate conflict entries, and the candidate reclaimed entries is identified as the reclaimed entry.

6. The method according to claim 4, characterized in that, The determination of the reclaimed items specifically includes: Identify candidate recycling items in the expanded victim list; Calculate the second retention priority corresponding to the new directory entry, the candidate conflict entry, and the candidate recycling entry, and then determine the directory entry with the lowest second retention priority as the recycling entry; If the second retention priority corresponding to the new directory entry, the candidate conflict entry, and the candidate recycling entry is the same, the directory entry with the oldest age among the new directory entry, the candidate conflict entry, and the candidate recycling entry is determined as the recycling entry.

7. The method according to claim 4, characterized in that, The determination of the reclaimed items specifically includes: Identify candidate recycling items in the expanded victim list; The new directory entry, the candidate conflict entry, and the candidate reclaimed entries are identified as the reclaimed entries if they have no valid sharer, no protocol extension status, or have not been matched within a preset period.

8. An extended victim directory management system for cache consistency directories, characterized in that, include: The directory extension module is used to add an extended victim directory alongside the primary consistency directory; The request receiving and parallel probing module is used to receive access requests and query the primary consistency directory and the extended victim directory in parallel according to the access requests. The first management module is used to update the sharer set if the access request hits the main consistency directory; The second management module is used to obtain the hit item in the extended victim directory and the conflict item in the primary consistency directory if the access request hits the extended victim directory, calculate the first retention priority of the hit item and the conflict item, and then promote the hit item, downgrade or swap the conflict item according to the first retention priority. The third management module is used to insert new items, downgrade conflicting items, or reclaim low-value items based on the slot status of the primary consistency directory and the idle status of the extended victim directory if the access request does not hit the primary consistency directory and the extended victim directory.

9. An electronic device, characterized in that, The electronic device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the method of any one of claims 1 to 7.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 1 to 7.