Cache management method and device and storage medium

By employing a replacement strategy in the GPU cache based on persistence information and quantity constraints, the problem of high-persistence data being replaced and low-persistence data failing to be hit in the cache space is solved, thereby improving cache utilization efficiency and hit rate while reducing hardware complexity.

CN121785952APending Publication Date: 2026-04-03MOORE THREADS TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-22
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

In the existing technology, data with high persistence requirements in the graphics processing unit (GPU) cache space is still being replaced, resulting in a decrease in cache hit rate, and data with low persistence requirements cannot obtain cache space for a long time, reducing the overall cache utilization efficiency.

Method used

By determining the persistence information of the target cache request, and responding to the historical data already stored in the cache space of the missed request, a simple persistence information judgment and quantity constraint are used to replace the historical data with persistence requirements or the historical data without persistence requirements, so as to ensure reasonable allocation of cache space.

Benefits of technology

It improves the effectiveness of the cache data replacement mechanism, ensures the hit rate of cache requests with high persistence requirements, and provides caching opportunities for requests with low persistence requirements, thereby achieving a balanced allocation of cache resources and reducing hardware implementation complexity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121785952A_ABST
    Figure CN121785952A_ABST
Patent Text Reader

Abstract

The invention relates to a cache management method and device and a storage medium. The method comprises the following steps: determining persistent information of a received target cache request; wherein the persistent information comprises a non-persistent demand or a persistent demand; in response to the situation that the target cache request does not hit any historical data stored in the requested cache space, the target cache request has a persistent demand, and a preset number of historical data with a persistent demand is stored in the cache space; and storing the to-be-stored data indicated by the target cache request in a cache space in a manner of replacing any historical data with a persistent requirement. According to the embodiment of the invention, the validity of a cache data replacement mechanism can be improved, and the replacement management of the data in the cache space can be realized through simple judgment and quantity constraint, so that the hardware implementation complexity is reduced, and the adaptability and expandability under different loads are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of cache control technology, and in particular to a cache management method, apparatus and storage medium. Background Technology

[0002] The core idea of ​​caching technology is to preload frequently accessed data from slower storage media (such as main memory or disk) into a high-speed cache to shorten data read / write latency and improve overall system performance. Since cache capacity is limited and can typically only store a portion of the data, how to rationally select data to be replaced when cache space is insufficient is a key issue in cache management.

[0003] In the caching architecture of modern Graphics Processing Units (GPUs), to improve the utilization efficiency of cache resources, persistence information representing "residence tendency" is typically assigned to the target cache request and the data in the cache space. Persistence information can be used to guide cache replacement strategies, such as prioritizing data with lower persistence requirements when data needs to be evicted from the cache space, thereby improving the cache hit rate of data with higher persistence requirements.

[0004] However, existing persistent information technologies typically employ multi-level designs with relatively complex structures. Even when all data in the cache space has high persistence requirements, data with high persistence needs may still be replaced, reducing the effectiveness of the cache data replacement mechanism. Furthermore, because existing replacement strategies tend to retain data with high persistence requirements, target cache requests with low persistence needs may be unable to access the cache space for extended periods, making subsequent requests almost impossible to hit the cache and reducing overall cache utilization efficiency. Summary of the Invention

[0005] In view of this, the present disclosure provides a cache management method, apparatus and storage medium.

[0006] According to one aspect of this disclosure, a cache management method is provided. The method includes:

[0007] Determine the persistence information of the received target cache request; wherein, the persistence information includes: non-persistent requests or persistent requests;

[0008] In response to the target cache request failing to hit any historical data already stored in the requested cache space, the target cache request having a persistence requirement, and the cache space already storing a preset maximum number of historical data with persistence requirements, the data to be stored indicated by the target cache request is stored in the cache space in such a way that any historical data with persistence requirements is replaced.

[0009] In one possible implementation, the method further includes:

[0010] In response to the target cache request failing to hit any historical data already stored in the requested cache space, the target cache request having a persistence requirement, and the number of historical data with persistence requirements already stored in the cache space not reaching the preset limit, the data to be stored indicated by the target cache request is stored in the cache space in a way that replaces any historical data with non-persistent requirements.

[0011] In one possible implementation, the method further includes:

[0012] In response to a target cache request failing to hit any historical data already stored in the requested cache space, and the target cache request having a non-persistent requirement, the data to be stored indicated by the target cache request is stored in the cache space in such a way that any historical data with a non-persistent requirement is replaced.

[0013] In one possible implementation, the method further includes:

[0014] In response to a target cache request failing to hit any historical data already stored in the requested cache space, and the target cache request having a persistence requirement, the persistence information of the data to be stored in the cache space is updated to the persistence requirement.

[0015] In response to a target cache request failing to hit any historical data already stored in the requested cache space, and the target cache request having a non-persistent requirement, the persistence information of the data to be stored in the cache space is updated to the non-persistent requirement.

[0016] In one possible implementation, the method further includes:

[0017] In response to a target cache request hitting the target historical data already stored in the requested cache space, update the persistence information of the target historical data based on the persistence information of the target cache request and the persistence information of the target historical data.

[0018] In one possible implementation, based on the persistence information of the target cached request and the persistence information of the target historical data, the persistence information of the target historical data is updated, including:

[0019] In response to a non-persistent requirement for the target cache request or a persistent requirement for the target historical data, the persistence information of the updated target historical data remains unchanged.

[0020] In one possible implementation, based on the persistence information of the target cached request and the persistence information of the target historical data, the persistence information of the target historical data is updated, including:

[0021] In response to the target cache request being a persistent requirement, the target historical data being a non-persistent requirement, and the cache space already storing a preset maximum number of historical data with persistent requirements, the persistence information of the updated target historical data is determined to be a non-persistent requirement.

[0022] In one possible implementation, based on the persistence information of the target cached request and the persistence information of the target historical data, the persistence information of the target historical data is updated, including:

[0023] In response to the target cache request being a persistent requirement, the target historical data being a non-persistent requirement, and the number of historical data with persistent requirements already stored in the cache space not reaching the preset limit, the updated target historical data is determined to be a persistent requirement.

[0024] According to another aspect of this disclosure, a cache management apparatus is provided. The apparatus includes:

[0025] The determination module is used to determine the persistence information of the received target cache request; wherein, the persistence information includes: non-persistent requirements or persistent requirements;

[0026] The first replacement module is used to replace any historical data with a persistent requirement in the cache space when the target cache request fails to hit any historical data already stored in the requested cache space, the target cache request has a persistence requirement, and the cache space already stores a preset maximum number of historical data with persistence requirements.

[0027] In one possible implementation, the device further includes:

[0028] The second replacement module is used to replace any historical data with non-persistent requirements in the cache space when the target cache request fails to hit any historical data already stored in the requested cache space, the target cache request has a persistence requirement, and the number of historical data with persistence requirements already stored in the cache space does not reach a preset limit.

[0029] In one possible implementation, the device further includes:

[0030] The third replacement module is used to replace any historical data with non-persistent requirements in the cache space when the target cache request fails to hit any historical data already stored in the requested cache space and the target cache request has non-persistent requirements.

[0031] In one possible implementation, the device further includes:

[0032] The first update module is used to update the persistence information of the data to be stored in the cache space to the persistence requirement in response to the target cache request not hitting any historical data already stored in the requested cache space, and the target cache request having a persistence requirement.

[0033] The second update module is used to update the persistence information of the data to be stored in the cache space to a non-persistent requirement when the target cache request fails to hit any historical data already stored in the requested cache space and the target cache request has a non-persistent requirement.

[0034] In one possible implementation, the device further includes:

[0035] The third update module is used to update the persistence information of the target historical data based on the persistence information of the target cache request and the persistence information of the target historical data in response to the target cache request hitting the target historical data already stored in the requested cache space.

[0036] In one possible implementation, the third update module is used for:

[0037] In response to a non-persistent requirement for the target cache request or a persistent requirement for the target historical data, the persistence information of the updated target historical data remains unchanged.

[0038] In one possible implementation, the third update module is used for:

[0039] In response to the target cache request being a persistent requirement, the target historical data being a non-persistent requirement, and the cache space already storing a preset maximum number of historical data with persistent requirements, the persistence information of the updated target historical data is determined to be a non-persistent requirement.

[0040] In one possible implementation, the third update module is used for:

[0041] In response to the target cache request being a persistent requirement, the target historical data being a non-persistent requirement, and the number of historical data with persistent requirements already stored in the cache space not reaching the preset limit, the updated target historical data is determined to be a persistent requirement.

[0042] According to another aspect of this disclosure, a cache management apparatus is provided, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the above-described method.

[0043] According to another aspect of this disclosure, a non-volatile computer-readable storage medium is provided, on which a computer program is stored, which, when executed by a processor, implements the steps of the above-described method.

[0044] According to another aspect of this disclosure, a computer program product is provided, including a computer program or a non-volatile computer-readable storage medium carrying the computer program, wherein the computer program, when executed by a processor, implements the steps of the above-described method.

[0045] According to embodiments of this disclosure, the replacement of historical data with persistent requirements stored in the cache space can be avoided, thus improving the effectiveness of the cache data replacement mechanism. Simultaneously, this disclosure considers the persistence information of the target cache request and the quantity of historical data with persistent requirements in the cache space. While ensuring the cache hit rate of cache requests with persistent requirements, it provides reasonable cache allocation opportunities for data requested by cache requests with non-persistent requirements, avoiding the problem of non-persistent cache requests being unable to obtain cache space for extended periods and subsequent accesses almost never hitting the cache. This achieves a balanced allocation of cache resources among cache requests with different persistence information. Since the persistence information designed in this disclosure only includes non-persistent or persistent requirements, data replacement management in the cache space can be achieved through simple judgment and quantity constraints, thereby reducing hardware implementation complexity and increasing adaptability and scalability under different loads.

[0046] Other features and aspects of this disclosure will become clear from the following detailed description of exemplary embodiments with reference to the accompanying drawings. Attached Figure Description

[0047] The accompanying drawings, which are included in and form part of this specification, illustrate exemplary embodiments, features, and aspects of this disclosure together with the specification and serve to explain the principles of this disclosure.

[0048] Figure 1 A schematic diagram illustrating an application scenario according to an embodiment of this disclosure is shown.

[0049] Figure 2 A flowchart illustrating a cache management method according to an embodiment of the present disclosure is shown.

[0050] Figure 3 A flowchart illustrating a cache management method according to an embodiment of the present disclosure is shown.

[0051] Figure 4 A structural diagram of a cache management apparatus according to an embodiment of the present disclosure is shown.

[0052] Figure 5 This is a block diagram illustrating an apparatus 1900 for cache management according to an exemplary embodiment. Detailed Implementation

[0053] Various exemplary embodiments, features, and aspects of this disclosure will now be described in detail with reference to the accompanying drawings. The same reference numerals in the drawings denote elements that have the same or similar functions. Although various aspects of the embodiments are shown in the drawings, they are not necessarily drawn to scale unless specifically indicated otherwise.

[0054] As used herein, the terms “comprising,” “including,” “having,” or variations thereof are open-ended and include one or more of the stated features, integrals, elements, steps, components, or functions, but do not exclude the presence or addition of one or more other features, integrals, elements, steps, components, functions, or groups thereof.

[0055] When an element is referred to as “connected,” “coupled,” “responding,” or a variation thereof relative to another element, it may be directly connected, coupled, or responding to another element, or there may be an intermediate element present.

[0056] Although the terms first, second, third, etc., may be used herein to describe various elements / operations, these elements / operations should not be limited by these terms. These terms are only used to distinguish one element / operation from another. Therefore, without departing from the teachings of the inventive concept, a first element / operation in some embodiments may be referred to as a second element / operation in other embodiments.

[0057] The term “exemplary” as used herein means “serving as an example, embodiment, or illustration.” Any embodiment illustrated herein as “exemplary” is not necessarily to be construed as superior to or better than other embodiments.

[0058] Furthermore, to better illustrate this disclosure, numerous specific details are set forth in the following detailed description. Those skilled in the art will understand that this disclosure can be practiced without certain specific details. In some instances, methods, means, components, and circuits well known to those skilled in the art have not been described in detail in order to highlight the main points of this disclosure.

[0059] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, data stored, data displayed, etc.) and signals involved in this application are all authorized by the user or fully authorized by all parties, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant regions.

[0060] The core idea of ​​caching technology is to preload frequently accessed data from slower storage media (such as main memory or disk) into a high-speed cache to shorten data read / write latency and improve overall system performance. Since cache capacity is limited and can typically only store a portion of the data, how to rationally select data to be replaced when cache space is insufficient is a key issue in cache management.

[0061] In the caching architecture of modern Graphics Processing Units (GPUs), to improve the utilization efficiency of cache resources, persistence information representing "residence tendency" is typically assigned to cache requests and data in the cache space. Persistence information can be used to guide cache replacement strategies, such as prioritizing data with lower persistence requirements when data needs to be evicted from the cache space, thereby improving the cache hit rate of data with higher persistence requirements.

[0062] However, existing persistent information technologies typically employ multi-level designs with relatively complex structures. Even when all data in the cache space has high persistence requirements, data with high persistence needs may still be replaced, reducing the effectiveness of the cache data replacement mechanism. Furthermore, because existing replacement strategies tend to retain data with high persistence requirements, cache requests with low persistence needs may be unable to access the cache for extended periods, making subsequent requests almost impossible to hit the cache and reducing overall cache utilization efficiency.

[0063] In view of this, the present disclosure provides a cache management method, apparatus, and storage medium. The method of the present disclosure determines the persistence information of a received target cache request. In response to the target cache request failing to hit any historical data already stored in the requested cache space, the target cache request having a persistence requirement, or the cache space already storing a preset maximum number of historical data with persistence requirements, the method stores the data to be stored indicated by the target cache request in the cache space in a manner that replaces any historical data with persistence requirements. This avoids the replacement of historical data with persistence requirements when historical data already stored in the cache space has persistence requirements, thus improving the effectiveness of the cache data replacement mechanism. Simultaneously, the present disclosure considers the persistence information of the target cache request and the number of historical data with persistence requirements in the cache space. While ensuring the cache hit rate of cache requests with persistence requirements, it provides reasonable cache allocation opportunities for data requested by cache requests with non-persistent requirements, avoiding the problem of cache requests with non-persistent requirements being unable to obtain cache space for a long time and subsequent accesses almost never hitting the cache. This achieves a balanced allocation of cache resources among cache requests with different persistence information. Since the persistent information in this design only includes non-persistent or persistent requirements, the replacement management of data in the cache space can be achieved through simple judgment and quantity constraints, thereby reducing the complexity of hardware implementation and increasing adaptability and scalability under different loads.

[0064] Figure 1 A schematic diagram illustrating an application scenario according to an embodiment of this disclosure is provided. Figure 1 As shown, the embodiments of this disclosure can be used Figure 1 The computing system shown includes a GPU, cache, and memory. The cache may include a cache controller, and all hardware control logic of the cache is implemented by the cache controller.

[0065] In this embodiment of the disclosure, the cache can be organized into multiple sets, each set including multiple cache lines. A cache line is the basic unit of data storage in the cache, and each cache line typically stores a continuous segment of data in memory.

[0066] When the GPU issues a cache request, the cache controller can check if the cache stores the requested data based on the destination address in the cache request. If the requested data is hit in the cache, it can be returned directly without accessing memory. If the data requested by the GPU is missed in the cache, and it is determined that the requested data needs to be loaded into the cache, the data to be stored can be obtained from the next-level storage device (such as memory) based on the destination address of the requested data, and stored in the cache by replacing the data in any cache line according to the method of this embodiment. During this cache data replacement process, the granularity of data exchange between the cache and memory is at the cache line level.

[0067] The cache in this embodiment can be composed of static random-access memory (SRAM). The cache can be integrated on the GPU, integrated on the main memory, or configured independently. Figure 1 This example illustrates the concept of cache being independent of both the GPU and memory.

[0068] Figure 2 A flowchart illustrating a cache management method according to an embodiment of this disclosure is shown. This method can be used as... Figure 1 The cache controller shown is as follows: Figure 2 As shown, the method includes:

[0069] Step S201: Determine the persistence information of the received target cache request.

[0070] The target cache request may include the destination address and the persistence information.

[0071] The destination address is the address of the data requested by the target cache request. This address can be a physical address (such as a memory address). Based on the destination address, the cache can be searched to see if the requested data hits any historical data (i.e. any cache line) already stored in the requested cache space. In other words, it can be determined whether the requested data has been stored in any cache line of the cache space.

[0072] Persistence information can be used to indicate the amount of persistence required for a target cache request to remain in the cache, in order to determine the data retention strategy when cached data is replaced. Each piece of data in the cache space (i.e., each cache line) also records its own persistence information.

[0073] In this embodiment of the disclosure, persistence information includes: persistence requirement (i.e., high persistence requirement, persist) or non-persistence requirement (i.e., low persistence requirement, normal). For any historical data in the cache space, when it has a persistence requirement, the historical data is preferentially retained during the cache data replacement process and is not easily replaced; while when it has a non-persistence requirement, the historical data is more likely to be evicted when replacement is needed. For example, the value of persistence requirement can be set to 1, and the value of non-persistence requirement can be set to 0 or set to a default value (such as null).

[0074] In this embodiment of the disclosure, when it is necessary to replace historical data in the cache space, if the target cache request has a persistence requirement, it can replace historical data in the cache space that has a persistence requirement or a non-persistence requirement; if the target cache request has a non-persistence requirement, it can only replace historical data in the cache space that has a non-persistence requirement. This ensures that data with persistence requirements has a stronger residency capability in the cache space.

[0075] In step S202, in response to the target cache request not hitting any historical data already stored in the requested cache space, the target cache request having a persistence requirement, and the cache space already storing a preset maximum number of historical data with persistence requirements, the data to be stored indicated by the target cache request is stored in the cache space in a manner that replaces any historical data with persistence requirements.

[0076] According to embodiments of this disclosure, the replacement of historical data with persistent requirements stored in the cache space can be avoided, thus improving the effectiveness of the cache data replacement mechanism. Simultaneously, this disclosure considers the persistence information of the target cache request and the quantity of historical data with persistent requirements in the cache space. While ensuring the cache hit rate of cache requests with persistent requirements, it provides reasonable cache allocation opportunities for data requested by cache requests with non-persistent requirements, avoiding the problem of non-persistent cache requests being unable to obtain cache space for extended periods and subsequent accesses almost never hitting the cache. This achieves a balanced allocation of cache resources among cache requests with different persistence information. Since the persistence information designed in this disclosure only includes non-persistent or persistent requirements, data replacement management in the cache space can be achieved through simple judgment and quantity constraints, thereby reducing hardware implementation complexity and increasing adaptability and scalability under different loads.

[0077] The cache space requested by the target cache request can be any one or more sets in the above cache, and any historical data already stored in the cache space can be a continuous data segment stored in the cache line of any one or more sets in the above cache.

[0078] The target cache request misses any historical data already stored in the requested cache space. This can mean that there is no cache line in the cache space storing the data requested by the target cache request, that is, the data requested by the target cache request is not stored in the requested cache space.

[0079] The preset upper limit can be pre-configured via a register (e.g., MAX_PERSIST_WAY_NUM) to indicate the maximum number of historical data with persistent requirements in the cache space. That is, it indicates the maximum number of cache lines storing historical data with persistent requirements allowed in each group (i.e., the set mentioned above) of the cache space. The preset upper limit can be configured to be less than the maximum number of cache lines contained in each set of the cache space to avoid all historical data in the cache space having persistent requirements, thereby affecting the flexibility of cache replacement and cache sharing efficiency. In step S202, this preset upper limit can be configured to be greater than 0.

[0080] A counter (cur_set_persit_way_cnt) can be configured in the cache space (e.g., a cached set) to record the number of historical data with persistence requirements in the cache space, which is the number of cache lines with persistence requirements in the missed set, i.e., the cur_set_persit_way_cnt value corresponding to the missed set.

[0081] The data to be stored can be retrieved from the next level of storage (e.g., memory) based on the destination address carried by the target cache request.

[0082] The replacement of any historical data with persistent requirements can be implemented using any existing replacement algorithm, such as the Least Recently Used (LRU) algorithm, the Pseudo Least Recently Used (PLRU) algorithm, etc., and this disclosure does not limit this.

[0083] For example, with the LRU algorithm, based on the access information of cache lines corresponding to historical data with persistent requirements in the cache space, the least recently accessed cache line can be selected, and the historical data stored in that cache line can be replaced with the data to be stored. Specifically, the timestamp or access order flag of the corresponding cache line can be updated as access information each time the cache is accessed; the least recently accessed cache line is the one with the earliest timestamp or the latest access order.

[0084] For example, for the PLRU algorithm, the replacement target can be located based on the PLRU flag (e.g., the direction bit of a binary tree structure) of the cache line corresponding to the historical data with persistent requirements in the cache space. The cache line considered to be "least frequently used" can be found according to the path indicated by the PLRU flag. The historical data stored in the cache line can be replaced with the data to be stored, and the PLRU flag of the cache line can be updated after the replacement to reflect the new access status.

[0085] In some cases, even if the target cache request does not hit any historical data already stored in the requested cache space, it is not necessary to allocate a cache line for the destination address. This is for example, if the data requested by the target cache request is only used for one-time calculations or temporary reads. In this case, the process can be terminated without updating the persistence information of any cacheline data in the cache space.

[0086] In this embodiment, three different cache data replacement strategies (referred to as level 1 to level 3) can exist. When the preset quantity limit is set to be greater than 0, level 2 or level 3 can be used. The method of replacing any historical data with persistence requirements in the cache space with the data to be stored in step S202 can correspond to the level 2 strategy. Since the level 2 strategy will not replace historical data with the default persistence information in the cache space (i.e., the corresponding cache line has not yet stored data), it can prevent the number of historical data with persistence requirements from exceeding the preset quantity limit, thereby effectively avoiding deadlock in the cache replacement strategy.

[0087] In other cases, replacing any historical data in the cache space that has non-persistent requirements with the data to be stored corresponds to level 3.

[0088] Therefore, different distinctions and selections can be made according to different situations, making the cache data replacement strategy more flexible and efficient in adapting to different persistent information and cache usage.

[0089] When the preset quantity limit is set to 0, level 1 can be used. Under this strategy, the difference in persistence information does not need to be considered; that is, neither the persistence information of the target cache request nor the persistence information of each historical data in the cache space is taken into account. In this case, the data to be stored can replace any historical data in the cache space that has persistence requirements or non-persistence requirements.

[0090] This allows for the simplest and most flexible cache data replacement strategy, ensuring that caching behavior remains consistent with traditional replacement processes and avoiding additional complexity introduced by persistent information. This makes it suitable for scenarios that are not sensitive to persistent information or do not require persistent information management.

[0091] In one possible implementation, the method may further include:

[0092] In response to the target cache request failing to hit any historical data already stored in the requested cache space, the target cache request having a persistence requirement, and the number of historical data with persistence requirements already stored in the cache space not reaching the preset limit, the data to be stored indicated by the target cache request is stored in the cache space in a way that replaces any historical data with non-persistent requirements.

[0093] Historical data with non-persistent requirements can have a persistence information of 0 for the data in the corresponding cache line, or a persistence information of the data in the corresponding cache line with a default value (i.e., no persistence information has been allocated, for example, no data has been stored in the cache line).

[0094] This avoids the problem that data with persistent requirements cannot reside in the cache for a long time, ensuring that cache requests with persistent requirements receive the necessary cache protection.

[0095] The replacement of any historical data with non-persistent requirements can be implemented using any existing replacement algorithm, such as the LRU algorithm and PLRU algorithm mentioned above. This disclosure does not limit this approach.

[0096] In one possible implementation, the method may further include:

[0097] In response to a target cache request failing to hit any historical data already stored in the requested cache space, and the target cache request having a non-persistent requirement, the data to be stored indicated by the target cache request is stored in the cache space in such a way that any historical data with a non-persistent requirement is replaced.

[0098] This avoids the situation where non-persistent data evicts persistent historical data from the cache, thus ensuring that persistent data is prioritized for storage in the cache. For the data to be stored in the cache after replacement, its persistence information can be updated based on different scenarios.

[0099] In one possible implementation, the method further includes:

[0100] In response to a target cache request failing to hit any historical data already stored in the requested cache space, and the target cache request having a persistence requirement, the persistence information of the data to be stored stored in the cache space is updated to a persistence requirement; in response to a target cache request failing to hit any historical data already stored in the requested cache space, and the target cache request having a non-persistent requirement, the persistence information of the data to be stored stored in the cache space is updated to a non-persistent requirement.

[0101] This ensures that the data to be stored in the replaced cache space has persistence information that matches the target cache request, thus ensuring that the cache data replacement strategy can correctly distinguish and manage data with different persistence information during subsequent operation.

[0102] In one possible implementation, the method may further include:

[0103] In response to a target cache request hitting the target historical data already stored in the requested cache space, update the persistence information of the target historical data based on the persistence information of the target cache request and the persistence information of the target historical data.

[0104] A hit in the target cache request means that the target historical data is already stored in the requested cache space. This could mean that the cache space contains a cache line storing data corresponding to the destination address carried by the target cache request, allowing direct reading of the target historical data without reloading from other storage (such as memory). In the event of a hit, the persistence information of the target historical data can be dynamically adjusted.

[0105] Therefore, the persistence information of data in the cache space can be adaptively updated according to the access behavior of cache requests, thereby avoiding the situation where cache requests with persistence requirements are hit for a long time but are not reflected in the persistence information management. Furthermore, it can ensure that data with persistence requirements has a more stable residence space in the cache, reduce the probability of being replaced by data with non-persistent requirements, and improve the hit performance of cache management strategies.

[0106] The step of updating the persistence information of the target historical data can only be performed when the preset quantity limit is set to a value greater than 0. When the preset quantity limit is set to 0, the target historical data can be kept as a non-persistent requirement.

[0107] In one possible implementation, in response to the target cache request hitting the target historical data already stored in the requested cache space, the persistence information of the target historical data is updated based on the persistence information of the target cache request and the persistence information of the target historical data, which may include:

[0108] In response to a non-persistent requirement for the target cache request or a persistent requirement for the target historical data, the persistence information of the updated target historical data remains unchanged.

[0109] The persistence information of the updated target historical data remains unchanged can include the following three scenarios:

[0110] 1. If the target cache request is a non-persistent requirement and the target historical data is also a non-persistent requirement, then the updated target historical data will also be a non-persistent requirement.

[0111] 2. If the target cache request is a persistent requirement and the target historical data is also a persistent requirement, then the updated target historical data will also be a persistent requirement.

[0112] 3. If the target cache request is a non-persistent requirement and the target historical data is a persistent requirement, then the updated target historical data will also be a persistent requirement.

[0113] Therefore, under the above conditions, the persistence information of the updated target historical data can remain unchanged, avoiding the erroneous modification of the persistence information of the target historical data by cache requests in the above situation.

[0114] In one possible implementation, in response to the target cache request hitting the target historical data already stored in the requested cache space, the persistence information of the target historical data is updated based on the persistence information of the target cache request and the persistence information of the target historical data, including:

[0115] In response to the target cache request being a persistent requirement, the target historical data being a non-persistent requirement, and the cache space already storing a preset maximum number of historical data with persistent requirements, the persistence information of the updated target historical data is determined to be a non-persistent requirement.

[0116] The number of historical data with persistence requirements that have been stored in the cache space with a preset upper limit refers to the number of cache lines corresponding to the data with persistence requirements in the set where the target historical data is located, i.e., the cur_set_persit_way_cnt value corresponding to the set, which has reached the preset upper limit.

[0117] Therefore, when the cache space already contains a preset upper limit of historical data with persistent requirements, some of the historical data with persistent requirements can be proactively downgraded to non-persistent requirements. This prevents the number of historical data with persistent requirements in the cache space from continuously growing and consuming too many cache resources, and avoids a deadlock state where historical data with persistent requirements cannot be replaced, thus ensuring the overall replaceability of the cache and the effective execution of the replacement strategy.

[0118] In one possible implementation, in response to the target cache request hitting the target historical data already stored in the requested cache space, the persistence information of the target historical data is updated based on the persistence information of the target cache request and the persistence information of the target historical data, including:

[0119] In response to the target cache request being a persistent requirement, the target historical data being a non-persistent requirement, and the number of historical data with persistent requirements already stored in the cache space not reaching the preset limit, the updated target historical data is determined to be a persistent requirement.

[0120] In the above scenario, after determining that the persistence information of the updated target historical data is a persistence requirement, the value of cur_set_persit_way_cnt corresponding to the set where the target historical data is located can be incremented by 1.

[0121] Therefore, under the above conditions, the updated target historical data can be made to be the larger value between the target cache request and the persistence information of the current target historical data, thus preventing data with persistence requirements from being mistakenly reduced to non-persistent requirements by the cache request.

[0122] Figure 3 A flowchart illustrating a cache management method according to an embodiment of this disclosure is shown. Figure 3 As shown, the target cache request is first loaded / stored, as described in step S201 above.

[0123] In the event of a cache miss and the need to allocate cache space, if the preset quantity limit is 0 (as shown in MAX_PERSIST_WAY_NUM == 0), the level 1 strategy described above is adopted, and the data to be stored remains as a non-persistent requirement. Otherwise, if the target cache request has a persistent requirement, and the cache space already stores the preset quantity limit of historical data with persistent requirements (as shown in MAX_PERSIST_WAY_NUM ≥ MAX_PERSIST_WAY_NUM for the current set), the level 2 strategy described above is adopted, and the data to be stored is updated to have a persistent requirement. If the target cache request has a persistent requirement, and the number of historical data with persistent requirements already stored in the cache space has not reached the preset quantity limit, the level 3 strategy described above is adopted, and the data to be stored is updated to have a persistent requirement. If the target cache request has a non-persistent requirement, the level 3 strategy described above is adopted, and the data to be stored is updated to have a non-persistent requirement.

[0124] If a cache miss occurs and no cache space needs to be allocated (as shown in the figure, "Hit" indicates no), the persistence information does not need to be updated and the process can be terminated.

[0125] When a cache miss occurs and cache space needs to be allocated (as shown in the figure, "Hit" indicates "Yes"), the persistence information needs to be updated. Specifically, when the preset maximum number is 0 (as shown in the figure, MAX_PERSIST_WAY_NUM == 0), the historical data of the hit target is kept as a non-persistent requirement.

[0126] Otherwise, when the target cache request is a non-persistent requirement and / or the hit target historical data is a persistent requirement, the persistence information of the hit target historical data remains unchanged; when the target cache request is a persistent requirement and the hit target historical data is a non-persistent requirement, it is further determined whether the cache space already stores a preset maximum number of historical data with persistent requirements. If the cache space already stores a preset maximum number of historical data with persistent requirements (i.e., the current set's cur_set_persit_way_cnt ≥ MAX_PERSIST_WAY_NUM), the hit target historical data remains a non-persistent requirement; if the number of historical data with persistent requirements already stored in the cache space does not reach the preset maximum number, the hit target historical data is updated to a persistent requirement, and the current set's cur_set_persit_way_cnt is incremented by 1.

[0127] Figure 4 A structural diagram of a cache management apparatus according to an embodiment of the present disclosure is shown. Figure 4 As shown, the device includes:

[0128] The determination module 401 is used to determine the persistence information of the received target cache request; wherein, the persistence information includes: non-persistent requirements or persistent requirements;

[0129] The first replacement module 402 is used to replace any historical data with a persistent requirement in the cache space with the data to be stored indicated by the target cache request in the cache space in response to the target cache request failing to hit any historical data already stored in the requested cache space, the target cache request having a persistence requirement, and the cache space having a preset upper limit of historical data with a persistence requirement.

[0130] In one possible implementation, the device further includes:

[0131] The second replacement module is used to replace any historical data with non-persistent requirements in the cache space when the target cache request fails to hit any historical data already stored in the requested cache space, the target cache request has a persistence requirement, and the number of historical data with persistence requirements already stored in the cache space does not reach a preset limit.

[0132] In one possible implementation, the device further includes:

[0133] The third replacement module is used to replace any historical data with non-persistent requirements in the cache space when the target cache request fails to hit any historical data already stored in the requested cache space and the target cache request has non-persistent requirements.

[0134] In one possible implementation, the device further includes:

[0135] The first update module is used to update the persistence information of the data to be stored in the cache space to the persistence requirement in response to the target cache request not hitting any historical data already stored in the requested cache space, and the target cache request having a persistence requirement.

[0136] The second update module is used to update the persistence information of the data to be stored in the cache space to a non-persistent requirement when the target cache request fails to hit any historical data already stored in the requested cache space and the target cache request has a non-persistent requirement.

[0137] In one possible implementation, the device further includes:

[0138] The third update module is used to update the persistence information of the target historical data based on the persistence information of the target cache request and the persistence information of the target historical data in response to the target cache request hitting the target historical data already stored in the requested cache space.

[0139] In one possible implementation, the third update module is used for:

[0140] In response to a non-persistent requirement for the target cache request or a persistent requirement for the target historical data, the persistence information of the updated target historical data remains unchanged.

[0141] In one possible implementation, the third update module is used for:

[0142] In response to the target cache request being a persistent requirement, the target historical data being a non-persistent requirement, and the cache space already storing a preset maximum number of historical data with persistent requirements, the persistence information of the updated target historical data is determined to be a non-persistent requirement.

[0143] In one possible implementation, the third update module is used for:

[0144] In response to the target cache request being a persistent requirement, the target historical data being a non-persistent requirement, and the number of historical data with persistent requirements already stored in the cache space not reaching the preset limit, the updated target historical data is determined to be a persistent requirement.

[0145] According to embodiments of this disclosure, the replacement of historical data with persistent requirements stored in the cache space can be avoided, thus improving the effectiveness of the cache data replacement mechanism. Simultaneously, this disclosure considers the persistence information of the target cache request and the quantity of historical data with persistent requirements in the cache space. While ensuring the cache hit rate of cache requests with persistent requirements, it provides reasonable cache allocation opportunities for data requested by cache requests with non-persistent requirements, avoiding the problem of non-persistent cache requests being unable to obtain cache space for extended periods and subsequent accesses almost never hitting the cache. This achieves a balanced allocation of cache resources among cache requests with different persistence information. Since the persistence information designed in this disclosure only includes non-persistent or persistent requirements, data replacement management in the cache space can be achieved through simple judgment and quantity constraints, thereby reducing hardware implementation complexity and increasing adaptability and scalability under different loads.

[0146] In some embodiments, the functions or modules of the apparatus provided in this disclosure can be used to perform the methods described in the above method embodiments. The specific implementation can be referred to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.

[0147] This disclosure also provides a cache management device, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the above method.

[0148] This disclosure also provides a non-volatile computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the above-described method.

[0149] This disclosure also provides a computer program product, including a computer program or a non-volatile computer-readable storage medium carrying the computer program, wherein the computer program, when executed by a processor, implements the steps of the above method.

[0150] Figure 5 This is a block diagram illustrating an apparatus 1900 for cache management according to an exemplary embodiment. For example, apparatus 1900 may be provided as a server or terminal device. (Refer to...) Figure 5 The apparatus 1900 includes a processing component 1922, which further includes one or more processors, and memory resources represented by memory 1932 for storing instructions, such as application programs, that can be executed by the processing component 1922. The application programs stored in memory 1932 may include one or more modules, each corresponding to a set of instructions. Furthermore, the processing component 1922 is configured to execute instructions to perform the methods described above.

[0151] Device 1900 may also include a power supply component 1926 configured to perform power management of device 1900, a wired or wireless network interface 1950 configured to connect device 1900 to a network, and an input / output interface 1958 (I / O interface). Device 1900 can operate on an operating system, such as Windows Server, stored in memory 1932. TM macOS X TM Unix TM Linux TM FreeBSD TM Or similar.

[0152] In an exemplary embodiment, a non-volatile computer-readable storage medium is also provided, such as a memory 1932 including computer program instructions that can be executed by a processing component 1922 of the device 1900 to perform the above-described method.

[0153] Computer-readable storage media can be tangible devices capable of holding and storing programs / instructions used by instruction execution devices. Computer-readable storage media can be, for example—but not limited to—electrical storage devices, magnetic storage devices, optical storage devices, electromagnetic storage devices, semiconductor storage devices, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of computer-readable storage media include: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), portable compact disc read-only memory (CD-ROM), digital multifunction disc (DVD), memory sticks, floppy disks, mechanical encoding devices, such as punch cards or recessed protrusions storing instructions thereon, and any suitable combination of the foregoing. The computer-readable storage media used herein are not to be construed as transient signals themselves, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (e.g., light pulses through fiber optic cables), or electrical signals transmitted through wires.

[0154] The computer program (or computer-readable program instructions) described herein can be downloaded from a computer-readable storage medium to various computing / processing devices, or downloaded via a network, such as the Internet, local area network, wide area network, and / or wireless network, to an external computer or external storage device. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards them to the computer-readable storage medium in the respective computing / processing device.

[0155] The computer program (or computer program instructions) used to perform the operations of this disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Smalltalk, C++, etc., and conventional procedural programming languages ​​such as the "C" language or similar programming languages. The computer-readable program instructions may execute entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, electronic circuitry, such as programmable logic circuitry, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), is personalized by utilizing state information from the computer-readable program instructions to implement various aspects of this disclosure.

[0156] Various aspects of this disclosure are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.

[0157] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processor of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner; thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.

[0158] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.

[0159] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction containing one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than those shown in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.

[0160] The various embodiments of this disclosure have been described above. These descriptions are exemplary and not exhaustive, nor are they limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen to best explain the principles, practical application, or technical improvements to the embodiments in the market, or to enable others skilled in the art to understand the embodiments disclosed herein.

Claims

1. A cache management method, characterized in that, The method includes: Determine the persistence information of the received target cache request; wherein the persistence information includes: non-persistent requests or persistent requests; In response to the target cache request failing to hit any historical data already stored in the requested cache space, the target cache request having the persistence requirement, and the cache space already storing a preset maximum number of historical data with the persistence requirement, the data to be stored indicated by the target cache request is stored in the cache space in such a way that any historical data with the persistence requirement is replaced.

2. The method according to claim 1, characterized in that, The method further includes: In response to the target cache request failing to hit any historical data already stored in the requested cache space, the target cache request having the persistence requirement, and the number of historical data with the persistence requirement already stored in the cache space not reaching the preset upper limit, the data to be stored indicated by the target cache request is stored in the cache space in such a way as replacing any historical data with the non-persistent requirement.

3. The method according to claim 1 or 2, characterized in that, The method further includes: In response to the target cache request failing to hit any historical data already stored in the requested cache space, and the target cache request having the non-persistent requirement, the data to be stored indicated by the target cache request is stored in the cache space in such a way that any historical data having the non-persistent requirement is replaced.

4. The method according to any one of claims 1-3, characterized in that, The method further includes: In response to the target cache request failing to hit any historical data already stored in the requested cache space, and the target cache request having the persistence requirement, the persistence information of the data to be stored stored in the cache space is updated to the persistence requirement. In response to the target cache request failing to hit any historical data already stored in the requested cache space, and the target cache request having the non-persistent requirement, the persistence information of the data to be stored stored in the cache space is updated to a non-persistent requirement.

5. The method according to claim 1, characterized in that, The method further includes: In response to the target cache request hitting the target historical data already stored in the requested cache space, the persistence information of the target historical data is updated based on the persistence information of the target cache request and the persistence information of the target historical data.

6. The method according to claim 5, characterized in that, The step of updating the persistence information of the target historical data based on the persistence information of the target cache request and the persistence information of the target historical data includes: In response to the target cache request being a non-persistent requirement or the target historical data being a persistent requirement, it is determined that the persistence information of the updated target historical data remains unchanged.

7. The method according to claim 5 or 6, characterized in that, The step of updating the persistence information of the target historical data based on the persistence information of the target cache request and the persistence information of the target historical data includes: In response to the target cache request being a persistent requirement, the target historical data being a non-persistent requirement, and the cache space already storing a preset maximum number of historical data with the persistent requirement, the persistence information of the updated target historical data is determined to be the non-persistent requirement.

8. The method according to any one of claims 5-7, characterized in that, The step of updating the persistence information of the target historical data based on the persistence information of the target cache request and the persistence information of the target historical data includes: In response to the fact that the target cache request is a persistent requirement, the target historical data is a non-persistent requirement, and the number of historical data with the persistent requirement already stored in the cache space has not reached the preset upper limit, the persistence information of the updated target historical data is determined to be the persistent requirement.

9. A cache management device, characterized in that, The device includes: A determination module is used to determine the persistence information of the received target cache request; wherein the persistence information includes: non-persistent requirements or persistent requirements; The first replacement module is configured to, in response to the target cache request failing to hit any historical data already stored in the requested cache space, the target cache request having the persistence requirement, and the cache space having a preset maximum number of historical data with the persistence requirement, store the data to be stored indicated by the target cache request in the cache space in such a way as replacing any historical data with the persistence requirement.

10. A cache management device, comprising a memory, a processor, and a computer program stored in the memory, characterized in that, The processor executes the computer program to implement the steps of the method according to any one of claims 1 to 8.

11. A non-volatile computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 8.

12. A computer program product comprising a computer program, or a non-volatile computer-readable storage medium carrying the computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 8.