Task allocation method, task processing method and processing architecture

By constructing objective functions and constraints and rationally allocating tasks to general-purpose processors and special-purpose processors, the problem of load imbalance in computer processing architecture is solved, and resource utilization and task execution efficiency are improved.

CN115543583BActive Publication Date: 2025-09-16LYNXI TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202211397434.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-09
Publication Date
2025-09-16
Estimated Expiration
2042-11-09

AI Technical Summary

Technical Problem

In computer processing architecture, the load on general-purpose processors and special-purpose processors is unbalanced, resulting in long processing time and low resource utilization, and there is a lack of consideration for load balancing between general-purpose processors and special-purpose processors.

Method used

By constructing objective functions and constraints, and combining the costs and available computing power of general and specialized processing methods, we determine the target allocation plan for tasks, rationally utilize the two processing resources, consider the priority and dependencies of tasks, and optimize the compilation order.

Benefits of technology

It improves the processor load balancing capability and resource utilization, reduces the total task execution time, and solves the problem of unreasonable compilation order caused by task priority and dependencies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115543583B_ABST
    Figure CN115543583B_ABST
Patent Text Reader

Abstract

The present disclosure provides a task allocation method, a task processing method and a processing architecture, which belong to the field of computer technology. The method includes: for a plurality of tasks to be processed, determining the first cost corresponding to the general processing method and the second cost corresponding to the special processing method for each task to be processed; constructing an objective function and constraints based on the first and second costs corresponding to each task to be processed, the first available computing power of the general processing method, and the second available computing power of the special processing method; solving the target solution of the objective function that meets the constraints, and determining the target allocation scheme for the plurality of tasks to be processed based on the target solution; wherein the target allocation scheme is used to indicate the compilation method and / or compilation order of the plurality of tasks to be processed. According to the embodiments of the present disclosure, tasks can be allocated more reasonably and evenly, and the total execution time of tasks can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a task allocation method, a task processing method, and a processing architecture. Background Art

[0002] Computers support the execution of tasks in a precise manner. That is, for a general-purpose program, the compiler converts it into equivalent underlying execution code, and the processor executes the processing operations precisely according to the process specified by the code. In this way, the determinism of the computer becomes the basis of its controllability, allowing the computer to solve problems completely according to human will. However, with the development of approximate computing technology, computers support the processing of special-purpose programs, which can save computing resources and improve processing speed at the expense of appropriate computing accuracy or the determinism of the execution process. However, in related technologies, general-purpose programs are usually processed by general-purpose processors, while special-purpose programs are usually processed by special-purpose processors. When allocating tasks, there is a lack of consideration for load balancing between general-purpose processors and special-purpose processors. Summary of the Invention

[0003] The present disclosure provides a task allocation method, a task processing method and processing architecture, an electronic device, and a computer-readable storage medium.

[0004] In a first aspect, the present disclosure provides a task allocation method, which is applied to allocate tasks to be processed of a processing architecture, and the compilation mode of the processing architecture includes a general compilation mode and a special compilation mode, and the processing mode of the processing architecture includes a general processing mode and a special processing mode. The task allocation method includes: for multiple tasks to be processed, determining a first cost corresponding to the general processing mode and a second cost corresponding to the special processing mode for each of the tasks to be processed, wherein the tasks to be processed using the general processing mode are compiled and processed by the general compilation mode, and the tasks to be processed using the special processing mode are compiled and processed by the special compilation mode; constructing an objective function and constraints based on the first cost and the second cost corresponding to each of the tasks to be processed, the first available computing power of the general processing mode, and the second available computing power of the special processing mode; solving the objective solution of the objective function that satisfies the constraints, and determining a target allocation scheme for multiple tasks to be processed based on the target solution; wherein the target allocation scheme is used to indicate the compilation mode and / or compilation order of multiple tasks to be processed.

[0005] In a second aspect, the present disclosure provides a task processing method, which is applied to a processing architecture, and the compilation mode of the processing architecture includes a general compilation mode and a special compilation mode, and the processing mode of the processing architecture includes a general processing mode and a special processing mode. The task processing method includes: obtaining a target allocation scheme corresponding to a plurality of tasks to be processed, and the target allocation scheme is used to indicate the compilation mode and / or compilation order of the plurality of tasks to be processed; according to the target allocation scheme, compiling and processing each of the tasks to be processed using the corresponding compilation mode and / or compilation order to obtain a compilation result of at least one of the tasks to be processed; processing the compilation result of each of the tasks to be processed based on the processing mode corresponding to the compilation mode to obtain processing results of multiple tasks to be processed; wherein the compilation results include a general compilation result compiled and processed using the general compilation mode, and a special compilation result compiled and processed using the special compilation mode, and the general compilation result is processed based on the general processing mode, and the special compilation result is processed based on the special processing mode.

[0006] In a third aspect, the present disclosure provides a processing architecture, which includes: a task allocation module, which is used to obtain a target allocation scheme for multiple tasks to be processed according to the task allocation method described in any one of the embodiments of the present disclosure; a compilation system, which is used to compile and process the multiple tasks to be processed according to the target allocation scheme using a corresponding compilation method to obtain compilation results; a processing system, which is used to process the compilation results using a processing method corresponding to the compilation method to obtain processing results of the multiple tasks to be processed; wherein, the compilation method includes a general compilation method and a special compilation method, and the processing method includes a general processing method and a special processing method, and the general processing method is used to process the compilation result obtained using the general compilation method, and the special processing method is used to process the compilation result obtained using the special compilation method.

[0007] In a fourth aspect, the present disclosure provides an electronic device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores one or more computer programs executable by the at least one processor, and one or more of the computer programs are executed by the at least one processor so that the at least one processor can execute the above-mentioned task allocation method or task processing method.

[0008] In a fifth aspect, the present disclosure provides an electronic device comprising: a plurality of processing cores; and an on-chip network configured to exchange data between the plurality of processing cores and external data; wherein one or more instructions are stored in one or more of the processing cores, and one or more of the instructions are executed by one or more of the processing cores, so that one or more of the processing cores can execute the above-mentioned task allocation method or task processing method.

[0009] In a sixth aspect, the present disclosure provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the above-mentioned task allocation method or task processing method when executed by a processor / processing core.

[0010] The embodiments provided by the present disclosure can construct an objective function and constraints based on the cost required when using a general processing method and a dedicated processing method for multiple tasks to be processed, the available computing power of the two processing methods, and other information. By solving the objective function that satisfies the constraints, the target solution can be obtained, and then the target allocation plan for multiple tasks to be processed can be determined based on the target solution. In this process, the available computing power of the general processing method and the dedicated processing method and the cost required for each task to be processed using different processing methods are taken into account. While taking into account both computing power and cost, the appropriate compilation method and processing method are selected for each task to be processed, so that the processing resources of the two different processing methods can be more reasonably utilized, and the total execution time of the task can also be reduced.

[0011] 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 disclosure, nor are they intended to limit the scope of the present disclosure. Other features of the present disclosure will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] The accompanying drawings are used to provide a further understanding of the present disclosure and constitute a part of the specification. Together with the embodiments of the present disclosure, they are used to explain the present disclosure and do not constitute a limitation of the present disclosure. The above and other features and advantages will become more apparent to those skilled in the art by describing detailed example embodiments with reference to the accompanying drawings. In the accompanying drawings:

[0013] Figure 1 A schematic diagram of a processing architecture provided for related technologies;

[0014] Figure 2 A flowchart of a task allocation method provided in an embodiment of the present disclosure;

[0015] Figure 3 A schematic diagram of the working process of a many-core architecture provided in an embodiment of the present disclosure;

[0016] Figure 4A schematic diagram of an approximation process of an approximator provided in an embodiment of the present disclosure;

[0017] Figure 5 A schematic diagram of an approximation process of an approximator provided in an embodiment of the present disclosure;

[0018] Figure 6 A schematic diagram of cost accuracy provided by an embodiment of the present disclosure;

[0019] Figure 7 A flowchart of a task processing method provided by an embodiment of the present disclosure;

[0020] Figure 8 A schematic diagram of the working process of a task processing method provided by an embodiment of the present disclosure;

[0021] Figure 9 A block diagram of a processing architecture provided in an embodiment of the present disclosure;

[0022] Figure 10 A block diagram of a task allocation device provided in an embodiment of the present disclosure;

[0023] Figure 11 A block diagram of an electronic device provided in an embodiment of the present disclosure;

[0024] Figure 12 A block diagram of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0025] To enable those skilled in the art to better understand the technical solutions of the present disclosure, exemplary embodiments of the present disclosure are described below in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding. These details should be considered merely exemplary. Therefore, those skilled in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0026] In the absence of conflict, the various embodiments of the present disclosure and the various features therein may be combined with each other.

[0027] As used herein, the term "and / or" includes any and all combinations of one or more of the associated listed items.

[0028] The terms used herein are only used to describe specific embodiments and are not intended to limit the present disclosure. As used herein, the singular forms "a" and "the" are also intended to include the plural forms, unless the context clearly indicates otherwise. It will also be understood that when the terms "comprising" and / or "made of" are used in this specification, the presence of the features, wholes, steps, operations, elements and / or components is specified, but the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or groups thereof is not excluded. Similar words such as "connected" or "connected" are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect.

[0029] Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and the present disclosure, and will not be interpreted as having an idealized or overly formal meaning unless expressly defined as such herein.

[0030] In related art, although general-purpose processors and dedicated processors can be set up simultaneously in a processing architecture, generally speaking, the general-purpose processor still processes general programs, while the dedicated processor processes dedicated programs, and there is no cross-processing of processors (i.e., the general-purpose processor processes dedicated programs, and the dedicated processor processes general programs). When the load of the general-purpose processor and the dedicated processor is unbalanced, it is easy to cause a long processing time. In addition, during the processing process, one of the general-purpose processor and the dedicated processor may be idle, resulting in low utilization of processing resources.

[0031] Figure 1 A schematic diagram of a processing architecture provided for related technologies. Figure 1 The processing architecture 100 is provided with a general-purpose processor 110 and a special-purpose processor 120. The processing architecture 100 can use the general-purpose processor 110 and the special-purpose processor 120 to process general-purpose programs and special-purpose programs.

[0032] like Figure 1 As shown, for general programs, they can only be compiled and processed using a general compilation method, and the general processor 110 executes the corresponding general compilation result to obtain the execution result of the general program; similarly, for special programs, they can only be compiled and processed using a special compilation method, and the special processor 120 executes the corresponding special compilation result to obtain the execution result of the special program.

[0033] If, within a certain time period, multiple programs to be processed received by the processing architecture are dedicated programs, the dedicated processors are in an efficient working state, but the general-purpose processors are in an idle state because they have no matching programs (i.e., general-purpose programs) to process. This task allocation method makes the load of each processor in the processing architecture unbalanced, which easily leads to problems such as long task processing time and low utilization of processing resources.

[0034] According to the task allocation method of the embodiment of the present invention, the available computing power of the general processing method and the special processing method and the cost required for each task to adopt different processing methods are taken into account. While taking into account the computing power and cost, a suitable compilation method and processing method are selected for each task to be processed, so that the processing resources of the two different processing methods can be more reasonably utilized, and the total execution time of the task can be reduced. In addition, in the task allocation process, the priority information and / or execution dependency information of each task to be processed are also taken into account, so that the compilation order of each task to be processed is scientific and reasonable, and the problem of not being able to smoothly execute tasks according to a given compilation method due to task priority, dependency relationship during task execution, etc. is alleviated.

[0035] The task allocation method and task processing method according to the embodiments of the present disclosure can be executed by an electronic device such as a terminal device or a server. The terminal device can be a user equipment (UE), a mobile device, a user terminal, a terminal, a cellular phone, a cordless phone, a personal digital assistant (PDA), a handheld device, a computing device, a vehicle-mounted device, a wearable device, etc. The method can be implemented by a processor calling a computer-readable program instruction stored in a memory. The server can be an independent physical server, a server cluster composed of multiple servers, or a cloud server capable of cloud computing.

[0036] A first aspect of an embodiment of the present disclosure provides a task allocation method.

[0037] Figure 2 The flowchart of a task allocation method provided in an embodiment of the present disclosure can be applied to allocate tasks to be processed by a processing architecture, wherein the compilation mode of the processing architecture includes a general compilation mode and a special compilation mode, and the processing mode of the processing architecture includes a general processing mode and a special processing mode. Figure 2 , the task allocation method includes:

[0038] In step S21 , for a plurality of tasks to be processed, a first cost corresponding to a general processing method and a second cost corresponding to a dedicated processing method are determined for each task to be processed.

[0039] Among them, the tasks to be processed using the general processing method are compiled and processed using the general compilation method, and the tasks to be processed using the special processing method are compiled and processed using the special compilation method.

[0040] In step S22, an objective function and constraint conditions are constructed according to the first cost and the second cost corresponding to each task to be processed, the first available computing power of the general processing method, and the second available computing power of the special processing method.

[0041] In step S23, a target solution of the target function that satisfies the constraint conditions is obtained, and a target allocation scheme of the plurality of tasks to be processed is determined according to the target solution.

[0042] The target allocation scheme is used to indicate the compilation method and / or compilation order of multiple tasks to be processed.

[0043] According to the embodiments of the present disclosure, it is possible to select a suitable compilation method and processing method for each task to be processed in a manner that takes into account both computing power and cost, thereby making more reasonable use of the processing resources of the two different processing methods and reducing the total execution time of the task. At the same time, since the attribute information of the task is also taken into account in the task allocation process, the compilation and processing are performed in combination with the priority information and / or execution dependency information of each task to be processed, so that the compilation order of each task to be processed is scientific and reasonable, alleviating the problem of not being able to smoothly execute the task according to the given compilation method due to task priority, dependency relationship during task execution, etc.

[0044] In some optional implementations, the tasks to be processed include general-purpose tasks and specialized tasks. General-purpose tasks are general-purpose tasks, typically corresponding to general-purpose programs, while specialized tasks are tasks in specific fields (e.g., tasks in the field of neural networks), typically corresponding to specialized programs. Furthermore, specialized programs typically can only be run on specialized processors, and thus specialized tasks can only be executed by specialized processors.

[0045] For example, a general-purpose processor includes general-purpose processing components, while a special-purpose processor includes special-purpose processing components. General-purpose processing components can process any program, while special-purpose processing components can more efficiently process special-purpose programs. For example, neural network acceleration hardware, as a special-purpose processing component, can efficiently process neural network tasks, but has low processing power or may even be unable to process other programs.

[0046] In the embodiments of the present disclosure, regardless of whether the task to be processed is a general-purpose task or a dedicated task, it can be compiled and processed using either a general-purpose compilation method or a dedicated compilation method, and the compilation result can be processed using the processing method corresponding to the compilation method. In other words, in this application, a general-purpose task can be executed by a general-purpose processor or a dedicated processor, and similarly, a dedicated task can be executed by a dedicated processor or a general-purpose processor.

[0047] In some optional implementations, the processing architecture includes a compilation system and a processing system, wherein the compilation system supports both a general compilation method and a dedicated compilation method, and the processing system supports both a general processing method and a dedicated processing method. In other words, for general programs, the compilation system of the processing architecture can use both a general compilation method and a dedicated compilation method for compilation. Similarly, for dedicated programs, the compilation system can still use a dedicated compilation method and a general compilation method for compilation. However, the general compilation results obtained using the general compilation method must be processed using the general processing method, and the dedicated compilation results obtained using the dedicated compilation method must also be processed using the dedicated processing method.

[0048] Figure 3 A schematic diagram of the working process of a multi-core architecture provided by an embodiment of the present disclosure. Figure 3 The processing architecture 300 includes a general compiler 311, a general processor 312, a special compiler 321 and a special processor 322, wherein the general compiler 311 supports a general compilation mode, the special compiler 321 supports a special compilation mode, the general processor 312 supports a general processing mode, and the special processor 322 supports a special processing mode.

[0049] like Figure 3 As described, when the task to be processed received by the processing architecture 300 corresponds to a general program, the general compiler 311 can compile the general program in a general compilation method (corresponding to path 1-1) to obtain a general compilation result, and transmit the general compilation result to the general processor 312 for processing (corresponding to path 1-2), thereby obtaining the processing result of the general program; in addition, for the general program, the special compiler 321 can also compile the general program in a special compilation method (corresponding to path 2-1), obtain a special compilation result, and transmit the special compilation result to the special processor 322 for processing (corresponding to path 2-2), thereby obtaining the processing result of the general program.

[0050] When the task to be processed received by the processing architecture corresponds to a special program, the general compiler 311 can compile the special program in a general compilation method (corresponding to path 3-1), obtain a general compilation result, and transmit the general compilation result to the general processor 312 for processing (corresponding to path 3-2), thereby obtaining the processing result of the special program; in addition, for the special program, the special compiler 321 can also compile the special program in a special compilation method (corresponding to path 4-1), obtain a special compilation result, and transmit the special compilation result to the special processor 322 for processing (corresponding to path 4-2), thereby obtaining the processing result of the special program.

[0051] It should be noted that when using a general compilation method, regardless of whether the task being processed is general or specialized, the corresponding program code is precisely converted into equivalent underlying execution code, and this equivalent underlying execution code is executed using a general processing method, without introducing errors or precision loss. Therefore, in this case, specialized tasks are compiled and processed in a precise manner, which may result in lower efficiency than executing the specialized task using a specialized compilation method and specialized processing method.

[0052] When using a dedicated compilation method to compile a dedicated task, the compilation effect and efficiency are often high due to the high compatibility between the dedicated task and the compilation method. However, when using a dedicated compilation method to compile a general-purpose task, the underlying execution code obtained is approximate execution code using a dedicated program. Therefore, executing this approximate execution code using a dedicated processing method is equivalent to approximating the general-purpose task. This process introduces a loss of precision, but this loss of precision should be within a preset tolerance.

[0053] It should also be noted that, precisely because any type of task to be processed can be compiled and processed using either a general compilation method or a dedicated compilation method, it is possible to cross-use processing methods when executing tasks. That is, in addition to being able to compile a general program using a general compilation method and execute the compiled result using a general processing method, it is also possible to compile a general program using a dedicated compilation method and process the compiled result using a dedicated processing method. Similarly, in addition to being able to compile a dedicated program using a dedicated compilation method and execute the compiled result using a dedicated processing method, it is also possible to compile a dedicated program using a pass compilation method and process the compiled result using a pass processing method. Based on this processing method, the flexibility and rationality of task allocation during the compilation process are improved, thereby improving the load balancing capability of the processor and the utilization rate of processing resources.

[0054] In some optional implementations, in step S21, the first cost is the cost required to process the pending task using a general processing method, and the second cost is the cost required to process the pending task using a dedicated processing method, wherein the cost includes various types of resources consumed to execute the corresponding task (computing resources, storage resources, communication resources, etc.), which is related to information such as the scale of the program corresponding to the pending task, the type of resources occupied, and the amount of resources. Since the pending tasks include both general tasks and dedicated tasks, the first cost may include the following situations: the cost of general processing of general tasks, and the cost of general processing of dedicated tasks; similarly, the second cost may include the following situations: the cost of dedicated processing of general tasks, and the cost of dedicated processing of dedicated tasks.

[0055] In some optional implementations, determining a first cost corresponding to a general processing method and a second cost corresponding to a dedicated processing method for each to-be-processed task includes:

[0056] If the task to be processed is a general task, the cost of compiling the task to be processed in a general compilation manner and processing the general compilation result in a general processing manner is determined according to a preset cost algorithm as the first cost of the task to be processed;

[0057] In the case where the task to be processed is a general task, determining the second cost of the task to be processed based on the critical accuracy and cost-accuracy association information of the task to be processed, wherein the critical accuracy represents the minimum accuracy requirement allowed by the task to be processed, and the cost-accuracy association information is used to represent the association relationship between the corresponding cost and accuracy when the task to be processed is compiled in a dedicated compilation method and the dedicated compilation result is processed in a dedicated processing method;

[0058] If the task to be processed is a dedicated task, the cost of compiling the task to be processed in a general compilation manner and processing the general compilation result in a general processing manner is determined according to the cost algorithm as the first cost of the task to be processed;

[0059] When the task to be processed is a dedicated task, the cost of compiling the task to be processed in a dedicated compilation mode and processing the dedicated compilation result in a dedicated processing mode is determined according to the cost algorithm as the second cost of the task to be processed.

[0060] It can be seen that in the process of determining the first cost and the second cost, the corresponding Figure 3In the processing architecture shown, the first costs corresponding to paths 1-1 and 1-2, the first costs corresponding to paths 3-1 and 3-2, and the second costs corresponding to paths 4-1 and 4-2 can be calculated based on a cost algorithm. The second costs corresponding to paths 2-1 and 2-2 are determined based on information related to the critical accuracy and cost accuracy of the task to be processed. The preset cost algorithm is used to calculate the cost, and the same or different cost algorithms can be used for the costs corresponding to the different paths described above, which is not limited in this embodiment of the present disclosure.

[0061] In some optional implementations, the critical accuracy is the minimum accuracy requirement (or maximum error) allowed for the task to be processed. When the task to be processed is a face recognition task, if the acceptable accuracy requirement is 90% (i.e., the maximum error is 10%), the critical accuracy is 90%.

[0062] In some optional implementations, when the task to be processed is a general task, the second cost of the task to be processed is determined based on the critical accuracy and cost accuracy correlation information of the task to be processed, including: when the task to be processed is a general task, based on the critical accuracy, a binary classification method is used to select a target approximator of the task to be processed from a plurality of preset approximators, the approximator is used to compile the task to be processed using a special compilation method with an approximate approximation method, so that the corresponding special compilation result is processed using a special processing method; the second cost of the task to be processed is determined based on the cost accuracy correlation information of the target approximator.

[0063] In some optional implementations, considering that neural networks and lookup tables have approximate approximation capabilities, approximate compilation can be achieved through neural networks or lookup tables (i.e., general programs are compiled using a dedicated compilation method). Correspondingly, the approximator includes a neural network approximator or a lookup table approximator consisting of an input layer, a hidden layer, an output layer, and an activation function. Among them, the approximate approximation capability of the neural network and the lookup table means that for a Turing-terminating function, within a limited domain of definition and under given accuracy requirements, there is a corresponding neural network or lookup table that can approximate a preset target function (the target function is the function to be approximated) while meeting the accuracy requirements. Operators with the above-mentioned approximation capability are usually called approximators.

[0064] In some optional implementations, the neural network approximator includes a multilayer perceptron (MLP) approximator, which is composed of an input layer, a hidden layer, an output layer, and an activation function, which is equivalent to a piecewise linear function. When performing approximate approximation, the number of segments of the piecewise linear function corresponding to the approximator can be adjusted by adjusting the number of neurons in the hidden layer, and the position of the piecewise fitting can also be adjusted by adjusting the parameters of the neural network. After the above adjustment, the degree of fit between the objective function and the function corresponding to the approximator is high, thereby meeting the preset fitting requirements.

[0065] Figure 4 A schematic diagram of the approximation process of an approximator provided in an embodiment of the present disclosure. Figure 4 , the approximation process includes:

[0066] Step S41: determine the approximation sub-item.

[0067] For example, an MLP approximator with n1 neurons in the hidden layer is selected as the initial approximator. The approximator with n1 neurons in the hidden layer can represent a piecewise linear function with n1 segments. Furthermore, generally, the larger the hidden layer (e.g., the larger the number of neurons, the larger the hidden layer), the higher the approximation accuracy that can be achieved, but the corresponding execution cost is also greater. Therefore, a balance between approximation accuracy and cost can be taken into account to obtain a suitable approximator.

[0068] Step S42: According to the objective function, the piecewise linear function corresponding to the approximator is converted into parameters of the neural network to obtain the neural network.

[0069] Among them, the objective function is the function to be approximated.

[0070] In some optional implementations, the operation of converting the piecewise linear function into neural network parameters can be performed using a preset formula. The embodiment of the present disclosure does not limit the conversion method.

[0071] Step S43: training the neural network to improve its approximation accuracy.

[0072] Step S44, determining whether the approximation accuracy of the neural network reaches a preset accuracy.

[0073] Step S45: If the preset accuracy is not reached, increase the number of neurons in the hidden layer of the approximator, and jump to step S42 to re-execute the approximation operation.

[0074] Step S46: When the preset accuracy is reached, the cost corresponding to the approximation is determined.

[0075] Step S47: Determine whether the number of hidden layer neurons of the approximator needs to be reduced according to the cost.

[0076] Step S48: If it is determined to be necessary, reduce the number of neurons in the hidden layer of the approximator, and jump to step S42 to re-execute the approximation operation.

[0077] Step S49: When it is determined that the number of neurons in the hidden layer of the approximator does not need to be reduced, the approximator is determined to be a suitable approximator, and the approximation process ends.

[0078] Among them, the appropriate approximator can be regarded as the target approximator.

[0079] In some optional implementations, the approximator is a lookup table approximator, which is equivalent to a piecewise step function. The approximation accuracy can be adjusted by adjusting the size of the lookup table. A larger lookup table improves the approximation accuracy but also consumes more memory, and vice versa.

[0080] Figure 5 A schematic diagram of the approximation process of an approximator provided in an embodiment of the present disclosure. Figure 5 , the approximation process includes:

[0081] Step S51: Select an approximator.

[0082] The approximator corresponds to a lookup table, and the size of the lookup table is fixed. The content of the lookup table is determined according to subsequent steps. Furthermore, the larger the lookup table, the more data it can accommodate, which in turn increases the approximation accuracy and occupies more storage space, and vice versa.

[0083] Step S52: Divide the objective function into multiple intervals, and for each interval, select a function value at a certain point in the interval as the objective function value of the interval.

[0084] Step S53: Record the corresponding relationship between each interval and the objective function value in a lookup table.

[0085] After the lookup table is obtained, the approximation accuracy of the approximator can be adjusted by further adjusting the size of the lookup table.

[0086] Step S54 , determining the approximation accuracy according to the lookup table and the objective function, and judging whether the approximation accuracy reaches a preset accuracy.

[0087] Step S55 : If the preset accuracy is not reached, the approximation sub-table is increased, and the process jumps to step S52 to re-execute the approximation operation.

[0088] Step S56: When the preset accuracy is reached, the cost corresponding to the approximation is determined.

[0089] Step S57: Determine whether the approximation lookup table needs to be reduced according to the cost.

[0090] Step S58: If it is determined that it is necessary, reduce the approximation sub-table and jump to step S52 to re-execute the approximation operation.

[0091] Step S59 : If it is determined that the lookup table of the approximator does not need to be reduced, the approximator is determined to be a suitable approximator, and the approximation process ends.

[0092] Among them, the appropriate approximator can be regarded as the target approximator.

[0093] In summary, neural network approximators typically require a significant amount of computational resources and a moderate amount of storage resources. However, because neural networks are trainable, their approximation accuracy can be improved through training. Lookup table approximators, on the other hand, require significant storage resources, but require minimal computational effort during execution. Furthermore, lookup tables cannot be trained, resulting in limited flexibility in adjusting approximation accuracy. Therefore, neural network approximators and lookup table approximators have different advantages and disadvantages. When performing approximation, the appropriate approximator can be selected based on actual needs, computational resources, and storage resources.

[0094] In some optional implementations, the cost-precision association information is a cost-precision (CP) curve, which represents the association between the approximation precision and the cost of the approximator.

[0095] Figure 6 A schematic diagram of cost accuracy provided by an embodiment of the present disclosure. Figure 6 As shown in the figure, the horizontal axis represents the cost and the vertical axis represents the error. As the cost increases, the error generally shows a decreasing trend. Considering the inverse correlation between error and accuracy, as the cost increases, the accuracy generally shows an increasing trend.

[0096] In some optional implementations, an exhaustive method can be used to obtain the CP curve. For example, for the MLP approximator, the number of hidden layer neurons is set to [2, 3, 4, 5, 6, …, 100], each of which is constructed and trained once, and then the corresponding CP curve is plotted. The CP curve plotting process for the lookup table approximator is similar and will not be described in detail here.

[0097] Considering the time and effort required to train a neural network and generate multiple lookup tables, some optional implementations can employ a bisection approach, drawing a CP curve with critical accuracy as a prerequisite. While the resulting CP curve may not be a complete curve, the target approximator can be identified based on the drawn line segments (or points).

[0098] For example, for an MLP approximator with the number of hidden layer neurons set to [2, 3, 4, 5, 6, …, 100], we can first select 36 hidden layer neurons and determine the corresponding cost-precision relationship. When its accuracy is much greater than the critical accuracy, we can appropriately reduce the number of hidden layer neurons to select 16 hidden layer neurons and determine the corresponding cost-precision relationship. When its accuracy is less than the critical accuracy, we can appropriately increase the number of hidden layer neurons to select 24 hidden layer neurons and determine the corresponding cost-precision relationship. This process continues until the approximator's accuracy "approaches" the critical accuracy. This approximator is then selected as the target approximator, and the cost corresponding to this target approximator is the second cost. The search path based on the binary search method is now: [32, 16, 24, …, p], where p is the number of neurons in the target approximator's hidden layer (p is an integer between 16 and 24). This method allows the target approximator to be determined with fewer training steps, effectively improving efficiency.

[0099] In some optional implementations, after determining the sum of the first cost and the second cost of the task to be processed, the corresponding objective function and constraint conditions can be constructed in step S22.

[0100] In some optional implementations, the first available computing power of the general processing mode is the computing power available to the general processor, and the second available computing power of the special processing mode is the computing power available to the special processor.

[0101] In some optional implementations, step S22 includes: for each task to be processed, arbitrarily selecting the corresponding first cost or second cost as an alternative cost; combining the alternative costs of multiple tasks to be processed to obtain multiple alternative allocation schemes; determining the general processing time and special processing time of each alternative allocation scheme based on the first available computing power and the second available computing power, the general processing time represents the processing time required to process the task to be processed corresponding to the first cost in the alternative allocation scheme using a general processing method, and the special processing time represents the processing time required to process the task to be processed corresponding to the second cost in the alternative allocation scheme using a special processing method; constructing an objective function based on the general processing time and special processing time of each alternative allocation scheme; finally, determining the constraint conditions based on the first available computing power and the second available computing power.

[0102] Exemplarily, the objective function is a function of the total execution time of multiple tasks to be processed. The target solution obtained by solving the objective function can minimize the total task duration; the constraint condition is a condition about the available computing power. Through this constraint condition, it can be ensured that the computing power required to execute the task is lower than the available computing power (the highest computing power of the general processing method is lower than the first available computing power, and the highest computing power of the special processing method is lower than the second available computing power).

[0103] In some optional implementations, the pending tasks correspond to attribute information, and the attribute information of the pending tasks includes task priority information and / or task execution dependency information. Among them, the task priority information is used to characterize the processing priority level of each pending task, and the task execution dependency information characterizes the dependency of each pending task in the execution order. For example, among the pending tasks A, B and C, if the input data of the pending task B includes the execution result of the pending task C, and the input and output of the pending task A are irrelevant to the pending tasks B and C, then the task execution order can only include one of: C→A→B, B→C→A, and simultaneous execution of B and C→A.

[0104] In some optional implementations, when determining the constraints, you can refer to the attribute information of the tasks to be processed, so as to reduce the total execution time of the tasks while making the compilation order of the tasks to be processed more scientific and reasonable, thereby alleviating the problem of not being able to smoothly execute tasks according to a given compilation method due to task priority, dependencies during task execution, etc. Correspondingly, step S22 includes: for each task to be processed, arbitrarily selecting the corresponding first cost or second cost as an alternative cost; combining the alternative costs of multiple tasks to be processed to obtain multiple alternative allocation schemes; determining the general processing time and special processing time of each alternative allocation scheme based on the first available computing power and the second available computing power, the general processing time represents the processing time required to process the task to be processed corresponding to the first cost in the alternative allocation scheme using a general processing method, and the special processing time represents the processing time required to process the task to be processed corresponding to the second cost in the alternative allocation scheme using a special processing method; constructing an objective function based on the general processing time and special processing time of each alternative allocation scheme, the objective function is a function of the total execution time of multiple tasks to be processed; determining the compilation order requirements of each task to be processed based on task priority information and / or task execution dependency information; and determining the constraint conditions based on the compilation order requirements.

[0105] In some optional implementations, the general processing time is the ratio of the sum of the first costs in the alternative allocation scheme to the first available computing power, and the dedicated processing time is the ratio of the sum of the second costs in the alternative allocation scheme to the second available computing power.

[0106] For example, the tasks to be processed include 4 items A, B, C, and D, where A and B are general tasks, C and D are special tasks, and the first cost corresponding to A is cost A1 , the second cost is cost A2 , the first cost corresponding to B is cost B1 , the second cost is cost B2 , the first cost corresponding to C is cost C1 , the second cost is cost C2 , the first cost corresponding to D is cost D1 , the second cost is cost D2 For A, it can choose cost A1 、cost A2 By combining the alternative costs of the above four tasks to be processed, 16 alternative allocation schemes can be obtained, including: cost A1 , cost B1 , cost C1 , cost D1 ;cost A2 , cost B1 , cost C1 , cost D1 ;…;cost A2 , cost B2 , cost C2 , cost D2 Among them, "cost A2 , cost B1 , cost C1 , cost D1 " indicates that a special treatment is adopted for A, and a general treatment is adopted for B, C, and D. Other alternative allocation schemes are similar and will not be described in detail here.

[0107] Assuming the first available computing power is p1 and the second available computing power is p2, then for the alternative allocation scheme cost A1 , cost B1 , cost C1 , cost D1 , since they all adopt a common processing method, their common processing time is t1_1=(cost A1 +cost B1 +cost C1 +cost D1 ) / p1, dedicated processing time t1_2 = 0; for the alternative allocation scheme cost A2 , cost B1 , costC1 , cost D1 , since B, C and D use a general processing method and A uses a dedicated processing method, its general processing time is t2_1=(cost B1 +cost C1 +cost D1 ) / p1, dedicated processing time t2_2=(cost A1 ) / p2, ..., and so on, for the alternative allocation scheme cost A2 , cost B2 , cost C2 , cost D2 Since they all adopt a dedicated processing method, the general processing time t16_2=0, and the dedicated processing time is t16_2=(cost A2 +cost B2 +cost C2 +cost D2 ) / p2.

[0108] Then, construct the objective function F=min(max(ti_1,ti_2)), where i represents the serial number of the alternative allocation plan, ti_1 represents the general processing time corresponding to the i-th alternative allocation plan, and ti_2 represents the special processing time corresponding to the i-th alternative allocation plan.

[0109] Furthermore, if the priority order of the four pending tasks is C, B, A, and D, then constraint Q1 is constructed, and Q1 indicates that the parsing time for C should be earlier than the parsing time for B, the parsing time for B should be earlier than the parsing time for A, and the parsing time for A should be earlier than the parsing time for D.

[0110] In addition, if the task execution dependency information of the above four pending tasks is that the execution of C depends on the execution of A, then the constraint condition Q2 is constructed, and Q2 indicates that the resolution time of A is earlier than the resolution time of C.

[0111] It should be noted that one or more constraints may be set for an objective function (for example, including constraints based on compilation order requirements and constraints based on available computing power), and the embodiments of the present disclosure do not limit this.

[0112] In some optional implementations, after constructing the objective function and constraints, they can be solved. In step S23, solving the target solution of the objective function that satisfies the constraints includes: solving the optimal solution of the objective function that satisfies the constraints as the target solution based on a preset allocation optimization algorithm; wherein the allocation optimization algorithm includes at least one of a simulated annealing algorithm (SA) and a heuristic search algorithm.

[0113] Among them, the simulated annealing algorithm is a random optimization algorithm based on the Monte-Carlo iterative solution strategy. Its starting point is based on the similarity between the annealing process of solid materials in physics and the general combinatorial optimization problem. Starting from a certain higher initial temperature, with the continuous decrease of the temperature parameter, combined with the probability jump characteristic, it randomly searches for the global optimal solution of the objective function in the solution space, that is, it can probabilistically jump out of the local optimal solution and eventually tend to the global optimal. The heuristic search algorithm evaluates each search position in the state space, obtains the best position, and then searches from this position until the target is determined. Applied to the embodiment of the present disclosure, that is, through the simulated annealing algorithm or the heuristic search algorithm, the optimal solution of the objective function is solved while satisfying the constraints, and the optimal solution is used as the target solution.

[0114] It should be noted that the above allocation optimization algorithm is only an example, and the embodiments of the present disclosure do not limit this.

[0115] After obtaining the target solution, a target allocation scheme for multiple tasks to be processed can be determined based on the target solution. The target allocation scheme includes the compilation method and / or compilation order of the multiple tasks to be processed. When the compilation method is determined, the corresponding processing method is determined.

[0116] For example, the optimal solution (target solution) for the objective function F = min(max(ti_1, ti_2)) should be the one where, among multiple alternative allocation schemes, the maximum of the general execution time and the dedicated execution time is the minimum among all the alternative allocation schemes, while satisfying the constraints. This optimal solution corresponds to an alternative allocation scheme, which is then determined as the target allocation scheme. Compilation and processing of the pending tasks is then performed based on this target allocation scheme.

[0117] It should be noted that in the embodiment of the present disclosure, if within a certain time period, the multiple tasks to be processed received by the processing architecture are general tasks, and the available computing power of the dedicated processor is relatively high, some of the tasks can be assigned to the dedicated processor. When the critical accuracy is met, these tasks are processed by the dedicated processor, thereby alleviating the processing pressure of the general processor and shortening the total task processing time. A similar task allocation scheme can also be adopted for the case where multiple tasks to be processed are dedicated tasks, which will not be described in detail here. It can be seen that in the embodiment of the present disclosure, since the processors can be used crosswise, when determining the target allocation scheme, the available computing power and cost of various processing methods are comprehensively considered. Therefore, when executing task allocation based on the target allocation scheme, the load of each processor can be made more balanced, and the total task processing time can be shortened as much as possible.

[0118] A second aspect of the embodiments of the present disclosure provides a task processing method.

[0119] Figure 7 This is a flowchart of a task processing method provided by an embodiment of the present disclosure, which is applied to a processing architecture, wherein the compilation mode of the processing architecture includes a general compilation mode and a special compilation mode, and the processing mode of the processing architecture includes a general processing mode and a special processing mode. Figure 7 , the method comprising:

[0120] Step S71: Obtain target allocation plans corresponding to multiple tasks to be processed.

[0121] The target allocation scheme is used to indicate the compilation method and / or compilation order of multiple tasks to be processed.

[0122] Step S72 : compile each task to be processed using a corresponding compilation method and / or compilation sequence according to the target allocation plan to obtain a compilation result of at least one task to be processed.

[0123] Step S73 , processing the compilation results of each task to be processed based on a processing method corresponding to the compilation method to obtain processing results of multiple tasks to be processed.

[0124] The compilation results include general compilation results compiled in a general compilation method and special compilation results compiled in a special compilation method. The general compilation results are processed based on the general processing method, and the special compilation results are processed based on the special processing method.

[0125] In some optional implementations, to further shorten task processing time and improve processing efficiency, compilation and task processing can be performed in parallel using a streaming approach. In other words, instead of completing compilation of all pending tasks before executing the corresponding task processing, compilation and task processing can be performed in parallel.

[0126] For example, after compiling a pending task, the corresponding processor can use the corresponding processing method to process the compilation result to obtain the processing result of the pending task. While processing the first pending task, the next pending task can be compiled so that the next pending task can be processed in time when the compilation is completed. And so on, the pipeline parallel processing of compilation processing and task processing is realized, which further shortens the total processing time and improves the task processing efficiency.

[0127] According to the embodiments of the present disclosure, since the target allocation scheme provides a compilation method and / or compilation order for multiple tasks to be processed, the compilation operations and processing operations of each task to be processed can be accurately performed according to the target allocation scheme, and since the target allocation scheme comprehensively considers information such as task cost, available computing power and task attributes, when the compilation and processing operations are performed based on the target allocation scheme, the load balancing is improved, the idleness of processing resources is alleviated, and the utilization rate of processing resources is improved.

[0128] In some optional implementations, the tasks to be processed include general tasks and special tasks, and each task to be processed is compiled and processed using a corresponding compilation method, including: when the task to be processed is a general task, the general compilation method is used to compile the task to be processed into a first equivalent execution instruction based on an accurate calculation method, or, the special compilation method is used to compile the task to be processed into an approximate execution instruction based on an approximate approximation method; when the task to be processed is a special task, the general compilation method is used to compile the task to be processed into a second equivalent execution instruction based on an accurate calculation method, or, the special compilation method is used to compile the task to be processed into a special execution instruction. Among them, the approximate execution instruction is equivalent to the approximate instruction of the first equivalent execution instruction, and there is a loss of precision or an error is introduced in the process. Therefore, the accuracy of the execution result of the approximate execution instruction is usually less than the accuracy of the first equivalent execution instruction; the second equivalent execution instruction is equivalent to obtaining the executable code of the special task in the form of accurate calculation, and the corresponding execution efficiency is usually lower than the execution efficiency of the special execution instruction.

[0129] It should be noted that, for general programs, a dedicated compilation method is used to compile the general program. Its essence is to use an approximator to approximate the general program, so as to obtain a dedicated program that meets the critical accuracy. For related content, please refer to the approximation process based on the approximator in the embodiment of the present disclosure, and will not be described in detail here.

[0130] In some optional implementations, the processing system includes a general component that supports a general processing method and a dedicated component that supports a dedicated processing method; accordingly, the compilation results of multiple tasks to be processed are processed based on a processing method corresponding to the compilation method to obtain the processing results of multiple tasks to be processed, including: processing the compilation results of multiple tasks to be processed based on a processing method corresponding to the compilation method to obtain the processing results of multiple tasks to be processed, including: when the task to be processed is a general task and a general compilation method is adopted, executing the first equivalent execution instruction corresponding to the task to be processed based on the general component; when the task to be processed is a general task and a dedicated compilation method is adopted, executing the approximate execution instruction corresponding to the task to be processed based on the dedicated component; when the task to be processed is a dedicated task and a general compilation method is adopted, executing the second equivalent execution instruction corresponding to the task to be processed based on the general component; when the task to be processed is a dedicated task and a general compilation method is adopted, executing the dedicated execution instruction corresponding to the task to be processed based on the dedicated component.

[0131] In other words, when the task to be processed is a general task corresponding to a general program, if a general compilation method is used, the general processing component can process the general program in the form of precise calculations. If a dedicated processing method is used, it is first necessary to use a dedicated program to approximate the general program, and then use the dedicated processing component to execute the dedicated program. This is equivalent to the dedicated processing component executing the general program in an approximate processing manner, introducing precision loss in the process, and the execution result obtained is an approximate result of the general program. When the task to be processed is a dedicated task corresponding to a dedicated program, if a dedicated compilation method is used, the dedicated processing component can be used to efficiently execute the dedicated program, which is more efficient. If a general compilation method is used, it is equivalent to the general processing component processing the dedicated program in the form of precise calculations. The processing efficiency is usually lower than when the dedicated compilation method and dedicated processing method are directly used.

[0132] Figure 8 A schematic diagram of the working process of a task processing method provided in an embodiment of the present disclosure, referring to Figure 8 , the method comprising:

[0133] In step S801, a plurality of tasks to be processed are received.

[0134] The tasks to be processed include general tasks and special tasks, which correspond to general programs and special programs respectively. Regardless of the type of the tasks to be processed, they can be processed in either a general processing method or a special processing method.

[0135] In step S802 , the task to be processed is a general task, and a first cost of the task to be processed is calculated.

[0136] In step S803, the task to be processed is a general task, and the critical accuracy of the task to be processed is obtained.

[0137] In step S804 , a cost-accuracy curve of the task to be processed is determined according to the critical accuracy, and a second cost of the task to be processed is determined according to the cost-accuracy curve.

[0138] In step S805 , the task to be processed is a dedicated task, and a first cost of the task to be processed is calculated.

[0139] In step S806 , the task to be processed is a dedicated task, and a second cost of the task to be processed is calculated.

[0140] In step S807, based on the first cost, the second cost, the first available computing power, the second available computing power and the attribute information of the task to be processed, the objective function and constraints are constructed, the target solution is obtained by solving through the allocation optimization algorithm, and the target allocation plan is determined based on the target solution.

[0141] The target allocation scheme provides the compilation method and / or compilation order of each task to be processed. After the target allocation scheme is determined, the compilation process can be performed according to the methods shown in ①, ②, ③ and ④.

[0142] In step S808, for any task to be processed in the target allocation plan, for the first case, a general compilation method is used for compilation processing; for the second case, a special compilation method is used for compilation processing; for the third case, a general compilation method is used for compilation processing; for the fourth case, a special compilation method is used for compilation processing.

[0143] In other words, if the target allocation plan indicates that a general processing method should be used for a general task, then it belongs to the first case and can be processed in the corresponding manner. If it indicates that a special processing method should be used for a general task, then it belongs to the second case and can be processed in the corresponding manner. If it indicates that a general processing method should be used for a special task, then it belongs to the third case and can be processed in the corresponding manner. If it indicates that a special processing method should be used for a special task, then it belongs to the fourth case and can be processed in the corresponding manner.

[0144] In step S809, the general compilation result is executed in a general processing manner.

[0145] Among them, the general compilation result is the result obtained by compiling using the general compilation method, corresponding to cases ① and ③ in the figure.

[0146] In step S810, the dedicated compilation result is executed in a dedicated processing manner.

[0147] Among them, the dedicated compilation result is the result obtained by compiling using a dedicated compilation method, corresponding to the second and fourth cases in the figure.

[0148] A third aspect of the embodiments of the present disclosure provides a processing architecture.

[0149] Figure 9 A block diagram of a processing architecture provided by an embodiment of the present disclosure. Figure 9 , the processing architecture 900 includes:

[0150] The task allocation module 910 is configured to obtain a target allocation plan for a plurality of tasks to be processed according to any one of the task allocation methods of the embodiments of the present disclosure.

[0151] The compilation system 920 is used to compile the plurality of pending tasks in a corresponding dedicated compilation mode according to the target allocation scheme to obtain compilation results.

[0152] The processing system 930 is configured to process the compilation result in a processing manner corresponding to the compilation manner to obtain processing results of the plurality of tasks to be processed.

[0153] Among them, the compilation mode includes a general compilation mode and a special compilation mode, and the processing mode includes a general processing mode and a special processing mode. The general processing mode is used to process the compilation result obtained by the general compilation mode, and the special processing mode is used to process the compilation result obtained by the special compilation mode.

[0154] A fourth aspect of the embodiments of the present disclosure provides a task allocation device.

[0155] Figure 10 This is a block diagram of a task allocation device provided by an embodiment of the present disclosure, which can be used to allocate tasks to be processed by a processing architecture, wherein the compilation mode of the processing architecture includes a general compilation mode and a dedicated compilation mode, and the processing mode of the processing architecture includes a general processing mode and a dedicated processing mode. Figure 10 , the task allocation device 1000 includes:

[0156] The determination module 1010 is configured to determine, for each of the plurality of tasks to be processed, a first cost corresponding to a general processing method and a second cost corresponding to a dedicated processing method.

[0157] Among them, the tasks to be processed using the general processing method are compiled and processed using the general compilation method, and the tasks to be processed using the special processing method are compiled and processed using the special compilation method.

[0158] The construction module 1020 is used to construct an objective function and constraint conditions according to the first cost and the second cost corresponding to each task to be processed, the first available computing power of the general processing method, and the second available computing power of the special processing method.

[0159] The solution module 1030 is used to solve the target solution of the target function that meets the constraint conditions, and determine the target allocation scheme of multiple tasks to be processed according to the target solution.

[0160] The target allocation scheme is used to indicate the compilation method and / or compilation order of multiple tasks to be processed.

[0161] It is understood that the above-mentioned various method embodiments mentioned in this disclosure can be combined with each other to form combined embodiments without violating the principle logic. Due to space limitations, this disclosure will not go into details. It is understood by those skilled in the art that in the above-mentioned methods of specific implementation, the specific execution order of each step should be determined by its function and possible internal logic.

[0162] In addition, the present disclosure also provides electronic devices and computer-readable storage media, which can be used to implement any task allocation method or task processing method provided by the present disclosure. The corresponding technical solutions and descriptions are referred to the corresponding records in the method section and will not be repeated here.

[0163] Figure 11 A block diagram of an electronic device provided in an embodiment of the present disclosure.

[0164] Reference Figure 11 An embodiment of the present disclosure provides an electronic device, which includes: at least one processor 1101; at least one memory 1102, and one or more I / O interfaces 1103, connected between the processor 1101 and the memory 1102; wherein the memory 1102 stores one or more computer programs that can be executed by the at least one processor 1101, and the one or more computer programs are executed by the at least one processor 1101 to enable the at least one processor 1101 to perform the above-mentioned task allocation method or task processing method.

[0165] Figure 12 A block diagram of an electronic device provided in an embodiment of the present disclosure.

[0166] Reference Figure 12 An embodiment of the present disclosure provides an electronic device, which includes multiple processing cores 1201 and an on-chip network 1202, wherein the multiple processing cores 1201 are connected to the on-chip network 1202, and the on-chip network 1202 is used to exchange data between the multiple processing cores and external data.

[0167] One or more instructions are stored in one or more processing cores 1201 , and the one or more instructions are executed by one or more processing cores 1201 , so that one or more processing cores 1201 can execute the above-mentioned task allocation method or task processing method.

[0168] In some embodiments, the electronic device may be a brain-inspired chip. Because brain-inspired chips can use vectorized computing and require external memory, such as Double Data Rate (DDR) synchronous dynamic random access memory, to load parameters such as weight information of the neural network model, the disclosed embodiments utilize batch processing for higher computational efficiency.

[0169] The present disclosure also provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor / processing core, implements the above-described task allocation method or task processing method. The computer-readable storage medium may be a volatile or non-volatile computer-readable storage medium.

[0170] An embodiment of the present disclosure also provides a computer program product, including a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes the above-mentioned task allocation method or task processing method.

[0171] It will be understood by those skilled in the art that all or some of the steps, systems, and functional modules / units in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. In a hardware implementation, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or may be implemented as hardware, or may be implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable storage medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or temporary medium).

[0172] As is well known to those skilled in the art, the term computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information (such as computer-readable program instructions, data structures, program modules or other data). Computer storage media includes, but is not limited to, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), static random access memory (SRAM), flash memory or other memory technology, portable compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical disc storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, as is well known to those skilled in the art, communication media typically contains computer-readable program instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.

[0173] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions to be stored in the computer-readable storage medium in each computing / processing device.

[0174] The computer program instructions for performing the operations of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Smalltalk, C++, and conventional procedural programming languages ​​such as "C" language or similar programming languages. Computer-readable program instructions may be executed entirely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer, partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., utilizing an Internet service provider to connect via the Internet). In some embodiments, an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), may be personalized by utilizing the state information of the computer-readable program instructions. The electronic circuit may execute the computer-readable program instructions, thereby realizing various aspects of the present disclosure.

[0175] The computer program product described herein may be implemented in hardware, software, or a combination thereof. In one embodiment, the computer program product is implemented as a computer storage medium. In another embodiment, the computer program product is implemented as a software product, such as a software development kit (SDK).

[0176] Various aspects of the present disclosure are described herein with reference to flowcharts and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present disclosure. It should be understood that each block of the flowcharts and / or block diagrams, and combinations of blocks in the flowcharts and / or block diagrams, can be implemented by computer-readable program instructions.

[0177] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processor of the computer or other programmable data processing device, a device is generated that implements the functions / actions specified in one or more blocks in the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium, where these instructions cause the computer, programmable data processing device, and / or other device to operate in a specific manner. Thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing various aspects of the functions / actions specified in one or more blocks in the flowchart and / or block diagram.

[0178] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operational steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more blocks in the flowchart and / or block diagram.

[0179] The flow charts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the systems, methods and computer program products according to multiple embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and the part of the module, program segment or instruction contains one or more executable instructions for realizing the prescribed logical function. In some alternative implementations, the functions marked in the box can also occur in a sequence different from that marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented by a dedicated hardware-based system that performs the prescribed function or action, or can be implemented by a combination of dedicated hardware and computer instructions.

[0180] Example embodiments have been disclosed herein, and although specific terms are employed, they are used and should be interpreted only in a general illustrative sense and not for purposes of limitation. In some instances, it will be apparent to those skilled in the art that, unless otherwise expressly stated, features, characteristics, and / or elements described in conjunction with a particular embodiment may be used alone or in combination with features, characteristics, and / or elements described in conjunction with other embodiments. Therefore, it will be understood by those skilled in the art that various changes in form and detail may be made without departing from the scope of the present disclosure as set forth in the appended claims.

Claims

1. A task allocation method, characterized in that: The method is applied to allocate tasks to be processed of a processing architecture, wherein the compilation mode of the processing architecture includes a general compilation mode and a special compilation mode, and the processing mode of the processing architecture includes a general processing mode and a special processing mode, and the method includes: For a plurality of tasks to be processed, determining a first cost corresponding to the general processing method and a second cost corresponding to the special processing method for each of the tasks to be processed, wherein the tasks to be processed using the general processing method are compiled and processed using the general compilation method, and the tasks to be processed using the special processing method are compiled and processed using the special compilation method, the general compilation method is based on support from a general compiler, and the special compilation method is based on support from a special compiler, and the tasks to be processed include general tasks and special tasks; An objective function and constraint conditions are constructed based on the first cost and the second cost corresponding to each of the tasks to be processed, the first available computing power of the general processing method, and the second available computing power of the special processing method, wherein the first available computing power is the available computing power of the general processor, the second available computing power is the available computing power of the special processor, the processing accuracy of the general task when executed by the general processor is higher than the processing accuracy when executed by the special processor, and the execution efficiency of the special task when executed by the special processor is higher than the execution efficiency when executed by the general processor. The process of executing the general task by the dedicated processor includes: using a dedicated program to approximate the general program to obtain a compiled dedicated program, and using a dedicated processing component of the dedicated processor to execute the compiled dedicated program; wherein the dedicated program is a program corresponding to the dedicated task, the general program is a program corresponding to the general task, and the approximate approximation is implemented based on an approximator, and the approximator includes a neural network approximator composed of an input layer, a hidden layer, an output layer, and an activation function, or a lookup table approximator; Solving the objective solution of the objective function that satisfies the constraint conditions, and determining the target allocation schemes of the plurality of tasks to be processed according to the objective solution; The target allocation scheme is used to indicate the compilation method and / or compilation order of the plurality of tasks to be processed.

2. The task allocation method according to claim 1, characterized in that: The determining of a first cost corresponding to the general processing method and a second cost corresponding to the dedicated processing method for each of the to-be-processed tasks includes: If the task to be processed is a general task, determining, according to a preset cost algorithm, the cost of compiling the task to be processed using the general compilation method and processing the general compilation result using the general processing method, as the first cost of the task to be processed; In a case where the task to be processed is a general task, determining a second cost of the task to be processed based on critical accuracy and cost-accuracy association information of the task to be processed, wherein the critical accuracy represents a minimum accuracy requirement allowed by the task to be processed, and the cost-accuracy association information is used to represent a corresponding association relationship between cost and accuracy when the task to be processed is compiled using the dedicated compilation method and the dedicated compilation result is processed using the dedicated processing method; If the task to be processed is a dedicated task, determining, according to the cost algorithm, a cost of compiling the task to be processed in the general compilation manner and processing the general compilation result in the general processing manner, as a first cost of the task to be processed; When the task to be processed is a dedicated task, the cost of compiling the task to be processed in the dedicated compilation mode and processing the dedicated compilation result in the dedicated processing mode is determined according to the cost algorithm as the second cost of the task to be processed.

3. The task allocation method according to claim 2, characterized in that: When the task to be processed is a general task, determining the second cost of the task to be processed according to the critical precision and cost precision association information of the task to be processed includes: In the case where the task to be processed is a general task, a target approximator for the task to be processed is selected from a plurality of preset approximators using a binary classification method according to the critical accuracy, the approximator being used to compile the task to be processed using the dedicated compilation method in an approximate approximation manner, so that the corresponding dedicated compilation result is processed using the dedicated processing method; Determine a second cost of the task to be processed according to the cost-accuracy association information of the target approximator.

4. The task allocation method according to claim 1, characterized in that: The constructing of the objective function and the constraint conditions according to the first cost and the second cost corresponding to each of the tasks to be processed, the first available computing power of the general processing method, and the second available computing power of the dedicated processing method includes: For each of the tasks to be processed, arbitrarily select the corresponding first price or second price as an alternative price; Combining the alternative costs of the plurality of tasks to be processed to obtain a plurality of alternative allocation schemes; Determining, based on the first available computing power and the second available computing power, a general processing time and a dedicated processing time for each of the alternative allocation schemes, wherein the general processing time represents a processing time required to process a pending task corresponding to a first cost in the alternative allocation scheme using a general processing method, and the dedicated processing time represents a processing time required to process a pending task corresponding to a second cost in the alternative allocation scheme using the dedicated processing method; constructing the objective function based on the general processing time and the specific processing time of each of the alternative allocation schemes, wherein the objective function is a function of the total execution time of the plurality of tasks to be processed; The constraint condition is determined according to the first available computing power and the second available computing power.

5. The task allocation method according to claim 1, characterized in that: Attribute information corresponding to the task to be processed; The constraint condition at least includes a compilation order requirement of each of the tasks to be processed, and the compilation order requirement is determined according to attribute information of each of the tasks to be processed.

6. The task allocation method according to claim 4, characterized in that: The general processing duration is the ratio of the sum of the first costs in the alternative allocation scheme to the first available computing power, and the dedicated processing duration is the ratio of the sum of the second costs in the alternative allocation scheme to the second available computing power.

7. The task allocation method according to claim 1, characterized in that: The method of solving the objective function that satisfies the constraint condition includes: According to a preset allocation optimization algorithm, an optimal solution of the objective function that satisfies the constraint conditions is obtained as the target solution; The allocation optimization algorithm includes at least one of a simulated annealing algorithm and a heuristic search algorithm.

8. A task processing method, characterized in that: Applied to a processing architecture, wherein the compilation mode of the processing architecture includes a general compilation mode and a dedicated compilation mode, and the processing mode of the processing architecture includes a general processing mode and a dedicated processing mode, the method includes: Obtaining target allocation schemes corresponding to a plurality of tasks to be processed, wherein the target allocation schemes are used to indicate compilation methods and / or compilation orders of the plurality of tasks to be processed; Compiling each of the tasks to be processed using a corresponding compilation method and / or compilation order according to the target allocation scheme to obtain a compilation result of at least one of the tasks to be processed; Processing the compilation results of each of the tasks to be processed based on a processing method corresponding to the compilation method to obtain processing results of multiple tasks to be processed; The compilation result includes a general compilation result compiled and processed using the general compilation method and a special compilation result compiled and processed using the special compilation method, and the general compilation result is processed based on the general processing method, and the special compilation result is processed based on the special processing method, the general compilation method is based on the support of a general compiler, and the special compilation method is based on the support of a special compiler. The tasks to be processed include general tasks and special tasks. The processing accuracy of the general tasks when executed by the general processor is higher than that when executed by the special processor. The execution efficiency of the special tasks when executed by the special processor is higher than that when executed by the general processor. The process of the general task being executed by the dedicated processor includes: using a dedicated program to approximate the general program to obtain a compiled dedicated program, and using the dedicated processing component of the dedicated processor to execute the compiled dedicated program; wherein, the dedicated program is the program corresponding to the dedicated task, the general program is the program corresponding to the general task, and the approximate approximation is implemented based on an approximator, and the approximator includes a neural network approximator or a lookup table approximator composed of an input layer, a hidden layer, an output layer and an activation function.

9. The task processing method according to claim 8, characterized in that: The step of compiling each of the tasks to be processed using a corresponding compilation method includes: In the case where the task to be processed is a general task, the general compilation method is used to compile the task to be processed into a first equivalent execution instruction based on an exact calculation method, or the dedicated compilation method is used to compile the task to be processed into an approximate execution instruction based on an approximate approximation method; When the task to be processed is a dedicated task, the task to be processed is compiled into a second equivalent execution instruction based on a precise calculation method using the general compilation method, or the task to be processed is compiled into a dedicated execution instruction using the dedicated compilation method.

10. The task processing method according to claim 9, characterized in that: The processing architecture includes general components supporting the general processing mode and special components supporting the special processing mode; The processing of the compilation results of each of the tasks to be processed based on the processing method corresponding to the compilation method to obtain the processing results of the plurality of tasks to be processed includes: When the task to be processed is a general task and the general compilation method is adopted, executing a first equivalent execution instruction corresponding to the task to be processed based on the general component; When the task to be processed is a general task and the dedicated compilation method is adopted, executing the approximate execution instruction corresponding to the task to be processed based on the dedicated component; When the task to be processed is a dedicated task and the general compilation method is adopted, executing a second equivalent execution instruction corresponding to the task to be processed based on the general component; When the task to be processed is a dedicated task and the dedicated compilation method is adopted, the dedicated execution instruction corresponding to the task to be processed is executed based on the dedicated component.

11. A processing architecture, characterized in that include: A task allocation module, configured to obtain a target allocation scheme for a plurality of tasks to be processed according to the task allocation method according to any one of claims 1 to 7; A compilation system, configured to compile the plurality of tasks to be processed using a corresponding compilation method according to the target allocation plan to obtain compilation results; a processing system, configured to process the compilation result in a processing manner corresponding to the compilation manner, and obtain processing results of the plurality of tasks to be processed; The compilation mode includes a general compilation mode and a dedicated compilation mode, and the processing mode includes a general processing mode and a dedicated processing mode. The general processing mode is used to process the compilation result obtained by adopting the general compilation mode, and the dedicated processing mode is used to process the compilation result obtained by adopting the dedicated compilation mode. The general compilation mode is based on the support of a general compiler, and the dedicated compilation mode is based on the support of a dedicated compiler. The tasks to be processed include general tasks and special tasks. The processing accuracy of the general tasks when executed by the general processor is higher than that when executed by the special processor. The execution efficiency of the special tasks when executed by the special processor is higher than that when executed by the general processor. The process of the general task being executed by the dedicated processor includes: using a dedicated program to approximate the general program to obtain a compiled dedicated program, and using the dedicated processing component of the dedicated processor to execute the compiled dedicated program; wherein, the dedicated program is the program corresponding to the dedicated task, the general program is the program corresponding to the general task, and the approximate approximation is implemented based on an approximator, and the approximator includes a neural network approximator or a lookup table approximator composed of an input layer, a hidden layer, an output layer and an activation function.

12. 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 one or more computer programs that can be executed by the at least one processor, and the one or more computer programs are executed by the at least one processor to enable the at least one processor to execute the task allocation method according to any one of claims 1 to 7, or the task processing method according to any one of claims 8 to 10.

13. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the computer program implements the task allocation method according to any one of claims 1 to 7 or the task processing method according to any one of claims 8 to 10.

Citation Information

Patent Citations

  • Joint compiling method and system for heterogeneous hardware architecture

    CN110968320A

  • Task allocation method and task allocation device

    CN114461386A

  • Method for controlling heterogeneous multiprocessor and multigrain parallelizing compiler

    US20070283358A1