Space recovery method and device for dual-port emission, equipment and medium

Through the space recycling method of dual-port emission, the instruction sequence relationship table is used to determine and release the instruction space that does not depend on the relationship, which solves the problem of increased waiting time caused by the linear recycling mechanism and improves the execution performance of the processor.

CN118568008APending Publication Date: 2024-08-30芯来智融半导体科技(上海)股份有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410726682.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-05
Publication Date
2024-08-30

AI Technical Summary

Technical Problem

In dual-issue and multi-issue scenarios of existing processors, the instruction waiting time increases due to the linear recycling mechanism, which affects the execution performance of the processor.

Method used

Through the space recycling method of dual-port emission, the dispatched instruction sequence relationship table is used to maintain the logical execution sequence between instructions, determine and release the space occupied by instructions without dependencies, allow out-of-order release, and avoid waiting for the release of advanced instructions.

Benefits of technology

It reduces invalid waiting time, improves instruction execution efficiency and circuit operating frequency, and improves the processing efficiency of dual-emission high-performance processors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118568008A
    Figure CN118568008A
Patent Text Reader

Abstract

The embodiment of the invention provides a space recovery method and device for dual-port emission, equipment and a medium, and relates to the technical field of computers. The method comprises the following steps: for a first executed instruction, according to related information of instructions stored in an information stack, determining a third set of instructions of which the target register index is the same as the target register index of the first instruction in dispatched instructions; determining whether a fourth set of instructions earlier than the logic execution sequence of the first instruction exists in the third set or not according to a sequence relation table of the dispatched instructions; if the instruction earlier than the logic execution sequence of the first instruction does not exist in the third set, the WAW dependency relationship between the dispatched instruction and the first instruction does not exist, and the space number occupied by the first instruction and the space of the information stack occupied by the first instruction are recovered immediately. Based on the technical scheme provided by the embodiment of the invention, invalid waiting of instruction recovery can be reduced, and the execution performance of the processor is improved.
Need to check novelty before this filing date? Find Prior Art

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 dual-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, in both sequential and out-of-order architectures, processors execute 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). Among them, the processor executes instructions in a fixed order at the IF, ID, and EX pipeline stages; the processor executes instructions out of order at the EX and MEM pipeline stages. 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 dependency is in the program order, including RAW (Read after Write) dependency and WAW (Write after Write) dependency. RAW dependency indicates that the execution of subsequent instructions requires the results of previous instructions that have not been executed yet, and the two WAW-dependent 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 allocation space.

[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 earlier has not yet been executed, and instruction 2 that allocates space later 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 dual-port transmission.

[0007] According to a first aspect of an embodiment of the present application, a space recovery method for dual-port transmission is provided. 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 is determined based on relevant information of the instructions stored in the information stack; based on a dispatched instruction sequence table, it is determined whether there is a fourth set of instructions in the third set that are earlier in logical execution order than the first instruction, 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 the dual-port dispatches the instruction; if there is no instruction in the third set that is earlier in logical execution order than the first instruction, 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 in the information stack occupied by the first instruction are immediately recovered.

[0008] In an optional embodiment of the present application, if there is an instruction in the third set whose logical execution order is earlier than the first instruction, it is determined that the first instruction has a WAW dependency relationship with other dispatched instructions, and the first instruction is controlled to continue to be released.

[0009] In an optional embodiment of the present application, a first logical execution order relationship between the first instruction and all other dispatched instructions is obtained from a dispatched instruction order relationship table; based on the third set and the first logical execution order relationship, it is determined whether there is a fourth set of instructions in the third set whose logical execution order is earlier than that of the first instruction.

[0010] In an optional embodiment of the present application, the executed instructions include a first instruction and a fourth instruction, and the fourth instruction is an instruction executed after the first instruction is executed; the method also includes: within the same cycle, determining whether there is an instruction in the dispatched instructions that has a WAW dependency with the first instruction, and determining whether there is an instruction in the dispatched instructions that has a WAW dependency with the fourth instruction; if the first instruction has a WAW dependency with other dispatched instructions, and there is no instruction that has a WAW dependency with the fourth instruction, then no further query is made for the first instruction, the first instruction is controlled to continue waiting for release, and the space number occupied by the fourth instruction and the space in the information stack occupied by the fourth instruction are immediately reclaimed.

[0011] 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 method also includes: 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, determining 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, determining to reclaim the space number occupied by the first instruction and the space in the information stack occupied by the first instruction; if the instruction with the latest logical execution order in the fourth set is not one of the multiple instructions, controlling the first instruction to continue waiting for release.

[0012] In an optional embodiment of the present application, the method further includes: after reclaiming the space occupied by the first instruction, writing the index 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, and a row corresponds to the sequence of a dispatched instruction and other dispatched instructions, and N is a positive integer.

[0014] According to a first aspect of an embodiment of the present application, a space recovery device for dual-port transmission is provided, the device comprising: a determination module and a recovery module; the determination module is used to determine, for a first instruction that has been executed, 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 based on relevant information of the instructions stored in an information stack; according to a dispatched instruction sequence table, determine whether there is a fourth set of instructions in the third set that are earlier in logical execution order than the first instruction, 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 the dual-port dispatches the instruction; the recovery module is used to immediately reclaim the space number occupied by the first instruction and the space in the information stack occupied by the first instruction if there is no instruction in the third set that is earlier in logical execution order than the first instruction, then there is no WAW dependency between the dispatched instruction and the first instruction.

[0015] In an optional embodiment of the present application, the space recovery device for dual-port transmission also includes: a control module; the control module is used to control the first instruction to continue waiting for release if there is a first instruction in the third set whose logical execution order is earlier than the first instruction, then the first instruction has a WAW dependency relationship with other dispatched instructions, and no further query is made.

[0016] In an optional embodiment of the present application, the determination module is specifically used to: obtain a first logical execution order relationship between a first instruction and all other dispatched instructions from a dispatched instruction order relationship table; and determine, based on the third set and the first logical execution order relationship, whether there is a fourth set of instructions in the third set whose logical execution order is earlier than that of the first instruction.

[0017] In an optional embodiment of the present application, the executed instructions include a first instruction and a fourth instruction, the fourth instruction being an instruction executed after the first instruction is executed, and the determination module is also used to: within the same cycle, determine whether there is an instruction in the dispatched instructions that has a WAW dependency with the first instruction, and determine whether there is an instruction in the dispatched instructions that has a WAW dependency with the fourth instruction; if the first instruction has a WAW dependency with other dispatched instructions, and there is no instruction that has a WAW dependency with the fourth instruction, the query module will no longer continue to query for the first instruction, the control module controls the first instruction to continue waiting, and the recovery module is used to immediately reclaim the space number occupied by the fourth instruction and the space of the information stack occupied by the fourth instruction.

[0018] 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 determination module is also used to determine that the instruction with the latest logical execution order in the fourth set has a WAW dependency relationship with the first instruction 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; if the instruction with the latest logical execution order in the fourth set is one of the multiple instructions, determine to reclaim the space number occupied by the first instruction and the information stack space occupied by the first instruction; if the instruction with the latest logical execution order in the fourth set is not one of the multiple instructions, control the first instruction to continue waiting for release.

[0019] In an optional embodiment of the present application, the space recovery device for dual-port transmission also includes: a write-back module; the write-back module is used to write the index number of the space occupied by the first instruction to the end of the available list after the space occupied by the first instruction is recovered.

[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 dual-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 recycling method for dual-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 dual-port transmission is provided, in which the logical execution order of dispatched instructions is maintained through a dispatched instruction order relationship table, and 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 is determined based on the relevant information of the instructions stored in the information stack; then, based on 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 are no instructions in the third set that are earlier in logical execution order than the first instruction, there are no instructions that have 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 does not have a 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 first-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 dual-issue high-performance processors. 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 flow chart of a spatial recycling method for dual-port transmission provided by an embodiment of the present application;

[0028] Figure 4 A logical diagram of spatial allocation / recycling of dual-port transmission provided for one embodiment of the present application;

[0029] Figure 5 A flow chart of a spatial recycling method for dual-port transmission provided by an embodiment of the present application;

[0030] Figure 6 A schematic diagram of the structure of a dual-port transmitting space recovery device provided in one embodiment of the present application;

[0031] Figure 7 A schematic diagram of the structure of a dual-port transmitting space recovery device provided in one embodiment of the present application;

[0032] Figure 8 A schematic diagram of the structure of a dual-port transmitting space recovery device provided in one embodiment of the present application;

[0033] Fig. 9 A schematic diagram of the structure of a computer device 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 1As 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. Among them, resource dependency is common in that different instructions of the same type preempt the same processing unit, or different memory access instructions access the same address.

[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 the related art, 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 the 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 index of the next free space. Similarly, every time an old instruction is executed, the release pointer increases by a corresponding value, pointing to the index of the next space to be 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 dispatched first must be earlier instructions, and such instructions are also executed first and released first. 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 dual-port transmission and a method for recovering space for dual-port transmission.

[0046] On the one hand, in the space allocation method for dual-port transmission, the order of dispatched instructions is maintained through the dispatched instruction order table. After the dual-port dispatches the instruction, the index numbers of the two free spaces are searched from both ends of the available list at the same time, 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 index numbers of the two 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 dual-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 updated table after the allocation for the first instruction to allocate space for the second instruction. That is, at least two cycles are required in the related art to allocate space for instructions. However, in the dual-port transmission mechanism, the present application maintains the order of instructions through the dispatched instruction order relationship table. When allocating space for the information stack for the instruction after the instruction is dispatched, the first-in-first-out mechanism is no longer used. Instead, the free space is searched from both ends of the available list at the same time, and the first free space is found respectively, that is, the space is allowed to be allocated in a disorderly order. Therefore, the allocation demand of the instruction free space can be quickly responded to, and two free spaces are found to allocate for the instruction, which shortens the waiting cycle caused by the search, reduces the waiting in the linear allocation mechanism, and thus reduces 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 the instructions, the execution efficiency of the processor for the instructions can be improved. Therefore, the space allocation method of the dual-port transmission of the present application is suitable for dual-transmission high-performance processors.

[0047] Secondly, in the space recovery method of dual-port transmission, the logical execution order of the dispatched instructions is maintained through a dispatched instruction order relationship table, and 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 are no instructions in the third set that are earlier in logical execution order than the first instruction, there are no instructions that have 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 does not have a 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 first-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 dual-issue high-performance processors.

[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] Spatial allocation of dual-port launch

[0051] The following embodiments use a processor as an execution subject and apply the method provided in the embodiments of the present application to an electronic device, so as to specifically illustrate a spatial allocation method for dual-port transmission provided in the present application.

[0052] A space allocation method for dual-port transmission provided by an embodiment of the present application includes the following steps: after the dual-port dispatches an instruction, the processor starts to search for the index numbers of two free spaces from both ends of the available list at the same time. The processor determines the RAW dependency relationship 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 instruction to be dispatched into the information stack based on the index numbers of the two 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 index numbers of the two free spaces.

[0053] In an embodiment of the present application, an available list of free space indexes of an information stack is maintained in the processor, the available list includes an index for indicating free space of the information stack, and the information stack is used to store relevant information of dispatched instructions.

[0054] It should be noted that in the embodiment of the present application, the currently dispatched instruction includes one or two instructions. The dispatched instruction indicates an instruction for which space of the information stack has been allocated and the relevant information of the instruction is stored in the allocated space. The dispatched instruction indicates an instruction in a pipeline stage.

[0055] Exemplarily, the relevant information of the instruction may include at least one of the following:

[0056] (1) Whether the instruction requires the source operand register rsen;

[0057] 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.

[0058] (2) the index of the instruction source operand register rsidx;

[0059] The read register index indicates the number of the source operand register.

[0060] (3) Whether the instruction needs to write to the destination register rdwen;

[0061] Among them, a field in the information stack is used to write register enable information.

[0062] (4) The instruction writes the index rdidx of the destination register.

[0063] Among them, a field in the information stack is used for writing the register index of the destination.

[0064] (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.

[0065] In the embodiment of the present application, 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 the dual port dispatches a new instruction.

[0066] It should be noted that in the embodiment of the present application, after the dual-port dispatch instruction, there is no necessary order of execution for searching the index of the free space and judging the RAW dependency. 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.

[0067] For example, in the embodiment of the present application, an Age Matrix module (age matrix) is provided in the processor to implement the dispatched instruction priority table, and the order of the dispatched instruction priority table can be updated with the update of the number of dispatched instructions, or 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.

[0068] For example, in a certain cycle, the pipeline includes 4 dispatched instructions, then the dispatched instruction sequence relationship table is a 4-level table (4*4), indicating the logical execution sequence relationship between the 4 instructions, and each table entry is 1 bit. In the next cycle, the pipeline includes 5 dispatched instructions, then the dispatched instruction sequence relationship table is updated to a 5-level table (5*5), indicating the logical execution sequence relationship between the 5 instructions.

[0069] For example, if the maximum number of instructions in the pipeline stage is 8, the dispatched instruction sequence table is an 8-stage table (8*8).

[0070] In a possible example of the present application, the dispatched instruction sequence table is an N-level table that can store the logical execution sequence of N dispatched instructions, each row corresponds to the sequence of a dispatched instruction and other dispatched instructions, and N is a positive integer.

[0071] For example, Table 1 is an exemplary table of a dispatched instruction sequence table provided in an embodiment of the present application, wherein 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).

[0072] Table 1

[0073] <![CDATA[I0]]> <![CDATA[I1]]> <![CDATA[I2]]> <![CDATA[I3]]> <![CDATA[I0]]> 0 1 1 1 <![CDATA[I1]]> 0 0 0 0 <![CDATA[I2]]> 0 1 0 1 <![CDATA[I3]]> 0 1 0 0

[0074] Exemplarily, in conjunction with Table 1, the first row in the age matrix (i.e., the order relationship table of dispatched instructions) stores the order relationship between 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 relationship between 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.

[0075] It should be noted that the table entry is updated only when a new instruction is allocated, and the updated address is the number of the allocated free address.

[0076] In the embodiment of the present application, the relevant information of the currently dispatched instruction includes all the information required for determining the RAW dependency relationship between the currently dispatched instruction and all the dispatched instructions.

[0077] For ease of explanation, in an embodiment of the present application, an example is taken in which the logical execution order of the first instruction comes first, the logical execution order of the second instruction comes later, the first number is the number of the first free space in the available list from small to large, and the second number is the number of the first free space in the available list from large to small.

[0078] Specifically, 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 Figure 4 A logical diagram of space allocation / recycling of dual-port transmission provided by an embodiment of the present application. Figure 4 As shown in , the available information list includes the index numbers of 8 spaces of the information stack, wherein the flag bit vld corresponding to the index number of the free space is set to 1, and the flag bit vid corresponding to the index number of the occupied space is set to 0. An index 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. 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 allocated 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 dual-port transmission, which maintains the order of dispatched instructions through a dispatched instruction order table. After the dual-port dispatches an instruction, the index numbers of two free spaces are searched from both ends of the available list at the same time, 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 index numbers of the two 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 table. In the scenario of dual-port transmission in the related art, 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 to allocate space for the second instruction based on the table updated after the allocation for the first instruction. That is, at least two cycles are required in the related art to allocate space for instructions. However, in the present application, under the dual-port transmission mechanism, the order of instructions is maintained through a dispatched instruction order relationship table. When allocating space in the information stack for the instruction after the instruction is dispatched, the first-in-first-out mechanism is no longer used. Instead, the free space is searched from both ends of the available list at the same time, and the first free space is found respectively, that is, out-of-order allocation of space is allowed. Therefore, the allocation demand of the instruction free space can be responded quickly, and two free spaces can be found to allocate to the instruction, shortening the waiting cycle caused by the search, reducing 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 for instructions can be improved.

[0083] In an optional embodiment of the present application, the above step of "the processor determines the RAW dependency relationship between the current dispatched instruction and the dispatched instruction based on the relevant information of the instruction and the dispatched instruction sequence table" may specifically include the following steps: the processor determines a first set of instructions in the dispatched instruction whose target register index is the same as the operand of the current 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 current dispatched instruction based on the dispatched instruction sequence table. The processor determines that the instruction in the second set that is closest in logical execution order to the current dispatched instruction is the instruction with which the current dispatched instruction has a RAW dependency, otherwise the current dispatched instruction does not have a RAW dependency.

[0084] The operands of the currently dispatched instruction may include at least one operand.

[0085] For example, if the first instruction includes 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.

[0086] 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.

[0087] 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.

[0088] Specifically, 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.

[0089] 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 (i.e., 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.

[0090] In an optional embodiment of the present application, the index values ​​of the two free spaces are different; the current dispatched instruction includes a first instruction and a second instruction, and the logical execution order of the first instruction is earlier than the logical execution order of the second instruction; further, the above-mentioned step "the processor updates the relevant information of the instruction to be dispatched to the information stack according to the index numbers of the two 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.

[0091] The first number is the number of the first free space in the available list from the smallest value to the largest value, and the second number is the number of the first free space in the available list from the largest value to the smallest value.

[0092] It should be noted that in the application embodiment, if the dual port dispatches two instructions and two different free numbers are found, after the relevant information of the two instructions is stored in the information stack, the flag bits corresponding to the two numbers in the available list can be updated to indicate that the information stack space corresponding to the two numbers has been used.

[0093] Based on this scheme, in the case of dual-port transmission, two instructions are dispatched in one cycle, and the indexes of two free spaces with different values ​​are found from the two ends of 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 index 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 index 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 the two ports in parallel, thereby improving the allocation efficiency of the instruction space in the case of dual-port transmission.

[0094] In an optional embodiment of the present application, the index values ​​of the two free spaces are different, and the currently dispatched instruction includes the first instruction; that is, the dual port only dispatches one instruction in this cycle. Furthermore, the above step "the processor updates the relevant information of the instruction to be dispatched to the information stack according to the index numbers of the two 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, updates the flag bit corresponding to the first number in the available list, and keeps the flag bit of the second number unchanged.

[0095] The first number is the number of the first free space in the available list from the smallest value to the largest value, and the second number is the number of the first free space in the available list from the largest value to the smallest value.

[0096] It can be understood that keeping the flag bit of the second number unchanged indicates that the second number is not used and can be found when the processor searches for free space next time.

[0097] Based on this scheme, if one of the dual ports dispatches an instruction (i.e., the first instruction) and the other port does not dispatch an instruction, the processor stores the relevant information of the instruction in the free space corresponding to the smaller index value of the two index values, and no longer takes out the index number with the larger index value. The index number of the unused free space can be found again in the next cycle in time, avoiding the decrease in the utilization 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.

[0098] In an optional embodiment of the present application, the index values ​​of the two free spaces are both the first number, and the first number is the number of the only free space in the available list; the current dispatched instruction includes the first instruction and the second instruction, and the logical execution order of the first instruction is earlier than the logical execution order of the second instruction; further, the above-mentioned step "the processor updates the relevant information of the instruction to be dispatched to the information stack according to the index numbers of the two 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 suspends the allocation of space for the second instruction in this cycle.

[0099] Exemplarily, the processor searches for the index of the available free space for the second instruction again in the next cycle.

[0100] It can be understood that if the space is allocated to the second instruction first in the next cycle, the dual ports may not dispatch instructions in the next cycle, or only one port dispatches the second instruction, or dispatches the second instruction and the third instruction. In the case that two instructions are dispatched in the next cycle, the index of the free space is 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 later.

[0101] Based on this scheme, when two instructions are dispatched by the dual ports, if there is only an index of free space 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 allocation of resources to 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.

[0102] In an optional embodiment of the present application, the index values ​​of the two free spaces are both the first number, and the first number is the number of the only free space in the available list; the current dispatched instruction includes the first instruction, that is, only one port dispatches instructions in this cycle of the dual port; further, the above step "the processor updates the relevant information of the instructions to be dispatched to the information stack according to the index numbers of the two 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.

[0103] It should be noted that in the embodiment of the present application, regardless of whether the allocated instruction is one instruction or two instructions, the search for the first free space starts from both ends of the available list at the same time, and the number of search spaces 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 dual-port transmission.

[0104] Based on this solution, only an index of a free space is found in this cycle, and only one of the dual ports dispatches an instruction in this cycle. The processor then stores the relevant information of the instruction in the free space. There is no need to find the indexes of two free spaces. The allocation method is flexible, and space can be flexibly allocated for different scenarios.

[0105] Example 1:

[0106] Step 1: Compare the operands rs1idx and rs2idx of instruction 1 with the destination register indexes 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 with instruction 1.

[0107] A-Instruction 1: {Instruction 2, Instruction 3, Instruction 5}.

[0108] Step 2: For each instruction among all the assigned instructions, its own rdidx is compared with the rdidx of other dispatched instructions, and each instruction obtains an instruction set B having the same rdidx as the instruction.

[0109] Among them, B includes:

[0110] B1-instruction 2: {instruction 3, instruction 5};

[0111] B2-Instruction 3: {Instruction 2 and Instruction 5};

[0112] B3-Instruction 4: Empty set;

[0113] B4-Instruction 5: {Instruction 2, Instruction 3}.

[0114] Get the logical execution order relationship 1 between each instruction and other dispatched instructions from AgeMatreix. Instruction 5 is earlier than instruction 4, instruction 4 is earlier than instruction 3, and instruction 3 is earlier than instruction 2. According to the order relationship 1 and instruction set B, query whether there is an instruction that is later than the logical execution order of each instruction and has the same destination register as instruction 1, and obtain the set C corresponding to each dispatched instruction.

[0115] Among them, C includes:

[0116] C1-Instruction 2: Empty set;

[0117] C2-instruction 3: {instruction 2};

[0118] C3-Instruction 4: Empty set;

[0119] C5 - Instruction 5: {instruction 2, instruction 3}.

[0120] Step 3: Based on Set A and Set C, determine whether there is an allocated instruction whose rdidx is the same as the rsidx of Instruction 1 and there is no dispatched instruction younger than the dispatched instruction with the same rdidx. Determine that Instruction 2 exists and there is a RAW dependency between Instruction 1 and Instruction 2.

[0121] It should be noted that rs1idx and rs2idx of instruction 1 may have dependencies on different instructions at the same time. For example, rs1idx may depend on the result of instruction 3, and rs2 may depend on the result of instruction 5. Here, only rs1idx is used as an example. The judgment logic of rs2idx is exactly the same as that of rs1idx. It will not be repeated here.

[0122] It should be noted that, in the embodiment of the present application, logically, the first set is searched first, and then the youngest instruction in the logical execution order of the instructions in the first set is searched for, and the first instruction has a RAW dependency relationship. In practical applications, the actual execution steps caused by the hardware mechanism include the following steps: determining the first set of instructions whose destination register index is the same as the operand of the first instruction; determining whether there is an instruction with the same destination register index value for each dispatched instruction, and then determining whether each dispatched instruction is the youngest instruction in the execution order among the instructions with the same destination register based on the sequence table of dispatched instructions, and recording the result as the fifth set. Then, based on the first set and the fifth set, determine the instructions that have a RAW dependency relationship with the first instruction.

[0123] Spatial recycling for dual-port launch

[0124] After the dispatched first instruction is executed, it can be recycled according to the following recycling method.

[0125] See also Figure 3 , Figure 3 This is a flowchart of a dual-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 dual-port transmission, which is used to specifically illustrate the processor supporting dual transmission as an example. The dual-port transmission space recovery method provided by the embodiment of the present application includes the following steps 301-303:

[0126] Step 301: 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.

[0127] Among them, the instructions that have been executed are waiting to be recycled.

[0128] 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.

[0129] Step 302: 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.

[0130] Step 303: 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.

[0131] Combination Figure 4 ,During the space recovery process, the relevant information of the ,instructions stored in each space can be compared with the relevant information of the ,currently executed instructions, combined with the age matrix, it can be determined ,whether among all the dispatched instructions there are instructions that have a WAW dependency ,relationship with the instructions to be recovered.

[0132] An embodiment of the present application provides a space recovery method based on dual-port transmission, which maintains the logical execution order of dispatched instructions through a dispatched instruction order relationship table, and for a first instruction that has been executed, determines 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 based on relevant information of the instructions stored in an information stack; then determines whether there is a fourth set of instructions in the third set that are earlier in logical order than the first instruction based on the dispatched instruction order relationship table; if there are no instructions in the third set that are earlier in logical execution order than the first instruction, there are no instructions that have a WAW dependency relationship with the first instruction, and the processor immediately recovers 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 does not have a 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 first-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 dual-issue high-performance processors.

[0133] In an optional embodiment of the present application, the above step 302 can be specifically performed by the following steps 302a and 302b:

[0134] Step 302a: 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.

[0135] Step 302b: 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.

[0136] 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.

[0137] 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.

[0138] In an optional embodiment of the present application, step 303 may be specifically performed by the following step 303a:

[0139] Step 303a: After the space occupied by the first instruction is reclaimed, the index number of the space occupied by the first instruction is written to the end of the available list.

[0140] It can be understood that in the embodiment of the present application, the index number of the free space maintained in the available list is updated as the instructions are dispatched and recycled.

[0141] 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 index 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 index number of the first space to the end of the available list.

[0142] 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 index 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 vld corresponding to the first index number of the first space to 1 (it can also be set to 0, which can be selected as needed).

[0143] Based on this solution, after the processor reclaims the space in the information stack occupied by the instruction, the index number of the reclaimed space can be promptly added to the available list and updated in a timely manner to facilitate the search for free space when dispatching instructions in the next cycle, thereby improving the processing efficiency of the processor that supports dual-issue.

[0144] In an optional embodiment of the present application, after the above step 302, in combination with Figure 5 , Figure 5 This is a flow chart of a spatial recycling method for dual-port transmission provided by an embodiment of the present application. The method may also include the following step 304:

[0145] Step 304: 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.

[0146] 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.

[0147] 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.

[0148] 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.

[0149] In an optional embodiment of the present application, the instruction to be recycled includes a first instruction and a fourth instruction, and the fourth instruction is an instruction executed after the first instruction. Then the above method may include the following steps 305 and 306:

[0150] Step 305: In the same recycling cycle, the processor determines whether there is any instruction in the dispatched instructions that has a WAW dependency relationship with the first instruction, and determines whether there is any instruction in the dispatched instructions that has a WAW dependency relationship with the fourth instruction.

[0151] 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.

[0152] 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.

[0153] Step 306: If the first instruction has a WAW dependency relationship with other dispatched instructions, and no instruction has a WAW dependency relationship with the fourth instruction, the processor will no longer continue to query for the first instruction, control the first instruction to continue waiting for release, and immediately reclaim the space number occupied by the fourth instruction and the space of the information stack occupied by the fourth instruction.

[0154] Specifically, the processor immediately adds the space number of the information stack occupied by the fourth instruction to the available list.

[0155] 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 fourth instruction is recovered, and invalid waiting for instructions can be avoided. 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.

[0156] 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 307 and 308:

[0157] Step 307: 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.

[0158] 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.

[0159] Step 308: 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.

[0160] 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.

[0161] 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.

[0162] Example 2:

[0163] Step 1: Compare the rdidx 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{instruction 2, instruction 3, instruction 5} of all instructions that may have a WAW dependency with instruction 1.

[0164] Step 2: For each instruction among all dispatched instructions, compare its own rdidx with the rdidx of other dispatched instructions, and each instruction obtains the instruction set B with the same rdidx as the instruction. Obtain the logical execution order relationship 1 between each instruction and other dispatched instructions from AgeMatreix, and query whether there is an instruction that is earlier than each instruction in logical execution order and has the same destination register as instruction 1 based on the relationship 1 and instruction set B, and obtain the set C corresponding to each dispatched instruction.

[0165] Step 3: Based on set A and set C, determine whether there is a dispatched instruction 2, the rdidx of instruction 2 is the same as the rsidx of instruction 1, and instruction 2 does not have any younger instruction with the same rdidx than instruction 1. If instruction 2 exists, then instruction 1 depends on instruction 2; if instruction 2 does not exist, then instruction 2 has no dependent instructions and there is no dependency relationship.

[0166] 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.

[0167] See also Figure 6 , Figure 6 A structural schematic diagram of a dual-port transmission space recovery device provided for an embodiment of the present application, the dual-port transmission space recovery device 600 includes: a determination module 601 and a recovery module 602; the determination module 601 is used to determine, 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 the relevant information of the instructions stored in the information stack; according to the dispatched instruction sequence table, determine whether there is a fourth set of instructions in the third set that are earlier in logical execution order than the first instruction, 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 the dual-port dispatches the instruction; the recovery module 602 is used to immediately reclaim the space number occupied by the first instruction and the space in the information stack occupied by the first instruction if there is no instruction in the third set that is earlier in logical execution order than the first instruction, then there is no WAW dependency between the dispatched instruction and the first instruction.

[0168] In an optional embodiment of the present application, in combination with Figure 6 ,like Figure 7 As shown in, the dual-port transmission space recovery device 600 also includes: a control module 603; the control module 603 is used to stop querying and control the first instruction to continue waiting for release if it is found that there is a first instruction in the third set whose logical execution order is earlier than the first instruction, and the first instruction has a WAW dependency relationship with other dispatched instructions.

[0169] In an optional embodiment of the present application, the determination module is specifically used to: obtain a first logical execution order relationship between a first instruction and all other dispatched instructions from a dispatched instruction order relationship table; and determine, based on the third set and the first logical execution order relationship, whether there is a fourth set of instructions in the third set whose logical execution order is earlier than that of the first instruction.

[0170] In an optional embodiment of the present application, the executed instructions include a first instruction and a fourth instruction, and the fourth instruction is an instruction executed after the first instruction is executed. The determination module 601 is also used to: within the same cycle, determine whether there is an instruction in the dispatched instructions that has a WAW dependency relationship with the first instruction, and determine whether there is an instruction in the dispatched instructions that has a WAW dependency relationship with the fourth instruction; if the first instruction has a WAW dependency relationship with other dispatched instructions, and there is no instruction that has a WAW dependency relationship with the fourth instruction, the query module will no longer continue to query for the first instruction, the control module controls the first instruction to continue waiting, and the recovery module is used to immediately reclaim the space number occupied by the fourth instruction and the space of the information stack occupied by the fourth instruction.

[0171] 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 determination module 601 is also used to determine that the instruction with the latest logical execution order in the fourth set has a WAW dependency relationship with the first instruction 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; if the instruction with the latest logical execution order in the fourth set is one of the multiple instructions, determine to reclaim the space number occupied by the first instruction and the information stack space occupied by the first instruction; if the instruction with the latest logical execution order in the fourth set is not one of the multiple instructions, control the first instruction to continue waiting for release.

[0172] In an optional embodiment of the present application, in combination with Figure 6 ,like Figure 8 As shown in , the dual-port transmission space recovery device 600 also includes: a write-back module 604; the write-back module 604 is used to write the index number of the space occupied by the first instruction to the end of the available list after the space occupied by the first instruction is recovered.

[0173] 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.

[0174] It should be noted that the above-mentioned dual-port transmitting space recovery device can achieve the effects in the above-mentioned method embodiment, which will not be repeated here.

[0175] For the specific definition of the above-mentioned space recovery device based on dual-port transmission, please refer to the definition of the space recovery method based on dual-port transmission above, which will not be repeated here. Each module in the above-mentioned space recovery device based on dual-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.

[0176] 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 dual-port transmission as described above is implemented.

[0177] 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 recycling method based on dual-port transmission is implemented.

[0178] 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 dual-port transmission can be implemented.

[0179] 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 in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0180] 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.

[0181] 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.

[0182] 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.

[0183] 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.

[0184] 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 dual-port transmission, characterized in that: The method comprises: For the executed first instruction, determining, 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; Determine whether there is a fourth set of instructions in the third set that are earlier in logical execution order than the first instruction according to a dispatched instruction sequence table, wherein 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 the dual-port dispatches the instruction; If there is no instruction in the third set that is earlier in logical execution order than the first instruction, there is no WAW dependency 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.

2. The method according to claim 1, characterized in that The method further comprises: If it is found that there is a first instruction in the third set whose logical execution order is earlier than the first instruction, then the first instruction has a WAW dependency relationship with other dispatched instructions, and the query is no longer continued, and the first instruction is controlled to continue waiting for release.

3. The method according to claim 1, characterized in that The determining, according to the dispatched instruction sequence table, whether there is a fourth set of instructions in the third set that are earlier in logical execution order than the first instruction comprises: Acquire a first logical execution order relationship between the first instruction and all other dispatched instructions from the dispatched instruction order relationship table; According to the third set and the first logical execution sequence relationship, it is determined whether there is a fourth set of instructions in the third set that are earlier in the logical execution sequence than the first instructions.

4. The method according to claim 2, characterized in that: The executed instruction includes the first instruction and the fourth instruction, and the fourth instruction is an instruction executed after the first instruction is executed; the method further includes: In the same cycle, determining whether there is an instruction in the dispatched instructions that has a WAW dependency relationship with the first instruction, and determining whether there is an instruction in the dispatched instructions that has a WAW dependency relationship with a fourth instruction; If the first instruction has a WAW dependency relationship with other dispatched instructions, and no instruction has a WAW dependency relationship with the fourth instruction, no further query is made for the first instruction, the first instruction is controlled to continue waiting for release, and the space number occupied by the fourth instruction and the space in the information stack occupied by the fourth instruction are immediately reclaimed.

5. The method according to claim 2, characterized in that: The executed instruction includes multiple instructions, and the first instruction is one of the multiple instructions; the method further includes: 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, determining that the instruction in the fourth set with the latest logical execution order 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, determine to reclaim the space number occupied by the first instruction and the space of the information stack occupied by the first instruction; If the latest instruction in the fourth set in logical execution order is not one of the multiple instructions, the first instruction is controlled to continue waiting for release.

6. The method according to claim 1, characterized in that The method further comprises: After the space occupied by the first instruction is reclaimed, the index number of the space occupied by the first instruction is written to the end of the available list.

7. The method according to any one of claims 1 to 6, 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.

8. A dual-port transmitting space recovery device, characterized in that: The dual-port transmitting spatial recovery device comprises: a determination module and a recovery module; The determination module is used to determine, for the 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 the relevant information of the instructions stored in the information stack; determine whether there is a fourth set of instructions whose logical execution order is earlier than that of the first instruction in the third set according to the dispatched instruction sequence relationship table, the dispatched instruction sequence relationship table being used to store the logical execution sequence of each dispatched instruction and other dispatched instructions, and the dispatched instruction sequence relationship table being updated when the dual-port dispatches the instruction; The recycling module 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 if there is no instruction in the third set that is earlier in the logical execution order than the first instruction and there is no instruction that has a WAW dependency relationship with the first instruction.

9. 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 7 when executing the computer program.

10. 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 7 are implemented.