MESI protocol-based cache consistency optimization method, electronic equipment and storage medium

By introducing the data sniffing register into the MESI protocol, cross-layer data transfer is directly performed, which solves the problem of low cache consistency efficiency of the MESI protocol under high communication speed and large-scale inter-chip communication, and achieves more efficient cache consistency. Maintenance and system performance improvements.

CN118779254APending Publication Date: 2024-10-15SHANDONG INSPUR SCI RES INST CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410759466.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-13
Publication Date
2024-10-15

AI Technical Summary

Technical Problem

In the case of high communication speed and large-scale inter-chip communication, the cache consistency maintenance efficiency of the MESI protocol is low, leading to channel congestion and access conflicts. The existing technical steps are cumbersome and the synchronization cycle is long, which affects system performance.

Method used

Based on the MESI protocol, a data sniffing register is added to capture the data exclusive or invalid status of the E state and I state, and directly transfer cross-layer data to avoid cross-multi-layer status updates. Data interaction between nodes is carried out through the data sniffing register. Reduce bus load.

Benefits of technology

It significantly saves the cache consistency load on the bus, improves the efficiency of the MESI protocol, maintains cache consistency, reduces the number of instruction bus operations, and improves system performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118779254A_ABST
    Figure CN118779254A_ABST
Patent Text Reader

Abstract

The invention discloses a cache consistency optimization method based on an MESI protocol, electronic equipment and a storage medium, belongs to the technical field of data communication optimization, and aims to solve the technical problem of how to improve the working logic of the MESI protocol, increase the working efficiency of cache consistency and maintain the cache consistency. According to the technical scheme, an MESI protocol is expanded, a data sniffing register is added, the data sniffing register is used for capturing an E state and an I state, and when data are exclusive or invalid, the data sniffing register captures the data in time and loves that captured result to be stored; when the state needs to be updated, judging whether the operation is the operation inside the same node or the operation outside the node: if the operation is the operation inside the same node, directly completing data exchange inside the node; if the operation is the external operation of the node, the data sniffing register is used for directly accessing, so that cross-multilayer state updating is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data communication optimization, and in particular to a cache consistency optimization method, electronic equipment and storage medium based on a MESI protocol. Background Art

[0002] With the development of the chip industry and the increase of main frequency, the speed of communication between chiplets will become higher and higher, but the problem of cache consistency of inter-chip communication will arise. At first, the solution for cache consistency was to monitor and broadcast consistency messages in the system in real time, but this method is only applicable to the situation where the inter-chip communication speed is not high and the inter-chip communication range is small. If the communication range is large, it is easy to cause channel congestion and access conflicts. For this reason, the MESI protocol was born. The MESI protocol is actually a finite state machine of the CPU Cache, with a total of 4 states (MESI is the first letter of the state):

[0003] M (Modified): indicates that the cache block has been modified but not synchronized back to the memory;

[0004] E (Exclusive): indicates that the cache block is exclusively occupied by the current core, and the same cache block of other cores will become invalid;

[0005] S (Shared): indicates that the cache block is held by multiple cores and is valid;

[0006] I (Invalidated): Indicates that the data in the cache block is outdated.

[0007] In the E and S states, any read operation can directly use cache data. However, in the I and M states, the data may be inconsistent with the memory data. When reading or writing I state data, it is necessary to first write the M state data of other cores back to the memory, and then read the data from the memory. In the S and I states, the core does not obtain the exclusive right (lock) of the cache block. When modifying data, it cannot be modified directly. Instead, an RFO (Request For Ownership) request must be broadcast to all cores first, and the cache of other cores must be set to the I state. Only after receiving the response ACK can the exclusive right of the cache block be obtained. This exclusive right is somewhat similar to the concept of lock at the development language level. Before modifying resources, the resource lock must be obtained first; in the M and E states, the core has obtained the exclusive right (lock) of the cache block. When modifying data, there is no need to send a broadcast to the bus, which can reduce the communication pressure of the bus. By defining four access states, other processors need to request access to shared data from the memory where the data is located, thereby limiting the number of broadcast messages (point-to-point sending), thereby improving system performance. However, this method is relatively cumbersome and requires a longer synchronization cycle, and the execution efficiency will be reduced when there are more cache levels.

[0008] Therefore, how to improve the working logic of the MESI protocol to increase the efficiency of cache consistency and maintain cache consistency is a technical problem that needs to be solved urgently. Summary of the invention

[0009] The technical task of the present invention is to provide a cache consistency optimization method, electronic device and storage medium based on the MESI protocol to solve the problem of how to improve the working logic of the MESI protocol to increase the working efficiency of cache consistency and maintain cache consistency.

[0010] The technical task of the present invention is achieved in the following way: a cache consistency optimization method based on the MESI protocol, which is to expand the MESI protocol and add a data sniffing register (DATA Sniffing memory) on the original basis. The data sniffing register is used to capture the E state and the I state. When the data is exclusive or invalid, the data sniffing register captures it in time and saves the captured result;

[0011] When the status needs to be updated, determine whether it is an operation within the same node or an operation outside the node:

[0012] If the operation is within the same node, the data exchange is completed directly within the node;

[0013] If the operation is external to the node, it is directly accessed through the data sniffing register to avoid updating the status across multiple layers.

[0014] As a preference, the node external operations are as follows:

[0015] Assume the nodes are Node 1 / CPU1 and Node 2 / CPU1;

[0016] If in the current state, the latest data is stored on node 2 / CPU1 and named A1, with address 0x01, then there will be a mark in the data sniffer to record the data address, and the counting method is to set the first position to 1 and combine it with the corresponding address;

[0017] Pull the P2_CPU1_DATA_Valid signal high, which means that the data of node 2 / CPU1 at the corresponding address is the latest.

[0018] When node 1 / CPU1 needs to read data, the instruction does not need to go through the instruction bus. CPU1 only needs to issue the corresponding instruction of curV to search the data sniffing register.

[0019] When the data sniffing register has a signal that meets the requirements, such as 10x01, you can find the corresponding CPU that pulls up the valid signal to get the data.

[0020] More preferably, the data address is recorded as 0x01-A1-curV, wherein curV represents current value=10x01.

[0021] Preferably, when operating externally of a node, all operations involving the instruction bus need to be performed through the data sniffing register.

[0022] Preferably, the P2_CPU1_DATA_Valid signal is pulled high to indicate that the corresponding signal is set to 1, and by setting curV=1, the corresponding address and data are found to trigger the corresponding CPU.

[0023] More preferably, when curV does not meet the value requirements, the current CPU is assumed to be the latest value, and there is no need to use the data and address bus (BUS) to determine whether the data is the latest.

[0024] An electronic device comprising: a memory and at least one processor;

[0025] Wherein, the memory stores a computer program;

[0026] The at least one processor executes the computer program stored in the memory, so that the at least one processor performs the cache consistency optimization method based on the MESI protocol as described above.

[0027] A computer-readable storage medium stores a computer program, and the computer program can be executed by a processor to implement the cache consistency optimization method based on the MESI protocol as described above.

[0028] The cache consistency optimization method, electronic device and storage medium based on the MESI protocol of the present invention have the following advantages:

[0029] (i) The present invention can directly transfer data across layers through data sniffing registers, which can greatly save the load on the bus for ensuring cache consistency, while ensuring the working efficiency of MESI and maintaining cache consistency;

[0030] (ii) The common MESI protocol in the prior art requires that the relevant identifiers be uploaded to the data and address bus for comparison before being sent from the bus, which is very time-consuming and inefficient. However, after the data sniffing register is added to the present invention, only the address needs to be downloaded from the data sniffing register to realize data interaction within the node;

[0031] (III) The function of MESI in the present invention is to facilitate data sniffing registers and pull up the relevant ready signal through the judgment of the identifier. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] The present invention is further described below in conjunction with the accompanying drawings.

[0033] Attached Figure 1 A schematic diagram of cross-layer data reading for traditional data reading;

[0034] Attached Figure 2 A schematic diagram of a cache consistency optimization method based on the MESI protocol;

[0035] Attached Figure 3 The flowchart of the cache consistency optimization method based on the MESI protocol is shown in FIG. DETAILED DESCRIPTION

[0036] The cache consistency optimization method, electronic device and storage medium based on the MESI protocol of the present invention are described in detail below with reference to the accompanying drawings and specific embodiments of the specification.

[0037] Embodiment 1:

[0038] This embodiment provides a cache consistency optimization method based on the MESI protocol. The method is to expand the MESI protocol and add a data sniffing register (DATA Sniffing memory) on the original basis. The data sniffing register is used to capture the E state and the I state. When the data is exclusive or invalid, the data sniffing register captures it in time and saves the captured result.

[0039] When the status needs to be updated, determine whether it is an operation within the same node or an operation outside the node:

[0040] If the operation is within the same node, the data exchange is completed directly within the node;

[0041] If the operation is external to the node, it is directly accessed through the data sniffing register to avoid updating the status across multiple layers.

[0042] First, for traditional data reading, take cross-layer data reading as an example, as shown in the following figure. Figure 1 As shown:

[0043] The data needs to pass through CPU1 of node 1, node 1, node 2, and finally reach CPU1 on node 2. Then the read data is passed back layer by layer. Under normal circumstances, the MESI process that each node needs to go through is as follows:

[0044] Node 1 / CPU1 Node 1 Node 2 Node 2 / CPU1 Read request sent I I I E Data transmission E→S E→S E→S E→S

[0045] It can be seen that when data is transmitted across layers, the data and address buses need to send consistent data tags multiple times according to the content of MESI to ensure cache consistency. The following effects can be achieved through the embodiment:

[0046] As attached Figure 2 As shown, node 1 and node 2 can directly transfer data across layers through the data sniffing register. This method can greatly save the load on the bus to ensure cache consistency, while ensuring the working efficiency of MESI and maintaining cache consistency.

[0047] Taking CPU1 of node 1 as an example, the function of the data sniffer is as follows: Assuming that in the current state, the latest data is stored on node 2 / CPU1 and is named A1, with an address of 0x01, there will be a mark in the data sniffer to record the data address, and 0x01-A1-curV will be recorded. curV means current value = 10x01, and its counting method is to set the first position 1 and combine it with the corresponding address, and pull the P2_CPU1_DATA_Valid signal high (pulling high means setting the signal to 1, through curV = 1, and finding the corresponding address and data to trigger the corresponding CPU), which means that the data of node 2 / CPU1 at this address is the latest. When node 1 / CPU1 needs to read data, the instruction does not need to pass through the instruction bus, and only needs CPU1 to send the corresponding instruction of curV to the data sniffing register to find it. If the data sniffing register has a signal that meets the requirements such as 10x01, it can find the corresponding CPU that pulls up the valid signal to get the data. All operations involving the instruction bus need to be performed through the data sniffing register.

[0048] The same optimization scheme for the same node also has a very obvious effect. The ordinary MESI protocol requires the relevant identifier to be uploaded to the data and address bus for comparison before being sent from the bus, which is very time-consuming and inefficient. After adding the data sniffing register, only the address needs to be downloaded from the data sniffing register to realize data interaction within the node.

[0049] As for the current function description of MESI, since it does not require bus transmission, the current function of this protocol is to maintain data consistency between cores. Another function is to facilitate data sniffing registers and pull up related ready signals through identifier judgment. The corresponding diagram is as follows:

[0050] M E S I READY status √ √ X X

[0051] It should be noted that the S state is a sharable state, so there is no need to design a ready signal, and the relevant data can be directly read from any CPU in the S state. The M state will overwrite the previous data according to the latest modified version.

[0052] As attached Figure 3 As shown, if in the current state, the latest data is stored on node 2 / CPU1 and is named A1, with an address of 0x01, then there will be a mark in the data sniffer to record the data address, which is recorded as 0x01-A1-curV; where curV means current value = 10x01; the counting method is to set the first position to 1 and combine it with the corresponding address;

[0053] The P2_CPU1_DATA_Valid signal is pulled high, that is, the data of the corresponding address of node 2 / CPU1 is the latest; wherein, the P2_CPU1_DATA_Valid signal is pulled high to set the corresponding signal to 1, and through curV=1, the corresponding address and data are found to trigger the corresponding CPU;

[0054] When node 1 / CPU1 needs to read data, the instruction does not need to go through the instruction bus. CPU1 only needs to issue the corresponding instruction of curV to search the data sniffing register.

[0055] When the data sniffing register has a signal that meets the requirements, such as 10x01, you can find the corresponding CPU that pulls up the valid signal to get the data.

[0056] In this embodiment, when the node is operated externally, all operations involving the instruction bus need to be performed through the data sniffing register.

[0057] In this embodiment, when curV does not meet the value requirements, it is assumed that the current CPU is the latest value, and there is no need to use the data and address bus (BUS) to determine whether the data is the latest.

[0058] This embodiment can be described in detail through the above description of node 1 taking node 2. It should be noted that the nodes involved are not limited to node 1 and node 2, and can be expanded to an infinite number, subject to specific needs. When curV does not meet the value requirements, the current CPU is assumed to be the latest value, and there is no need to use the bus to determine whether the data is the latest.

[0059] Embodiment 2:

[0060] This embodiment also provides an electronic device, including: a memory and a processor;

[0061] Wherein, the memory stores computer-executable instructions;

[0062] The processor executes the computer-executable instructions stored in the memory, so that the processor executes the cache consistency optimization method based on the MESI protocol in any embodiment of the present invention.

[0063] The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The processor may be a microprocessor or any conventional processor, etc.

[0064] The memory can be used to store computer programs and / or modules. The processor realizes various functions of the electronic device by running or executing the computer programs and / or modules stored in the memory, and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application required for a function, etc.; the data storage area can store data created according to the use of the terminal, etc. In addition, the memory can also include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (SMC), a secure digital (SD) card, a flash memory card, at least one disk storage period, a flash memory device, or other volatile solid-state storage devices.

[0065] Embodiment 3:

[0066] This embodiment also provides a computer-readable storage medium, in which a plurality of instructions are stored, and the instructions are loaded by a processor, so that the processor executes the cache consistency optimization method based on the MESI protocol in any embodiment of the present invention. Specifically, a system or device equipped with a storage medium can be provided, on which a software program code that implements the functions of any of the above embodiments is stored, and a computer (or CPU or MPU) of the system or device reads and executes the program code stored in the storage medium.

[0067] In this case, the program code itself read from the storage medium can realize the function of any one of the above-mentioned embodiments, and thus the program code and the storage medium storing the program code constitute a part of the present invention.

[0068] The storage medium embodiments for providing the program code include a floppy disk, a hard disk, a magneto-optical disk, an optical disk (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RYM, DVD-RW, DVD+RW), a magnetic tape, a non-volatile memory card, and a ROM. Alternatively, the program code can be downloaded from a server computer via a communication network.

[0069] In addition, it should be clear that the functions of any of the above embodiments can be implemented not only by executing the program code read by the computer, but also by enabling an operating system operating on the computer to complete part or all of the actual operations based on instructions from the program code.

[0070] In addition, it can be understood that the program code read from the storage medium is written to a memory provided in an expansion board inserted into the computer or to a memory provided in an expansion unit connected to the computer, and then based on the instructions of the program code, a CPU installed on the expansion board or the expansion unit is enabled to perform part or all of the actual operations, thereby realizing the functions of any of the above-mentioned embodiments.

[0071] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein by equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A cache consistency optimization method based on the MESI protocol, characterized in that: The method is to expand the MESI protocol and add a data sniffing register, which is used to capture the E state and the I state. When the data is exclusive or invalid, the data sniffing register captures it in time and saves the captured result. When the status needs to be updated, determine whether it is an operation within the same node or an operation outside the node: If the operation is within the same node, the data exchange is completed directly within the node; If the operation is external to the node, it is directly accessed through the data sniffing register to avoid updating the status across multiple layers.

2. The cache consistency optimization method based on the MESI protocol according to claim 1, characterized in that: The specific external operations of the node are as follows: Assume the nodes are Node 1 / CPU1 and Node 2 / CPU1; If in the current state, the latest data is stored on node 2 / CPU1 and named A1, with address 0x01, then there will be a mark in the data sniffer to record the data address, and the counting method is to set the first position to 1 and combine it with the corresponding address; Pull the P2_CPU1_DATA_Valid signal high, which means that the data of node 2 / CPU1 at the corresponding address is the latest. When node 1 / CPU1 needs to read data, the instruction does not need to go through the instruction bus. CPU1 only needs to issue the corresponding instruction of curV to search the data sniffing register. When the data sniffing register has a signal that meets the requirements, you can find the corresponding CPU that pulls up the valid signal to get the data.

3. The cache consistency optimization method based on the MESI protocol according to claim 2, characterized in that: The data address is recorded as 0x01-A1-curV, where curV represents current value = 10x01.

4. The cache consistency optimization method based on the MESI protocol according to claim 2, characterized in that: When operating externally of a node, all operations involving the instruction bus must be performed through the data sniffing register.

5. The cache consistency optimization method based on the MESI protocol according to claim 2, characterized in that: The P2_CPU1_DATA_Valid signal is pulled high to indicate that the corresponding signal is set to 1. By setting curV=1, the corresponding address and data are found to trigger the corresponding CPU.

6. The cache consistency optimization method based on the MESI protocol according to claim 1, characterized in that: When curV does not meet the value requirements, the current CPU is assumed to be the latest value, and there is no need to use the data and address bus to determine whether the data is the latest.

7. An electronic device, characterized in that: include: memory and at least one processor; Wherein, the memory stores a computer program; The at least one processor executes the computer program stored in the memory, so that the at least one processor performs the cache consistency optimization method based on the MESI protocol as described in any one of claims 1 to 6.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which can be executed by a processor to implement the cache consistency optimization method based on the MESI protocol as described in any one of claims 1 to 6.