Multi-core processor system
By adopting multi-level cache architecture and cache state matrix marking in multi-core processor systems, cache consistency processing is simplified, cache consistency delay problem is solved, and system stability and response speed are improved.
Patent Information
- Application Number
- CN202411035441.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-30
- Publication Date
- 2024-11-26
AI Technical Summary
The existing multi-core processor system has a long delay in the cache consistency process, which affects system stability and program accuracy.
Adopt a multi-level cache architecture, including first-level cache, second-level cache and third-level cache. Each set of processor cores corresponds to a second-level cache, and multiple sets of processor cores correspond to a third-level cache. The cache line is marked in the cache state matrix. The exclusive state, shared state and invalid state simplify the cache consistency processing process and eliminate the process of querying directories.
It shortens the delay of the cache consistency process, improves the system's response speed and processing capabilities, reduces the cached data missing rate, and enhances the stability and scalability of the system.
Smart Images

Figure CN119025443A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the technical field of computers, and in particular, to a multi-core processor system. Background Art
[0002] With the rapid development of information technology, modern computing platforms are standardly configured with multi-core processor systems, which can significantly improve the processing power and response speed of computing platforms. In the architecture of multi-core processors, each processor core is equipped with an independent high-speed cache to accelerate data access, but this also introduces cache consistency issues. When different processor cores perform read and write operations on the same data in shared memory, if the consistency issue is not resolved, data inconsistency may affect the correctness of the program and the stability of the system.
[0003] In order to solve the problem of cache inconsistency, a directory-based protocol is proposed to maintain cache consistency. The directory is introduced to track the status of each shared memory block in each cache. All cores send memory access requests to the directory, which queries the cache status of the cache block. If the cache status of the cache block meets the read and write requests, it can be read and written directly. If it does not meet the requirements, a listening request is sent to other cores, or a request to read and write data is sent to the memory to obtain a cache status that meets the request. The directory-based protocol implements an efficient and scalable data consistency maintenance mechanism by centrally managing the cache status of shared data.
[0004] However, in the process of using the directory to maintain cache consistency, each memory access request needs to be sent to the directory first, and then the cache of each core is operated after being processed by the directory. The whole process takes a long time, resulting in a long delay in the cache consistency process. Summary of the invention
[0005] An embodiment of the present application provides a multi-core processor system, aiming to shorten the latency of a cache consistency process.
[0006] In a first aspect, an embodiment of the present application provides a multi-core processor system, the multi-core processor system comprising multiple processor cores, a multi-level cache and a memory, the multi-level cache comprising a first-level cache, a second-level cache and a third-level cache;
[0007] Each of the multiple processor cores has a corresponding first-level cache;
[0008] The multiple processor cores are divided into multiple groups of processor cores, each group of processor cores corresponds to a secondary cache, and a first cache directory is set in any secondary cache, and the first cache directory includes cache states of cache lines of all the primary caches of the group of processor cores in each processor core of the group;
[0009] The multiple groups of processor cores correspond to a third-level cache, the third-level cache is provided with a second cache directory, and the second cache directory includes cache states of cache lines in all the second-level caches in each group of processor cores;
[0010] The cache state is used to characterize the usage of the cache line by any processor core, and the cache state includes an exclusive state, a shared state, and an invalid state.
[0011] Optionally, the first cache directory of any secondary cache is set in a tag matrix of the secondary cache;
[0012] The second cache directory of the third-level cache is set in the tag matrix of the third-level cache;
[0013] For any cache line in the second cache directory, when any processor core in any group of processor cores has an exclusive state for the cache line, the cache state of the cache line in the group of processor cores is marked as an exclusive state; when no processor core in any group of processor cores has an exclusive state for the cache line, if any processor core in the group has a shared state for the cache line, the cache state of the cache line in the group of processor cores is marked as a shared state; when all processor cores in any group of processor cores are in an invalid state for the cache line, the cache state of the cache line in the group of processor cores is marked as an invalid state.
[0014] Optionally, the size of any L2 cache is the sum of the sizes of the L1 caches of all processor cores corresponding to the L2 cache;
[0015] The size of the L3 cache is the sum of the sizes of all L2 caches.
[0016] Optionally, the system further comprises a cache controller and a plurality of first consistency processing units, each group of processor cores corresponding to one first consistency processing unit;
[0017] The cache controller is used to query whether there is a target cache line corresponding to the target request in the first-level cache of the target processor core in response to the target request of the target processor core;
[0018] When the cache controller finds the target cache line corresponding to the target request in the first-level cache of the target processor core, the cache controller is used to send a status query request to the first consistency processing unit corresponding to the target processor core;
[0019] The first consistency processing unit is used to determine, in response to the status query request, a cache status of the target processor core for the target cache line in a first cache directory of the secondary cache corresponding to the target processor core;
[0020] When the cache state of the target cache line satisfies the request state of the target request, the first consistency processing unit is used to return a response corresponding to the target request to the target processor core.
[0021] Optionally, when the cache controller does not find a target cache line corresponding to the target request in the first-level cache of the target processor core, the cache controller is used to send the target request to the first consistency processing unit;
[0022] The first consistency processing unit is used for querying whether there is a target cache line corresponding to the target request in the secondary cache corresponding to the target processor core in response to the target request;
[0023] When the target cache line corresponding to the target request is queried in the secondary cache corresponding to the target processor core, and the cache status corresponding to the target cache line in the first cache directory of the secondary cache satisfies the request status of the target request, the first consistency processing unit sends a consistency monitoring request to the group of processor cores, and changes the cache status corresponding to the target cache line in the first cache directory of the secondary cache according to the monitoring responses returned by the group of processor cores respectively, and returns a response corresponding to the target request to the target processor core.
[0024] Optionally, the system further comprises a second consistency processing unit;
[0025] When the target cache line corresponding to the target request is not found in the secondary cache corresponding to the target processor core, or the cache state corresponding to the target cache line in the first cache directory of the secondary cache does not satisfy the request state of the target request, the first consistency processing unit is used to send the target request to the second consistency processing unit;
[0026] The second consistency processing unit is used for querying whether there is a target cache line corresponding to the target request in the third-level cache in response to the target request;
[0027] When the target cache line corresponding to the target request is queried in the third-level cache, and the cache status corresponding to the target cache line in the second cache directory of the third-level cache satisfies the request status of the target request, the second consistency processing unit sends consistency monitoring requests to each group of processor cores respectively, and changes the cache status corresponding to the target cache line in the second cache directory of the third-level cache according to the monitoring responses returned by the group of processor cores respectively, and returns the response corresponding to the target request to the target processor core.
[0028] Optionally, when the target cache line corresponding to the target request is not found in the third-level cache, or the cache status corresponding to the target cache line in the second cache directory of the third-level cache does not satisfy the request status of the target request, the second consistency processing unit is used to read the data corresponding to the target request from the memory and load it into the third-level cache, and return a response corresponding to the target request to the target processor core.
[0029] Optionally, when the target request is a write request, the first consistency processing unit is used to send a write consistency snoop request to a processor core whose cache state of the target cache line in the first cache directory is exclusive or shared;
[0030] When the target request is a write request, the second consistency processing unit is used to send a write consistency snooping request to the first consistency processing unit corresponding to any group of processor cores whose cache status of the target cache line in the second cache directory is exclusive or shared, and the first consistency processing unit that receives the write consistency snooping request is used to send a write consistency snooping request to the processor core in the group whose cache status is exclusive or shared;
[0031] The write consistency snoop request is used to change the exclusive state or shared state of a cache line by any processor core to an invalid state.
[0032] Optionally, when the target request is a read request, the first consistency processing unit is used to send a read consistency snooping request to a processor core whose cache state of the target cache line in the first cache directory is exclusive;
[0033] When the target request is a read request, the second consistency processing unit is used to send a read consistency snooping request to the first consistency processing unit corresponding to any group of processor cores whose cache status of the target cache line in the second cache directory is exclusive, and the first consistency processing unit that receives the read consistency snooping request is used to send a read consistency snooping request to the processor core in the group whose cache status is exclusive;
[0034] The read consistency snoop request is used to change the exclusive state of any processor core on the cache line to a shared state.
[0035] Optionally, the cache state of the target cache line satisfies the request state of the target request, including: an exclusive state or at least one shared state exists in the cache state of the target cache line.
[0036] Beneficial effects:
[0037] In the multi-core processor system provided in this embodiment, each of the multiple processor cores corresponds to a first-level cache, the multiple processor cores are divided into multiple groups of processor cores, each group of processor cores corresponds to a second-level cache, and multiple groups of processor cores correspond to a third-level cache.
[0038] A first cache directory is set in any second-level cache, and the first cache directory includes the cache status of cache lines of all first-level caches of the group of processor cores in each processor core of the group; a second cache directory is set in the third-level cache, and the second cache directory includes the cache status of cache lines in all second-level caches in each group of processor cores.
[0039] The first cache directory in the second-level cache only stores the cache status of all cache lines of the first-level cache corresponding to the second-level cache. The second cache directory of the third-level cache only stores all cache lines corresponding to all the second-level caches. During the consistency process, cache consistency does not require additional processing through a separate directory to achieve cache consistency. Cache consistency can be maintained in multiple levels of cache, thereby shortening the latency of the cache consistency process. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art.
[0041] Figure 1 A schematic diagram of the architecture of a multi-core processor system provided in an embodiment of the present application is shown;
[0042] Figure 2 A schematic diagram of the structure of the first-level cache provided in an embodiment of the present application is shown;
[0043] Figure 3 A schematic diagram of the structure of the secondary cache provided by an embodiment of the present application is shown;
[0044] Figure 4 A schematic diagram of the structure of the three-level cache provided in an embodiment of the present application is shown;
[0045] Figure 5 A flow chart of searching for a target request provided by an embodiment of the present application is shown;
[0046] Figure 6 A processing flow chart of a write request provided by an embodiment of the present application is shown;
[0047] Figure 7 A processing flow chart of a write request provided by an embodiment of the present application is shown;
[0048] Figure 8 A processing flow chart of a read request provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0049] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.
[0050] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, each embodiment of the present application will be described in detail below in conjunction with the accompanying drawings. However, it will be appreciated by those skilled in the art that in each embodiment of the present application, many technical details are proposed in order to enable the reader to better understand the present application. However, even without these technical details and various changes and modifications based on the following embodiments, the technical scheme claimed in the present application can also be implemented. The division of the following embodiments is for the convenience of description, and the specific implementation of the present application should not constitute any limitation, and the various embodiments can be combined with each other and referenced to each other without contradiction.
[0051] With the rapid development of information technology, modern computing platforms are standardly configured with multi-core processor systems, which can significantly improve the processing power and response speed of computing platforms. In the architecture of multi-core processors, each processor core is equipped with an independent high-speed cache to accelerate data access, but this also introduces cache consistency issues. When different processor cores perform read and write operations on the same data in shared memory, if the consistency issue is not resolved, data inconsistency may affect the correctness of the program and the stability of the system.
[0052] Traditional cache consistency protocols, such as the MESI protocol, maintain data consistency by monitoring bus transactions, and synchronize the latest data for each core or invalidate expired data in each core through write synchronization or write invalidation. However, as the number of cores increases, the communication overhead of traditional cache consistency protocols increases dramatically, which not only consumes a lot of bandwidth, but also may cause performance bottlenecks. Especially in scenarios such as big data processing, cloud computing, and high-performance computing, massive data interaction and high-concurrency access further aggravate this problem.
[0053] In addition, a directory-based protocol can be used to maintain cache consistency. A directory is introduced into the system to track the status of each shared memory block in each cache. Specifically, all cores send requests to the directory, which queries the cache status of the cache block. If the cache status of the cache block meets the read and write requests, it can be read and written directly. If it does not meet the requirements, a listening request is sent to other cores, or a request to read and write data is sent to the memory to obtain a cache status that meets the request. The directory-based protocol implements an efficient and scalable data consistency maintenance mechanism by centrally managing the cache status of shared data. It optimizes the cache collaboration in multi-core processors and distributed systems by reducing unnecessary data transmission and status updates. It is a key component of modern high-performance computing and data center technology.
[0054] There are many ways to implement directories, such as complete directories and sparse directories. In a complete directory, directory entries are allocated to all memory addresses, and each directory entry records the cache status information of the corresponding cache block. However, since only a small number of directory entries are used during a certain period of time, most of the other directory entries are not used, resulting in a waste of resources. In order to reduce the overhead of unused directories, sparse directories are introduced. Sparse directories only maintain consistency information corresponding to data cached by private caches.
[0055] Assuming a processor with a cache size of 64KB, a block size of 32 bytes, and a main memory size of 4MB, the maximum number of entries that can be allocated in the sparse directory for the processor's cache is 2048. If the directory has entries for all blocks in memory, the number of entries in the directory will be 131072. It can be seen that the improved sparse directory format for storage provides great significance.
[0056] In the process of using the directory to maintain cache consistency, each memory access request needs to be sent to the directory first. After the directory is processed, the cache of each core is operated. The whole process takes a long time and requires additional cache space to store the directory.
[0057] Therefore, in order to shorten the latency in the cache consistency process, an embodiment of the present application provides a multi-core processor system.
[0058] Reference Figure 1 , showing an architectural schematic diagram of a multi-core processor system provided in an embodiment of the present application, the multi-core processor system includes multiple processor cores, multi-level cache and memory, the multi-level cache includes a first-level cache, a second-level cache and a third-level cache.
[0059] Each of the multiple processor cores corresponds to a first-level cache, the multiple processor cores are divided into multiple groups of processor cores, each group of processor cores corresponds to a second-level cache, and the multiple groups of processor cores correspond to a third-level cache.
[0060] In this embodiment, the first-level cache is recorded as L1 cache, the second-level cache is recorded as L2 cache, and the third-level cache is recorded as L3 cache. Each core in each group of processor cores, the first-level cache corresponding to each core, and a second-level cache are recorded as a Cluster. For example, Cluster 1 includes core 1 and its corresponding L1 cache, core 2 and its corresponding L1 cache and L2 cache.
[0061] Multi-level cache can adopt Inclusive mode, that is, there may be multiple identical copies of data at the same address, which are placed in L1 cache, L2 cache, and L3 cache respectively. The L2 cache is the lower-level cache of the L1 cache, and the L3 cache is the lower-level cache of the L2 cache. The lower-level cache contains the content of the upper-level cache. For example, the data in the L1 cache has a copy in the L2 cache, and the data in the L2 cache also has a copy in the L3 cache.
[0062] Since the data stored in the L1 cache must have a copy of the data in the L2 cache, and when the cache data of the address in the L2 cache is replaced, the corresponding copy of the data in the L1 cache must also be evicted, the cache line of the data in the L1 cache will be passively invalidated, resulting in a cache miss when accessed again. When a cache miss occurs, the efficiency of the memory access request is reduced and the latency is increased.
[0063] Therefore, in a feasible implementation, the size of any L2 cache can be the sum of the sizes of the L1 caches of all processor cores corresponding to the L2 cache; and the size of the L3 cache can be the sum of the sizes of all L2 caches.
[0064] For example, the size of the L2 cache is the sum of the L1 cache sizes corresponding to each processor core in the Cluster. Since the cache sizes in the same level of cache are generally the same, the size of any L1 cache is denoted as CL1, then the size of the L2 cache in the Cluster is CL2=N×CL1, N is the number of processor cores in the Cluster; when the system includes M Clusters, the size of the system's L3 cache is CL3=M×CL2.
[0065] Assuming that the data in the L1 cache corresponding to each processor core is exclusive, when the corresponding L2 cache is filled, and the L2 cache data in each Cluster is also exclusively occupied by the Cluster, the corresponding L3 cache is also filled, which will avoid the eviction of the upper-level cache caused by the occupation of the lower-level cache, thereby reducing the cache data miss rate.
[0066] Reference Figure 2, shows a schematic diagram of the structure of the first-level cache provided in an embodiment of the present application. The L1 cache includes an identification matrix, namely a Tag matrix and a data matrix. The Tag matrix stores cache line address information and cache line status information. The cache line status information in the L1 cache includes a dirty flag and an invalid flag of the cache line. The data matrix is used to store data corresponding to each cache line. The Tag matrix and the data matrix correspond one to one.
[0067] Reference Figure 3 , showing a schematic diagram of the structure of the secondary cache provided in an embodiment of the present application. In this embodiment, a first cache directory is set in any secondary cache. Specifically, the first cache directory is extended in the tag matrix, i.e., the Tag matrix, of any L2 cache. The first cache directory includes the cache status of cache lines of all the first-level caches of the group of processor cores in each processor core of the group.
[0068] For example, assuming that the L2 cache Cluster includes processor core 1, processor core 2, ... processor core N, if the cache state of the cache line corresponding to Tag: 0001 in processor core 1 is invalid, then the cache state corresponding to processor core 1 in the first cache directory is 00.
[0069] Reference Figure 4 , showing a schematic diagram of the structure of the third-level cache provided in an embodiment of the present application, wherein a second cache directory is provided in the third-level cache. Specifically, the second cache directory is extended in the tag matrix of the third-level cache, i.e., the Tag matrix, and the second cache directory includes the cache status of the cache lines in all the second-level caches in each group of processor cores.
[0070] Since each group of processor cores includes multiple processor cores, and the cache states of the multiple processor cores for the same cache line are different, for any cache line in the second cache directory, when any processor core in any group of processor cores has an exclusive state for the cache behavior, the cache state of the cache line in the group of processor cores is marked as an exclusive state; when no processor core in any group of processor cores has an exclusive state for the cache behavior, if any processor core in the group has a shared state for the cache behavior, the cache state of the cache line in the group of processor cores is marked as a shared state; when all processor cores in any group of processor cores are in an invalid state for the cache line, the cache state of the cache line in the group of processor cores is marked as an invalid state.
[0071] That is, the cache state of any cache line in the second cache directory in a Cluster is determined in descending order of priority of exclusive state, shared state and invalid state. For example, for any cache line, if the cache state corresponding to processor core 1 among processor cores 1-N of Cluster1 is exclusive, then the cache state of the cache line in the second cache directory in Cluster1 is exclusive; if among processor cores 1-N of Cluster1, no processor core has an exclusive state for the cache behavior, determine whether there is a processor core that has a shared state for the cache behavior. If so, the cache state of the cache line in the second cache directory in Cluster1 is shared; if not, it indicates that all processor cores in Cluster1 are in an invalid state for the cache line, and then the cache state of the cache line in the second cache directory in Cluster1 is invalid.
[0072] Based on the traditional cache design, this embodiment adds a cache status for each cache line in the Tag matrix of the L2 cache and the L3 cache, without the need to set up a separate directory to store cache status information. Therefore, when querying whether any request hits in the cache, the cache status of the cache line corresponding to the request in different processor cores can also be obtained, which simplifies the process of maintaining cache consistency and eliminates the process of querying the directory, thereby shortening the delay in the cache consistency process.
[0073] In a feasible implementation manner, the system further includes a cache controller, a plurality of first consistency processing units and a second consistency processing unit; each group of processor cores corresponds to a first consistency processing unit.
[0074] Reference Figure 5 , shows a target request search flow chart provided in an embodiment of the present application. When any processor core initiates a target request, the processor core serves as the target processor core, and the cache controller is used to respond to the target request of the target processor core and query whether there is a target cache line corresponding to the target request in the first-level cache of the target processor core, that is, query whether the first-level cache of the target processor core hits the target request.
[0075] When the cache controller finds the target cache line corresponding to the target request in the L1 cache of the target processor core, ie, an L1 cache hit, the cache controller is configured to send a status query request to a first consistency processing unit corresponding to the target processor core.
[0076] The first consistency processing unit is used to determine, in response to the status query request, the cache status of the target processor core for the target cache line in the first cache directory of the secondary cache corresponding to the target processor core; when the cache status of the target cache line satisfies the request status of the target request, the first consistency processing unit is used to return a response corresponding to the target request to the target processor core.
[0077] For example, when the target request is a read request, the L1 cache of the target processor core hits and the cache state of the target processor core in the first cache directory for the cache line corresponding to the target request is exclusive or shared, the read request can be executed directly; when the target request is a write request, the L1 cache of the target processor core hits and the cache state of the target processor core in the first cache directory for the cache line corresponding to the target request is exclusive, the write request can be executed directly.
[0078] When the cache controller does not find the target cache line corresponding to the target request in the first-level cache of the target processor core, the cache controller is used to send the target request to the first consistency processing unit; the first consistency processing unit is used to respond to the target request and query whether there is a target cache line corresponding to the target request in the second-level cache corresponding to the target processor core.
[0079] When the target cache line corresponding to the target request is queried in the secondary cache corresponding to the target processor core, and the cache status corresponding to the target cache line in the first cache directory of the secondary cache satisfies the request status of the target request, the first consistency processing unit sends a consistency monitoring request to the group of processor cores, and changes the cache status corresponding to the target cache line in the first cache directory of the secondary cache according to the monitoring responses returned by the group of processor cores respectively, and returns a response corresponding to the target request to the target processor core.
[0080] When the target cache line corresponding to the target request is not found in the secondary cache corresponding to the target processor core, or the cache status corresponding to the target cache line in the first cache directory of the secondary cache does not meet the request status of the target request, the first consistency processing unit is used to send the target request to the second consistency processing unit.
[0081] The second consistency processing unit is used to respond to the target request and query whether there is a target cache line corresponding to the target request in the third-level cache; when the target cache line corresponding to the target request is queried in the third-level cache, and the cache status corresponding to the target cache line in the second cache directory of the third-level cache satisfies the request status of the target request, the second consistency processing unit sends a consistency listening request to each group of processor cores respectively, and changes the cache status corresponding to the target cache line in the second cache directory of the third-level cache according to the listening responses returned by the group of processor cores respectively, and returns a response corresponding to the target request to the target processor core.
[0082] When the target cache line corresponding to the target request is not found in the third-level cache, or the cache status corresponding to the target cache line in the second cache directory of the third-level cache does not satisfy the request status of the target request, the second consistency processing unit is used to read the data corresponding to the target request from the memory and load it into the third-level cache, and return a response corresponding to the target request to the target processor core.
[0083] When the target request is a write request, the first consistency processing unit is used to send a write consistency snoop request to the processor core whose cache status of the target cache line in the first cache directory is exclusive or shared; the second consistency processing unit is used to send a write consistency snoop request to the first consistency processing unit corresponding to any group of processor cores whose cache status of the target cache line in the second cache directory is exclusive or shared, and the first consistency processing unit that receives the write consistency snoop request is used to send a write consistency snoop request to the processor cores in the group whose cache status is exclusive or shared; the write consistency snoop request is used to change the exclusive state or shared state of the cache line of any processor core to an invalid state.
[0084] When the target request is a read request, the first consistency processing unit is used to send a read consistency snoop request to the processor core whose cache state of the target cache line in the first cache directory is exclusive; when the target request is a read request, the second consistency processing unit is used to send a read consistency snoop request to the first consistency processing unit corresponding to any group of processor cores in the second cache directory whose cache state of the target cache line is exclusive, and the first consistency processing unit that receives the read consistency snoop request is used to send a read consistency snoop request to the processor core in the group whose cache state is exclusive; the read consistency snoop request is used to change the exclusive state of any processor core for the cache line to a shared state.
[0085] The cache state of the target cache line satisfies the request state of the target request, including: an exclusive state or at least a shared state exists in the cache state of the target cache line.
[0086] The multi-core processor system provided in this embodiment can be applicable to any cache consistency protocol, including, for example, MSI, MESI, MESIF, MOESI, CHI, CCIX, ACE and other cache consistency protocols, but this embodiment does not limit this.
[0087] For different consistency protocols, the encoding of the cache status of the cache line can be modified adaptively; for example, taking the CHI protocol as an example, the cache status of any cache line can be an invalid state I (Invalid), an exclusive state U (Unique), and the shared state includes clean sharing (Shared Clean, SC) and dirty sharing (Shared Dirty, SD). The invalid state I means that the cache line is invalid; the exclusive state U means that the cache line only exists in the current cache; clean sharing SC means that the cache line may be stored in other caches and may have been modified; dirty sharing SD means that this cache line may be stored in other caches and is inconsistent with the memory data; 2-bit encoding can be used to represent the cache status of the cache line, which are: 00 (I), 01 (SC), 10 (SD), 11 (U).
[0088] In a feasible implementation manner, the cache consistency process of the multi-core processor system provided in this embodiment is illustrated by taking 4 Clusters and 4 processor cores in each Cluster as an example.
[0089] Reference Figure 6 , shows a processing flow chart of a write request provided by an embodiment of the present application. Taking the processor core 1 in Cluster 1 initiating a write request as an example, if the cache controller queries the L1 cache and misses the target cache line of the write request, the cache controller sends the write request to the first consistency processing unit corresponding to Cluster 1. The first consistency processing unit queries the L2 cache for the target cache line corresponding to the write request, and obtains the cache status information of the target cache line in the Tag matrix of the L2 cache of Cluster 1, including: xxxx (Tag bit), 1 (dirty bit), 0 (invalid bit) and 00 (processor core 1), 01 (processor core 2), 01 (processor core 3), 10 (processor core 4).
[0090] After the first consistency processing unit obtains the cache status information of the target cache line, the cache status of the target cache line satisfies the existence of at least one shared state. In the scenario of multiple processor cores in a multi-level cache, the exclusive state and the shared state cannot coexist, that is, if the cache state of any processor core for any cache line is an exclusive state, then the cache state of other processor cores for the cache line can only be an invalid state, but not a shared state; since the cache status information of the target cache line is obtained in the Tag matrix of the L2 cache of Cluster 1, the cache states of the four processor cores in Cluster 1 for the target cache line include a shared state, such as the cache states of processor cores 2 and 3 for the target cache line are clean shared SC, and the cache state of processor core 4 for the target cache line is dirty shared SD, so there is no exclusive state for this cache line in the system.
[0091] The write request must correspond to the exclusive state. The processor core 1 in Cluster 1 needs to obtain the exclusive state of the target cache line. The first consistency processing unit sends write consistency monitoring requests to processor cores 2, 3 and 4 respectively, so that the cache status of processor cores 2, 3 and 4 for the target cache line becomes invalid. After receiving the write consistency monitoring request, processor cores 2, 3 and 4 respectively invalidate the copies of the target cache line in their corresponding first-level caches and return monitoring responses to the first consistency processing unit.
[0092] After the first consistency processing unit collects the monitoring responses sent by processor core 2, processor core 3 and processor core 4 respectively, it sends a response corresponding to the write request to processor core 1. At this time, processor core 1 obtains the exclusive state U of the target cache line; at the same time, the cache state of the target cache line in the Tag matrix of the L2 cache of Cluster 1 is changed. The cache state information of the target cache line in the Tag matrix of the changed L2 cache is xxxx (Tag bit), 1 (dirty bit), 0 (invalid bit), 11 (processor core 1), 00 (processor core 2), 00 (processor core 3), 00 (processor core 4); that is, except for the cache state of processor core 1 that executes the write request, which is in the exclusive state U, the cache states of processor core 2, processor core 3 and processor core 4 are all in the invalid state I.
[0093] Reference Figure 7, shows a processing flow chart of a write request provided by an embodiment of the present application. If the cache status information corresponding to the target cache line obtained by the first consistency processing unit in the Tag matrix of the L2 cache is: xxxx (Tag bit), 1 (dirty bit), 0 (invalid bit), 00 (processor core 1), 11 (processor core 2), 00 (processor core 3), 00 (processor core 4); the first consistency processing unit only needs to send a write consistency listening request to the exclusive processor core 2, because at this time processor core 3 and processor core 4 are already in invalid state, and there is no need to change the cache state; after the first consistency processing unit receives the processor core After receiving the snoop response from processor core 2, the processor core 1 can reply with the response corresponding to the write request, and at the same time change the cache status of the target cache line in the Tag matrix of the L2 cache of Cluster 1. The cache status information of the target cache line in the Tag matrix of the L2 cache after the change is xxxx (Tag bit), 1 (dirty bit), 0 (invalid bit), 11 (processor core 1), 00 (processor core 2), 00 (processor core 3), 00 (processor core 4); by sending consistency snoop requests only to processor cores in non-invalid states, the complexity of the data processing process can be reduced, and the latency in the cache consistency process can be further reduced.
[0094] Reference Figure 8 , shows a processing flow chart of a read request provided by an embodiment of the present application. Taking the read request initiated by the processor core 1 of Cluster1 as an example, if the cache controller queries the L1 cache and the L2 cache and fails to hit the target cache line of the read request, the first consistency processing unit corresponding to Cluster1 sends the read request to the second consistency processing unit, and the second consistency processing unit queries whether there is a target cache line corresponding to the read request in the three-level cache. After the query, the L3 cache hits the read request, and the cache status information of the target cache line corresponding to the read request in the Tag matrix of the L3 cache is obtained as xxxx (Tag bit), 1 (dirty bit), 0 (invalid bit), 00 (cluster 1), 11 (cluster 2), 00 (cluster 3), 00 (cluster4).
[0095] From the cache status of the target cache line, it can be learned that except for Cluster 2, the cache status of Cluster 1, Cluster 3 and Cluster 4 for the target cache line is invalid, which further indicates that the cache status of each processor core of Cluster 1, Cluster 3 and Cluster 4 for the target cache line is invalid.
[0096] The second consistency processing unit only needs to send the read consistency listening request to the first consistency processing unit corresponding to Cluster 2. After receiving the read consistency listening request, the first consistency processing unit corresponding to Cluster 2 queries the cache status information of the target cache line in the Tag matrix of the L2 cache of Cluster 2: xxxx (Tag bit), 1 (dirty bit), 0 (invalid bit), 11 (processor core 1), 00 (processor core 2), 00 (processor core 3), 00 (processor core 4), that is, in Cluster 2, except that the cache status of processor core 1 for the target cache line is exclusive, the cache status of processor core 2, processor core 3 and processor core 4 for the target cache line are all invalid. Therefore, the first consistency processing unit only sends a read consistency listening request to processor core 1 whose cache status in Cluster 2 is exclusive, so as to change the cache status of processor core 1 of Cluster 2 for the target cache line from exclusive to shared.
[0097] After the first consistency processing unit receives the snoop response returned by the processor core 1 of Cluster2, the snoop response is sent to the second consistency processing unit, and the first consistency processing unit changes the cache status of the target cache line in the L2 cache of Cluster2. The cache status information of the target cache line in the Tag matrix of the changed L2 cache is xxxx (Tag bit), 0 (dirty bit), 1 (invalid bit), 10 (processor core 1), 00 (processor core 2), 00 (processor core 3), 00 (processor core 4).
[0098] The second consistency processing unit sends the snoop response returned by the processor core 1 of Cluster2 to the first consistency processing unit corresponding to Cluster1. At the same time, the second consistency processing unit changes the cache status information of the target cache line in the L3 cache to: xxxx (Tag bit), 1 (dirty bit), 0 (invalid bit), 01 (cluster 1), 10 (cluster 2), 00 (cluster 3), 00 (cluster 4).
[0099] The first consistency processing unit corresponding to Cluster 1 returns a response corresponding to the read request to the processor core 1 of Cluster 1; and changes the cache state of the target cache line in the L2 cache of Cluster 1 to 01. That is, when the processor core 1 of Cluster 1 makes a read request, it only needs to change the cache state of the target cache line to a shared state.
[0100] In the multi-core processor system provided in this embodiment, the shared cache and sparse directory in the multi-level cache are merged, that is, the cache status of the cache line is expanded in the identification matrix of the shared cache L2 cache and L3 cache, that is, the Tag matrix, so that there is no need to set up a separate directory to store cache status information, which can not only reduce the cache resources occupied by a separate directory, but also when querying whether any request hits in the cache, the cache status of the cache line corresponding to the request in different processor cores can be obtained, which simplifies the process of maintaining cache consistency and eliminates the process of querying the directory, thereby shortening the delay in the cache consistency process.
[0101] In addition, the multi-core processor system provided in this embodiment can apply various cache consistency protocols and has strong adaptability. In the actual implementation process, the processor cores in the system can also be expanded, the number of processor cores is not limited, and the number of Cluster groups corresponding to the processor cores is also not limited, which has strong scalability.
[0102] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0103] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, devices, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0104] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0105] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0106] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0107] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present application.
[0108] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0109] Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for those skilled in the art, according to the idea of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A multi-core processor system, characterized in that: The multi-core processor system includes multiple processor cores, multi-level cache and memory, and the multi-level cache includes a first-level cache, a second-level cache and a third-level cache; Each of the multiple processor cores has a corresponding first-level cache; The multiple processor cores are divided into multiple groups of processor cores, each group of processor cores corresponds to a secondary cache, and a first cache directory is set in any secondary cache, and the first cache directory includes cache states of cache lines of all the primary caches of the group of processor cores in each processor core of the group; The multiple groups of processor cores correspond to a third-level cache, the third-level cache is provided with a second cache directory, and the second cache directory includes cache states of cache lines in all the second-level caches in each group of processor cores; The cache state is used to characterize the usage of the cache line by any processor core, and the cache state includes an exclusive state, a shared state, and an invalid state.
2. The system according to claim 1, characterized in that The first cache directory of any secondary cache is set in the tag matrix of the secondary cache; The second cache directory of the third-level cache is set in the tag matrix of the third-level cache; For any cache line in the second cache directory, when any processor core in any group of processor cores has an exclusive state for the cache line, the cache state of the cache line in the group of processor cores is marked as an exclusive state; When no processor core in any group of processor cores has an exclusive state for the cache behavior, if any processor core in the group has a shared state for the cache behavior, the cache state of the cache line in the group of processor cores is marked as a shared state; When all processor cores in any group of processor cores are in an invalid state for the cache line, the cache state of the cache line in the group of processor cores is marked as an invalid state.
3. The system according to claim 1, characterized in that The size of any L2 cache is the sum of the sizes of the L1 caches of all processor cores corresponding to the L2 cache; The size of the L3 cache is the sum of the sizes of all L2 caches.
4. The system according to claim 1, characterized in that The system further comprises a cache controller and a plurality of first consistency processing units, each group of processor cores corresponding to a first consistency processing unit; The cache controller is used to query whether there is a target cache line corresponding to the target request in the first-level cache of the target processor core in response to the target request of the target processor core; When the cache controller finds the target cache line corresponding to the target request in the first-level cache of the target processor core, the cache controller is used to send a status query request to the first consistency processing unit corresponding to the target processor core; The first consistency processing unit is used to determine, in response to the status query request, a cache status of the target processor core for the target cache line in a first cache directory of the secondary cache corresponding to the target processor core; When the cache state of the target cache line satisfies the request state of the target request, the first consistency processing unit is used to return a response corresponding to the target request to the target processor core.
5. The system according to claim 4, characterized in that When the cache controller does not find a target cache line corresponding to the target request in the first-level cache of the target processor core, the cache controller is configured to send the target request to the first consistency processing unit; The first consistency processing unit is used for querying whether there is a target cache line corresponding to the target request in the secondary cache corresponding to the target processor core in response to the target request; When the target cache line corresponding to the target request is queried in the secondary cache corresponding to the target processor core, and the cache status corresponding to the target cache line in the first cache directory of the secondary cache satisfies the request status of the target request, the first consistency processing unit sends a consistency monitoring request to the group of processor cores, and changes the cache status corresponding to the target cache line in the first cache directory of the secondary cache according to the monitoring responses returned by the group of processor cores respectively, and returns a response corresponding to the target request to the target processor core.
6. The system according to claim 5, characterized in that The system also includes a second consistency processing unit; When the target cache line corresponding to the target request is not found in the secondary cache corresponding to the target processor core, or the cache state corresponding to the target cache line in the first cache directory of the secondary cache does not satisfy the request state of the target request, the first consistency processing unit is used to send the target request to the second consistency processing unit; The second consistency processing unit is used for querying whether there is a target cache line corresponding to the target request in the third-level cache in response to the target request; When the target cache line corresponding to the target request is queried in the third-level cache, and the cache status corresponding to the target cache line in the second cache directory of the third-level cache satisfies the request status of the target request, the second consistency processing unit sends consistency monitoring requests to each group of processor cores respectively, and changes the cache status corresponding to the target cache line in the second cache directory of the third-level cache according to the monitoring responses returned by the group of processor cores respectively, and returns the response corresponding to the target request to the target processor core.
7. The system according to claim 6, characterized in that When the target cache line corresponding to the target request is not found in the third-level cache, or the cache status corresponding to the target cache line in the second cache directory of the third-level cache does not satisfy the request status of the target request, the second consistency processing unit is used to read the data corresponding to the target request from the memory and load it into the third-level cache, and return a response corresponding to the target request to the target processor core.
8. The system according to claim 6, characterized in that When the target request is a write request, the first consistency processing unit is used to send a write consistency snoop request to a processor core whose cache state of the target cache line in the first cache directory is exclusive or shared; When the target request is a write request, the second consistency processing unit is used to send a write consistency snooping request to the first consistency processing unit corresponding to any group of processor cores whose cache status of the target cache line in the second cache directory is exclusive or shared, and the first consistency processing unit that receives the write consistency snooping request is used to send a write consistency snooping request to the processor core in the group whose cache status is exclusive or shared; The write consistency snoop request is used to change the exclusive state or shared state of a cache line by any processor core to an invalid state.
9. The system according to claim 6, characterized in that When the target request is a read request, the first consistency processing unit is used to send a read consistency snooping request to a processor core whose cache state of the target cache line in the first cache directory is exclusive; When the target request is a read request, the second consistency processing unit is used to send a read consistency snooping request to the first consistency processing unit corresponding to any group of processor cores whose cache status of the target cache line in the second cache directory is exclusive, and the first consistency processing unit that receives the read consistency snooping request is used to send a read consistency snooping request to the processor core in the group whose cache status is exclusive; The read consistency snoop request is used to change the exclusive state of any processor core on the cache line to a shared state.
10. The system according to claim 6, characterized in that The cache state of the target cache line satisfies the request state of the target request, including: an exclusive state or at least a shared state exists in the cache state of the target cache line.
Citation Information
Cited By
Data processing system, method, product, equipment and storage medium
CN119473664A
Multi-core network-on-chip transaction processing system, method, device, medium and product
CN119544643A
Message processing method and device based on network-on-chip, medium and product
CN119557264A
Cache data reading method and device, computer equipment and storage medium
CN119759807A
Cache data reading method, device, computer equipment and storage medium
CN119759807B
