Spatial recovery method, device, equipment and medium for multi-port transmission
Through the space recycling method of multi-port emission, the dispatched instruction sequence relationship table is used to determine the dependency relationship, and the space is released out of order, which solves the problem of increased instruction waiting time caused by the linear recycling mechanism and improves the execution performance of the processor.
Patent Information
- Application Number
- CN202410726207.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-05
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2044-06-05
AI Technical Summary
In the multi-issue scenario of existing processors, the instruction waiting time increases due to the linear recycling mechanism, which affects the execution performance of the processor.
The space recycling method of multi-port emission is adopted, and the dependency relationship between instructions is judged through the dispatched instruction sequence relationship table, allowing space to be released out of order and avoiding waiting for the instruction dispatched first to be released first.
Reduce invalid waiting time, improve instruction execution efficiency, reduce logic delay, and improve the processing efficiency of multi-issue high-performance processors.
Smart Images

Figure CN118295710B
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a spatial recovery method, device, equipment and medium for multi-port transmission. Background Art
[0002] With the rapid development of computer technology, the processing speed of computers is required to be higher and higher.
[0003] Generally, regardless of whether the processor is a sequential or out-of-order architecture, it executes instructions in the order of the program flow. For example, the classic five-stage pipeline processor architecture includes five pipeline stages: IF (Instruction Fetch), ID (Instruction Decode), EX (Execute), MEM (Memory Access), and WB (Write Back). The IF, ID, and EX pipeline stages are executed in a fixed order, while the instructions in the EX and MEM pipeline stages are executed out of order. The order of instructions determines the judgment of dependencies, which include resource dependencies and data dependencies. Among them, resource dependencies are often different instructions of the same type that preempt the same processing unit, or different memory access instructions that access the same address. Data dependencies are in the program order, including RAW (Readafter Write) dependencies and WAW (Write after Write) dependencies. Among them, RAW dependencies indicate that the execution of subsequent instructions requires the results of the previous instructions that have not been executed, and both WAW instructions must be written back to the same register.
[0004] Currently, ROB (Re-Order Buffer) is used to maintain the order and determine the dependency of instructions, that is, it is implemented using first-in-first-out. Instructions are allocated ROB space in the order of dispatch, and recycling is also linear recycling, that is, recycling is carried out in the order of space allocation.
[0005] However, in the current order preservation and dependency judgment mechanism, for instructions of different cycles, for example, multi-cycle multiplication instruction 1 allocates space early, and single-cycle addition instruction 2 allocates space late, instruction 1 that allocates space early has not been executed yet, while instruction 2 that allocates space late has been executed. This will cause instruction 2 to consume invalid waiting time before it can be written back. With the increasing use of dual-issue and multi-issue mechanisms, this situation will become more and more common, resulting in a large number of instructions in the pipeline stage waiting ineffectively, which will greatly affect the execution performance of the processor. Summary of the invention
[0006] Embodiments of the present application provide a method, apparatus, device, and medium for spatial recovery of multi-port transmission.
[0007] A first aspect of an embodiment of the present application provides a space recovery method for multi-port transmission, the method comprising: for a first instruction that has been executed, according to the space number of the information stack occupied by the first instruction, obtaining second information of the first instruction stored in the information stack; the second information indicates whether the first instruction is the instruction with the earliest logical execution order among instructions with the same rdidx (index of the destination register), the second information is determined based on a dispatched instruction sequence table, the dispatched instruction sequence table is used to store the logical execution sequence of each dispatched instruction and other dispatched instructions, and the dispatched instruction sequence table is updated when multi-port dispatches instructions; if the second information indicates that the first instruction is the instruction with the earliest logical execution sequence among instructions with the same rdidx, it is determined that there is no WAW dependency between the dispatched instruction and the first instruction, and the space number occupied by the first instruction and the space of the information stack occupied by the first instruction are immediately recovered.
[0008] In an optional embodiment of the present application, the recycling queue of the space number includes P idle numbers allocated and unused in the first cycle, P is a positive integer less than M, and M is the number of ports of the multi-port; the method also includes: determining the number P of numbers to be recycled and the first available recycling address; recycling the recycling addresses of the P idle numbers unused in the first cycle according to the number P of numbers to be recycled and the first available recycling address; saving the P numbers to be recycled to the corresponding recycling addresses; wherein the recycling address indicates the storage address of the number in the available list.
[0009] In an optional embodiment of the present application, after immediately reclaiming the space number occupied by the first instruction and the space in the information stack occupied by the first instruction, the method also includes: if all instructions that are earlier in logical execution order than the fourth instruction and whose rdidx is the same as the rdidx of the fourth instruction have been executed and the space numbers of the occupied information stack have been reclaimed, then the flag bit of the second information of the fourth instruction is updated to 1; wherein the first instruction is an instruction whose rdidx is the same as the rdidx of the fourth instruction, whose logical execution order is earlier than the logical execution order of the fourth instruction, and whose logical execution order is closest to the fourth instruction.
[0010] In an optional embodiment of the present application, after obtaining the second information of the first instruction stored in the information stack, the method also includes: if the second information indicates that the first instruction is not the earliest instruction in the logical execution order among the instructions with the same rdidx, it is determined that the first instruction has a WAW dependency relationship with other instructions, and the first instruction is controlled to continue waiting for release.
[0011] In an optional embodiment of the present application, after determining that the first instruction has a WAW dependency relationship with other instructions, the method further includes: continuing to determine whether there is an instruction in the dispatched instructions that has a WAW dependency relationship with a fifth instruction within the current cycle; the fifth instruction is an instruction that is executed after the first instruction is executed; if there is no instruction that has a WAW dependency relationship with the fifth instruction, immediately reclaiming the space number occupied by the fifth instruction and the space in the information stack occupied by the fifth instruction.
[0012] In an optional embodiment of the present application, the method further includes: after reclaiming the space occupied by the first instruction, writing the space number of the space occupied by the first instruction to the end of the available list.
[0013] In an optional embodiment of the present application, the dispatched instruction sequence table is an N-level table, which can store the logical execution sequence of N dispatched instructions, each row corresponds to the logical execution sequence of a dispatched instruction and other dispatched instructions, and N is a positive integer.
[0014] According to a second aspect of an embodiment of the present application, a space recovery device for multi-port transmission is provided, the device comprising: an acquisition module, a dependency judgment module and a recovery module; the acquisition module is used to acquire, for a first instruction that has been executed, second information of the first instruction stored in an information stack according to the space number of the information stack occupied by the first instruction; the second information indicates whether the first instruction is the instruction with the earliest logical execution order among the instructions with the same rdidx, the second information is determined based on a dispatched instruction sequence table, the dispatched instruction sequence table is used to store the logical execution sequence of each dispatched instruction and other dispatched instructions, and the dispatched instruction sequence table is updated when multi-port dispatches instructions; the dependency judgment module is used to determine that there is no WAW dependency between the dispatched instruction and the first instruction if the second information indicates that the first instruction is the instruction with the earliest logical execution order among the instructions with the same rdidx; the recovery module is used to immediately recover the space number occupied by the first instruction and the space of the information stack occupied by the first instruction.
[0015] In an optional embodiment of the present application, the recycling queue of the space number includes P idle numbers allocated and unused in the first cycle, P is a positive integer less than M, and M is the number of ports of the multi-port; the recycling module is also used to: determine the number P of numbers to be recycled and the first available recycling address; recycle the recycling addresses of the P idle numbers that are not used in the first cycle according to the number P of numbers to be recycled and the first available recycling address; save the P numbers to be recycled to the corresponding recycling addresses; wherein the recycling address indicates the storage address of the number in the available list.
[0016] In an optional embodiment of the present application, the space recovery device for multi-port transmission also includes: an update module; the update module is used to update the flag bit of the second information of the fourth instruction to 1 after the recovery module immediately reclaims the space number occupied by the first instruction and the space in the information stack occupied by the first instruction, if all instructions whose logical execution order is earlier than the fourth instruction and whose rdidx is the same as the rdidx of the fourth instruction have been executed and the space numbers of the occupied information stack have been recovered; wherein the first instruction is an instruction whose rdidx is the same as the rdidx of the fourth instruction, whose logical execution order is earlier than the logical execution order of the fourth instruction, and whose logical execution order is closest to the fourth instruction.
[0017] In an optional embodiment of the present application, the space recovery device for multi-port transmission also includes: a control module; a dependency judgment module is used to, after the acquisition module acquires the second information of the first instruction stored in the information stack, if the second information indicates that the first instruction is not the earliest instruction in the logical execution order among the instructions with the same rdidx, determine that the first instruction has a WAW dependency relationship with other instructions; a control module, used to control the first instruction to continue waiting for release.
[0018] In an optional embodiment of the present application, the dependency judgment module is also used to: after determining that the first instruction has a WAW dependency with other instructions, continue to determine whether there is an instruction in the dispatched instructions that has a WAW dependency with the fifth instruction within the current cycle; the fifth instruction is an instruction that is executed after the first instruction is executed; the recovery module is also used to: if there is no instruction that has a WAW dependency with the fifth instruction, reclaim the space number occupied by the fifth instruction and the space in the information stack occupied by the fifth instruction.
[0019] In an optional embodiment of the present application, the recycling module is further used to: after reclaiming the space occupied by the first instruction, write the space number of the space occupied by the first instruction to the end of the available list.
[0020] In an optional embodiment of the present application, the dispatched instruction sequence table is an N-level table, which can store the logical execution sequence of N dispatched instructions, each row corresponds to the logical execution sequence of a dispatched instruction and other dispatched instructions, and N is a positive integer.
[0021] According to a third aspect of an embodiment of the present application, a computer device is provided, including: a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of any of the above multi-port transmission space recovery methods are implemented.
[0022] According to a fourth aspect of the embodiments of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the spatial recovery method for multi-port transmission as described in any one of the above items are implemented.
[0023] In an embodiment of the present application, a space recovery method for multi-port transmission is provided. For a first instruction that has been executed, a processor obtains second information of the first instruction stored in the information stack based on the space number of the information stack occupied by the first instruction. The second information can indicate whether the first instruction is the instruction with the earliest logical execution order among the instructions with the same rdidx. If the second information indicates that the first instruction is the instruction with the earliest logical execution order among the instructions with the same rdidx, it can be determined that there is no WAW dependency between the dispatched instructions and the first instruction. Therefore, the space number occupied by the first instruction and the space in the information stack occupied by the first instruction can be immediately recovered. Since the second information is determined based on the dispatched instruction sequence table, the dispatched instruction sequence table is used to store the logical execution sequence of each dispatched instruction and other dispatched instructions, and the dispatched instruction sequence table is updated when multi-port dispatches instructions, it is possible to determine in advance whether each instruction is the earliest instruction in the same rdidx logical execution sequence based on the dispatched instruction sequence table, and store the corresponding indication information (i.e., the second information) in the information stack, so that within a single cycle, it is possible to quickly determine whether the instruction has a WAW dependency based on the second information directly, and in the absence of a WAW dependency, it can be released immediately, that is, the release of the space in the information stack occupied by the instruction is no longer released in a first-in-first-out order, that is, the release is out of order. Compared with the linear recovery mechanism used in the related art, it is no longer necessary to wait for the first-dispatched instruction to be released first, so the invalid waiting time can be reduced, so the execution efficiency of the instruction can be improved while ensuring the sequence of instructions, the logical delay is reduced, the circuit operating frequency is increased, and the processing efficiency of the multi-issue high-performance processor is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0025] Figure 1 A schematic diagram of a five-stage pipeline processor architecture in a related technology;
[0026] Figure 2 A schematic diagram of space allocation and order preservation principle in a related technology;
[0027] Figure 3 A flowchart of a spatial recycling method for multi-port transmission provided by an embodiment of the present application;
[0028] Figure 4 A schematic diagram of a multi-port space allocation / reclaim logic provided for one embodiment of the present application;
[0029] Figure 5 A flowchart of a spatial recycling method for multi-port transmission provided by an embodiment of the present application;
[0030] Figure 6 A schematic diagram of the structure of a spatial recovery device for multi-port transmission provided in one embodiment of the present application;
[0031] Figure 7 A schematic diagram of the structure of a spatial recovery device for multi-port transmission provided in one embodiment of the present application;
[0032] Figure 8 A schematic diagram of the structure of a spatial recovery device for multi-port transmission provided in one embodiment of the present application;
[0033] Fig. 9 A schematic diagram of the computer device structure provided for one embodiment of the present application. DETAILED DESCRIPTION
[0034] In the process of implementing the present application, the inventors discovered that the current way of reclaiming space in a processor has a significant impact on processor performance.
[0035] First, let's introduce the technical terms in the relevant technologies in detail here:
[0036] 1. Classic five-stage pipeline processor architecture
[0037] Figure 1 FIG. 1 is a schematic diagram of a five-stage pipeline processor architecture in a related technology. Figure 1 As shown in , it includes the following five pipeline stages. Among them: IF pipeline stage, responsible for reading instructions from memory. ID pipeline stage, responsible for identifying the type of instruction. EX pipeline stage, responsible for the operation of instructions; operation instructions get the results of the operation at this stage. MEM pipeline stage, responsible for accessing the memory; reading data from internal or external memory, or writing the execution results to the memory. WB pipeline stage, responsible for writing back the results; writing the results of instruction execution back to the processor's register stack for quick access next time.
[0038] like Figure 1 As shown in the figure, it is a classic five-stage pipeline workflow. The life cycle of some instructions will go through the above five-stage pipeline, or four of the five-stage pipeline (for example, some instructions do not need the WB pipeline stage, and some instructions do not need the MEM pipeline stage). If the instruction does not obtain all the data when entering the EX pipeline stage, or if any operand of the instruction does not get the correct data when entering the EX pipeline stage, then the instruction can only wait in the EX pipeline stage until the operand gets the data. This dependency between operands is called data dependency.
[0039] It should be noted that the method in the embodiments of the present application can be applied to a multi-stage pipeline processor architecture, such as the instruction execution of a processor with a five-stage or nine-stage pipeline.
[0040] 2. ROB order preservation and dependency judgment
[0041] In related technologies, ROB is usually used to judge the order preservation and dependency relationship of instructions. The principle is to use a FIFO (First In First Out) to achieve order preservation between instructions. For dual-issue, it is a two-write, one-read or multi-read FIFO.
[0042] Figure 2 A schematic diagram of space allocation and order preservation principle in a related technology is shown in FIG. Figure 2 As shown in , the entire ROB has 8 spaces, each numbered in sequence. Every time a new instruction is allocated, the allocation pointer increases by a corresponding value, pointing to the space number of the next free space. Similarly, every time an old instruction is executed, the release pointer increases by a corresponding value, pointing to the next space number that is about to be executed and released. Therefore, these 8 spaces will have 3 different states: space that has been executed and released, such as space 0; space that has been occupied but not yet released, such as space 1 to space 4; and space that is completely unused, such as space 5 to 7. This type of space that is completely unused will eventually be converted into the first type of space.
[0043] Due to the logic of the FIFO structure used, the instructions that are allocated space first must be earlier instructions. Such instructions are also the first to be executed and released. Figure 2In the example, the instruction represented by space 2 must be later than the instruction in space 1, but must be earlier than the instruction represented by space 3. This linear allocation-release mechanism automatically completes the order preservation work between instructions in principle. In this way, the resource dependency between instructions is also guaranteed. On this basis, it is also simple to check the dependency between data. Take the RAW dependency of the instruction represented by space 3 as an example. Since the order between instructions has been guaranteed by FIFO, the instruction only needs to check whether its operand rsidx is the same as all instructions earlier than it, that is, the destination rdidx of space 1 and 2. If the two are equal, then which space's rdidx is equal to indicates which space space 3 will depend on. At that time, you only need to check that instruction. If they are all equal, then select the instruction closer to 3, that is, the youngest instruction for the instruction in space 3, that is, instruction 2, as the destination instruction it depends on. For WAW dependencies, since the executed instructions release space linearly in FIFO order, that is, the order in which instructions are allocated, when the instructions in space 1 are not released, the instructions in space 2 are not allowed to be released, ensuring that the order in which instructions are executed is as expected.
[0044] As mentioned above, since the instructions in the above mechanism are recycled linearly, and in the processor pipeline, the execution cycles of different types of instructions are uncertain, such as single-cycle addition and subtraction instructions and multi-cycle multiplication and division instructions, which are completely dependent on the implementation of the microarchitecture. In this case, it is possible that the earlier multi-cycle instructions have not been executed, but the later single-cycle instructions have been executed and are waiting for write-back and space recycling. For dual-issue or even multi-issue processors, this situation will become more and more common. If the single-cycle instruction, regardless of whether it has WAW dependency, still needs to wait in sequence for the multi-cycle instruction to complete before it can be written back, then the subsequent single-cycle instructions will consume a lot of invalid waiting time. This will greatly affect the execution performance of the processor.
[0045] In view of the above problems, embodiments of the present application provide a method for allocating space for multi-port transmission and a method for recovering space for multi-port transmission.
[0046] On the one hand, in the space allocation method for multi-port transmission, the order of dispatched instructions is maintained through the dispatched instruction order table. After the multi-port dispatches the instruction, the space numbers of M free spaces are found from the available list, and then the RAW dependency between the current dispatched instruction and the dispatched instruction is determined based on the relevant information of the instruction and the dispatched instruction order table; finally, based on the space numbers of the M free spaces found, the relevant information of the current dispatched instruction is updated to the information stack, and the order relationship between the current dispatched instruction and the dispatched instruction is updated to the dispatched instruction order table. In the related art, in the scenario of multi-port transmission, if the space is allocated according to the original first-in-first-out method for a single port, it is necessary to first search the table to allocate space for the first instruction, and then search the table again based on the table updated after the first instruction is dispatched to allocate space for the second instruction. That is, if the first number of instructions are allocated in the related art, at least the first number of cycles are required to allocate space for the instructions. However, in the present application, under the multi-port transmission mechanism, the order of instructions is maintained through the dispatched instruction order relationship table. When the space of the instruction dispatch information stack is allocated after the instruction is dispatched, the first-in-first-out mechanism is no longer used. Instead, M free spaces are directly searched from the available list, that is, out-of-order allocation of space is allowed. Therefore, the allocation demand of instruction free space can be responded quickly, and M free spaces can be found to allocate to instructions, which shortens the waiting cycle caused by the search and reduces the waiting in the linear allocation mechanism, thereby reducing the impact on the operating frequency of the processor, and can increase the operating frequency of the logic circuit in the processor. While ensuring the order of instructions, the execution efficiency of the processor on instructions can be improved.
[0047] Secondly, for the executed first instruction, the processor obtains second information of the first instruction stored in the information stack based on the space number of the information stack occupied by the first instruction. The second information can indicate whether the first instruction is the instruction with the earliest logical execution order among the instructions with the same rdidx. If the second information indicates that the first instruction is the instruction with the earliest logical execution order among the instructions with the same rdidx, it can be determined that there is no WAW dependency between the dispatched instruction and the first instruction, and therefore the space number occupied by the first instruction and the space in the information stack occupied by the first instruction can be reclaimed immediately. Since the second information is determined based on the dispatched instruction sequence table, the dispatched instruction sequence table is used to store the logical execution sequence of each dispatched instruction and other dispatched instructions, and the dispatched instruction sequence table is updated when multi-port dispatches instructions, it is possible to determine in advance whether each instruction is the earliest instruction in the same rdidx logical execution sequence based on the dispatched instruction sequence table, and store the corresponding indication information (i.e., the second information) in the information stack, so that within a single cycle, it is possible to quickly determine whether the instruction has a WAW dependency based on the second information directly, and in the absence of a WAW dependency, it can be released immediately, that is, the release of the space in the information stack occupied by the instruction is no longer released in a first-in-first-out order, that is, the release is out of order. Compared with the linear recovery mechanism used in the related art, it is no longer necessary to wait for the first-dispatched instruction to be released first, so the invalid waiting time can be reduced, so the execution efficiency of the instruction can be improved while ensuring the sequence of instructions, the logical delay is reduced, the circuit operating frequency is increased, and the processing efficiency of the multi-issue high-performance processor is improved.
[0048] The solutions in the embodiments of the present application can be implemented using various computer languages, for example, the object-oriented programming language Java and the interpreted scripting language JavaScript.
[0049] In order to make the technical solutions and advantages in the embodiments of the present application more clearly understood, the exemplary embodiments of the present application are further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than an exhaustive list of all the embodiments. It should be noted that the embodiments in the present application and the features in the embodiments can be combined with each other without conflict.
[0050] Space Allocation Example
[0051] The following embodiments use the above-mentioned processor as the execution subject, and apply the method provided in the embodiments of the present application to a computer device supporting multi-port transmission, and specifically illustrate the processor supporting dual transmission as an example.
[0052] The space allocation method for multi-port transmission provided in the embodiment of the present application includes the following steps: after the multi-port dispatches the instruction, the processor searches for the space numbers of M free spaces from the available list. The processor determines the RAW dependency between the current dispatched instruction and the dispatched instruction based on the relevant information of the instruction and the dispatched instruction sequence table. The processor updates the relevant information of the current dispatched instruction into the information stack based on the space numbers of the M free spaces. The processor updates the sequence relationship between the current dispatched instruction and the dispatched instruction into the dispatched instruction sequence table based on the space numbers of the M free spaces. Wherein, M is the number of ports, and M is an integer greater than or equal to 2.
[0053] In an embodiment of the present application, an available list of space numbers of free space of an information stack is maintained in the processor, the available list includes space numbers for indicating free space of the information stack, and the information stack is used to store relevant information of dispatched instructions. The dispatched instruction indicates that space of the information stack has been allocated, and relevant information of the instruction is stored in the allocated space.
[0054] Exemplarily, the space numbers in the available list are arranged in order of recovery, that is, the earlier the space is recovered, the closer the space number is to the head of the queue in the available list, and the later the space is recovered, the closer the space number is to the end of the queue, that is, the space numbers in the available list are arranged in random order.
[0055] It should be noted that in the embodiment of the present application, the currently dispatched instruction includes at least one instruction. The dispatched instruction indicates the instruction in the pipeline stage, and the currently dispatched instruction (ie, the instruction to be dispatched) indicates the instruction waiting to enter the pipeline stage.
[0056] Exemplarily, the relevant information of the instruction may include at least one of the following:
[0057] (1) Whether the instruction requires the source operand register rsen;
[0058] Among them, if an instruction read register is enabled and requires n source operand registers, then the relevant information of the instruction includes n rsens, where n is a positive integer.
[0059] (2) The index of the instruction source operand register rsidx;
[0060] The read register index indicates the number of the source operand register.
[0061] (3) Whether the instruction needs to write to the destination register rdwen;
[0062] Among them, a field in the information stack is used to write the register enable information of the instruction.
[0063] (4) The instruction writes the index rdidx of the destination register.
[0064] Among them, a field in the information stack is used to write the destination register index of the instruction.
[0065] (5) Other relevant information, such as if the architecture supports floating-point instructions, a flag indicating whether the instruction needs to read or write a floating-point register, etc.
[0066] Specifically, in the step "the processor determines the RAW dependency between the current dispatched instruction and the dispatched instructions based on the relevant information of the instruction and the dispatched instruction sequence table", the dispatched instruction sequence table is used to store the logical execution sequence of each dispatched instruction and other dispatched instructions, and the dispatched instruction sequence table is updated when new instructions are dispatched on multiple ports.
[0067] It should be noted that in the embodiment of the present application, the search for the space number is performed after the multi-port dispatch instruction, and there is no necessary order of execution for the search for the space number of the free space and the RAW dependency judgment. They can be executed in parallel or one after the other. The embodiment of the present application does not make any specific limitation on this.
[0068] For example, in the embodiment of the present application, an Age Matrix module is provided in the processor to implement a dispatched instruction priority table, and the order of the dispatched instruction priority table can be updated as the number of dispatched instructions is updated, or it can be the sum of the number of spaces. For example, in a certain cycle, the pipeline includes N dispatched instructions, then the dispatched instruction priority table is an N-order table, and each table entry is 1 bit.
[0069] For example, in a certain cycle, the pipeline includes 4 dispatched instructions, so the dispatched instruction sequence table is a 4-stage table (4 4), indicating the logical execution order relationship between the four instructions. Each table entry is 1 bit. In the next cycle, the pipeline includes 5 dispatched instructions, so the dispatched instruction order relationship table is updated to a 5-level table (5 5), indicating the logical execution order relationship between the five instructions. Assuming that the maximum number of instructions in the pipeline stage is 8, the dispatched instruction order relationship table is a maximum of 8-level table (8 8).
[0070] In a possible example of the present application, specifically, the dispatched instruction sequence table is an N-order table, which can store the logical execution sequence of N dispatched instructions, and each row corresponds to the logical execution sequence of a dispatched instruction and other dispatched instructions, and N is a positive integer. For example, Table 1 is an exemplary table of a dispatched instruction sequence table provided in an embodiment of the present application, where N=4, with A [i][j]=1 means that the instructions in space i are older than the instructions in space j (it can also be defined as younger, which can be customized according to needs).
[0071] Table 1
[0072]
[0073] Exemplarily, in conjunction with Table 1, the first row in the age matrix (i.e., the order of dispatched instructions table) stores the order of the instructions in space 0 and other dispatched instructions. The instructions in space 0 are older than the instructions in space 1, the instructions in space 0 are older than the instructions in space 2, and the instructions in space 0 are older than the instructions in space 3, which means that among the four spaces, the instructions in space 0 are the oldest instructions among the dispatched instructions. The second row stores the order of the instructions in space 1 and other dispatched instructions. The instructions in space 1 are younger than the instructions in space 0, the instructions in space 1 are younger than the instructions in space 2, and the instructions in space 1 are younger than the instructions in space 3, which means that among the four spaces, the instructions in space 1 are the youngest instructions among the dispatched instructions. The third row stores the order of the instructions in space 2 and other dispatched instructions. The instructions in space 2 are younger than the instructions in space 0, older than the instructions in space 1, and younger than the instructions in space 3. The fourth row stores the order of the instructions in space 3 and other dispatched instructions. The instructions in space 3 are younger than the instructions in space 0, older than the instructions in space 1, and older than the instructions in space 2. That is, the first logical execution order is: space 0 is the youngest, space 2 is younger than space 3, and space 3 is younger than space 1. That is, as shown in Table 1, the logical execution order of the four instructions is: I0, I2, I3, I1. That is, I0 is executed first, I2 is second, I3 is third, and I1 is the latest.
[0074] It should be noted that the entries in the dispatched instruction sequence table are updated only when a new instruction is dispatched, and the updated address is the number of the allocated free address.
[0075] In the step "the processor updates the relevant information of the current dispatched instruction into the information stack according to the space number of the M free spaces", the relevant information of the current dispatched instruction includes all the information required to determine the RAW dependency and WAW dependency between the current dispatched instruction and all dispatched instructions.
[0076] In the step "the processor updates the order of the currently dispatched instruction and the dispatched instructions into the dispatched instruction order table according to the space numbers of the M free spaces", the processor updates the order of the instruction and other dispatched instructions into the row (or column) corresponding to the space number in the dispatched instruction order table according to the space number to which the instruction is dispatched. Optionally, after the processor finds the space numbers of the M free spaces, the relevant information of the currently dispatched instruction can be randomly updated into the information stack, or the relevant information of the currently dispatched instruction can be updated into the information stack according to the dispatch order or the logical execution order, which is not specifically limited in the embodiments of the present application.
[0077] There is no limit on the correspondence between instructions and free numbers, but one-to-one correspondence is the simplest mapping method. In addition, if the number of dispatched instructions is less than the free numbers, it means that there are excess free numbers and the recycling process needs to be started immediately.
[0078] Exemplarily, assuming that the logic execution order of the first instruction is first, the logic execution order of the second instruction is later, the first number is the number of the first free space from left to right in the available list, and the second number is the number of the second free space from left to right in the available list. The processor stores the relevant information of the first instruction in the space corresponding to the first number in the information stack, and stores the relevant information of the second instruction in the space corresponding to the second number in the information stack.
[0079] Specifically, the processor updates the order of the first instruction and other dispatched instructions in the row with the first number in the dispatched instruction order table, and updates the order of the second instruction and other dispatched instructions in the row with the second number in the dispatched instruction order table.
[0080] Figure 4 A multi-port space allocation / reclaim logic diagram is provided for one embodiment of the present application. Figure 4 As shown in , the available information list includes the space numbers of 24 spaces in the information stack, wherein the flag bit vid corresponding to the space number of the free space is set to 1, and the flag bit vid corresponding to the space number of the occupied space is set to 0. A space number corresponds to a space in the information stack, wherein a column in the information stack corresponds to a space, and a space may include multiple bits for storing different information of instructions. The age matrix stores the relative logical execution relationship between each instruction and other instructions. In the process of space allocation, the relevant information of the instructions stored in each space can be compared with the relevant information of the currently dispatched instruction, combined with the age matrix, to determine whether there is an instruction in all dispatched instructions that has a RAW dependency relationship with the currently dispatched instruction.
[0081] When free space is allocated, relevant information used for dependency judgment can be saved in the space of the information stack, and the relevant information can be kept unchanged at other times, thereby saving power consumption and improving the processing performance of the processor.
[0082] The embodiment of the present application provides a space allocation method based on multi-port transmission, which maintains the order of dispatched instructions through a dispatched instruction order relationship table. After the multi-port dispatches the instruction, the space numbers of M free spaces are found from the available list, and then the RAW dependency between the current dispatched instruction and the dispatched instruction is determined based on the relevant information of the instruction and the dispatched instruction order relationship table; finally, based on the space numbers of the M free spaces found, the relevant information of the current dispatched instruction is updated into the information stack, and the order relationship between the current dispatched instruction and the dispatched instruction is updated into the dispatched instruction order relationship table. In the related art, in the scenario of multi-port transmission, if the space is allocated according to the original first-in-first-out method for a single port, it is necessary to first search the table to allocate space for the first instruction, and then search the table again based on the table updated after the first instruction is dispatched to allocate space for the second instruction. That is, if the first number of instructions are allocated in the related art, at least the first number of cycles are required to allocate space for the instructions. However, in the present application, under the multi-port transmission mechanism, the order of instructions is maintained through the dispatched instruction order relationship table. When the space of the instruction dispatch information stack is allocated after the instruction is dispatched, the first-in-first-out mechanism is no longer used. Instead, M free spaces are directly searched from the available list, that is, out-of-order allocation of space is allowed. Therefore, the allocation demand of instruction free space can be responded quickly, and M free spaces can be found to allocate to instructions, which shortens the waiting cycle caused by the search and reduces the waiting in the linear allocation mechanism, thereby reducing the impact on the operating frequency of the processor, and can increase the operating frequency of the logic circuit in the processor. While ensuring the order of instructions, the execution efficiency of the processor on instructions can be improved.
[0083] In an optional embodiment of the present application, the information stack includes first information and second information of instructions; the first information of the first instruction indicates whether the first instruction is the latest instruction in the logical execution order among the instructions with the same rdidx; the second information of the first instruction indicates whether the first instruction is the earliest instruction in the logical execution order among the instructions with the same rdidx; the first instruction is any one of the instructions dispatched by multiple ports.
[0084] Exemplarily, two bits are added to the cache storing instruction information in the information stack to record the age status of the current instruction among all dispatched instructions. Among them, ygst (youngest) indicates that the current instruction is the youngest (i.e., the latest in logical execution order) among all instructions with the same rdidx, and edst (eldest) indicates that the current instruction is the oldest (i.e., the earliest in logical execution order) among all instructions with the same rdidx.
[0085] Based on this solution, the processor adds 2 bits in the cache of the information stack to record the age status of each instruction among all dispatched instructions at the current moment, so as to facilitate the rapid judgment of RAW relationships when allocating space for instructions, and the rapid judgment of WAW dependencies when the space occupied by instructions is reclaimed, thereby improving the processing speed of the processor.
[0086] In an optional embodiment of the present application, the above step of "the processor determines the RAW dependency relationship between the currently dispatched instruction and the dispatched instruction according to the relevant information of the instruction and the dispatched instruction sequence table" can be specifically performed by the following method 1 or the following method 2:
[0087] Method 1:
[0088] The processor determines a first set of instructions in the dispatched instructions whose target register index is the same as the operand of the currently dispatched instruction. The processor determines a second set of instructions in the first set whose logical execution order is earlier than the logical order of the currently dispatched instruction based on the dispatched instruction sequence table. The processor determines that the instruction in the second set that is closest to the logical execution order of the currently dispatched instruction is the instruction with which the currently dispatched instruction has a RAW dependency, otherwise the currently dispatched instruction does not have a RAW dependency.
[0089] The operands of the currently dispatched instruction may include at least one operand.
[0090] For example, if the operands of the first instruction include a first operand and a second operand, the processor needs to determine a set of instructions whose target register is the same as the first operand in the dispatched instructions (referred to as a first subset), and a set of instructions whose target register is the same as the second operand (referred to as a second subset). The following operation steps need to be performed for both the first subset and the second subset.
[0091] It can be understood that if there is no instruction in the dispatched instructions whose target register number is the same as the operand of the currently dispatched instruction, it is determined that there is no RAW dependency relationship between the currently dispatched instruction and all the dispatched instructions.
[0092] It can be understood that if there is no instruction in the first set whose logical execution order is earlier than the logical execution order of the currently dispatched instruction, it is determined that there is no RAW dependency relationship between the currently dispatched instruction and all the dispatched instructions.
[0093] It can be understood that the processor determines, based on the dispatched instruction sequence table, that the youngest instruction in the second set has a RAW dependency relationship with the currently dispatched instruction.
[0094] Based on this scheme, the processor can perform RAW dependency detection according to the dispatched instruction sequence table, the target register index of the dispatched instruction and the operand of the currently dispatched instruction. Specifically, the processor can first determine the first set of instructions whose index value of the target register in the dispatched instruction is the same as the operand of the currently dispatched instruction, and then determine whether there are instructions in the first set whose logical execution order is earlier than the logical execution order of the currently dispatched instruction. If the logical execution order of the instructions in the second set is earlier than the logical execution order of the currently dispatched instruction, and the index value of the target register is the same as the operand of the currently dispatched instruction, then based on the dispatched instruction sequence table, it is determined that the youngest instruction in the second set (that is, the instruction in the second set whose logical execution order is closest to the currently dispatched instruction) has a RAW dependency with the currently dispatched instruction.
[0095] Method 2:
[0096] The processor determines a first set of instructions in the dispatched instructions whose target register index is the same as the operand of the currently dispatched instruction. The processor determines, based on the ygst information of the dispatched instructions stored in the information stack, that the instruction in the first set whose logical execution order indicated by ygst is the latest is the instruction that has a RAW dependency relationship with the currently dispatched instruction.
[0097] Exemplarily, the processor uses the operand rsidx of the first instruction (the first instruction is any instruction in the currently dispatched instruction) to compare with the index value rdidx of the target register of all dispatched instructions to obtain a first set of all instructions that may have a RAW dependency relationship with the first instruction, recorded as set A, and then uses set A as a selection signal and uses the ygst information of all dispatched instructions to select the second instruction whose youngest rdidx is the same as the rdidx of A. The second instruction is the instruction that the currently dispatched first instruction depends on.
[0098] Based on this scheme, the processor can perform RAW dependency detection according to the first information of the instructions stored in the information stack, the target register index of the dispatched instruction and the operand of the currently dispatched instruction. Specifically, it can first determine the first set of instructions whose index value of the target register in the dispatched instruction is the same as the operand of the currently dispatched instruction, and then determine that the instruction with the latest logical execution order indicated by ygst in the first set is the instruction that has a RAW dependency with the currently dispatched instruction.
[0099] In an optional embodiment of the present application, the above-mentioned space allocation method for multi-port transmission may also include the following steps: if the number of currently dispatched instructions is less than M, the processor immediately adds the unused space numbers to the space number recycling queue of the free space.
[0100] It can be understood that when the number of instructions dispatched in this cycle is less than the number of ports, that is, there are cases where some transmitting ports have no valid instructions, there may be over-allocated free space numbers. The processor immediately adds these space numbers to the end of the free space number recycling queue, so that the unused space numbers can immediately enter the recycling process and re-enter the available list after one or more cycles to continue to participate in the allocation.
[0101] It should be noted that in the embodiment of the present application, each time the space number of the available space is searched, the search is performed according to the number of ports, which can avoid the increased processing time caused by searching according to the number of instructions and simplify the search steps.
[0102] Based on this solution, when some multi-transmit ports store undispatched instructions, after the relevant information of the instructions is stored in the free space, the space number of the unused free space is immediately added to the recycling process, so that it can be quickly recycled and added to the available list in time to facilitate the processor to continue to find available space for subsequently dispatched instructions, which can improve the utilization rate of the available space in the information stack.
[0103] In the embodiment of the present application, when a new instruction is dispatched, or when a dispatched instruction is executed and needs to be reclaimed, the ygst and edst corresponding to the instruction can be updated according to the Age Matrix.
[0104] In an optional embodiment of the present application, the above-mentioned multi-port transmission space allocation method also includes the following steps: when dispatching instructions, for the newly dispatched first instruction, if there is no instruction with a later logical execution order than the first instruction among all the instructions to be dispatched, the processor determines that the first instruction is the instruction with the latest logical execution order at the time of dispatch, updates the flag bit of the first information of the first instruction in the information stack to 1, and updates the flag bit of the first information of the dispatched instructions in the information stack that is the same as the rdidx of the first instruction to 0.
[0105] Furthermore, when dispatching a new instruction, the processor can determine whether the newly dispatched instruction is the instruction with the latest logical execution order, that is, the latest executed instruction among the instructions with the same rdidx at the current moment, and can indicate the age status of the instruction among all dispatched instructions, so as to judge the RAW dependency between instructions based on the flag bit of the first information.
[0106] Based on this scheme, when allocating space, it can be determined whether the currently dispatched instruction is the instruction with the latest logical execution order among the instructions with the same rdidx. If it is the latest, the flag position of the first information corresponding to the instruction can be set to 1, and the flag positions of other instructions with the same rdidx can be set to 0, so as to facilitate the subsequently dispatched instructions to quickly determine the instructions with RAW dependencies.
[0107] In an optional embodiment of the present application, the above-mentioned multi-port transmission space allocation method also includes the following steps: when dispatching instructions, for the newly dispatched first instruction, if there is no instruction with an earlier logical execution order among all the instructions to be dispatched that has the same rdidx as the first instruction, and there is no instruction with the same rdidx as the first instruction among the dispatched instructions, then the first instruction is determined to be the earliest instruction in the logical execution order at the time of dispatch, and the flag bit of the second information of the first instruction in the information stack is updated to 0, otherwise it is 1.
[0108] Similarly, when dispatching a new instruction, the processor can determine whether the newly dispatched instruction is the oldest instruction in the logical execution order, that is, the earliest executed instruction among the instructions with the same rdidx at the current moment, which can indicate the age status of the instruction among all dispatched instructions, so as to judge the WAW dependency between instructions based on the flag bit of the first information.
[0109] Based on this scheme, when allocating space, it can be determined whether the currently dispatched instruction is the instruction with the earliest logical execution order among the instructions with the same rdidx. If it is the earliest, the flag position of the second information corresponding to the instruction can be set to 1, and the flag positions of other instructions with the same rdidx can be set to 0, so as to facilitate the subsequent dispatched instructions to quickly determine the instructions with WAW dependencies.
[0110] In an optional embodiment of the present application, the space number values of the M free spaces are different; the current dispatched instruction includes M instructions, and the logical execution order of the first instruction among the M instructions is earlier than the logical execution order of the second instruction; further, the above-mentioned step "the processor updates the relevant information of the current dispatched instruction into the information stack according to the numbers of the M free spaces" may specifically include the following steps: the processor stores the relevant information of the first instruction in the space corresponding to the first number in the information stack, and stores the relevant information of the second instruction in the space corresponding to the second number in the information stack.
[0111] The first number is the number of the first free space among the M free spaces whose space numbers are from small to large, and the second number is the number of the second free space among the M free spaces whose space numbers are from small to large.
[0112] Based on this scheme, in the case of multi-port transmission, M instructions are dispatched in one cycle, and space numbers of M free spaces with different values are found from the available list. The processor stores the relevant information of the first instruction with an earlier logical execution order in the space corresponding to the first number with a smaller space number value in the information stack, and stores the relevant information of the second instruction with a later logical execution order in the space corresponding to the second number with a larger space number value in the information stack, so that space can be quickly allocated for the currently dispatched instruction. Compared with the method in the related art that the space allocation of the second instruction needs to be based on the allocation result of the first instruction, free space can be searched for the currently dispatched instructions transmitted by M ports in parallel, thereby improving the allocation efficiency of instruction space in the case of multi-port transmission.
[0113] In an optional embodiment of the present application, the space number values of the M free spaces are different, and the number of currently dispatched instructions K is less than M; that is, the M port dispatched K instructions in this cycle. Furthermore, the above step "the processor updates the relevant information of the currently dispatched instructions into the information stack according to the space numbers of the M free spaces" can specifically include the following steps: the processor stores the relevant information of the K instructions in the space corresponding to the K space numbers in the information stack, and immediately adds the MK space numbers to the number recycling queue of the free space.
[0114] The K space numbers are space numbers with smaller address index values in the available list among the M space numbers.
[0115] For example, 4 ports are transmitting, and the space numbers found by the processor from the free space are 0 (available list address 1), 2 (available list address 2), 1 (available list address 3), and 5 (available list address 4), and 3 instructions are dispatched. The processor can select the spaces corresponding to the three space numbers 0, 2, and 1 to store the relevant information of the 3 instructions.
[0116] Based on this scheme, if some of the multiple ports dispatch instructions, the processor stores the relevant information of the instruction in the free space corresponding to the smaller index value among the M available list address index values, and immediately adds the space number with the larger address index value to the free space recycling task, so that the space number of the unused free space can be recycled in time so that it can be found again in the next cycle, avoiding the decrease in the utilization rate of the free space caused by the existence of free space in the information stack and the failure to update the available list in time.
[0117] In an optional embodiment of the present application, the space numbers of the M free spaces are different values of J space numbers, J is less than M; the current dispatched instructions include L instructions, L is an integer greater than J and less than or equal to M, and the logical execution order of the first instruction is earlier than the logical execution order of other dispatched instructions; further, the above-mentioned step "the processor updates the relevant information of the current dispatched instruction into the information stack according to the space numbers of the M free spaces" may specifically include the following steps: the processor stores the relevant information of the J instructions in the space corresponding to the J space numbers in the information stack; and suspends the allocation of space for other instructions among the L instructions except the J instructions in this cycle.
[0118] Among them, the J instructions are instructions with an earlier logical execution order among the L instructions.
[0119] Exemplarily, the processor searches again for the space number of the available free space for the other instructions in the next cycle.
[0120] It can be understood that if space is allocated to other instructions dispatched this time in the next cycle, multiple ports may not dispatch instructions in the next cycle, or some ports may dispatch one instruction, or all ports may dispatch instructions. In the case that instructions are dispatched in the next cycle, the space numbers of free space are searched for the second instruction and the third instruction from the available list in the next cycle, wherein the third instruction is the instruction dispatched earlier.
[0121] Based on this scheme, when instructions are dispatched on multiple ports, if there are only J free space numbers in the available list of the current cycle, the processor will prioritize allocating space for instructions with an earlier logical execution order in this cycle, and will not allocate space for instructions with a later logical execution order in this cycle. In the next cycle, space will be reallocated for the instruction. This can enable priority dispatching of resources for instructions that are executed first when space resources are insufficient, thereby reducing the situation where other instructions that are dependent on instructions have to wait at the same time due to unnecessary waiting for instructions with urgent time limits, thereby improving the processing efficiency of the processor in this scenario.
[0122] In an optional embodiment of the present application, the space numbers of the M free spaces are all the first number, and the first number is the space number of the only free space in the available list; the current dispatch instruction includes the first instruction, that is, only one port dispatch instruction is given among the M ports in this cycle; furthermore, the above step "the processor updates the relevant information of the current dispatch instruction into the information stack according to the space numbers of the M free spaces" may specifically include the following steps: the processor stores the relevant information of the first instruction in the space corresponding to the first number in the information stack.
[0123] It should be noted that in the embodiment of the present application, regardless of whether the dispatched instruction is one instruction or two instructions, the search for free space begins in the available list, and the amount of search space is not determined based on the number of instructions. This can simplify the processing logic of the processor, and there is no need to determine the number of instructions each time before searching, which can improve the space allocation efficiency of multiple ports.
[0124] Based on this solution, only an index of a free space is found in this cycle, and only one port among multiple ports dispatches an instruction in this cycle, then the processor stores the relevant information of the instruction in the free space, and there is no need to find the indexes of M free spaces before allocating them. The allocation method is flexible, and space can be flexibly allocated for different scenarios.
[0125] It should be noted that, in actual applications, due to hardware mechanisms, some processors search through the information stack based on the relevant information of the stored instructions to determine whether the destination register of each dispatched instruction is the same as the destination register of the first instruction, and obtain a first set; the processor searches the age information stream of the first instruction from the age matrix to determine the first logical execution order of the first instruction and all dispatched instructions; then, based on the determined first set and the first logical execution order, it is determined that the destination register of an instruction is the same as the destination register of the first instruction, and the oldest instruction among the instructions with the same destination register in the logical execution order is the instruction that has a WAW relationship with the first instruction.
[0126] Based on this scheme, a dispatched instruction sequence relationship table is maintained in the processor, for example, it can be in the form of an age matrix or an age table. The dispatched instruction sequence relationship table maintains the logical execution sequence relationship between each dispatched instruction and all other dispatched instructions. When performing WAW dependency judgment, the logical execution order between instructions can be accurately obtained based on the dispatched instruction sequence relationship table, and then combined with the dispatched instructions with the same destination register as the first instruction and the logical execution order between instructions, it can be accurately determined whether there is an instruction that has a WAW dependency relationship with the first instruction, so that after the instruction is executed, it can be quickly determined whether the instruction can be released.
[0127] In an optional embodiment of the present application, after the step "the processor updates the order of the current dispatched instruction and the dispatched instruction in the dispatched instruction order table according to the space numbers of the M free spaces", the following steps can also be performed: after the space occupied by the first instruction is reclaimed, the space number of the space occupied by the first instruction is written to the end of the available list.
[0128] It can be understood that in the embodiment of the present application, the space number of the free space maintained in the available list is updated as the instructions are dispatched and recycled.
[0129] The first processing method: after the processor updates the relevant information of the first instruction to the first space of the information stack, the processor deletes the first space number corresponding to the first space in the available list; after the processor releases the relevant information of the first instruction from the first space of the information stack, the processor adds the first space number of the first space to the end of the available list.
[0130] The second processing method: after the processor updates the relevant information of the first instruction to the first space of the information stack, the processor sets the flag vld (Valid, valid flag) corresponding to the first space number corresponding to the first space in the available list to 0; after the processor releases the relevant information of the first instruction from the first space of the information stack, the processor sets the flag vld corresponding to the first space number of the first space to 1.
[0131] Based on this solution, after the processor reclaims the space of the information stack occupied by the instruction, the space number of the reclaimed space can be promptly added to the available list and updated in time to facilitate the search for free space when dispatching instructions in the next cycle, which can improve the processing efficiency of the processor that supports dual-issue.
[0132] Example 1:
[0133] The first step is to compare the operands rs1idx and rs2idx of instruction 1 with the destination register index rdidx of all dispatched instructions (including instruction 2, instruction 3, instruction 4 and instruction 5) to obtain a set A of all instructions that may have a RAW dependency relationship with instruction 1. Among them, set A-instruction 1: {instruction 2, instruction 3, instruction 5}. The second step is to obtain the first information of each instruction from the information stack, and determine which instruction in the instruction set B with ygst being 1 has the same rdidx as the rdidx of the first instruction, and which instruction is the instruction that has a RAW dependency relationship with instruction 1. Among them, set B includes: {instruction 1, instruction 2}; the third step is to determine whether there is a dispatched instruction based on set A and set B, the rdidx of the dispatched instruction is the same as the rsidx of instruction 1, and ygst is 1. It is determined that instruction 2 exists, and instruction 1 and instruction 2 have a RAW dependency relationship.
[0134] Space Reclamation Example
[0135] See also Figure 3 , Figure 3This is a flowchart of a multi-port transmission space recovery method provided by an embodiment of the present application. The following embodiments use the above-mentioned processor as the execution subject, and apply the method provided by the embodiment of the present application to a computer device supporting multi-port transmission, which is used to specifically illustrate the processor supporting multi-transmission as an example. The multi-port transmission space recovery method provided by the embodiment of the present application includes the following steps 301 and 302:
[0136] Step 301: For a first instruction that has been executed, the processor obtains second information of the first instruction stored in an information stack according to the space number of the information stack occupied by the first instruction.
[0137] In the embodiment of the present application, the executed instruction can wait for recycling. It should be noted that the description of the relevant information of the instruction stored in the information stack can refer to the description in the above embodiment, which will not be repeated here. Specifically, the first information and the second information are determined based on the dispatched instruction sequence table.
[0138] Step 302: If the second information indicates that the first instruction is the earliest instruction in the logical execution order among the instructions with the same rdidx, the processor determines that there is no WAW dependency between the dispatched instructions and the first instruction, and immediately reclaims the space number occupied by the first instruction and the space of the information stack occupied by the first instruction.
[0139] Combination Figure 4 During the space recovery process, it is possible to determine, based on the relevant information of the instructions stored in the space, whether the second information of the instruction to be recovered indicates whether the instruction to be recovered is the earliest instruction in the logical execution order among multiple instructions of the same rdidx, thereby determining whether there is an instruction among all the dispatched instructions that has a WAW dependency relationship with the currently dispatched instruction.
[0140] An embodiment of the present application provides a space recovery method for multi-port transmission. For a first instruction that has been executed, a processor obtains second information of the first instruction stored in an information stack based on the space number of the information stack occupied by the first instruction. The second information can indicate whether the first instruction is the instruction with the earliest logical execution order among instructions with the same rdidx. If the second information indicates that the first instruction is the instruction with the earliest logical execution order among instructions with the same rdidx, it can be determined that there is no WAW dependency relationship between the dispatched instructions and the first instruction. Therefore, the space number occupied by the first instruction and the space in the information stack occupied by the first instruction can be immediately recovered. Since the second information is determined based on the dispatched instruction sequence table, the dispatched instruction sequence table is used to store the logical execution sequence of each dispatched instruction and other dispatched instructions, and the dispatched instruction sequence table is updated when multi-port dispatches instructions, it is possible to determine in advance whether each instruction is the earliest instruction in the same rdidx logical execution sequence based on the dispatched instruction sequence table, and store the corresponding indication information (i.e., the second information) in the information stack, so that within a single cycle, it is possible to quickly determine whether the instruction has a WAW dependency based on the second information directly, and in the absence of a WAW dependency, it can be released immediately, that is, the release of the space in the information stack occupied by the instruction is no longer released in a first-in-first-out order, that is, the release is out of order. Compared with the linear recovery mechanism used in the related art, it is no longer necessary to wait for the first-dispatched instruction to be released first, so the invalid waiting time can be reduced, so the execution efficiency of the instruction can be improved while ensuring the sequence of instructions, the logical delay is reduced, the circuit operating frequency is increased, and the processing efficiency of the multi-issue high-performance processor is improved.
[0141] In an optional embodiment of the present application, the recycling queue of the space number includes P idle numbers allocated and unused in the first cycle, where P is a positive integer less than M, and M is the number of ports of the multi-port. The above method may also include the following steps 303 to 305:
[0142] Step 303: The processor determines the number P of serial numbers to be recycled and the first available recycling address.
[0143] Step 304: The processor reclaims the reclaim addresses of P idle numbers that were not used in the first cycle according to the number P of numbers to be reclaimed and the first available reclaim address.
[0144] Step 305: The processor saves the P numbers to be recycled into corresponding recycling addresses.
[0145] The recycling address indicates the storage address of the number in the available list.
[0146] Based on this scheme, after multi-ports dispatch instructions, when not every port has dispatched instructions, when there are idle numbers that are not used when allocating space, the processor can immediately add the unused space numbers to the recycling queue. Specifically, the number of space numbers to be recycled and the first available recycling address can be determined first. Since the idle numbers are obtained in the order of first-in-first-out FIFO when multi-ports dispatch instructions, other addresses that need to be recycled can be quickly obtained according to the first recyclable address and the number of recycled space numbers, so that the idle numbers can be quickly recycled.
[0147] In an embodiment of the present application, when a new instruction is dispatched, or when an already dispatched instruction is executed and needs to be reclaimed, the ygst and edst corresponding to the instruction can be updated according to the Age Matrix.
[0148] In an optional embodiment of the present application, after the above step 302, that is, after the space of the information stack occupied by the first instruction is reclaimed, the following step 306 may be further included:
[0149] Step 306: If all instructions whose logical execution order is earlier than that of the fourth instruction and whose rdidx is the same as that of the fourth instruction have been executed and the space numbers of the occupied information stack have been recovered, the processor updates the flag bit of the second information of the fourth instruction to 1.
[0150] The first instruction is an instruction having the same rdidx as the fourth instruction, an earlier logical execution order than the fourth instruction, and a logical execution order closest to the fourth instruction.
[0151] Based on this scheme, the rdidx of the first instruction and the fourth instruction are the same, the first instruction is logically executed earlier than the fourth instruction, and the logical execution order of the first instruction and the fourth instruction is the closest instruction among multiple instructions with the same rdidx. Then, after the first instruction is recycled, the fourth instruction is the oldest instruction among the instructions with the same rdidx. Therefore, the flag position of the second information of the fourth instruction can be updated to 1, so that when the fourth instruction is recycled, it can be quickly determined whether the fourth instruction has a WAW dependency, thereby improving the recycling efficiency of the processor.
[0152] In an optional embodiment of the present application, after the above step 301, the following step 307 may also be included:
[0153] Step 307: If the second information indicates that the first instruction is not the earliest instruction in the logical execution order among the instructions with the same rdidx as the first instruction, the processor determines that the first instruction has a WAW dependency relationship with the dispatched instructions, and controls the first instruction to continue waiting for release.
[0154] Based on this scheme, when the second information indicates that the first instruction is not the earliest instruction in the logical execution order among the instructions with the same rdidx as the first instruction, it is determined that the first instruction has an instruction with a WAW dependency relationship. Therefore, there is no need to determine which specific instruction it depends on, and the first instruction can be directly controlled to continue waiting for release, thereby improving the processing effect of the processor.
[0155] In an optional embodiment of the present application, after the above step 307, the following steps 308 and 309 may also be included:
[0156] Step 308: The processor continues to determine whether there is any instruction in the dispatched instructions that has a WAW dependency relationship with the fifth instruction in this cycle.
[0157] The fifth instruction is an instruction that is executed after the first instruction is executed.
[0158] Step 309: If there is no instruction that has a WAW dependency relationship with the fifth instruction, immediately reclaim the space number occupied by the fifth instruction and the space of the information stack occupied by the fifth instruction.
[0159] It should be noted that different instructions have different execution cycles, and an instruction that is executed earlier in the order of execution may not necessarily be completed earlier than an instruction that is executed later.
[0160] It should be noted that in an embodiment of the present application, when the processor determines that the currently executed instruction has a WAW dependency, it can promptly determine whether other instructions have a WAW dependency, without waiting for the instructions in the execution order to release space first, thereby reducing the waiting time for instruction release.
[0161] Specifically, the processor immediately adds the space number of the information stack occupied by the fourth instruction to the available list.
[0162] Based on this solution, when the processor determines that the first instruction has a WAW dependency relationship with the instructions in the dispatched instructions, the processor can continue to determine whether other instructions that have been executed can be recycled, that is, directly determine whether the next instruction executed after the first instruction meets the recycling condition. There is no need to wait for the first instruction to be recycled before recycling the fifth instruction, which can avoid invalid waiting for instructions. The processor can quickly recycle the space of instructions and release the space in time, thereby improving the space allocation efficiency of instructions, improving the efficiency of the processor in executing instructions, and improving the space utilization of the information stack.
[0163] In an optional embodiment of the present application, after the above step 302, the following step 310 may also be included:
[0164] Step 310: After reclaiming the space occupied by the first instruction, the processor writes the space number of the space occupied by the first instruction to the end of the available list.
[0165] It can be understood that in the embodiment of the present application, the space number of the free space maintained in the available list is updated as the instructions are dispatched and recycled.
[0166] The first processing method: after the processor updates the relevant information of the first instruction to the first space of the information stack, the processor deletes the first space number corresponding to the first space in the available list; after the processor releases the relevant information of the first instruction from the first space of the information stack, the processor adds the first space number of the first space to the end of the available list.
[0167] The second processing method: after the processor updates the relevant information of the first instruction to the first space of the information stack, the processor sets the flag bit vld corresponding to the first space number corresponding to the first space in the available list to 0 (it can also be set to 1, which can be selected as needed); after the processor releases the relevant information of the first instruction from the first space of the information stack, the processor sets the flag bit vld corresponding to the first space number of the first space to 1 (it can also be set to 0, which can be selected as needed).
[0168] Based on this solution, after the processor reclaims the space of the information stack occupied by the instruction, the space number of the reclaimed space can be promptly added to the available list and updated in time to facilitate the search for free space when dispatching instructions in the next cycle, which can improve the processing efficiency of the processor that supports multiple launches.
[0169] In an optional embodiment of the present application, the processor may also recycle space in the following recycling manner for the space allocation manner of multi-port transmission: Figure 5 The flowchart of the spatial recovery method of multi-port transmission provided by an embodiment of the present application specifically includes the following steps 501 to 503:
[0170] Step 501: The processor determines, for a first instruction that has been executed, a third set of instructions whose destination register index is the same as the destination register index of the first instruction in the dispatched instructions according to relevant information of the instructions stored in the information stack.
[0171] It can be understood that if there is no instruction in the dispatched instructions whose destination register is the same as the destination register of the first instruction, it is determined that there is no WAW dependency relationship between the first instruction and other dispatched instructions.
[0172] Step 502: The processor has dispatched an instruction sequence table to determine whether there is a fourth set of instructions in the third set that are earlier in logical execution order than the first instruction.
[0173] Step 503: If there is no instruction in the third set that is earlier in logical execution order than the first instruction, the processor determines that there is no WAW dependency between the dispatched instructions and the first instruction, and immediately reclaims the space number occupied by the first instruction and the space of the information stack occupied by the first instruction.
[0174] Based on this scheme, the logical execution order of the dispatched instructions is maintained through the dispatched instruction order relationship table. For the first instruction that has been executed, according to the relevant information of the instructions stored in the information stack, a third set of instructions in the dispatched instructions whose destination register index is the same as the destination register index of the first instruction is determined; then, according to the dispatched instruction order relationship table, it is determined whether there is a fourth set of instructions in the third set that are earlier in logical order than the first instruction. If there is no instruction in the third set that is earlier in logical execution order than the first instruction, there is no instruction that has a WAW dependency relationship with the first instruction, and the processor immediately reclaims the space number occupied by the first instruction and the space in the information stack occupied by the first instruction. That is, after detecting that an instruction has been executed, the processor can complete the judgment of the WAW dependency between the instruction and other instructions based on the dispatched instruction sequence table and instruction-related information within a single cycle. If the instruction has no WAW dependency with the dispatched instruction, it can be released immediately. In other words, the space in the information stack occupied by the instruction is no longer released in first-in-first-out order, that is, the release is out of order. Compared with the linear recovery mechanism used in related technologies, there is no need to wait for the earlier dispatched instruction to be released first, so the invalid waiting time can be reduced. Therefore, the execution efficiency of the instruction can be improved while ensuring the sequence of instructions, with less logical delay, higher circuit operating frequency, and better processing efficiency of multi-issue high-performance processors.
[0175] In an optional embodiment of the present application, the above step 502 can be specifically performed by the following steps 502a and 502b:
[0176] Step 502a: The processor obtains a first logical execution order relationship between the first instruction and all other dispatched instructions from the dispatched instruction order relationship table.
[0177] Specifically, the logical execution order relationship between instructions can be determined based on the dispatched instruction order relationship table in combination with the corresponding description in Table 1, which will not be elaborated here.
[0178] Step 502b: The processor determines, based on the logical execution order of the third set and the first instruction, whether there is a fourth set of instructions in the third set that are earlier in the logical execution order than the first instruction.
[0179] Furthermore, if the fourth set exists, the processor determines that there is an instruction that has a WAW dependency relationship with the first instruction; if the fourth set does not exist, the processor determines that there is no instruction that has a WAW dependency relationship with the first instruction.
[0180] Based on this scheme, a dispatched instruction sequence relationship table is maintained in the processor, for example, it can be in the form of an age matrix or an age table. The dispatched instruction sequence relationship table maintains the logical execution sequence relationship between each dispatched instruction and all other dispatched instructions. When performing WAW dependency judgment, the logical execution order between instructions can be accurately obtained based on the dispatched instruction sequence relationship table, and then combined with the dispatched instructions with the same destination register as the first instruction and the logical execution order between instructions, it can be accurately determined whether there is an instruction that has a WAW dependency relationship with the first instruction, so that after the instruction is executed, it can be quickly determined whether the instruction can be released.
[0181] In an optional embodiment of the present application, after the above step 502, the following step 504 may also be included:
[0182] Step 504: If it is found that there is a first instruction in the third set whose logical execution order is earlier than the first instruction, the processor determines that there is a WAW dependency relationship between the first instruction and other dispatched instructions, stops searching, and controls the first instruction to continue waiting for release.
[0183] It can be understood that if there are instructions with the same destination register index as the first instruction, and among these instructions there are instructions whose execution order is earlier than the first instruction, it means that there is a WAW dependency relationship between the instructions and the first instruction. Therefore, although the first instruction has been executed, the space in the information stack occupied by the first instruction cannot be reclaimed.
[0184] Exemplarily, the logical execution order relationship between the first instruction and other dispatched instructions can be judged based on the value in the row corresponding to the space occupied by the first instruction in the age matrix. By combining the third set and the logical execution order relationship, it can be determined that there are instructions among the other dispatched instructions whose execution order is earlier than the first instruction and whose destination register is the same as the destination register of the first instruction. In the case of not being sure which specific instruction has a WAW dependency relationship with the first instruction, it can be quickly determined that the instruction will not be recycled.
[0185] Based on this solution, the processor can determine that there is a first instruction that is earlier than the first instruction among the instructions with the same target register as the first instruction based on querying the dispatched instruction sequence table. The processor can then determine that the first instruction has a WAW relationship with other instructions. Therefore, the processor does not need to determine which specific instruction has a WAW dependency relationship and no longer needs to continue querying. The first instruction can be controlled to continue waiting for release, thereby improving the processing efficiency of the processor.
[0186] In an optional embodiment of the present application, the instruction to be recycled includes a first instruction and a sixth instruction, and the sixth instruction is an instruction executed after the first instruction. Then the above method may include the following steps:
[0187] In the same recovery cycle, the processor determines whether there is an instruction in the dispatched instructions that has a WAW dependency relationship with the first instruction, and determines whether there is an instruction in the dispatched instructions that has a WAW dependency relationship with the sixth instruction. If the first instruction has a WAW dependency relationship with other dispatched instructions, and no instruction has a WAW dependency relationship with the sixth instruction, the processor will no longer continue to query for the first instruction, control the first instruction to continue to wait for release, and immediately reclaim the space number occupied by the sixth instruction and the space of the information stack occupied by the sixth instruction.
[0188] It should be noted that different instructions have different execution cycles, and an instruction that is executed earlier in the order of execution may not necessarily be completed earlier than an instruction that is executed later.
[0189] It should be noted that in an embodiment of the present application, when the processor determines that the currently executed instruction has a WAW dependency, it does not affect the recovery of other instructions. It can promptly determine whether other instructions have a WAW dependency without waiting for the instructions in the execution order to release space first, thereby reducing the waiting time for instruction release.
[0190] Specifically, the processor immediately adds the space number of the information stack occupied by the sixth instruction to the available list.
[0191] Based on this solution, when the execution of an instruction includes multiple instructions, the processor can execute the recovery process in parallel and synchronously. When the processor determines that the first instruction has a WAW dependency relationship with the instructions in the dispatched instructions, it will not affect the recovery of other instructions in the cycle. That is, the processor can simultaneously determine whether the multiple instructions that have been executed can be recovered, that is, it can simultaneously determine whether the multiple instructions that have been executed have a WAW dependency relationship with other dispatched instructions. There is no need to wait for the first instruction to be recovered before the sixth instruction is recovered, which can avoid invalid waiting for instructions. The processor can quickly recover the space of instructions, release space in time, improve the space allocation efficiency of instructions, improve the efficiency of the processor in executing instructions, and improve the space utilization of the information stack.
[0192] In an optional embodiment of the present application, the executed instruction includes multiple instructions, and the first instruction is one of the multiple instructions. The above method may include the following steps:
[0193] After determining that there is a fourth set of instructions in the third set that are earlier in logical execution order than the first instruction, the processor determines that the instruction with the latest logical execution order in the fourth set has a WAW dependency relationship with the first instruction. If the instruction with the latest logical execution order in the fourth set is one of the multiple instructions, the processor determines to reclaim the space number occupied by the first instruction and the space of the information stack occupied by the first instruction.
[0194] It can be understood that the instructions with the same destination register address as the first instruction may include multiple instructions that are earlier in logical execution order than the first instruction. Therefore, the youngest instruction (i.e., the latest in logical execution order) among the multiple instructions can be determined as the instruction that has a WAW dependency relationship with the first instruction.
[0195] It should be noted that, in actual applications, due to hardware mechanisms, some processors search for relevant information based on stored instructions in the information stack to determine whether the destination register of each dispatched instruction is the same as the destination register of the first instruction, and obtain a third set of instructions with the same destination register; the processor searches for the age information stream of the first instruction from the age matrix, and determines the first logical execution order of the first instruction and all dispatched instructions; then, based on the determined third set and the first logical execution order, it is determined that the destination register of an instruction is the same as the destination register of the first instruction, and the logical execution order is that the youngest instruction among the instructions with the same destination register is the instruction that has a WAW relationship with the first instruction.
[0196] Based on this scheme, when the executed instruction includes multiple instructions, the processor can execute the recycling process in parallel and synchronously. When the processor determines that the first instruction has a WAW dependency relationship with the first instruction in the dispatched instructions, the processor can determine whether the instruction that has a WAW dependency relationship with the first instruction is an instruction in the multiple instructions that have been executed within the clock cycle. If so, the first instruction can be recycled within the current clock cycle, that is, not only can it be simultaneously determined whether the multiple instructions that have been executed have a WAW dependency relationship with other dispatched instructions, but also when the dependent instructions are also executed instructions, there is no need to wait for the instructions that the first instruction depends on to be recycled before recycling the first instruction, which can avoid invalid waiting of instructions. The processor can quickly recycle the space of instructions, release space in time, improve the space allocation efficiency of instructions, improve the efficiency of processor execution of instructions, and improve the space utilization of the information stack.
[0197] Example 2:
[0198] The first step is to determine whether the edst of instruction 1 stored in the information stack is set to 1 for the executed instruction 1 according to the space number 1 in the information stack occupied by instruction 1. The second step is to determine whether the edst of instruction 1 stored in the information stack is set to 1 for the space number 1 in the information stack occupied by instruction 1. The second step is to determine whether the edst of instruction 1 is set to 1, which means that instruction 1 is the oldest instruction in the instructions of rdidx1 and instruction 1 does not have any WAW dependency. Therefore, the space 1 in the information stack occupied by instruction 1 can be released and the space number 1 can be written to the end of the queue in the available list. The third step is to determine whether the edst of instruction 1 is set to 0, which means that instruction 1 is not the oldest instruction in the instructions of rdidx1 and instruction 1 has any WAW dependency. Therefore, instruction 1 can be temporarily not released.
[0199] It should be understood that, although the various steps in the flow chart are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the figure may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
[0200] See also Figure 6 , Figure 6 A schematic diagram of the structure of a space recovery device for multi-port transmission provided for an embodiment of the present application, the space recovery device 600 for multi-port transmission includes: an acquisition module 601, a dependency judgment module 602 and a recovery module 603; the acquisition module 601 is used to obtain, for a first instruction that has been executed, second information of the first instruction stored in the information stack according to the space number of the information stack occupied by the first instruction; the second information indicates whether the first instruction is the instruction with the earliest logical execution order among the instructions with the same rdidx, and the second information is determined based on a dispatched instruction sequence table, the dispatched instruction sequence table is used to store the logical execution sequence of each dispatched instruction and other dispatched instructions, and the dispatched instruction sequence table is updated when multi-port dispatches instructions; the dependency judgment module 602 is used to determine that there is no WAW dependency between the dispatched instruction and the first instruction if the second information indicates that the first instruction is the instruction with the earliest logical execution order among the instructions with the same rdidx; the recovery module 603 is used to immediately reclaim the space number occupied by the first instruction and the space of the information stack occupied by the first instruction.
[0201] In an optional embodiment of the present application, the recycling queue of the space number includes P idle numbers allocated and unused in the first cycle, P is a positive integer less than M, and M is the number of ports of the multi-port; the recycling module 603 is also used to: determine the number P of numbers to be recycled and the first available recycling address; recycle the recycling addresses of the P idle numbers that are not used in the first cycle according to the number P of numbers to be recycled and the first available recycling address; save the P numbers to be recycled to the corresponding recycling addresses; wherein the recycling address indicates the storage address of the number in the available list.
[0202] In an optional embodiment of the present application, in combination with Figure 6 ,like Figure 7 As shown in, the multi-port transmission space recovery device 600 also includes: an update module 604; the update module 604 is used to update the flag bit of the second information of the fourth instruction to 1 after the recovery module 603 immediately recovers the space number occupied by the first instruction and the space of the information stack occupied by the first instruction, if all instructions that are earlier in logical execution order than the fourth instruction and whose rdidx is the same as the rdidx of the fourth instruction have been executed and the space numbers of the occupied information stack have been recovered; wherein the first instruction is an instruction whose rdidx is the same as the rdidx of the fourth instruction, whose logical execution order is earlier than the logical execution order of the fourth instruction, and whose logical execution order is closest to the fourth instruction.
[0203] In an optional embodiment of the present application, Figure 8 As shown in, the multi-port transmission space recovery device 600 also includes: a control module 605; the dependency judgment module 602 is also used to, after the acquisition module 601 acquires the second information of the first instruction stored in the information stack, if the second information indicates that the first instruction is not the earliest instruction in the logical execution order among the instructions with the same rdidx, then determine that the first instruction has a WAW dependency relationship with other instructions; the control module 605 is used to control the first instruction to continue waiting for release.
[0204] In an optional embodiment of the present application, the dependency judgment module 602 is also used to: after determining that the first instruction has a WAW dependency with other instructions, continue to determine whether there is an instruction in the dispatched instructions that has a WAW dependency with the fifth instruction within the current cycle; the fifth instruction is an instruction that is executed after the first instruction is executed; the recycling module 603 is also used to: if there is no instruction that has a WAW dependency with the fifth instruction, reclaim the space number occupied by the fifth instruction and the space in the information stack occupied by the fifth instruction.
[0205] In an optional embodiment of the present application, the recycling module 603 is further used to: after the space occupied by the first instruction is recycled, write the space number of the space occupied by the first instruction to the end of the available list.
[0206] In an optional embodiment of the present application, the dispatched instruction sequence table is an N-level table, which can store the logical execution sequence of N dispatched instructions, each row corresponds to the logical execution sequence of a dispatched instruction and other dispatched instructions, and N is a positive integer.
[0207] It should be noted that the multi-port space recovery device can achieve the effects in the above method embodiments, which will not be described in detail here.
[0208] For the specific definition of the above-mentioned space recovery device based on multi-port transmission, please refer to the definition of the space recovery method based on multi-port transmission above, which will not be repeated here. The various modules in the above-mentioned space recovery device based on multi-port transmission can be implemented in whole or in part through software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0209] In one embodiment, a computer device is provided, the internal structure diagram of which can be as follows: Fig. 9 As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a space recovery method based on multi-port transmission as described above is implemented.
[0210] In one embodiment, a computer device is provided, including: a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, any step in the above-mentioned space recovery method based on multi-port transmission is implemented.
[0211] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, any step in the above-mentioned spatial recycling method based on multi-port transmission can be implemented.
[0212] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0213] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0214] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0215] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0216] Although the preferred embodiments of the present application have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.
[0217] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A spatial recovery method for multi-port transmission, characterized in that: The method comprises: For a first instruction that has been executed, second information of the first instruction stored in the information stack is obtained according to the space number of the information stack occupied by the first instruction; the second information indicates whether the first instruction is the instruction with the earliest logical execution order among the instructions with the same destination register index rdidx, and the second information is determined based on a dispatched instruction sequence table, the dispatched instruction sequence table is used to store the logical execution sequence of each dispatched instruction and other dispatched instructions, and the dispatched instruction sequence table is updated when multi-port dispatch instructions; If the second information indicates that the first instruction is the earliest instruction in the logical execution order among the instructions with the same rdidx, it is determined that there is no write-after-write WAW dependency relationship between the dispatched instructions and the first instruction, and the space number occupied by the first instruction and the space of the information stack occupied by the first instruction are immediately reclaimed; If the second information indicates that the first instruction is not the earliest instruction in the logical execution order among the instructions with the same rdidx, it is determined that the first instruction has a WAW dependency relationship with the dispatched instruction, and the process continues to wait for the space number occupied by the first instruction and the space in the information stack occupied by the first instruction to be reclaimed.
2. The method according to claim 1, characterized in that The method further comprises: When there are idle numbers that are not in use during space allocation, determine the number of numbers to be recycled and the first recyclable address; Reclaim unused idle numbers based on the number of numbers to be reclaimed and the first reclaimable address.
3. The method according to claim 1, characterized in that After immediately reclaiming the space number occupied by the first instruction and the space of the information stack occupied by the first instruction, the method further includes: If all instructions that are earlier in logical execution order than the fourth instruction and whose rdidx is the same as the rdidx of the fourth instruction have been executed and the space numbers of the occupied information stack have been recovered, then the flag bit of the second information of the fourth instruction is updated to 1; The first instruction is an instruction whose rdidx is the same as the rdidx of the fourth instruction, whose logical execution order is earlier than the logical execution order of the fourth instruction, and whose logical execution order is closest to the fourth instruction.
4. The method according to claim 1, characterized in that: After determining that the first instruction has a WAW dependency relationship with the dispatched instruction, the method further includes: Continue to determine in the first cycle whether there is an instruction in the dispatched instructions that has a WAW dependency relationship with a fifth instruction; the fifth instruction is an instruction that is executed after the first instruction is executed; If there is no instruction having a WAW dependency relationship with the fifth instruction, the space number occupied by the fifth instruction and the space of the information stack occupied by the fifth instruction are immediately reclaimed.
5. The method according to any one of claims 1 to 4, characterized in that The method further comprises: After the space occupied by the first instruction is reclaimed, the space number of the space occupied by the first instruction is written to the end of the available list, and the available list includes the space number for indicating the free space of the information stack.
6. The method according to claim 1, characterized in that The dispatched instruction sequence table is an N-order table, which can store the logical execution sequence of N dispatched instructions, each row corresponds to the logical execution sequence of a dispatched instruction and other dispatched instructions, and N is a positive integer.
7. A spatial recovery device for multi-port transmission, characterized in that: The multi-port transmission space recovery device comprises: an acquisition module, a dependency relationship judgment module and a recovery module; The acquisition module is used to acquire, for the executed first instruction, second information of the first instruction stored in the information stack according to the space number of the information stack occupied by the first instruction; the second information indicates whether the first instruction is the instruction with the earliest logical execution order among the instructions with the same destination register index rdidx, the second information is determined based on a dispatched instruction sequence table, the dispatched instruction sequence table is used to store the logical execution sequence of each dispatched instruction and other dispatched instructions, and the dispatched instruction sequence table is updated when multi-port dispatching instructions; The dependency judgment module is used to determine that there is no WAW dependency between the dispatched instruction and the first instruction if the second information indicates that the first instruction is the instruction with the earliest logical execution order among the instructions with the same rdidx; the recycling module is used to immediately recycle the space number occupied by the first instruction and the space of the information stack occupied by the first instruction; The dependency judgment module is also used to determine that the first instruction has a WAW dependency with the dispatched instruction if the second information indicates that the first instruction is not the earliest instruction in the logical execution order among the instructions with the same rdidx. The recovery module is also used to continue waiting for the recovery of the space number occupied by the first instruction and the space in the information stack occupied by the first instruction.
8. A computer device comprising: A memory and a processor, wherein the memory stores a computer program, and wherein the processor implements the steps of the method according to any one of claims 1 to 6 when executing the computer program.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Dependency mesh based instruction-level parallel scheduling method
CN104699464A
Instruction processing method and device, electronic equipment and readable storage medium
CN116880908A
Instruction processing device, microprocessor, and device
CN116932050A
Efficiently managing speculative finish tracking and error handling for load instructions
US20170090941A1
Emit vector optimization of a trace
US7937564B1
