Processor, instruction execution method, electronic device, storage medium, and computer program product
By employing a shared private cache area structure of clusters and cache units in a synchronous multithreaded processor, and combining a thread history table and a Bloom filter to dynamically adjust the cache area configuration, the problem of improper cache resource allocation is solved, thereby improving the processor's performance and stability.
Patent Information
- Application Number
- CN202611336890.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-31
- Publication Date
- 2026-11-27
AI Technical Summary
In synchronous multithreaded processors, the reasonable allocation of cache resources among multiple logical processors is difficult to adapt to the memory access needs of different threads, resulting in wasted or insufficient cache space, affecting processor performance, and the adjustment of cache configuration during thread switching causes performance fluctuations.
It adopts a multi-cluster and cache unit structure, with cache units divided into shared and private cache areas. The cache space configuration is dynamically adjusted through a thread history table and a Bloom filter, and cache resource allocation is optimized by combining branch prediction and data prefetching.
It achieves efficient allocation of cache resources, reduces resource contention between threads, improves the overall performance of the processor, and quickly restores the appropriate cache configuration when switching threads, reducing performance fluctuations.
Smart Images

Figure CN123178299A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing, and more particularly to a processor, instruction execution method, electronic device, storage medium, and computer program product. Background Technology
[0002] Simultaneous Multi-Threading (SMT) is a multi-threading technique that allows multiple instructions to be issued by multiple threads within a single clock cycle. In processors employing SMT, two logical processors are typically configured within a single physical processor core by replicating the architectural state. These two logical processors share hardware resources such as execution units and caches, but independently track the execution status of their respective threads. This leverages the horizontal and vertical waste generated during single-threaded execution to improve processor resource utilization.
[0003] However, while synchronous multithreading (SMM) technology improves resource utilization, it also introduces new problems. When SMM is enabled, the processor core's internal storage units, such as cache, are divided into several regions for shared use by two logical processors. During operation, these two logical processors will compete for resources. On one hand, when two logical processors run memory-intensive threads simultaneously, cache space is mutually encroached upon, leading to frequent cache replacements and a decrease in the memory access performance of a single logical processor. On the other hand, different threads exhibit significantly different memory access behaviors; for example, different threads have different active instruction sets and active data sets. A fixed cache space allocation method is difficult to adapt to the memory access needs of multiple threads simultaneously, easily resulting in wasted or insufficient cache space, thus affecting the overall performance of the processor.
[0004] Furthermore, threads running in a processor are dynamically scheduled. A thread may be swapped out during execution due to time slice exhaustion, waiting for events, or other reasons, and then rescheduled for execution. In existing technologies, cache space configuration parameters adapted to a particular thread are adjusted during thread execution but not associated with that thread and are lost when the thread is swapped out. When the thread is rescheduled, the processor needs to undergo a reconfiguration process to restore the cache space configuration adapted to the thread's memory access requirements. During this reconfiguration period, the cache hit rate is low, and memory access performance cannot be restored in a timely manner, causing fluctuations in processor performance.
[0005] Therefore, in synchronous multithreaded processors, how to reasonably allocate cache resources among multiple logical processors to adapt to the memory access needs of different threads, and how to quickly restore the cache space configuration adapted to the thread when the thread reappears, has become an urgent problem to be solved. Summary of the Invention
[0006] This application provides a processor, an instruction execution method, an electronic device, a storage medium, and a computer program product.
[0007] This application provides a processor, characterized in that the processor includes multiple clusters and a third cache unit, the multiple clusters being electrically connected to the third cache unit respectively; each cluster includes multiple processor cores and a second cache unit, the multiple processor cores being electrically connected to the second cache unit respectively; each processor core includes two architecture command centers, two instruction fetch units corresponding to the two architecture command centers, a decoding unit, two micro-operation queues corresponding to the two instruction fetch units, an execution unit, and a first cache unit, the architecture command centers being electrically connected to the corresponding instruction fetch units, the two instruction fetch units being electrically connected to the decoding units respectively, the decoding units being electrically connected to the two micro-operation queues respectively, the two micro-operation queues being electrically connected to the execution units respectively, and the first cache unit being electrically connected to the two instruction fetch units and the execution unit respectively; The first cache unit includes an instruction cache area and a data cache area. The instruction cache area is divided into an instruction shared cache area and two instruction private cache areas corresponding one-to-one with the two architecture command centers. The data cache area is divided into a data shared cache area and two data private cache areas corresponding one-to-one with the two architecture command centers. The instruction fetching unit is used to obtain the current thread identifier and the current instruction address from the corresponding architecture command center; to obtain the current instruction data from the corresponding instruction private cache or instruction shared cache through memory access behavior based on the current instruction address; to use the combination of the current thread identifier and the current instruction address as an index to match the corresponding configuration data from the thread history table; and to send the cache allocation parameters in the configuration data to the first cache unit for configuration. The thread history table includes multiple indexes and configuration parameters corresponding to the indexes. The configuration parameters include at least cache allocation parameters, which at least indicate the space configuration of each cache area in the first cache unit. The decoding unit is used to alternately fetch instruction data from the two instruction fetch units to obtain the current instruction data; decode the current instruction data, and store the decoded current micro-operation into the micro-operation queue corresponding to the current thread; The execution unit is used to alternately obtain micro-operations from the two micro-operation queues to obtain the current micro-operation; obtain the current data to be processed from the corresponding data private cache or data shared cache through memory access behavior according to the current micro-operation; and execute the current micro-operation according to the current data to be processed.
[0008] The first cache unit is used to adjust the space configuration of each cache area in the first cache unit according to the memory access behavior of the instruction cache area and the data cache area during the current thread execution; and to update the corresponding configuration parameters in the thread history table of the instruction fetch unit according to the adjusted space configuration.
[0009] The processor core further includes a Bloom filter, and the first cache unit is electrically connected to the two instruction fetch units and the execution unit through the Bloom filter. The Bloom filter is used to receive the memory access index carried by the instruction fetch request initiated by the instruction fetch unit for the instruction cache and the memory access index carried by the data access request initiated by the execution unit for the data cache; when it is determined that the memory access index does not match the memory access index recorded in the Bloom filter, the memory access index is recorded and the target size value corresponding to the current thread is incremented, the target size value is used to characterize the private cache space required by the memory access behavior of the current thread; the target size value and the memory access index recorded in the Bloom filter are cleared at each first preset time interval; The first cache unit is used to determine that the target size value is greater than or equal to the sum of the corresponding private cache space of the current thread and the preset adjustment size, and to expand the private cache space according to the preset adjustment size; and to determine that the private cache space of the current thread is greater than or equal to the sum of the corresponding target size value and the preset adjustment size, and to shrink the private cache space according to the preset adjustment size.
[0010] The first cache unit is used to determine that the historical private cache space in the cache allocation parameters is less than the current private cache space, and to reduce the current thread's private cache space proportionally based on the difference between the two; and to determine that the historical private cache space is greater than the current private cache space, and to increase the current thread's private cache space proportionally based on the difference between the two.
[0011] The second cache unit includes a second shared cache area and two second private cache areas corresponding one-to-one with the two architecture command centers; the third cache unit includes a third shared cache area and two third private cache areas corresponding one-to-one with the two architecture command centers. The second cache unit is used to adjust the space configuration of each cache area in the second cache unit according to the memory access behavior of the current thread during the execution of the second cache unit; and to update the corresponding configuration parameters in the instruction fetching unit thread history table according to the adjusted space configuration. The third cache unit is used to adjust the space configuration of each cache area in the third cache unit according to the memory access behavior of the current thread during the execution of the third cache unit; and to update the corresponding configuration parameters in the instruction fetch unit thread history table according to the adjusted space configuration.
[0012] The instruction fetching unit includes a branch prediction unit; The branch prediction unit is used to predict the execution direction of branch instructions in the instruction stream of the current thread and generate the predicted next instruction address. The next instruction address instructs the instruction fetch unit to obtain the corresponding instruction data. The instruction fetching unit is used to send the branch prediction configuration parameters in the configuration data to the branch prediction unit for configuration after matching the corresponding configuration data from the thread history table according to the index, so that the branch prediction unit can make predictions according to the configured parameters. The configuration parameters also include the branch prediction configuration parameters, which at least indicate the table entry configuration of the prediction table in the branch prediction unit. The branch prediction unit is used to record the prediction accuracy data, and at every second preset time interval, the table item configuration of the prediction table in the branch prediction unit is adjusted according to the accuracy data.
[0013] The processor core further includes a data prefetching unit, and the execution unit is electrically connected to the first cache unit through the data prefetching unit. The data prefetching unit is used to initiate a data prefetching request to the first cache unit based on the memory access behavior of the current thread during its operation, and to prefetch the data that the current thread is expected to access into the data cache area. The fetching unit is used to send the data prefetching configuration parameters in the configuration data to the data prefetching unit for configuration after matching the corresponding configuration data from the thread history table according to the index, so that the data prefetching unit performs data prefetching according to the configured parameters. The configuration parameters also include data prefetching configuration parameters, which at least indicate the prefetching strategy and prefetching degree used for data prefetching. The data prefetching unit is used to record the accuracy data of data prefetching. Every third preset time interval, the prefetching strategy and prefetching degree used by the data prefetching unit are adjusted according to the accuracy data.
[0014] The decoding unit is used to determine that the current instruction data carries a low-power flag and send a switching instruction to the first cache unit. The first cache unit is configured to, in response to the switching instruction, set the size of both instruction private cache areas and the two data private cache areas to zero, so that the space of the two instruction private cache areas is converted into the space of the instruction shared cache area, and the space of the two data private cache areas is converted into the space of the data shared cache area.
[0015] Another aspect of this application provides an instruction execution method applied to a processor, characterized in that the processor includes multiple clusters and a third cache unit; the clusters include multiple processor cores and a second cache unit; the processor cores include two architecture command centers, two instruction fetch units corresponding to the two architecture command centers, a decoding unit, two micro-operation queues corresponding to the two instruction fetch units, an execution unit, and a first cache unit; the first cache unit includes an instruction cache area and a data cache area, the instruction cache area is divided into a shared instruction cache area and two private instruction cache areas corresponding to the two architecture command centers, and the data cache area is divided into a shared data cache area and two private data cache areas corresponding to the two architecture command centers; the method includes: The instruction fetching unit obtains the current thread identifier and the current instruction address from the corresponding architecture command center; based on the current instruction address, it retrieves the current instruction data from the corresponding instruction private cache or instruction shared cache through memory access behavior; it uses the combination of the current thread identifier and the current instruction address as an index to match the corresponding configuration data from the thread history table, and sends the cache allocation parameters in the configuration data to the first cache unit for configuration. The thread history table includes multiple indexes and configuration parameters corresponding to the indexes. The configuration parameters include at least cache allocation parameters, which at least indicate the space configuration of each cache area in the first cache unit. The decoding unit alternately fetches instruction data from the two instruction fetching units to obtain the current instruction data; it decodes the current instruction data and stores the decoded current micro-operation into the micro-operation queue corresponding to the current thread. The execution unit alternately retrieves micro-operations from the two micro-operation queues to obtain the current micro-operation; based on the current micro-operation, it retrieves the current data to be processed from the corresponding data private cache or data shared cache through memory access behavior; and executes the current micro-operation based on the current data to be processed.
[0016] The method further includes: The first cache unit adjusts the space configuration of each cache area in the first cache unit according to the memory access behavior of the instruction cache area and the data cache area during the current thread execution; and updates the corresponding configuration parameters in the instruction fetch unit thread history table according to the adjusted space configuration.
[0017] The processor core further includes a Bloom filter; adjusting the space configuration of each cache area in the first cache unit based on the memory access behavior of the instruction cache and the data cache during the current thread execution includes: The Bloom filter receives the memory access index carried by the instruction fetch request initiated by the instruction fetch unit for the instruction cache and the memory access index carried by the data access request initiated by the execution unit for the data cache; when it is determined that the memory access index does not match the memory access index already recorded in the Bloom filter, the memory access index is recorded and the target size value corresponding to the current thread is incremented, the target size value is used to characterize the private cache space required by the memory access behavior of the current thread; the target size value and the memory access index already recorded in the Bloom filter are cleared at each first preset time interval; The first cache unit determines that the target size value is greater than or equal to the sum of the corresponding private cache space of the current thread and the preset adjustment size, and expands the private cache space according to the preset adjustment size; determines that the private cache space of the current thread is greater than or equal to the sum of the corresponding target size value and the preset adjustment size, and shrinks the private cache space according to the preset adjustment size.
[0018] The method further includes: The first cache unit determines that the historical private cache space in the cache allocation parameters is less than the current private cache space, and proportionally reduces the current thread's private cache space based on the difference between the two; it also determines that the historical private cache space is greater than the current private cache space, and proportionally expands the current thread's private cache space based on the difference between the two.
[0019] The second cache unit includes a second shared cache area and two second private cache areas corresponding one-to-one with the two architecture command centers; the third cache unit includes a third shared cache area and two third private cache areas corresponding one-to-one with the two architecture command centers; the method further includes: The second cache unit adjusts the space configuration of each cache area in the second cache unit according to the memory access behavior of the current thread during the execution of the second cache unit; and updates the corresponding configuration parameters in the instruction fetching unit thread history table according to the adjusted space configuration. The third cache unit adjusts the space configuration of each cache area in the third cache unit according to the memory access behavior of the current thread during the execution of the third cache unit; and updates the corresponding configuration parameters in the thread history table of the instruction fetch unit according to the adjusted space configuration.
[0020] The instruction fetching unit includes a branch prediction unit; the method further includes: The branch prediction unit predicts the execution direction of branch instructions in the instruction stream of the current thread, generates the predicted next instruction address, and the next instruction address instructs the instruction fetch unit to obtain the corresponding instruction data; records the prediction accuracy data, and adjusts the table entry configuration of the prediction table in the branch prediction unit according to the accuracy data every second preset time interval; Accordingly, after the fetching unit obtains the corresponding configuration data from the thread history table according to the index, it sends the branch prediction configuration parameters in the configuration data to the branch prediction unit for configuration, so that the branch prediction unit makes predictions according to the configured parameters. The configuration parameters also include the branch prediction configuration parameters, which at least indicate the table entry configuration of the prediction table in the branch prediction unit.
[0021] The processor core further includes a data prefetching unit; the method further includes: The data prefetching unit initiates a data prefetching request to the first cache unit based on the memory access behavior of the current thread during its operation, and prefetches the data that the current thread is expected to access into the data cache area in advance; records the accuracy data of data prefetching, and adjusts the prefetching strategy and prefetching degree adopted by the data prefetching unit for data prefetching based on the accuracy data every third preset time interval; After the fetching unit obtains the corresponding configuration data from the thread history table according to the index, it sends the data prefetching configuration parameters in the configuration data to the data prefetching unit for configuration, so that the data prefetching unit performs data prefetching according to the configured parameters. The configuration parameters also include data prefetching configuration parameters, which at least indicate the prefetching strategy and prefetching degree used for data prefetching.
[0022] The method further includes: The decoding unit determines that the current instruction data carries a low-power flag and sends a switching instruction to the first cache unit; In response to the switching instruction, the first cache unit sets the size of both instruction private caches and the two data private caches to zero, so that the space of the two instruction private caches is converted into the space of the instruction shared cache, and the space of the two data private caches is converted into the space of the data shared cache.
[0023] Another aspect of this application provides an electronic device, the electronic device including a processor, the processor being capable of executing the instruction execution method.
[0024] Another embodiment of this application provides a computer-readable storage medium storing a computer program for executing the instruction execution method described above.
[0025] Another aspect of this application provides a computer program product, including a computer program or instructions, which, when executed by a processor, implements the instruction execution method provided in this application.
[0026] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this application, nor is it intended to limit the scope of this application. Other features of this application will become readily apparent from the following description. Attached Figure Description
[0027] The above and other objects, features, and advantages of exemplary embodiments of this application will become readily apparent from the following detailed description taken in conjunction with the accompanying drawings. Several embodiments of this application are illustrated in the drawings by way of example and not limitation, in which: In the accompanying drawings, the same or corresponding reference numerals indicate the same or corresponding parts.
[0028] Figure 1 A schematic diagram of the structure of a processor according to an embodiment of this application is shown; Figure 2 A schematic diagram of the structure of a processor core according to an embodiment of this application is shown; Figure 3 A schematic diagram of the first cache unit partitioning according to an embodiment of this application is shown; Figure 4 A schematic diagram of the structure of a processor according to another embodiment of this application is shown; Figure 5 A schematic diagram of the structure of a processor according to another embodiment of this application is shown; Figure 6 A schematic diagram of the structure of a processor according to another embodiment of this application is shown; Figure 7A schematic diagram of the composition structure of an electronic device according to an embodiment of this application is shown. Detailed Implementation
[0029] To make the objectives, features, and advantages of this application more apparent and understandable, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0030] To reduce the performance degradation caused by shared internal resources such as cache among multiple threads after enabling synchronous multithreading, and to enable the processor to quickly restore the running state adapted to the current thread based on the thread's historical execution information, one embodiment of this application provides a processor, such as... Figure 1 As shown, the processor 100 includes: Multiple clusters 101 and a third cache unit 102 are provided, with the multiple clusters 101 electrically connected to the third cache unit 102 respectively; each cluster 101 includes multiple processor cores 103 and a second cache unit 104, with the multiple processor cores 103 electrically connected to the second cache unit 104 respectively.
[0031] like Figure 2 As shown, the processor core 103 includes two architecture command centers 105, two instruction fetch units 106 corresponding to the two architecture command centers 105, a decoding unit 107, two micro-operation queues 108 corresponding to the two instruction fetch units 106, an execution unit 109, and a first cache unit 110. The architecture command centers 105 are electrically connected to the corresponding instruction fetch units 106. The two instruction fetch units 106 are electrically connected to the decoding units 107. The decoding units 107 are electrically connected to the two micro-operation queues 108. The two micro-operation queues 108 are electrically connected to the execution unit 109. The first cache unit 110 is electrically connected to the two instruction fetch units 106 and the execution unit 109.
[0032] The processor 100 can be a Simultaneous Multi-Threading (SMT) processor or any other processor with multi-threading capabilities. SMT allows multiple instructions to be issued and executed by multiple threads within a single clock cycle. The processor 100 may include multiple clusters 101, each cluster 101 including multiple processor cores 103, and the clusters 101 are interconnected via a third cache unit 102. The third cache unit 102 may also be electrically connected to main memory, which may be Double Data Rate Synchronous Dynamic Random Access Memory (DDR).
[0033] For example, the third cache unit 102 can be the last level cache (LLC). The two processor cores 103 can be interconnected with the shared second cache unit 104 based on a coherence protocol (such as the ACE protocol, a cache coherence protocol) to realize data and instruction communication between the two processor cores 103. The two processor cores 103 and a second cache unit 104 together form a cluster 101. The cluster 101 can be interconnected with the shared third cache unit 102 through a coherence protocol (such as the CHI protocol, a cache coherence protocol). The third cache unit 102 is interconnected with the main memory DDR.
[0034] Processor core 103 is the physical execution core in processor 100. For the implementation of synchronous multithreading, two architectural command centers 105 are set up within processor core 103. By sharing, copying, and partitioning existing execution resources, a single physical processor core 103 is split into two logical processors, allowing processor 100 to exhibit more core capabilities at the operating system level. Each logical processor independently responds to interrupts and tracks its own software threads. When allocating thread tasks, the operating system can independently assign thread tasks to the two logical processors. The execution unit of each processor core 103 takes turns reading and executing the program instructions of the subtasks in the corresponding two logical processors. For example, it executes the first instruction of thread A in the first logical processor first, then the first instruction of thread B in the second logical processor, and so on, with the remaining instructions executed in the same manner.
[0035] The Architectural State (AS) 105 is used to maintain the architectural state corresponding to the logical processors. The AS can be represented in hardware as two independent register files, renaming tables, program counters (PCs), and interrupt / flag registers. Each logical processor maintains a complete architectural state, including hardware context resources (PC, general-purpose registers, control registers, Advanced Programmable Interrupt Controller (APIC) registers, and some machine status registers). Each thread maintains an independent pipeline flushing mechanism, a retirement mechanism after instruction execution, and precise interrupt and subroutine return mechanisms. Resources in processor core 103 are allocated to the two logical processors using a replication, sharing, and partitioning method. Replicated resources refer to the architectural state maintained for each logical processor, requiring each logical processor to maintain an independent complete structure. Shared resources refer to resources that are competed for equally between the logical processors. Partitioned resources mean that when the logical processors are in multitasking mode, these resources are equally distributed between the two logical processors; when in single-tasking mode, these resources are exclusively used by one logical processor.
[0036] The first cache unit 110 includes an instruction cache area and a data cache area. The instruction cache area is divided into an instruction shared cache area and two instruction private cache areas corresponding one-to-one with the two architecture command centers 105. The data cache area is divided into a data shared cache area and two data private cache areas corresponding one-to-one with the two architecture command centers 105.
[0037] like Figure 3As shown, the first cache unit 110 is a private L1 cache for processor core 103, including an instruction cache and a data cache. The instruction cache can be a Level 1 Instruction Cache (L1 I-Cache) for storing instruction data. The data cache can be a Level 1 Data Cache (L1 D-Cache) for storing data to be processed. The instruction cache and data cache can share a cache space. Depending on usage, both the instruction cache and data cache are divided into three regions: one shared cache and two private caches. The two private caches are used by two separate logical processors, while the shared cache can be used by both logical processors. In the instruction cache, two sets of instruction pointers can independently track the instructions of the two executing threads. If two logical processors access the first cache unit 110 simultaneously, access is granted to one logical processor in alternating clock cycles, and then to the other. If one logical processor is disabled or unable to use the first cache unit 110, the other logical processor can use the full bandwidth of the first cache unit 110 in each cycle. The private cache setting ensures that during replacement, each logical processor only performs replacement and filling operations on the data within its own private cache. This prevents a single logical processor from occupying a large amount of storage space, which could severely limit the performance of another logical processor. The storage space adjustment of the first cache unit 110 is done on a way-by-way basis. It does not require operations on the contents of the cache. It only requires setting the cache space range at the cache control level and invalidating the newly modified way, waiting for new data to be filled in and naturally modifying the cache.
[0038] The instruction fetching unit 106 is used to obtain the current thread identifier and the current instruction address from the corresponding architecture command center 105; obtain the current instruction data from the corresponding instruction private cache or instruction shared cache through memory access behavior according to the current instruction address; use the combination of the current thread identifier and the current instruction address as an index to match the corresponding configuration data from the thread history table, and send the cache allocation parameters in the configuration data to the first cache unit 110 for configuration. The thread history table includes multiple indexes and configuration parameters corresponding to the indexes. The configuration parameters include at least cache allocation parameters, which at least indicate the space configuration of each cache area in the first cache unit 110.
[0039] The Instruction Fetch Unit (IFU) 106 is used to fetch instructions for the corresponding logical processor's thread instructions. The IFU interacts with the Instruction Translation Lookaside Buffer (ITLB) in the memory management unit to perform virtual-to-physical address translation of the instruction. Two IFUs 106 are replicated in each processor core 103 to independently fetch instructions for the threads in the two logical processors. During this stage, the two logical processors can execute simultaneously, and the fetched instruction data is placed in the corresponding stream buffer. The current instruction address obtained by the IFU 106 can be the instruction address output by the program counter or the next instruction address predicted by the branch prediction unit.
[0040] The current thread identifier is used to identify the currently executing thread. The current thread identifier can be an address space identifier (ASID), which is a number of bits in the page table base address register (SATP, Supervisor Address Translation and Protection register). The instruction fetch unit 106 obtains the address space identifier from the system register of the corresponding architecture command center 105 and uses it as the hardware thread identifier information.
[0041] A thread history table is set up in the instruction fetch unit 106 to record the historical execution configuration information of threads. The thread history table includes multiple indexes and corresponding configuration parameters. The index is a combination of the current thread identifier and the current instruction address. The configuration parameters include at least cache allocation parameters, and may also include branch prediction configuration parameters and data prefetch configuration parameters. The instruction fetch unit 106 sets up a table to record the currently running thread identifier. The obtained current thread identifier is compared with this table. If a matching entry exists, it means that the current instruction is not the first instruction of the current thread; otherwise, it means that the current instruction is the first instruction executed by the current thread. When the instruction fetch unit 106 receives an instruction that is the first instruction of a thread, after waiting for the first cache unit 110 to return the instruction data, it combines the current thread identifier and the current instruction address as an index to search for a corresponding entry in the thread history table. If found, it means that this combination has recently appeared. The configuration data recorded therein can be retrieved and quickly restored. The corresponding information is sent to each level of cache unit, branch prediction unit, and data prefetch unit. If not found, it is recorded as a new entry and recorded according to the subsequent configuration parameter adjustments for later use.
[0042] The cache allocation parameters are used to indicate the space configuration of each cache area in the first cache unit 110. The cache allocation parameters can indicate the size of the instruction-private cache area and data-private cache area of the current thread, or the size of the instruction-shared cache area and data-shared cache area, and can also indicate the space configuration of each cache area in the second cache unit 104 and the third cache unit 102. The instruction fetch unit 106 sends the cache allocation parameters from the configuration data to the first cache unit 110 for configuration, so that the first cache unit 110 sets the space size of each cache area according to the cache allocation parameters.
[0043] The decoding unit 107 is used to alternately fetch instruction data from the two instruction fetch units 106 to obtain the current instruction data; decode the current instruction data, and store the decoded current micro-operation into the micro-operation queue 108 corresponding to the current thread.
[0044] Decoding unit 107 is used to decode instruction data. Decoding unit 107 (IDU, Instruction DecodeUnit) alternately fetches instruction data from the stream buffers corresponding to the two instruction fetch units 106 for decoding, so that the two logic processors can share the same decoder logic, avoiding thread starvation. Decoding unit 107 maintains separate state information for the two threads, and the remaining execution resources are reused without distinction.
[0045] Micro-operation queue 108 is used to temporarily store the micro-operations obtained from decoding. The two micro-operation queues 108 are actually two areas divided from the micro-operation queues, each corresponding one-to-one with the two instruction fetch units, used to store micro-operations. Micro-operations ( Micro-operations (ops) are internal execution operations generated by the decoding unit 107 after decoding the instruction data. Regardless of which logical processor a micro-operation belongs to, the micro-operation queue 108 will select the micro-operation. This module essentially ignores the distinction between logical processors; micro-operations are evaluated only based on the availability of relevant inputs and execution resources. However, the micro-operation queue 108 allocates resources to prevent any single thread from occupying the majority of the capacity. The micro-operation queue 108 is located between the decoding unit 107 and the execution unit 109 and can be divided into two parts corresponding to the two logical processors, with one micro-operation queue 108 for each logical processor.
[0046] The execution unit 109 is used to alternately obtain micro-operations from the two micro-operation queues 108 to obtain the current micro-operation; obtain the current data to be processed from the corresponding data private cache or data shared cache through memory access behavior according to the current micro-operation; and execute the current micro-operation according to the current data to be processed.
[0047] The execution unit 109 is used to perform micro-operations. The execution unit 109 (EXU, Execute Unit) alternately retrieves micro-operations from two micro-operation queues 108, restores the program order of instructions after out-of-order execution, and arranges the states of these instructions in program order. The two logical processors alternately execute instruction retirement operations. Specifically, the retirement logic is divided into two parts to track when micro-operations from the two logical processors are ready to retire. It then retires micro-operations for each logical processor in program order by alternating between the two logical processors; that is, the retirement logic retires micro-operations from the first logical processor first, and then retires micro-operations from the second logical processor, alternating between the two. If a logical processor is not ready to retire any micro-operations, all retirement bandwidth is dedicated to the other logical processor. The execution unit 109 may include structures such as a register renaming unit, a scheduler, a load store unit (LSU), and a reordering buffer. The register renaming unit is copied to track the results of different threads, but the instructions of different logical processors are not distinguished in the subsequent scheduler and execution resources. Instead, the individual instructions in the instruction queue are simply allocated to the available execution resources. The load memory unit in execution unit 109 interacts with the data translation lookaside buffer (DTLB) in the memory management unit to perform virtual-to-physical translation of data addresses.
[0048] In the above scheme, by setting up two architecture command centers in each processor core and using the combination of the current thread identifier and the current instruction address as an index to match the configuration data in the thread history table, the cache allocation parameters in the configuration data are sent to the first cache unit for configuration. This enables the processor to quickly restore the cache configuration adapted to the thread when it reappears, reducing the gradual training process under parameter combinations with poor performance. At the same time, by dividing the instruction cache area and data cache area into a shared cache area and a private cache area, it avoids a single logical processor occupying a large amount of cache space, which would limit the performance of another logical processor. This reduces the performance degradation caused by resource contention between threads in synchronous multithreaded mode and improves the overall performance of the processor.
[0049] In one example of this application, a processor is also provided, wherein the first cache unit 110 is used to adjust the space configuration of each cache area in the first cache unit 110 according to the memory access behavior of the instruction cache area and the data cache area during the current thread execution; and to update the corresponding configuration parameters in the thread history table of the instruction fetch unit 106 according to the adjusted space configuration.
[0050] The size relationship between the instruction cache and the data cache in the first cache unit 110 is dynamically adjusted according to the operating conditions. Memory access behavior may include instruction fetch requests initiated by the instruction fetch unit 106 for the instruction cache and data access requests initiated by the execution unit 109 for the data cache. The space configuration of each cache in the first cache unit 110 includes the space sizes of the instruction shared cache, instruction private cache, data shared cache, and data private cache.
[0051] For example, during the execution of the current thread, the instruction fetch unit 106 initiates an instruction fetch request to the instruction cache. Then, the first cache unit 110 adjusts the space configuration of the instruction private cache and the instruction shared cache in the instruction cache according to the instruction fetch behavior.
[0052] For example, during the execution of the current thread, execution unit 109 initiates a data access request to the data cache. Then, the first cache unit 110 adjusts the space configuration of the private data cache and the shared data cache in the data cache according to the data access behavior.
[0053] The storage space adjustment of the first cache unit 110 is done on a path-by-path basis. It does not require manipulation of the cached content; it only needs to set the cache space range at the cache control level and invalidate the newly modified path, waiting for new data to be filled in naturally. When a memory access occurs, it searches all addresses in the cache. By setting up a private cache area, during replacement, each logical processor only performs replacement and filling operations on the data within its own private cache area.
[0054] After adjusting the space configuration based on memory access behavior, the first cache unit 110 sends the adjusted space configuration information to the instruction fetch unit 106, updating the corresponding configuration parameters in the thread history table of the instruction fetch unit 106. Whenever an adjustment occurs, the information is sent to the thread history table of the instruction fetch unit 106 for recording, so that the thread can quickly restore its state based on historical configuration parameters the next time it appears.
[0055] In the above scheme, the space configuration of each cache area in the first cache unit 110 is dynamically adjusted according to the memory access behavior of the instruction cache area and data cache area during the current thread execution, and the adjusted space configuration is updated to the thread history table. This allows the capacity configuration of the first cache unit 110 to adapt to the memory access load requirements of different threads, avoids the waste of resources under the limited capacity of the first-level cache, and can quickly restore the appropriate cache configuration when the thread reappears.
[0056] In one example of this application, a processor is also provided, such as Figure 4As shown, the processor core 103 also includes a Bloom filter 111, and the first cache unit 110 is electrically connected to the two instruction fetch units 106 and the execution unit 109 through the Bloom filter 111. The Bloom filter 111 is used to receive the memory access index carried by the instruction fetch request initiated by the instruction fetch unit 106 for the instruction cache and the memory access index carried by the data access request initiated by the execution unit 109 for the data cache; when it is determined that the memory access index does not match the memory access index recorded in the Bloom filter 111, the memory access index is recorded and the target size value corresponding to the current thread is incremented, the target size value is used to characterize the private cache space required by the memory access behavior of the current thread; the target size value and the memory access index recorded in the Bloom filter 111 are cleared at each first preset time interval.
[0057] A Bloom filter 111 (a probabilistic data structure based on bit vectors) is configured in processor core 103 to record recently accessed memory access index information. The first cache unit 110 is electrically connected to the two instruction fetch units 106 and the execution unit 109 via the Bloom filter 111, ensuring that instruction fetch requests initiated by the instruction fetch unit 106 for the instruction cache and data access requests initiated by the execution unit 109 for the data cache are sent to the Bloom filter 111. The memory access index is used to index the cache location accessed by the memory access request. The memory access index may include the index of the instruction requested by the instruction fetch unit 106 for the instruction cache and the index of the data accessed by the data access request from the execution unit 109 for the data cache, i.e., the relevant bit fields of the instruction address or data address corresponding to the memory access request.
[0058] The first cache unit 110 can adaptively adjust its size and capacity, which is achieved through the Bloom filter 111. When the instruction fetch unit 106 and the execution unit 109 perform memory access operations, the corresponding memory access requests are sent to the corresponding Bloom filter 111. The Bloom filter 111 records the recently accessed index information. If no index is hit, the memory access index information is recorded and the target size value is increased. The two instruction private cache areas and the two data private cache areas in the first cache unit 110 each have corresponding target size values. The target size value is used to characterize the space required for the memory access behavior of the thread to which the corresponding private cache area space belongs. The larger the target size value, the more different cache locations the memory access behavior of the corresponding thread involves, and the larger the private cache area space required.
[0059] The first cache unit 110 is used to determine that the target size value is greater than or equal to the sum of the corresponding private cache space of the current thread and the preset adjustment size, and to expand the private cache space according to the preset adjustment size; and to determine that the private cache space of the current thread is greater than or equal to the sum of the corresponding target size value and the preset adjustment size, and to shrink the private cache space according to the preset adjustment size.
[0060] The adaptive adjustment of the private cache space by the first cache unit 110 includes both expansion and contraction adjustments. If the target size is greater than or equal to the sum of the private cache space currently allocated to the thread and the preset adjustment size, the current private cache space is increased by the preset adjustment size. Every first preset time interval, the target size is compared with the size of the currently allocated private cache space. If the current thread's private cache space is greater than or equal to the sum of the corresponding target size and the preset adjustment size, the current private cache space is decreased by the preset adjustment size. Every first preset time interval, the target size and the memory access indexes recorded in the Bloom filter 111 are cleared and recalculated. Whenever an adjustment occurs, the information is sent to the thread history table of the instruction fetch unit 106 for recording.
[0061] For example, during the current thread's execution, its corresponding instruction private cache space is 4-way, with a preset adjustment size of 1-way. Bloom filter 111 calculates the target size of the instruction cache corresponding to the current thread to be 6-way, meaning that the thread's memory access behavior requires approximately 6-way private cache space to accommodate its active instruction set. The first cache unit 110 compares the target size value with the current instruction private cache space. The target size value is greater than or equal to the sum of the current instruction private cache space and the preset adjustment size. This indicates that the currently allocated instruction private cache space is significantly smaller than the thread's actual memory access requirements, with a difference exceeding one preset adjustment size. Therefore, it is determined that the current instruction private cache space needs to be expanded. The current instruction private cache space is increased by one preset adjustment size, from 4-way to 5-way.
[0062] The preset adjustment size can be the storage capacity corresponding to one cache path of the first cache unit 110, or it can be other preset capacity values. The first preset time can be preset according to the processor's operating scenario; for example, it can be the duration corresponding to 1 million clock cycles, or it can be set based on specific needs.
[0063] In the above scheme, the memory access index is recorded and the target size value is statistically analyzed by the Bloom filter 111. The first cache unit 110 adjusts the size of the private cache space according to the comparison result between the target size value and the private cache space, thereby realizing the adaptive capacity adjustment of the first cache unit 110. This allows the private cache space to change dynamically with the actual needs of thread memory access behavior, avoiding resource waste while preventing a single thread from occupying too much cache space, thus taking into account both cache utilization and thread fairness in multi-threaded scenarios.
[0064] In one example of this application, a processor is also provided, wherein the first cache unit 110 is used to determine that the historical private cache space in the cache allocation parameters is less than the current private cache space, and proportionally reduce the private cache space of the current thread according to the difference between the two; and to determine that the historical private cache space is greater than the current private cache space, and proportionally expand the private cache space of the current thread according to the difference between the two.
[0065] The historical private cache space is the size of the private cache space of the thread when it last ended, as recorded in the cache allocation parameters. The current private cache space is the size of the private cache space currently allocated to the logical processor. After the instruction fetch unit 106 obtains the configuration data from the thread history table, it sends the cache allocation parameters in the configuration data to the first cache unit 110. The cache allocation parameters include information about the historical private cache space. After receiving this information, the first cache unit 110 compares the historical private cache space with the current private cache space and adjusts it by shrinking or expanding it according to the comparison result.
[0066] If the historical private cache space is smaller than the current private cache space, it means the private cache space currently allocated to this thread is too large. In this case, the private cache space of the current thread is reduced proportionally based on the difference between the two. The capacity released after the current private cache space is reduced can be returned to the shared cache. For example, it can be checked whether the size of the shared cache space on the currently adjusted side (the side in the instruction cache or data cache where the private cache space is adjusted) is higher than a first critical threshold. If it is not higher than the first critical threshold, the space reduced from the current private cache is converted into space in the shared cache on that side. If it is higher than the first critical threshold, the size of the shared cache space on the other side is checked. If the size of the shared cache space on the other side is not higher than the first critical threshold, the space reduced from the current private cache is transferred into space in the shared cache on the other side. If the size of the shared cache space on the other side is higher than the first critical threshold, it is converted into space in all other private caches except the current private cache.
[0067] For example, when the current thread is running, the instruction fetch unit 106 matches the cache allocation parameters corresponding to the thread in the thread history table. The historical instruction private cache space of this thread is 2-way, and the instruction private cache space currently allocated to this thread is 4-way. The first cache unit 110 compares the historical instruction private cache space with the current instruction private cache space. The historical instruction private cache space is smaller than the current instruction private cache space. This indicates that the instruction private cache space currently allocated to this thread is too large. It is determined that the instruction private cache space of the current thread needs to be reduced proportionally according to the difference between the two, reducing the current instruction private cache space by half of the difference, i.e., 1-way, from 4-way to 3-way. The current adjustment side is the instruction cache. The first cache unit 110 checks whether the instruction shared cache space size is higher than the first critical threshold. The instruction shared cache space size is 1-way, which is not higher than the first critical threshold. Therefore, the 1-way space of the current instruction private cache is converted into the space of the instruction shared cache.
[0068] For example, when the current thread is running, the instruction fetch unit 106 matches the cache allocation parameters corresponding to the thread in the thread history table. The historical data private cache space of this thread is 2-way, and the data private cache space currently allocated to this thread is 6-way. The first cache unit 110 compares the historical data private cache space with the current data private cache space. The historical data private cache space is smaller than the current data private cache space. This indicates that the data private cache space currently allocated to this thread is too large. It is determined that the data private cache space of the current thread needs to be reduced proportionally according to the difference between the two, reducing the current data private cache space by half of the difference, i.e., 2-way, from 6-way to 4-way. The current adjustment side is the data cache. The first cache unit 110 checks whether the size of the data shared cache space is higher than the first critical threshold. The size of the data shared cache space is 3-way, which is higher than the first critical threshold. Then, it checks the size of the shared cache space of the other side, i.e., the instruction cache. The size of the instruction shared cache space is 1-way, which is not higher than the first critical threshold. Then, the 2-way space reduced from the current data private cache is transferred to the instruction shared cache space.
[0069] If the historical private cache space is larger than the current private cache space, it indicates that the private cache space currently allocated to this thread is too small. In this case, the private cache space of the current thread is expanded proportionally based on the difference between the two. The capacity required for expansion can be allocated preferentially from the shared cache space of the currently adjusted side, or from the shared cache space of the other side, or by shrinking the space of all private caches except the one being expanded. For example, it can be checked whether the size of the shared cache space of the currently adjusted side (the side in the instruction cache or data cache where the private cache space is adjusted) is higher than the second critical threshold. If it is higher than the second critical threshold, the space of the shared cache on that side is converted into the space of the current private cache. If it is not higher than the second critical threshold, the size of the shared cache space of the other side is checked. If the size of the shared cache space of the other side is higher than the second critical threshold, the space of the shared cache on the other side is converted into the space of the current private cache. If the size of the shared cache space of the other side is not higher than the critical threshold, the space of all private caches except the current private cache is shrunk and converted into the space of the current private cache.
[0070] For example, when the current thread is running, the instruction fetch unit 106 matches the cache allocation parameters corresponding to the thread in the thread history table. The historical instruction private cache space of this thread is 4-way, and the instruction private cache space currently allocated to this thread is 2-way. The first cache unit 110 compares the historical instruction private cache space with the current instruction private cache space. The historical instruction private cache space is larger than the current instruction private cache space. This indicates that the instruction private cache space currently allocated to this thread is too small. It is determined that the instruction private cache space of the current thread needs to be increased proportionally according to the difference between the two, increasing the current instruction private cache space by half of the difference, i.e., 1-way, from 2-way to 3-way. The current adjustment side is the instruction cache. The first cache unit 110 checks whether the size of the instruction shared cache space is higher than the second critical threshold. The size of the instruction shared cache space is 3-way, which is higher than the second critical threshold. Therefore, the 1-way space in the instruction shared cache is converted into the space of the current instruction private cache.
[0071] For example, when the current thread is running, the instruction fetch unit 106 matches the cache allocation parameters corresponding to the thread in the thread history table. The historical data private cache space of this thread is 6-way, and the data private cache space currently allocated to this thread is 2-way. The first cache unit 110 compares the historical data private cache space with the current data private cache space. The historical data private cache space is larger than the current data private cache space. This indicates that the data private cache space currently allocated to this thread is too small. It is determined that the data private cache space of the current thread needs to be increased proportionally according to the difference between the two, increasing the current data private cache space by half of the difference, i.e., 2-way, from 2-way to 4-way. The current adjustment side is the data cache. The first cache unit 110 checks whether the size of the data shared cache space is higher than the second critical threshold. The size of the data shared cache space is 1-way, which is not higher than the second critical threshold. Then, it checks the size of the shared cache space on the other side, i.e., the instruction cache. The size of the instruction shared cache space is 3-way, which is higher than the second critical threshold. Then, the 2-way space in the instruction shared cache is converted into the space of the current data private cache.
[0072] In this embodiment, the first critical threshold can be set to half the total space size of its corresponding side cache (instruction cache or data cache). The second critical threshold can be set to one-eighth the total space size of its corresponding side cache. In other embodiments, the first and second critical thresholds can be set based on specific requirements.
[0073] It should be noted that the space conversion method in the above scheme of shrinking or expanding the corresponding private cache space by using the target size value is the same as that here.
[0074] In the above scheme, by comparing the historical private cache space in the cache allocation parameters with the current private cache space, the private cache space of the current thread is proportionally reduced or expanded according to the difference between the two. This enables the first cache unit 110 to quickly restore the cache space configuration that matches the memory access needs of the thread when it reappears, avoiding the gradual training process under parameter combinations with poor performance and improving the processor's operating efficiency.
[0075] In one example of this application, a processor is also provided, wherein the second cache unit 104 includes a second shared cache area and two second private cache areas corresponding one-to-one with the two architecture command centers 105; the third cache unit 102 includes a third shared cache area and two third private cache areas corresponding one-to-one with the two architecture command centers 105.
[0076] The second cache unit 104 can be a Level 2 cache, and the third cache unit 102 can be a Level 3 cache. The second cache unit 104 and the third cache unit 102 will also have separate private cache areas, namely two second private cache areas and two third private cache areas corresponding one-to-one with the two architecture command centers 105, as well as a second shared cache area and a third shared cache area shared by the two logical processors.
[0077] The second cache unit 104 is used to adjust the space configuration of each cache area in the second cache unit 104 according to the memory access behavior of the current thread during the execution of the second cache unit 104; and to update the corresponding configuration parameters in the thread history table of the instruction fetch unit 106 according to the adjusted space configuration.
[0078] The third cache unit 102 is used to adjust the space configuration of each cache area in the third cache unit 102 according to the memory access behavior of the current thread during the execution of the third cache unit 102; and to update the corresponding configuration parameters in the thread history table of the instruction fetch unit 106 according to the adjusted space configuration.
[0079] The adjustment method for the private cache area in the second cache unit 104 and the third cache unit 102 is the same as the adjustment process for the private cache area in the first cache unit 110. However, the second cache unit 104 and the third cache unit 102 do not need to further distinguish between separate instruction cache area and data cache area. That is, the shared cache area and the private cache area in the second cache unit 104 and the third cache unit 102 do not distinguish between instructions and data, and the space configuration is adjusted uniformly.
[0080] The second cache unit 104 adjusts the space configuration of the second shared cache and the two second private caches in the second cache unit 104 according to the memory access behavior of the current thread during its execution, and updates the corresponding configuration parameters in the thread history table of the instruction fetch unit 106 according to the adjusted space configuration. The third cache unit 102 adjusts the space configuration of the third shared cache and the two third private caches in the third cache unit 102 according to the memory access behavior of the current thread during its execution, and updates the corresponding configuration parameters in the thread history table of the instruction fetch unit 106 according to the adjusted space configuration.
[0081] In addition, a portion of the capacity in the third cache unit 102 can be allocated separately for storing prefetch metadata, i.e., training data recorded in the prefetch record to initiate data prefetching, thereby controlling the storage overhead of time pattern prefetching. The size of the prefetch metadata table can be controlled by a Bloom filter 111, and the space size of the prefetch metadata table can also be dynamically adjusted in the same way as the adjustment method of the private cache area in the first cache unit 110 through the Bloom filter 111.
[0082] In the above scheme, shared and private cache areas are divided in the second cache unit 104 and the third cache unit 102, and the space configuration of each cache unit is dynamically adjusted and the thread history table is updated according to memory access behavior. This allows the space configuration of the multi-level cache to adapt to the memory access load requirements of different threads, improving cache utilization while avoiding a single thread occupying a large amount of cache resources, thereby further improving the overall memory access performance in multi-threaded scenarios.
[0083] In one example of this application, a processor is also provided, such as Figure 5 As shown, the instruction fetching unit 106 includes a branch prediction unit 112; The branch prediction unit 112 is used to predict the execution direction of branch instructions in the instruction stream of the current thread and generate the predicted next instruction address. The next instruction address instructs the instruction fetch unit 106 to obtain the corresponding instruction data. The instruction fetching unit 106 is used to send the branch prediction configuration parameters in the configuration data to the branch prediction unit 112 for configuration after matching the corresponding configuration data from the thread history table according to the index, so that the branch prediction unit 112 performs prediction according to the configured parameters. The configuration parameters also include the branch prediction configuration parameters, which at least indicate the table entry configuration of the prediction table in the branch prediction unit 112.
[0084] Branch prediction unit 112 is located within instruction fetch unit 106. It predicts the execution direction of branch instructions during the instruction fetch stage, generating the predicted next instruction address. Instruction fetch unit 106 then retrieves the corresponding instruction data based on this predicted next instruction address, thereby reducing pipeline flushing losses caused by branch instructions. Branch prediction unit 112 contains a prediction table, the configuration of which can be indicated by branch prediction configuration parameters. For example, the prediction table's entry configuration indicates the number of entries, indexing method, tag width, and other configuration information.
[0085] Prediction tables can be implemented based on various branch prediction algorithms. Taking the commonly used TAGE_SC_L (a branch prediction algorithm) as an example, TAGE_SC_L is a branch prediction algorithm that combines the features of the TAGE predictor, the Statistical Correlation (SC) predictor, and the Loop predictor. The TAGE predictor is the main predictor, based on a multi-level index table of global history, and uses label matching for branch prediction. The Statistical Correlation predictor provides auxiliary predictions based on statistical correlation, correcting misjudgments by the TAGE predictor. The Loop predictor identifies and predicts cyclic branches. The configuration of the prediction table entries can include the number of entries in the multi-level index table of the TAGE predictor, the confidence threshold of the Statistical Correlation predictor, and the number of entries in the Loop predictor.
[0086] The branch prediction unit 112 is used to record the prediction accuracy data, and at every second preset time interval, the table item configuration of the prediction table in the branch prediction unit 112 is adjusted according to the accuracy data.
[0087] Branch prediction unit 112 records the accuracy data of its predictions over time. Every second preset time interval, it adjusts the configuration of the prediction table entries in branch prediction unit 112 based on the accuracy data. Specifically, a statistical table or a performance monitoring unit (PMU) module can be set up in branch prediction unit 112 to monitor and record the number of hits and missing values in each index table of the TAGE predictor, the number of successful and failed coverages of the statistical correlation predictor, and the number of hits of the loop predictor. Adjustments are made every second preset time interval. For example, the number of historical table entries of the TAGE predictor, the number of table entries of the loop predictor, and the confidence threshold of the statistical correlation predictor can be adjusted. Entry changes can be achieved through mutual conversion between table entries. Since branch prediction unit 112 is thread-independent, it can directly adjust upon receiving the adjustment signal from instruction fetch unit 106 without affecting other aspects. Whenever an entry changes, the signal is also synchronized to instruction fetch unit 106, and the thread history table information is modified to correct the historical table entries.
[0088] The second preset time can be pre-set according to the processor's operating scenario. For example, it can be the duration corresponding to a fixed access cycle, or it can be set based on specific needs.
[0089] In the above scheme, the branch prediction unit 112 predicts the execution direction of the branch instruction and generates the predicted next instruction address, enabling the instruction fetch unit 106 to fetch instructions according to the predicted address. Simultaneously, the branch prediction unit 112 records the accuracy data of each prediction and adjusts the configuration of the prediction table entries based on the accuracy data at second preset time intervals. This achieves dynamic adjustment of branch prediction parameters according to the running conditions, reducing pipeline flushing losses caused by branch prediction errors. The adjusted configuration parameters are stored in the thread history table, allowing for rapid recovery of the state when the thread reappears, further improving processor performance.
[0090] In one example of this application, a processor is also provided, such as Figure 6 As shown, the processor core 103 further includes a data prefetch unit 113, and the execution unit 109 is also electrically connected to the first cache unit 110 through the data prefetch unit 113; The data prefetching unit 113 is used to initiate a data prefetching request to the first cache unit 110 based on the memory access behavior during the current thread's operation, and to prefetch the data that the current thread is expected to access into the data cache area. The fetching unit 106 is used to send the data prefetching configuration parameters in the configuration data to the data prefetching unit 113 for configuration after matching the corresponding configuration data from the thread history table according to the index, so that the data prefetching unit 113 performs data prefetching according to the configured parameters. The configuration parameters also include data prefetching configuration parameters, which at least indicate the prefetching strategy and prefetching degree used for data prefetching. The data prefetching unit 113 is used to record the accuracy data of data prefetching. Every third preset time interval, the prefetching strategy and prefetching degree used by the data prefetching unit 113 in data prefetching are adjusted according to the accuracy data.
[0091] The data prefetching unit 113 is located in the processor core 103. It is used to identify potential memory access patterns by recording historical memory access information, thereby predicting future cache misses (i.e., data that may be requested in the future) and prefetching it into the data cache of the first cache unit 110 to reduce memory access latency. The data prefetching unit 113 is electrically connected to the execution unit 109 and the first cache unit 110. Memory access requests and cache miss requests from the execution unit 109 during memory access can be sent to the data prefetching unit 113. Based on the memory access behavior of the current thread, the data prefetching unit 113 initiates a data prefetching request to the first cache unit 110, prefetching the data that the current thread is predicted to access into the data cache.
[0092] The prefetch strategy indicates the type and method of prefetcher used for data prefetching, while the prefetch degree indicates the number of prefetch requests calculated and issued by the data prefetch unit 113 based on the memory access pattern when initiating a prefetch request. The data prefetch unit 113 can maintain multiple prefetchers. Since the memory access sequence patterns of different threads are inconsistent, the optimal prefetcher often varies. For example, it can maintain stride prefetchers (such as global stride prefetchers and local stride prefetchers), offset prefetchers (such as sandbox prefetchers, optimal offset prefetchers, Berti prefetchers, etc.), and time prefetchers (such as DCPT, Triage, Triangel, etc.). An arbitrator is set up to determine which prefetch request issued by which prefetcher is used as the actual prefetch request, and the prefetch degree (i.e., how many prefetch requests are issued based on this pattern) is adjusted. Requests issued by other prefetchers can also be used as simulated prefetch requests, and the accuracy data of these prefetch requests is recorded.
[0093] After fetching unit 106 retrieves the corresponding configuration data from the thread history table based on the index, it sends the data prefetch configuration parameters from the configuration data to data prefetching unit 113 for configuration, so that data prefetching unit 113 performs data prefetching according to the configured parameters. The data prefetch configuration parameters at least indicate the prefetching strategy and prefetching degree used for data prefetching. When there are records in fetching unit 106, data prefetching unit 113 first uses the prefetcher selection and prefetching degree information of the records to perform data prefetching.
[0094] Data prefetching unit 113 records the accuracy data of each data prefetch. Every third preset time interval, it adjusts the prefetching strategy and prefetching degree based on the accuracy data. Specifically, issued prefetch requests (whether actually issued or simulated by other prefetchers) are recorded in the prefetch request history table with a compressed index, and the prefetch source is also recorded. This is compared with cache miss requests and prefetch hit requests received by the prefetcher. Every third preset time interval, the number of hits from different prefetch sources and the accuracy of the issued prefetch requests are compared. The two are comprehensively evaluated to determine the best prefetcher and prefetching degree information to be used in the next time period, and the result is returned to instruction fetching unit 106 for recording. Time-mode prefetching requires recording a large amount of memory access flow information, which occupies a large space. This information can be stored in the third cache unit 102, while only a portion of commonly used memory access flow sequence information is recorded in the second cache unit 104.
[0095] The third preset time can be preset according to the processor's operating scenario. For example, it can be the duration corresponding to a fixed time period, or it can be set based on specific needs.
[0096] In the above scheme, the data prefetching unit 113 initiates a data prefetch request to the first cache unit 110 based on the memory access behavior of the current thread during execution, prefetching the data that the current thread is expected to access into the data cache area, thus masking the memory access latency caused by cache misses. Simultaneously, requests from other prefetchers can be used as simulated prefetch requests, and the accuracy data of these prefetch requests is recorded to quickly increase the data available for prediction. The data prefetching unit 113 records the accuracy data of data prefetching and adjusts the prefetching strategy and prefetching degree based on the accuracy data every third preset time interval. Through periodic competition among multiple prefetchers, it adapts to different load scenarios and saves the corresponding configuration parameters in the thread history table. When the thread reappears, the state can be quickly restored, and the most suitable prefetching algorithm for the load scenario can be quickly matched, thereby improving the accuracy of data prefetching and processor performance while reducing the risk of cache pollution.
[0097] In one example of this application, a processor is also provided, wherein the decoding unit 107 is used to determine that the current instruction data carries a low-power identifier and send a switching instruction to the first cache unit 110; The first cache unit 110 is configured to, in response to the switching instruction, set the space size of both the two instruction private cache areas and the two data private cache areas to zero, so that the space of the two instruction private cache areas is converted into the space of the instruction shared cache area, and the space of the two data private cache areas is converted into the space of the data shared cache area.
[0098] A low-power flag is an identifier used to indicate that the processor is entering a low-power mode. Instruction sets can be extended with low-power instructions. For example, the RISC-V instruction set (RISC-V, an open-source instruction set architecture based on the principles of reduced instruction set computing) itself includes low-power instructions and can be further extended with other low-power instructions. Low-power instructions can instruct the processor to enter a low-power mode. When the decoding unit 107 decodes the current instruction data, it can determine whether the current instruction data carries a low-power flag. The current instruction data carrying the low-power flag can be the instruction data corresponding to a low-power instruction.
[0099] When Hyper-Threading is enabled, executing low-power instructions will switch the processor from multi-threaded mode to single-threaded mode, depending on which logic processor's low-power instruction is being executed. When the decoding unit 107 determines that the current instruction data carries a low-power flag, it sends a switching instruction to the first cache unit 110. In response to the switching instruction, the first cache unit 110 sets the size of both instruction private caches and both data private caches to zero, converting the space of the two instruction private caches into the space of the instruction shared cache, and the space of the two data private caches into the space of the data shared cache.
[0100] For example, if logic processor 0 executes a low-power instruction, only logic processor 1 is active. In this case, the size of both the private instruction cache corresponding to logic processor 0 and the private instruction cache corresponding to logic processor 1 in the instruction cache is set to 0, and the entire space is converted to the shared instruction cache space. The same process is performed on the data cache. This allows logic processor 1 to fully utilize all processor resources. If both logic processors execute low-power instructions, the entire physical processor enters low-power mode.
[0101] It should be noted that the method of switching the low-power mode of the first cache unit 110 described above also applies to the second cache unit 104 and the third cache unit 102.
[0102] In the above scheme, when the decoding unit 107 determines that the current instruction data carries a low-power flag, it sends a switching instruction to the first cache unit 110. This causes the first cache unit 110 to set the size of both instruction private cache areas and both data private cache areas to zero and convert them into the corresponding shared cache area space. This achieves the on / off operation of hyper-threading using low-power instructions and reorganizes the processor's internal cache resources to adapt to the switching process, enabling the remaining logic processors to fully utilize all cache resources and reducing resource waste in low-power mode.
[0103] An example of this application provides an instruction execution method applied to a processor, the processor including multiple clusters and a third cache unit; the clusters include multiple processor cores and a second cache unit; the processor cores include two architecture command centers, two instruction fetch units corresponding to the two architecture command centers, a decoding unit, two micro-operation queues corresponding to the two instruction fetch units, an execution unit, and a first cache unit; the first cache unit includes an instruction cache area and a data cache area, the instruction cache area being divided into a shared instruction cache area and two private instruction cache areas corresponding to the two architecture command centers, and the data cache area being divided into a shared data cache area and two private data cache areas corresponding to the two architecture command centers; the method includes: The instruction fetching unit obtains the current thread identifier and the current instruction address from the corresponding architecture command center; based on the current instruction address, it retrieves the current instruction data from the corresponding instruction private cache or instruction shared cache through memory access behavior; it uses the combination of the current thread identifier and the current instruction address as an index to match the corresponding configuration data from the thread history table, and sends the cache allocation parameters in the configuration data to the first cache unit for configuration. The thread history table includes multiple indexes and configuration parameters corresponding to the indexes. The configuration parameters include at least cache allocation parameters, which at least indicate the space configuration of each cache area in the first cache unit.
[0104] The decoding unit alternately fetches instruction data from the two instruction fetch units to obtain the current instruction data; it decodes the current instruction data and stores the decoded current micro-operation into the micro-operation queue corresponding to the current thread.
[0105] The execution unit alternately retrieves micro-operations from the two micro-operation queues to obtain the current micro-operation; based on the current micro-operation, it retrieves the current data to be processed from the corresponding data private cache or data shared cache through memory access behavior; and executes the current micro-operation based on the current data to be processed.
[0106] In the above scheme, the instruction fetch unit uses the combination of the current thread identifier and the current instruction address as an index to match configuration data from the thread history table and configure the first cache unit. The decoding unit stores the decoded micro-operations into the micro-operation queue corresponding to the current thread. The execution unit alternately retrieves micro-operations from the two micro-operation queues and executes the micro-operations according to the current data to be processed in the data cache. This enables the processor to quickly restore the appropriate cache configuration when the thread reappears. Furthermore, by dividing the micro-operation queue, it avoids a single logical processor from occupying most of the resources, thereby improving the overall performance of the processor in synchronous multi-threaded mode.
[0107] This application also provides an instruction execution method in one example, the method further comprising: The first cache unit adjusts the space configuration of each cache area in the first cache unit according to the memory access behavior of the instruction cache area and the data cache area during the current thread execution; and updates the corresponding configuration parameters in the thread history table of the instruction fetch unit according to the adjusted space configuration.
[0108] In the above scheme, the first cache unit dynamically adjusts the space configuration of each cache area and updates the thread history table according to the memory access behavior during the current thread execution, thereby realizing the adaptive cache capacity configuration to the thread memory access load and improving the cache utilization in multi-threaded scenarios.
[0109] In one example of this application, an instruction execution method is also provided, wherein the processor core further includes a Bloom filter; adjusting the space configuration of each cache area in the first cache unit according to the memory access behavior of the instruction cache area and the data cache area during the current thread execution includes: The Bloom filter receives the memory access index carried by the instruction fetch request initiated by the instruction fetch unit for the instruction cache and the memory access index carried by the data access request initiated by the execution unit for the data cache; when it is determined that the memory access index does not match the memory access index already recorded in the Bloom filter, the memory access index is recorded and the target size value corresponding to the current thread is incremented, the target size value is used to characterize the private cache space required by the memory access behavior of the current thread; the target size value and the memory access index already recorded in the Bloom filter are cleared at each first preset time interval; The first cache unit determines that the target size value is greater than or equal to the sum of the corresponding private cache space of the current thread and the preset adjustment size, and expands the private cache space according to the preset adjustment size; determines that the private cache space of the current thread is greater than or equal to the sum of the corresponding target size value and the preset adjustment size, and shrinks the private cache space according to the preset adjustment size.
[0110] In the above scheme, the target size value is statistically analyzed by using a Bloom filter. The first cache unit adjusts the private cache space according to the preset adjustment size based on the comparison result between the target size value and the private cache space. This achieves adaptive capacity adjustment of the first cache unit, thereby avoiding resource waste and preventing a single thread from occupying too much cache space.
[0111] This application also provides an instruction execution method in one example, the method further comprising: The first cache unit determines that the historical private cache space in the cache allocation parameters is less than the current private cache space, and proportionally reduces the current thread's private cache space based on the difference between the two; it also determines that the historical private cache space is greater than the current private cache space, and proportionally expands the current thread's private cache space based on the difference between the two.
[0112] In the above scheme, the private cache space is adjusted proportionally based on the difference between the historical private cache space and the current private cache space, which enables the rapid restoration of the cache configuration when the thread reappears, thereby avoiding the gradual training process under parameter combinations with poor performance.
[0113] In one example of this application, an instruction execution method is also provided, wherein the second cache unit includes a second shared cache area and two second private cache areas corresponding one-to-one with the two architecture command centers; the third cache unit includes a third shared cache area and two third private cache areas corresponding one-to-one with the two architecture command centers; the method further includes: The second cache unit adjusts the space configuration of each cache area in the second cache unit according to the memory access behavior of the current thread during the execution of the second cache unit; and updates the corresponding configuration parameters in the thread history table of the instruction fetch unit according to the adjusted space configuration. The third cache unit adjusts the space configuration of each cache area in the third cache unit according to the memory access behavior of the current thread during the execution of the third cache unit; and updates the corresponding configuration parameters in the thread history table of the instruction fetch unit according to the adjusted space configuration.
[0114] In the above scheme, by dynamically adjusting and updating the thread history table of the shared cache area and private cache area in the second and third cache units, the multi-level cache space configuration is adapted to the thread memory access load, thereby further improving the overall memory access performance in multi-threaded scenarios.
[0115] In one example of this application, an instruction execution method is also provided, wherein the instruction fetch unit includes a branch prediction unit; the method further includes: The branch prediction unit predicts the execution direction of branch instructions in the instruction stream of the current thread, generates the predicted next instruction address, and the next instruction address instructs the instruction fetch unit to obtain the corresponding instruction data; records the prediction accuracy data, and adjusts the table entry configuration of the prediction table in the branch prediction unit according to the accuracy data every second preset time interval; Accordingly, after the fetching unit obtains the corresponding configuration data from the thread history table according to the index, it sends the branch prediction configuration parameters in the configuration data to the branch prediction unit for configuration, so that the branch prediction unit makes predictions according to the configured parameters. The configuration parameters also include the branch prediction configuration parameters, which at least indicate the table entry configuration of the prediction table in the branch prediction unit.
[0116] In the above scheme, the prediction accuracy data is recorded by the branch prediction unit, and the table item configuration of the prediction table is adjusted at every second preset time interval. This realizes the dynamic adjustment of the branch prediction parameters according to the running conditions, thereby reducing the pipeline scouring loss caused by branch prediction errors.
[0117] In one example of this application, an instruction execution method is also provided, wherein the processor core further includes a data prefetching unit; the method further includes: The data prefetching unit initiates a data prefetching request to the first cache unit based on the memory access behavior of the current thread during its operation, and prefetches the data that the current thread is expected to access into the data cache area in advance; records the accuracy data of data prefetching, and adjusts the prefetching strategy and prefetching degree adopted by the data prefetching unit for data prefetching based on the accuracy data every third preset time interval; After the fetching unit obtains the corresponding configuration data from the thread history table according to the index, it sends the data prefetching configuration parameters in the configuration data to the data prefetching unit for configuration, so that the data prefetching unit performs data prefetching according to the configured parameters. The configuration parameters also include data prefetching configuration parameters, which at least indicate the prefetching strategy and prefetching degree used for data prefetching.
[0118] In the above scheme, the accuracy data of data prefetching is recorded by the data prefetching unit, and the prefetching strategy and prefetching degree are adjusted every third preset time interval. This realizes the adaptiveness of data prefetching to the load scenario, thereby improving the accuracy of data prefetching while reducing the risk of cache pollution.
[0119] This application also provides an instruction execution method in one example, the method further comprising: The decoding unit determines that the current instruction data carries a low-power flag and sends a switching instruction to the first cache unit; In response to the switching instruction, the first cache unit sets the size of both instruction private caches and the two data private caches to zero, so that the space of the two instruction private caches is converted into the space of the instruction shared cache, and the space of the two data private caches is converted into the space of the data shared cache.
[0120] In the above scheme, the decoding unit identifies the low-power flag carried by the current instruction data and triggers the first cache unit to convert the private cache space into a shared cache space. This realizes the use of low-power instructions to enable / disable hyper-threading and recombine the internal cache resources of the processor, thereby reducing resource waste in low-power mode.
[0121] This application also provides an electronic device. Figure 7A schematic block diagram of an example electronic device 700 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0122] like Figure 7 As shown, the electronic device 700 includes a computing unit 701, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 702 or a computer program loaded from a storage unit 708 into a random access memory (RAM) 703. The RAM 703 may also store various programs and data required for the operation of the electronic device 700. The computing unit 701, ROM 702, and RAM 703 are interconnected via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0123] Multiple components in electronic device 700 are connected to I / O interface 705, including: input unit 706, such as keyboard, mouse, etc.; output unit 707, such as various types of displays, speakers, etc.; storage unit 708, such as disk, optical disk, etc.; and communication unit 709, such as network card, modem, wireless transceiver, etc. Communication unit 709 allows electronic device 700 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0124] The computing unit 701 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 701 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 701 performs the various methods and processes described above, such as instruction execution methods. For example, in some embodiments, the instruction execution method may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 708. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 700 via ROM 702 and / or communication unit 709. When the computer program is loaded into RAM 703 and executed by the computing unit 701, one or more steps of the instruction execution method described above may be performed. Alternatively, in other embodiments, the computing unit 701 may be configured to perform instruction execution methods by any other suitable means (e.g., by means of firmware).
[0125] This application provides a computer-readable storage medium storing executable instructions, wherein a computer program is stored, the computer program being used to execute the instruction execution method provided in this application.
[0126] This application provides a computer program product, which includes a computer program or instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer program or instructions from the computer-readable storage medium and executes the computer program or instructions, causing the computer device to perform the instruction execution method described above in this application.
[0127] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), system-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0128] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0129] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0130] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0131] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.
[0132] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.
[0133] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.
[0134] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this disclosure, "a plurality of" means two or more, unless otherwise explicitly specified.
[0135] The above description is merely a specific embodiment of this disclosure, but the scope of protection of this disclosure is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this disclosure should be included within the scope of protection of this disclosure. Therefore, the scope of protection of this disclosure should be determined by the scope of the claims.
Claims
1. A processor, characterized in that, The processor includes multiple clusters and a third cache unit, with each cluster electrically connected to the third cache unit. Each cluster includes multiple processor cores and a second cache unit, with each processor core electrically connected to the second cache unit. Each processor core includes two architecture command centers, two instruction fetch units corresponding to each of the two architecture command centers, a decoding unit, two micro-operation queues corresponding to each of the two instruction fetch units, an execution unit, and a first cache unit. Each architecture command center is electrically connected to its corresponding instruction fetch unit, each instruction fetch unit is electrically connected to the decoding unit, each decoding unit is electrically connected to the two micro-operation queues, each micro-operation queue is electrically connected to the execution unit, and the first cache unit is electrically connected to both the two instruction fetch units and the execution unit. The first cache unit includes an instruction cache area and a data cache area. The instruction cache area is divided into an instruction shared cache area and two instruction private cache areas corresponding one-to-one with the two architecture command centers. The data cache area is divided into a data shared cache area and two data private cache areas corresponding one-to-one with the two architecture command centers. The instruction fetching unit is used to obtain the current thread identifier and the current instruction address from the corresponding architecture command center; to obtain the current instruction data from the corresponding instruction private cache or instruction shared cache through memory access behavior based on the current instruction address; to use the combination of the current thread identifier and the current instruction address as an index to match the corresponding configuration data from the thread history table; and to send the cache allocation parameters in the configuration data to the first cache unit for configuration. The thread history table includes multiple indexes and configuration parameters corresponding to the indexes. The configuration parameters include at least cache allocation parameters, which at least indicate the space configuration of each cache area in the first cache unit. The decoding unit is used to alternately fetch instruction data from the two instruction fetch units to obtain the current instruction data; The current instruction data is decoded, and the decoded current micro-operation is stored in the micro-operation queue corresponding to the current thread; The execution unit is used to alternately obtain micro-operations from the two micro-operation queues to obtain the current micro-operation; Based on the current micro-operation, the data to be processed is obtained from the corresponding private data cache or the shared data cache through memory access behavior; the current micro-operation is then executed based on the data to be processed.
2. The processor according to claim 1, wherein the first cache unit is configured to adjust the space configuration of each cache area in the first cache unit according to the memory access behavior of the instruction cache area and the data cache area during the current thread execution; and update the corresponding configuration parameters in the instruction fetch unit thread history table according to the adjusted space configuration.
3. The processor according to claim 2, wherein the processor core further includes a Bloom filter, and the first cache unit is electrically connected to the two instruction fetch units and the execution unit respectively through the Bloom filter; The Bloom filter is used to receive the memory access index carried by the instruction fetch request initiated by the instruction fetch unit for the instruction cache and the memory access index carried by the data access request initiated by the execution unit for the data cache; when it is determined that the memory access index does not match the memory access index already recorded in the Bloom filter, the memory access index is recorded and the target size value corresponding to the current thread is incremented, the target size value is used to characterize the private cache space required by the memory access behavior of the current thread; The target size value and the memory access index recorded in the Bloom filter are cleared at each first preset time interval; The first cache unit is used to determine that the target size value is greater than or equal to the sum of the private cache space corresponding to the current thread and the preset adjustment size, and to expand the private cache space according to the preset adjustment size; If the private cache space of the current thread is determined to be greater than or equal to the sum of the corresponding target size value and the preset adjustment size, the private cache space is reduced according to the preset adjustment size.
4. The processor according to claim 1, wherein the first cache unit is configured to determine that the historical private cache space in the cache allocation parameters is less than the current private cache space, and proportionally reduce the private cache space of the current thread according to the difference between the two; and determine that the historical private cache space is greater than the current private cache space, and proportionally expand the private cache space of the current thread according to the difference between the two.
5. The processor according to claim 1, wherein the second cache unit includes a second shared cache area and two second private cache areas corresponding one-to-one with the two architecture command centers; the third cache unit includes a third shared cache area and two third private cache areas corresponding one-to-one with the two architecture command centers; The second cache unit is used to adjust the space configuration of each cache area in the second cache unit according to the memory access behavior of the current thread during the execution of the second cache unit; and to update the corresponding configuration parameters in the instruction fetching unit thread history table according to the adjusted space configuration. The third cache unit is used to adjust the space configuration of each cache area in the third cache unit according to the memory access behavior of the current thread during the execution of the third cache unit; and to update the corresponding configuration parameters in the instruction fetch unit thread history table according to the adjusted space configuration.
6. The processor according to claim 1, wherein the instruction fetching unit includes a branch prediction unit; The branch prediction unit is used to predict the execution direction of branch instructions in the instruction stream of the current thread and generate the predicted next instruction address. The next instruction address instructs the instruction fetch unit to obtain the corresponding instruction data. The instruction fetching unit is used to send the branch prediction configuration parameters in the configuration data to the branch prediction unit for configuration after matching the corresponding configuration data from the thread history table according to the index, so that the branch prediction unit can make predictions according to the configured parameters. The configuration parameters also include the branch prediction configuration parameters, which at least indicate the table entry configuration of the prediction table in the branch prediction unit. The branch prediction unit is used to record the prediction accuracy data, and at every second preset time interval, the table item configuration of the prediction table in the branch prediction unit is adjusted according to the accuracy data.
7. The processor according to claim 1, wherein the processor core further includes a data prefetch unit, and the execution unit is further electrically connected to the first cache unit through the data prefetch unit; The data prefetching unit is used to initiate a data prefetching request to the first cache unit based on the memory access behavior of the current thread during its operation, and to prefetch the data that the current thread is expected to access into the data cache area. The fetching unit is used to send the data prefetching configuration parameters in the configuration data to the data prefetching unit for configuration after matching the corresponding configuration data from the thread history table according to the index, so that the data prefetching unit performs data prefetching according to the configured parameters. The configuration parameters also include data prefetching configuration parameters, which at least indicate the prefetching strategy and prefetching degree used for data prefetching. The data prefetching unit is used to record the accuracy data of data prefetching. Every third preset time interval, the prefetching strategy and prefetching degree used by the data prefetching unit are adjusted according to the accuracy data.
8. The processor according to claim 1, wherein the decoding unit is configured to determine that the current instruction data carries a low-power identifier and send a switching instruction to the first cache unit; The first cache unit is configured to, in response to the switching instruction, set the size of both instruction private cache areas and the two data private cache areas to zero, so that the space of the two instruction private cache areas is converted into the space of the instruction shared cache area, and the space of the two data private cache areas is converted into the space of the data shared cache area.
9. An instruction execution method applied to a processor, characterized in that, The processor includes multiple clusters and a third cache unit; each cluster includes multiple processor cores and a second cache unit; each processor core includes two architecture command centers, two instruction fetch units corresponding to the two architecture command centers, a decoding unit, two micro-operation queues corresponding to the two instruction fetch units, an execution unit, and a first cache unit; the first cache unit includes an instruction cache area and a data cache area, the instruction cache area is divided into a shared instruction cache area and two private instruction cache areas corresponding to the two architecture command centers, and the data cache area is divided into a shared data cache area and two private data cache areas corresponding to the two architecture command centers; the method includes: The instruction fetching unit obtains the current thread identifier and the current instruction address from the corresponding architecture command center; based on the current instruction address, it retrieves the current instruction data from the corresponding instruction private cache or instruction shared cache through memory access behavior; it uses the combination of the current thread identifier and the current instruction address as an index to match the corresponding configuration data from the thread history table, and sends the cache allocation parameters in the configuration data to the first cache unit for configuration. The thread history table includes multiple indexes and configuration parameters corresponding to the indexes. The configuration parameters include at least cache allocation parameters, which at least indicate the space configuration of each cache area in the first cache unit. The decoding unit alternately fetches instruction data from the two instruction fetching units to obtain the current instruction data; it decodes the current instruction data and stores the decoded current micro-operation into the micro-operation queue corresponding to the current thread. The execution unit alternately retrieves micro-operations from the two micro-operation queues to obtain the current micro-operation; based on the current micro-operation, it retrieves the current data to be processed from the corresponding data private cache or data shared cache through memory access behavior; and executes the current micro-operation based on the current data to be processed.
10. The instruction execution method according to claim 9, further comprising: The first cache unit adjusts the space configuration of each cache area in the first cache unit according to the memory access behavior of the instruction cache area and the data cache area during the current thread execution; Update the corresponding configuration parameters in the instruction fetching unit thread history table according to the adjusted space configuration.
11. The instruction execution method according to claim 10, wherein the processor core further includes a Bloom filter; adjusting the space configuration of each cache area in the first cache unit according to the memory access behavior of the instruction cache area and the data cache area during the current thread execution includes: The Bloom filter receives the memory access index carried by the instruction fetch request initiated by the instruction fetch unit for the instruction cache and the memory access index carried by the data access request initiated by the execution unit for the data cache; when it is determined that the memory access index does not match the memory access index already recorded in the Bloom filter, the memory access index is recorded and the target size value corresponding to the current thread is incremented, the target size value being used to characterize the private cache space required for the memory access behavior of the current thread; The target size value and the memory access index recorded in the Bloom filter are cleared at each first preset time interval; The first cache unit determines that the target size value is greater than or equal to the sum of the private cache space corresponding to the current thread and the preset adjustment size, and expands the private cache space according to the preset adjustment size; If the private cache space of the current thread is determined to be greater than or equal to the sum of the corresponding target size value and the preset adjustment size, the private cache space is reduced according to the preset adjustment size.
12. The instruction execution method according to claim 9, further comprising: The first cache unit determines that the historical private cache space in the cache allocation parameters is smaller than the current private cache space, and proportionally reduces the private cache space of the current thread according to the difference between the two. If the historical private cache space is determined to be larger than the current private cache space, the private cache space of the current thread is increased proportionally based on the difference between the two.
13. An electronic device, characterized in that, The electronic device includes a processor capable of executing the instruction execution method according to any one of claims 9 to 12.
14. A computer-readable storage medium, characterized in that, The storage medium stores a computer program for executing the instruction execution method according to any one of claims 9 to 12.
15. A computer program product, comprising a computer program or instructions, characterized in that, When the computer program or instructions are executed by the processor, they implement the instruction execution method according to any one of claims 9 to 12.
