Heterogeneous computing method and framework based on multi-computing-unit in-vehicle infotainment chip
By adopting heterogeneous computing methods in the smart cockpit and utilizing the heterogeneous computing framework of multi-computing unit car-machine chips to split and distribute computing tasks, the problem of unbalanced computing resource load is solved and the algorithm running speed and resource utilization are improved. .
Patent Information
- Application Number
- CN202410738568.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-07
- Publication Date
- 2024-09-27
AI Technical Summary
The load of computing resources in the smart cockpit is unbalanced in the vehicle, resulting in low algorithm running speed, insufficient utilization of computing resources, and low operating efficiency.
Adopting a heterogeneous computing method based on multi-computing unit car-machine chips, by pre-formulating the driving mode of the computing unit, receiving the algorithm model, converting it into a computing graph, splitting it into computing blocks, and assigning tasks to each calculation based on computing resources and operating status unit to implement heterogeneous operations.
It improves resource utilization, significantly speeds up the running speed of algorithm models, avoids resource competition when redundant computing resources occur, and ensures the stability of basic functions and existing processes.
Smart Images

Figure CN118708337A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of vehicle-mounted information technology, and in particular to a heterogeneous computing method and framework based on a multi-computing unit vehicle chip. Background Art
[0002] In recent years, with the improvement of people's living standards and the rapid development of the vehicle industry, the electronic and electrical architecture of vehicles has become increasingly complex. The onboard SoC chip integrates multiple computing units such as CPU, GPU and NPU. All services of the smart cockpit, such as instrumentation, central control, entertainment, etc., rely on the computing resources on the SoC. Because the smart cockpit uses different functions at different stages of vehicle driving, and the resources consumed by services using different functions are not fixed, the load of each computing resource is also different at different stages of vehicle driving.
[0003] However, in the process of current smart cockpits performing computing tasks, the ability to coordinate existing computing resources is insufficient, resulting in low algorithm running speed and insufficient utilization of computing resources, which in turn leads to low operating efficiency. Summary of the invention
[0004] In view of the above problems, the present invention provides a heterogeneous computing method and framework based on a multi-computing unit vehicle chip.
[0005] One object of the present invention is to provide a heterogeneous computing method based on a multi-computing unit vehicle chip to fully utilize existing computing resources and realize heterogeneous operations of algorithm models on different computing units.
[0006] A further object of the present invention is to further ensure the efficiency of heterogeneous computing.
[0007] In particular, according to one aspect of an embodiment of the present invention, a heterogeneous computing method based on a multi-computing unit vehicle chip is provided, comprising:
[0008] Predetermine the corresponding driving mode for each computing unit in the multi-computing unit vehicle computer chip;
[0009] Receive the algorithm model to be deployed to the multi-computing unit vehicle chip;
[0010] Convert the algorithm model into a computational graph;
[0011] Split the computational graph into multiple computational blocks according to the attribute information of the operators in the computational graph;
[0012] Allocating computing tasks of multiple computing blocks to each computing unit of the multi-computing unit vehicle chip according to the computing resources required by each computing block and the operating status of each computing unit; and
[0013] Each computing unit is called according to a driving mode corresponding to each computing unit, and each computing unit is made to calculate the assigned computing task respectively.
[0014] Furthermore, the step of receiving the algorithm model to be deployed to the multi-computing unit vehicle chip includes:
[0015] According to the type of the algorithm model, the parsing interface corresponding to the algorithm model is called, wherein each type of the algorithm model to be deployed predefines an independent parsing interface, and each parsing interface is used to receive the algorithm model to be deployed of the corresponding type;
[0016] Use the parsing interface to receive the algorithm model to be deployed.
[0017] Furthermore, the computation graph includes multiple operators, each of which is supported by at least one type of computation unit.
[0018] Further, each operation block includes at least one operator;
[0019] And the step of splitting the computation graph into multiple operation blocks according to the attribute information of the operators in the computation graph includes:
[0020] According to the branch to which the operator belongs in the computation graph, the operators belonging to the same branch are divided into the same operation block, so that each operation block obtained by splitting can be calculated independently;
[0021] According to the computing unit support of the operator, the operators in the computation graph are divided and all operators of each computation block are supported by at least one computing unit at the same time;
[0022] According to the number of operators, determine the number of multiple operation blocks;
[0023] The operation time of the operation block is estimated according to the support of the operator's computing unit and the execution efficiency of the operator on different computing units, so that the operation time of multiple split operation blocks is balanced.
[0024] Furthermore, after the step of splitting the computation graph into a plurality of computation blocks according to the attribute information of the operators in the computation graph and before the step of allocating the computation tasks of the plurality of computation blocks to the respective computation units of the multi-computing unit vehicle machine chip according to the computation resources required by the respective computation blocks and the running status of the respective computation units, the heterogeneous computing method further includes:
[0025] Record the ID of the computation block at the end of the computation graph; and
[0026] After the steps of calling each computing unit according to the driving mode corresponding to each computing unit and making each computing unit respectively calculate the assigned computing task, the heterogeneous computing method further includes:
[0027] After the calculation task of the operation block at the end is completed, the calculation result is obtained according to the ID of the operation block at the end of the calculation graph.
[0028] Furthermore, the step of allocating the computing tasks of the plurality of computing blocks to the respective computing units of the multi-computing unit vehicle chip according to the computing resources required by the computing blocks and the operating status of the computing units includes:
[0029] Allocate computing resources of multi-computing unit vehicle chips according to the computing resources required by each computing block and the operating status of each computing unit;
[0030] According to the allocation result of computing resources, the computing tasks of multiple operation blocks are allocated to each computing unit of the multi-computing unit vehicle computer chip.
[0031] Furthermore, the operating status of each computing unit includes the occupancy rate and resource allocation of each computing unit; and
[0032] According to the computing resources required by each operation block and the operating status of each computing unit, the steps of allocating computing resources of the multi-computing unit vehicle computer chip include:
[0033] According to the computing resources required by each operation block and the resource allocation situation, determine the allocation expectation and redundancy control of the computing resources of the multi-computing unit vehicle computer chip;
[0034] Determine the resource allocation priority of each computing unit according to the occupancy rate of each computing unit and the allocation expectation and redundancy control of computing resources;
[0035] The computing resources of the multi-computing unit vehicle computer chip are allocated according to the resource allocation priority of each computing unit.
[0036] According to another aspect of an embodiment of the present invention, a heterogeneous computing framework based on a multi-computing unit vehicle chip is provided, including:
[0037] The hardware device layer is used to pre-set a corresponding driving mode for each computing unit in the multi-computing unit vehicle chip, and call each computing unit according to the driving mode corresponding to each computing unit, so that each computing unit can calculate the assigned computing task respectively;
[0038] The model input layer is used to receive the algorithm model to be deployed to the multi-computing unit vehicle chip;
[0039] Model parsing layer, used to convert algorithm models into computational graphs;
[0040] The computation graph partitioning layer is used to split the computation graph into multiple computation blocks according to the attribute information of the operators in the computation graph; and
[0041] The resource scheduling layer is used to allocate the computing tasks of multiple computing blocks to the various computing units of the multi-computing unit vehicle chip according to the computing resources required by each computing block and the operating status of each computing unit.
[0042] Furthermore, the model input layer includes a plurality of independent parsing interfaces, each parsing interface being used to receive the corresponding algorithm model to be deployed.
[0043] According to another aspect of an embodiment of the present invention, the present invention further provides a machine-readable storage medium having a machine executable program stored thereon, and when the machine executable program is executed by a processor, any of the above-mentioned heterogeneous computing methods is implemented.
[0044] In addition, the present invention also provides a computer device, including a memory, a processor, and a machine executable program stored in the memory and running on the processor, and the processor implements any of the above-mentioned heterogeneous computing methods when executing the machine executable program.
[0045] The heterogeneous computing method based on the multi-computing unit vehicle chip of the present invention ensures the support of each computing unit at the framework level by formulating corresponding driving modes for each computing unit in the multi-computing unit vehicle chip in advance, converts the algorithm model into a computing graph by receiving the algorithm model to be deployed to the multi-computing unit vehicle chip, splits the computing graph into multiple computing blocks according to the attribute information of the operator in the computing graph, distributes the computing tasks of multiple computing blocks to each computing unit of the multi-computing unit vehicle chip according to the computing resources required by each computing block and the running status of each computing unit, and calls each computing unit according to the driving mode corresponding to each computing unit, and makes each computing unit calculate the assigned computing tasks respectively, thus realizing the heterogeneous computing of the algorithm model on different computing units. Compared with the scheme that does not adopt heterogeneous computing, the heterogeneous computing method of the present invention has higher resource utilization, greatly speeds up the running speed of the algorithm model, and at the same time ensures that the basic functions and existing processes are not affected, avoiding resource competition when there are redundant computing resources.
[0046] Furthermore, the heterogeneous computing method of the present invention calls the parsing interface corresponding to the algorithm model according to the type of the algorithm model, wherein each type of algorithm model to be deployed pre-defines an independent parsing interface, and each parsing interface is used to receive the algorithm model to be deployed of the corresponding type, and the algorithm model to be deployed is received by using the parsing interface, thereby realizing the reception of algorithm models obtained by different training frameworks and ensuring the accuracy of heterogeneous computing.
[0047] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below.
[0048] Based on the following detailed description of specific embodiments of the present invention in conjunction with the accompanying drawings, those skilled in the art will become more aware of the above and other objects, advantages and features of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0050] Figure 1 A schematic diagram of the structure of a heterogeneous computing framework based on a multi-computing unit vehicle chip according to an embodiment of the present invention is shown;
[0051] Figure 2 A schematic flow chart of a heterogeneous computing method based on a multi-computing unit vehicle chip according to an embodiment of the present invention is shown;
[0052] Figure 3 A schematic flow chart of a heterogeneous computing method based on a multi-computing unit vehicle chip according to another embodiment of the present invention is shown;
[0053] Figure 4 is a schematic diagram of the structure of a machine-readable storage medium according to an embodiment of the present invention; and
[0054] Figure 5 is a schematic diagram of the structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0055] The exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present disclosure and to enable the scope of the present invention to be fully communicated to those skilled in the art.
[0056] To solve the above technical problems, an embodiment of the present invention proposes a heterogeneous computing framework based on a multi-computing unit vehicle chip. Specifically, the multi-computing unit vehicle chip can be a system-level SoC (System on Chip), and the computing units in the multi-computing unit vehicle SoC can include CPU, GPU, NPU and DSP, etc. Each different computing unit can be called a different device.
[0057] Figure 1 The structure diagram of a heterogeneous computing framework based on a multi-computing unit vehicle chip according to an embodiment of the present invention is shown. Figure 1 The heterogeneous computing framework 10 may at least include: a model input layer 11, a model parsing layer 12, a computing graph partitioning layer 13, a resource scheduling layer 14 and a hardware device layer 15.
[0058] The model input layer 11 may include multiple independent parsing interfaces, each of which is used to receive the algorithm model to be deployed corresponding to it. Figure 1 As shown, the model input layer 11 defines an independent parsing interface for each algorithm model, including tensorflow, pytorch, onnx, caffe, etc. The parsing interface can parse the model weights and structures obtained by various framework training into framework internal data types, so that the heterogeneous computing framework 10 of the present invention has the ability to receive input from various mainstream framework model files.
[0059] The model parsing layer 12 is used to parse the algorithm model to be deployed and obtain the calculation graph of the algorithm model. In a specific embodiment, the algorithm model to be deployed may be an autonomous driving algorithm model to be deployed in a vehicle-mounted SoC. For the autonomous driving algorithm model to be deployed in the vehicle-mounted SoC, due to different frameworks during training, the file type and parsing method of the model are also different. At the same time, in order to achieve a reasonable allocation of computing resources, an algorithm model needs to be split into various devices for calculation, so it is necessary to unify its internal form. Therefore, the model parsing layer 12 of the present invention is used to construct an internal universal calculation graph. The calculation graph may be a universal calculation flow chart within a heterogeneous computing framework 10, which may be referred to as a calculation IR graph. For the autonomous driving algorithm model to be deployed in the vehicle-mounted SoC, the calculation IR graph stores the entire calculation process of the autonomous driving algorithm model on the device.
[0060] Specifically, for the convenience of explanation, the smallest computing unit in the calculation IR graph is called an operator. In this embodiment, each operator implements a specific calculation. In addition, all operators in the calculation IR graph are supported by at least one device to facilitate subsequent model segmentation and allocation. In order to ensure the efficiency of subsequent graph cutting, each operator needs to support as many devices as possible. Preferably, all operators in the calculation IR graph need to be supported by at least the CPU and another device.
[0061] In some specific embodiments, the model input layer 11 and the model parsing layer 12 of the present invention can be combined into a whole and provided with a model parser. The model parser is designed to receive various algorithm models and convert them into a calculation graph in a unified form. Specifically, the calculation graph can be obtained by the internal data type obtained by the parsing interface.
[0062] The computation graph partitioning layer 13 is used to split the computation graph into multiple computation blocks according to a preset partitioning rule. Figure 1 As shown, each operation block is a calculation subgraph, and each operation block may include at least one operator. It should be noted that the preset block rules can be pre-formulated according to the attribute information of the operators in the calculation graph and stored in the system. Specifically, when splitting, the block rules should effectively improve the calculation efficiency while ensuring that the calculation results before and after the splitting do not change. Based on this, the preset block rules include: each operation block obtained by splitting is an operation branch that can be operated independently; all operators of each operation block support at least one calculation unit at the same time; and / or determine the number of multiple operation blocks and the size of each operation block according to the calculation efficiency of each calculation unit and the support of the operator of each operation block for each calculation unit.
[0063] In a specific embodiment, the preset block rules may include the following rules:
[0064] First, in principle, each operation block obtained by splitting should belong to a separate branch in the calculation IR graph to ensure that each operation block can be operated independently. Except for the input of the operation block, the operation of each operation block does not depend on the data and structure of any external block to avoid waiting during calculation.
[0065] Second, all operators in each operation block must support at least one of the same devices to ensure that an operation block can always complete the operation on a certain computing device. Based on this, operators that only support the same and single device can be divided into the same operation block as much as possible.
[0066] Third, while meeting the above two principles, the number of blocks should not be too many or too few. Since the operation process of the entire computing model involves data interaction between various operation blocks, too many operation blocks will cause too much data copying and data transmission in the operation process of the entire computing model. Too few operation blocks will lose the advantage of parallel acceleration brought by heterogeneous computing, and a subgraph that is too large is not conducive to the portable allocation of computing resources.
[0067] Fourth, when splitting, you also need to consider the actual situation and try to balance the computing power and time consumed by each computing block. An overly large computing block will cause other computing blocks that rely on its computing results to wait during calculation, thereby reducing the efficiency of heterogeneous computing. In addition, the computing efficiency of different devices varies greatly. Generally, NPU>>GPU>>CPU / DSP, so when estimating the computing time of each computing block, you also need to consider the device support of all operators in the computing block.
[0068] The heterogeneous computing framework 10 of the present invention completes the block division according to the above rules, realizes the reasonable splitting of the computing graph, and effectively improves the efficiency of heterogeneous computing. In addition, each operation block obtained by the algorithm model splitting scheme proposed by the present invention can be independently operated on a certain computing device, which solves the compatibility problem between different hardware platforms, so that the algorithm model can flexibly select a more suitable computing platform for operation, reducing waiting time.
[0069] The resource scheduling layer 14 is used to allocate the computing tasks of multiple computing blocks to each computing unit of the multi-computing unit vehicle chip according to a preset scheduling strategy. It should be noted that the preset scheduling strategy can be pre-formulated according to the computing resources required by each computing block and the operating status of each computing unit, and stored in the system. Specifically, the resource scheduling layer 14 of the present invention allocates the computing resources of the multi-computing unit vehicle chip according to the preset scheduling strategy, and according to the allocation result of the computing resources, allocates the computing tasks of multiple computing blocks to each computing unit of the multi-computing unit vehicle chip to realize the allocation and scheduling of computing resources.
[0070] In a specific embodiment, the primary principle for allocating computing tasks is to allocate them according to the current load of each device. In other words, the computing resources of the multi-computing unit vehicle chip are allocated according to the occupancy rate of each computing unit. Specifically, for computing tasks with higher occupancy rates, fewer computing resources are allocated, while ensuring a certain degree of redundancy so that there are sufficient resources available to respond to emergencies.
[0071] In another specific embodiment, the principle of allocating computing tasks may also include: allocating computing tasks according to the following principles, and allocating computing resources of multi-computing unit vehicle chips according to the allocation expectations and redundancy control of computing resources. When allocating, first determine the resource allocation priority of each computing unit according to the allocation expectations and redundancy control of computing resources, and then allocate computing resources of multi-computing unit vehicle chips according to the resource allocation priority of each computing unit. Specifically, in this specific embodiment, computing tasks are allocated according to the following principles:
[0072] First, NPU resources should be allocated first. Because NPU devices have the highest computing efficiency and the fastest speed, and other applications in the smart cockpit have a smaller demand for NPUs, when allocating and scheduling computing resources, as many computing tasks as possible should be assigned to NPUs for intelligent algorithms.
[0073] Secondly, GPU resources should be allocated according to their redundancy. Because the voice and image-related applications in the cockpit require the GPU to perform, especially rendering and other tasks, when allocating and scheduling computing resources, try to avoid allocating too many computing tasks to the GPU.
[0074] In addition, try to avoid using CPU resources. CPU resources can be used for some simple tasks of specific tasks. Because all tasks in the entire cockpit are controlled by the CPU, and emergency processing also relies on the CPU, and the CPU has a low execution efficiency for most operators in the model, try to avoid using it.
[0075] The hardware device layer 15 is used to call each computing unit according to the driving mode corresponding to each computing unit. Specifically, based on the different hardware manufacturers selected by the vehicle-mounted SoC, the code rules, interface forms and calling logic of each device are different. Therefore, different driving modes need to be formulated for different devices in the algorithm framework. In a specific embodiment, the specific rules of the calling mode may include the following rules:
[0076] For CPU: CPU is the most common computing resource and can generally be called directly without any additional calling method.
[0077] For GPU: For GPU development, CUDA development method is preferred for hardware that supports CUDA; for devices that do not support CUDA, OpenCL is preferred for calling, and vulkan is used for calling on the Android side; for hardware that is not supported by both CUDA and OpenCL, customized development is performed based on the corresponding calling rules provided by the hardware manufacturer.
[0078] For NPU: There is no universal calling rule for NPU. Different NPU manufacturers will provide their own calling methods for NPU devices, which are mostly called using the UMD (user mode driver) layer interface provided by them.
[0079] For DSP: There are few manufacturers that integrate DSP units, and they are generally called through interfaces provided by the manufacturers.
[0080] Through the above-mentioned method, the heterogeneous computing framework 10 of the present invention can realize the support of each hardware unit at the framework level to form a usable computing device.
[0081] In some embodiments, various devices in the heterogeneous computing framework 10 of the present invention can communicate with each other, facilitating data interaction between various computing blocks. Specifically, this solution uses a PCIe bus solution to achieve data sharing.
[0082] In some embodiments, the heterogeneous computing framework 10 of the present invention can record the IDs of the split operation blocks so as to obtain the calculation results from the corresponding IDs.
[0083] Based on the same inventive concept, the present invention also provides a heterogeneous computing method based on a multi-computing unit vehicle computer chip. Figure 2 The flowchart of the heterogeneous computing method based on a multi-computing unit vehicle chip according to an embodiment of the present invention is shown. Figure 2 The heterogeneous computing method at least includes the following steps S202 to S212.
[0084] Step S202, pre-formulate corresponding driving modes for each computing unit in the multi-computing unit vehicle chip. It should be noted that the multi-computing unit vehicle chip can be a system-level SoC (System on Chip), and the computing units in the multi-computing unit vehicle SoC can include CPU, GPU, NPU and DSP, etc. Each different computing unit can also be called a different device. The driving mode corresponding to each type of device can be formulated according to the code rules, interface form and call logic of the device.
[0085] Step S204, receiving the algorithm model to be deployed to the multi-computing unit vehicle chip.
[0086] Step S206, converting the algorithm model into a computational graph. It should be noted that the computational graph may be a computational flow chart commonly used within the heterogeneous computing framework 10, which may be referred to as a computational IR graph. Specifically, the algorithm model to be deployed may be an autonomous driving algorithm model to be deployed in the vehicle-mounted SoC. For the autonomous driving algorithm model to be deployed in the vehicle-mounted SoC, the computational IR graph stores the entire computational process of the autonomous driving algorithm model on the device.
[0087] Step S208: split the computation graph into multiple operation blocks according to the attribute information of the operators in the computation graph. It should be noted that an operator in the computation IR graph is referred to as an operator, and each operation block may include at least one operator.
[0088] Step S210 , allocating computing tasks of multiple computing blocks to each computing unit of the multi-computing unit vehicle chip according to the computing resources required by each computing block and the operating status of each computing unit.
[0089] Step S212, calling each computing unit according to the driving mode corresponding to each computing unit, and making each computing unit calculate the assigned computing task respectively.
[0090] The heterogeneous computing method based on the multi-computing unit vehicle chip of the embodiment of the present invention ensures the support of each computing unit at the framework level by formulating the corresponding driving mode for each computing unit in the multi-computing unit vehicle chip in advance, converts the algorithm model into a computing graph by receiving the algorithm model to be deployed to the multi-computing unit vehicle chip, splits the computing graph into multiple operation blocks according to the attribute information of the operator in the computing graph, distributes the computing tasks of multiple operation blocks to each computing unit of the multi-computing unit vehicle chip according to the computing resources required by each operation block and the running status of each computing unit, and calls each computing unit according to the driving mode corresponding to each computing unit, and makes each computing unit calculate the assigned computing tasks respectively, so as to realize the heterogeneous operation of the algorithm model on different computing units. Compared with the scheme that does not adopt heterogeneous computing, the heterogeneous computing method of the present invention has higher resource utilization, greatly speeds up the running speed of the algorithm model, and at the same time ensures that the basic functions and existing processes are not affected, and avoids resource competition when there are redundant computing resources.
[0091] In one embodiment, the above step S204 may include the following steps: according to the type of the algorithm model, calling the parsing interface corresponding to the algorithm model, wherein each type of algorithm model to be deployed predefines an independent parsing interface, and each parsing interface is used to receive the algorithm model to be deployed of the corresponding type; receiving the algorithm model to be deployed using the parsing interface. It should be noted that for the autonomous driving algorithm model to be deployed in the vehicle-mounted SoC, the file type and parsing method of the model are different due to different frameworks during training. That is to say, before receiving the algorithm model to be deployed to the multi-computing unit vehicle chip, the heterogeneous computing method of the present invention can predefine an independent parsing interface for each algorithm model to be deployed, and each parsing interface is used to receive the algorithm model to be deployed corresponding to it. Specifically, the parsing interface includes tensorflow, pytorch, onnx, caffe, etc. The parsing interface can parse the model weights and structures obtained by training various frameworks into framework internal data types.
[0092] The heterogeneous computing method of the embodiment of the present invention calls the parsing interface corresponding to the algorithm model according to the type of the algorithm model, wherein each type of algorithm model to be deployed pre-defines an independent parsing interface, and each parsing interface is used to receive the algorithm model to be deployed of the corresponding type, and the algorithm model to be deployed is received by using the parsing interface, thereby realizing the reception of algorithm models obtained by different training frameworks and ensuring the accuracy of heterogeneous computing.
[0093] In some embodiments, the computation graph includes multiple operators. Each of the operators is supported by at least one computing unit. In other words, each operator supports at least one computing unit. Specifically, in the above step S206, in order to achieve a reasonable allocation of computing resources, it is necessary to split an algorithm model into various devices for calculation, so it is necessary to unify its internal form. In this embodiment, each operator implements a specific calculation. In addition, all operators in the computation IR graph are supported by at least one device to facilitate subsequent model segmentation and distribution. In order to ensure the efficiency of subsequent graph cutting, each operator needs to support as many devices as possible. Preferably, all operators in the computation IR graph need to be supported by at least the CPU and another device.
[0094] By using the above method, the heterogeneous computing method of the present invention can convert various algorithm models into a unified computing graph after receiving them. Specifically, the computing graph can be obtained by parsing the internal data types obtained by the interface.
[0095] In one embodiment, the above step S204 may include: dividing the operators belonging to the same branch into the same operation block according to the branch to which the operator belongs in the calculation graph, so that each operation block obtained by the split can be independently calculated; dividing the operators in the calculation graph according to the computing unit support of the operator and making all the operators of each operation block supported by at least one computing unit at the same time; determining the number of the multiple operation blocks according to the number of the operators; estimating the operation time of the operation block according to the computing unit support of the operator and the execution efficiency of the operator on different computing units, so that the operation time of the multiple operation blocks obtained by the split is balanced. The heterogeneous computing method of the present invention effectively improves the computing efficiency while ensuring that the calculation results before and after the split will not change.
[0096] Specifically, the block division rules for splitting the computation graph into multiple operation blocks may include the following rules:
[0097] First, in principle, each operation block obtained by splitting should belong to a separate branch in the calculation IR graph to ensure that each operation block can be operated independently. Except for the input of the operation block, the operation of each operation block does not depend on the data and structure of any external block to avoid waiting during calculation.
[0098] Second, all operators in each operation block must support at least one of the same devices to ensure that an operation block can always complete the operation on a certain computing device. Based on this, operators that only support the same and single device can be divided into the same operation block as much as possible.
[0099] Third, while meeting the above two principles, the number of blocks should not be too many or too few. Since the operation process of the entire computing model involves data interaction between various operation blocks, too many operation blocks will cause too much data copying and data transmission in the operation process of the entire computing model. Too few operation blocks will lose the advantage of parallel acceleration brought by heterogeneous computing, and a subgraph that is too large is not conducive to the portable allocation of computing resources.
[0100] Fourth, when splitting, you also need to consider the actual situation and try to balance the computing power and time consumed by each computing block. An overly large computing block will cause other computing blocks that rely on its computing results to wait during calculation, thereby reducing the efficiency of heterogeneous computing. In addition, the computing efficiency of different devices varies greatly. Generally, NPU>>GPU>>CPU / DSP, so when estimating the computing time of each computing block, you also need to consider the device support of all operators in the computing block.
[0101] The heterogeneous computing method of the present invention completes the block division according to the above rules, realizes the reasonable splitting of the computing graph, and effectively improves the efficiency of heterogeneous computing. In addition, each operation block obtained by the algorithm model splitting scheme proposed by the present invention can be independently operated on a certain computing device, which solves the compatibility problem between different hardware platforms, so that the algorithm model can flexibly select a more suitable computing platform for operation, reducing waiting time.
[0102] In one embodiment, the above step S210 may include the following steps: allocating computing resources of the multi-computing unit vehicle chip according to the computing resources required by each computing block and the operating status of each computing unit; and allocating computing tasks of multiple computing blocks to each computing unit of the multi-computing unit vehicle chip according to the computing resource allocation result. It should be noted that the operating status of each computing unit includes the occupancy rate and resource allocation of each computing unit.
[0103] Specifically, before the above step S210, the heterogeneous computing method of the present invention further includes the following steps: monitoring the operating status of each device in the vehicle-mounted SoC so as to obtain the occupancy rate of each device when the algorithm calculation needs to be called; feeding back the occupancy rate and resource allocation of each device to the heterogeneous computing framework 10 in real time; feeding back the operating mode of the smart cockpit at this time to determine the resource allocation expectation and redundancy control. After executing the above steps, the step of allocating computing tasks is executed.
[0104] In some embodiments, the above-mentioned step of allocating computing resources of the multi-computing unit vehicle chip according to the computing resources required by each of the computing blocks and the operating status of each of the computing units can be specifically executed as the following steps: determining the allocation expectation and redundancy control of the computing resources of the multi-computing unit vehicle chip according to the computing resources required by each of the computing blocks and the resource allocation situation; determining the resource allocation priority of each of the computing units according to the occupancy rate of each of the computing units and the allocation expectation and redundancy control of the computing resources; allocating the computing resources of the multi-computing unit vehicle chip according to the resource allocation priority of each of the computing units.
[0105] In other words, the primary principle of allocating computing tasks is to allocate them according to the current load of each device. Specifically, for computing tasks with high occupancy rates, fewer computing resources are allocated, while ensuring a certain degree of redundancy so that there are sufficient resources available to respond to emergencies.
[0106] In addition, another principle for allocating computing tasks is to allocate computing resources of multi-computing unit vehicle chips according to the allocation expectations and redundancy control of computing resources. Specifically, computing tasks are allocated according to the following principles:
[0107] First, NPU resources should be allocated first. Because NPU devices have the highest computing efficiency and the fastest speed, and other applications in the smart cockpit have a smaller demand for NPUs, when allocating and scheduling computing resources, as many computing tasks as possible should be assigned to NPUs.
[0108] Secondly, GPU resources should be allocated according to their redundancy. Because the voice and image-related applications in the cockpit require the GPU to perform, especially rendering and other tasks, when allocating and scheduling computing resources, try to avoid allocating too many computing tasks to the GPU.
[0109] In addition, try to avoid using CPU resources. CPU resources can be used for some simple tasks of specific tasks. Because all tasks in the entire cockpit are controlled by the CPU, and emergency processing also relies on the CPU, and the CPU has a low execution efficiency for most operators in the model, try to avoid using it.
[0110] The heterogeneous computing method of the present invention completes the allocation and scheduling of computing resources according to the above rules, realizes full utilization of computing resources, and realizes heterogeneous operations of algorithm models on different computing units. Compared with the solution that does not adopt heterogeneous computing, the heterogeneous computing method of the present invention has higher resource utilization, greatly speeds up the operation speed of the algorithm model, and ensures that the basic functions and existing processes are not affected, avoiding resource competition when there are redundant computing resources.
[0111] In some embodiments, after the above step S208 and before the above step S210, the heterogeneous computing method of the present invention may further include the following steps: recording the ID of the operation block at the end of the calculation graph. On this basis, after the above step S212, the heterogeneous computing method of the present invention may further include the following steps: after the calculation task of the operation block at the end is completed, according to the ID of the operation block at the end of the calculation graph, the calculation result is obtained, so that the calculation result can be fed back to the calling application later, thereby completing the entire heterogeneous computing process.
[0112] In some embodiments, in the above step S212, based on the different hardware manufacturers selected by the vehicle-mounted SoC, the code rules, interface forms and calling logic of each device are different. Therefore, different driving methods need to be formulated for different devices. In a specific embodiment, the specific rules of the calling method may include the following rules:
[0113] For CPU: CPU is the most common computing resource and can generally be called directly without any additional calling method.
[0114] For GPU: For GPU development, CUDA development method is preferred for hardware that supports CUDA; for devices that do not support CUDA, OpenCL is preferred for calling, and vulkan is used for calling on the Android side; for hardware that is not supported by both CUDA and OpenCL, customized development is performed based on the corresponding calling rules provided by the hardware manufacturer.
[0115] For NPU: There is no universal calling rule for NPU. Different NPU manufacturers will provide their own calling methods for NPU devices, which are mostly called using the UMD (user mode driver) layer interface provided by them.
[0116] For DSP: There are few manufacturers that integrate DSP units, and they are generally called through interfaces provided by the manufacturers.
[0117] Through the above-mentioned manner, each computing unit in the heterogeneous computing method of the present invention can obtain support at the framework level to form an available computing device, thereby completing the calculation of the computing tasks of multiple computing blocks.
[0118] In some embodiments, the devices can communicate with each other so as to exchange data between the operation blocks. Specifically, the solution adopts the PCIe bus solution to realize data sharing.
[0119] The above describes various implementations of the steps of the heterogeneous computing method according to the embodiment of the present invention. The following describes the implementation process of the heterogeneous computing method according to the present invention in an exemplary manner through a specific embodiment.
[0120] Figure 3 A schematic diagram of a heterogeneous computing method based on a multi-computing unit vehicle chip according to another embodiment of the present invention is shown. Figure 3 The process steps of this specific embodiment are described in detail.
[0121] Step S302: Different driving modes are formulated for various devices of the multi-computing unit vehicle chip. Various devices of the multi-computing unit vehicle chip may include CPU, GPU, NPU, DSP, etc. The driving modes corresponding to various devices may be formulated according to the code rules, interface forms, and call logic of the device.
[0122] Step S304, define an independent parsing interface for each algorithm model to be deployed, and each parsing interface is used to receive the corresponding algorithm model to be deployed. Specifically, the parsing interface includes tensorflow, pytorch, onnx, caffe, etc. The parsing interface can parse the model weights and structures obtained by training various frameworks into the internal data types of the framework.
[0123] Step S306, parse the algorithm model to be deployed and obtain the calculation graph of the algorithm model. It should be noted that the calculation graph can be a general calculation flow chart within the heterogeneous computing framework 10, which can be called a calculation IR graph. Specifically, the algorithm model to be deployed can be an autonomous driving algorithm model to be deployed in the vehicle SoC. For the autonomous driving algorithm model to be deployed in the vehicle SoC, the calculation IR graph saves the entire calculation process of the autonomous driving algorithm model on the device.
[0124] Step S308, split the computation graph into multiple operation blocks according to the attribute information of the operators in the computation graph. It should be noted that the computation IR graph includes multiple operators, and each operation block may include at least one operator. Each operator implements a specific computation. In addition, all operators in the computation IR graph are supported by at least one device.
[0125] Step S310, record the ID of the operation block at the end of the calculation graph.
[0126] Step S312, assigning computing tasks of multiple computing blocks to various devices of the multi-computing unit vehicle chip according to the computing resources required by each computing block and the operating status of each computing unit.
[0127] Step S314: calling each device according to the driving mode corresponding to each device to complete the calculation task of running multiple operation blocks.
[0128] Step S316, after the calculation task of the terminal operation block is completed, the calculation result is obtained according to the ID of the terminal operation block of the calculation graph.
[0129] Step S318: Feedback the calculation result to the calling application. This process ends.
[0130] The heterogeneous computing method based on the multi-computing unit vehicle chip of the embodiment of the present invention ensures the support of each computing unit at the framework level by formulating the corresponding driving mode for each computing unit in the multi-computing unit vehicle chip in advance, converts the algorithm model into a computing graph by receiving the algorithm model to be deployed to the multi-computing unit vehicle chip, splits the computing graph into multiple operation blocks according to the attribute information of the operator in the computing graph, distributes the computing tasks of multiple operation blocks to each computing unit of the multi-computing unit vehicle chip according to the computing resources required by each operation block and the running status of each computing unit, and calls each computing unit according to the driving mode corresponding to each computing unit, and makes each computing unit calculate the assigned computing tasks respectively, so as to realize the heterogeneous operation of the algorithm model on different computing units. Compared with the scheme that does not adopt heterogeneous computing, the heterogeneous computing method of the present invention has higher resource utilization, greatly speeds up the running speed of the algorithm model, and at the same time ensures that the basic functions and existing processes are not affected, and avoids resource competition when there are redundant computing resources.
[0131] Furthermore, the heterogeneous computing method of the embodiment of the present invention calls the parsing interface corresponding to the algorithm model according to the type of the algorithm model, wherein each type of algorithm model to be deployed pre-defines an independent parsing interface, and each parsing interface is used to receive the algorithm model to be deployed of the corresponding type, and the algorithm model to be deployed is received by using the parsing interface, thereby realizing the reception of algorithm models obtained by different training frameworks and ensuring the accuracy of heterogeneous computing.
[0132] Furthermore, the heterogeneous computing method of the embodiment of the present invention divides the operators belonging to the same branch into the same operation block according to the branch to which the operator belongs in the calculation graph, so that each operation block obtained by the split can be independently calculated, divides the operators in the calculation graph according to the computing unit support of the operator and makes all the operators of each operation block supported by at least one computing unit at the same time, determines the number of multiple operation blocks according to the number of operators, and estimates the operation time of the operation block according to the computing unit support of the operator and the execution efficiency of the operator on different computing units, so that the operation time of the multiple operation blocks obtained by the split is balanced, completes the reasonable splitting of the calculation graph, and effectively improves the efficiency of heterogeneous computing. In addition, the algorithm model splitting scheme proposed by the present invention solves the compatibility problem between different hardware platforms, so that the algorithm model can flexibly select a more suitable computing platform for calculation, reducing waiting time.
[0133] The embodiments of the present invention also provide a machine-readable storage medium and a computer device. Figure 4 It is a schematic diagram of the structure of a machine-readable storage medium according to an embodiment of the present invention. Figure 5 is a schematic diagram of the structure of a computer device according to an embodiment of the present invention.
[0134] like Figure 4 and Figure 5 As shown, the machine-readable storage medium 20 stores a machine executable program 21 thereon, and when the machine executable program 21 is executed by a processor, the heterogeneous computing method of any of the above embodiments is implemented.
[0135] The computer device 30 may include a memory 320, a processor 310, and a machine executable program 21 stored in the memory 320 and running on the processor 310, and the processor 310 implements the heterogeneous computing method of any of the above embodiments when executing the machine executable program 21.
[0136] It should be noted that the machine-readable storage medium 20 can be any device that can contain, store, communicate, propagate or transmit a program for use in an instruction execution system, device or equipment or in conjunction with these instruction execution systems, devices or equipment. More specific examples (non-exhaustive list) of the machine-readable storage medium 20 include the following: an electrical connection portion (electronic device) with one or more wirings, a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and editable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the machine-readable storage medium 20 can even be paper or other suitable media on which the program can be printed, because the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting or processing in other suitable ways as necessary, and then stored in a computer memory.
[0137] It should be understood that each part of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system.
[0138] The computer device 30 may be, for example, a server, a vehicle-mounted computer, a desktop computer, a notebook computer, a tablet computer, or a smart phone. In some examples, the computer device 30 may be a cloud computing node. The computer device 30 may also be described in the general context of computer system executable instructions (such as program modules) executed by a computer system. Typically, a program module may include routines, programs, target programs, components, logic, data structures, etc. that perform specific tasks or implement specific abstract data types. The computer device 30 may be implemented in a distributed cloud computing environment where remote processing devices linked via a communication network perform tasks. In a distributed cloud computing environment, program modules may be located on a local or remote computing system storage medium including a storage device.
[0139] The computer device 30 may include a processor 310 adapted to execute stored instructions, and a memory 320 providing temporary storage space for the operation of the instructions during operation. The processor 310 may be a single-core processor, a multi-core processor, a computing cluster, or any number of other configurations. The memory 320 may include a random access memory (RAM), a read-only memory, a flash memory, or any other suitable storage system.
[0140] The processor 310 may be connected to an I / O interface (input / output interface) suitable for connecting the computer device 30 to one or more I / O devices (input / output devices) through a system interconnect (e.g., PCI, PCI-Express, etc.). The I / O devices may include, for example, a keyboard and a pointing device, wherein the pointing device may include a touch pad or a touch screen, etc. The I / O devices may be built-in components of the computer device 30, or may be devices externally connected to the computing device.
[0141] Processor 310 can also be linked to a display interface suitable for connecting computer device 30 to a display device through a system interconnection. Display device can include a display screen as a built-in component of computer device 30. Display device can also include a computer monitor, a television or a projector, etc., which are externally connected to computer device 30. In addition, a network interface controller (NIC) can be suitable for connecting computer device 30 to a network through a system interconnection. In some embodiments, NIC can use any suitable interface or protocol (such as an Internet small computer system interface, etc.) to transmit data. The network can be a cellular network, a radio network, a wide area network (WAN), a local area network (LAN) or the Internet, etc. Remote devices can be connected to computing devices through a network.
[0142] At this point, those skilled in the art should recognize that, although multiple exemplary embodiments of the present invention have been shown and described in detail herein, many other variations or modifications that conform to the principles of the present invention can still be directly determined or derived based on the content disclosed in the present invention without departing from the spirit and scope of the present invention. Therefore, the scope of the present invention should be understood and recognized as covering all these other variations or modifications.
Claims
1. A heterogeneous computing method based on a multi-computing unit vehicle chip, comprising: Predetermine a corresponding driving mode for each computing unit in the multi-computing unit vehicle computer chip; Receiving an algorithm model to be deployed to the multi-computing unit vehicle chip; Converting the algorithm model into a computational graph; Splitting the computation graph into a plurality of computation blocks according to attribute information of operators in the computation graph; Allocating the computing tasks of the plurality of computing blocks to the respective computing units of the multi-computing unit vehicle chip according to the computing resources required by the respective computing blocks and the operating status of the respective computing units; as well as The respective computing units are called according to the driving modes corresponding to the respective computing units, and the respective computing units are made to respectively calculate the assigned computing tasks.
2. The heterogeneous computing method according to claim 1, wherein: The step of receiving the algorithm model to be deployed to the multi-computing unit vehicle chip includes: According to the type of the algorithm model, calling the parsing interface corresponding to the algorithm model, wherein each type of the algorithm model to be deployed predefines an independent parsing interface, and each of the parsing interfaces is used to receive the algorithm model to be deployed of the type corresponding thereto; The algorithm model to be deployed is received using the parsing interface.
3. The heterogeneous computing method according to claim 1, wherein: The computation graph includes a plurality of operators, and each operator is supported by at least one computing unit.
4. The heterogeneous computing method according to claim 3, wherein: Each of the operation blocks includes at least one of the operators; And the step of splitting the computation graph into a plurality of operation blocks according to the attribute information of the operators in the computation graph comprises: According to the branches to which the operators belong in the calculation graph, the operators belonging to the same branch are divided into the same operation block, so that each operation block obtained by the division can be independently calculated; According to the computing unit support of the operator, the operators in the computing graph are divided and all the operators of each computing block are supported by at least one computing unit at the same time; Determining the number of the plurality of operation blocks according to the number of the operators; The operation time of the operation block is estimated according to the support of the operation unit of the operator and the execution efficiency of the operator on different operation units, so that the operation time of the multiple operation blocks obtained by splitting is balanced.
5. The heterogeneous computing method according to claim 1, wherein: After the step of splitting the computation graph into a plurality of computation blocks according to the attribute information of the operators in the computation graph and before the step of allocating the computation tasks of the plurality of computation blocks to the respective computation units of the multi-computing unit vehicle chip according to the computation resources required by the respective computation blocks and the running status of the respective computation units, the heterogeneous computing method further includes: Record the ID of the computation block at the end of the computation graph; and After the step of calling each computing unit according to the driving mode corresponding to each computing unit and making each computing unit respectively calculate the assigned computing task, the heterogeneous computing method further includes: After the calculation task of the operation block at the end is completed, the calculation result is obtained according to the ID of the operation block at the end of the calculation graph.
6. The heterogeneous computing method according to claim 1, wherein: The step of allocating the computing tasks of the plurality of computing blocks to the respective computing units of the multi-computing unit vehicle chip according to the computing resources required by the computing blocks and the operating status of the computing units comprises: Allocating computing resources of the multi-computing unit vehicle chip according to the computing resources required by each computing block and the operating status of each computing unit; According to the allocation result of the computing resources, the computing tasks of the multiple operation blocks are allocated to the respective computing units of the multi-computing unit vehicle chip.
7. The heterogeneous computing method according to claim 6, wherein: The operation status of each computing unit includes the occupancy rate and resource allocation of each computing unit; and The step of allocating computing resources of the multi-computing unit vehicle chip according to the computing resources required by each of the computing blocks and the operating status of each of the computing units includes: Determine the allocation expectation and redundancy control of the computing resources of the multi-computing unit vehicle chip according to the computing resources required by each of the computing blocks and the resource allocation situation; Determining the resource allocation priority of each computing unit according to the occupancy rate of each computing unit and the allocation expectation and redundancy control of the computing resources; The computing resources of the multi-computing unit vehicle computer chip are allocated according to the resource allocation priority of each computing unit.
8. A heterogeneous computing framework based on a multi-computing unit vehicle chip, comprising: The hardware device layer is used to predetermine a corresponding driving mode for each computing unit in the multi-computing unit vehicle machine chip, and call each computing unit according to the driving mode corresponding to each computing unit, so that each computing unit can respectively calculate the assigned computing task; A model input layer, used to receive the algorithm model to be deployed to the multi-computing unit vehicle chip; A model parsing layer, used to convert the algorithm model into a computational graph; A computation graph block layer, used to split the computation graph into multiple computation blocks according to attribute information of operators in the computation graph; as well as The resource scheduling layer is used to distribute the computing tasks of the multiple computing blocks to the various computing units of the multi-computing unit vehicle chip according to the computing resources required by each computing block and the operating status of each computing unit.
9. The heterogeneous computing framework according to claim 8, wherein: The model input layer includes a plurality of independent parsing interfaces, each of which is used to receive a corresponding algorithm model to be deployed.
10. A machine-readable storage medium having a machine-executable program stored thereon, wherein the machine-executable program, when executed by a processor, implements the heterogeneous computing method according to any one of claims 1 to 7.
11. A computer device, comprising a memory, a processor, and a machine executable program stored in the memory and running on the processor, wherein the processor implements the heterogeneous computing method according to any one of claims 1 to 7 when executing the machine executable program.
Citation Information
Cited By
Large model heterogeneous reasoning engine method, device and equipment and storage medium
CN121457605A
