Method for eliminating read port conflicts of multiple register banks of a vliw processor

By compiling the target basic blocks of the VLIW processor and constructing a conflict graph, the problem of multi-register group read port conflicts was solved, achieving efficient conflict elimination and cost reduction.

CN123114545APending Publication Date: 2026-11-17SHANGHAI SUIYUAN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611332665.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-31
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

In existing technologies, the multi-register group read port conflict elimination methods for VLIW processors have the problems that software solutions cannot avoid conflicts, while hardware solutions have uncontrollable effects and are costly and inefficient.

Method used

By compiling the target basic block, machine instructions are generated and scheduling cycles are allocated. A read register conflict graph is constructed, and the register group is determined based on the conflict graph to eliminate read port conflicts.

Benefits of technology

It effectively eliminates read port conflicts caused by register group allocation, reduces elimination costs, improves efficiency, and avoids pipeline stoppages caused by conflicts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123114545A_ABST
    Figure CN123114545A_ABST
Patent Text Reader

Abstract

This invention discloses a method for eliminating read port conflicts in a VLIW processor with multiple register groups, comprising: generating machine instructions corresponding to a target basic block and allocating scheduling cycles for each machine instruction; sequentially using each read register in each machine instruction as the current read register, and using machine instructions based on the registers corresponding to each current read register to determine the read conflict register, the current same-cycle read register, and the paired same-cycle read register corresponding to each current read register; constructing a read register conflict graph corresponding to the target basic block based on each current read register and the read conflict register, the current same-cycle read register, and the paired same-cycle read register corresponding to each current read register; and determining the register group corresponding to each current read register based on the read register conflict graph, which can effectively eliminate read port conflicts caused by register group allocation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of register file management, and more particularly to a method for eliminating read port conflicts in multiple register groups of VLIW processors. Background Technology

[0002] VLIW processors, as processor architectures that leverage instruction-level parallelism, are widely used in computationally intensive chips such as deep learning accelerators and digital signal processors. The core characteristic of VLIW processors is that a single Very Long Instruction (VLIW) (i.e., an instruction packet) contains multiple sub-instructions, which can be simultaneously issued to different functional units for parallel execution within the same scheduling cycle. Registers are the fastest-accessing memory units in VLIW processors. To balance register file area, access latency, and power consumption, most modern VLIW processors employ a multi-register bank architecture. However, each register bank only supports a limited number of read operations per scheduling cycle. When the processor pipeline executes the same instruction packet, it needs to read the registers of each sub-instruction within the packet in parallel. If the number of registers belonging to the same register bank within the read register set exceeds the read port limit, a read port conflict will occur.

[0003] Currently, at the hardware level, a register hash remapping scheme is often used to reallocate register groups for each read register, thereby eliminating read port conflicts. Specifically, this scheme adds hardware hash units to the register read path and dynamically remaps the software-specified read register numbers to different register groups at runtime, thus distributing registers that originally belonged to the same register group to different groups. At the software level, register allocation algorithms or instruction scheduling algorithms are often used to assign physical read register numbers to virtual registers to alleviate read port conflicts. Register allocation algorithms include graph coloring algorithms and linear scan algorithms, while instruction scheduling algorithms include list scheduling algorithms and critical path scheduling algorithms.

[0004] However, for register hash remapping schemes, firstly, since the mapping result of the same read register must be consistent across all instruction packets, modifying a mapping in one place will affect the register group assignment of that read register in all other instruction packets. This could lead to the elimination of one conflict while introducing new conflicts in other locations, making the global effect uncontrollable. Secondly, the hardware hash unit added by the register hash remapping scheme increases the register heap area and read path timing delay, thereby increasing overhead and reducing the efficiency of VLIW processor operations. Finally, since the register hash remapping scheme is inherently a probabilistic method, it often cannot guarantee the elimination of all multi-register group conflicts. For register allocation algorithms or instruction scheduling algorithms, since these algorithms are unaware of the multi-register group structure and only complete the mapping from virtual registers to physical read register numbers, they cannot control the register group to which the allocated physical read registers belong. Therefore, when executed on a VLIW processor, they inevitably trigger read port conflicts frequently. Summary of the Invention

[0005] This invention provides a read port conflict elimination method for VLIW processors with multiple register groups. It solves the problems that existing software solutions cannot avoid conflicts caused by register group allocation, and existing hardware solutions have uncontrollable effects, high costs, and low efficiency. It can effectively eliminate read port conflicts caused by register group allocation, reduce the cost of read port conflict elimination, and improve the efficiency of read port conflict elimination.

[0006] In a first aspect, embodiments of the present invention provide a method for eliminating read port conflicts for multiple register groups in a VLIW processor, comprising: compiling a target basic block to obtain machine instructions corresponding to the target basic block, and allocating scheduling cycles for each machine instruction; sequentially using each read register in each machine instruction as the current read register, and using machine instructions based on the registers corresponding to each current read register to determine the read conflict register, the current co-cycle read register, and the paired co-cycle read register corresponding to each current read register; constructing a read register conflict graph corresponding to the target basic block based on each current read register and the read conflict register, the current co-cycle read register, and the paired co-cycle read register corresponding to each current read register; and determining the register group corresponding to each current read register based on the read register conflict graph to eliminate read port conflicts for multiple register groups in a VLIW processor.

[0007] Secondly, embodiments of the present invention also provide a read port conflict elimination device for a VLIW processor with multiple register groups, comprising: a scheduling cycle allocation module, used to compile a target basic block to obtain machine instructions corresponding to the target basic block, and allocate scheduling cycles for each machine instruction; a register relationship determination module, used to sequentially take each read register in each machine instruction as the current read register, and use machine instructions based on the registers corresponding to each current read register to determine the read conflict register, the current same-cycle read register, and the paired same-cycle read register corresponding to each current read register; a conflict graph construction module, used to construct a read register conflict graph corresponding to the target basic block based on each current read register, and the read conflict register, the current same-cycle read register, and the paired same-cycle read register corresponding to each current read register; and a register group allocation module, used to determine the register group corresponding to each current read register based on the read register conflict graph, so as to eliminate read port conflicts for a VLIW processor with multiple register groups.

[0008] Thirdly, embodiments of the present invention also provide an electronic device, the electronic device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores a computer program executable by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to execute the read port conflict elimination method for VLIW processor multi-register set provided in any embodiment of the present invention.

[0009] Fourthly, embodiments of the present invention also provide a computer-readable storage medium storing computer instructions for causing a processor to execute and implement the read port conflict elimination method for VLIW processor multi-register set provided in any embodiment of the present invention.

[0010] The technical solution of this invention generates machine instructions corresponding to the target basic block and allocates scheduling cycles for each machine instruction; sequentially uses each read register in each machine instruction as the current read register, and uses machine instructions based on the registers corresponding to each current read register to determine the read conflict register, current same-cycle read register, and paired same-cycle read register corresponding to each current read register; based on each current read register and the read conflict register, current same-cycle read register, and paired same-cycle read register corresponding to each current read register, a read register conflict graph corresponding to the target basic block is constructed; and based on the read register conflict graph, the register groups corresponding to each current read register are determined. This technical means solves the problems that existing software solutions cannot avoid conflicts caused by register group allocation, and that existing hardware solutions have uncontrollable effects, high costs, and low efficiency. It can effectively eliminate read port conflicts caused by register group allocation, reduce the cost of read port conflict elimination, and improve the efficiency of read port conflict elimination.

[0011] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description

[0012] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0013] Figure 1 This is a flowchart of a read port conflict elimination method for a VLIW processor with multiple register groups, provided in Embodiment 1 of the present invention.

[0014] Figure 2 This is a flowchart of another method for eliminating read port conflicts for VLIW processor multi-register groups, provided by Embodiment 2 of the present invention.

[0015] Figure 3 This is a schematic diagram of a read register conflict diagram provided in Embodiment 2 of the present invention.

[0016] Figure 4 This is a schematic diagram of a read port conflict elimination device for a VLIW processor multi-register group according to Embodiment 3 of the present invention.

[0017] Figure 5 This is a schematic diagram of the structure of an electronic device provided in Embodiment 4 of the present invention. Detailed Implementation

[0018] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0019] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0020] Example 1 Figure 1 This is a flowchart of a read port conflict elimination method for a VLIW processor with multiple register groups, provided in Embodiment 1 of the present invention.

[0021] This embodiment is applicable to situations where a VLIW processor contains a multi-register set register file, and each read register is assigned to a suitable register set to eliminate read port conflicts. This method can be executed by a read port conflict elimination device for a VLIW processor's multi-register set. This read port conflict elimination device for a VLIW processor's multi-register set can be implemented in hardware and / or software. This read port conflict elimination device for a VLIW processor's multi-register set can be configured in an electronic device, which can be a VLIW processor or a control device capable of controlling the VLIW processor, as long as it can execute the read port conflict elimination method for a VLIW processor's multi-register set. This embodiment of the invention does not limit the specific device type of the electronic device.

[0022] like Figure 1 As shown, this embodiment discloses a read port conflict elimination method for VLIW processor multi-register groups. The method is executed by a compiler adapted to the VLIW processor and includes steps S110-S140.

[0023] S110. Compile the target basic block to obtain the machine instructions corresponding to the target basic block, and allocate scheduling cycles for each machine instruction.

[0024] In this embodiment, the target basic block can be understood as the basic block that needs to allocate an appropriate register set for its internal read registers to avoid read port conflicts. A read port conflict refers to an access conflict caused by multiple sub-instructions concurrently accessing the same register set within the same scheduling cycle, where the access requests exceed the read port capacity of that register set.

[0025] In this step, specifically, to meet the minimum latency requirement for instruction execution, the instruction scheduling optimization operation is only performed within a single basic block. Therefore, a target basic block can be obtained and compiled to obtain the machine instructions corresponding to the target basic block. Then, since each machine instruction is a sub-instruction within an instruction package, machine instructions with the same scheduling cycle belong to the same instruction package and will ultimately be executed together. Therefore, machine instructions with the same scheduling cycle may experience register set read access conflicts. Based on this, it is necessary to allocate scheduling cycles to each machine instruction to avoid register set read access conflicts caused by improper allocation of machine instructions with the same scheduling cycle.

[0026] For example, suppose the target basic block is compiled to obtain the following machine instructions: First machine instruction "vstore.inc %4:vreg, %5:ptr", Second machine instruction "vadd %0:vreg, %1:vreg, %2:vreg", Third machine instruction "vload.inc %6:vreg, %7:ptr", Fourth machine instruction "saddi %8:sreg, 0xff", Fifth machine instruction "store.inc %4:vreg, %5:ptr", Sixth machine instruction "vadd %10:vreg, %0:vreg, %8:vreg", Seventh machine instruction "vload.inc %6:vreg, %7:ptr", Eighth machine instruction "saddi %8:sreg, 0xff", Ninth machine instruction "vstore.inc %44:vreg, %5:ptr", Tenth machine instruction "vadd %11:vreg, The instructions "%0:vreg, %9:vreg", the eleventh machine instruction "vload.inc %6:vreg, %7:ptr", and the twelfth machine instruction "saddi %8:sreg, 0xff" can allocate the first scheduling cycle for the first, second, third, and fourth machine instructions; allocate the second scheduling cycle for the fifth, sixth, seventh, and eighth machine instructions; and allocate the third scheduling cycle for the ninth, tenth, eleventh, and twelfth machine instructions.

[0027] S120. Sequentially take each read register in each machine instruction as the current read register, and use machine instructions based on the registers corresponding to each current read register to determine the read conflict register, the current same-cycle read register, and the paired same-cycle read register corresponding to each current read register.

[0028] In this embodiment, register usage machine instructions can be understood as machine instructions within the target basic block that use the currently read register. A read conflict register can be understood as a read register of the same type that conflicts with the currently read register; specifically, it refers to read registers of the same type within the register usage machine instructions, excluding the read register itself. A current same-cycle read register can be understood as a read register of the same type that is in the same scheduling cycle as the current read register. A paired same-cycle read register can be understood as a read register of the same type that is in the same scheduling cycle as the read conflict register. It is worth noting that, to ensure that the current read register, read conflict register, current same-cycle read register, and paired same-cycle read register are all registers of the same type, they can be pre-defined to be either vector registers or scalar registers.

[0029] In this step, specifically, each machine instruction can be iterated sequentially. For each machine instruction, the read registers that have not yet undergone read conflict register and same-cycle read register selection operations are selected as the current read registers. After a read register is selected as the current read register, the following read conflict register and same-cycle read register selection operations are performed on that current read register: Based on the machine instruction used by the register where the current read register is located, at least one read conflict register corresponding to the current read register is determined. Simultaneously, based on the same-cycle machine instructions that belong to the same scheduling cycle as the machine instructions used by each register, the current same-cycle read register and the paired same-cycle read register corresponding to the current read register are determined.

[0030] Taking the current read register, read conflict register, current same-cycle read register, and paired same-cycle read register as vector registers as an example, since the read vector register in the first machine instruction is %4:vreg, the read vector registers in the second machine instruction are %1:vreg and %2:vreg, the read vector registers in the fifth machine instruction are %4:vreg, the read vector registers in the sixth machine instruction are %0:vreg and %8:vreg, the read vector registers in the ninth machine instruction are %44:vreg, the read vector registers in the tenth machine instruction are %0:vreg and %9:vreg, and the third, fourth, seventh, eighth, eleventh, and twelfth machine instructions do not contain read vector registers, %4:vreg, %1:vreg, %2:vreg, %0:vreg, %8:vreg, %44:vreg, and %9:vreg can be used as the current read registers in sequence. Furthermore, taking %0:vreg as an example, at least one read conflict register corresponding to %0:vreg can be determined based on the sixth and tenth machine instructions. Simultaneously, based on the same-cycle machine instructions in the same scheduling period as the sixth machine instruction and the same-cycle machine instructions in the same scheduling period as the tenth machine instruction, the current same-cycle read register and the paired same-cycle read register corresponding to %0:vreg can be determined.

[0031] S130. Based on each current read register, and the read conflict register, current same-cycle read register, and paired same-cycle read register corresponding to each current read register, construct the read register conflict graph corresponding to the target basic block.

[0032] In this embodiment, the read register conflict graph can be understood as an undirected graph used to reflect the read conflict relationship between various read registers.

[0033] In this step, specifically, based on each current read register, and the read conflict register, current same-cycle read register, and paired same-cycle read register corresponding to each current read register, an undirected graph is constructed, and this undirected graph is used as the read register conflict graph corresponding to the target basic block.

[0034] S140. Based on the read register conflict graph, determine the register group corresponding to each current read register to eliminate read port conflicts for VLIW processors with multiple register groups.

[0035] In this step, specifically, the conflict handling priority corresponding to each currently read register can be determined based on the read register conflict graph. Then, the register group corresponding to each currently read register can be determined based on the conflict handling priority corresponding to each currently read register.

[0036] The technical solution of this embodiment compiles the target basic block to obtain machine instructions corresponding to the target basic block and allocates scheduling cycles for each machine instruction; sequentially, each read register in each machine instruction is taken as the current read register, and machine instructions are used based on the registers corresponding to each current read register to determine the read conflict register, current same-cycle read register, and paired same-cycle read register corresponding to each current read register; based on each current read register and the read conflict register, current same-cycle read register, and paired same-cycle read register corresponding to each current read register, a read register conflict graph corresponding to the target basic block is constructed; based on the read register conflict graph, the register group corresponding to each current read register is determined. This technical means solves the problems that existing software solutions cannot avoid conflicts caused by register group allocation, and existing hardware solutions have uncontrollable effects, high costs, and low efficiency. It can effectively eliminate read port conflicts caused by register group allocation, reduce the cost of read port conflict elimination, and improve the efficiency of read port conflict elimination.

[0037] Example 2 Figure 2 This is a flowchart of another read port conflict elimination method for VLIW processor multi-register groups provided by Embodiment 2 of the present invention. This embodiment is a further optimization and extension based on the above embodiments and can be combined with various optional technical solutions in the above embodiments.

[0038] like Figure 2 As shown, this embodiment discloses a read port conflict elimination method for VLIW processor multi-register groups, including S210-S290.

[0039] S210. Compile the target basic block to obtain the machine instructions corresponding to the target basic block, and allocate scheduling cycles for each machine instruction.

[0040] S220. Sequentially take each read register in each machine instruction as the current read register, and determine the read conflict register corresponding to each current read register based on the instruction for using the register in the same cycle and the instruction for using the register in a different cycle.

[0041] In this step, specifically, the following read conflict register determination operation can be performed for each current read register: In the target basic block, the first machine instruction containing the current read register is designated as its corresponding in-cycle register use instruction, and the subsequent machine instructions containing the current read register are designated as their corresponding out-of-cycle register use instructions. Then, the read registers of the same type among the in-cycle register use instructions and out-of-cycle register use instructions, excluding the current read register, are identified as the read conflict registers corresponding to the current read register.

[0042] For example, assuming the current register read is %0:vreg in the sixth machine instruction, the sixth machine instruction can be used as the same-cycle register use instruction corresponding to %0:vreg, and the tenth machine instruction can be used as the different-cycle register use instruction corresponding to %0:vreg. Then, %8:vreg in the sixth machine instruction and %9:vreg in the tenth machine instruction can be identified as the read conflict registers corresponding to %0:vreg.

[0043] S230. Based on the same-cycle machine instructions that belong to the same scheduling cycle as the instructions used by each same-cycle register, determine the current same-cycle read register corresponding to each current read register.

[0044] In this step, specifically, the following current same-cycle read register determination operation can be performed for each current read register: extract the same type of read register corresponding to the current read register from the same-cycle machine instructions that belong to the same scheduling cycle as the instruction that uses the same-cycle register, and use it as the current same-cycle read register corresponding to the current read register.

[0045] Taking the current read register as %0:vreg from the sixth machine instruction as an example, after determining that the instruction using the same-cycle register corresponding to %0:vreg is the sixth machine instruction, the fifth, seventh, and eighth machine instructions can be used as the same-cycle machine instructions corresponding to the sixth machine instruction. Then, since only the fifth machine instruction contains a read register of the same type corresponding to %0:vreg, %4:vreg from the fifth machine instruction can be used as the current same-cycle read register corresponding to %0:vreg.

[0046] S240. Based on the same-cycle machine instruction that belongs to the same scheduling cycle as the instruction used by each different cycle register, determine the paired same-cycle read register corresponding to each current read register.

[0047] In this embodiment, the current read register, the read conflict register, the current same-cycle read register, and the paired same-cycle read register are all vector registers.

[0048] In this step, specifically, the following paired same-cycle read register determination operation can be performed for each current read register: extract the same type of read register corresponding to the current read register from the same-cycle machine instructions that belong to the same scheduling cycle as the instructions that use out-of-cycle registers, and use them as the paired same-cycle read registers corresponding to the current read register.

[0049] Taking the current register read as %0:vreg from the sixth machine instruction as an example, after determining that the instruction for using the out-of-cycle register corresponding to %0:vreg is the tenth machine instruction, the ninth, eleventh, and twelfth machine instructions can be regarded as the same-cycle machine instructions corresponding to the tenth machine instruction. Then, since only the ninth machine instruction contains a read register of the same type corresponding to %0:vreg, %44:vreg from the ninth machine instruction can be regarded as the paired same-cycle read register corresponding to %0:vreg.

[0050] S250. Using each current read register as a node, select the target read register that has not yet established a corresponding undirected edge from the read conflict register, current same-cycle read register and paired same-cycle read register that correspond to each current read register.

[0051] Taking the current read register as %0:vreg in the sixth machine instruction as an example, after determining that the read conflict registers corresponding to %0:vreg are %8:vreg and %9:vreg, the current in-cycle read register corresponding to %0:vreg is %4:vreg, and the paired in-cycle read register corresponding to %0:vreg is %44:vreg, we can then determine whether undirected edges have been established between %0:vreg and %8:vreg, %0:vreg and %9:vreg, %0:vreg and %4:vreg, and %0:vreg and %44:vreg. Since an undirected edge has been established between %0:vreg and %4:vreg with %4:vreg as the reference, while no undirected edges have been established between %0:vreg and %8:vreg, %0:vreg and %9:vreg, and %0:vreg and %44:vreg, %8:vreg, %9:vreg, and %44:vreg can be used as the target read registers corresponding to %0:vreg.

[0052] S260. Establish an undirected edge between each current read register and the corresponding target read register to obtain the read register conflict graph corresponding to the target basic block.

[0053] Taking a target basic block as a basic block composed of machine instructions from the first to the twelfth machine instructions as an example, it can be constructed using %4:vreg, %1:vreg, %2:vreg, %0:vreg, %8:vreg, %44:vreg, and %9:vreg as the current read registers, respectively, to obtain the following: Figure 3 The diagram shows a register read conflict.

[0054] S270. Based on the read register conflict graph, determine the number of undirected edges corresponding to each current read register.

[0055] For example, such as Figure 3As shown, the number of undirected edges corresponding to %4:vreg, %1:vreg, %2:vreg, %0:vreg, %8:vreg, %44:vreg and %9:vreg can be determined to be 4, 2, 2, 4, 2, 2 and 2 respectively.

[0056] S280. Determine the conflict handling priority corresponding to each current read register based on the number of undirected edges corresponding to each current read register.

[0057] In this embodiment, the more undirected edges corresponding to the current read register, the higher the priority of conflict handling corresponding to the current read register.

[0058] In this step, specifically, the degree of conflict with each current read register can be determined based on the number of undirected edges corresponding to each current read register. The more undirected edges a current read register has, the more severe the conflict. Then, a higher conflict handling priority can be assigned to current read registers with more severe conflicts, that is, current read registers with more undirected edges can be assigned a higher conflict handling priority.

[0059] For example, if the number of undirected edges corresponding to %4:vreg, %1:vreg, %2:vreg, %0:vreg, %8:vreg, %44:vreg, and %9:vreg are 4, 2, 2, 4, 2, 2, and 2 respectively, the conflict handling priority of %4:vreg and %0:vreg can be determined to be higher than that of %1:vreg, %2:vreg, %8:vreg, %44:vreg, and %9:vreg.

[0060] S290. Based on the conflict handling priority corresponding to each current read register, determine the register group corresponding to each current read register to eliminate read port conflicts for VLIW processor multi-register groups.

[0061] In this step, specifically, the current read register with the highest conflict handling priority can be selected from all current read registers as the read register to be allocated. Then, based on the read conflict register corresponding to the read register to be allocated, the current in-cycle read register, and the paired in-cycle read register, the register group corresponding to the read register to be allocated is determined. It is worth noting that for current read registers with the same conflict handling priority, the current read register in the earlier generated machine instruction can be given priority as the read register to be allocated.

[0062] Optionally, based on the conflict handling priority corresponding to each current read register, the register group corresponding to each current read register is determined, including: sequentially selecting the current read register with the highest conflict handling priority from each current read register as the read register to be allocated; when the read conflict register, current same-cycle read register, and paired same-cycle read register corresponding to the read register to be allocated have not yet been allocated to any register group, the read register to be allocated is allocated to any register group; when the read conflict register, current same-cycle read register, or paired same-cycle read register corresponding to the read register to be allocated has been allocated to any register group, the target register group corresponding to the read register to be allocated is determined based on the allocated register groups corresponding to the read conflict register, current same-cycle read register, and paired same-cycle read register.

[0063] Specifically, the current read register with the highest conflict handling priority can be added to the working list as the read register to be allocated, and the working list is checked to see if it is empty. If the working list is not empty, the read register to be allocated is popped from the working list. Then, the read conflict register corresponding to the read register to be allocated, the current same-cycle read register, and the paired same-cycle read register can be added as the adjacent read registers corresponding to the read register to be allocated, and the allocated register groups corresponding to the adjacent read registers are added to the list of unavailable register groups corresponding to the read register to be allocated. If the list of unavailable register groups corresponding to the read register to be allocated is empty, that is, the read conflict register, the current same-cycle read register, and the paired same-cycle read register corresponding to the read register to be allocated have not yet been allocated to any register group, then the read register to be allocated is allocated to any register group.

[0064] If the list of unavailable register sets corresponding to the read register to be allocated is not empty, that is, if the read conflict register, the current same-cycle read register, or the paired same-cycle read register corresponding to the read register to be allocated has been allocated to any register set, then one register that is not in the list of unavailable register sets is selected from the multi-register set register file as the target register set corresponding to the read register to be allocated. In other words, any register set other than the already allocated register set is determined as the target register set corresponding to the read register to be allocated.

[0065] Finally, it can be determined whether register sets have been allocated for all current read registers. If not, the current read register with the highest conflict handling priority among those that have not yet been allocated register sets is selected as the new read register to be allocated. After adding the new read register to be allocated to the working list, the operation of checking whether the working list is empty is returned until register sets have been allocated for all current read registers. At this point, register sets corresponding to each current read register are obtained, and all registers belonging to the same register set are selected as candidate registers based on the register set partitioning method.

[0066] Taking the undirected edge numbers corresponding to %4:vreg, %1:vreg, %2:vreg, %0:vreg, %8:vreg, %44:vreg, and %9:vreg as 4, 2, 2, 4, 2, 2, and 2 respectively, since %4:vreg and %0:vreg have the highest and same conflict handling priority, considering that %4:vreg is the read register in the first machine instruction of the target basic block, %4:vreg can be used as the read register to be allocated. Then, since %1:vreg, %2:vreg, %0:vreg, and %8:vreg have not yet been allocated to any register set, %4:vreg can be allocated to register set 0. After that, %0:vreg can be used as the new read register to be allocated. Although %8:vreg, %44:vreg, and %9:vreg have not yet been allocated to any register set, but %4:vreg has been allocated to register set 0, %0:vreg can be allocated to register set 1. Finally, %1:vreg, %2:vreg, %8:vreg, %44:vreg, and %9:vreg can be assigned to register groups 2, 3, 4, 5, and 6 in sequence.

[0067] The technical solution of this embodiment determines the read conflict register, current same-cycle read register, and paired same-cycle read register corresponding to each current read register by using the machine instructions used in the registers where each current read register is located, as well as the same-cycle machine instructions belonging to the same scheduling cycle as each register's machine instructions. Based on each current read register, and the read conflict register, current same-cycle read register, and paired same-cycle read register corresponding to each current read register, a read register conflict graph corresponding to the target basic block is constructed. The technical means of determining the register group corresponding to each current read register based on the read register conflict graph can avoid the situation where it is difficult to avoid read port conflicts under all clock cycles by constructing the read register conflict graph based only on the machine instructions within a certain scheduling cycle. This effectively avoids read port conflicts under all clock cycles, thereby eliminating pipeline stalls caused by read port conflicts.

[0068] Example 3 Figure 4 This is a schematic diagram of a read port conflict elimination device for a VLIW processor multi-register group according to Embodiment 3 of the present invention.

[0069] This embodiment is applicable to situations where a VLIW processor contains a multi-register set register file, and each read register is assigned to a suitable register set to eliminate read port conflicts. The read port conflict elimination device for the VLIW processor multi-register set can be implemented in hardware and / or software. The read port conflict elimination device for the VLIW processor multi-register set can be configured in an electronic device, which can be a VLIW processor or a control device capable of controlling the VLIW processor, as long as it can execute the read port conflict elimination method for the VLIW processor multi-register set. This embodiment of the invention does not limit the specific device type of the electronic device.

[0070] like Figure 4 As shown, the read port conflict elimination device for VLIW processor multi-register groups disclosed in this embodiment includes a scheduling cycle allocation module 41, a register relationship determination module 42, a conflict graph construction module 43, and a register group allocation module 44.

[0071] Among them, the scheduling cycle allocation module 41 is used to compile the target basic block to obtain the machine instructions corresponding to the target basic block, and allocate a scheduling cycle for each machine instruction. The register relationship determination module 42 is used to sequentially take each read register in each machine instruction as the current read register, and use machine instructions based on the registers corresponding to each current read register to determine the read conflict register, the current same-cycle read register and the paired same-cycle read register corresponding to each current read register. The conflict graph construction module 43 is used to construct a read register conflict graph corresponding to the target basic block based on each current read register and the read conflict register, current same-cycle read register and paired same-cycle read register corresponding to each current read register. The register group allocation module 44 is used to determine the register group corresponding to each currently read register based on the read register conflict graph, so as to eliminate read port conflicts for VLIW processor multi-register groups.

[0072] The technical solution in this embodiment, through the cooperation of the scheduling cycle allocation module 41, the register relationship determination module 42, the conflict graph construction module 43, and the register group allocation module 44, solves the problems that existing software solutions cannot avoid conflicts caused by register group allocation, and that existing hardware solutions have uncontrollable effects, high costs, and low efficiency. It can effectively eliminate read port conflicts caused by register group allocation, reduce the cost of read port conflict elimination, and improve the efficiency of read port conflict elimination.

[0073] Optionally, the current read register, the read conflict register, the current same-cycle read register, and the paired same-cycle read register can all be vector registers.

[0074] Optionally, when the register usage machine instructions include in-cycle register usage instructions and out-of-cycle register usage instructions, the register relationship determination module 42 is specifically used to: determine the read conflict registers corresponding to each current read register based on the in-cycle register usage instructions and out-of-cycle register usage instructions where each current read register is located; determine the current in-cycle read registers corresponding to each current read register based on the in-cycle machine instructions that belong to the same scheduling cycle as each in-cycle register usage instruction; and determine the paired in-cycle read registers corresponding to each current read register based on the in-cycle machine instructions that belong to the same scheduling cycle as each out-of-cycle register usage instruction.

[0075] Optionally, the conflict graph construction module 43 is specifically used to: using each current read register as a node, filter out the target read registers that have not yet established corresponding undirected edges from the read conflict registers, current same-cycle read registers and paired same-cycle read registers corresponding to each current read register; establish undirected edges between each current read register and the corresponding target read register to obtain the read register conflict graph corresponding to the target basic block.

[0076] Optionally, the register set allocation module 44 includes: The undirected edge number determination unit is used to determine the number of undirected edges corresponding to each current read register based on the read register conflict graph; The priority determination unit is used to determine the conflict handling priority corresponding to each current read register based on the number of undirected edges corresponding to each current read register. The register group allocation unit is used to determine the register group corresponding to each current read register based on the conflict handling priority corresponding to each current read register.

[0077] Optionally, the register set allocation unit includes: The register to be allocated selection sub-unit is used to sequentially select the current read register with the highest conflict handling priority from each current read register as the register to be allocated; The first register allocation subunit is used to allocate the read register to any register group when the read conflict register corresponding to the read register to be allocated, the current same-cycle read register, and the paired same-cycle read register have not been allocated to any register group; The second register allocation subunit is used to determine the target register group corresponding to the read register to be allocated, based on the allocated register groups corresponding to the read conflict register, the current same-cycle read register, and the paired same-cycle read register when the read conflict register, the current same-cycle read register, or the paired same-cycle read register corresponding to the read register to be allocated has been allocated to any register group.

[0078] Optionally, the second register allocation subunit is specifically used to: determine any register group other than the already allocated register group as the target register group corresponding to the read register to be allocated.

[0079] The read port conflict elimination device for VLIW processor multi-register groups provided in this embodiment of the invention can execute the read port conflict elimination method for VLIW processor multi-register groups provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the method. Contents not described in detail in this embodiment can be referred to the descriptions in any method embodiment of this application.

[0080] Example 4 Figure 5 A schematic diagram of the structure of an electronic device 10 that can be used to implement embodiments of the present invention is shown. For example... Figure 5 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory 12 or a random access memory 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the read-only memory 12 or loaded from storage unit 18 into the random access memory 13. The random access memory 13 may also store various programs and data required for the operation of the electronic device 10. The processor 11, read-only memory 12, and random access memory 13 are interconnected via a bus 14. An input / output interface 15 is also connected to the bus 14.

[0081] Multiple components in electronic device 10 are connected to input / output interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of monitors, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0082] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as read port conflict resolution methods for VLIW processor multi-register sets.

[0083] In some embodiments, the read port conflict resolution method for a VLIW processor multi-register set can be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on electronic device 10 via read-only memory 12 and / or communication unit 19. When the computer program is loaded into random access memory 13 and executed by processor 11, one or more steps of the read port conflict resolution method for a VLIW processor multi-register set described above can be performed. Alternatively, in other embodiments, processor 11 can be configured to perform the read port conflict resolution method for a VLIW processor multi-register set by any other suitable means (e.g., by means of firmware).

[0084] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0085] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0086] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory, read-only memory, erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0087] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0088] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

[0089] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.

[0090] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.

[0091] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A method for eliminating read port conflicts of a VLIW processor facing multiple register banks, characterized in that, The method is executed by a compiler adapted to the VLIW processor, and the method includes: The target basic block is compiled to obtain machine instructions corresponding to the target basic block, and a scheduling cycle is allocated to each machine instruction. Each read register in each machine instruction is taken as the current read register in turn, and machine instructions are used based on the registers corresponding to each current read register to determine the read conflict register, the current same-cycle read register, and the paired same-cycle read register corresponding to each current read register. Based on each of the current read registers, and the read conflict registers, current same-cycle read registers and paired same-cycle read registers corresponding to each of the current read registers, a read register conflict graph corresponding to the target basic block is constructed. Based on the read register conflict graph, the register groups corresponding to each of the current read registers are determined to eliminate read port conflicts for VLIW processor multi-register groups.

2. The method of claim 1, wherein, The current read register, the read conflict register, the current same-cycle read register, and the paired same-cycle read register are all vector registers.

3. The method of claim 1, wherein, The machine instructions used by the registers include in-cycle register usage instructions and out-of-cycle register usage instructions; Based on machine instructions used in relation to the registers corresponding to each of the current read registers, the read conflict registers, current in-cycle read registers, and paired in-cycle read registers corresponding to each of the current read registers are determined, including: Based on the instructions for using registers in the same cycle and the instructions for using registers in different cycles where each current read register is located, determine the read conflict registers corresponding to each current read register; Based on the same-cycle machine instruction that belongs to the same scheduling cycle as the instruction used by each of the same-cycle registers, determine the current same-cycle read register corresponding to each of the current read registers respectively; Based on the same-cycle machine instruction that belongs to the same scheduling cycle as the instruction used by each of the different-cycle registers, the paired same-cycle read registers corresponding to each of the current read registers are determined.

4. The method of claim 1, wherein, Based on each of the current read registers, and the read conflict registers, current same-cycle read registers, and paired same-cycle read registers corresponding to each of the current read registers, a read register conflict graph corresponding to the target basic block is constructed, including: Using each of the current read registers as nodes, select the target read registers that have not yet established corresponding undirected edges from the read conflict registers, current same-cycle read registers and paired same-cycle read registers that correspond to each of the current read registers respectively; An undirected edge is established between each current read register and its corresponding target read register to obtain a read register conflict graph corresponding to the target basic block.

5. The method of claim 4, wherein, Based on the read register conflict graph, determine the register groups corresponding to each of the current read registers, including: Based on the read register conflict graph, determine the number of undirected edges corresponding to each of the current read registers; Based on the number of undirected edges corresponding to each of the current read registers, the conflict handling priority corresponding to each of the current read registers is determined. Based on the conflict handling priority corresponding to each of the current read registers, a register group corresponding to each of the current read registers is determined.

6. The method of claim 5, wherein, Based on the conflict handling priority corresponding to each of the current read registers, a register group corresponding to each of the current read registers is determined, including: The current read register with the highest conflict handling priority is selected from each of the current read registers in turn as the read register to be allocated; When the read conflict register, the current same-cycle read register, and the paired same-cycle read register corresponding to the read register to be allocated have not yet been allocated to any register group, the read register to be allocated will be allocated to any register group; When the read conflict register, the current same-cycle read register, or the paired same-cycle read register corresponding to the read register to be allocated has been allocated to any register group, the target register group corresponding to the read conflict register, the current same-cycle read register, and the paired same-cycle read register is determined based on the allocated register groups corresponding to the read conflict register, the current same-cycle read register, and the paired same-cycle read register.

7. The method of claim 6, wherein, Based on the allocated register groups corresponding to the read conflict register, the current in-cycle read register, and the paired in-cycle read register, determine the target register group corresponding to the read register to be allocated, including: Any register group other than the already allocated register group is determined as the target register group corresponding to the read register to be allocated.

8. An apparatus for eliminating read port conflicts of a VLIW processor with multiple register files, characterized by The apparatus is executed by a compiler adapted to the VLIW processor, and the apparatus includes: The scheduling cycle allocation module is used to compile the target basic block to obtain each machine instruction corresponding to the target basic block, and to allocate a scheduling cycle for each machine instruction. The register relationship determination module is used to sequentially take each read register in each machine instruction as the current read register, and use machine instructions based on the registers corresponding to each current read register to determine the read conflict register, the current same-cycle read register, and the paired same-cycle read register corresponding to each current read register. The conflict graph construction module is used to construct a read register conflict graph corresponding to the target basic block based on each of the current read registers, and the read conflict registers, current same-cycle read registers and paired same-cycle read registers corresponding to each of the current read registers respectively. The register group allocation module is used to determine the register group corresponding to each of the current read registers based on the read register conflict graph, so as to eliminate read port conflicts for VLIW processor multi-register groups.

9. An electronic device, comprising: The electronic device includes: At least one processor; and a memory communicatively connected to said at least one processor; The memory stores a computer program that can be executed by the at least one processor, which enables the at least one processor to perform the read port conflict elimination method for VLIW processor multi-register set as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the read port conflict elimination method for a VLIW processor with multiple register sets as described in any one of claims 1-7.