Processing method and device, controller, electronic equipment and storage medium
By introducing a target control module in a multi-core processor system to priorityly receive and process cache consistency requests, and forward them when necessary, combined with the directory access mechanism, the cache consistency problem is solved, and system performance and energy efficiency are improved.
Patent Information
- Application Number
- CN202411195472.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-28
- Publication Date
- 2024-12-03
AI Technical Summary
In multi-core processor systems, cache consistency issues lead to increased transmission bandwidth consumption and power consumption, affecting system performance and energy efficiency.
By prioritizing the reception and processing of cache consistency requests in the target control module and forwarding them to other control modules when necessary, unnecessary data transmission is reduced and the directory access mechanism is used to optimize cache consistency maintenance.
Reduces bus load, improves performance and energy efficiency of multi-core processor systems, and reduces unnecessary data transmission and power consumption.
Smart Images

Figure CN119065991A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a processing method, device, controller, electronic device and storage medium. Background Art
[0002] In a multi-core processor architecture, each processing core is usually equipped with its own private cache to reduce the latency and frequency of the processor accessing the main memory, thereby improving execution efficiency. Although this design effectively improves system performance, it also introduces a new challenge, namely the cache consistency problem. Summary of the invention
[0003] In view of the above problems, the present application provides a processing method, device, controller, electronic device and storage medium. The specific scheme is as follows:
[0004] In a first aspect, the present application provides a processing method, which is applied to a target control module of an electronic device, wherein the target control module is connected to a transmission module of the electronic device via a target interface; the transmission module includes other control modules; the method comprises:
[0005] The target control module receives the cache coherence request preferentially compared to the other control modules;
[0006] The target control module processes the cache coherence request;
[0007] If the processing obtains a first processing result, and the first processing result indicates that the target control module needs to assist in processing the cache consistency request, the cache consistency request is forwarded to the other control modules so that the other control modules process the received cache consistency request to obtain a second processing result.
[0008] In a possible implementation, the target control module processes the cache coherence request, including:
[0009] The target control module obtains the memory address corresponding to the data to be accessed from the cache coherence request;
[0010] The target control module determines whether there is a first target cache line corresponding to the memory address in a first cache associated with the target control module; the first cache is different from a second cache associated with the other control module;
[0011] If not, obtaining a first processing result; the first processing result indicates that the first target cache line corresponding to the memory address does not exist in the first cache;
[0012] If so, the cache coherence request is sent to the processing unit to which the first target cache line belongs for processing.
[0013] In a possible implementation, the method further includes:
[0014] The target control module determines the source and type of the cache coherence request;
[0015] If the source is a processing unit of the electronic device, the target control module determines whether there is a first target cache line corresponding to the memory address in a first cache associated with the target control module;
[0016] If the source is a peripheral device connected to the electronic device and the type is a read request, the target control module determines whether a first target cache line corresponding to the memory address exists in a first cache associated with the target control module.
[0017] In a possible implementation, the method further includes:
[0018] If the source is the peripheral device and the type is a write request, the target control module determines whether there is a first target cache line corresponding to the memory address in a first cache associated with the target control module;
[0019] If so, the target control module sends an update request to the first cache, so that the first cache clears the data in the first target cache line and returns response information after clearing;
[0020] When receiving the response information, the target control module generates a first processing result, where the first processing result indicates that the current data state of the first target cache line is empty.
[0021] In a possible implementation, before the target control module processes the cache coherence request, the method further includes:
[0022] The target control module determines a source of the cache coherence request;
[0023] If the source is a processing unit of the electronic device, determining that the cache coherence request can affect the cache of at least one processing unit of the electronic device, and recording the cache coherence request to build or update a cache directory;
[0024] If the source is a peripheral device connected to the electronic device, recording the cache coherence request to build or update a cache directory;
[0025] The cache directory is used for the target control module to process the cache coherence request when the subsequent cache coherence request meets the execution condition.
[0026] In a possible implementation, the processing method further includes:
[0027] If a new cache coherence request is received and the number of records in the cache directory meets a set threshold, a target record is selected from the cache directory;
[0028] The target record is replaced by the record corresponding to the new cache coherence request.
[0029] In another aspect of the present application, a processing device is provided, which is applied to a target control module of an electronic device, wherein the target control module is connected to a transmission module of the electronic device via a target interface; the transmission module includes other control modules; the device includes:
[0030] A receiving module, which receives the cache coherence request in priority compared to the other control modules;
[0031] A processing module, used for processing cache consistency requests;
[0032] A forwarding module is used to forward the cache consistency request to the other control modules if the processing process obtains a first processing result, and the first processing result indicates that the target control module needs to assist in processing the cache consistency request, so that the other control modules process the received cache consistency request to obtain a second processing result.
[0033] In a third aspect of the present application, a controller is provided, comprising:
[0034] A target interface, used to connect to a transmission module of the electronic device; the transmission module includes other control modules;
[0035] Control components for:
[0036] receiving the cache coherence request in priority to the other control modules;
[0037] Processing the cache coherence request;
[0038] If the processing procedure obtains a first processing result, and the first processing result indicates that the control component needs to assist in processing the cache consistency request, the cache consistency request is forwarded to the other control modules so that the other control modules process the received cache consistency request to obtain a second processing result.
[0039] In a fourth aspect of the present application, an electronic device is provided, comprising:
[0040] Transmission module; the transmission module includes other control modules;
[0041] A controller is connected to the transmission module via a target interface, and the controller is used for:
[0042] receiving the cache coherence request in priority to the other control modules;
[0043] Processing the cache coherence request;
[0044] If the processing process obtains a first processing result, and the first processing result indicates that the controller needs to assist in processing the cache consistency request, the cache consistency request is forwarded to the other control modules so that the other control modules process the received cache consistency request to obtain a second processing result.
[0045] In a fifth aspect of the present application, a storage medium is provided, which stores a computer program for implementing any one of the processing methods described above, and the computer program is executed by a processor to implement any one of the processing methods described above. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.
[0047] Figure 1 A schematic diagram of an implementation scenario of a processing method provided in this application;
[0048] Figure 2 A schematic diagram of a process for a treatment method provided in this application;
[0049] Figure 3 A schematic diagram of another implementation scenario of a processing method provided in this application;
[0050] Figure 4 Another schematic diagram of a processing method provided in this application;
[0051] Figure 5 A schematic diagram of another implementation scenario of a processing method provided in this application;
[0052] Figure 6 A schematic diagram of another process of a processing method provided in this application;
[0053] Figure 7 A schematic diagram of another process of a processing method provided in this application;
[0054] Figure 8 A schematic diagram of a state transition of a cache directory;
[0055] Fig. 9 A functional schematic diagram of a target control module provided in this application;
[0056] Fig.10 A schematic diagram of the structure of a processing device provided in this application. DETAILED DESCRIPTION
[0057] The following describes the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. The terms used in the implementation method section of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application.
[0058] The embodiments of the present application are described below in conjunction with the accompanying drawings. Those skilled in the art will appreciate that, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0059] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, which is only to describe the distinction mode adopted by the objects of the same attributes when describing in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0060] In a multi-processor system, in order to solve the cache consistency problem, a cache coherence protocol is usually used to ensure that the copies of shared data (that is, data that can be accessed or modified by multiple processing cores) in the private caches of all processing units are consistent at any time. When a processing unit needs to modify the shared data in its private cache, the processing unit will initiate a cache coherence request.
[0061] This cache coherence request is broadcast to all other processing units in the multiprocessor system, requiring them to update or verify the status of the corresponding data in their caches.
[0062] However, this global cache consistency maintenance mechanism also brings about significant transmission bandwidth consumption and power consumption. Especially in large-scale multi-core systems, as the number of processing units increases, the broadcast range and frequency of cache consistency requests will also increase significantly, which will adversely affect the overall performance and energy efficiency of the multi-core processor system.
[0063] In order to maintain global cache consistency, that is, to ensure that the shared data accessed by all processing units is up-to-date and consistent, a series of mechanisms are usually adopted. However, these mechanisms often bring side effects that cannot be ignored, such as significantly increasing the consumption of network bandwidth and the overall power consumption of the system. In order to solve this problem, the process is optimized by introducing a directory access mechanism.
[0064] like Figure 1 As shown in FIG. 1 , when a transmission module (such as an interconnect bus module) in a multiprocessor system receives a cache coherence request from a processing unit, the transmission module first accesses a global or distributed directory structure (Coherency controller). This directory structure is specifically used for data in different private caches (i.e., caches in nodes) in the system.
[0065] The transmission module can send cache consistency requests to the shared cache in the multi-processor system in parallel while determining which processing units may hold copies of the data through the directory structure, so that the corresponding private cache and shared cache process the cache consistency requests.
[0066] However, although directory access reduces unnecessary global broadcasts, it still needs to send cache coherence requests to all private caches and shared caches that may hold related data. This means that a large load is still generated on the bus, especially in high-concurrency or data-intensive application scenarios, and this load may become a bottleneck for system performance.
[0067] Therefore, the present application provides a processing method to reduce unnecessary processing load of the bus.
[0068] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0069] Reference Figure 2 , is a flow chart of a processing method provided in Example 1 of the present application, which can be applied to a target control module of an electronic device, wherein the target control module is connected to a transmission module of the electronic device via a target interface; the transmission module includes other control modules, such as Figure 2 As shown, the method may include but is not limited to the following steps:
[0070] Step S101 : The target control module receives the cache coherence request preferentially compared with other control modules.
[0071] In a multi-core processor system, when a processing unit (e.g., one of the processing units that is one of the independent execution units in a multi-core processor, or a complete processor that can itself be considered a processing unit in a system composed of multiple independent processors) needs to modify or access data in its cache that also has a copy in the shared cache, the processing unit can generate a cache coherence request.
[0072] After generating the cache coherence request, the processing unit may send the cache coherence request through a bus inside the processor.
[0073] In this embodiment, the target control module is connected to the transmission module of the electronic device through the target interface, so that the target control module can obtain priority independently of the transmission module, and the target control module can receive the cache coherence request earlier than the transmission module. Figure 3 As shown, if the processing unit generates a cache coherence request or the input / output device generates a coherence request, the target control module may receive the cache coherence request in priority to the transmission module.
[0074] The target control module may obtain priority through hardware. For example, the target control module may be connected to the processing unit through a bus. The target control module may be connected to the transmission module of the electronic device through a target interface. On the physical path, the cache consistency request of the processing unit in the processor reaches the target control module first.
[0075] The target control module may also obtain priority through software. For example, the cache coherence request may be preferentially scheduled to the target control module.
[0076] The transmission module can be used to be responsible for data transmission and communication between processing units, between processing units and resources (such as cache, memory), and between processing units and external devices.
[0077] Step S102: The target control module processes the cache coherence request.
[0078] The target control module may process cache coherence requests independently of other control modules in the transmission module.
[0079] In this embodiment, the target control module processes the cache coherence request, which may include: the target control module enables the processing unit corresponding to the corresponding cache to process the cache coherence request.
[0080] The target control module may obtain a first processing result when causing the processing unit corresponding to the corresponding cache to process the cache coherence request. The first processing result may indicate that the target control module needs to assist in processing the cache coherence request.
[0081] Step S103: If the first processing result is obtained, and the first processing result indicates that the target control module needs to assist in processing the cache consistency request, the cache consistency request is forwarded to other control modules so that the other control modules process the received cache consistency request to obtain a second processing result.
[0082] In this embodiment, the target control module is connected to the transmission module of the electronic device through the target interface. This design gives the target control module independence and priority when receiving cache consistency requests. The target control module can receive cache consistency requests earlier than other control modules. Accordingly, the target control module can process cache consistency requests first. If the cache consistency request can be processed independently by the target control module, it can ensure that the processing unit that sends the cache consistency request can obtain the latest data in the corresponding cache faster, thereby ensuring data processing efficiency. In addition, only when the cache consistency request requires auxiliary processing will the request be forwarded to other control modules. If the cache consistency request does not need auxiliary processing, other control modules will not receive cache consistency requests. In this way, unnecessary data transmission when other control modules process cache consistency requests can be reduced, thereby reducing transmission bandwidth consumption and power consumption, and improving the overall performance and energy efficiency of the multi-core processor system.
[0083] As another optional embodiment of the present application, refer to Figure 4 , is a flow chart of a processing method provided in Example 2 of the present application. In this embodiment, it is mainly an implementation method of step S102 in Example 1, such as Figure 4 As shown, step S102 may include but is not limited to the following steps:
[0084] Step S1021: The target control module obtains the memory address corresponding to the data to be accessed from the cache coherence request.
[0085] Step S1022: The target control module determines whether there is a first target cache line corresponding to the memory address in the first cache associated with the target control module.
[0086] The first cache may be different from the second cache corresponding to other control modules. In this embodiment, the first cache associated with the target control module may include: a private cache, that is, a cache of each processing unit. Accordingly, the second cache corresponding to other control modules may include: a shared cache corresponding to each processing unit. A private cache is only open to the processing unit to which it belongs, while a shared cache can be accessed by multiple processing units and external devices (such as peripheral devices).
[0087] The target control module may include a target directory, which may be used to record the correspondence between cache lines and memory addresses in the private cache. Figure 5 As shown, the cache in the node is a private cache, the target directory in the target control module is used to record the correspondence between the cache line and the memory address of the cache in the node, and other control modules in the transmission module can correspond to the shared cache.
[0088] For example, the target directory may include a tag of a cache line in a private cache and a processing unit identifier. The tag of the cache line may be used to identify which memory address the cache line corresponds to. The processing unit identifier may be used to identify the processing unit that owns the cache line.
[0089] The target control module can search in the target directory whether there is a target memory address corresponding to the memory address in the cache consistency request; if so, it can be determined that there is a first target cache line corresponding to the memory address in the first cache associated with the target control module; if not, it can be determined that there is no first target cache line corresponding to the memory address in the first cache associated with the target control module.
[0090] If it exists, execute step S1023; if it does not exist, execute step S1024.
[0091] Step S1023: Send a cache coherence request to the processing unit to which the first target cache line belongs.
[0092] In this embodiment, the target control module may determine the processing unit to which the first target cache line belongs based on the processing unit identifier in the target directory, and send the cache coherence request to the processing unit to which the first target cache line belongs.
[0093] After receiving the cache coherence request, the processing unit to which the first target cache line belongs can check the current state of the first target cache line and perform corresponding processing according to the cache coherence protocol and the current state of the first target cache line. The specific implementation and process of the cache coherence protocol can be referred to the relevant introduction in the prior art, which will not be repeated here.
[0094] Step S1024, obtaining a first processing result; the first processing result indicates that the first target cache line corresponding to the memory address does not exist in the first cache.
[0095] The first processing result may be used as an intermediate state, indicating that the target control module has not found the corresponding cache line in its associated first cache.
[0096] The first processing result indicates that the first target cache line corresponding to the memory address does not exist in the first cache. The target control module can forward the cache consistency request to other control modules, and other control modules can send the cache consistency request to the second cache associated with other control modules, such as the shared cache corresponding to each processing unit.
[0097] After receiving a cache coherence request, the shared cache can obtain the memory address corresponding to the data to be accessed from the cache coherence request, and determine whether there is a cache line corresponding to the memory address in the shared cache. If so, the current state of the cache line corresponding to the memory address can be checked, and the current state of the cache line corresponding to the memory address can be processed accordingly according to the cache coherence protocol and the current state of the cache line corresponding to the memory address. The specific implementation and process of the cache coherence protocol can be found in the relevant introduction of the prior art, which will not be repeated here.
[0098] In this embodiment, the target control module is connected to the transmission module of the electronic device through the target interface. This design gives the target control module independence and priority when receiving cache consistency requests. The target control module can receive cache consistency requests earlier than other control modules. Accordingly, the target control module can preferentially obtain the memory address corresponding to the data to be accessed from the cache consistency request. The target control module determines whether there is a first target cache line corresponding to the memory address in the first cache associated with the target control module. If so, the cache consistency request is sent to the processing unit to which the first target cache line belongs; if not, a first processing result is obtained; the first processing result indicates that there is no first target cache line corresponding to the target data in the first cache. After obtaining the first processing result, the cache consistency request is forwarded to other control modules, and other control modules send the cache consistency request to the second cache associated with other control modules. This mechanism can ensure that the cache consistency request will be sent to the second cache only when necessary, thereby effectively reducing unnecessary data transmission.
[0099] As another optional embodiment of the present application, refer to Figure 6 , is a flow chart of a processing method provided in Example 3 of the present application. This embodiment is mainly an implementation method of step S102 in Example 1, such as Figure 6 As shown, step S102 may include but is not limited to the following steps:
[0100] Step S1025: The target control module obtains the memory address corresponding to the data to be accessed from the cache coherence request.
[0101] The detailed process of step S1025 can refer to the relevant introduction of step S1021 in embodiment 2, which will not be repeated here.
[0102] Step S1026: The target control module determines the source and type of the cache coherence request.
[0103] In this embodiment, the processing unit of the electronic device may generate a cache coherence request. For example, when a processing unit of the electronic device executes a program, if the data at a certain memory address is modified, and the data at the memory address is also held by the cache of another processing unit, the processing unit may generate a cache coherence request.
[0104] A peripheral device connected to the electronic device may also generate a cache coherence request. For example, the peripheral device may generate a cache coherence request when reading data from a cache or writing data to a memory.
[0105] There are multiple possibilities when a peripheral device writes data to the memory. On the one hand, the peripheral device may only update part of the data in the memory allocated to it. On the other hand, the peripheral device may also perform a comprehensive data update, that is, replace all relevant data in the memory allocated to the peripheral device.
[0106] When generating a cache coherence request, the processing unit of the electronic device may encapsulate information identifying the processing unit and information identifying the request type (eg, a write request or a read request) in the cache coherence request.
[0107] When a peripheral device of an electronic device generates a cache coherence request, the peripheral device may encapsulate information identifying the peripheral device and information identifying the request type (eg, a write request or a read request) in the cache coherence request.
[0108] The source and type of the cache coherence request may be determined by, but is not limited to, parsing the cache coherence request and obtaining information identifying the source and type of the request from the cache coherence request.
[0109] Step S1027: If the source is a processing unit of an electronic device, the target control module determines whether there is a first target cache line corresponding to the memory address in the first cache associated with the target control module.
[0110] If the source is a processing unit of an electronic device, and the first cache associated with the target control module allows the operation regardless of whether it is a write request or a read request, then the request type of the cache consistency request is not restricted, and the target control module can determine whether there is a first target cache row corresponding to the memory address in the first cache associated with the target control module.
[0111] If it exists, execute step S1028; if it does not exist, execute step S1029.
[0112] Step S1028: Send the cache coherence request to the processing unit to which the first target cache line belongs for processing.
[0113] Step S1029, obtaining a first processing result; the first processing result indicates that the first target cache line corresponding to the memory address does not exist in the first cache.
[0114] The detailed process of steps S1028-S1029 can be found in the relevant introduction of steps S1023-S1024 in Example 2, which will not be repeated here.
[0115] Step S10210: If the source is a peripheral device connected to the electronic device and the type is a read request, the target control module determines whether there is a first target cache line corresponding to the memory address in the first cache associated with the target control module.
[0116] If the source is a peripheral device connected to the electronic device, the first cache (e.g., private cache) does not allow the peripheral device to write data, so when the type is a write request, special processing is required compared to a read request. However, the first cache allows the peripheral device to read data, so when the type is a read request, the target control module can determine whether there is a first target cache line corresponding to the memory address in the first cache associated with the target control module.
[0117] If it exists, execute step S1028; if it does not exist, execute step S1029.
[0118] In this embodiment, the target control module can flexibly decide how to process the cache coherence requests according to the source and type (read request or write request) of the cache coherence requests. For requests from the processing unit, whether it is read or write, the first cache can be directly checked; and for requests from the peripheral device, different processing strategies can be performed according to the request type (read or write), thereby increasing the flexibility and responsiveness of the processing.
[0119] As another optional embodiment of the present application, a processing method is provided for embodiment 4 of the present application. In this embodiment, it is mainly an implementation method of step S102 in embodiment 1. Step S102 may include but is not limited to the following steps:
[0120] Step S1025: The target control module obtains the memory address corresponding to the data to be accessed from the cache coherence request.
[0121] The detailed process of step S1025 can refer to the relevant introduction of step S1021 in embodiment 2, which will not be repeated here.
[0122] Step S1026: The target control module determines the source and type of the cache coherence request.
[0123] Step S1027: If the source is a processing unit of an electronic device, the target control module determines whether there is a first target cache line corresponding to the memory address in the first cache associated with the target control module.
[0124] If it exists, execute step S1028; if it does not exist, execute step S1029.
[0125] Step S1028: Send the cache coherence request to the processing unit to which the first target cache line belongs for processing.
[0126] Step S1029, obtaining a first processing result; the first processing result indicates that the first target cache line corresponding to the memory address does not exist in the first cache.
[0127] The detailed process of steps S1028-S1029 can be found in the relevant introduction of steps S1023-S1024 in Example 2, which will not be repeated here.
[0128] Step S10210: If the source is a peripheral device connected to the electronic device and the type is a read request, the target control module determines whether there is a first target cache line corresponding to the memory address in the first cache associated with the target control module.
[0129] If it exists, execute step S1028; if it does not exist, execute step S1029.
[0130] Step S10211: If the source is a peripheral device and the type is a write request, the target control module determines whether there is a first target cache line corresponding to the memory address in the first cache associated with the target control module.
[0131] If the source is a peripheral device and the type is a write request, the target control module can determine whether there is a first target cache line corresponding to the memory address in the first cache associated with the target control module, so as to process the data in the first target cache line in response to the subsequent write request of the peripheral device.
[0132] The target control module can read out the data from the first target cache line, and the target control module can merge the data read from the first target cache line with the newly written data in the memory allocated to it by the peripheral device. The merge process can be more than a simple data superposition or replacement, but can intelligently determine which data should be retained and which data should be updated or discarded according to certain logical rules, thereby generating a merged data. The merged data is consistent with the data in the memory allocated to the peripheral device.
[0133] If it exists, execute step S10212; if it does not exist, execute step S1029.
[0134] Step S10212: The target control module sends an update request to the first cache, so that the first cache clears the data in the first target cache line and returns response information after clearing.
[0135] The target control module may send an update request to the processing unit in the first cache belonging to the first target cache line. After receiving the update request, the processing unit to which the first target cache line belongs may clear the data in the first target cache line.
[0136] After clearing the data in the first target cache line, the processing unit to which the first target cache line belongs may return response information to the target control module.
[0137] Step S10213: When receiving the response information, the target control module generates a first processing result, where the first processing result indicates that the current data state of the first target cache line is empty.
[0138] When the first processing result indicates that the current data state of the first target cache line is empty, the target control module may forward the merged data to other control modules, other control modules may send the merged data to the shared cache, and the shared cache may cache the merged data.
[0139] In this embodiment, if the source is a peripheral device and the type is a write request, the target control module determines whether there is a first target cache line corresponding to the memory address in the first cache associated with the target control module. If so, the target control module sends an update request to the first cache so that the first cache clears the data in the first target cache line, thereby ensuring that subsequent accesses to the memory address can obtain the latest data, thereby avoiding the problem of data inconsistency.
[0140] When receiving the response information, the target control module generates a first processing result, and the first processing result indicates that the current data state of the first target cache line is empty. When the first processing result indicates that the current data state of the first target cache line is empty, the target control module can forward the merged data to other control modules, and the other control modules can send the merged data to the shared cache. The shared cache can cache the merged data and maintain the consistency of the data about the peripheral device in the shared cache and the memory, so that multiple processing cores or peripheral devices can subsequently quickly and accurately access the data from the shared cache.
[0141] As another optional embodiment of the present application, refer to Figure 7, is a flow chart of a processing method provided in Example 5 of the present application, such as Figure 7 As shown, the method may include but is not limited to the following steps:
[0142] Step S201: The target control module receives the cache coherence request preferentially compared with other control modules.
[0143] The detailed process of step S201 can be found in the relevant introduction in Example 1, and will not be repeated here.
[0144] Step S202: The target control module determines the source of the cache coherence request.
[0145] For this step, please refer to the relevant introduction of step S1026 in Example 3, which will not be repeated here.
[0146] Step S203: If the source is a processing unit of an electronic device, it is determined that the cache coherence request can affect the cache of at least one processing unit of the electronic device, and the cache coherence request is recorded to build or update the cache directory.
[0147] In complex multi-processor or multi-core processor systems, each processing unit may have its own cache. The purpose of cache coherence requests is usually to ensure that the data in these caches is consistent with the data in the main memory or other caches. However, not all cache coherence requests from processing units will actually affect other caches. Some requests may only be related to the operation of the local cache, or the address in the request may not be within the cache range of other processing units. Therefore, by first determining the scope of the request, unnecessary recording of those insignificant requests can be avoided, thereby reducing the waste of system resources.
[0148] Step S204: If the source is a peripheral device connected to the electronic device, the cache coherence request is recorded to build or update the cache directory.
[0149] In this embodiment, the interaction between the peripheral device and the electronic device often involves data read and write operations. These operations may directly affect the cache data in the electronic device. Therefore, recording the cache coherence request from the peripheral device helps to ensure that the data between the peripheral device, the memory and the cache remains synchronized.
[0150] The process of building or updating the cache directory can be seen in Figure 8. Figure 8 As shown, when no cache coherence request is received, the state of the entry in the cache directory is idle (Q_IDLE);
[0151] If a cache coherence request is received from a processing unit of an electronic device:
[0152] Determine that a cache coherence request can affect the cache of at least one processing unit of the electronic device, record the cache coherence request, and the entry jumps from the idle state to the first state (Q_VALID), where the first state indicates that the request is valid; if the target control module asks other control modules whether there is a corresponding cache line in the shared cache, if a completion response (comprsp) is received from the other control modules, jump to the second state (Q_WAITARB), where the second state indicates preparation for arbitration; if a retry response (retryrsp) is received from the other control modules, jump back to the idle state (Q_IDLE).
[0153] If the cache coherence request is successfully arbitrated, the entry can jump to the third state (Q_WAITQUERY). The target control module can send the cache coherence request to other control modules, which send the cache coherence request to the shared cache, and the shared cache responds to the cache coherence request. If the target directory of the target control module contains a record of the corresponding cache line of the processing unit, the record in the target directory is updated. After the update is completed, the entry jumps from the third state to the idle state. If the arbitration fails, the second state remains unchanged and waits for the next arbitration.
[0154] If a cache coherence request is received from a peripheral device connected to the electronic device:
[0155] A cache coherence request is recorded and the entry transitions from the idle state to the first state (Q_VALID).
[0156] If the cache consistency request is a write request, the target control module can ask other control modules whether there is a corresponding cache line in the shared cache. If a completion response (comprsp) is received from other control modules, it jumps to the second state (Q_WAITARB); if a retry response (retryrsp) is received from other control modules, it jumps back to the idle state (Q_IDLE).
[0157] For example, if the arbitration of the write request is successful, the entry can jump to the third state (Q_WAITQUERY). If the target directory of the target control module contains a record about the corresponding cache line of the processing unit (i.e., write hit), jump to the fourth state (Q_WAITSNP). If the peripheral device performs a comprehensive data update, a snoop request is generated based on the write request, and the snoop request is sent to the processing unit, and jump to the fifth state (Q_SEND). After receiving the snoop request, the processing unit clears the data in the corresponding cache line and returns a response message. If the response message of the processing unit is received, jump to the idle state. If the peripheral device only updates part of the data in the memory allocated to it, the corresponding data of the peripheral device obtained from the processing unit is merged with the newly written data of the peripheral device, and jump to the first state.
[0158] If the target directory of the target control module does not contain a record of the corresponding cache line of the processing unit (i.e., a miss), the write request is forwarded to other control modules, and the other control modules send the write request to the shared cache, jump to the fifth state (Q_SEND), and then jump to the idle state from the fifth state.
[0159] In the first state, if the cache directory is full, replace an entry in the cache directory, jump to the fourth state (Q_WAITSNP), generate a snoop request to inform the processing unit that the entry is replaced, send the snoop request to the processing unit, jump to the fifth state (Q_SEND), the processing unit returns a response message after receiving the snoop request, and jump to the idle state if the response message of the processing unit is received.
[0160] The cache directory may be used by the target control module to process a cache coherence request when a subsequent cache coherence request meets an execution condition.
[0161] Step S205: The target control module obtains a cache coherence request from the cache directory and processes the cache coherence request.
[0162] Step S206: If the first processing result is obtained, and the first processing result indicates that the target control module needs to assist in processing the cache consistency request, the cache consistency request is forwarded to other control modules so that the other control modules process the received cache consistency request to obtain a second processing result.
[0163] The detailed process of step S206 can refer to the relevant introduction of step S103 in embodiment 1, which will not be repeated here.
[0164] In this embodiment, if the source is a processing unit of an electronic device, by first determining the impact range of the cache coherence request and then deciding whether to record it, unnecessary recording and processing of insignificant requests can be avoided. This can not only reduce the waste of system resources (such as CPU time, memory space, etc.), but also improve the overall efficiency and response speed of the system.
[0165] Furthermore, cache coherence requests from peripheral devices are recorded to help ensure that data between peripherals, memory, and cache remains synchronized.
[0166] Furthermore, the construction and update of the cache directory can provide the system with a reliable data source for reference when processing cache consistency requests later. The cache directory can reduce the risk of system crashes or performance degradation caused by inconsistent data or incorrect processing.
[0167] In this embodiment, the processing method is described in conjunction with the specific functional modules of the target control module. For example, Fig. 9 As shown, a receiving module (req_ctrl) in a target control module receives a cache consistency request; the receiving module sends the cache consistency request to a recording module (req_POCQ); the recording module records the cache consistency request according to the source of the cache consistency request to obtain a cache directory; the recording module can send the cache consistency request in the cache directory to a processing module (sf_tagpipe); the processing module determines whether there is a first target line corresponding to the memory address in the cache consistency request in the private cache of the processing unit according to the target directory (sf_tagarray); if so, the forwarding module (Snoop-ctrl) is notified to generate a snoop request according to the cache consistency request, and send the snoop request to the processing unit to which the first target cache line belongs; if not, a first processing result is obtained, and the first processing result is sent to the forwarding module, and the forwarding module generates a snoop request according to the first processing result, and sends the snoop request to other control modules, so that other control modules send the snoop request to the shared cache.
[0168] If the cache coherence request comes from a peripheral device and is a write request, the merge module (sf_datactrl) in the target control module can read the data from the first target cache line, merge the data read from the first target cache line with the newly written data from the memory allocated to it by the peripheral device, and generate a merged data. The merged data is consistent with the data in the memory allocated to the peripheral device.
[0169] As another optional embodiment of the present application, a processing method is provided for Embodiment 6 of the present application, which may include but is not limited to the following steps:
[0170] Step S301: The target control module receives the cache coherence request in priority to other control modules.
[0171] Step S302: The target control module determines the source of the cache coherence request.
[0172] Step S303: If the source is a processing unit of an electronic device, it is determined that the cache coherence request can affect the cache of at least one processing unit of the electronic device, and the cache coherence request is recorded to build or update the cache directory.
[0173] Step S304: If the source is a peripheral device connected to the electronic device, the cache coherence request is recorded to build or update the cache directory.
[0174] Step S305: The target control module obtains a cache coherence request from the cache directory and processes the cache coherence request.
[0175] Step S306: If the first processing result is obtained, and the first processing result indicates that the target control module needs to assist in processing the cache consistency request, the cache consistency request is forwarded to other control modules so that the other control modules process the received cache consistency request to obtain a second processing result.
[0176] The detailed process of steps S301-S306 can refer to the relevant introduction of steps S201-S206 in Example 5, which will not be repeated here.
[0177] Step S307: If a new cache coherence request is received and the number of records in the cache directory meets a set threshold, a target record is selected from the cache directory.
[0178] During the process of processing cache coherence requests, if new cache coherence requests continue to be received, and the number of records in the cache directory has reached the set threshold, this means that the cache directory may have reached the upper limit of its storage capacity, or is approaching a point that may affect processing efficiency. Therefore, a target record can be selected from the cache directory as the object to be replaced.
[0179] Strategies for selecting target records may include, but are not limited to:
[0180] Least Recently Used (LRU): Replaces the record that has not been accessed for the longest time.
[0181] FIFO (First In First Out): Replace the earliest record in the order in which the records were added.
[0182] Replacement based on importance: If the records contain: data about the critical operation of the system or data that is accessed frequently, these factors can be considered to decide which records should be retained and which should be replaced.
[0183] Step S308: Replace the target record with the record corresponding to the new cache coherence request.
[0184] Once the target record is selected, the system will replace the target record with the record corresponding to the newly received cache consistency request, which can ensure that the cache directory can continue to effectively provide the necessary cache consistency requests to the system.
[0185] In this embodiment, by regularly replacing old records in the cache directory, the target control module can ensure that the cache directory stores the latest and most relevant cache coherence requests, which helps to reduce the search time when processing cache coherence requests and improve the overall processing efficiency of the system.
[0186] Next, a processing device provided by the present application is introduced. The processing device introduced below and the processing method introduced above can refer to each other.
[0187] The processing device can be applied to a target control module of an electronic device, wherein the target control module is connected to a transmission module of the electronic device via a target interface; the transmission module includes other control modules;
[0188] Reference Fig.10 The processing device includes: a receiving module 100, a processing module 200 and a forwarding module 300.
[0189] The receiving module 100 receives the cache coherence request in priority compared to other control modules.
[0190] The processing module 200 is used to process a cache coherence request.
[0191] The forwarding module 300 is used to forward the cache consistency request to other control modules if the processing process obtains a first processing result, and the first processing result indicates that the target control module needs to assist in processing the cache consistency request, so that the other control modules process the received cache consistency request and obtain a second processing result.
[0192] The processing module 200 may be specifically used for:
[0193] Obtain the memory address corresponding to the data to be accessed from the cache coherence request;
[0194] Determine whether a first target cache line corresponding to the memory address exists in a first cache associated with the target control module; the first cache is different from a second cache associated with other control modules;
[0195] If not, a first processing result is obtained; the first processing result indicates that the first target cache line corresponding to the memory address does not exist in the first cache;
[0196] If so, the cache coherence request is sent to the processing unit to which the first target cache line belongs for processing.
[0197] The processing module 200 may also be used for:
[0198] Determining a source and type of the cache coherence request;
[0199] If the source is a processing unit of an electronic device, determining whether there is a first target cache line corresponding to the memory address in a first cache associated with the target control module;
[0200] If the source is a peripheral device connected to the electronic device and the type is a read request, it is determined whether there is a first target cache line corresponding to the memory address in a first cache associated with the target control module.
[0201] The processing module 200 may also be used for:
[0202] If the source is a peripheral device and the type is a write request, determining whether there is a first target cache line corresponding to the memory address in a first cache associated with the target control module;
[0203] If so, sending an update request to the first cache, so that the first cache clears the data in the first target cache line, and returns response information after clearing;
[0204] When the response information is received, a first processing result is generated, where the first processing result indicates that the current data state of the first target cache line is empty.
[0205] The processing device may also include:
[0206] A determination module, used to determine the source of the cache coherence request;
[0207] Logging module for:
[0208] If the source is a processing unit of the electronic device, determining that the cache coherence request can affect the cache of at least one processing unit of the electronic device, recording the cache coherence request to build or update the cache directory;
[0209] If the source is a peripheral device connected to the electronic device, the cache coherence request is recorded to build or update the cache directory;
[0210] The cache directory is used for the target control module to process the cache coherence request when the subsequent cache coherence request meets the execution condition.
[0211] The processing device may also include:
[0212] A selection module, for selecting a target record from the cache directory if a new cache coherence request is received and the number of records in the cache directory meets a set threshold;
[0213] The replacement module is used to replace the target record with the record corresponding to the new cache consistency request.
[0214] In another embodiment of the present application, a controller is also provided.
[0215] The controller may include:
[0216] A target interface is used to connect to a transmission module of an electronic device; the transmission module includes other control modules;
[0217] Control components for:
[0218] Receive cache coherence requests before other control modules;
[0219] Process cache coherence requests;
[0220] If the processing process obtains a first processing result, and the first processing result indicates that the control component needs to assist in processing the cache consistency request, the cache consistency request is forwarded to other control modules so that the other control modules process the received cache consistency request to obtain a second processing result.
[0221] In another embodiment of the present application, an electronic device is provided.
[0222] Electronic equipment may include:
[0223] Transmission module; the transmission module includes other control modules;
[0224] A controller is connected to the transmission module via a target interface, and is used for:
[0225] Receive cache coherence requests before other control modules;
[0226] Process cache coherence requests;
[0227] If the processing process obtains a first processing result, and the first processing result indicates that the controller needs to assist in processing the cache consistency request, the cache consistency request is forwarded to other control modules so that the other control modules process the received cache consistency request to obtain a second processing result.
[0228] In another embodiment of the present application, a storage medium is provided, which stores a computer program for implementing the processing method described in any one of Examples 1-6. The computer program is executed by a processor to implement the processing method described in any one of Examples 1-6.
[0229] It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.
[0230] Through the description of the above implementation mode, the technicians in the field can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present application, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a ROM, a RAM, a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a training device, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0231] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.
[0232] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, a computer, a training device, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, training device, or data center. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)), etc.
Claims
1. A processing method, applied to a target control module of an electronic device, wherein the target control module is connected to a transmission module of the electronic device via a target interface; the transmission module includes other control modules; the method include: The target control module receives the cache coherence request preferentially compared to the other control modules; The target control module processes the cache coherence request; If the processing obtains a first processing result, and the first processing result indicates that the target control module needs to assist in processing the cache consistency request, the cache consistency request is forwarded to the other control modules so that the other control modules process the received cache consistency request to obtain a second processing result.
2. The processing method according to claim 1, wherein the target control module processes the cache coherence request. include: The target control module obtains the memory address corresponding to the data to be accessed from the cache coherence request; The target control module determines whether there is a first target cache line corresponding to the memory address in the first cache associated with the target control module; The first cache is different from the second cache associated with the other control module; If it does not exist, obtain the first processing result; The first processing result indicates that the first target cache line corresponding to the memory address does not exist in the first cache; If so, the cache coherence request is sent to the processing unit to which the first target cache line belongs for processing.
3. The processing method according to claim 2, wherein the method further comprises: include: The target control module determines the source and type of the cache coherence request; If the source is a processing unit of the electronic device, the target control module determines whether there is a first target cache line corresponding to the memory address in a first cache associated with the target control module; If the source is a peripheral device connected to the electronic device and the type is a read request, the target control module determines whether a first target cache line corresponding to the memory address exists in a first cache associated with the target control module.
4. The processing method according to claim 3, wherein the method further comprises: include: If the source is the peripheral device and the type is a write request, the target control module determines whether there is a first target cache line corresponding to the memory address in the first cache associated with the target control module; If so, the target control module sends an update request to the first cache, so that the first cache clears the data in the first target cache line and returns response information after clearing; When receiving the response information, the target control module generates a first processing result, where the first processing result indicates that the current data state of the first target cache line is empty.
5. The processing method according to claim 1, before the target control module processes the cache coherence request, include: The target control module determines a source of the cache coherence request; If the source is a processing unit of the electronic device, determining that the cache coherence request can affect the cache of at least one processing unit of the electronic device, and recording the cache coherence request to build or update a cache directory; If the source is a peripheral device connected to the electronic device, recording the cache coherence request to build or update a cache directory; The cache directory is used for the target control module to process the cache coherence request when the subsequent cache coherence request meets the execution condition.
6. The processing method according to claim 5, further comprising: include: If a new cache coherence request is received and the number of records in the cache directory meets a set threshold, a target record is selected from the cache directory; The target record is replaced by the record corresponding to the new cache coherence request.
7. A processing device, applied to a target control module of an electronic device, wherein the target control module is connected to a transmission module of the electronic device via a target interface; the transmission module includes other control modules; the device include: A receiving module, which receives the cache coherence request in priority compared to the other control modules; A processing module, used for processing cache consistency requests; A forwarding module is used to forward the cache consistency request to the other control modules if the processing process obtains a first processing result, and the first processing result indicates that the target control module needs to assist in processing the cache consistency request, so that the other control modules process the received cache consistency request to obtain a second processing result.
8. A controller, include: A target interface, used to connect to a transmission module of the electronic device; the transmission module includes other control modules; Control components for: receiving the cache coherence request in priority to the other control modules; Processing the cache coherence request; If the processing procedure obtains a first processing result, and the first processing result indicates that the control component needs to assist in processing the cache consistency request, the cache consistency request is forwarded to the other control modules so that the other control modules process the received cache consistency request to obtain a second processing result.
9. An electronic device, include: Transmission module; The transmission module includes other control modules; A controller is connected to the transmission module via a target interface, and the controller is used for: receiving the cache coherence request in priority to the other control modules; Processing the cache coherence request; If the processing process obtains a first processing result, and the first processing result indicates that the controller needs to assist in processing the cache consistency request, the cache consistency request is forwarded to the other control modules so that the other control modules process the received cache consistency request to obtain a second processing result.
10. A storage medium storing a computer program for implementing the processing method according to any one of claims 1 to 6, wherein the computer program is executed by a processor to implement the processing method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Method for cataloging Cache consistency
CN103729309A
Method and device for achieving cache consistency between multiple cores
CN104462007A
Data processing method and device, electronic equipment, cache and storage medium
CN116679886A
Method and apparatus for maintaining coherence information in multi-cache systems
US20050188160A1
Cited By
Transaction request processing method and device, electronic equipment and storage medium
CN119583652A
