Heterogeneous computing processing method and electronic device
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- SMARTER SILICON (SHANGHAI) TECH CO LTD
- Filing Date
- 2025-09-15
- Publication Date
- 2026-04-23
AI Technical Summary
Existing heterogeneous computing architectures face inefficiencies in AI mixed-precision computing due to lower energy efficiency of GPU inference compared to NPU inference, leading to slower computing performance.
A method and device for heterogeneous computing that includes receiving task completion signals from processors, obtaining target scheduling codes, and generating task start signals to trigger subsequent processors based on these signals, allowing for efficient task execution across multiple computing units without occupying CPU resources.
This approach enhances computing efficiency by improving parallel capabilities and reducing overall power consumption while optimizing software complexity, enabling synchronized execution of computing tasks across multiple processors.
Smart Images

Figure CN2025121244_23042026_PF_FP_ABST
Abstract
Description
HETEROGENEOUS COMPUTING PROCESSING METHOD AND ELECTRONIC DEVICECROSS-REFERENCE TO RELATED APPLICATION (S)
[0001] This application claims priority to Chinese Patent Application No. 202411304907.7 filed on September 18, 2024, which is incorporated herein by reference in its entirety. FIELD OF THE TECHNOLOGY
[0002] The present disclosure relates to a field of information processing, and in particular to a heterogeneous computing processing method and electronic device.BACKGROUND
[0003] Heterogeneous computing is a distributed computing system that may include multiple computing units, such as CPU (central processing unit) , NPU (Neural Processor Unit) , GPU (Graphics Processing Unit) , DSP (Digital Signal Processor) , or the like.
[0004] FIG. 1 is a schematic diagram of an existing heterogeneous computing architecture, including: CPU, NPU, DSP and GPU, and each processor is connected by a bus. Among them, the general computing unit CPU is responsible for computing scheduling, and the dedicated computing unit (NPU, GPU, DSP, or the like) is responsible for dense computing. Each XPU (a general term for multiple computing units) has different characteristics. CPU is suitable for process control, DSP is suitable for vector operations and has certain flexibility, GPU is suitable for large-scale parallel computing, and NPU is suitable for dedicated AI (Artificial Intelligence) computing.
[0005] Each XPU comes from an off-shelf product of a different supplier, and its computing power module and capabilities are not fully configurable. For example, different XPUs support different data types, and different operators are implemented and executed in different XPUs in different ways and with different efficiencies.
[0006] In order to support AI mixed-precision computing, in certain existing heterogeneous computing architecture, inferences are performed by XPUs that support certain types of data types or operators. For example, INT8+FP16 may be inferred by GPUs for the entire network. One disadvantage is that GPU inference has lower energy efficiency than NPU inference, which may lead to slower computing efficiency.SUMMARY
[0007] In one aspect, the present disclosure provides a heterogeneous computing processing method. The method includes: receiving a task completion signal sent by a first processor, wherein the task completion signal indicates that the first processor has completed a first computing subtask; obtaining a target scheduling code based on the task completion signal; generating a task start signal based on the task completion signal and the target scheduling code; and according to the task start signal, triggering a second processor to execute a second computing subtask, wherein the second computing subtask and the first computing subtask together belong to a computing task.
[0008] In another aspect, the present disclosure provides an electronic device. The electronic device includes: a memory storing computer program instructions; and a processor coupled to the memory and configured to execute the computer program instructions and perform: receiving a task completion signal sent by a first processor, wherein the task completion signal indicates that the first processor has completed a first computing subtask; obtaining a target scheduling code based on the task completion signal; generating a task start signal based on the task completion signal and the target scheduling code; and according to the task start signal, triggering a second processor to execute a second computing subtask, wherein the second computing subtask and the first computing subtask together belong to a computing task.
[0009] In yet another aspect, the present disclosure provides a heterogeneous computing device. The device includes: a receiving module for receiving a task completion signal sent by a first processor, the task completion signal indicating that the first processor has completed a first computing subtask; an acquisition module for obtaining a target scheduling code based on the task completion signal; a generation module for generating a task start signal based on the task completion signal and the target scheduling code; and a triggering module for triggering a second processor to execute a second computing subtask based on a subtask file according to the task start signal, the second computing subtask and the first computing subtask belonging to a same computing task.
[0010] In yet another aspect, the present disclosure provides a non-transitory computer-readable storage medium storing computer program instructions executable by at least one processor to perform: receiving a task completion signal sent by a first processor, wherein the task completion signal indicates that the first processor has completed a first computing subtask; obtaining a target scheduling code based on the task completion signal; generating a task start signal based on the task completion signal and the target scheduling code; and according to the task start signal, triggering a second processor to execute a second computing subtask, wherein the second computing subtask and the first computing subtask together belong to a computing task.BRIEF DESCRIPTION OF THE DRAWINGS
[0011] Features, advantages and aspects of certain embodiments of the present disclosure become more apparent with reference to the following description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. The drawings are schematic and are not necessarily drawn to scale.
[0012] FIG. 1 is a schematic diagram of an existing heterogeneous computing architecture;
[0013] FIG. 2 is a schematic diagram of a process of a heterogeneous computing processing method provided in certain embodiments of the present disclosure;
[0014] FIG. 3 is a schematic diagram of a task execution file provided in certain embodiments of the present disclosure;
[0015] FIG. 4 is a partial schematic diagram of a SOC composition structure of a heterogeneous computing processing method provided in certain embodiments of the present disclosure;
[0016] FIG. 5 is a schematic diagram of a process of generating a task start signal based on the task completion signal and the target scheduling code provided in certain embodiments of the present disclosure;
[0017] FIG. 6 is a partial schematic diagram of another SOC composition structure of a heterogeneous computing processing method provided in certain embodiments of the present disclosure;
[0018] FIG. 7 is a schematic diagram of a process of forming a scheduling code and a subtask file provided in certain embodiments of the present disclosure;
[0019] FIG. 8 is a schematic diagram of a split computing task to obtain a task execution code provided in certain embodiments of the present disclosure;
[0020] FIG. 9 is a schematic diagram of a process of splitting the computing task to obtain a preset number of computing subtasks and a preceding processor and an execution processor corresponding to each computing subtask provided in certain embodiments of the present disclosure;
[0021] FIG. 10 is a schematic diagram of a split computing task provided in certain embodiments of the present disclosure;
[0022] FIG. 11 is a schematic diagram of a split computing task to obtain task execution code provided in certain embodiments of the present disclosure;
[0023] FIG. 12 is a schematic diagram of a split computing task provided in certain embodiments of the present disclosure;
[0024] FIG. 13 is a flowchart of splitting the computing task to obtain a preset number of computing subtasks and a preceding processor and an execution processor corresponding to each computing subtask provided in certain embodiments of the present disclosure;
[0025] FIG. 14 is a schematic diagram of computing subtasks obtained by splitting the computing task provided in certain embodiments of the present disclosure;
[0026] FIG. 15 is a schematic diagram of splitting computing tasks provided in certain embodiments of the present disclosure;
[0027] FIG. 16 is a flowchart of generating corresponding scheduling codes based on the preceding processor and execution processor of each computing subtask provided in certain embodiments of the present disclosure;
[0028] FIG. 17 is a schematic diagram of an implementation scenario of a heterogeneous computing method provided in the present disclosure;
[0029] FIG. 18 is a schematic diagram of the structure of a heterogeneous computing processing device provided in certain embodiments of the present disclosure; and
[0030] FIG. 19 is a schematic diagram of an electronic device provided in certain embodiments of the present disclosure.DETAILED DESCRIPTION
[0031] Certain embodiments of the present disclosure are described below in conjunction with the accompanying drawings. The terms used in the implementation method of the present disclosure are used to refer to certain particular embodiments of the present disclosure, and are not intended to limit the present disclosure.
[0032] Certain embodiments of the present disclosure are described below in conjunction with the drawings. With the development of technology and the emergence of new scenarios, the technical solutions provided in certain embodiments of the present disclosure are also applicable to similar technical problems.
[0033] The terms "first" , "second" , or the like in the descriptions, the claims and the drawings of the present disclosure are used to distinguish similar objects, and do not have to be used to describe a particular order or sequence. The terms used may be interchangeable where appropriate, in a way of distinguishing objects of the same or similar attributes when describing certain embodiments of the present disclosure. In addition, the terms "including" and "comprising" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that a process, method, system, product or device containing a series of units does not have to be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or devices.
[0034] FIG. 2 is a flow chart of a heterogeneous computing processing method provided in certain embodiments of the present disclosure. As shown in FIG. 2, a heterogeneous computing processing method provided in certain embodiments of the present disclosure may include steps 201 to 204, and these steps are described in detail below.
[0035] 201. Receive a task completion signal sent by a first processor, and the task completion signal indicates that the first processor completes the first computing subtask;
[0036] The heterogeneous computing processing method provided in certain embodiments of the present disclosure is applied to a heterogeneous SOC (System on Chip) having multiple processors of different types, and the SOC is also provided with a scheduling device for executing the heterogeneous computing processing method, and the scheduling device implements scheduling and executing heterogeneous computing in multiple processors, and the scheduling device is not a structure in the CPU and does not need to occupy the computing power of the CPU.
[0037] In certain embodiments, in an SOC having multiple processors, each processor executes the computing subtask assigned to it, and a task completion signal is generated when the processor completes the computing subtask.
[0038] In certain embodiments, the signal output end of each processor is connected to the scheduling device through a circuit to form a transmission path of the task completion signal, and the signal output end of the processor outputs the task completion signal to the scheduling device through the transmission path of the task completion signal.
[0039] In certain embodiments, the signal output end may be a pin or a combination of multiple pins.
[0040] In certain embodiments, the task completion signal may be a signal in an agreed form between each processor and the scheduling device, such as a high-level or low-level signal.
[0041] In certain embodiments, the task completion signal is a high-level pulse signal. After a processor completes its computing subtask, it outputs a high-level pulse signal through its signal output end. Correspondingly, after receiving the high-level pulse signal, the scheduling device may determine that the first processor has completed its computing subtask.
[0042] 202. Obtain the target scheduling code based on the task completion signal;
[0043] In certain embodiments, a computing task is pre-divided into multiple computing subtasks, and a scheduling code is preset for each computing subtask, and the scheduling code represents information such as the execution processor and the preceding processor of the computing subtask.
[0044] In certain embodiments, one scheduling code corresponds to one computing subtask, and each of all computing subtasks together constitute one computing task.
[0045] In certain embodiments, the scheduling codes of each computing subtask in the computing task may be stored in the form of a coding queue, and the process of obtaining the target scheduling code corresponding to the scheduling code storage method is described in detail in the subsequent embodiments.
[0046] In certain embodiments, the scheduling codes of each computing subtask in the computing task may be stored in the form of a linked list, and the process of obtaining the target scheduling code corresponding to the scheduling code storage method is described in detail in the subsequent embodiments.
[0047] In certain embodiments, after receiving the task completion signal of the first computing subtask, the corresponding target scheduling code is obtained according to the task completion signal of the first computing subtask.
[0048] In certain embodiments, the first computing subtask is the preceding computing subtask of the second computing subtask, and the scheduling code may characterize the execution order relationship between the first computing subtask and the second computing subtask. After the first computing subtask is completed, the corresponding target scheduling code is obtained, and then the execution of the second computing subtask is triggered based on the target scheduling code. The subsequent step 204 describes in detail the process of determining the second computing subtask.
[0049] In certain embodiments, the preceding computing subtask of a computing subtask may be one or more. When the preceding computing subtask of the second computing subtask is one, the step 202 is triggered when the task completion signal of the preceding computing subtask is received; when the preceding computing subtask of the second computing subtask is multiple, the step 202 is triggered when the task completion signals of all the preceding computing subtasks are received.
[0050] 203. Generate a task start signal based on the task completion signal and the target scheduling code;
[0051] In certain embodiments, the target scheduling code contains relevant information about the second processor that executes the next computing subtask. Accordingly, after receiving the task completion signal of the first computing subtask as the preceding computing subtask, the task start signal is generated in combination with the task completion signal and the target scheduling code to start the second processor of the second computing task.
[0052] In certain embodiments, the scheduling code includes two parts, the first part of the code is used to characterize the preceding processor of the corresponding computing subtask, and the second part of the code is used to characterize the execution processor of the corresponding subtask. According to the scheduling code, the corresponding execution processor may be determined, and then a task start signal is generated to trigger the execution processor to execute an action. The process of generating a task start signal based on the task completion signal and the target scheduling code is described in detail in the subsequent FIG. 5.
[0053] In certain embodiments, the task start signal may be a signal of a form agreed upon between each processor and the scheduling device, such as a high or low level signal.
[0054] In certain embodiments, the task start signal and the task completion signal may use the same type of signal or different types of signals, which may be set according to a particular scenario.
[0055] In certain embodiments, in a SOC with multiple processors, each processor is provided with a signal input end connected to the scheduling device through a circuit to form a transmission path for the task start signal, and the scheduling device sends the task start signal to the signal input end of the processor through the transmission path of the task start signal.
[0056] 204. Based on the task start signal, trigger the second processor to execute the second computing subtask according to the subtask file, and the second computing subtask and the first computing subtask belong to the same computing task.
[0057] In certain embodiments, the task start signal is for the second processor that executes the second computing subtask. Accordingly, after the task start signal is generated, it is sent to the second processor to trigger the second processor to execute the computing subtask.
[0058] In certain embodiments, a subtask file is set for each computing subtask, and the subtask file contains information for the execution processor that executes the corresponding computing subtask to execute the computing subtask.
[0059] In certain embodiments, the subtask file adopts a task execution file (ELF, Executable and Linkable Format) , and the ELF file includes the input data address, result output address and function (algorithm) of the execution processor. The execution processor executes actions according to the ELF file to realize the execution of the computing subtask.
[0060] In certain embodiments, the subtask file may be a file generated for each computing subtask obtained by splitting the computing task in advance, and the subtask file is saved to the execution processor of the corresponding computing subtask.
[0061] In certain embodiments, the information of each computing subtask executed by a processor constitutes a task execution file. In the task execution file, the information of each computing subtask is separated by outputting a task completion signal and waiting for receiving a task start signal.
[0062] In certain embodiments, the processor executes the corresponding computing subtask according to the information to execute the computing subtask in the task execution file, and outputs a task completion signal when completing the computing subtask. The processor pauses. When receiving the task start signal, it executes the computing subtask according to the information to execute the computing subtask subsequently.
[0063] FIG. 3 is a schematic diagram of a task execution file provided in certain embodiments of the present disclosure, including relevant information of two computing subtasks, a function statement for outputting a task completion signal, a function statement for waiting for receiving a task start signal, or the like. In this schematic diagram, the execution processor of the task execution file is an NPU, and the corresponding information for executing the computing subtask adopts the sbugraph_npu_elf. bin file. In this schematic diagram, the relevant information of the two computing subtasks adopts sbugraph0_npu_elf. bin and sbugraph1_npu_elf. bin respectively, where an output task completion signal (output stop signal) is set after the relevant information of each computing subtask and a wait for receiving a task start signal (wait input start) is set before the relevant information of the next computing subtask.
[0064] FIG. 4 is a partial schematic diagram of a SOC composition structure of a heterogeneous computing processing method provided in certain embodiments of the present disclosure, where the SOC includes four processors 401-404 and a scheduling device 405. In FIG. 4, the processors include an NPU, a GPU, a DSP, and a CPU, or the like. There are transmission paths for task completion signals and task start signals between each processor and the scheduling device. In the diagram, the transmission path for task completion signals is marked with STOP, and the transmission path for task start signals is marked with START.
[0065] In certain embodiments, the scheduling device 405 executes the heterogeneous computing processing method provided in certain embodiments of the present disclosure, which is a control for each processor to perform heterogeneous computing. Taking NPU as an example, after the NPU completes its computing subtask, it sends a task completion signal to the scheduling device through the transmission path of the task completion signal, and the NPU pauses and waits, and does not execute subsequent computing subtasks. After receiving the task completion signal, the scheduling device obtains a scheduling code based on the task completion signal. The scheduling code is characterized by the execution processor of the next computing subtask being a GPU, and then sends a task start signal to the GPU through the transmission path of the task start signal between the GPU. Based on the received task start signal, the GPU triggers the start of the next computing subtask. After the GPU completes its computing subtask, it sends a task completion signal to the scheduling device through the transmission path of the task completion signal, and the GPU pauses and waits, and does not execute subsequent computing subtasks. The process continues until all scheduling codes in the scheduling device are used and the computing task is completed.
[0066] In certain embodiments, the computing subtask may be split into multiple computing subtasks in advance, and a corresponding subtask file and scheduling code are generated for each computing subtask. The process of forming the scheduling code and subtask file is described in detail in the subsequent FIG. 7.
[0067] In certain embodiments, a task completion signal sent by a first processor is received, and the task completion signal indicates that the first processor completes a first computing subtask; a target scheduling code is obtained based on the task completion signal; a task start signal is generated based on the task completion signal and the target scheduling code; and a second processor is triggered to execute a second computing subtask according to a subtask file based on the task start signal. The second computing subtask and the first computing subtask belong to the same computing task. The computing task is first split into individual computing subtasks, and a scheduling code is set for each computing subtask. The target scheduling code is obtained by generating a task completion signal when the first processor completes a preceding computing subtask. A task start signal is generated based on the target scheduling code and the task completion signal. The second processor executes a subsequent second computing subtask according to the subtask file. A scheduling device is set to execute the scheduling of computing subtasks between the processors without occupying the CPU, thereby reducing the software complexity of the CPU. After reducing the participation of the CPU, the overall power consumption of the SOC is reduced. Moreover, by implementing the inter-core synchronization logic of each processor through encoding, the parallel capability of each processor may be improved, and the computing efficiency of the SOC in executing computing tasks may be improved.
[0068] FIG. 5 is a flow chart of generating a task start signal based on the task completion signal and the target scheduling code provided in certain embodiments of the present disclosure, which may include steps 501 to 504, and these steps are described in detail below.
[0069] 501. Parse the target scheduling code to obtain the first part code and the second part code of the target scheduling code;
[0070] In certain embodiments, the scheduling code includes two parts: the first part code and the second part code.
[0071] In certain embodiments, the first part code represents the preceding processor of the computing subtask, and the second part code represents the execution processor of the computing subtask.
[0072] In certain embodiments, in the first part code and the second part code of the scheduling code, each processor is encoded in the set order in the code.
[0073] In certain embodiments, different numerical values may be used in the code to indicate whether a processor is used or not.
[0074] In certain embodiments, the code 1 represents the use of the processor, and the code 0 represents the non-use of the processor.
[0075] In certain embodiments, the SOC includes four processors, NPU, GPU, DSP and CPU. Accordingly, the two parts in the scheduling code correspond to four code positions, such as xxxxyyyy, where xxxx is the first part of the code, yyyy is the second part of the code, the xxxx represents the preceding processor of the computing subtask, and yyyy represents the execution processor of the computing subtask. The four code positions of the xxxx correspond to the NPU, GPU, DSP and CPU from left to right, and the four code positions of yyyy correspond to the NPU, GPU, DSP and CPU from left to right. For example, when the preceding processor (or first processor) of the computing subtask is NPU and the execution processor (or second processor or subsequent processor) is GPU, the first part of the code xxxx is 1000, the second part of the code yyyy is 0100, and the scheduling code of the computing subtask is 10000100.
[0076] In certain embodiments, the code 11 represents the use of the processor, and the codes 10, 01, and 00 may all represent the non-use of the processor.
[0077] In certain embodiments, the SOC includes three processors, NPU, GPU and CPU. Correspondingly, the two parts in the scheduling code correspond to six code positions, such as aaaaaabbbbbb. Among them, aaaaaa is the first part of the code, bbbbbb is the second part of the code, the aaaaaa represents the preceding processor of the computing subtask, and bbbbbb represents the execution processor of the computing subtask. The six code positions of the aaaaaa correspond to the NPU, GPU and CPU in groups of two from left to right, and the six code positions of the bbbbbb correspond to the NPU, GPU and CPU in groups of two from left to right. For example, when the preceding processor of the computing subtask is the NPU and the execution processor is the CPU, the first part of the code aaaaaa is 110110, the second part of the code bbbbbb is 001011, and the scheduling code of the computing subtask is 110110001011.
[0078] In certain embodiments, when a computing task may be split to obtain multiple computing subtasks, a scheduling code for the computing subtask is generated for the preceding processor and execution processor of each computing subtask. The process of generating the scheduling code is described in detail in the subsequent FIG. 16.
[0079] 502. According to the first part code and the task completion signal, determine that each preceding processor completes the corresponding first computing subtasks, the preceding processor is a processor for executing the first computing subtask, the first computing subtask is the preceding subtask of the second computing subtask, and the preceding processor of the second computing subtask includes at least one first processor;
[0080] In certain embodiment, in the present disclosure, there may be multiple first computing subtasks before the second subtask, each first computing subtask is executed by a different processor, and the first computing subtask is the preceding subtask of the second computing subtask, and the second computing subtask is executed according to the computing results of each first computing subtask.
[0081] In certain embodiments, when each preceding processor completes its corresponding first computing subtask, it generates a corresponding task completion signal, and the scheduling device receives the task completion signal through the signal transmission path between each processor, and the scheduling device may determine that each preceding processor completes the corresponding first computing subtask according to the target scheduling code and the task completion signal transmitted by each processor.
[0082] In certain embodiments, the first part of the scheduling code of the computing subtask is 1100, and the order of the four processors corresponding to the SOC is NPU, GPU, DSP and CPU. Only when the task completion signals transmitted by the NPU and GPU are received, it is determined that all the preceding subtasks are completed, triggering step 503, otherwise, waiting.
[0083] 503. Determine the execution processor of the second computing subtask according to the second part of the code;
[0084] In certain embodiments, based on the first part of the target scheduling code, it is determined that all the preceding processors have completed their corresponding first computing subtasks, and the execution processor of the second computing subtask is determined according to the second part of the target scheduling code.
[0085] In certain embodiments, in the second part of the code, for each processor, the execution processor corresponding to a designated value is determined in the set order.
[0086] In certain embodiments, the designated value of the execution processor may be 1, and the value of the execution processor in the remaining code is 0.
[0087] In certain embodiments, the SOC includes 4 processors NPU, GPU, DSP and CPU, the scheduling code of the computing subtask is 11000010, and the NPU and GPU are received as the preceding processors. After receiving the task completion signal transmitted by the NPU and GPU, it is determined that the preceding subtasks of the computing subtask are all completed, and the DSP of the execution processor of the computing subtask is determined.
[0088] In certain embodiments, the SOC includes 4 processors NPU, GPU, DSP and CPU, the scheduling code of the computing subtask is 00010110, and the CPU is used as the preceding processor. After receiving the task completion signal transmitted by the CPU, it is determined that the preceding subtasks of the computing subtask are all completed, and the GPU and DSP of the execution processor of the computing subtask are determined.
[0089] 504. Generate a task start signal according to the execution processor corresponding to the second part of the code, and the task start signal is used to trigger the execution processor to execute the second computing subtask.
[0090] In certain embodiments, determine the execution processor of the second computing subtask, generate a task start signal, and send the task start signal to the execution processor through the signal transmission path between the execution processors to trigger the execution processor to execute its second computing subtask.
[0091] In certain embodiments, the output logic of the task start signal requires that all preceding subtasks be completed, and the task completion signals sent by the first processors corresponding to all preceding subtasks are received to determine that all preceding subtasks are completed; the corresponding execution processor is determined based on the second part of the target scheduling code, and the task start signal is output to the execution processor, thereby realizing synchronous judgment and triggering the execution processor.
[0092] FIG. 6 is a partial schematic diagram of another SOC composition structure of the heterogeneous computing processing method provided in certain embodiments of the present disclosure. The SOC includes a scheduling device 601 and four processors 602-605. In FIG. 6, the processors include NPU, GPU, DSP and CPU. There are transmission paths for task completion signals and transmission paths for task start signals between each processor and the scheduling device. In the schematic diagram, the transmission path of the task completion signal is marked with STOP, and the transmission path of the task start signal is marked with START. The direction of the arrow in the figure indicates the direction of signal transmission.
[0093] In certain embodiments, the scheduling device 601 is provided with scheduling codes corresponding to each computing subtask, and the scheduling device includes a logic unit 6011 and a coding unit 6012, and the logic unit includes a coding logic circuit 60111 and an output logic circuit 60112.
[0094] The coding unit stores the scheduling codes of each computing subtask. The coding logic circuit is connected to each processor to form a transmission path for the task completion signal. After receiving the task completion signal, the coding logic circuit 60111 generates a POP signal corresponding to the processor executing the task, and the POP signal indicates the processor corresponding to the task completion signal in a specific signal encoding method. The coding unit 6012 outputs the scheduling code to the output logic circuit 60112 based on the POP signal. After receiving the scheduling code, the output logic circuit 60112 generates a task start signal to the corresponding execution processor based on the scheduling code.
[0095] The coding unit 6012 may be DDR / SRAM, a small block of storage configured separately for the scheduling device, or other storage resources of the soc chip may be reused, which is not limited in the present disclosure.
[0096] In certain embodiments, the target scheduling code is parsed to obtain the first part code and the second part code of the target scheduling code; based on the first part code and the task completion signal, it is determined that each preceding processor completes the corresponding first computing subtasks, and the preceding processor is a processor for executing the first computing subtask, the first computing subtask is a preceding subtask of the second computing subtask, and the preceding processor of the second computing subtask includes at least one first processor; based on the second part code, the execution processor of the second computing subtask is determined; based on the execution processor corresponding to the second part code, a task start signal is generated, and the task start signal is used to trigger the execution processor to execute the second computing subtask. In the scheduling code, a preceding processor code for executing the preceding first computing subtask and an execution processor code for executing the second computing subtask are respectively set. Accordingly, based on the preceding processor code and the received task completion signal, it is determined that each preceding processor completes the corresponding first computing task, which may trigger the execution processor of the second computing subtask, and then a task start signal corresponding to each execution processor is generated to trigger and start each execution processor to execute the second computing task. In this process, based on the task completion signal of the first processor of the preceding subtask, it is determined whether all the first part of the code in the target scheduling code is satisfied, and the corresponding execution processor is determined based on the second part of the code in the target scheduling code, and the task start signal is output to the execution processor, thereby realizing organized judgment and triggering of the execution processor.
[0097] In a heterogeneous computing processing method provided in certain embodiments of the present disclosure, the computing result of the first computing subtask is stored so that the second processor may perform the second computing subtask based on the computing result of the first computing subtask.
[0098] In certain embodiments, after step 104, the method includes:
[0099] Controlling the second processor to obtain the execution result of the first computing subtask based on the storage address corresponding to the subtask file in the preset storage area, so as to execute the second computing subtask based on the execution result of the first computing subtask, and the preset storage area is pre-allocated with a storage address for each computing subtask.
[0100] In certain embodiments, when the computing task is split into multiple computing subtasks, the storage location of the execution result of each computing subtask is allocated.
[0101] In certain embodiments, the storage address of the preceding subtask and the storage address of the current computing subtask are set in the subtask file corresponding to each computing subtask.
[0102] In certain embodiments, the preset storage area may be a storage device such as SRAM (Static Random Access Memory) / DDRSRAM (Double Data Rate SRAM) , and the storage address of the computing result of each computing subtask is pre-set in the preset storage area.
[0103] In certain embodiments, the first processor executes the first computing subtask to obtain the execution result, and stores the execution result in the storage address allocated to the first computing subtask in the preset storage area; when the second processor subsequently executes the second computing subtask, based on the storage address recorded in the subtask file, the execution result of the first computing subtask is obtained from the corresponding storage address in the preset storage area, and the second processor executes the second computing subtask based on the execution result of the first computing subtask, and stores the execution result in the storage address allocated to the second computing subtask in the preset storage area.
[0104] In certain embodiments, a storage address is pre-allocated to each computing subtask in the preset storage area. When the second processor is triggered to start executing the second computing subtask, the second processor is controlled to obtain the execution result of the first computing subtask based on the corresponding storage address of the subtask file in the preset storage area. The second processor executes the second computing subtask based on the execution result of the first computing subtask, thereby realizing the implementation of the execution result of the preceding subtask to the computing subtask.
[0105] In certain embodiments, obtaining a target scheduling code based on a task completion signal includes: determining that the first computing subtask corresponding to the second computing subtask is completed based on the task completion signal, and obtaining a target scheduling code in a local preset scheduling code queue in response to the task completion signal.
[0106] Correspondingly, generating a task start signal based on the task completion signal and the target scheduling code includes:
[0107] In response to the task completion signal, determining the completion status of each first computing subtask;
[0108] In response to determining that each first computing subtask is completed, generating a task start signal based on the target scheduling code.
[0109] In certain embodiments, after receiving a task completion signal of a processor executing a completed computing subtask, each computing subtask corresponding to the preceding scheduling code has been completed, and the task completion signal is the completion of the first computing subtask as a preceding subtask of the second computing subtask, and the first computing subtask corresponding to the task completion signal is the first completed preceding subtask of the second computing subtask.
[0110] In certain embodiments, each time a task completion signal is received, the target scheduling code may be obtained in the scheduling code queue according to the task completion signal, until all the preceding processors in the target scheduling code complete their computing subtasks.
[0111] However, in the above process, the process of obtaining the target scheduling code is to be repeated, and the burden of the scheduling device may be heavy.
[0112] In certain embodiments, after receiving a task completion signal, the process of obtaining the scheduling code may be triggered once, and then when a task completion signal is received, when the task completion signal is generated by the preceding processor in the scheduling code, the process of obtaining the scheduling code is not triggered again, until all the preceding processors in the scheduling code complete the subtasks, and a task start signal is generated according to the execution processor recorded in the target scheduling code, so as to start the execution processor to execute the second computing subtask.
[0113] In certain embodiments, the scheduling code queue is pre-set locally in the scheduling device, and the scheduling code of each computing subtask is placed in the scheduling code queue according to the order in the computing task.
[0114] In certain embodiments, the logic unit in the scheduling device may determine that the first computing subtasks of each preceding order are all completed based on the task completion signal, and control to pop a scheduling code from the scheduling code queue, and the scheduling code is the target scheduling code.
[0115] Among them, the scheduling code queue may be generated when splitting the computing subtasks, and the scheduling code of each computing subtask is pushed into the scheduling code queue according to the order of each computing subtask in the computing task.
[0116] In certain embodiments, the scheduling code queue may adopt a FIFO (First Input First Output) queue.
[0117] In certain embodiments, the scheduling codes in the scheduling code queue are stored according to the execution order of each computing subtask, for example, in a first-in-first-out order, the computing subtasks with the preceding execution order are first pushed into the scheduling code queue, and the computing tasks with the later execution order are pushed into the scheduling code queue later.
[0118] In certain embodiments, the SOC includes four processors, NPU, GPU, DSP and CPU, among which three computing subtasks are to be executed sequentially. The execution processor of computing subtask 1 is NPU, the execution processor of computing subtask 2 is DSP and CPU, and the execution processor of computing subtask 1 is GPU. Accordingly, since computing subtask 1 has no preceding subtask, the scheduling code of computing subtask 1 is 00001000, the scheduling code of computing subtask 2 is 10000011, and the scheduling code of computing subtask 3 is 00110100. The scheduling codes 00001000, 10000011 and 00110100 are pushed into the scheduling code queue in sequence. Accordingly, when the scheduling codes in the scheduling code queue are popped out, they are also popped out in the order of 00001000, 10000011 and 00110100.
[0119] When the depth of the scheduling code queue is not less than the number of scheduling codes of the computing subtasks in the computing task, all scheduling codes may be stacked into the scheduling code queue without temporarily storing the scheduling codes from the external storage structure.
[0120] When the depth of the scheduling code queue is less than the number of scheduling codes of the computing subtasks in the computing task, the scheduling codes exceeding the scheduling code queue depth may be first stored in the external preset memory, and in the process of executing each computing subtask, the scheduling codes are read from the preset memory according to the predetermined rules.
[0121] The predetermined rule may include popping a scheduling code from the scheduling code queue, obtaining a scheduling code from the external preset memory and stacking it into the scheduling code queue.
[0122] The preset memory may be a storage structure such as DDR.
[0123] The location address of the scheduling code stored in the external storage structure is predefined, and accordingly, the address location of the scheduling code in the external storage structure and the number of obtained information are preconfigured, so that in the process of executing each computing subtask, a particular number of scheduling codes may be obtained from the corresponding address location in the external storage structure.
[0124] In certain embodiments, the external storage structure may adopt a storage structure such as SRAM or DDR, such as the memory of a SOC chip.
[0125] Referring to the SOC schematic diagram of the heterogeneous computing processing method in view of FIG. 6, the coding unit 6012 in the scheduling device may be in the form of a queue to store the scheduling codes of each computing subtask. After a scheduling code in the coding unit is popped, the logic unit in the scheduling device receives a task completion signal, which is sent by the processor of the first computing subtask, triggering the next scheduling code in the coding unit to be popped, and obtaining the target scheduling code. The logic unit subsequently continues to receive the task completion signal sent by each processor, and compares the processor from which each task completion signal is derived with the first part of the target scheduling code. After receiving the task completion signal of all processors corresponding to the first part of the scheduling code, a task start signal is generated and sent to the processor in the second part of the scheduling code, so as to trigger the execution of the next computing subtask.
[0126] In certain embodiments, in the heterogeneous computing processing method, after the scheduling code is popped from the scheduling code queue, the following steps may be performed:
[0127] Based on the idle state in the scheduling code queue, at least one scheduling code is read from the scheduling codes stored in the preset memory and put into the scheduling code queue, and the computing subtasks corresponding to the scheduling codes stored in the preset memory constitute a computing task.
[0128] In certain embodiments, the number of the scheduling codes is the same as the number of computing subtasks, and the number of the computing subtasks may be determined based on the number of computing subtasks actually obtained by splitting the computing task. The number of computing subtasks is not limited.
[0129] The preset memory may adopt a storage structure such as DDR.
[0130] In certain embodiments, when the depth of the scheduling code queue is less than the total number of scheduling codes of computing subtasks in the computing task, some of the scheduling codes sorted later are stored in the preset memory in advance. During the execution of the computing task, when the scheduling code in the scheduling code queue is popped out, the scheduling code queue becomes idle, and the scheduling code is read from the scheduling code stored in the preset memory. The scheduling code read from the preset memory is sorted after the last scheduling code in the scheduling code queue.
[0131] Moreover, the read scheduling code is pushed into the scheduling code queue to implement the stacking and popping of the FIFO queue.
[0132] In certain embodiments, when the depth of the scheduling code queue is not less than the total number of scheduling codes of the computing subtasks in the computing task, during the execution of the computing task, when the scheduling code in the scheduling code queue is popped, even if the scheduling code queue is idle, there is no need to add scheduling codes to the scheduling code queue.
[0133] In certain embodiments, a scheduling code queue is preset locally in the scheduling device, and when the completion of the first computing subtask is determined based on the task completion signal, in response to the first computing subtask, and when all the first computing subtasks are completed, a task start signal is generated according to the target scheduling code to trigger the execution of the second computing subtask, and also based on the idle state in the scheduling code queue, one or more scheduling codes are read from the preset number of scheduling codes stored in the preset memory and put into the scheduling code queue, and the computing subtasks corresponding to the preset number of scheduling codes stored in the preset storage constitute a computing task, and when the computing task is split into multiple computing subtasks, the generated scheduling code is pre-stored in the preset memory, and as the computing subtask is executed, the scheduling code is moved from the preset memory to the preset scheduling code queue according to the idle state of the scheduling code queue, thereby ensuring that even when the depth of the scheduling code queue is small, all scheduling codes corresponding to the computing task may be put into the scheduling code queue.
[0134] In certain embodiments, obtaining a target scheduling code based on a task completion signal includes: determining that the first computing subtask is completed based on the task completion signal, and determining the target scheduling code corresponding to the second computing subtask that is subsequent to the first computing subtask according to a preset linked list sequence;
[0135] Correspondingly, generating a task start signal based on the task completion signal and the target scheduling code includes:
[0136] In response to the task completion signal, determining the completion status of each first computing subtask;
[0137] Based on determining that each first computing subtask is completed, generating a task start signal based on the target scheduling code.
[0138] In the scheduling device, the scheduling code is stored in a linked list structure, and the preset linked list is used to record the storage location of the scheduling code corresponding to each computing subtask.
[0139] The linked list is a common data structure, which includes or consists of a series of nodes, each node contains two parts: a data part and a pointer to the next node. Correspondingly, the data part in the node is a scheduling code.
[0140] The preset linked list may be generated when splitting the computing subtasks, and the scheduling codes of each computing subtask are stored in a linked list, and the linked list is recorded in the logic unit of the scheduling device.
[0141] The scheduling device may set a storage area, and the set storage area stores each node of the linked list, the data field in the node is used to store the scheduling code of the preceding computing subtask, and the pointer field in the node is used to store the node address of the subsequent computing subtask.
[0142] In certain embodiments, after receiving a task completion signal that a processor has completed the computing subtask, each computing subtask corresponding to the preceding scheduling code has been completed, and the task completion signal is the completion of the first computing subtask as the preceding subtask of the second computing subtask, and the first computing subtask corresponding to the task completion signal is the first completed preceding subtask of the second computing subtask.
[0143] In certain embodiments, each time a task completion signal is received, the target scheduling code may be obtained according to the pointer of the preset list according to the task completion signal, until all the preceding processors in the target scheduling code complete their computing subtasks.
[0144] However, the process of obtaining the target scheduling code may need to be repeated, and the burden of the scheduling device is heavy.
[0145] In certain embodiments, after receiving a task completion signal, the process of obtaining the scheduling code may be triggered once, and subsequently when a task completion signal is received, when the task completion signal is generated by the preceding processor in the scheduling code, the process of obtaining the scheduling code is not triggered again, until all the preceding processors in the scheduling code complete the subtask, and a task start signal is generated and sent to the processor in the second part of the scheduling code, so as to start the execution processor to execute the second computing subtask.
[0146] Referring to the SOC schematic diagram of the heterogeneous computing processing method shown in FIG. 6, the coding unit in the scheduling device may use a linked list to store the scheduling codes of each computing subtask. The logic unit in the scheduling device obtains a scheduling code in the coding unit. After receiving the task completion signal, the task completion signal is sent by the first preceding processor corresponding to the first computing subtask, and the pointer of the node where the scheduling code of the current first computing subtask is located is obtained to determine the node address of the subsequent computing subtask. The target scheduling code is obtained from the data part corresponding to the node address. The processors corresponding to each subsequent task completion signal received are compared according to the first part of the target scheduling code. After receiving the task completion signals of all processors corresponding to the first part of the target scheduling code, a task start signal is generated and sent to the execution processor in the second part of the target scheduling code to trigger the execution of the subsequent computing subtask.
[0147] In certain embodiments, a linked list is preset in the scheduling device, and the linked list records the scheduling code of the preceding computing subtask and the node address of the succeeding computing subtask. Accordingly, based on the task completion signal, it is determined that each first computing subtask is completed, and the target scheduling code corresponding to the second computing subtask that is succeeding the first computing subtask is determined according to the preset linked list. Based on the preset linked list, the sequential execution of each computing subtask in the computing task is realized.
[0148] FIG. 7 is a flow chart of forming a scheduling code and a subtask file provided in certain embodiments of the present disclosure, which may include steps 701 to 704, and these steps are described in detail below.
[0149] 701. Obtain a computing task;
[0150] In certain embodiments, the computing task is a computing task for subsequent splitting, and the computing task includes multiple computing steps, and the computing power required for each computing step may be different, and the data format of different computing steps may also be different.
[0151] When the computing task may be a built-in function in the SOC, the computing task may be split in advance, and the scheduling code and subtask file may be obtained, and the obtained scheduling code and subtask file may be placed in the SOC.
[0152] When the computing task is in a third-party APP (application) , the computing task therein may be encoded locally in the SOC when the application is loaded for the first time.
[0153] In certain embodiments, the scheduling device may split the computing task in an offline state after obtaining the computing task. For example, after the scheduling device loads a third-party APP online, the computing task in the APP is split offline.
[0154] In certain embodiments, the scheduling device may split the computing task in an online runtime state after obtaining the computing task. For example, when the scheduling device loads a third-party APP online, the computing task in the APP is directly split.
[0155] As an example, the computing subtask may be various types of computing tasks, such as computing tasks of AI (Artificial Intelligence) models, graphics processing tasks, image rendering tasks, etc.
[0156] 702. Split the computing task to obtain at least two computing subtasks and a preceding processor and an execution processor corresponding to each computing subtask; the execution processor triggers the execution of the computing subtask based on the completion of the processing of the computing subtask by the corresponding preceding processor, and the preceding processor corresponding to each computing subtask is the execution processor corresponding to the preceding computing subtask;
[0157] The computing task may be split into multiple computing subtasks, and the number of the computing subtasks may be the number of computing subtasks split according to the splitting rules. The present disclosure does not limit the number of computing subtasks.
[0158] One computing subtask corresponds to a preceding processor and an execution processor, and the preceding processor is used to execute the preceding subtask of the computing subtask, and the execution result of the preceding processor is used as the input of the execution processor.
[0159] The computing task is split to obtain multiple computing subtasks, and the execution processor of each computing subtask is obtained, and the preceding processor of each computing subtask may be determined according to the order of splitting.
[0160] In certain embodiments, the rule for splitting the computing task may be to split the computing task based on the computing parameters of each processor to obtain multiple computing sub-tasks; it may be to split the computing task based on the execution order of each step in the computing task to obtain multiple computing sub-tasks; it may be to split the computing task based on the computing parameters of the processor and the execution order of each step in the computing task to obtain multiple computing sub-tasks. The subsequent FIG. 9 provides a detailed description of the process of splitting the computing task based on the computing parameters of the processor, and the subsequent FIG. 13 provides a detailed description of the process of splitting the computing task based on the execution order of each step in the computing task.
[0161] 703. Generate a corresponding subtask file for each computing subtask, and the preceding processor and the execution processor respectively execute the corresponding computing subtask according to the corresponding subtask file;
[0162] For each computing subtask obtained by splitting, a corresponding subtask file is generated, and the subtask file may include the input data address, result output address and function (algorithm) of the execution processor.
[0163] The data input address and result output address in each computing subtask may be a storage area preset in the SOC, and the storage area stores the execution result of each computing subtask, and the storage area needs to be resident in the SOC.
[0164] In certain embodiments, by specifying the entry for interaction of the storage area, the storage area may adopt an internal address encryption method, such as PA / VA (Physical Address &Virtual Address) , and the input data address and result output address recorded in the subtask file are physical addresses. The execution processor requests the execution result of the preceding subtask from the storage area according to the physical address in the subtask file, and the storage area obtains the execution result of the preceding subtask according to the internal virtual address and returns it.
[0165] In certain embodiments, each processor executes its computing subtask according to the subtask file corresponding to the processor.
[0166] In certain embodiments, the preceding processor executes its corresponding first computing subtask according to its corresponding subtask file, and the execution processor executes its corresponding second computing subtask according to the subtask file corresponding to the processor. The execution result of the first computing subtask is used as the input of the second computing subtask. After the first computing subtask is executed, the execution result is stored in the assigned result output address. The result output address of the first computing subtask is the input data address of the second computing subtask. Correspondingly, the execution processor obtains the execution result of the first computing subtask according to the input data address of the second computing subtask, and executes the second computing subtask according to the execution result of the first computing subtask.
[0167] In certain embodiments, the computing task is the computing of the neural network model. Accordingly, the neural network compiler TVM may be used to process the split computing subtasks to generate corresponding subtask files.
[0168] In certain embodiments, when the executors of several computing subtasks are the same processor, the subtask files of several computing subtasks whose executors are the same processor may be used to generate the task execution file ELF of the processor. In the task execution file, the relevant information of each computing subtask is separated by particular statements.
[0169] In certain embodiments, the particular or designated statement in the task execution file is used to output a task completion signal to pause when a computing subtask is executed, and to start the execution of the next computing subtask after receiving a task start signal.
[0170] In certain embodiments, the particular statement is output stop signal &wait input start. Among them, stop signal is a task completion signal, output stop signal means outputting a task completion signal after completing the computing subtask; among them, start is a task start signal, and wait input start means waiting for the task start signal to execute subsequent steps.
[0171] FIG. 8 is a schematic diagram of a split computing task to obtain a task execution code provided in certain embodiments of the present disclosure. In this schematic diagram, the computing task is split into 4 computing subtasks 801-804, and the relevant information of each computing subtask is compiled by the neural network compiler TVM to obtain a corresponding subgraph. Among them, computing subtask 801 corresponds to sbugraph0, and the execution processor is NPU; computing subtask 802 corresponds to subgraph1, and the execution processor is GPU; computing subtask 803 corresponds to sbugraph2, and the execution processor is NPU; computing subtask 804 corresponds to subgraph3, and the execution processor is GPU. Correspondingly, the subtask file corresponding to computing subtask 801 is sbugraph0_npu_elf. bin, the subtask file corresponding to computing subtask 802 is sbugraph1_gpu_elf. bin, the subtask file corresponding to computing subtask 803 is sbugraph2_npu_elf. bin, and the subtask file corresponding to computing subtask 804 is sbugraph3_gpu_elf. bin. The computing subtasks of the same processor are merged to obtain the ELF file of the processor. The ELF file 805 in FIG. 8 is a task execution file of the NPU, wherein an output stop signal &wait input start is added between sbugraph0_npu_elf. bin and sbugraph2_npu_elf. bin, and the NPU pauses and waits for receiving a task start signal after completing the computing subtask 801, and then executes the computing subtask 803; similarly, the ELF file 806 in FIG. 8 is a task execution file of the GPU, wherein an output stop signal &wait input start is added between sbugraph1_gpu_elf. bin and sbugraph3_gpu_elf. bin, and the GPU pauses and waits for receiving a task start signal after completing the computing subtask 802, and then executes the computing subtask 804. Among them, after the NPU completes the computing subtask 801 according to sbugraph0_npu_elf. bin, it generates a task completion signal and pauses; the scheduling device triggers the generation of a task start signal to the GPU according to the task completion signal, and the GPU receives the task start signal and completes the computing subtask 802 according to sbugraph1_gpu_elf. bin, generates a task completion signal, and pauses; the scheduling device triggers the generation of a task start signal to the NPU according to the task completion signal, and the NPU receives the task start signal and starts to execute the subsequent computing subtask 803 according to sbugraph0_npu_elf. bin, and so on, until each computing subtask in the computing task is executed and the execution result of the computing task is obtained.
[0172] 704. Generate corresponding scheduling codes according to the preceding processor and execution processor of each computing subtask to obtain scheduling codes corresponding to each computing subtask.
[0173] After determining the preceding processor and execution processor of each computing subtask, generate corresponding scheduling codes according to the preceding processor and execution processor to obtain scheduling codes corresponding to the computing subtasks one by one.
[0174] In certain embodiments, the process of splitting computing tasks, generating subtask files and compiling scheduling codes may be performed when the SOC is offline to reduce the processing burden of the SOC.
[0175] The scheduling code includes a first part of the code and a second part of the code, the first part of the code is used to characterize the preceding processor, and the second part of the code is used to characterize the execution processor.
[0176] When there are multiple preceding processors for a computing subtask, each preceding processor in the first part of the code is represented by a numerical value.
[0177] In certain embodiments, 1 in the code represents the use of the processor, and 0 in the code represents the non-use of the processor.
[0178] As an example, the SOC includes 4 processors NPU, GPU, DSP and CPU, and accordingly, the two parts in the scheduling code correspond to 4 code positions respectively. When the preceding processor of the computing subtask is NPU and the execution processor is CPU, the corresponding scheduling code is 10000001; when the preceding processor of the computing subtask is NPU and GPU, and the execution processor is CPU, the corresponding scheduling code is 11000001.
[0179] In certain embodiments, the numerical value of the code position corresponding to the preceding processor in the first part of the coding is set for the preceding processor, and the numerical value of the code position corresponding to the execution processor in the second part of the coding is set for the execution processor. The subsequent FIG. 15 describes in detail the process of generating corresponding scheduling codes according to the preceding processor and the execution processor of each computing subtask.
[0180] In certain embodiments, the computing task is split to obtain multiple computing subtasks and the preceding processor and the execution processor corresponding to each computing subtask. The preceding processor corresponding to each computing subtask is used as the execution processor corresponding to the preceding computing task. For each computing subtask, a corresponding subtask file is generated. Each computing subtask executes the corresponding computing subtask according to the corresponding subtask file. In addition, the corresponding scheduling code is generated according to the preceding processor and the execution processor of each computing subtask, and the scheduling codes corresponding to each computing subtask are obtained, which realizes the splitting of computing tasks, forms scheduling codes and subtask files, and provides a basis for the scheduling device to perform heterogeneous computing processing methods.
[0181] FIG. 9 is a flowchart of splitting the computing task provided in certain embodiments of the present disclosure to obtain a preset number of computing subtasks and a preceding processor and an execution processor corresponding to each computing subtask, which may include steps 901 to 904, and these steps are described in detail below.
[0182] 901. Obtain the computing parameters of each processor in at least two processors;
[0183] In certain embodiments, the splitting rule is to split according to the computing parameters of the processor and the computing parameters for the computing steps in the computing task.
[0184] The computing parameters may include the computing power of the processor or the data type supported for computing, or the like.
[0185] Multiple operators may be set in each processor, and the computing power of each operator may be different.
[0186] The data type supported by each processor for computing may be one or more, and the data type may be INT4, INT8, INT16 or FP32, or the like.
[0187] The computing parameters of the processor may be written into the relevant parameter record of the processor as the parameters of the processor, and the computing parameters may be directly obtained from the relevant parameter record.
[0188] In certain embodiments, the source of the computing parameters of the processor is not confined or limited. The computing parameters of each processor may be set according to particular scenarios.
[0189] 902. According to the computing parameters corresponding to each computing step in the computing task, the computing task is divided into at least two computing subtasks, and one computing subtask includes at least one computing step;
[0190] In certain embodiments, the computing task includes multiple computing steps, and the corresponding computing parameters may be determined for each computing step, and the computing parameters may be the computing power to execute the computing step or the data type of the computing step, or the like.
[0191] The computing task may be divided according to each computing step, and each computing subtask obtained contains a computing step.
[0192] When the computing power required for several consecutive computing steps is small, these computing steps may be used as a computing subtask, and the computing subtask corresponds to the computing power of an operator in a processor.
[0193] When the data types of several consecutive computing steps are the same, these computing steps may be used as a computing subtask, and the data types of these computing steps correspond to the data types executed by a processor.
[0194] In certain embodiments, the computing task may be split according to the computing power of the processor to obtain multiple computing sub-tasks; the computing task may be split according to the data type supported by the processor to obtain multiple computing sub-tasks; the computing task may be split in combination with the computing power of the processor and the supported data type to obtain multiple computing sub-tasks.
[0195] 903. The processor with corresponding computing parameters is used as the execution processor of the corresponding computing subtask;
[0196] In certain embodiments, each computing subtask obtained by splitting is assigned to the processor with corresponding computing parameters.
[0197] In certain embodiments, the computing parameters of each processor may be compared and matched with the computing parameters corresponding to each computing step, so that each step in the computing task may be assigned to the processor according to the computing parameters of the processor.
[0198] The computing steps that each processor may support may be determined by comparing the computing power of the processor with the computing power required for each computing step; the computing steps that each processor may support may be determined by comparing the data type supported by the processor with the data type of each computing step; and the computing steps that each processor may support may be determined by comparing the computing power and supported data type of the processor with the computing power and data type required for each computing step.
[0199] In certain embodiments, when splitting the computing tasks in combination with the computing power of the processor and the supported data type, the computing power of each operator in the processor may be combined with the capacity of the supported data type, and the processor that may support it may be selected as the execution processor from multiple processors; or the data type supported by the processor may be combined with the computing power of each operator therein, and then the processor that may support it may be selected as the execution processor from multiple processors; when multiple processors all support the data type and the operator supports the computing power required for the computing step, the computing tasks may be split according to the vivid information, and the corresponding processor may be determined as the execution processor.
[0200] 904. Based on the computing order of each computing subtask, determine the preceding processor of each computing subtask.
[0201] In certain embodiments, except for the first computing subtask, each computing subtask has a preceding processor.
[0202] According to the computing order of each computing subtask, the preceding processor of each computing subtask is determined in the multiple computing subtasks obtained by splitting.
[0203] There may be a situation where a computing subtask has multiple preceding subtasks, then it has multiple preceding processors, and the multiple preceding processors may compute in parallel.
[0204] FIG. 10 is a schematic diagram of the split computing task provided in certain embodiments of the present disclosure, the computing task includes multiple computing steps, and the operators required for each computing step are operator 1, operator 2, operator 1, operator 5, operator 6... in sequence. Among them, the NPU includes operator 1 and operator 2, and its performance is better than other processors including operator 1 and operator 2. The three computing steps that require operator 1, operator 2, and operator 1 to execute are divided into one computing subtask, and the computing subtask is executed by the NPU. Among them, the GPU includes operator 5 and operator 6, and its performance is better than other processors including operator 5 and operator 6. The two computing steps that need to be executed by operator 5 and operator 6 are divided into one computing subtask, and the computing subtask is executed by the GPU.
[0205] FIG. 11 is another schematic diagram of a method of splitting a computing task to obtain a task execution code provided in certain embodiments of the present disclosure. In the schematic diagram, the computing task includes multiple computing steps, each box represents a computing step, and the computing task is split into multiple computing subtasks 1101-1103 (three of which are shown in the figure) , and the dotted box represents a computing subtask. The split computing subtasks are compiled by the neural network compiler TVM to obtain a subgraph of each computing subtask. The figure takes the four compiled subgraphs (subgraph0-subgraph3) as an example for explanation. Among them, the execution processors of subgraph0 and subgraph2 are NPUs, and the execution processors of subgraph1 and subgraph3 are GPUs. Generate an ELF file 1104 for NPU, in which output stop signal &wait input start are added between sbugraph0_npu_elf. bin and sbugraph2_npu_elf. bin; Generate an ELF file 1105 for GPU, in which output stop signal &wait input start are added between sbugraph1_gpu_elf. bin and sbugraph3_gpu_elf. bin.
[0206] FIG. 12 is another schematic diagram of the split computing task provided in certain embodiments of the present disclosure, which includes multiple computing steps, where the data types of each computing step are INT8, INT4, INT8, FP16, FP32, or the like. NPU supports INT8 and INT4 data type computing, and its performance is better than other processors that support INT8 and INT4. The three computing steps using INT8 and INT4 are divided into computing subtasks, and the computing subtask is executed by NPU. Among them, the GPU supports FP16 and FP32 data type computing, and its performance is better than other processors that support FP16 and FP32. The two computing steps using FP16 and FP32 data types are divided into one computing subtask, and the computing subtask is executed by the GPU.
[0207] In certain embodiments, the computing parameters of each processor are not exactly the same. The computing task may be split into multiple computing subtasks according to the computing parameters corresponding to each computing step in the computing task. Each computing subtask includes at least one computing step. According to the computing parameters of each processor, the processor matching each computing subtask is determined, and the processor matching the computing subtask is used as the execution processor of the corresponding computing subtask. The computing order of each computing subtask is determined to determine the preceding processor of each computing subtask, thereby realizing the splitting of the computing task, determining the execution processor and preceding processor of each computing subtask, and providing a basis for the subsequent generation of scheduling code.
[0208] FIG. 13 is a flowchart of splitting the computing task provided in certain embodiments of the present disclosure to obtain a preset number of computing subtasks and the preceding processor and execution processor corresponding to each computing subtask, which may include steps 1301 to 1303, and these steps are described in detail below.
[0209] 1301. Determine the execution order of each step in the computing task;
[0210] In certain embodiments, the splitting rule is to split according to the order of each step of the computing task.
[0211] There may be parallel computing steps in the computing task. When there are parallel computing steps, the parallel computing steps may be divided into different processors for execution.
[0212] The execution order of each step in the computing task may be determined first, and the execution order includes parallel and serial.
[0213] In the parallel computing step, the computing results of two or more parallel computing steps are respectively used as inputs of subsequent adjacent computing steps; in the serial computing step, the computing result of the preceding computing step is used as input of a subsequent adjacent computing step.
[0214] When there is a parallel computing step in the computing task, execute step 1302; when there is no parallel computing step in the computing task, execute step 1303.
[0215] 1302. When there is a parallel computing step in the computing task, split the parallel computing step in the computing task into at least two parallel computing subtasks, and split the serial computing step in the computing task into at least two serial computing subtasks;
[0216] When there is a parallel computing step in the computing task, split the parallel computing part to obtain parallel computing subtasks; split the remaining serial computing tasks in the computing task into serial computing subtasks.
[0217] The preceding subtask of a computing subtask in the multiple computing subtasks may be two or more parallel computing subtasks, or may be a certain computing subtask.
[0218] FIG. 14 is a schematic diagram of computing subtasks obtained by splitting computing tasks provided in certain embodiments of the present disclosure. In FIG. 14, computing task 1401 is split into computing subtasks 1-5, where computing subtask 2 and computing subtask 3 are parallel computing subtasks, the execution result of computing subtask 1 is used as the input of computing subtask 2 and computing subtask 3, the execution results of computing subtask 2 and computing subtask 3 are used as the input of computing subtask 4, and the execution result of computing subtask 4 is used as the input of computing subtask 5. Among them, computing subtask 4 and computing subtask 5 are serial computing subtasks.
[0219] After executing step 1302 to split and obtain multiple computing subtasks, step 1304 is executed.
[0220] FIG. 15 is another schematic diagram of splitting computing tasks provided in certain embodiments of the present disclosure. The computing task includes 15 computing steps, and the operators required for each computing step are operators 1-15 in sequence. Among them, the computing steps corresponding to operators 1-3 are executed by NPU as computing subtask 1, the computing steps corresponding to operators 4-5 are executed by GPU as computing subtask 2, the computing steps corresponding to operators 6-8 are executed by DSP as computing subtask 3, the computing steps corresponding to operators 9-12 are executed by CPU as computing subtask 4, the computing steps corresponding to operator 13 are executed by GPU as computing subtask 5, and the computing steps corresponding to operators 14-15 are executed by NPU as computing subtask 6.
[0221] Among them, the computing subtask 1-3 is a parallel computing subtask, and the computing subtask 1-3 and computing subtask 5 are in a serial relationship. The computing subtasks 1-3, 5 and computing subtask 4 are parallel computing subtasks. Correspondingly, during the execution process, computing subtask 1-3 may be executed first, and computing subtask 5 may be triggered to execute based on the completion of computing subtasks 1-3. In the process of executing computing tasks 1-3 or computing subtask 5, computing subtask 4 is executed, and after computing subtasks 5 and computing subtask 4 are completed, computing subtask 6 is triggered to execute.
[0222] 1303. When there is no parallel computing step in the computing task, split the computing task into at least two serial computing subtasks;
[0223] When all the computing steps in the computing task are serial and there are no parallel computing steps, the serial steps of the computing task may be split into multiple serial computing subtasks.
[0224] In certain embodiments, the preceding computing task of each computing subtask is unique.
[0225] In certain embodiments, after executing step 1303 to split and obtain multiple computing subtasks, step 1304 is executed.
[0226] 1304. Determine the execution processor of each computing subtask;
[0227] The execution processor of each computing subtask may be determined according to one or more of the computing power, data type, or the like required by each computing subtask.
[0228] The execution processor of each computing subtask may be one or more, and the corresponding number of processors may be determined from multiple processors as the execution processors of the corresponding computing subtask according to the determination conditions.
[0229] The corresponding processor may be determined for multiple computing subtasks according to the computing power of the operator in each processor, the supported data type, or the like, as the execution processor of the computing subtask.
[0230] 1305. Determine the preceding processor of each computing subtask based on the computing subtasks that are sequentially adjacent to each computing subtask.
[0231] After determining the execution processor of each computing subtask, the preceding subtask of each computing subtask may be determined according to the order of each computing subtask, and then the preceding processor of each computing subtask may be determined.
[0232] In certain embodiments, the execution order of each step in the computing task is first determined. When there is no parallel computing step in the computing task, but only serial computing steps, the computing task is split into multiple serial computing subtasks. When there is a parallel computing step in the computing task, the parallel computing step is split into multiple parallel computing subtasks, and the serial computing step is split into serial computing subtasks. The execution processor of each computing subtask is determined in turn, and then the preceding processor of each computing subtask is determined based on the computing subtasks that are adjacent in sequence to each other. Based on this, the execution processor and preceding processor of each computing subtask are obtained, which provides a basis for the subsequent generation of scheduling code.
[0233] FIG. 16 is a flowchart of generating corresponding scheduling codes according to the preceding processor and execution processor of each computing subtask and obtaining a preset number of scheduling codes provided in certain embodiments of the present disclosure, which may include steps 1601 to 1603, and these steps are described in detail below.
[0234] 1601. Determine the code position corresponding to each processor in at least two processors;
[0235] In certain embodiments, the code position of each processor in each processor in the SOC is preset.
[0236] In certain embodiments, the order of each processor in the SOC is predetermined, and the code position is determined according to the order.
[0237] As an example, there are 3 processors in the SOC, namely GPU, CPU and NPU, in the order of GPU, CPU, NPU.
[0238] 1602. Set the first target code position in the first part of the coding in the scheduling code corresponding to each computing subtask to the first value, and set the non-first target code position in the first part of the coding to the second value, the first target code position is the code position corresponding to the preceding processor of the computing subtask;
[0239] Among them, the first part of the code in the scheduling code corresponding to the computing subtask is the part of the code corresponding to the preceding processor. According to the code position corresponding to each processor, the value of the coding position corresponding to the preceding processor of the computing subtask is set to the first value, and the values of other code positions are set to the second value.
[0240] In certain embodiments, 1 in the code represents the use of the processor, and 0 represents the non-use of the processor.
[0241] As an example, the code positions corresponding to the three processors GPU, CPU and NPU in the SOC are arranged in sequence. When the preceding processor of the computing task is GPU, the first part of the code in its scheduling code is 100; when the preceding processor of the computing subtask is GPU and NPU, the first part of the code in its scheduling code is 101.
[0242] 1603. The second target code position in the second part of the code in the scheduling code corresponding to the computing subtask is set to the first value, and the non-second target code position in the second part of the code is set to the second value. The second target code position is the code position corresponding to the execution processor of the computing subtask.
[0243] Among them, the second part of the code in the scheduling code corresponding to the computing subtask is the part of the code corresponding to the execution processor. According to the code positions corresponding to each processor, the value of the code position corresponding to the execution processor of the computing subtask is set to the first value, and the values of other code positions are set to the second value.
[0244] As an example, the code positions corresponding to the three processors GPU, CPU and NPU in the SOC are arranged in sequence. When the execution processor of the computing task is the CPU, the second part of the code in its scheduling code is 010; when the execution processor of the computing subtask is the GPU and NPU, the second part of the code in its scheduling code is 101.
[0245] Among them, the scheduling code includes or consists of the first part code and the second part code, and the first part code is before the second part code.
[0246] For example, the format of the scheduling code is xxxxyyyy, where the number of x and y is the same, the number of x and y is determined by the number of processors, xxxx is the first part code, and yyyy is the second part code.
[0247] Referring to the various computing subtasks split in FIG. 15, the generated scheduling codes are 11100100 and 01011000.
[0248] In certain embodiments, after determining the preceding processor and the execution processor of each computing subtask, the code position corresponding to each processor in the multiple processors is determined; the first target code position in the first part of the coding in the scheduling code corresponding to each computing subtask is set to a first value, and the non-first target code position in the first part of the coding is set to a second value, and the first target code position is the code position corresponding to the preceding processor of the computing subtask; the second target code position in the second part of the coding in the scheduling code corresponding to the computing subtask is set to a first value, and the non-second target code position in the second part of the coding is set to a second value, and the second target code position is the code position corresponding to the execution processor of the computing subtask, and a unified format is used to generate scheduling codes for each computing subunit, providing a basis for subsequent execution of heterogeneous computing based on each processor.
[0249] FIG. 17 is a schematic diagram of an implementation scenario of a heterogeneous computing method provided in certain embodiments of the present disclosure, and the scenario includes 4 processors and a scheduling device 1701, and the processors are NPU, GPU, DSP and CPU. Among them, the NPU execution data type is INT4 and INT8, and the NPU contains operators 1-3; the GPU execution data type is INT8, FP16 and FP32, and the NPU contains operators 4-6; the DSP execution data type is INT8 and INT16, and the NPU contains operators 7-9; the CPU execution data type is INT8, FP16 and FP32, and the CPU contains operators 10-12. The scheduling device 1701 includes a logic unit, a coding unit, a DMA (Data Memory Access, direct memory access) engine (engine) and a clock. The logic unit includes a coding logic circuit and an output logic circuit, and the coding unit stores a scheduling coding queue FIFO. There is a transmission path for task completion signals between the coding logic circuit and each processor, and there is a transmission path for task start signals between the output logic circuit and each processor. After the NPU completes the computing subtask, it transmits the task completion signal NPUstop to the encoding logic circuit; after the GPU completes the computing subtask, it transmits the task completion signal GPUstop to the coding logic circuit; after the DSP completes the computing subtask, it transmits the task completion signal DSPstop to the coding logic circuit; after the CPU completes the computing subtask, it transmits the task completion signal CPUstop to the coding logic circuit. The output logic circuit may send a task start signal NPUstart to the NPU; the output logic circuit may send a task start signal GPUstart to the GPU; the output logic circuit may send a task start signal DSPstart to the DSP; the output logic circuit may send a task start signal CPUstart to the CPU. The coding logic circuit outputs a pop signal (POP) to the coding unit based on the received task completion signal, and the coding unit outputs the scheduling code in the scheduling code queue to the output logic circuit. The output logic circuit determines the execution processor based on the second part of the scheduling code, and sends a task start signal to the execution processor. For example, the scheduling code is xxxx0100, and it is determined that the execution processor is the GPU, and a task start signal is sent to the GPU.
[0250] In certain embodiments, each processor is connected to the memory through a memory bus (memory BUS) , and the memory in FIG. 17 uses SRAM / DDR. The execution results obtained by each processor executing the computing subtask are stored in the storage address allocated to the processor in the memory.
[0251] In certain embodiments, the memory stores the scheduling codes of the computing task. When the scheduling code queue does not complete all the scheduling codes carrying the computing task, the scheduling code may be first transmitted to the DMA engine in the scheduling device through the memory bus. Based on the idle position of the scheduling code queue, the DMA engine pushes the scheduling code into the scheduling code queue. The scheduling code examples in FIG. 17 include xxxx0100, xxxx1000, xxxx0100, and xxxx1000.
[0252] In certain embodiments, the scheduling device 1701 is provided with a clock, and the clock signal is generated by driving the clock to drive the scheduling device to close or enable. When the scheduling device is enabled, the heterogeneous computing processing method in certain embodiments of the present disclosure is executed.
[0253] A heterogeneous computing processing method provided in certain embodiments of the present disclosure is introduced, and a device for executing the above heterogeneous computing processing method is introduced below.
[0254] FIG. 18 is a structural schematic diagram of a heterogeneous computing processing device provided in certain embodiments of the present disclosure. As shown in FIG. 18, the heterogeneous computing processing device 1800 includes:
[0255] Receiving module 1801, used to receive a task completion signal sent by a first processor, and the task completion signal indicates that the first processor completes the first computing subtask;
[0256] Acquisition module 1802, used to obtain a target scheduling code based on the task completion signal;
[0257] Generation module 1803, used to generate a task start signal based on the task completion signal and the target scheduling code;
[0258] Triggering module 1804, used to trigger the second processor to perform a second computing subtask based on the subtask file based on the task start signal, and the second computing subtask and the first computing subtask belong to the same computing task.
[0259] In certain embodiments, the generation module includes:
[0260] Parsing unit, used to parse the target scheduling code to obtain the first part code and the second part code of the target scheduling code;
[0261] The first determination unit is used to determine that each preceding processor completes each corresponding first computing subtask according to the first part code and the task completion signal. The preceding processor is a processor for executing the first computing subtask. The first computing subtask is the preceding subtask of the second computing subtask. The preceding processor of the second computing subtask includes at least one first processor;
[0262] The second determination unit is used to determine the execution processor of the second computing subtask according to the second part code;
[0263] The first generation unit is used to generate a task start signal according to the execution processor corresponding to the second part code, and the task start signal is used to trigger the execution processor to execute the second computing subtask.
[0264] In certain embodiments, it also includes:
[0265] The execution result acquisition module is used to control the second processor to obtain the execution result of the first computing subtask according to the storage address corresponding to the subtask file in the preset storage area after triggering the second processor to execute the second computing subtask according to the subtask file based on the task start signal, so as to execute the second computing subtask according to the execution result of the first computing subtask. The preset storage area is pre-assigned with a storage address for each computing subtask.
[0266] In certain embodiments, there are multiple first computing subtasks to be completed before the second computing subtask, and the acquisition module is used to:
[0267] Determine the completion of the first computing subtask corresponding to the second computing subtask based on the task completion signal, and obtain the target scheduling code in the local preset scheduling code queue in response to the task completion signal;
[0268] Correspondingly, the trigger module is used to:
[0269] Determine the completion status of each first computing subtask in response to the task completion signal; based on determining that each first computing subtask is completed, generate a task start signal according to the target scheduling code.
[0270] In certain embodiments, it also includes:
[0271] The reading module is used to read at least one scheduling code from the scheduling code stored in the preset memory and put it into the scheduling code queue based on the idle state in the scheduling code queue. The computing subtasks corresponding to the scheduling codes stored in the preset memory constitute a computing task.
[0272] In certain embodiments, the acquisition module is used to:
[0273] Determine the completion of the first computing subtask based on the task completion signal, and determine the target scheduling code corresponding to the second computing subtask that is subsequent to the first computing subtask according to the preset linked list sequence;
[0274] Correspondingly, the triggering module is used to:
[0275] In response to the task completion signal, determine the completion status of each first computing subtask; based on determining that each first computing subtask is completed, generate a task start signal according to the target scheduling code.
[0276] In certain embodiments, it also includes: a preprocessing module for forming a scheduling code and a subtask file;
[0277] Where the preprocessing module includes:
[0278] A computing task acquisition unit for obtaining a computing task;
[0279] A splitting unit for splitting the computing task to obtain at least two computing subtasks and a preceding processor and an execution processor corresponding to each computing subtask; the execution processor triggers the execution of the computing subtask based on the completion of the processing of the computing subtask by the corresponding preceding processor, and the preceding processor corresponding to each computing subtask is the execution processor corresponding to the preceding computing subtask;
[0280] The second generation unit is used to generate a corresponding subtask file for each computing subtask, and the preceding processor and the execution processor respectively execute the corresponding computing subtask according to the corresponding subtask file;
[0281] The third generation unit is used to generate a corresponding scheduling code according to the preceding processor and the execution processor of each computing subtask, and obtain the scheduling code corresponding to each computing subtask.
[0282] In certain embodiments, the splitting unit is used to:
[0283] obtain the computing parameters of each processor in at least two processors;
[0284] split the computing task into at least two computing subtasks according to the computing parameters corresponding to each computing step in the computing task, and one computing subtask includes at least one computing step;
[0285] use the processor matching the computing parameters as the execution processor of the corresponding computing subtask;
[0286] determine the preceding processor of each computing subtask based on the computing order of each computing subtask.
[0287] In certain embodiments, the third generation unit is used to:
[0288] determine the code position corresponding to each processor in at least two processors;
[0289] set the first target code position in the first part of the coding in the scheduling code corresponding to each computing subtask to the first value, and set the non-first target code position in the first part of the coding to the second value, the first target code position is the code position corresponding to the preceding processor of the computing subtask;
[0290] The second target code position in the second part of the scheduling code corresponding to the computing subtask is set to the first value, and the non-second target code position in the second part of the code is set to the second value. The second target code position is the code position corresponding to the execution processor of the computing subtask.
[0291] The functional explanation of each component structure in a heterogeneous computing processing device provided in certain embodiments of the present disclosure, may be found in the aforementioned method embodiments, and is not repeated here for brevity.
[0292] In certain embodiments, the computing task is first split to obtain each computing subtask, and a scheduling code is set for each computing subtask. The target scheduling code is obtained by generating a task completion signal generated by the first processor completing the preceding computing subtask. The task start signal is generated based on the target scheduling code and the task completion signal. The second processor executes the subsequent second computing subtask based on the subtask file. By setting a scheduling device, the computing subtask scheduling between each processor is executed without occupying the CPU, reducing the software complexity of the CPU. After reducing the participation of the CPU, the overall power consumption of the SOC is reduced. Moreover, by implementing the inter-core synchronization logic of each processor through coding, the parallel capability of each processor may be improved, and the computing efficiency of the SOC in executing computing tasks may be improved.
[0293] An electronic device is also provided in certain embodiments of the present disclosure. Referring to FIG. 19, a schematic diagram of the structure of the electronic device suitable for implementing certain embodiments of the present disclosure is shown. The electronic device in certain embodiments of the present disclosure may include, but is not limited to, fixed terminals such as mobile phones, laptops, PDAs (personal digital assistants) , PADs (tablet computers) , desktop computers, etc. The electronic device shown in FIG. 19 is only an example and should not impose any restrictions on the functions and scope of use of certain embodiments of the present disclosure.
[0294] As shown in FIG. 19, the electronic device may include a processing device 1901 (such as a central processing unit, a graphics processor, or the like) , which may perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1902 or a program loaded from a storage device 1908 to a random access memory (RAM) 1903. When the electronic device is powered on, various programs and data required for the operation of the electronic device are also stored in the RAM 1903. The processing device 1901, the ROM 1902, and the RAM 1903 are connected to each other via a bus 1904. The input / output (I / O) interface 1905 is connected to the bus 1904.
[0295] In certain embodiments, the following devices may be connected to the I / O interface 1905: input devices 1906 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, or the like; output devices 1907 including, for example, a liquid crystal display (LCD) , a speaker, a vibrator, or the like; storage devices 1908 including, for example, a memory card, a hard disk, or the like; and communication devices 1909. The communication device 1909 may allow the electronic device to communicate with other devices wirelessly or wired to exchange data. Although FIG. 19 shows an electronic device with various devices, not all the devices shown need to be implemented. More or fewer devices may be implemented.
[0296] In certain embodiments of the present disclosure, a computer program product is provided, including computer-readable instructions, which, when the computer-readable instructions are executed on the electronic device, enable the electronic device to implement any heterogeneous computing processing method provided in certain embodiments of the present disclosure.
[0297] In certain embodiments of the present disclosure, a computer-readable storage medium is provided, which carries one or more computer programs. When one or more computer programs are executed by an electronic device, the electronic device can implement any heterogeneous computing processing method provided in certain embodiments of the present disclosure.
[0298] The device embodiments described here are only schematic, where the unit described as a separate component may or may not be physically separated, and the component displayed as a unit may or may not be a physical unit, that is, it may be located in one place, or it may be distributed on multiple network units. Some or all of the modules may be selected according to particular scenarios. In addition, in the accompanying drawings of the device embodiment provided by the present disclosure, the connection relationship between the modules indicates that there is a communication connection between them, which may be implemented as one or more communication buses or signal lines.
[0299] Through the description of the above implementation methods, technicians in the relevant field may clearly understand that the present disclosure may be implemented by means of software plus necessary general hardware, and it may be implemented by dedicated hardware including dedicated integrated circuits, dedicated CPUs, dedicated memories, dedicated components, or the like. In general, functions performed by computer programs may be easily implemented with corresponding hardware, and the hardware structure used to implement the same function may be diverse, such as analog circuits, digital circuits or dedicated circuits. However, software program implementation may be chosen. The technical solution may be in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, USB flash drive, mobile hard disk, ROM, RAM, disk or CD, or the like, and includes several instructions for enabling a computer device (which may be a personal computer, training equipment, or network equipment, or the like. ) to execute the methods described.
[0300] In the embodiments, it may be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it may be implemented in whole or in part in the form of a computer program product.
[0301] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in certain embodiments of the present disclosure is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from one website site, computer, training equipment or data center to another website site, computer, training equipment or data center by wired (for example, coaxial cable, optical fiber, digital subscriber line (DSL) ) or wireless (for example, infrared, wireless, microwave, or the like) . The computer-readable storage medium may be any available medium that may be stored by a computer or a data storage device such as a training device, data center, etc. that includes one or more available media integrated. The available medium may be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape) , an optical medium (for example, a DVD) , or a semiconductor medium (for example, a solid state disk (SSD) ) .
Claims
1.A heterogeneous computing processing method, comprising:receiving a task completion signal sent by a first processor, wherein the task completion signal indicates that the first processor has completed a first computing subtask;obtaining a target scheduling code based on the task completion signal;generating a task start signal based on the task completion signal and the target scheduling code; andbased on the task start signal, triggering a second processor to execute a second computing subtask, wherein the second computing subtask and the first computing subtask belong to a same computing task.2.The heterogeneous computing processing method of claim 1, wherein generating the task start signal includes:parsing the target scheduling code to obtain a first part code and a second part code of the target scheduling code;determining that the first processor has completed the first computing subtask;determining the second processor according to the second part code; andgenerating the task start signal according to the second processor corresponding to the second part code.3.The heterogeneous computing processing method of claim 2, wherein after triggering the second processor to execute the second computing subtask based on the subtask file, the method further comprises:controlling the second processor to obtain the execution result of the first computing subtask based on the corresponding storage address of the subtask file in a preset storage area, thereby executing the second computing subtask based on the execution result of the first computing subtask, wherein the preset storage area has a storage address pre-allocated for each computing subtask.4.The heterogeneous computing processing method of claim 1, wherein there are multiple first computing subtasks to be completed before the second computing subtask, and obtaining the target scheduling code based on the task completion signal includes:determining, based on the task completion signal, that the first computing subtask corresponding to the second computing subtask is completed, and in response to the task completion signal, obtaining the target scheduling code from a local preset scheduling code queue; andcorrespondingly, generating a task start signal based on the task completion signal and the target scheduling code includes:determining, in response to the task completion signal, a completion status of each first computing subtask; andupon determining that each first computing subtask is completed, generating the task start signal based on the target scheduling code.5.The heterogeneous computing processing method of claim 4, further comprising:based on an idle state of the scheduling code queue, reading at least one scheduling code from scheduling codes stored in a preset memory and placing it into the scheduling code queue, wherein the computing subtasks corresponding to the scheduling codes stored in the preset memory form a computing task.6.The heterogeneous computing processing method of claim 1, wherein obtaining a target scheduling code based on the task completion signal includes:based on completion of the first computing subtask based on the task completion signal, determining the target scheduling code corresponding to a second computing subtask subsequent to the first computing subtask according to a preset linked list sequence;correspondingly, generating the task start signal based on the task completion signal and the target scheduling code includes:determining a completion status of each first computing subtask in response to the task completion signal;generating the task start signal based on the target scheduling code upon determining that each first computing subtask is completed.7.The heterogeneous computing processing method of claim 1, wherein the scheduling code and the subtask file are generated by:obtaining a computing task;splitting the computing task to obtain at least two computing subtasks and a corresponding preceding processor and execution processor for each computing subtask;the execution processor triggers execution of the computing subtask based on the completion of processing of the computing subtask by the corresponding preceding processor, wherein the preceding processor corresponding to each computing subtask is the execution processor corresponding to the previous computing subtask;generating a corresponding subtask file for each computing subtask; and the preceding processor and execution processor respectively executing the corresponding computing subtask according to the corresponding subtask file; andgenerating a corresponding scheduling code based on the preceding processor and execution processor of each computing subtask to obtain a scheduling code corresponding to each computing subtask.8.The heterogeneous computing processing method of claim 7, wherein splitting the computing task to obtain at least two computing subtasks includes:obtaining computing parameters for each of the at least two processors;splitting the computing task into at least two computing subtasks based on the computing parameters corresponding to each computing step in the computing task, each computing subtask including at least one computing step;selecting the processor with matching computing parameters as the execution processor for the corresponding computing subtask; anddetermining the preceding processor for each computing subtask based on the computation order of the computing subtasks.9.The heterogeneous computing processing method of claim 7, wherein generating a corresponding scheduling code based on the preceding processor and execution processor of each computing subtask includes:determining a code position corresponding to each processor in at least two processors;setting a first target code position in a first portion of the code in the scheduling code corresponding to each computing subtask to a first value, and setting non-first target code positions in the first portion of the code to a second value, wherein the first target code position is the code position corresponding to the preceding processor of the computing subtask; andsetting a second target code position in a second portion of the code in the scheduling code corresponding to the computing subtask to a first value, and setting non-second target code positions in the second portion of the code to a second value, wherein the second target code position is the code position corresponding to the execution processor of the computing subtask.10.The heterogeneous computing processing method of claim 1, further comprising:setting a first part code and a second part code in the target scheduling code; andcorresponding the first part code with the first processor and corresponding the second part code with the second processor.11.A heterogeneous computing device, comprising:a receiving module for receiving a task completion signal sent by a first processor, the task completion signal indicating that the first processor has completed a first computing subtask;an acquisition module for obtaining a target scheduling code based on the task completion signal;a generation module for generating a task start signal based on the task completion signal and the target scheduling code; anda triggering module for triggering a second processor to execute a second computing subtask based on a subtask file according to the task start signal, the second computing subtask and the first computing subtask belonging to a same computing task.12.An electronic device, comprising: a memory storing computer program instructions; and a processor coupled to the memory and configured to execute the computer program instructions and perform:receiving a task completion signal sent by a first processor, wherein the task completion signal indicates that the first processor has completed a first computing subtask;obtaining a target scheduling code based on the task completion signal;generating a task start signal based on the task completion signal and the target scheduling code; andaccording to the task start signal, triggering a second processor to execute a second computing subtask, wherein the second computing subtask and the first computing subtask belong to a computing task.13.The electronic device of claim 12, wherein generating of the task start signal includes:parsing the target scheduling code to obtain a first part code and a second part code of the target scheduling code;determining that the first processor has completed the first computing subtask;determining the second processor according to the second part code; andgenerating the task start signal according to the second processor corresponding to the second part code.14.The electronic device of claim 12, wherein the processor is further configured to perform:controlling the second processor to obtain an execution result of the first computing subtask, so as to execute the second computing subtask according to the execution result of the first computing subtask.15.The electronic device of claim 12, wherein there are two or more first computing subtasks to be completed before the second computing subtask, and the processor is further configured to perform:determining each of the two or more first computing subtasks has been completed prior to generating the task completion signal.16.The electronic device of claim 12, wherein the processor is further configured to perform:constructing the computing task according to an idle state in a scheduling code queue.17.The electronic device of claim 12, wherein obtaining the target scheduling code includes:determining the target scheduling code according to a preset linked list.18.The electronic device of claim 12, wherein the processor is further configured to perform:generating a first subtask file for the first computing subtask and a second subtask file for the second computing subtask; andgenerating the target scheduling code according to the first subtask file and the second subtask file.19.The electronic device of claim 12, wherein the processor is further configured to perform:obtaining a first computing parameter of the first processor and a second computing parameter of the second processor; andassigning the first computing subtask to the first processor according to the first computing parameter and assigning the second computing subtask to the second processor according to the second computing parameter.20.The electronic device of claim 12, wherein the processor is further configured to perform:setting a first part code and a second part code in the target scheduling code; andcorresponding the first part code with the first processor and corresponding the second part code with the second processor.
Citation Information
Patent Citations
Performing a workflow having a set of dependancy-related predefined activities on a plurality of task servers
US20110131448A1
Program code allocation based on processor features
US20190166228A1