Cache and cache control method, integrated circuit system, electronic component and device

By setting specific states in the cache control module to prevent data from being replaced unnecessarily in heterogeneous systems, the problems of data delay and bandwidth waste in heterogeneous systems are solved, and the performance of the computer system is improved.

CN117971728BActive Publication Date: 2024-10-18BEIJING XIANGDIXIAN COMPUTING TECH CO LTD
View PDF 9 Cites 0 Cited by

Patent Information

Application Number
CN202410370952.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-29
Publication Date
2024-10-18
Estimated Expiration
2044-03-29

AI Technical Summary

Technical Problem

In heterogeneous systems, when the data provided by the data provider is temporarily stored in the cache, the user does not read it in time, causing the data to be replaced, increasing latency and wasting memory access bandwidth, affecting performance.

Method used

Design a cache control module that responds to a specific write request by setting the second state of the target cache line to be valid, during which data is not moved out, and responds to a read request by setting the state to invalid and validating the third state of the cache line Writes are allowed during this period, and the cache line replacement strategy is optimized to improve performance.

Benefits of technology

It effectively avoids unnecessary replacement of data in the cache, reduces delay and waste of memory access bandwidth, and improves the performance of the computer system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117971728B_ABST
    Figure CN117971728B_ABST
Patent Text Reader

Abstract

The present disclosure provides a cache and a cache control method, an integrated circuit system, an electronic component and a device. Among them, the cache control method is as follows: a second state is configured for a cache line, and when data is written to the cache line based on a specific write request, the second state of the cache line is set to valid, and the data of the cache line will not be removed during the validity period of the second state. When data is read from the cache line based on a specific read request, the second state of the cache line is set to invalid. As a result, the data provided by the data provider to the data user is temporarily stored in the cache, and the second state of the corresponding cache line is set to valid, and the data provided by the data provider will not be removed from the cache. When the data user needs to read the data, the data can be successfully read from the cache, avoiding the increase in delay and the waste of memory access bandwidth, thereby improving performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of cache control, and in particular to a cache, an integrated circuit system, an electronic component, an electronic device, and a cache control method. Background Art

[0002] In computer systems, cache uses the principles of temporal locality and spatial locality to temporarily store a small amount of memory data closer to processing components such as the CPU (Central Processing Unit) or GPU (Graphics Processing Unit), thereby reducing memory access latency and increasing memory access bandwidth, which has a significant effect on improving computer system performance.

[0003] Cache includes multiple cache lines (ways), each of which has a flag field, a status field, and a data field. The flag field is used to index and locate the cache line, the status field is used to indicate the current state of the cache line, and the data field is used to store data.

[0004] Cache capacity is limited. When new data needs to be stored in the cache but there are no available cache lines, data replacement needs to be performed according to a predetermined replacement strategy. Common replacement strategies include LRU (Least Recently Used) replacement strategy, NRU (Not Recent Used) replacement strategy, SRRIP replacement strategy, etc. The existing replacement strategy idea is to dynamically adjust the age of each cache line at runtime and select the cache line with the oldest age for data replacement.

[0005] This type of strategy works well under normal circumstances and performance is guaranteed.

[0006] However, in some cases, especially in heterogeneous systems, the data provided by the data provider to the data consumer will be temporarily stored in the cache, and the data consumer will not read the data immediately. When the data consumer needs to read the data, the data may have been replaced not long ago. This will increase latency and waste memory bandwidth, thus affecting performance. Summary of the invention

[0007] The purpose of the present disclosure is to provide a cache, an integrated circuit system, an electronic component, an electronic device and a cache control method to improve cache performance.

[0008] According to one aspect of the present disclosure, a cache is provided, which includes a cache control module and a cache module. The cache control module is configured to: in response to a specific write request, write the data indicated by the specific write request to a target cache line of the cache module, and set the second state of the target cache line to be valid; in response to a specific read request for the above data, read the data from the target cache line, and set the second state of the target cache line to be invalid; while the second state of the target cache line is valid, the data in the target cache line is not removed.

[0009] Optionally, the cache control module sets the second state of the target cache line to valid according to the second state setting information carried in the specific write request.

[0010] Based on any of the above embodiments, optionally, the specific read request includes: a read request for the Nth cache hit, where N is an integer not less than 1; or a read request sent by a specified object; or a read request received when the second state of the target cache line is valid.

[0011] Based on any of the above embodiments, optionally, when the second state of the target cache line is valid, a write operation on the target cache line does not trigger a change in the second state of the target cache line.

[0012] Based on any of the above embodiments, optionally, the cache control module is further configured to: in response to a specific write request, set the third state of the target cache line to valid; while the third state of the target cache line is valid, in response to the Mth read hit of the target cache line, set the first state of the target cache line to invalid, and the cache line with an invalid first state is allowed to have data written, where M is an integer not less than 1.

[0013] On this basis, optionally, the cache control module sets the third state of the target cache line to valid according to the third state setting information carried in the specific write request.

[0014] Based on any of the above cache embodiments, the cache is a system-level cache.

[0015] According to another aspect of the present disclosure, an integrated circuit system is provided, comprising the buffer described in any one of the above embodiments.

[0016] According to another aspect of the present disclosure, an electronic component is provided, comprising the integrated circuit system described in the above embodiment.

[0017] According to another aspect of the present disclosure, an electronic device is provided, comprising the electronic component described in any one of the above embodiments.

[0018] According to another aspect of the present disclosure, a cache control method is provided, the method comprising:

[0019] In response to the specific write request, write the data indicated by the specific write request into the target cache line of the cache module, and set the second state of the target cache line to be valid;

[0020] In response to a specific read request for the above data, the data is read from the target cache line, and the second state of the target cache line is set to invalid; while the second state of the target cache line is valid, the data in the target cache line is not removed.

[0021] Optionally, setting the second state of the target cache line to be valid may be implemented by: setting the second state of the target cache line to be valid according to second state setting information carried in the specific write request.

[0022] Based on any of the above method embodiments, the specific read request includes: a read request for the Nth cache hit, where N is an integer not less than 1; or a read request sent by a specified object; or a read request received when the second state of the target cache line is valid.

[0023] Based on any of the above method embodiments, optionally, when the second state of the target cache line is valid, a write operation on the target cache line does not trigger a change in the second state of the target cache line.

[0024] Based on any of the above method embodiments, optionally, in response to a specific write request, the third state of the target cache line is set to valid; while the third state of the target cache line is valid, in response to the Mth read hit of the target cache line, the first state of the target cache line is set to invalid, and the cache line with an invalid first state is allowed to have data written, and M is an integer not less than 1.

[0025] On this basis, optionally, a specific implementation method of setting the third state of the target cache line to be valid may include: setting the third state of the target cache line to be valid according to the third state setting information carried in the specific write request. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] Figure 1 A schematic diagram of the structure of a buffer provided by an embodiment of the present disclosure;

[0027] Figure 2 A schematic diagram of the structure of a cache line provided for one embodiment of the present disclosure. DETAILED DESCRIPTION

[0028] Before introducing the embodiments of the present disclosure, it should be noted that:

[0029] Some embodiments of the present disclosure are described as processing flows. Although the various operation steps of the flow may be given sequential step numbers, the operation steps therein may be implemented in parallel, concurrently or simultaneously.

[0030] In the embodiments of the present disclosure, the terms "first", "second", etc. may be used to describe various features, but these features should not be limited by these terms. These terms are used only to distinguish one feature from another.

[0031] The term “and / or” may be used in embodiments of the present disclosure. “And / or” includes any and all combinations of one or more of the associated features listed.

[0032] It should be understood that when describing the connection or communication relationship between two components, unless it is explicitly stated that the two components are directly connected or directly communicating, the connection or communication between the two components can be understood as direct connection or communication, or as indirect connection or communication through an intermediate component.

[0033] In order to make the technical solutions and advantages of the embodiments of the present disclosure more clearly understood, the exemplary embodiments of the present disclosure are further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than an exhaustive list of all the embodiments. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.

[0034] The purpose of the present disclosure is to provide a cache control scheme, which configures a second state for a cache line. When data is written to the cache line based on a specific write request, the second state of the cache line is set to valid. During the validity period of the second state, the data of the cache line will not be removed. When data is read from the cache line based on a specific read request, the second state of the cache line is set to invalid. As a result, the data provided by the data provider to the data user is temporarily stored in the cache, and the second state of the corresponding cache line is set to valid, and the data provided by the data provider will not be removed from the cache. When the data user needs to read the data, the data can be successfully read from the cache, avoiding the increase in delay and the waste of memory access bandwidth, thereby improving performance. In the embodiment of the present disclosure, the second state can be invalid by default.

[0035] In the embodiments of the present disclosure, the data provider is also called a master, and the data user is also called a slave. The processing core in the computer system acts as a master when providing data and as a slave when using data.

[0036] The cache control solution provided by the embodiment of the present disclosure is applicable to a computer system (such as SOC) with two or more processing cores (including master and slave). The data provided by the master device to other slave devices is transferred in the memory and enters the SLC (system level cache) before the data reaches the memory. In this case, it cannot be guaranteed that the data entering the SLC will not be replaced before the slave device reads it. This problem is particularly common in heterogeneous computing, because the operation of the master device as the data provider to provide data and the operation of the slave device as the data user to read data are often triggered by different software entities, making it difficult to achieve a tight connection in terms of timing. The solution provided by the embodiment of the present disclosure can solve this problem.

[0037] An embodiment of the present disclosure provides a buffer, such as Figure 1 As shown, the cache includes a cache control module and a cache module. The cache control module is configured to: in response to a specific write request, write the data indicated by the specific write request into the target cache line of the cache module, and set the second state of the target cache line to be valid; in response to a specific read request for the above data, read the data from the target cache line, and set the second state of the target cache line to be invalid; while the second state of the target cache line is valid, the data in the target cache line is not removed.

[0038] In the disclosed embodiment, the cache module includes multiple cache lines. A cache line is the smallest storage unit in the cache, which is composed of multiple consecutive bytes or words. The size of the cache line depends on the specific processor architecture and design. The common cache line size is 64 bytes or 128 bytes. Each cache line corresponds to a flag field, a status field, and a data field.

[0039] Among them, the flag field is used to identify which address in the main memory the data stored in the cache line comes from, so as to index and locate the cache line in response to the memory access request. The cache module provided in the embodiment of the present disclosure can adopt mapping methods such as group-associated mapping, direct mapping, and fully-associated mapping. For different mapping methods, what information the flag field specifically includes is well known to those skilled in the art, and will not be repeated here. In addition, for different mapping methods, in order to accurately index the cache line, other positioning information may also be used, which is also well known to those skilled in the art. Taking group-associated mapping as an example, the cache lines (ways) of the cache module are divided into multiple groups (sets). To determine whether a memory access request (read request or write request) hits in the cache module, it is necessary to locate the target cache line first. Specifically, the group identification bit in the address carried in the memory access request can be compared with the group identification of each group in the cache module, so as to select the target group, and then the cache line flag bit in the address is compared with the tag field (tag) of each cache line in the target group, so as to select the target cache line.

[0040] Among them, the status field is used to indicate the current state of the cache line. Different cache architectures and designs may have different status bits. However, no matter what write strategy or read strategy is adopted, the cache line valid bit (corresponding to the first state of the embodiment of the present disclosure) will be defined, and the cache line valid bit is used to identify whether the cache line is valid. In addition to the cache line valid bit, common status bits also include dirty bit (Dirty Bit), protection bit (Protection Bit), exclusive bit (Exclusive Bit), consistency bit (Coherency Bit), etc. The specific meaning and usage of these status bits may vary depending on different cache architectures and designs. Changes in the above status bits of the cache line are usually managed and maintained by the cache consistency protocol. The cache consistency protocol ensures data consistency between multiple caches to avoid conflicts and errors in data access. Common cache consistency protocols include MESI (Modified, Exclusive, Shared, Invalid) and MOESI (Modified, Owned, Exclusive, Shared, Invalid), etc. In the embodiment of the present disclosure, the status field includes not only the above status bits, but also the first wait bit indicating the above second state. Correspondingly, such as Figure 2 As shown, in the embodiment of the present disclosure, the structure of a cache line includes a flag field, a status field and a data field. Among them, the status field includes a first sub-status field and a second sub-status field. The first sub-status field includes several status bits including a valid status bit, and the second sub-status field includes a first waiting bit.

[0041] The data domain is used to store data, which can be data units of different sizes such as bytes, words, and double words, depending on the design of the processor.

[0042] In the embodiment of the present disclosure, a specific write request means that the data requested to be written needs to be kept in the cache line by making the second state of the cache line valid.

[0043] When the application clearly knows that a certain data written back to the memory will be read and used in the near future, then the corresponding write request is a specific write request. In order to solve the problem that the data entering the cache is replaced out of the cache while waiting to be used, the present disclosure designs and implements a waiting state (second state), which is marked by the first waiting bit (Wait Bit) in the cache line. If the Wait Bit is valid, it means that it does not participate in the operation of the replacement strategy until the cache line is read at least once, the Wait Bit becomes invalid, and the cache line switches to execute the regular replacement strategy.

[0044] It should be pointed out that in actual applications, the cache does not need to identify a specific write request, but needs to identify whether the second state of the target cache line needs to be set to valid. In a feasible implementation, a specific write request will carry second state setting information to indicate that the second state of the target cache line is set to valid. Accordingly, the cache control module sets the second state of the target cache line to valid according to the second state setting information carried in the specific write request. The second state setting information can be newly added information, or it can reuse existing information. For example, one or more of the source address, destination address, source device identifier, target device identifier, request type, etc. can be used as the second state setting information.

[0045] In the embodiment of the present disclosure, a specific read request refers to a read request that no longer needs to be kept in the cache line by the second state of the cache line being valid after the data is read. According to the actual application situation, the specific read request can be a read request for the Nth cache hit, where N is an integer not less than 1. For example, if the data user reads the data once and does not read the data again in a short period of time, then, during the period when the second state of the target cache line is valid, the data of the target cache line can be set to invalid after being read once. For another example, during the period when the second state of the target cache line is valid, if a specific data user reads the data of the target cache line, the data no longer has the value of being kept, then the specific read request refers to a read request sent by a specified object, and the specified object can be identified by, but not limited to, the source address, source device identification, etc. For another example, a read request received when the second state of the target cache line is valid is regarded as a specific read request. In the embodiment of the present disclosure, if the second state of the cache line is invalid, the read and write operations of the cache line are performed in a normal mode.

[0046] Based on any of the above embodiments, optionally, when the second state of the target cache line is valid, a write operation to the target cache line does not trigger a change in the second state of the target cache line. This means that, during the period when the second state of the target cache line is valid, a write operation to the target cache line is regarded as a data update operation, and new data can directly overwrite old data, but the second state of the target cache line remains valid.

[0047] When the application layer explicitly knows that the data will only be used once, the following mechanism is designed to be implemented: the cache line with a valid second state becomes invalid immediately after being read once. This can bypass the replacement strategy and directly achieve the effect of being replaced immediately, thereby increasing the survival time of other cache lines in the cache and increasing the chance of being reused. Accordingly, based on any of the above embodiments, optionally, the cache control module is also configured to: in response to a specific write request, set the third state of the target cache line to valid; during the period when the third state of the target cache line is valid, in response to the Mth read hit of the target cache line, set the first state of the target cache line to invalid, and the cache line with an invalid first state is allowed to be written with data, and M is an integer not less than 1.

[0048] In the embodiment of the present disclosure, the third state can be set by the third state setting information carried in the specific write request. It should be noted that in actual applications, a write request may only indicate that the second state is set to be valid through the second state setting information, but does not indicate that the third state is set to be valid through the third state setting information.

[0049] Correspondingly, such as Figure 2 As shown, a second wait bit (Wait1 Bit) indicating the third state can be added to the second sub-state field of the state field of the cache line. If the second wait bit is set to valid (i.e., the third state is valid), then the cache line is immediately invalidated after waiting for a read operation, that is, it can be immediately replaced from the cache without waiting for the replacement strategy to be selected. In the case where the application layer determines that the data is only read once, the residence time of other cache lines can be increased to increase the chance of other data hitting and thus improve performance.

[0050] Based on the same inventive concept, an embodiment of the present disclosure further provides an integrated circuit system, the integrated circuit system comprising the buffer described in any of the above embodiments. The integrated circuit system may be, but is not limited to, a SOC (System on Chip) chip, an ASIC chip, and the like.

[0051] Based on the same inventive concept, the embodiment of the present disclosure also provides an electronic component, which includes the integrated circuit system described in any of the above embodiments. In some usage scenarios, the product form of the electronic component is a graphics card; in other usage scenarios, the product form of the electronic component is a CPU motherboard.

[0052] Based on the same inventive concept, the disclosed embodiment also provides an electronic device, which includes the above-mentioned electronic components. In some usage scenarios, the product form of the electronic device is a portable electronic device, such as a smart phone, a tablet computer, a VR device, etc.; in some usage scenarios, the product form of the electronic device is a personal computer, a game console, etc.

[0053] Based on the same inventive concept, the embodiment of the present disclosure also provides a cache control method, the method comprising:

[0054] In response to the specific write request, write the data indicated by the specific write request into the target cache line of the cache module, and set the second state of the target cache line to be valid;

[0055] In response to a specific read request for the above data, the data is read from the target cache line, and the second state of the target cache line is set to invalid; while the second state of the target cache line is valid, the data in the target cache line is not removed.

[0056] Optionally, setting the second state of the target cache line to be valid may be implemented by: setting the second state of the target cache line to be valid according to second state setting information carried in the specific write request.

[0057] Based on any of the above method embodiments, the specific read request includes: a read request for the Nth cache hit, where N is an integer not less than 1; or a read request sent by a specified object; or a read request received when the second state of the target cache line is valid.

[0058] Based on any of the above method embodiments, optionally, when the second state of the target cache line is valid, a write operation on the target cache line does not trigger a change in the second state of the target cache line.

[0059] Based on any of the above method embodiments, optionally, in response to a specific write request, the third state of the target cache line is set to valid; while the third state of the target cache line is valid, in response to the Mth read hit of the target cache line, the first state of the target cache line is set to invalid, and the cache line with an invalid first state is allowed to have data written, and M is an integer not less than 1.

[0060] On this basis, optionally, a specific implementation method of setting the third state of the target cache line to be valid may include: setting the third state of the target cache line to be valid according to the third state setting information carried in the specific write request.

[0061] Although the preferred embodiments of the present disclosure have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present disclosure.

[0062] Obviously, those skilled in the art can make various changes and modifications to the present disclosure without departing from the spirit and scope of the present disclosure. Thus, if these modifications and variations of the present disclosure fall within the scope of the claims of the present disclosure and their equivalents, the present disclosure is also intended to include these modifications and variations.

Claims

1. A cache, comprising a cache control module and a cache module; The cache control module is configured to: in response to a specific write request, write the data indicated by the specific write request into a target cache line of the cache module, and set the second state of the target cache line to be valid; in response to a specific read request for the data, read the data from the target cache line, and set the second state of the target cache line to be invalid; during the period when the second state of the target cache line is valid, the data in the target cache line is not removed; The cache control module is also configured to: in response to the specific write request, set the third state of the target cache line to valid; during the period when the third state of the target cache line is valid, in response to the Mth read hit of the target cache line, set the first state of the target cache line to invalid, and the cache line with an invalid first state is allowed to have data written, and M is an integer not less than 1.

2. The cache according to claim 1, wherein the cache control module is configured to: set the second state of the target cache line to valid according to the second state setting information carried in the specific write request.

3. The cache according to claim 1 or 2, wherein the specific read request comprises: The Nth cache hit read request, where N is an integer not less than 1; Or, a read request sent by a specified object; Alternatively, the read request is received when the second state of the target cache line is valid. 4 . The cache according to claim 1 , wherein when the second state of the target cache line is valid, a write operation to the target cache line does not trigger a change in the second state of the target cache line. 5 . The cache according to claim 1 , wherein the cache control module is configured to: set the third state of the target cache line to valid according to the third state setting information carried in the specific write request. The buffer according to claim 1 , wherein the buffer is a system-level buffer.

7. An integrated circuit system, comprising the buffer as claimed in any one of claims 1 to 6.

8. An electronic component comprising the integrated circuit system according to claim 7.

9. An electronic device comprising the electronic component according to claim 8.

10. A cache control method, comprising: In response to a specific write request, write the data indicated by the specific write request into a target cache line of the cache module, and set the second state of the target cache line to be valid; In response to a specific read request for the data, read the data from the target cache line and set the second state of the target cache line to invalid; During the period when the second state of the target cache line is valid, data in the target cache line is not removed; The method further comprises: In response to the specific write request, setting a third state of the target cache line to be valid; During the period when the third state of the target cache line is valid, in response to the Mth read hit of the target cache line, the first state of the target cache line is set to invalid, and the cache line with invalid first state allows data to be written, and M is an integer not less than 1.

11. The method according to claim 10, wherein the step of setting the second state of the target cache line to valid comprises: According to the second state setting information carried in the specific write request, the second state of the target cache line is set to valid.

12. The method according to claim 10 or 11, wherein the specific read request comprises: The Nth cache hit read request, where N is an integer not less than 1; Or, a read request sent by a specified object; Alternatively, the read request is received when the second state of the target cache line is valid. 13 . The method according to claim 10 , wherein when the second state of the target cache line is valid, a write operation to the target cache line does not trigger a change in the second state of the target cache line.

14. The method according to claim 10, wherein the step of setting the third state of the target cache line to valid comprises: According to the third state setting information carried in the specific write request, the third state of the target cache line is set to valid.

Citation Information

Patent Citations

  • control method and device for reducing secondary cache energy consumption of a GPU

    CN109799897A

  • Implementing atomic primitives using cache line locking

    CN110312997A

  • Methods and related devices for reading and partially writing data

    CN110832466B

  • Implementation method and device for cache consistency of multi-core processor, the multi-core processor and storage medium

    CN112416615A

  • Tracking memory modifications at cache line granularity

    CN117059147A