Processor, graphics card, computer equipment and dependency relieving method

By setting different channels in the processor to release the register dependency relationship used by the same instruction, the problem of excessive register occupancy time is solved, and the performance and instruction parallelism of the processor are improved.

CN119003002AActive Publication Date: 2024-11-22MOORE THREADS TECH CO LTD

Patent Information

Application Number
CN202410977461.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-19
Publication Date
2024-11-22
Estimated Expiration
2044-07-19

AI Technical Summary

Technical Problem

In the multi-stage pipeline mechanism of the processor, the time and time of the deletion of the registers used by the same instruction is different, resulting in the register occupancy time too long, reducing the register usage efficiency and instruction parallelism.

Method used

Set the first type path and the second type path between the instruction processing unit and the dependency processing unit, which are respectively used to release the dependency relationship of different types of registers used by the same instruction. Depending on the different timing and duration of the registers, use them first in advance. Completed register.

Benefits of technology

It improves the efficiency of register usage, increases the possibility of parallel execution between different instructions, reduces register usage time, and improves processor performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119003002A_ABST
    Figure CN119003002A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a processor, a graphics card, computer equipment and a dependency relieving method, and relates to the field of chips. According to the processor, a first type path and a second type path are arranged between an instruction processing unit and a dependency processing unit, the instruction processing unit is used for sending a first dependency relieving signal through the first type path, and the dependency processing unit is used for relieving an instruction dependency relationship corresponding to a first type register based on the first dependency relieving signal; the instruction processing unit is further used for sending a second dependency relieving signal through the second type of path, and the dependency processing unit is used for relieving the instruction dependency relationship corresponding to the second type of register based on the second dependency relieving signal; wherein the first type register and the second type register are registers used by the same instruction. By adopting the processor provided by the invention, the first type of register is supported to be released in advance, so that the first dependency relationship associated with the first type of register is relieved, and the occupation time of the first type of register is shortened.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of chips, and in particular to a processor, a graphics card, a computer device, and a dependency removal method. Background Art

[0002] When executing instructions, the processor often uses a multi-stage pipeline mechanism. Taking a relatively simple five-stage pipeline as an example, the five-stage pipeline includes: instruction fetch stage, decoding stage, execution stage, memory access stage, and write-back stage. The five-stage pipeline can increase the efficiency when multiple instructions are executed in parallel.

[0003] The existence of a dependency between two instructions means that the two instructions are assigned to use the same register, and the latter instruction must wait until the former instruction has finished using the register before it can start using the register. Dependencies are divided into three types: read first, write later, write first, read later, and write first, write later. For example, if the first instruction and the second instruction have a read-first, write-later dependency, the processor needs to wait until the write-back phase corresponding to the first instruction is completed before the second instruction can release the dependency on the first instruction in order to execute the second instruction's write to the register.

[0004] Since the second instruction needs to wait until the write-back phase corresponding to the first instruction is executed before the second instruction can release its dependency on the first instruction, the first instruction occupies the register for a long time, resulting in reduced register utilization efficiency. Summary of the invention

[0005] The embodiment of the present application provides a processor, a graphics card, a computer device, and a method for removing dependencies. The technical solution is as follows:

[0006] In one aspect, an embodiment of the present application provides a processor, the processor comprising: an instruction processing unit and a dependency processing unit, at least two paths provided between the instruction processing unit and the dependency processing unit, the at least two paths comprising a first type path and a second type path;

[0007] The instruction processing unit is used to send a first dependency release signal to the dependency processing unit through the first type path; the dependency processing unit is used to release the first dependency relationship corresponding to the first type register based on the first dependency release signal;

[0008] The instruction processing unit is used to send a second dependency release signal to the dependency processing unit through the second type path; the dependency processing unit is used to release the second dependency relationship corresponding to the second type register based on the second dependency release signal;

[0009] The first type register and the second type register are both registers used by the same instruction.

[0010] On the other hand, an embodiment of the present application provides a graphics card, the graphics card comprising the processor as described above. Optionally, the processor is a graphics processor.

[0011] On the other hand, an embodiment of the present application provides a computer device, the computer device comprising the processor as described above. Optionally, the processor is a graphics processor.

[0012] On the other hand, an embodiment of the present application provides a dependency removal method, the method being executed by a processor, the processor comprising: an instruction processing unit and a dependency processing unit, at least two paths being arranged between the instruction processing unit and the dependency processing unit, the at least two paths comprising a first type path and a second type path; the method comprising:

[0013] The instruction processing unit sends a first dependency release signal to the dependency processing unit through the first type path; the dependency processing unit releases the first dependency relationship corresponding to the first type register based on the first dependency release signal;

[0014] The instruction processing unit sends a second dependency release signal to the dependency processing unit through the second type path; the dependency processing unit releases the second dependency relationship corresponding to the second type register based on the second dependency release signal;

[0015] The first type register and the second type register are both registers used by the same instruction.

[0016] In the embodiment of the present application, a first type of path and a second type of path are set between the instruction processing unit and the dependency processing unit. For two types of registers used by the same instruction, the first type of path is used to release the first dependency and the second type of path is used to release the second dependency. Since the same instruction uses different types of registers at different times and for different durations, the dependency corresponding to the register that is used first can be released earlier, thereby reducing the duration of the instruction occupying the register that is used first and improving the efficiency of using this part of the registers. At the same time, since this part of the registers can be released earlier, the possibility of parallel instructions between different instructions is increased. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0018] Figure 1is a schematic diagram of the structure of a processor provided by an exemplary embodiment of the present application;

[0019] Figure 2 is a schematic diagram of a five-stage pipeline provided by an exemplary embodiment of the present application;

[0020] Figure 3 is a flow chart of a multi-stage pipeline provided by an exemplary embodiment of the present application;

[0021] Figure 4 is a schematic diagram of a device related to a load instruction provided by an exemplary embodiment of the present application;

[0022] Figure 5 is a schematic diagram of a device related to a storage instruction provided by an exemplary embodiment of the present application;

[0023] Figure 6 is a schematic diagram of the structure of a processor provided by an exemplary embodiment of the present application;

[0024] Figure 7 is a schematic diagram of the structure of three candidate pathways provided by an exemplary embodiment of the present application;

[0025] Figure 8 is a schematic diagram of the timing of using three candidate paths in a multi-stage pipeline provided by an exemplary embodiment of the present application;

[0026] Fig. 9 It is a schematic diagram of dependency release of a load instruction provided by an exemplary embodiment of the present application;

[0027] Fig.10 It is a schematic diagram of dependency release of a storage instruction provided by an exemplary embodiment of the present application;

[0028] Fig.11 It is a schematic diagram of dependency release of a load instruction provided by an exemplary embodiment of the present application;

[0029] Fig.12 It is a flowchart of a dependency removal method provided by an exemplary embodiment of the present application. DETAILED DESCRIPTION

[0030] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.

[0031] First, the terms involved in the embodiments of the present application are introduced.

[0032] Instruction: It is a command that instructs a computer to perform a certain operation. It is the smallest functional unit of a computer. An instruction is a statement in machine language, and an instruction is a group of meaningful binary codes. The collection of all instructions of a computer constitutes the instruction system of the computer, also known as the instruction set.

[0033] Instruction format: A readable representation of an instruction. An instruction usually includes an opcode and an operand. The opcode is used to describe the type of operation to be performed by the instruction, and the operand provides the data or address of the data required to execute the instruction. The opcode is indispensable in the instruction, but the operand can be absent, one, or two.

[0034] Operation type: at least one of data transfer type, arithmetic logic type, shift type, transfer type, and input / output type. For example, the data transfer type is used to transfer data between the memory and the register; another example is the arithmetic logic operation type, which is used to perform arithmetic operations or logic operations. Arithmetic operations include addition, subtraction, multiplication, and division, and logic operations include AND, NOR, and so on.

[0035] Instruction type: According to the number of operands, instruction types include zero operand instructions, one operand instructions, two operand instructions, etc. Zero operand instructions are instructions that have no operands in the format or the operands are implicitly determined; one operand instructions are instructions that have one operand in the format, or an implicit operand (actually double operands); two operand instructions are instructions that have two operands in the format, one of which is the destination operand and the other is the source operand. The source operand is an operand that can only be read, and the destination operand is an operand that can be read and written (to store the result of the operation).

[0036] Data operands: are data that need to be loaded, stored, or calculated.

[0037] Control operands: are operands different from data operands. Control operands are used to indicate memory addresses or execution conditions. For example, control operands include at least one of: memory addresses, offset values ​​of memory addresses, predicate values ​​in predicate registers, and bypass information.

[0038] Predicate register: A register used to implement conditional execution. For example, if 1 is true, the current instruction or a branch of the current instruction needs to be executed; if 0 is false, the current instruction or a branch of the current instruction does not need to be executed.

[0039] Bypassing Information: It is a technique used to improve performance in the pipeline design of the central processing unit (CPU) and the graphics processing unit (GPU). In pipeline processing, the operation of each stage depends on the output of the previous stage. However, if the result of the operation of a stage needs to be used immediately in the next clock cycle and cannot wait for the completion of the entire pipeline, bypass technology is needed to directly pass data from one stage to the next stage that needs it.

[0040] Load instruction: used to read data from memory into registers. When the processor is a GPU, the memory is video memory.

[0041] Store instruction: used to write data in register to memory.

[0042] Pipeline hazard: In some cases, the next instruction in the next clock cycle of the pipeline cannot be executed. This situation is called a hazard, which is divided into three types: data hazard, structural hazard and control hazard. The embodiment of the present application involves data hazard.

[0043] Data hazard: When at least two instructions are executed in parallel in the pipeline, if the second instruction needs to use the execution result of the first instruction, and the first instruction has not yet written back, a conflict will occur. Data hazard is also called data dependency.

[0044] Data hazards are divided into three categories: Read After Write (RAW), Write After Write (WAW), and Write After Read (WAR).

[0045] RAW means that the second instruction reads the register, which needs to be later than the first instruction writes to the register; WAW means that the second instruction writes to the register, which needs to be later than the first instruction writes to the register; WAR means that the second instruction writes to the register, which needs to be later than the first instruction reads the register.

[0046] Sleep-wake mechanism: a data hazard dependency release mechanism. If the second instruction depends on the execution result of the first instruction, the second instruction is put into sleep mode before the first instruction is completed. When the first instruction is completed, the second instruction is woken up to continue execution.

[0047] Scoreboard mechanism: Another dependency resolution mechanism for data hazards. The scoreboard is used to record the dependency between instructions. When the dependency between the second instruction and the first instruction is detected to be released, the second instruction is executed immediately.

[0048] An instruction is a command that instructs a computer to perform a certain operation, also known as a machine instruction. It is the smallest functional unit of a computer. An instruction is a statement in machine language, a set of meaningful binary codes. The collection of all instructions of a computer constitutes the instruction system of the computer, also known as the instruction set. Instructions are executed by processors, such as CPUs and GPUs.

[0049] Figure 1 The schematic diagram of the structure of a processor 100 provided by an exemplary embodiment of the present application is shown. The processor 100 includes: an instruction fetch unit 10, a decoding unit 20, a dependency processing unit 30, a load storage unit 40, a computing unit 50, a register file 60, a memory 70 and a write back unit 80.

[0050] The instruction fetch unit 10 is connected to the decoding unit 20, the decoding unit 20 is connected to the dependency processing unit 30, and the dependency processing unit 30 is connected to the load storage unit 40 and the calculation unit 50 respectively.

[0051] The instruction fetch unit 10 is connected to the memory 70 .

[0052] The computing unit 50 is connected to one or more registers in the register file 60. The register file 60 includes registers of different functions and different types, such as general registers, instruction registers, etc.

[0053] The load storage unit 40 is connected to the register file 60 and the memory 70 respectively, and the load storage unit 40 is also connected to the write back unit 80. When the processor 100 is a GPU, the memory 70 is also called a video memory. When the processor 100 is a CPU, the memory 70 can also be considered as a device outside the processor 100.

[0054] The write-back unit 80 is connected to the register file 60 and the memory 70 respectively, and is also connected to the dependency processing unit 30 .

[0055] The processor 100 uses a multi-stage pipeline mechanism to execute instructions. Taking a simple five-stage pipeline as an example, the execution process of instructions is divided into five basic stages to achieve parallel processing of instructions and improve the efficiency of the processor.

[0056] like Figure 2As shown in the figure, the five-stage pipeline includes five stages: instruction fetch (IF), decode (ID), execute (EX), memory access (MEM), and write-back (WB). The five-stage pipeline design allows multiple instructions to be processed simultaneously at different stages, thereby reducing the total execution time of each instruction. This parallelism can significantly improve the performance of the processor, especially in high-throughput scenarios. For example, in Figure 2 In the example, the five stages of instruction 1 execution take up cycles 1 to 5 in sequence; the five stages of instruction 2 execution take up cycles 2 to 6 in sequence; the five stages of instruction 3 execution take up cycles 3 to 7 in sequence. Specifically:

[0057] In the instruction fetch phase, the instruction fetch unit 10 fetches the instruction from the memory address pointed to by the program counter (PC) and loads it into the instruction cache. The program counter is then updated to the address of the next instruction. Optionally, the program counter is a counter between the instruction fetch unit 10 and the decode unit 20, which is used to store the address of the next instruction that the processor 100 needs to process. Figure 1 The instruction cache and program counter are not shown.

[0058] In the decoding stage, the decoding unit 20 parses the opcode and operand of the instruction in the instruction cache to determine the operation type of the instruction and the required operation. This stage may also involve converting the memory address or immediate value in the instruction into a form that the processor can understand. After the decoding unit 20 completes the decoding, it will send the instruction to the dependent processing unit 30.

[0059] The operation types of common instructions include: at least one of data transfer type, arithmetic logic type, shift type, transfer type, and input / output type. For example, the data transfer type is used to transfer data between memory and registers; another example is the arithmetic logic operation type, which is used to perform arithmetic operations or logic operations. Arithmetic operations include addition, subtraction, multiplication, and division, and logic operations include AND, NOR, and so on.

[0060] In the execution phase, the dependency processing unit 30 is responsible for processing the dependencies between different instructions. According to the dependencies between the instructions and the operation type of each instruction, each instruction is scheduled to the load storage unit 40 or the computing unit 50 for execution. For example, if the operation type of the instruction is a data transfer type, the dependency processing unit 30 will schedule the instruction to the load storage unit 40 for execution; if the operation type of the instruction is a calculation type, the dependency processing unit 30 will schedule the instruction to the computing unit 50 for execution. For the current instruction that depends on other instructions, the dependency processing unit 30 needs to release the dependency of the current instruction on other instructions before scheduling the current instruction to the load storage unit 40 or the computing unit 50.

[0061] In the memory access phase, the load storage unit 40 or the computing unit 50 will send a memory access request to the memory according to the requirements of different instructions. The memory access request can be a memory read request or a memory write request. The memory read request is used to request to read data in the memory into a register, and the memory write request is used to request to write data in the register into the memory.

[0062] In the write-back stage, the write-back unit 80 writes the data in the memory or the execution result of the instruction into the register corresponding to the target operand.

[0063] In the embodiment of the present application, the load storage unit 40, the calculation unit 50, and the write back unit 80 can all be understood as instruction processing units, that is, units for processing different instructions.

[0064] The present application embodiment relates to an improvement in the execution of load instructions and store instructions by a load storage unit. For more details on the multi-stage pipeline of load instructions and store instructions, please refer to Figure 3 . Figure 3 The execution phase and memory access phase shown each include at least one sub-phase. The execution phase includes at least one sub-phase of dependency release, read control class operands, memory address calculation, and read data class operands. The memory access phase includes at least one sub-phase of issuing a memory request and receiving return information. In different embodiments, the memory request sent to the memory may be a memory read request or a memory write request; the return information may be the data in the memory, or a write success response or a write failure response after writing data to the memory.

[0065] Loading instructions:

[0066] The load instruction is used to read data from the memory 70 into a certain register. In different embodiments, the load instruction has different forms. For example, load instruction 1 is load src dst, which means to load the data in the memory address src into the register dst. For another example, load instruction 2 is load R0, [R1, #4], which means to load the data in the offset memory address pointed to by the base memory address stored in the register R1 after offsetting by 4 bytes into the register R0. For another example, load instruction 3 is if p, load src dst, which means: if the predicate register p is true, load data from the memory address src into the general register dst.

[0067] The load instruction includes at least one source operand and at least one destination operand. The source operand is used to indicate the execution condition and / or memory address, and the destination operand is used to indicate the register to be written. In the above example, src, R1, #4, and p are source operands, and R0 and dst are destination operands. Moreover, these source operands are all control source operands.

[0068] Take the load instruction: if p, load src dst as an example, combined with reference Figure 3 and Figure 4 In the read control operand sub-phase, the load storage unit 40 first reads the control operand p, where p is the value in the predicate register, 1 is true and 0 is false, and determines whether loading is required based on p; if loading is required, in the memory address sub-phase, the memory address src is obtained or calculated; since the load instruction does not need to read the data operand from the register, there is no read data operand sub-phase; in the memory access phase, the load storage unit 40 issues a memory read request to the memory based on the memory address src, and the write back unit 80 receives the return information, which is the data returned by the memory; in the write back phase, the write back unit 80 writes the data into the general register dst. After the write back phase ends, the write back unit 80 sends a dependency release signal to the dependency processing unit 30 to update the dependency information configured for the load instruction. For example, if there are other instructions that depend on the use of the predicate register p and the general register dst by the load instruction, the write back unit 80 notifies the dependency processing unit 30 to release the dependency of other instructions on the current instruction.

[0069] Storage instructions:

[0070] The storage instruction is used to write the data in a register into the memory 70. In different embodiments, the storage instruction has different forms. For example, storage instruction 1 is store src dst, which means loading the data in register src into the memory address dst. For another example, storage instruction 2 is store R0, [R1, #8], which means storing the data in register R0 into the offset memory address after the base memory address stored in register R1 is offset by 8 bytes. For another example, storage instruction 3 is ifp, load src dst, which means: if the predicate register p is true, write the data in register src to register dst.

[0071] The storage instruction includes at least one source operand and at least one destination operand. The source operand is used to indicate the execution condition and / or the register to be read, and the destination operand is used to indicate the memory address. In the above example, src and p are source operands, and R1, #8, and dst are destination operands. Operand src is a data operand, and p, R1, #8, and dst are control operands.

[0072] Take the storage instruction: if p, store src dst as an example, combined with reference Figure 3 and Figure 5 In the read control operand sub-phase, the load storage unit 40 reads the value in the predicate register p to determine whether storage is required; if storage is required, in the memory address calculation sub-phase, the memory address dst is obtained or calculated; in the read data operand sub-phase, the load storage unit 40 reads the data in the general register src; in the memory access phase, the load storage unit 40 issues a memory write request to the memory based on the data in the general register src and the memory address dst to write the data into the memory. Then, the load storage unit 40 sends a dependency release signal to the dependency processing unit 30 to update the dependency information configured for the storage instruction. For example, when other instructions depend on the use of the predicate register p and the general register src by the storage instruction, the load storage unit 40 notifies the dependency processing unit 30 to release the dependency of other instructions on the current instruction.

[0073] Since the same instruction may involve multiple operands, and multiple operands may correspond to different registers. In related technologies, the same instruction only supports one dependency relationship. If multiple other instructions depend on the current instruction at the same time, this dependency relationship is used uniformly for maintenance and release. However, the timing and duration of use of different registers by the same instruction are different. Different registers share the same dependency relationship for maintenance, which will cause some of the registers that are used up first to be occupied for a longer time. Only after the last register is used up can the dependency of other instructions on the current instruction be released uniformly.

[0074] An embodiment of the present application provides a solution for releasing instruction dependencies, hoping to divide multiple registers involved in the same instruction into at least two categories, wherein the dependencies corresponding to the registers that are used first are released first, and the dependencies corresponding to the registers that are used later are released later, so that the registers that are used first can be used by other instructions earlier.

[0075] Figure 6 The schematic diagram of the structure of a processor 200 provided by an exemplary embodiment of the present application is shown. The processor 200 at least includes: an instruction processing unit 90 and a dependency processing unit 30.

[0076] The instruction processing unit 90 is a unit for executing different instructions. Optionally, the instruction processing unit 90 is a unit for processing instructions after decoding. The instruction processing unit 90 includes: at least one of a load storage unit and a write back unit. It is not excluded that in other embodiments, the instruction processing unit 90 includes a calculation unit.

[0077] The dependency processing unit 30 is a unit for processing the dependency relationship between different instructions. Optionally, the dependency processing unit 30 is used to configure the dependency relationship between different instructions and to release the dependency relationship between different instructions.

[0078] In this embodiment, at least two paths are provided between the instruction processing unit 90 and the dependency processing unit 30 , and the at least two paths include: a first type path 32 and a second type path 34 .

[0079] The instruction processing unit 90 is used to send a first dependency release signal to the dependency processing unit 30 through the first type path 32; the dependency processing unit 30 is used to release the dependency relationship corresponding to the first type register based on the first dependency release signal.

[0080] The instruction processing unit 90 is further configured to send a second dependency release signal to the dependency processing unit 30 through the second type path 34; the dependency processing unit 30 is configured to release the dependency relationship corresponding to the second type register based on the second dependency release signal.

[0081] The first type register and the second type register are both registers used by the same instruction, and the same instruction ends using the first type register and the second type register at different times.

[0082] Optionally, the dependency release signal is a signal sent by the instruction processing unit 90 to the dependency processing unit 30, and is used to release the dependency relationship associated with a certain instruction. In the case where an instruction supports at least two dependency relationships, the dependency release signal is used to release at least one dependency relationship associated with a certain instruction. Optionally, the dependency release signal carries at least one of the following information: an instruction identifier, a dependency identifier, a register identifier, a release reason, a status information, a timestamp, and a resource release information.

[0083] Optionally, the first type register is a register corresponding to the first type operand, and the second type register is a register corresponding to the second type operand. The first type operand and the second type operand are both operands of the same instruction. Optionally, the first dependency release signal and the second dependency release signal are sent at different times. For example, the first dependency release signal is sent earlier than the second dependency release signal; for another example, the second dependency release signal is sent earlier than the first dependency release signal.

[0084] A path is a signal transmission path based on hardware implementation, and the signal transmission path includes: a circuit in a chip, a cache, and at least one of other possible electronic devices. That is, a path is a signal transmission path composed of at least one of a metal line, a cache, and other possible electronic devices on a chip. The path in this embodiment is a logical concept, which is used to represent the signal transmission path for the instruction processing unit 90 to send a dependency release signal to the dependency processing unit 30.

[0085] In some embodiments, the dependency processing unit 30 is integrated in the decoding unit 20; in some embodiments, the dependency processing unit 30 is independent of the decoding unit 20; in some embodiments, the dependency processing unit 30 includes the decoding unit 20 or part of the functions of the decoding unit 20; in some embodiments, the dependency processing unit 30 and the decoding unit 20 cooperate to complete the dependency processing. The embodiment of the present application does not limit the implementation form of the dependency processing unit 30.

[0086] In some embodiments, the processor 200 further includes at least one of an instruction fetch unit, a decoding unit, a cache, a memory, and a register. The embodiment of the present application does not limit other units included in the processor 200 and the connection forms between other units.

[0087] In some embodiments, there may be three or more signal paths between the instruction processing unit 90 and the dependency processing unit 30, and the first type path and the second type path are any two of the three or more signal paths. At this time, the registers used by the same instruction may be three or more, and they are released respectively according to three or more release timings, which is not limited in the embodiments of the present application.

[0088] In summary, the processor provided in this embodiment sets a first type of path and a second type of path between the instruction processing unit and the dependency processing unit. For two types of registers used by the same instruction, the first type of path is used to release the first dependency and the second type of path is used to release the second dependency. Since the same instruction uses different types of registers at different times and for different durations, the dependency corresponding to the register that is used first can be released earlier, thereby reducing the duration of the instruction occupying the register that is used first and improving the efficiency of using this part of the registers. At the same time, since this part of the registers can be released earlier, the possibility of parallel instructions between different instructions is increased.

[0089] In different embodiments, there are many possible design methods for the first type of path 32 and the second type of path 34. Exemplarily, the first type of path 32 and the second type of path 34 are any two paths among the three candidate paths. Figure 7 As shown, the three candidate pathways include: a first pathway, a second pathway, and a third pathway.

[0090] The first path is a signal transmission path between the load storage unit 40 and the dependency processing unit 30 .

[0091] The second path is a signal transmission path between the load storage unit 40 and the dependency processing unit 30 .

[0092] The third path is a signal transmission path between the write-back unit 80 and the dependency processing unit 30 .

[0093] The three candidate paths send transmission dependency release signals at different times. Figure 8 The timing at which three candidate paths transmit dependency release signals in a multi-stage pipeline is shown.

[0094] The load storage unit 40 is used to send a first dependency release signal to the dependency processing unit 30 through a first path based on a first time T1, where the first time T1 is the end time of reading the control type source operand.

[0095] The load storage unit 40 is used to send a first dependency release signal or a second dependency release signal to the dependency processing unit 30 through the second path based on the second time T2, and the second time T2 is the end time of issuing a memory read request or a memory write request. Exemplarily, for a load instruction, the second time T2 is the end time of issuing a memory read request, and the load storage unit 40 sends the first dependency release signal to the dependency processing unit 30 through the second path at the second time T2; for a store instruction, the second time T2 is the end time of issuing a memory write request, and the load storage unit 40 sends the second dependency release signal to the dependency processing unit 30 through the second path at the second time T2.

[0096] The write-back unit 80 is used to send a second dependency release signal to the dependency processing unit 30 through a third path based on a third time T3. The third time T3 is the end time of the write-back phase, and the write-back phase is a phase of writing data back to the register.

[0097] It should be noted that “based on time xx” can be understood as: at time xx, or at a subsequent time slightly later than time xx, or at a time indicated by the sum of time xx and the delay time. The delay time includes the time required for the load storage unit 40 or the write back unit 80 to generate the dependency release signal.

[0098] In different embodiments, the processor includes all or part of the three candidate paths mentioned above. The embodiments of the present application at least provide the following embodiments:

[0099] The first type of path is the first path ①, and the second type of path is the second path ②;

[0100] The first type of path is the first path ①, and the second type of path is the third path ③;

[0101] The first type of passage is the second passage ②, and the second type of passage is the third passage ③.

[0102] The above-mentioned embodiments are introduced respectively below.

[0103] Fig. 9 A schematic diagram of dependency release of a load instruction provided by an exemplary embodiment of the present application is shown. Assume that the first type of path includes a first path ①, and the second type of path includes a third path ③.

[0104] For the load instruction, the execution phase includes three sub-phases: dependency processing, reading control source operands, and memory address calculation. After the load storage unit 40 reads the control source operand, the subsequent phases of the current instruction do not need to use the first type register corresponding to the control source operand. At the end time T1 of reading the control operand, the load storage unit 40 uses the first path ① to send a first dependency release signal to the dependency processing unit 30, and the dependency processing unit 30 releases the dependency relationship corresponding to the first type register based on the first dependency release signal.

[0105] Take the load instruction: if p, load src dst as an example, combined with reference Figure 3 and Fig. 9In the sub-phase of reading control operands, the load storage unit 40 reads the control source operand p from the predicate register to determine whether loading is required based on the control source operand p. The control source operand p after reading will be cached in the load storage unit 40. Since the predicate register is no longer needed in the subsequent phases of the load instruction, the load storage unit 40 sends a first dependency release signal to the dependency processing unit 30 through the first path ① at the end time T1 of reading the control operands to trigger the dependency processing unit 30 to release the first dependency relationship corresponding to the predicate register. For example, if the load instruction has a read-before-write dependency with other instructions, after sending the first dependency release signal, other instructions can start or continue to execute without waiting for the end of the write-back phase of the load instruction.

[0106] At the end time T3 of the write-back phase, the write-back unit 80 writes the data in the memory address src to the general register corresponding to the target operand dst. At this time, the write-back unit 80 sends a second dependency release signal to the dependency processing unit 30 through the third path ③, and the dependency processing unit 30 releases the second dependency relationship corresponding to the general register based on the second dependency release signal.

[0107] In the related art, the dependencies corresponding to the load instruction need to be released uniformly at the third time T3, at which time the predicate register and the general register used by the load instruction will be released at the same time. Compared with the related art, the predicate register in the embodiment of the present application can be released at the first time T1, which can greatly advance the release time of the predicate register, thereby improving the use efficiency of the predicate register.

[0108] Fig.10 A schematic diagram of dependency release of a storage instruction provided by an exemplary embodiment of the present application is shown. Assume that the first type of path includes a first path ①, and the second type of path includes a second path ②.

[0109] For storage instructions, the execution phase includes four sub-phases: dependency processing, reading control source operands, memory address calculation, and reading data source operands. After reading the control source operands, the subsequent phases of the storage instruction do not need to use the first type register corresponding to the control source operands. The load storage unit 40 uses the first path ① at the first moment T1 to send a first dependency release signal to the dependency processing unit 30, and the dependency processing unit 30 releases the dependency relationship corresponding to the first type register based on the first dependency release signal. In the memory address calculation sub-phase, the load storage unit 40 obtains or calculates the memory address based on the target operand; in the data source operand reading sub-phase, the data in the general register is read.

[0110] In the memory access phase, the load storage unit 40 will issue a memory write request, which carries a data source operand and a memory address. The data source operand and the memory address will be stored in the cache first and then written to the memory, so the second type register corresponding to the data source operand and / or the memory address will no longer be needed. At the second moment T2 after the load storage unit 40 issues the memory write request, the load storage unit 40 uses the second path ② to send a second dependency release signal to the dependency processing unit, and the dependency processing unit 30 releases the dependency relationship corresponding to the second type register based on the second dependency release signal.

[0111] Take the storage instruction: if p, store src dst as an example, combined with reference Figure 3 and Fig. 9 In the sub-phase of reading control class operands, the load storage unit 40 reads the control class source operand p from the predicate register to determine whether loading is required based on the control class source operand p. The control class source operand p after reading will be cached in the load storage unit 40. Since the predicate register is no longer needed in the subsequent phases of the storage instruction, the load storage unit 40 sends a first dependency release signal to the dependency processing unit 30 through the first path ① at the end time T1 of the sub-phase of reading control class source operands to trigger the dependency processing unit 30 to release the first dependency relationship corresponding to the predicate register based on the first dependency release signal. For example, the storage instruction has a read-before-write dependency with other instructions. After sending the first dependency release signal, other instructions can start or continue to execute without waiting for the end of the recall phase of the load instruction. In the sub-phase of reading data class source operands, the load storage unit 40 reads data from the general register corresponding to the data class source operand src.

[0112] In the memory access phase, the load storage unit 40 will issue a memory write request, which carries the data source operand src and the memory address dst. The data source operand src and the memory address dst will be stored in the cache first and then written to the memory. Therefore, after issuing the memory write request, the load storage unit 40 uses the second path ② to send a second dependency release signal to the dependency processing unit 30. The dependency processing unit 30 releases the instruction dependency corresponding to the second type register based on the second dependency release signal. The second type register is a general register corresponding to the data source operand src.

[0113] In the related art, the dependency relationship corresponding to the storage instruction needs to be uniformly released at the second moment T2, at which time the predicate register and the general register used by the storage instruction will be released at the same time. Compared with the related art, the predicate register in the embodiment of the present application can be released at the first moment T1, which can greatly advance the release timing of the predicate register, thereby improving the use efficiency of the predicate register.

[0114] Fig.11 A schematic diagram of dependency release of a load instruction provided by an exemplary embodiment of the present application is shown. Assume that the first type of path includes the second path ②, and the second type of path includes the third path ③.

[0115] For the load instruction, the execution phase includes three sub-phases: dependency processing, reading control source operands, and memory address calculation. After the load storage unit 40 reads the control source operand, the subsequent phases of the current instruction do not need to use the first type register corresponding to the control source operand. However, due to the absence of the first path ①, the load storage unit 40 waits for the second moment T2 after issuing the memory read request, and uses the second path ② to send a first dependency release signal to the dependency processing unit 30. The dependency processing unit 30 releases the first dependency relationship corresponding to the first type register based on the first dependency release signal.

[0116] Take the load instruction: if p, load src dst as an example, combined with reference Figure 3 and Fig. 9 In the sub-phase of reading control class operands, the load storage unit 40 reads the control class source operand p from the predicate register to determine whether loading is required based on the control class source operand p. The control class source operand p after reading will be cached in the load storage unit 40. However, due to the absence of the first path ①, the load storage unit 40 waits for the second moment T2 after the memory read request is issued, and uses the second path ② to send the first dependency release signal to the dependency processing unit 30 to trigger the dependency processing unit 30 to release the first dependency relationship corresponding to the predicate register. For example, if there is a read-before-write dependency between the load instruction and other instructions, after sending the first dependency release signal, other instructions can start or continue to execute without waiting for the write-back phase of the load instruction to end.

[0117] At the end time T3 of the write-back phase, the write-back unit 80 writes the data in the memory address src to the general register corresponding to the target operand dst. At this time, the write-back unit 80 sends a second dependency release signal to the dependency processing unit 30 through the third path ③, and the dependency processing unit 30 releases the second dependency relationship corresponding to the general register based on the second dependency release signal.

[0118] In the related art, the dependencies corresponding to the load instruction need to be released uniformly at the third time T3, at which time the predicate register and the general register used by the load instruction will be released at the same time. Compared with the related art, the predicate register in the embodiment of the present application can be released at the second time T2, which can greatly advance the release time of the predicate register, thereby improving the use efficiency of the predicate register.

[0119] Since there is no sub-stage for reading data operands in the execution stage of the load instruction, Fig. 9 Compared with the embodiment, the performance difference between the predicate register being released at the second time T2 and being released at the first time T1 is not significant.

[0120] Based on the above embodiments, it can be seen that the embodiments of the present application can release registers in advance, reduce the time overhead of actual registers, and increase the efficiency of register use. In particular, in the scenario where two instructions have a read-before-write dependency, the first instruction responsible for reading first can release the first type of register immediately after reading the first type of register corresponding to the control operand, and the second instruction responsible for writing later can use the first type of register earlier. Therefore, the embodiments of the present application can greatly improve the efficiency of register use in the scenario where the read-before-write dependency exists.

[0121] At this time, under the same compilation algorithm tendency, the embodiment of the present application can also reduce register allocation to a greater extent. The embodiment of the present application cooperates with the compilation algorithm to increase the probability of parallel loading instructions under the condition of the same register usage. For example, an instruction stream is given as an example:

[0122] / / Start of sample code segment

[0123] Load instruction 1 destination operand, source operand 1, source operand 2;

[0124] (Update the register where the source operand 1 is located)

[0125] Load instruction 2 destination operand, source operand 3, source operand 4; / / Source operand 4 reuses the register where source operand 1 is located

[0126] (Update the register where source operand 4 is located)

[0127] Load instruction 3 destination operand, source operand 5, source operand 6; / / Source operand 6 reuses the register where source operand 4 is located

[0128] Computational instructions;

[0129] / / End of sample code segment

[0130] In the above example code segment, if load instruction 1 uses two dependencies, the register where source operand 1 is located can be updated in advance before load instruction 1 finishes reading source operand 1 and before writing the register corresponding to the destination operand. The same is true for the next load instruction 2. Assuming that the update operation cost is small enough, the memory read requests of load instructions 1, load instructions 2, and load instructions 3 can be executed in parallel on the storage system.

[0131] Based on the above embodiments, the dependency processing unit 30 is used to use a first dependency release mechanism to release the first dependency relationship corresponding to the first type of register based on a first dependency release signal; and to use a second dependency release mechanism to release the second dependency relationship corresponding to the second type of register based on a second dependency release signal.

[0132] Optionally, the first dependency release mechanism is a scoreboard mechanism, and the second dependency release mechanism is a sleep-wake mechanism.

[0133] The scoreboard mechanism records the dependency between different instructions through the scoreboard. When the scoreboard monitors that the dependency between the second instruction and the first instruction is released, the second instruction is executed immediately.

[0134] The sleep-wake mechanism is that if the second instruction depends on the execution result of the first instruction, the second instruction is put into sleep state when the first instruction has not been completed; when the first instruction is completed, the second instruction is woken up to continue execution.

[0135] Compared with the sleep wake-up mechanism, the delay of the scoreboard mechanism is smaller, so using the scoreboard mechanism to release the first dependency can release the first type of register earlier. This is because under the scoreboard mechanism, instructions that have not released the dependency after decoding will wait in the instruction queue, and will be directly sent to the subsequent unit for execution after the dependency is released; while the sleep wake-up mechanism needs to be rescheduled after the dependency is released, and can only be sent to the subsequent unit for execution after passing through the instruction fetch stage and the decoding stage in sequence. Therefore, using the scoreboard mechanism for the first type of register that is used first, and using the sleep wake-up mechanism for the second type of register that is used later, can release the first type of register earlier.

[0136] Based on the above embodiments, the processor further includes a decoding unit 20, which is used to set the first dependency and the second dependency for the instructions in the decoding stage. Optionally, the decoding unit 20 analyzes the dependencies between different instructions, such as at least one of the aforementioned read-before-write, write-before-write, and write-before-read. Assuming that the current instruction is the first instruction, if both the first instruction and the second instruction use the first type of register, and the second instruction depends on the first instruction, the first dependency is configured for the first instruction; if both the first instruction and the third instruction use the second type of register, and the third instruction depends on the first instruction, the second dependency is configured for the first instruction.

[0137] When configuring the first dependency, the decoding unit 20 allocates a first resource to the first instruction, and the first resource is a resource required for the first dependency, such as a counter number used to independently count the first dependency; when configuring the second dependency, the decoding unit 20 allocates a second resource to the first instruction, and the second resource is a resource required for the second dependency, such as a counter used to independently count the second dependency.

[0138] In some embodiments, the decoding unit 20 is used to send a first dependency configuration signal to the dependency processing unit 30, and the dependency processing unit 30 is used to configure a first dependency relationship for the above-mentioned instruction based on the first dependency configuration signal; the decoding unit 20 is also used to send a second dependency configuration signal to the dependency processing unit 30, and the dependency processing unit 30 is used to configure a second dependency relationship for the above-mentioned instruction based on the second dependency configuration signal.

[0139] The decoding unit 20 is also used for resending the address of the (first) instruction to the program counter when the resending condition is met when the first dependency and the second dependency cannot be set due to insufficient resources. The program counter is used to store the address of the next instruction to be executed by the processor. For example, the first resource is a resource required for the first dependency and the second resource is a resource required for the second dependency, and the resending condition is that the first resource required by the instruction is sufficient and the second resource is sufficient.

[0140] There is only one case where there is insufficient resources:

[0141] In some embodiments, if the first resource required by the instruction is insufficient and the second resource is sufficient, the instruction can be set to a dormant state, and the wake-up condition is set to that the idle first resource is greater than or equal to the first resource required by the instruction; after the first resource is sufficient to wake up the instruction again, it is detected again whether the above resend condition is met, and if the resend condition is met, the address of the instruction is resent to the program counter. If the first resource required by the instruction is sufficient and the second resource is insufficient, the instruction can be set to a dormant state, and the wake-up condition is set to that the idle second resource is greater than or equal to the second resource required by the instruction; after the second resource is sufficient to wake up the instruction again, it is detected again whether the above resend condition is met, and if the resend condition is met, the address of the instruction is resent to the program counter.

[0142] In other embodiments, if the first resource required by the instruction is insufficient but the second resource is sufficient, only the second dependency may be configured for the instruction without configuring the first dependency; if the first resource required by the instruction is sufficient but the second resource is insufficient, only the first dependency may be configured for the instruction without configuring the second dependency. This allows the current instruction to be executed earlier.

[0143] When both resources are insufficient:

[0144] In some embodiments, if the first resource required by the instruction is insufficient and the second resource is insufficient, the instruction can be set to a dormant state, but due to software and hardware limitations, the wake-up condition cannot be set to the first resource being sufficient and the second resource being sufficient (that is, two conditions cannot be set at the same time, only one condition can be set). At the same time, since the release duration of the first dependency of the previously executed historical instruction is usually greater than the release duration of the second dependency, the wake-up condition set for the instruction is that the idle first resource is greater than or equal to the first resource required by the instruction. After the first resource is sufficient to wake up the instruction again, it is checked again whether the above resending condition is met. If the resending condition is met, the address of the instruction is resent to the program counter. If one resource is still insufficient, it can be handled according to the above situation where only one resource is insufficient.

[0145] This embodiment configures two dependencies for the instruction through the decoding unit, so that the same instruction can support two different dependencies, and then support the release of different types of registers at different times. At the same time, when the resources used to configure the two dependencies are insufficient, the sleep wake-up mechanism is used to temporarily put the first instruction into a dormant state, and then resend it to the program counter for execution when the resources are sufficient, so as to ensure the smooth execution of the instruction.

[0146] Based on the above embodiments, the load storage unit 40 is also used to terminate the execution of the (first) instruction and release the first dependency and the second dependency in the event of an internal exception. The load storage unit 40 may have an internal exception during the execution phase of the first instruction. When an internal exception occurs, the load storage unit 40 sends an exception signal to the decoding unit 20 or other exception handling units to terminate the execution of the instruction. If the instruction is configured with the first dependency and the second dependency at the same time, the load storage unit 40 also needs to notify the dependency processing unit 30 to release the first dependency and the second dependency.

[0147] This embodiment releases the first dependency and the second dependency at the same time by loading the storage unit when an internal exception occurs, so that a corresponding exception handling mechanism can be implemented in a scenario where the same instruction supports two dependencies to ensure the normal operation of the multi-stage pipeline.

[0148] Fig.12 A flowchart of a dependency removal method provided by an exemplary embodiment of the present application is shown. The method is executed by a processor provided by each of the above embodiments, and the processor includes: an instruction processing unit, a dependency processing unit, and at least two paths set between the instruction processing unit and the dependency processing unit, and the at least two paths include a first type path and a second type path. The method includes:

[0149] Step 222: The instruction processing unit sends a first dependency release signal to the dependency processing unit through a first type of path;

[0150] Step 224: the dependency processing unit releases the first dependency relationship corresponding to the first type register based on the first dependency release signal;

[0151] Step 242: The instruction processing unit sends a second dependency release signal to the dependency processing unit through the second type path;

[0152] Step 244: the dependency processing unit releases the second dependency relationship corresponding to the second type register based on the second dependency release signal;

[0153] The first type register and the second type register are both registers used by the same instruction, and the same instruction ends using the first type register and the second type register at different times.

[0154] Optionally, the instruction processing unit is a unit for executing different instructions. Optionally, the instruction processing unit is a unit for processing instructions after decoding. The instruction processing unit includes: at least one of a load storage unit and a write back unit. It is not excluded that in other embodiments, the instruction processing unit includes a calculation unit.

[0155] Optionally, the dependency processing unit is a unit for processing dependency relationships between different instructions. Optionally, the dependency processing unit 30 is used to configure dependency relationships between different instructions and to release dependency relationships between different instructions.

[0156] Optionally, the dependency release signal is a signal sent by the instruction processing unit to the dependency processing unit, and is used to release the dependency relationship associated with a certain instruction. In the case where an instruction supports at least two dependency relationships, the dependency release signal is used to release at least one dependency relationship associated with a certain instruction. Optionally, the dependency release signal carries at least one of the following information: instruction identification, dependency identification, register identification, release reason, status information, timestamp, and resource release information.

[0157] Optionally, the first type register is a register corresponding to the first type operand, and the second type register is a register corresponding to the second type operand. The first type operand and the second type operand are both operands of the same instruction. Optionally, the first dependency release signal and the second dependency release signal are sent at different times. For example, the first dependency release signal is sent earlier than the second dependency release signal; for another example, the second dependency release signal is sent earlier than the first dependency release signal.

[0158] A path is a signal transmission path based on hardware implementation, and the signal transmission path includes: a circuit in a chip, a cache, and at least one of other possible electronic devices. That is, a path is a signal transmission path composed of at least one of a metal line, a cache, and other possible electronic devices on a chip. The path in this embodiment is a logical concept, which is used to represent the signal transmission path for an instruction processing unit to send a dependency release signal to a dependency processing unit.

[0159] In some embodiments, the dependency processing unit is integrated into the decoding unit; in some embodiments, the dependency processing unit is independent of the decoding unit; in some embodiments, the dependency processing unit includes the decoding unit or part of the functions of the decoding unit; in some embodiments, the dependency processing unit and the decoding unit cooperate to complete the dependency processing. The embodiments of the present application are not limited to the implementation form of the dependency processing unit.

[0160] In some embodiments, the processor further includes at least one of an instruction fetch unit, a decoding unit, a cache, a memory, and a register. The embodiments of the present application do not limit other units included in the processor and the connection forms between other units.

[0161] In some embodiments, there may be three or more signal paths between the instruction processing unit and the dependency processing unit, and the first type path and the second type path are any two of the three or more signal paths. In this case, the registers used by the same instruction may be three or more, and they are released respectively according to three or more release opportunities, which is not limited in the embodiments of the present application.

[0162] In summary, the method provided by this embodiment sets a first type of path and a second type of path between the instruction processing unit and the dependency processing unit. For two types of registers used by the same instruction, the first type of path is used to release the first dependency and the second type of path is used to release the second dependency. Since the same instruction uses different types of registers at different times and for different durations, the dependency corresponding to the register that is used first can be released earlier, thereby reducing the duration of the instruction occupying the register that is used first and improving the efficiency of using this part of the registers. At the same time, since this part of the registers can be released earlier, the possibility of parallel instructions between different instructions is increased.

[0163] In different embodiments, there are multiple possible design modes for the first type of path and the second type of path. Exemplarily, the first type of path and the second type of path are any two paths among three candidate paths. The three candidate paths include: a first path, a second path, and a third path.

[0164] The first path is the signal transmission path between the load storage unit and the dependency processing unit.

[0165] The second path is another signal transmission path between the load-store unit and the dependent processing unit.

[0166] The third path is a signal transmission path between the write-back unit and the dependent processing unit.

[0167] The three candidate paths send transmission dependency release signals at different times.

[0168] The load storage unit is used to send a first dependency release signal to the dependency processing unit through a first path based on a first time T1, and the first time T1 is the end time of reading the control type source operand.

[0169] The load storage unit is used to send a first dependency release signal or a second dependency release signal to the dependency processing unit through the second path based on the second moment T2, and the second moment T2 is the end moment of issuing a memory read request or a memory write request. Exemplarily, for a load instruction, the second moment T2 is the end moment of issuing a memory read request, and the load storage unit sends the first dependency release signal to the dependency processing unit through the second path at the second moment T2; for a store instruction, the second moment T2 is the end moment of issuing a memory write request, and the load storage unit sends the second dependency release signal to the dependency processing unit through the second path at the second moment T2.

[0170] The write-back unit 80 is used to send a second dependency release signal to the dependency processing unit through a third path based on a third time T3. The third time T3 is the end time of the write-back phase, and the write-back phase is a phase of writing data back to the register.

[0171] It should be noted that “based on time xx” can be understood as: at time xx, or at a subsequent time slightly later than time xx, or at a time indicated by the sum of time xx and the delay time. The delay time includes the time required for the load storage unit to generate a dependency release signal.

[0172] In different embodiments, the processor includes all or part of the three candidate paths mentioned above. The embodiments of the present application at least provide the following embodiments:

[0173] The first type of path is the first path, and the second type of path is the second path;

[0174] The first type of path is the first path, and the second type of path is the third path;

[0175] The first type of path is the second path, and the second type of path is the third path.

[0176] The above-mentioned embodiments are introduced respectively below.

[0177] In some embodiments, in conjunction with reference Fig. 9as well as Fig. 9 In the related description, the instruction processing unit includes a load storage unit and a write back unit; the first type of path includes: a first path between the load storage unit and the dependent processing unit; the second type of path includes: a third path between the write back unit and the dependent processing unit; the instruction includes a load instruction;

[0178] The instruction processing unit sends a first dependency release signal through a first type of path, including:

[0179] The load-store unit sends a first dependency release signal through a first path based on a first time, the first time being an end time of reading the first type of operand;

[0180] The instruction processing unit sends the second dependency release signal through the second type path, including:

[0181] The write-back unit sends a second dependency release signal through a third path based on a third time, the third time being an end time of the write-back phase;

[0182] The load instruction is executed using a multi-stage pipeline, the multi-stage pipeline includes an execution stage and a write-back stage, and the first moment is a moment in the execution stage.

[0183] In the related art, the dependencies corresponding to the load instruction need to be released uniformly at the third time T3, at which time the predicate register and the general register used by the load instruction will be released at the same time. Compared with the related art, the register corresponding to the first type of operand in the embodiment of the present application can be released at the first time T1, which can greatly advance the release time of the register, thereby improving the use efficiency of the register.

[0184] In some embodiments, in conjunction with reference Fig.10 as well as Fig.10 In the related description, the instruction processing unit includes a load storage unit; the first type of path includes: a first path between the load storage unit and the dependent processing unit; the second type of path includes: a second path between the load storage unit and the dependent processing unit; the above-mentioned instruction includes a storage instruction;

[0185] The instruction processing unit sends a first dependency release signal through a first type of path, including:

[0186] The load-store unit sends a first dependency release signal through a first path based on a first time, the first time being an end time of reading the first type of operand;

[0187] The instruction processing unit sends the second dependency release signal through the second type path, including:

[0188] The load storage unit sends a second dependency release signal through a second path based on a second time, the second time being an end time of issuing the memory write request;

[0189] The storage instruction is executed by a multi-stage pipeline, and the multi-stage pipeline includes an execution stage and a memory access stage. The first moment is a moment in the execution stage, and the second moment is a moment in the memory access stage.

[0190] In the related art, the dependency relationship corresponding to the storage instruction needs to be uniformly released at the second moment T2, at which time the predicate register and the general register used by the storage instruction will be released at the same time. Compared with the related art, the register corresponding to the first type of operand in the embodiment of the present application can be released at the first moment T1, which can greatly advance the release timing of the register, thereby improving the use efficiency of the register.

[0191] In some embodiments, in conjunction with reference Fig.11 , the instruction processing unit includes a load storage unit and a write back unit; the first type of path includes: a second path between the load storage unit and the dependency processing unit; the second type of path includes: a third path between the write back unit and the dependency processing unit; the instruction is a load instruction;

[0192] The instruction processing unit sends a first dependency release signal through a first type of path, including:

[0193] The load storage unit sends a first dependency release signal through a second path based on a second time, the second time being an end time of sending the memory read request;

[0194] The instruction processing unit sends the second dependency release signal through the second type path, including:

[0195] The write-back unit sends a second dependency release signal through a third path based on a third time, the third time being an end time of the write-back phase;

[0196] The load instruction is executed using a multi-stage pipeline, the multi-stage pipeline includes a memory access stage and a write-back stage, and the second moment is a moment in the memory access stage.

[0197] In the related art, the dependencies corresponding to the load instruction need to be released uniformly at the third time T3, at which time the predicate registers and general registers used by the load instruction will be released at the same time. Compared with the related art, in the embodiment of the present application, a part of the registers can be released at the second time T2, which can greatly advance the release time of the part of the registers, thereby improving the use efficiency of the registers.

[0198] Since there is no sub-stage for reading data operands in the execution stage of the load instruction, Fig. 9Compared with the embodiment, the performance difference between releasing the part of registers at the second time T2 and releasing them at the first time T1 is not significant.

[0199] Based on the above embodiments, it can be seen that the embodiments of the present application can release registers in advance, reduce the time overhead of actual registers, and increase the efficiency of register use. In particular, in the scenario where two instructions have a read-before-write dependency, the first instruction responsible for reading first can release the first type of register immediately after reading the first type of register corresponding to the control operand, and the second instruction responsible for writing later can use the first type of register earlier. Therefore, the embodiments of the present application can greatly improve the efficiency of register use in the scenario where the read-before-write dependency exists.

[0200] At this time, under the same compilation algorithm tendency, the embodiment of the present application can further reduce register allocation. The embodiment of the present application cooperates with the compilation algorithm to increase the probability of parallel loading instructions under the condition of the same register usage.

[0201] In some embodiments, the dependency processing unit releases the first dependency relationship corresponding to the first type register based on the first dependency release signal, including: the dependency processing unit uses a first dependency release mechanism to release the first dependency relationship corresponding to the first type register based on the first dependency release signal;

[0202] The dependency processing unit releases the second dependency relationship corresponding to the second type register based on the second dependency release signal, including: the dependency processing unit uses a second dependency release mechanism to release the second dependency relationship corresponding to the second type register based on the second dependency release signal.

[0203] Among them, the first dependency release mechanism is the scoreboard mechanism, and the second dependency release mechanism is the sleep wake-up mechanism.

[0204] Compared with the sleep wake-up mechanism, the delay of the scoreboard mechanism is smaller, so using the scoreboard mechanism to release the first dependency can release the first type of register earlier. This is because under the scoreboard mechanism, instructions that have not released the dependency after decoding will wait in the instruction queue, and will be directly sent to the subsequent unit for execution after the dependency is released; while the sleep wake-up mechanism needs to be rescheduled after the dependency is released, and can only be sent to the subsequent unit for execution after passing through the instruction fetch stage and the decoding stage in sequence. Therefore, using the scoreboard mechanism for the first type of register that is used first, and using the sleep wake-up mechanism for the second type of register that is used later, can release the first type of register earlier.

[0205] In some embodiments, the processor further includes a decoding unit; and the method further includes:

[0206] The decoding unit sets the first dependency and the second dependency for the instruction respectively during the decoding stage.

[0207] This embodiment configures two dependency relationships for the instruction through a decoding unit, so that the same instruction can support two different dependency relationships, and then support the release of different types of registers at different times.

[0208] In some embodiments, the above method further comprises:

[0209] When the decoding unit is unable to set the first dependency and the second dependency due to insufficient resources, the decoding unit resends the address of the instruction to the program counter when waiting for the resending condition to be met. The program counter is used to store the address of the next instruction to be executed by the processor. For example, the first resource is the resource required for the first dependency and the second resource is the resource required for the second dependency. The resending condition is that the first resource required by the instruction is sufficient and the second resource is sufficient.

[0210] There is only one case where there is insufficient resources:

[0211] In some embodiments, if the first resource required by the instruction is insufficient and the second resource is sufficient, the decoding unit sets the instruction to a dormant state, and sets the wake-up condition to be that the idle first resource is greater than or equal to the first resource required by the instruction; after the first resource is sufficient to wake up the instruction again, it is detected again whether the above resend condition is met, and if the resend condition is met, the address of the instruction is resent to the program counter. If the first resource required by the instruction is sufficient and the second resource is insufficient, the decoding unit sets the instruction to a dormant state, and sets the wake-up condition to be that the idle second resource is greater than or equal to the second resource required by the instruction; after the second resource is sufficient to wake up the instruction again, it is detected again whether the above resend condition is met, and if the resend condition is met, the address of the instruction is resent to the program counter.

[0212] In other embodiments, if the first resource required by the instruction is insufficient but the second resource is sufficient, the decoding unit only configures the second dependency for the instruction and does not configure the first dependency; if the first resource required by the instruction is sufficient but the second resource is insufficient, the decoding unit only configures the first dependency for the instruction and does not configure the second dependency. This allows the current instruction to be executed earlier.

[0213] When both resources are insufficient:

[0214] In some embodiments, if the first resource required by the instruction is insufficient and the second resource is insufficient, the decoding unit sets the instruction to a dormant state, but due to software and hardware limitations, the wake-up condition cannot be set to the first resource being sufficient and the second resource being sufficient (that is, two conditions cannot be set at the same time, only one condition can be set). At the same time, since the release duration of the first dependency of the previously executed historical instruction is usually greater than the release duration of the second dependency, the wake-up condition set for the instruction is that the idle first resource is greater than or equal to the first resource required by the instruction. After the first resource is sufficient to wake up the instruction again, it is checked again whether the above resending condition is met. If the resending condition is met, the address of the instruction is resent to the program counter. If one resource is still insufficient, it can be handled according to the above situation where only one resource is insufficient.

[0215] In the embodiment of the present application, when the resources for configuring the two dependencies are insufficient, a sleep wake-up mechanism is used to temporarily put the first instruction into a dormant state, and then the instruction is resent to the program counter for execution when the resources are sufficient, thereby ensuring the smooth execution of the first instruction.

[0216] In some embodiments, the instruction processing unit includes a load storage unit; the method further includes:

[0217] When an internal exception occurs in the load storage unit, the execution of the above instruction is terminated, and the first dependency and the second dependency are released.

[0218] This embodiment releases the first dependency and the second dependency at the same time by loading the storage unit when an internal exception occurs, so that a corresponding exception handling mechanism can be implemented in a scenario where the same instruction supports two dependencies to ensure the normal operation of the pipeline.

[0219] In some embodiments, the first type register is a register corresponding to a control type operand, and the second type register is a register corresponding to a data type operand.

[0220] On the other hand, an embodiment of the present application provides a graphics card, the graphics card comprising the processor as described in the above embodiments. Optionally, the processor is a GPU.

[0221] On the other hand, an embodiment of the present application provides a computer device, the computer device comprising the processor as described above. Optionally, the processor is a GPU. The computer device may be at least one of a portable computer, a desktop computer, a server, a server cluster, an artificial intelligence (AI) computing cluster, and a cloud computing cluster. Among them, the AI ​​computing cluster may also be referred to as an intelligent computing cluster or a smart computing cluster.

[0222] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.

Claims

1. A processor, characterized in that: The processor comprises: an instruction processing unit and a dependency processing unit, at least two paths are arranged between the instruction processing unit and the dependency processing unit, and the at least two paths include a first type path and a second type path; The instruction processing unit is used to send a first dependency release signal to the dependency processing unit through the first type path; the dependency processing unit is used to release the first dependency relationship corresponding to the first type register based on the first dependency release signal; The instruction processing unit is used to send a second dependency release signal to the dependency processing unit through the second type path; the dependency processing unit is used to release the second dependency relationship corresponding to the second type register based on the second dependency release signal; The first type register and the second type register are both registers used by the same instruction.

2. The processor according to claim 1, characterized in that The instruction processing unit includes a load storage unit; The first type of path includes: a first path between the load storage unit and the dependency processing unit; The second type path includes: a second path between the load storage unit and the dependency processing unit.

3. The processor according to claim 2, characterized in that The instructions include storage instructions; The load storage unit is used to send the first dependency release signal to the dependency processing unit through the first path based on a first time, and the first time is the end time of reading the first type of operand; The load storage unit is used to send the second dependency release signal to the dependency processing unit through the second path based on a second time, and the second time is the end time of issuing the memory write request; The storage instruction is executed by a multi-stage pipeline, the multi-stage pipeline includes an execution stage and a memory access stage, the first moment is a moment in the execution stage, and the second moment is a moment in the memory access stage.

4. The processor according to claim 1, characterized in that The instruction processing unit includes a load storage unit and a write back unit; The first type of path includes: a first path between the load storage unit and the dependency processing unit; The second type path includes: a third path between the write-back unit and the dependent processing unit.

5. The processor according to claim 4, characterized in that The instructions include load instructions; The load storage unit is used to send the first dependency release signal to the dependency processing unit through the first path based on a first time, and the first time is the end time of reading the first type of operand; The write-back unit is used to send the second dependency release signal to the dependency processing unit through the third path based on a third moment, and the third moment is the end moment of the write-back phase; The load instruction is executed by a multi-stage pipeline, the multi-stage pipeline includes an execution stage and the write-back stage, and the first moment is a moment in the execution stage.

6. The processor according to claim 1, wherein: The instruction processing unit includes a load storage unit and a write back unit; The first type of path includes: a second path between the load storage unit and the dependency processing unit; The second type path includes: a third path between the write-back unit and the dependent processing unit.

7. The processor according to claim 6, characterized in that The instruction is a load instruction; The load storage unit is used to send the first dependency release signal to the dependency processing unit through the second path based on a second time, and the second time is the end time of issuing the memory read request; The write-back unit is used to send the second dependency release signal to the dependency processing unit through the third path based on a third moment, and the third moment is the end moment of the write-back phase; The load instruction is executed by a multi-stage pipeline, the multi-stage pipeline includes a memory access stage and the write-back stage, and the second moment is a moment in the memory access stage.

8. The processor according to any one of claims 1 to 7, characterized in that: The dependency processing unit is configured to, based on the first dependency release signal, use a first dependency release mechanism to release the first dependency relationship corresponding to the first type of register; and based on the second dependency release signal, use a second dependency release mechanism to release the second dependency relationship corresponding to the second type of register.

9. The processor according to claim 8, characterized in that The first dependency release mechanism is a scoreboard mechanism, and the second dependency release mechanism is a sleep-wake mechanism.

10. The processor according to any one of claims 1 to 7, characterized in that: The processor also includes a decoding unit; The decoding unit is used to set the first dependency and the second dependency for the instruction respectively during the decoding stage.

11. The processor according to claim 10, characterized in that The decoding unit is also used to resend the address of the instruction to the program counter when waiting for the resending condition to be met when insufficient resources make it impossible to set the first dependency and the second dependency. The program counter is used to store the address of the next instruction to be executed by the processor.

12. The processor according to any one of claims 1 to 7, characterized in that: The instruction processing unit includes a load storage unit; The load storage unit is further used to terminate the execution of the instruction and release the first dependency and the second dependency when an internal exception occurs.

13. The processor according to any one of claims 1 to 7, characterized in that: The first type register is a register corresponding to a control type operand, and the second type register is a register corresponding to a data type operand.

14. A graphics card, characterized in that: The graphics card comprises a processor as claimed in any one of claims 1 to 13.

15. A computer device, characterized in that: The computer device comprises a processor as claimed in any one of claims 1 to 13.

16. A method for removing dependency, characterized in that: The method is executed by a processor, the processor comprising: an instruction processing unit and a dependency processing unit, at least two paths are arranged between the instruction processing unit and the dependency processing unit, the at least two paths comprising a first type path and a second type path; the method comprises: The instruction processing unit sends a first dependency release signal to the dependency processing unit through the first type path; the dependency processing unit releases the first dependency relationship corresponding to the first type register based on the first dependency release signal; The instruction processing unit sends a second dependency release signal to the dependency processing unit through the second type path; the dependency processing unit releases the second dependency relationship corresponding to the second type register based on the second dependency release signal; The first type register and the second type register are both registers used by the same instruction.

17. The method according to claim 16, characterized in that The instruction processing unit includes a load storage unit; The first type of path includes: a first path between the load storage unit and the dependency processing unit; the second type of path includes: a second path between the load storage unit and the dependency processing unit; the instruction includes a store instruction; The instruction processing unit sends a first dependency release signal to the dependency processing unit through the first type of path, including: The load storage unit sends the first dependency release signal to the dependency processing unit through the first path based on a first time, and the first time is an end time of reading the first type of operand; The instruction processing unit sends a second dependency release signal to the dependency processing unit through the second type path, including: The load storage unit sends the second dependency release signal to the dependency processing unit through the second path based on a second time, where the second time is an end time of issuing the memory write request; The storage instruction is executed by a multi-stage pipeline, the multi-stage pipeline includes an execution stage and a memory access stage, the first moment is a moment in the execution stage, and the second moment is a moment in the memory access stage.

18. The method according to claim 16, characterized in that The instruction processing unit includes a load storage unit and a write back unit; the first type of path includes: a first path between the load storage unit and the dependency processing unit; the second type of path includes: a third path between the write back unit and the dependency processing unit; the instruction includes a load instruction; The instruction processing unit sends a first dependency release signal to the dependency processing unit through the first type of path, including: The load-store unit sends the first dependency release signal through the first path based on a first time, the first time being an end time of reading the first-category operand; The instruction processing unit sends a second dependency release signal to the dependency processing unit through the second type path, including: The write-back unit sends the second dependency release signal to the dependency processing unit through the third path based on a third time, and the third time is the end time of the write-back phase; The load instruction is executed by a multi-stage pipeline, the multi-stage pipeline includes an execution stage and the write-back stage, and the first moment is a moment in the execution stage.

19. The method according to claim 16, characterized in that The instruction processing unit includes a load storage unit and a write back unit; the first type of path includes: a second path between the load storage unit and the dependency processing unit; the second type of path includes: a third path between the write back unit and the dependency processing unit; the instruction is a load instruction; The instruction processing unit sends a first dependency release signal to the dependency processing unit through the first type of path, including: The load storage unit sends the first dependency release signal to the dependency processing unit through the second path based on a second time, where the second time is an end time of issuing the memory read request; The instruction processing unit sends a second dependency release signal to the dependency processing unit through the second type path, including: The write-back unit sends the second dependency release signal to the dependency processing unit through the third path based on a third time, and the third time is the end time of the write-back phase; The load instruction is executed by a multi-stage pipeline, the multi-stage pipeline includes a memory access stage and the write-back stage, and the second moment is a moment in the memory access stage.

20. The method according to any one of claims 16 to 19, characterized in that: The dependency processing unit releases the first dependency relationship corresponding to the first type register based on the first dependency release signal, including: The dependency processing unit uses a first dependency release mechanism to release the first dependency relationship corresponding to the first type register based on the first dependency release signal; The dependency processing unit releases the second dependency relationship corresponding to the second type register based on the second dependency release signal, including: The dependency processing unit releases the second dependency relationship corresponding to the second type register by using a second dependency release mechanism based on the second dependency release signal.

21. The method according to claim 20, characterized in that The first dependency release mechanism is a scoreboard mechanism, and the second dependency release mechanism is a sleep-wake mechanism.

22. The method according to any one of claims 16 to 19, characterized in that: The processor further includes a decoding unit; and the method further includes: The decoding unit sets the first dependency relationship and the second dependency relationship for the instructions respectively during the decoding stage.

23. The method according to claim 16, characterized in that The method further comprises: When insufficient resources prevent the first dependency and the second dependency from being set, the decoding unit resends the address of the instruction to the program counter when a resending condition is met. The program counter is used to store the address of the next instruction to be executed by the processor.

24. The method according to any one of claims 16 to 19, characterized in that: The instruction processing unit includes a load storage unit; the method further includes: When an internal exception occurs in the load-store unit, the load-store unit ends the execution of the instruction and releases the first dependency and the second dependency.

25. The method according to any one of claims 16 to 19, characterized in that: The first type register is a register corresponding to a control type operand, and the second type register is a register corresponding to a data type operand.

Citation Information

Patent Citations

  • Zero cycle load

    CN103514009A

  • Apparatus and method for program order queue (POQ) to manage data dependencies in processor having multiple instruction queues

    CN111752617A

  • Arithmetic bypassing circuit

    JP1993313893A

  • Single Precision Vector Permute Immediate with "Word" Vector Write Mask

    US20080100628A1

  • Processor architecture

    US20120221834A1

Cited By

  • Tensor instruction optimization method and device and storage medium

    CN121072629A

  • Processor, graphics card, computer device, and dependency release method

    WO2026016845A1