Instruction transmitting method and device, equipment and storage medium

By allocating and optimizing assembly instructions among operating units, the problem of poor balancing load effect caused by the limited number of hardware operating units is solved, and software processing efficiency and hardware resource utilization are improved.

CN119088457APending Publication Date: 2024-12-06SHANGHAI SMARTLOGIC TECHNOLOGY LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411191357.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-28
Publication Date
2024-12-06

AI Technical Summary

Technical Problem

In the prior art, due to the limited number of hardware operating units, the balancing load effect is poor when developing complex software functions, and the software performance and code volume cannot be taken into account.

Method used

By acquiring multiple assembly instruction segments, the number of allocated instructions of each operation unit is determined based on the preset number of operation units and the number of instructions, the instructions are allocated to the operation unit, and the first and second types of operation units are determined based on the delay information, and the first and second types of operation units are determined. The target instructions are assigned from the first type of operation unit to the second type of operation unit, and a transmission condition is added thereto to control the instruction transmission.

Benefits of technology

Without increasing the amount of code, the hardware resource utilization rate and software processing efficiency are improved, and the problem of poor balancing load effect is solved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119088457A_ABST
    Figure CN119088457A_ABST
Patent Text Reader

Abstract

The invention discloses an instruction transmitting method, apparatus and device, and a storage medium. The method comprises the steps of obtaining a plurality of assembly instruction segments; the assembly instruction segment comprises at least one instruction and delay information of each instruction; determining a first allocation instruction number of each operation unit according to the preset number of operation units and the instruction number contained in the plurality of assembly instruction segments; distributing each instruction to a plurality of operation units according to delay information, and obtaining a second distribution instruction number of each operation unit; determining a first type of operation units and a second type of operation units from the operation units based on the first distribution instruction number and the second distribution instruction number; distributing a target instruction extracted from the first type of operation units to a second type of operation units, and adding a transmitting condition for the target instruction; the target instruction is controlled to be transmitted and executed based on the transmitting condition, the utilization rate of hardware resources can be improved on the premise of not increasing the code quantity, and the processing efficiency of software is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of software development, and in particular to an instruction transmitting method, device, equipment and storage medium. Background Art

[0002] When using micro-operation instructions to develop software functions, the software functions will be mapped to several assembly instructions, which are arranged in order of execution and execution delay. When the hardware processor executes these instructions in sequence, the software function is completed. The indicators for measuring software development performance usually include: software processing efficiency, hardware resource utilization, software code volume, etc. Usually, when designing a simpler software function implementation plan, the best of all indicators can be achieved at the same time. However, when designing a more complex software function, it is often impossible to take all indicators into account.

[0003] The software design method of loop code plus balanced load in the prior art can achieve high processing efficiency when developing software tasks with fewer computing tasks and a moderate number of instructions. However, when developing more complex software functions, there are more computing tasks and more instructions corresponding to the software functions, which will result in poor load balancing due to the limited number of hardware operation units; therefore, you can choose to abandon the code loop structure or expand the loop code multiple times, but this expansion programming method will increase the amount of code, increase the difficulty of engineering compilation and storage, and is not conducive to the adjustment and modification of code functions. Summary of the invention

[0004] The present invention provides an instruction transmission method, device, equipment and storage medium to solve the problems in the prior art that the load balancing effect is poor due to the limited number of hardware operation units and the software performance and software code volume cannot be taken into account.

[0005] In a first aspect, an embodiment of the present invention provides a method for transmitting an instruction, comprising:

[0006] Acquire multiple assembly instruction segments; wherein the assembly instruction segments include at least one instruction and delay information of each instruction;

[0007] Determining a first allocated instruction number for each operation unit according to a preset number of operation units and the number of instructions included in the plurality of assembly instruction segments;

[0008] Allocate each of the instructions to the plurality of operation units according to the delay information to obtain a second number of allocated instructions for each operation unit;

[0009] Determine a first type of operation unit and a second type of operation unit from the operation units based on the first allocation instruction number and the second allocation instruction number; wherein the second allocation instruction number of the first type of operation unit is greater than the first allocation instruction number; and the second allocation instruction number of the second type of operation unit is less than the first allocation instruction number;

[0010] assigning the target instruction extracted from the first type of operation unit to the second type of operation unit, and adding a launch condition to the target instruction;

[0011] The target instruction is transmitted based on the transmission condition.

[0012] Optionally, determining the first allocated instruction number of each operation unit according to the preset number of operation units and the number of instructions included in the plurality of assembly instruction segments includes:

[0013] The number of instructions contained in the plurality of assembly instruction segments is evenly distributed to each operation unit to obtain a first number of allocated instructions for each operation unit.

[0014] Optionally, allocating each of the instructions to the plurality of operation units according to the delay information to obtain a second number of allocated instructions for each operation unit includes:

[0015] Instructions contained in a plurality of assembly instruction segments are sorted according to delay information;

[0016] Based on the sorting result of each instruction, the number of operation units and the first number of allocated instructions for each operation unit, each instruction is allocated to a plurality of operation units to obtain a second number of allocated instructions for each operation unit.

[0017] Optionally, determining a first type of operation unit and a second type of operation unit from the operation units based on the first allocation instruction number and the second allocation instruction number includes:

[0018] Compare the first allocation instruction number and the second allocation instruction number corresponding to each operation unit;

[0019] If the number of second allocation instructions in the operation unit is greater than the number of first allocation instructions, determining that the operation unit is a first type of operation unit;

[0020] If the number of second allocation instructions in the operation unit is less than the number of first allocation instructions, the operation unit is determined to be a second type of operation unit.

[0021] Optionally, allocating the target instruction extracted from the first type of operation unit to the second type of operation unit, and adding a launch condition for the target instruction, comprises:

[0022] extracting target instructions from the first type of operation unit according to the first number of allocated instructions corresponding to the first type of operation unit, so that the number of instructions remaining in the first type of operation unit is the first number of allocated instructions;

[0023] The extracted target instruction is assigned to the second type of operation unit, and an issue condition is added to the target instruction.

[0024] Optionally, the launch condition is that the number of cycles reaches a set value, wherein the set value is determined according to delay information corresponding to the target instruction;

[0025] Accordingly, transmitting the target instruction based on the transmitting condition includes:

[0026] When the number of cycles of the target instruction reaches the set value, the target instruction is transmitted.

[0027] In a second aspect, an embodiment of the present invention provides a command transmitting device, including:

[0028] An acquisition module, used for acquiring a plurality of assembly instruction segments; wherein the assembly instruction segments include at least one instruction and delay information of each instruction;

[0029] A first determining module, configured to determine a first allocated instruction number for each operating unit according to a preset number of operating units and the number of instructions included in the plurality of assembly instruction segments;

[0030] A second determining module is used to allocate each of the instructions to the plurality of operation units according to the delay information, and obtain a second allocated instruction number for each operation unit;

[0031] A third determining module is used to determine a first type of operating unit and a second type of operating unit from the operating unit based on the first allocation instruction number and the second allocation instruction number; wherein the second allocation instruction number of the first type of operating unit is greater than the first allocation instruction number; and the second allocation instruction number of the second type of operating unit is less than the first allocation instruction number;

[0032] An allocating module, configured to allocate the target instruction extracted from the first type of operation unit to the second type of operation unit, and add a launch condition to the target instruction;

[0033] A transmitting module is used to transmit the target instruction based on the transmitting condition.

[0034] Optionally, the first determining module is specifically configured to: evenly distribute the number of instructions contained in the plurality of assembly instruction segments to each operation unit, so as to obtain a first allocated number of instructions for each operation unit.

[0035] In a third aspect, an embodiment of the present invention provides an electronic device, the device comprising:

[0036] at least one processor; and

[0037] a memory communicatively connected to the at least one processor; wherein,

[0038] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the instruction transmission method described in any embodiment of the present invention.

[0039] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the instruction transmission method described in any embodiment of the present invention when executed.

[0040] The technical solution of the embodiment of the present invention is to obtain multiple assembly instruction segments; wherein the assembly instruction segment includes at least one instruction and delay information of each instruction; determine the first allocated instruction number of each operation unit according to the number of preset operation units and the number of instructions contained in the multiple assembly instruction segments; allocate each instruction to the multiple operation units according to the delay information to obtain the second allocated instruction number of each operation unit; determine the first type of operation unit and the second type of operation unit from the operation unit based on the first allocated instruction number and the second allocated instruction number; wherein the second allocated instruction number of the first type of operation unit is greater than the first allocated instruction number; the second allocated instruction number of the second type of operation unit is less than the first allocated instruction number; allocate the target instruction extracted from the first type of operation unit to the second type of operation unit, and add a launch condition for the target instruction; control the launch and execution of the target instruction based on the launch condition, so as to solve the problem in the prior art that the load balancing effect is poor due to the limited number of hardware operation units and the software performance and the amount of software code cannot be taken into account, and the utilization rate of hardware resources can be improved without increasing the amount of code, and the processing efficiency of the software can be improved.

[0041] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0043] Figure 1A flowchart of a command transmission method provided in Embodiment 1 of the present invention;

[0044] Figure 2 A schematic diagram of instruction allocation provided in Embodiment 1 of the present invention;

[0045] Figure 3 A flowchart of a method for transmitting an instruction provided in Embodiment 2 of the present invention;

[0046] Figure 4 A schematic diagram of optimized instruction allocation provided in Embodiment 2 of the present invention;

[0047] Figure 5 A schematic diagram of the structure of a command transmitting device provided in Embodiment 3 of the present invention;

[0048] Figure 6 A schematic diagram of the structure of an electronic device that can be used to implement an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0049] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0050] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0051] Embodiment 1

[0052] Figure 1 This is a flowchart of a method for transmitting an instruction provided in the first embodiment of the present invention. This embodiment is applicable to the case of transmitting an instruction. The method can be executed by an instruction transmitting device. The instruction transmitting device can be implemented in the form of hardware and / or software. The instruction transmitting device can be configured in an electronic device. Figure 1 As shown, the method includes:

[0053] S110, obtaining a plurality of assembly instruction segments; wherein the assembly instruction segments include at least one instruction and delay information of each instruction.

[0054] The assembly instruction segment may refer to the assembly instruction segment corresponding to the executed software function; specifically, the corresponding assembly instruction segment may be extracted from the source program file. The assembly instruction segment includes at least one instruction, and the delay information of the instruction may refer to the absolute delay of the instruction execution caused by data dependency; the absolute delay may refer to a delay mechanism in the real-time operating system task, which can ensure the periodic execution of the task by specifying the exact time point when the task must be executed, without being affected by other tasks or interrupts.

[0055] In this embodiment, multiple assembly instruction segments corresponding to the software functions that need to be executed can be extracted from the source program file, each assembly instruction segment includes one or more instructions, each instruction has its corresponding absolute delay, and each instruction in each assembly instruction segment can be emitted and executed according to the absolute delay.

[0056] S120: Determine a first allocated instruction number for each operation unit according to a preset number of operation units and the number of instructions included in the plurality of assembly instruction segments.

[0057] Among them, the operation unit may refer to a unit component in a hardware processor that manages and executes input / output (I / O) operations. The number of preset operation units may refer to the number of IO operation units contained in a preset hardware processor. The number of instructions contained in multiple assembly instruction segments may refer to the total number of instructions contained in each assembly instruction segment; it can also be understood as the total number of instructions corresponding to the executed software function. The first number of allocated instructions for each operation unit may refer to the theoretical optimal number of allocated instructions for each operation unit.

[0058] In this embodiment, the theoretical optimal number of instructions to be allocated to each operation unit may be determined according to the number of IO operation units included in the preset hardware processor and the total number of instructions included in each assembly instruction segment.

[0059] S130. Allocate each of the instructions to the plurality of operation units according to the delay information, and obtain a second number of allocated instructions for each operation unit.

[0060] The second allocation instruction number may refer to the actual allocation instruction number.

[0061] In this embodiment, each instruction in a plurality of assembly instruction segments may be allocated to a plurality of operation units according to the size of the delay information, so as to obtain the actual number of allocated instructions for each operation unit.

[0062] S140. Determine a first type of operation unit and a second type of operation unit from the operation units based on the first allocation instruction number and the second allocation instruction number; wherein the second allocation instruction number of the first type of operation unit is greater than the first allocation instruction number; and the second allocation instruction number of the second type of operation unit is less than the first allocation instruction number.

[0063] Specifically, the first allocation instruction number and the second allocation instruction number corresponding to each operation unit can be compared; if the second allocation instruction number in the operation unit is greater than the first allocation instruction number, the operation unit is determined to be a first-category operation unit; if the second allocation instruction number in the operation unit is less than the first allocation instruction number, the operation unit is determined to be a second-category operation unit.

[0064] In this embodiment, by comparing the first allocation instruction number and the second allocation instruction number corresponding to each operation unit, the first type of operation unit and the second type of operation unit are determined from each operation unit.

[0065] S150, assigning the target instruction extracted from the first type of operation unit to the second type of operation unit, and adding an emission condition for the target instruction.

[0066] The target instruction may refer to the instruction corresponding to the remaining number of instructions after subtracting the first allocated instruction number from the second allocated instruction number in the first type of operation unit. The emission condition may refer to the condition for emitting the target instruction.

[0067] In this embodiment, after the target instruction is split and extracted from the first type of operation unit, it is assigned to the second type of operation unit, and an emission condition is added to the target instruction in the second type of operation unit.

[0068] S160, transmitting the target instruction based on the transmitting condition.

[0069] Specifically, when the target instruction meets the emission condition, the target instruction is emitted.

[0070] In this embodiment, by obtaining multiple assembly instruction segments; wherein the assembly instruction segments include at least one instruction and delay information of each instruction; determining the first allocated instruction number of each operation unit according to the number of preset operation units and the number of instructions contained in the multiple assembly instruction segments; allocating each instruction to the multiple operation units according to the delay information to obtain the second allocated instruction number of each operation unit; determining the first type of operation unit and the second type of operation unit from the operation unit based on the first allocated instruction number and the second allocated instruction number; wherein the second allocated instruction number of the first type of operation unit is greater than the first allocated instruction number; the second allocated instruction number of the second type of operation unit is less than the first allocated instruction number; allocating the target instruction extracted from the first type of operation unit to the second type of operation unit, and adding a launch condition for the target instruction; controlling the launch and execution of the target instruction based on the launch condition, solves the problem in the prior art that the load balancing effect is poor due to the limited number of hardware operation units and the software performance and software code amount cannot be taken into account, and can improve the utilization rate of hardware resources and the processing efficiency of software without increasing the code amount.

[0071] Optionally, determining the first allocated instruction number of each operation unit according to the preset number of operation units and the number of instructions included in the plurality of assembly instruction segments includes:

[0072] The number of instructions contained in the plurality of assembly instruction segments is evenly distributed to each operation unit to obtain a first number of allocated instructions for each operation unit.

[0073] Specifically, the number of instructions included in the plurality of assembly instruction segments may be divided by the preset number of operation units to obtain the first number of allocated instructions for each operation unit.

[0074] For example, if a hardware processor has 4 IO operation units (IO_0, IO_1, IO_2, IO_3), multiple assembly instruction segments include: 3 segments with a total of 20 input instructions, and 2 segments with a total of 14 output instructions. The theoretical optimal number of allocated instructions (i.e., the first number of allocated instructions) calculated by uniform distribution is (20+14) / 4=8.5. Since the instructions are all integers, the optimal distribution plan may be to allocate 9 instructions to one IO operation unit and less than or equal to 9 instructions to other IO units.

[0075] In this embodiment, the number of instructions contained in multiple assembly instruction segments can be divided by the preset number of operation units to evenly distribute the number of instructions contained in multiple assembly instruction segments to each operation unit, thereby obtaining the theoretical optimal number of allocated instructions for each operation unit.

[0076] Optionally, allocating each of the instructions to the plurality of operation units according to the delay information to obtain a second number of allocated instructions for each operation unit includes:

[0077] Instructions contained in a plurality of assembly instruction segments are sorted according to delay information;

[0078] Specifically, based on the delay information of each instruction, the instructions included in the plurality of assembly instruction segments are sorted in order from small to large according to the delay information to obtain a sorting result of each instruction.

[0079] Based on the sorting result of each instruction, the number of operation units and the first number of allocated instructions for each operation unit, each instruction is allocated to a plurality of operation units to obtain a second number of allocated instructions for each operation unit.

[0080] Specifically, each instruction can be allocated to multiple operation units based on the sorting results of each instruction, the number of operation units, and the first allocated instruction number of each operation unit, i.e., the theoretical optimal allocated instruction number, to obtain the second allocated instruction number of each operation unit, i.e., the actual allocated instruction number.

[0081] For example, if a hardware processor has 4 IO operation units (IO_0, IO_1, IO_2, IO_3), and multiple assembly instruction segments include: 3 segments with a total of 20 input instructions, and 2 segments with a total of 14 output instructions, then the theoretical optimal allocation scheme can be: 9 instructions for one IO operation unit, and less than or equal to 9 instructions for other IO units. However, after considering the delay information of each instruction, the theoretical optimal allocation scheme cannot be achieved; for example, after adding a delay information of instruction execution generated by data dependency to the instructions in multiple different assembly instruction segments, the number of instructions and delay information contained in the above 5 assembly instruction segments are shown in Table 1:

[0082] Table 1. Number of instructions and delay information of assembly instruction segment

[0083] Instruction number Number of instructions Delay Information Input 1 4 0 Input 2 12 10 Input 3 4 50 Output 1 9 Not less than 36 Output 2 5 Not less than 90

[0084] Among them, since the data to be output can be cached by the internal register, the delay information of the output instruction should not be less than the delay calculated by the data to be output. In actual application scenarios, the instructions contained in multiple assembly instruction segments can be sorted and allocated in order from small to large according to the delay information corresponding to the instructions in each assembly instruction segment; Figure 2 A schematic diagram of instruction allocation provided in Embodiment 1 of the present invention is shown in FIG. Figure 2As shown, input 1 is assigned to IO_0, and input 2 is assigned to IO_1; according to the delay information in Table 1 and the number of IO operation units, input 3 and output 1 can be placed in the same IO operation unit; therefore, output 1 can be split, specifically into output 1_0 and output 1_1. Referring to the theoretical optimal allocation scheme, the number of instructions for split output 1_0 can be set to 5, and the number of instructions for output 1_1 can be set to 4; then input 3 and output 1_0 can be jointly assigned to IO_2; finally, output 1_1 and output 2 can be jointly assigned to IO_3. Therefore, the second number of allocated instructions for each operation unit, i.e., the actual number of allocated instructions, can be obtained, wherein the longest instruction cycle 12 in the entire loop body (i.e., multiple assembly instruction segments corresponding to the executed software function) is executed by the operation unit IO_1.

[0085] In this embodiment, the instructions contained in multiple assembly instruction segments can be sorted according to delay information; based on the sorting results of each instruction, the number of operation units and the first allocated instruction number of each operation unit, each instruction is allocated to multiple operation units to obtain the actual allocated instruction number of each operation unit in actual conditions.

[0086] Optionally, determining a first type of operation unit and a second type of operation unit from the operation units based on the first allocation instruction number and the second allocation instruction number includes:

[0087] Compare the first allocation instruction number and the second allocation instruction number corresponding to each operation unit;

[0088] Specifically, the theoretical optimal number of allocated instructions corresponding to each operation unit and the actual number of allocated instructions may be compared.

[0089] If the number of second allocation instructions in the operation unit is greater than the number of first allocation instructions, determining that the operation unit is a first type of operation unit;

[0090] If the number of second allocation instructions in the operation unit is less than the number of first allocation instructions, the operation unit is determined to be a second type of operation unit.

[0091] Specifically, if the actual number of allocated instructions in the operation unit is greater than the theoretical optimal number of allocated instructions, the operation unit is determined to be a first-class operation unit; if the actual number of allocated instructions in the operation unit is less than the theoretical optimal number of allocated instructions, the operation unit is determined to be a second-class operation unit, and the second-class operation unit can also be understood as an operation unit with lower utilization.

[0092] In this embodiment, the first type of operation unit and the second type of operation unit are determined by comparing the theoretical optimal number of allocated instructions and the actual number of allocated instructions corresponding to each operation unit, the target instruction extracted from the first type of operation unit is allocated to the second type of operation unit, and the emission condition is added to the target instruction; the emission and execution of the target instruction is controlled based on the emission condition, which can improve the utilization rate of hardware resources and the processing efficiency of the software without increasing the amount of code.

[0093] Embodiment 2

[0094] Figure 3 This is a flow chart of a method for transmitting instructions provided in the second embodiment of the present invention. The technical solution of this embodiment is further refined on the basis of the above embodiment. Figure 3 As shown, the method includes:

[0095] S210, obtaining a plurality of assembly instruction segments; wherein the assembly instruction segments include at least one instruction and delay information of each instruction.

[0096] S220: Determine a first allocated instruction number for each operation unit according to a preset number of operation units and the number of instructions included in the plurality of assembly instruction segments.

[0097] S230. Allocate each of the instructions to the plurality of operation units according to the delay information, and obtain a second number of allocated instructions for each operation unit.

[0098] S240. Determine a first type of operation unit and a second type of operation unit from the operation units based on the first allocation instruction number and the second allocation instruction number; wherein the second allocation instruction number of the first type of operation unit is greater than the first allocation instruction number; and the second allocation instruction number of the second type of operation unit is less than the first allocation instruction number.

[0099] S250. Extract target instructions from the first type of operation units according to the first allocated instruction number corresponding to the first type of operation units, so that the number of instructions remaining in the first type of operation units is the first allocated instruction number.

[0100] Specifically, the second allocated instruction number corresponding to the first type of operation unit can be determined as the sum of the first allocated instruction number and the target instruction number, that is, the target instruction number can be obtained by subtracting the first allocated instruction number from the second allocated instruction number in the first type of operation unit, and the target instructions corresponding to the target instruction number are split and extracted from the first type of operation unit, then the remaining number of instructions in the first type of operation unit is the first allocated instruction number, so that the first type of operation unit satisfies the theoretically optimal allocation plan.

[0101] S260: Allocate the extracted target instruction to the second type of operation unit, and add a launch condition for the target instruction.

[0102] Specifically, the target instructions extracted from the first type of operation units are allocated to the second type of operation units with lower utilization, and a launch condition is added for the target instructions; this not only effectively improves the utilization of the hardware units, but also plays a role in compressing assembly instructions, and can improve the execution efficiency of the software without increasing the amount of assembly code.

[0103] S270, transmitting the target instruction based on the transmitting condition.

[0104] In this embodiment, in this embodiment, by obtaining multiple assembly instruction segments; wherein the assembly instruction segments include at least one instruction and delay information of each instruction; according to the number of preset operation units and the number of instructions contained in the multiple assembly instruction segments, the first allocated instruction number of each operation unit is determined; according to the delay information, each instruction is allocated to the multiple operation units to obtain the second allocated instruction number of each operation unit; based on the first allocated instruction number and the second allocated instruction number, a first type of operation unit and a second type of operation unit are determined from the operation units; wherein the second allocated instruction number of the first type of operation unit is greater than the first allocated instruction number; the second allocated instruction number of the second type of operation unit The number of instructions is less than the first allocated number of instructions; the target instructions are extracted from the first type of operation unit according to the first allocated number of instructions corresponding to the first type of operation unit, so that the number of instructions remaining in the first type of operation unit is the first allocated number of instructions; the extracted target instructions are allocated to the second type of operation unit, and a launch condition is added to the target instruction; the target instruction is controlled to be launched and executed based on the launch condition, which solves the problem in the prior art that the load balancing effect is poor due to the limited number of hardware operation units and the software performance and software code size cannot be taken into account, and can improve the utilization rate of hardware resources and the processing efficiency of the software without increasing the code size.

[0105] Optionally, the launch condition is that the number of cycles reaches a set value, wherein the set value is determined according to delay information corresponding to the target instruction;

[0106] Among them, the set value can be understood as the set number of cycles; specifically, the target instruction can be emitted after reaching the nth cycle according to the delay information corresponding to the target instruction, so as to ensure that the delayed target instruction can meet the execution condition of its corresponding delay information.

[0107] Accordingly, transmitting the target instruction based on the transmitting condition includes:

[0108] When the number of cycles of the target instruction reaches the set value, the target instruction is transmitted.

[0109] In this embodiment, when the number of loops of the target instruction reaches the set number of loops, the target instruction is emitted to ensure that the delayed target instruction can meet the execution condition of its corresponding delay information, which can better balance the instruction load, improve hardware resource utilization, shorten the overall code cycle, and not increase the overall code amount.

[0110] For example, if a hardware processor has 4 IO operation units (IO_0, IO_1, IO_2, IO_3), the multiple assembly instruction segments include: 3 segments with a total of 20 input instructions, and 2 segments with a total of 14 output instructions. Then the theoretical optimal allocation scheme can be: give 9 instructions to one IO operation unit, and give less than or equal to 9 instructions to other IO units; the actual allocation scheme can be as follows Figure 2 As shown, by comparing the theoretical optimal instruction number (i.e., the first allocated instruction number) and the actual allocated instruction number (i.e., the second allocated instruction number) corresponding to each operation unit, it can be determined that IO_2 and IO_3 are just equal to the 9 instructions of theoretical performance, while the utilization rate of IO_0 is lower than the theoretical optimal instruction number (i.e., the second type of operation unit), and IO_1 exceeds the theoretical optimal instruction number (i.e., the first type of operation unit). Therefore, in order to avoid the above-mentioned poor load balancing effect, in this embodiment, the target instruction of IO_1 can be allocated to IO_0 to achieve load balancing. Figure 4 A schematic diagram of optimized instruction allocation provided in Embodiment 2 of the present invention is shown in FIG. Figure 4 As shown, the specific optimization process can be:

[0111] 1. Split input 2 in IO_1 (i.e., the first type of operation unit) into input 2_0 (i.e., the first number of allocated instructions) containing 8 instructions and input 2_1 (i.e., the target instruction) containing 4 instructions.

[0112] 2. Assign the split input 2_1 to IO_0 and add a launch condition to the instruction of input 2_1.

[0113] 3. If Figure 4 As shown, Figure 4The number of cycles of the instructions is marked and the instructions of the operation unit IO_0 are expanded by 2 cycles. Cyc1 represents the first cycle, and cyc2 represents the second cycle. By adding the emission condition to control input 2_1 to be emitted and executed again in the second cycle, the execution condition of the absolute delay (i.e., delay information) of input 2 instruction can be guaranteed to be 10. After the above allocation, the instruction cycles of IO_0, IO_2 and IO_3 are 9, and the instruction cycle of IO_1 is 8, which meets the theoretical performance and can achieve the optimal allocation scheme. In addition, in order to allow input 2_1 to be executed, the entire loop body (i.e., multiple assembly instruction segments corresponding to the executed software function) can be executed one more time, and the output results generated by other operation units due to the execution instructions of multiple cycles during this execution are invalid data, which will not affect the data results generated by the previous cycle.

[0114] In this embodiment, multiple assembly instruction segments are obtained; the theoretical optimal number of instructions for each operation unit is determined according to the number of preset operation units and the number of instructions contained in the multiple assembly instruction segments; each instruction is allocated to the multiple operation units according to the delay information to obtain the actual number of allocated instructions for each operation unit; the first type of operation unit and the second type of operation unit are determined by comparing the theoretical optimal number of instructions with the actual number of allocated instructions; the target instruction is split from the first type of operation unit according to the theoretical optimal number of instructions; the split target instruction is allocated to the second type of operation unit with lower utilization, and a launch condition is added to the target instruction; based on the launch condition control, when the number of cycles of the target instruction reaches the set number of cycles, the target instruction is launched, which can meet the execution condition of the corresponding delay information, improve the utilization rate of hardware resources without increasing the amount of code, and improve the processing efficiency of the software.

[0115] Embodiment 3

[0116] Figure 5 This is a schematic diagram of the structure of a command transmitting device provided in Embodiment 3 of the present invention. Figure 5 As shown, the device comprises:

[0117] The acquisition module 310 is used to acquire multiple assembly instruction segments; wherein the assembly instruction segments include at least one instruction and delay information of each instruction;

[0118] A first determining module 320, configured to determine a first allocated instruction number for each operating unit according to a preset number of operating units and the number of instructions included in the plurality of assembly instruction segments;

[0119] A second determining module 330 is used to allocate each of the instructions to the plurality of operation units according to the delay information, and obtain a second number of allocated instructions for each operation unit;

[0120] A third determining module 340 is used to determine a first type of operating unit and a second type of operating unit from the operating unit based on the first allocation instruction number and the second allocation instruction number; wherein the second allocation instruction number of the first type of operating unit is greater than the first allocation instruction number; and the second allocation instruction number of the second type of operating unit is less than the first allocation instruction number;

[0121] An allocating module 350, configured to allocate the target instruction extracted from the first type of operation unit to the second type of operation unit, and add a launch condition to the target instruction;

[0122] The transmitting module 360 ​​is used to transmit the target instruction based on the transmitting condition.

[0123] Optionally, the first determining module 320 is specifically configured to: evenly distribute the number of instructions contained in the plurality of assembly instruction segments to each operation unit, so as to obtain a first allocated number of instructions for each operation unit.

[0124] Optionally, the second determining module 330 is specifically configured to:

[0125] Instructions contained in a plurality of assembly instruction segments are sorted according to delay information;

[0126] Based on the sorting result of each instruction, the number of operation units and the first number of allocated instructions for each operation unit, each instruction is allocated to a plurality of operation units to obtain a second number of allocated instructions for each operation unit.

[0127] Optionally, the third determining module 330 is specifically configured to:

[0128] Compare the first allocation instruction number and the second allocation instruction number corresponding to each operation unit;

[0129] If the number of second allocation instructions in the operation unit is greater than the number of first allocation instructions, determining that the operation unit is a first type of operation unit;

[0130] If the number of second allocation instructions in the operation unit is less than the number of first allocation instructions, the operation unit is determined to be a second type of operation unit.

[0131] Optionally, the allocation module 340 is specifically used to:

[0132] extracting target instructions from the first type of operation unit according to the first number of allocated instructions corresponding to the first type of operation unit, so that the number of instructions remaining in the first type of operation unit is the first number of allocated instructions;

[0133] The extracted target instruction is assigned to the second type of operation unit, and an issue condition is added to the target instruction.

[0134] Optionally, the launch condition is that the number of cycles reaches a set value, wherein the set value is determined according to delay information corresponding to the target instruction;

[0135] Accordingly, the transmitting module 360 ​​is specifically used for:

[0136] When the number of cycles of the target instruction reaches the set value, the target instruction is transmitted.

[0137] The instruction transmitting device provided in the embodiment of the present invention can execute the instruction transmitting method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0138] Embodiment 4

[0139] Figure 6 A schematic diagram of an electronic device that can be used to implement an embodiment of the present invention is shown. The electronic device 10 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0140] like Figure 6 As shown, the electronic device 10 includes a data acquisition module (not shown in the figure), a domestic AD chip (not shown in the figure), a calibration module (not shown in the figure), a calibration coefficient memory (not shown in the figure), a test instrument accuracy verification module (not shown in the figure) and a logic processing module (not shown in the figure); the electronic device 10 also includes at least one processor 11 connected to the logic processing module, and a memory connected to the at least one processor 11 for communication, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor 11, and the computer program is executed by the at least one processor 11 so that the at least one processor 11 can execute the method provided by the present invention.

[0141] The processor 11 can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 12 or a computer program loaded from a storage unit 18 into a random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0142] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0143] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as the instruction transmission method.

[0144] In some embodiments, the instruction transmission method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the instruction transmission method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to execute the instruction transmission method in any other appropriate manner (e.g., by means of firmware).

[0145] 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 parts (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0146] Computer programs for implementing 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, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0147] In the context of the present invention, a computer-readable storage medium stores a computer instruction, and the computer instruction is used to implement the instruction transmission method provided by the present invention when the processor is executed. A computer-readable storage medium can be a tangible medium, which can contain or store a computer program for use by an instruction execution system, a device or an equipment or used in combination with an instruction execution system, a device or an equipment. A computer-readable storage medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the above. Alternatively, a computer-readable storage medium can be a machine-readable signal medium. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

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

[0149] The systems and techniques described herein can be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected by digital data communication (e.g., a communication network) in any form or medium. Examples of communication networks include: Local Area Network (LAN), Wide Area Network (WAN), blockchain network, and the Internet.

[0150] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and virtual private servers (VPS) services.

[0151] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0152] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A command transmission method, characterized in that: include: Acquire a plurality of assembly instruction segments, wherein the assembly instruction segments include at least one instruction and delay information of each instruction; Determining a first allocated instruction number for each operation unit according to a preset number of operation units and the number of instructions included in the plurality of assembly instruction segments; Allocate each of the instructions to the plurality of operation units according to the delay information to obtain a second number of allocated instructions for each operation unit; Determine a first type of operation unit and a second type of operation unit from the operation units based on the first allocation instruction number and the second allocation instruction number, wherein the second allocation instruction number of the first type of operation unit is greater than the first allocation instruction number, and the second allocation instruction number of the second type of operation unit is less than the first allocation instruction number; assigning the target instruction extracted from the first type of operation unit to the second type of operation unit, and adding a launch condition to the target instruction; The target instruction is transmitted based on the transmission condition.

2. The method according to claim 1, characterized in that Determining the first number of allocated instructions for each operation unit according to the number of preset operation units and the number of instructions included in the plurality of assembly instruction segments includes: The number of instructions contained in the plurality of assembly instruction segments is evenly distributed to each operation unit to obtain a first number of allocated instructions for each operation unit.

3. The method according to claim 1, characterized in that: Allocating each of the instructions to the plurality of operation units according to the delay information to obtain a second number of allocated instructions for each operation unit includes: Instructions contained in a plurality of assembly instruction segments are sorted according to delay information; Based on the sorting result of each instruction, the number of operation units and the first number of allocated instructions for each operation unit, each instruction is allocated to a plurality of operation units to obtain a second number of allocated instructions for each operation unit.

4. The method according to claim 1, characterized in that Determining a first type of operation unit and a second type of operation unit from the operation units based on the first allocation instruction number and the second allocation instruction number includes: Compare the first allocation instruction number and the second allocation instruction number corresponding to each operation unit; If the number of second allocation instructions in the operation unit is greater than the number of first allocation instructions, determining that the operation unit is a first type of operation unit; If the number of second allocation instructions in the operation unit is less than the number of first allocation instructions, the operation unit is determined to be a second type of operation unit.

5. The method according to claim 1, characterized in that Allocating the target instruction extracted from the first type of operation unit to the second type of operation unit, and adding an emission condition to the target instruction, including: extracting target instructions from the first type of operation unit according to the first number of allocated instructions corresponding to the first type of operation unit, so that the number of instructions remaining in the first type of operation unit is the first number of allocated instructions; The extracted target instruction is assigned to the second type of operation unit, and an issue condition is added to the target instruction.

6. The method according to claim 1, characterized in that The launch condition is that the number of cycles reaches a set value, wherein the set value is determined according to the delay information corresponding to the target instruction; Accordingly, transmitting the target instruction based on the transmitting condition includes: When the number of cycles of the target instruction reaches the set value, the target instruction is transmitted.

7. A command transmitting device, characterized in that: include: An acquisition module, used for acquiring a plurality of assembly instruction segments; wherein the assembly instruction segments include at least one instruction and delay information of each instruction; A first determining module, configured to determine a first allocated instruction number for each operating unit according to a preset number of operating units and the number of instructions included in the plurality of assembly instruction segments; A second determining module is used to allocate each of the instructions to the plurality of operation units according to the delay information, and obtain a second allocated instruction number for each operation unit; A third determining module is used to determine a first type of operating unit and a second type of operating unit from the operating unit based on the first allocation instruction number and the second allocation instruction number; wherein the second allocation instruction number of the first type of operating unit is greater than the first allocation instruction number; and the second allocation instruction number of the second type of operating unit is less than the first allocation instruction number; An allocating module, configured to allocate the target instruction extracted from the first type of operation unit to the second type of operation unit, and add a launch condition to the target instruction; A transmitting module is used to transmit the target instruction based on the transmitting condition.

8. The device according to claim 7, characterized in that The first determining module is specifically used to evenly distribute the number of instructions contained in the plurality of assembly instruction segments to each operation unit to obtain a first allocated number of instructions for each operation unit.

9. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the instruction transmitting method according to any one of claims 1 to 6.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the instruction transmission method described in claims 1-6 when executed.