Software program event order-preserving execution method, electronic equipment and medium

By using common lookup tables and event lookup tables during software program execution to control the order of instruction execution, the problem of high hardware resource consumption is solved and execution efficiency is improved.

CN120994282AActive Publication Date: 2025-11-21沐曦科技(成都)有限公司
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202511526293.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-24
Publication Date
2025-11-21
Estimated Expiration
2045-10-24

AI Technical Summary

Technical Problem

Existing technologies consume large amounts of hardware resources and have low execution efficiency during software program execution, making it difficult to achieve pre-ordered execution of events between multiple processes.

Method used

A common lookup table and an event lookup table corresponding to each software program group to be processed are used. By controlling the execution order of instructions through the correspondence between storage units and computing units, the resource consumption of lookup tables is reduced.

Benefits of technology

It effectively reduces hardware resource consumption and improves the efficiency of pre-order execution of software program events.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120994282A_ABST
    Figure CN120994282A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of chips, in particular to a software program event order-preserving execution method, electronic equipment and a medium. According to the method, the order-preserving execution of the software program events is ensured through the public lookup table and the event lookup table corresponding to each to-be-processed software program group, each storage unit in the public lookup table corresponds to one calculation unit, and the event lookup table is smaller than the public lookup table, so that the resource consumption required by the lookup tables is reduced, and the processing efficiency is improved. Therefore, the hardware resource consumption in the software program event order-preserving execution process is reduced, and the software program event order-preserving execution efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of chip technology, and in particular to a method for preserving the order of software program events, an electronic device, and a medium. Background Technology

[0002] During software program execution, events must be executed in the correct order; otherwise, errors may occur. However, upstream devices may have multiple processes running concurrently, each executing a different number of instructions (waves). The execution units (APs) of downstream devices may return instructions out of order, further disrupting the order of events across processes and making it impossible to achieve pre-order execution of software program events. Current technologies require recording tag information for each instruction and monitoring its execution status based on this tag information. This necessitates multiple interactions between upstream and downstream devices, consuming significant hardware resources and exhibiting low efficiency. Therefore, reducing hardware resource consumption and improving the efficiency of pre-order execution of software program events is a pressing technical problem. Summary of the Invention

[0003] The purpose of this invention is to provide a method, electronic device, and medium for pre-order execution of software program events, which reduces the hardware resource consumption during the pre-order execution of software program events and improves the efficiency of pre-order execution of software program events.

[0004] According to a first aspect of the present invention, a method for preserving the order of events in a software program is provided, comprising: Step S1: Set up a common lookup table and set up a corresponding event lookup table for each software program group to be processed. Each software program group to be processed includes multiple programs that need to be executed in order of events. Each program includes multiple instructions. The storage units in the common lookup table correspond one-to-one with the computing units of the downstream devices. Each event lookup table includes M storage units, where M is the maximum index value and M is less than the total number of computing units. Step S2: Store the identifier of the software program group to be processed corresponding to the instruction currently assigned by the computing unit and the index value corresponding to the program in the storage unit of the common lookup table. The index values ​​of the programs in the software program group to be processed are set in a cyclical order from 1 to M. The same index value of the same software program group to be processed cannot be set repeatedly at the same time. Store the number of currently incomplete instructions of the program corresponding to the index value in the storage unit of the event lookup table. The pointer in the event lookup table initially points to the storage unit with the index value of 1. Step S3: When the instruction in a computing unit is completed, obtain the target software program group identifier and the index value corresponding to the target program stored in the target storage unit in the common lookup table, decrement the number of incomplete instructions corresponding to the index value corresponding to the target program in the event lookup table corresponding to the target software program group identifier by 1, and then release the target storage unit in the common lookup table. Step S4: If the number of incomplete instructions in the memory unit currently pointed to by the pointer in the event lookup table is 0, then release the memory unit currently pointed to by the pointer and the corresponding index value, trigger the program event corresponding to the index value of the memory unit currently pointed to by the pointer, and then increment the current pointer by 1. If the pointer value after incrementing by 1 is greater than M, then update the pointer value to 1.

[0005] According to a second aspect of the present invention, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being configured to perform the method described in the first aspect of the present invention.

[0006] According to a third aspect of the present invention, a computer-readable storage medium is provided, storing computer-executable instructions for performing the method described in the first aspect of the present invention.

[0007] Compared with existing technologies, this invention has significant advantages and beneficial effects. Through the above technical solution, the software program event-preserving execution method, electronic device, and medium provided by this invention achieve considerable technological advancement and practicality, and have broad industrial application value. It has at least the following beneficial effects: This invention ensures the ordered execution of software program events by using a common lookup table and an event lookup table corresponding to each group of software programs to be processed. Each storage unit in the common lookup table corresponds to a computing unit. The event lookup table is smaller than the common lookup table, which reduces the resource consumption required by the lookup table, thereby reducing the hardware resource consumption during the ordered execution of software program events and improving the efficiency of the ordered execution of software program events. Attached Figure Description

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

[0009] Figure 1 A flowchart of a software program event-preserving execution method provided in an embodiment of the present invention. Detailed Implementation

[0010] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. 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 are within the scope of protection of the present invention.

[0011] This invention provides a method for preserving the order of events in a software program, such as... Figure 1 As shown, it includes: Step S1: Set up a common lookup table and set up a corresponding event lookup table for each software program group to be processed. Each software program group to be processed includes multiple programs that need to be executed in order of events. Each program includes multiple instructions. The storage units in the common lookup table correspond one-to-one with the computing units of the downstream devices. Each event lookup table includes M storage units, where M is the maximum index value and M is less than the total number of computing units.

[0012] The software program groups to be processed are maintained by the upstream equipment. These groups run in parallel and share the computing units and common lookup tables of the downstream equipment. Each software program group includes multiple programs that require ordered execution. This means that the events corresponding to the programs in the software program group must be executed sequentially. That is, the events corresponding to the first program in the software program group can only be executed after the events corresponding to the second program are completed, and so on. Furthermore, the execution of each program's events is contingent upon the completion of all instructions corresponding to that program.

[0013] It should be noted that if a lookup table is set up for each software program group to be processed, in order to meet the processing volume requirements of some software program groups, it is usually necessary to set up a lookup table of the same size as the common lookup table for each software program group to be processed. This requires a large amount of chip area and consumes a lot of hardware resources. In addition, when multiple software program groups to be processed run in parallel, since they share the computing units of downstream devices, the utilization rate of most lookup tables is very low. Moreover, when performing coverage testing, it is necessary to measure every lookup unit of every lookup table, so it is difficult to achieve 100% coverage, and the implementation becomes extremely complicated.

[0014] In this application, only one common lookup table needs to be set up for use by all software program groups to be processed. Although a corresponding event lookup table is set up for each software program group to be processed, the size of the event lookup table will be much smaller than that of the common lookup table. The size of the event lookup table only needs to meet the processing needs of the software program groups to be processed. For example, the hardware resources of the downstream device include X execution units (Accelerated Processors, abbreviated as AP), each execution unit includes Y processing units (Procesor Element Units, abbreviated as PEU), each computing unit includes Z computing units, and each computing unit can execute one instruction. The total number of computing units is Q = X × Y × Z. Q is usually on the order of hundreds, thousands, or even larger, but M is usually on the order of single digits. For example, if there are a total of 256 computing units, setting the value of M to 8 is sufficient to meet the requirements. Thus, this invention reduces the resource consumption required by the lookup table.

[0015] Step S2: Store the identifier of the software program group to be processed corresponding to the instruction currently assigned by the computing unit and the index value corresponding to the program in the storage unit of the common lookup table. The index values ​​of the programs in the software program group to be processed are set in a cyclical order from 1 to M. The same index value of the same software program group to be processed cannot be set repeatedly at the same time. Store the number of currently incomplete instructions of the program corresponding to the index value in the storage unit of the event lookup table. The pointer in the event lookup table initially points to the storage unit with the index value of 1.

[0016] The index values ​​of the programs in the software program group to be processed are set in a cyclical order from 1 to M. The same index value in the same software program group to be processed cannot be set repeatedly at the same time. This means that the index values ​​of the programs in the software program group to be processed are set in the order of 1, 2, 3, 4, ..., M. Only after the program corresponding to the index value has finished executing and been released can it be used in subsequent processes.

[0017] Step S3: When the instruction in a computing unit is completed, obtain the target software program group identifier and the index value corresponding to the target program stored in the target storage unit in the common lookup table, decrement the number of incomplete instructions corresponding to the index value corresponding to the target program in the event lookup table corresponding to the target software program group identifier by 1, and then release the target storage unit in the common lookup table.

[0018] It is understood that when the instructions in a computing unit are completed, the computing unit is released, and the target storage unit in the corresponding common lookup table is also released. In subsequent processes, new instructions can be distributed to the computing unit, and the processing software program group identifier and the index value corresponding to the newly distributed instructions are stored in the target storage unit.

[0019] Step S4: If the number of incomplete instructions in the memory unit currently pointed to by the pointer in the event lookup table is 0, then release the memory unit currently pointed to by the pointer and the corresponding index value, trigger the program event corresponding to the index value of the memory unit currently pointed to by the pointer, and then increment the current pointer by 1. If the pointer value after incrementing by 1 is greater than M, then update the pointer value to 1.

[0020] If the number of incomplete instructions in the memory location currently pointed to by the pointer in the event lookup table is 0, it means that the program instructions corresponding to the memory location pointed to by the pointer in the event lookup table have been executed and the corresponding event needs to be executed. After the event lookup table releases the memory location currently pointed to by the pointer and the corresponding index value, the software program group corresponding to the event lookup table can allocate the index value to other programs in sequence.

[0021] As one embodiment, step S1 includes: Step S11: Obtain the software program group to be processed {A1, A2, ..., A...} n ,...,A N}, A n Let A be the nth software program group to be processed, where n ranges from 1 to N, and N is the total number of software program groups to be processed. n ={A1 n A2 n ,...,A i n ,...,A f(n) n}, A i n For A n The corresponding i-th software program to be processed, where i ranges from 1 to f(n), and f(n) is A n The corresponding number of software programs to be processed, for each A i n It includes multiple instructions, different A n They are independent of each other, and the same A n A1 in n A2 n ,...,A i n ,...,A f(n) n Execution of A needs to be performed in order. i n The corresponding event.

[0022] Step S12: Set up a common lookup table FX in the downstream device, FX={D1,D2,...,D...} q ,...,DQ}, D q Let D be the q-th storage unit in FX, where q ranges from 1 to Q, Q is the total number of computing units in the downstream device, and D is the total number of computing units in the downstream device. q with U q Correspondingly, U q This is the q-th computational unit.

[0023] Step S13, for each A n Set up a corresponding event lookup table B. n B n ={C1 n C2 n ,...,C m n ,...,C M N}, C m n For B n The m-th storage unit in the array, where m ranges from 1 to M.

[0024] In a preferred embodiment, the size of the event lookup table corresponding to each software program group to be processed is equal.

[0025] As one example, A i n ={W1 in W2 in ,...,W j in ,...,W g(in) in}, W j in For A i n The corresponding j-th instruction, where j ranges from 1 to g(in), and g(in) is A i n The corresponding number of instructions, step S2 includes: for each A n Perform the following operations in parallel: Step S21: Initial index value R=1, i=1, j=1, current number of unexecuted instructions X=0.

[0026] Step S22, W j in The corresponding index value is set to R, and W is... j in The data is sent to the corresponding computing unit, and W is transferred to it. j in Corresponding A n , R store to W j inThe corresponding computing unit updates X = X + 1 in the storage unit corresponding to the common lookup table. If A is issued i n In the corresponding instruction process, the data stored in the storage unit corresponding to the common lookup table by the computing unit that has completed execution is A n and R, then update X = X - 1 and release the corresponding computing unit.

[0027] It should be noted that during the process of issuing A i n In the corresponding instruction process, there may be an instruction of A i n that has been issued and executed. Each time such an instruction appears, the value of X needs to be subtracted by 1 to ensure the accuracy of the X value.

[0028] Step S23: If j < g(in), then update j = j + 1 and return to execute Step S22. If j = g(in), then execute Step S24.

[0029] Step S24: If i = f(n), then for A n End the process of Step S2. If i < f(n), then execute Step S25.

[0030] Step S25: Store the current X value in the R-th storage unit of B n Update i = i + 1, j = 1, R = R + 1. If the updated R = M + 1, then update R = 1 and return to execute Step S22.

[0031] It should be noted that if the updated R = M + 1, it means that it may need to loop back to R = 1, so update R = 1. By cycling through the R value, the size of the event lookup table can be reduced while ensuring the normal issuance of the program.

[0032] As an embodiment, Step S3 includes: Step S31: When the instruction in the q-th computing unit is executed, obtain the corresponding target A q in D n and the target R value, and release D q .

[0033] Step S32: Update the X value in the storage unit corresponding to the target R value in the target B n corresponding to the target A n to X - 1.

[0034] As an embodiment, Step S4 includes: Step S41: If the pointer WR n in B n currently points to C mn If X is 0, then release the corresponding A. n The corresponding WR n The current C it points to m n The corresponding index value, Step S42: The downstream device sends a B-based message to the upstream device. n pointer WR in n The current C it points to m n Corresponding A i n The corresponding event execution instruction executes the corresponding event.

[0035] Step S43, Update B n pointer WR in n =WR n +1, if the updated WR n =M+1, then update WR n =1.

[0036] Software program events can include one type of event or multiple types of events. If the software program events include multiple types of events, then in step S2, the event type of the program corresponding to the corresponding index value and the number of currently incomplete instructions are stored in the storage unit of the event lookup table. In step S4, when the program event corresponding to the index value of the storage unit currently pointed to by the pointer is triggered, the event type corresponding to the storage unit currently pointed to by the pointer is sent to the upstream device. The upstream device executes the program event corresponding to the index value of the storage unit currently pointed to based on the event type. By simultaneously feeding back the corresponding event types to the upstream device, it is convenient for the upstream device to quickly execute the corresponding type of event. Software program events include cache flush events, cache invalidation events, cache refresh and invalidation events, etc.

[0037] It should be noted that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although the flowcharts describe the steps as sequential processes, many of these steps can be performed in parallel, concurrently, or simultaneously. Furthermore, the order of the steps can be rearranged. A process can be terminated when its operation is complete, but it may also have additional steps not included in the figures. A process can correspond to a method, function, procedure, subroutine, subroutine, etc.

[0038] This invention also provides an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being configured to perform the method described in this invention.

[0039] This invention also provides a computer-readable storage medium storing computer-executable instructions for performing the methods described in this invention.

[0040] This invention ensures the ordered execution of software program events by using a common lookup table and an event lookup table corresponding to each group of software programs to be processed. Each storage unit in the common lookup table corresponds to a computing unit. The event lookup table is smaller than the common lookup table, which reduces the resource consumption required by the lookup table, thereby reducing the hardware resource consumption during the ordered execution of software program events and improving the efficiency of the ordered execution of software program events.

[0041] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any way. Although the present invention has been disclosed above with reference to preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art can make some modifications or alterations to the above-disclosed technical content to create equivalent embodiments without departing from the scope of the present invention. Any simple modifications, equivalent changes, and alterations made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the scope of the present invention.

Claims

1. A method for preserving the order of events in a software program, characterized in that, Comprising: Step S1: Set a common lookup table and set a corresponding event lookup table for each software program group to be processed. Each software program group to be processed includes multiple programs that require event-ordered execution. Each program includes multiple instructions. The storage units in the common lookup table correspond one-to-one with the computing units of the downstream device. Each event lookup table includes M storage units, where M is the maximum index value and M is less than the total number of computing units; Step S2: Store the identification of the software program group to be processed corresponding to the instruction currently allocated to the corresponding computing unit and the index value corresponding to the corresponding program in the storage unit of the common lookup table. The index values of the programs in the software program group to be processed are cyclically set in the order from 1 to M. The same index value of the same software program group to be processed cannot be repeatedly set at the same time. Store the current number of uncompleted instructions of the program corresponding to the corresponding index value in the storage unit of the event lookup table. The pointer in the event lookup table initially points to the storage unit with an index value of 1; Step S3: When the instruction in a computing unit is executed, obtain the identification of the target software program group to be processed and the index value corresponding to the target program stored in the corresponding target storage unit in the common lookup table, subtract 1 from the current corresponding number of uncompleted instructions of the program corresponding to the index value corresponding to the target program in the event lookup table corresponding to the target software program group identification, and then release the target storage unit in the common lookup table; Step S4: If the number of uncompleted instructions in the storage unit currently pointed to by the pointer in the event lookup table is 0, release the storage unit currently pointed to by the pointer and the corresponding index value, trigger the program event corresponding to the index value corresponding to the storage unit currently pointed to by the pointer, and then increment the current pointer by 1. If the pointer value after incrementing by 1 is greater than M, update the pointer value to 1.

2. The method according to claim 1, wherein: Step S1 includes: Step S11: Obtain the software program group to be processed {A1, A2, ..., A...} n ,...,A N }, A n Let A be the nth software program group to be processed, where n ranges from 1 to N, and N is the total number of software program groups to be processed. n ={A1 n A2 n ,...,A i n ,...,A f(n) n }, A i n For A n The corresponding i-th software program to be processed, where i ranges from 1 to f(n), and f(n) is A n The corresponding number of software programs to be processed, for each A i n It includes multiple instructions, different A n They are independent of each other, and the same A n A1 in n A2 n ,...,A i n ,...,A f(n) n Execution of A needs to be performed in order. i n The corresponding event; Step S12: Set up a common lookup table FX in the downstream device, FX={D1,D2,...,D...} q ,...,D Q }, D q Let D be the q-th storage unit in FX, where q ranges from 1 to Q, Q is the total number of computing units in the downstream device, and D is the total number of computing units in the downstream device. q with U q Correspondingly, U q This is the q-th computational unit; Step S13, for each A n Set up a corresponding event lookup table B. n B n ={C1 n C2 n ,...,C m n ,...,C M N }, C m n For B n The m-th storage unit in the array, where m ranges from 1 to M.

3. The method according to claim 2, wherein: A i n ={W1 in W2 in ,...,W j in ,...,W g(in) in }, W j in For A i n The corresponding j-th instruction, where j ranges from 1 to g(in), and g(in) is A i n The corresponding number of instructions, step S2 includes: for each A n Perform the following operations in parallel: Step S21: The initial index value R = 1, i = 1, j = 1, and the current number of unexecuted instructions X = 0; Step S22, W j in The corresponding index value is set to R, and W is... j in The data is sent to the corresponding computing unit, and W is transferred to it. j in Corresponding A n , R store to W j in The corresponding computation unit updates X=X+1 in the storage unit corresponding to the common lookup table. If A is issued... i n During the corresponding instruction process, the data stored in the memory unit corresponding to the common lookup table after the calculation unit has completed execution is A. n If the value is equal to R, then update X = X - 1 and release the corresponding computing unit; Step S23: If j < g(in), then update j = j + 1 and return to execute Step S22. If j = g(in), then execute Step S24; Step S24: If i = f(n), then for A n End the process of Step S2. If i < f(n), then execute Step S25; Step S25: Store the current X value in B. n In the Rth storage unit, update i=i+1, j=1, R=R+1. If the updated R=M+1, then update R=1 and return to execute step S22.

4. The method according to claim 3, wherein: Step S3 includes: Step S31: When the instructions in the q-th computing unit have been executed, obtain D. q The corresponding target A in n And the target R value, release D q ; Step S32: Move target A n Corresponding target B n The value of X in the storage unit corresponding to the target R value is updated to X-1.

5. The method according to claim 4, wherein: Step S4 includes: Step S41, if B n pointer WR in n The current C it points to m n If X is 0, then release the corresponding A. n The corresponding WR n The current C it points to m n The corresponding index value; Step S42: The downstream device sends a B-based message to the upstream device. n pointer WR in n The current C it points to m n Corresponding A i n The corresponding event execution instruction executes the corresponding event; Step S43, Update B n pointer WR in n =WR n +1, if the updated WR n =M+1, then update WR n =1.

6. The method according to claim 1, wherein: The software program event includes one type of event or multiple types of events.

7. The method according to claim 6, wherein: If the software program event includes multiple types of events, then in Step S2, store the event type and the current number of uncompleted instructions of the program corresponding to the corresponding index value in the storage unit of the event lookup table; In step S4, when the program event corresponding to the index value of the memory unit currently pointed to by the pointer is triggered, the event type corresponding to the memory unit currently pointed to by the pointer is sent to the upstream device, and the upstream device executes the program event corresponding to the index value of the memory unit currently pointed to based on the event type.

8. The method according to claim 7, characterized in that, Software program events include cache refresh events, cache invalidation events, cache refresh, and invalidation events.

9. An electronic device, characterized in that, include: At least one processor; And, a memory communicatively connected to the at least one processor; The memory stores instructions that are executed by the at least one processor, the instructions being configured to perform the method of any one of claims 1-8.

10. A computer-readable storage medium, characterized in that, The device stores computer-executable instructions for performing the method of any one of claims 1-8.

Citation Information

Patent Citations

  • Accelerating table lookup in system on chip using decoupled lookup table accelerator

    CN115701597A

  • Data processing method and system, electronic equipment, storage medium and program product

    CN116561133A

  • Method for scheduling tasks and related products thereof

    CN117667328A