Cross-platform task adaptation method, electronic equipment and computer program product
By evaluating and selecting the most suitable hardware acceleration platform to perform tasks, the problem of users manually selecting platforms in the cross-chip architecture integration platform is solved, which improves task execution efficiency and computing power utilization, and simplifies user operations.
Patent Information
- Application Number
- CN202410205104.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-23
- Publication Date
- 2025-08-26
AI Technical Summary
In the prior art, cross-chip architecture integration platform requires users to manually select the platform when executing tasks, resulting in high usage threshold and large matching granularity of computing power. It is impossible to give full play to the advantages of platform computing, and it is difficult to determine the appropriate platform to execute tasks.
By obtaining multiple preset operation cost gradient information for the task to be calculated, the operation cost of each target hardware acceleration platform is evaluated, the most suitable platform is selected based on the evaluation value to perform the task, and the platform selection is optimized using the preset affinity weight and threshold value, and the operation cost gradient information is updated to improve matching accuracy.
It realizes efficient execution of cross-platform tasks, improves computing power utilization rate and task execution efficiency, simplifies user interaction process, and fully utilizes the hybrid heterogeneous computing power advantages of cross-chip architecture integration platforms.
Smart Images

Figure CN120540825A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of heterogeneous computing technology, and in particular to a cross-platform task adaptation method, electronic device, storage medium, and computer program product. Background Art
[0002] In existing technologies, AI applications such as video analysis, image recognition, and intelligent brains face the challenge of processing and analyzing large amounts of data. To improve computational efficiency, the industry generally accelerates data computation by introducing accelerator cards (accelerator chips). Each hardware accelerator chip vendor develops a dedicated compiler, runtime, and driver software toolchain for their chip to support the development and operation of different applications targeting the accelerator chip. These toolchains are tightly bound to the chip and incompatible with each other. To achieve interoperability between different hardware accelerator chip platforms and reduce the cost and complexity of chip migration, the industry has proposed cross-chip architecture integration platforms to achieve "one-time application development, cross-core deployment and migration." However, in these cross-chip architecture integration platforms, when computing tasks are performed on multiple platforms, users often rely on manual platform selection. This requires a deep understanding of the current task and creates a high barrier to entry. Furthermore, users manually determine which platform to perform the task on, resulting in a high granularity in platform computing power matching, which fails to fully leverage the computing advantages of the platform and makes it difficult to determine the appropriate platform for the task. Summary of the Invention
[0003] In view of this, embodiments of the present application provide a cross-platform task adaptation method, electronic device, storage medium, and computer program product.
[0004] The technical solution of the embodiment of the present application is implemented as follows:
[0005] The present invention provides a cross-platform task adaptation method, which includes:
[0006] Obtain a task to be calculated; determine an evaluation value of the computational cost of each target hardware acceleration platform executing the task to be calculated based on multiple preset computational cost gradient information corresponding to each target hardware acceleration platform among multiple target hardware acceleration platforms; each preset computational cost gradient information corresponds to an computational action, and each preset computational cost gradient information represents the computational cost of the corresponding target hardware acceleration platform when executing the same computational action of different data scales; the computational cost represents the efficiency and / or computing power utilization rate of the target hardware acceleration platform when executing the task to be calculated; determine a target hardware acceleration platform for executing the task to be calculated based on the evaluation value of the computational cost of the target hardware acceleration platform executing the task to be calculated.
[0007] In the above scheme, the task to be calculated includes multiple calculation actions; based on multiple preset calculation cost gradient information corresponding to each target hardware acceleration platform, the evaluation value of the calculation cost of each target hardware acceleration platform to execute the task to be calculated is determined, including: based on the scale of the operation data corresponding to each calculation action in the task to be calculated, and the multiple preset calculation cost gradient information corresponding to each target hardware acceleration platform, determining the sub-calculation cost of each calculation action executed by each target hardware acceleration platform; based on the sub-calculation cost of each calculation action executed by each target hardware acceleration platform, determining the evaluation value of the calculation cost of each target hardware acceleration platform to execute the task to be calculated.
[0008] In the above scheme, the sub-operational cost of each target hardware acceleration platform executing each operation action is used to determine the evaluation value of the operation cost of each target hardware acceleration platform executing the task to be calculated, including: based on the preset affinity weight corresponding to each target hardware acceleration platform, the preset sub-affinity weight corresponding to each operation action and the sub-operational cost of executing all operation actions in the task to be calculated, determining the evaluation value of the operation cost of each target hardware acceleration platform executing the task to be calculated; the preset affinity weight represents the priority of the target hardware acceleration platform, and the preset sub-affinity weight represents the adaptability of the operation action to the target hardware acceleration platform.
[0009] In the above scheme, the target hardware acceleration platform for executing the task to be calculated is determined based on the evaluation value of the computational cost of each target hardware acceleration platform executing the task to be calculated, including: calculating the difference in the evaluation value of the computational cost between each two target hardware acceleration platforms; if there is a situation where the difference is greater than a threshold, the target hardware acceleration platform for executing the task to be calculated is determined based on the evaluation value of the computational cost of each target hardware acceleration platform executing the task to be calculated; if there is no situation where the difference is greater than the threshold, the target hardware acceleration platform for executing the task to be calculated is determined based on the preset target hardware acceleration platform selection order.
[0010] In the above scheme, if there is a situation where the difference is greater than a threshold, the target hardware acceleration platform for calculating the task to be calculated is determined based on the evaluation value of the computational cost of the target hardware acceleration platform executing the task to be calculated, including: selecting the target hardware acceleration platform with the smallest evaluation value of the computational cost to execute the task to be calculated.
[0011] In the above scheme, after determining the target hardware acceleration platform for computing the task to be computed based on the evaluation value of the computational cost of each target hardware acceleration platform executing the task to be computed, the method further includes: obtaining the execution result of the task to be computed; the execution result includes the real sub-computational cost of each computational action in the task to be computed executed by the target hardware acceleration platform executing the task to be computed; and updating the preset computational cost gradient information of the corresponding target hardware acceleration platform based on the real sub-computational cost of each computational action in the task to be computed executed by the target hardware acceleration platform executing the task to be computed.
[0012] In the above scheme, obtaining the execution result of the task to be calculated includes: generating a native flow file based on preset rules; the native flow file includes the device description information and calculation task description information of the target hardware acceleration platform; updating the evaluation value of the calculation cost of the target hardware acceleration platform to the device description information of the native flow file; based on the device description information and calculation task description information in the updated native flow file, pushing the task to be calculated to the target hardware acceleration platform used to execute the task to be calculated.
[0013] An embodiment of the present application further provides an electronic device, comprising: a processor and a memory for storing a computer program that can be run on the processor, wherein the processor is configured to execute the steps in the above method when running the computer program.
[0014] An embodiment of the present application further provides a computer storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above method are implemented.
[0015] An embodiment of the present application further provides a computer program product, comprising a computer program, which implements the steps of the above method when executed by a processor.
[0016] The embodiment of the present application determines the evaluation value of the computational cost of the target hardware acceleration platform for executing the task to be calculated based on multiple preset computational cost gradient information corresponding to the target hardware acceleration platform. Among them, the preset computational cost gradient information characterizes the computational cost of the corresponding target hardware acceleration platform when executing operation data of different scales. Then, based on the evaluation value of the computational cost of the target hardware acceleration platform for executing the task to be calculated, the target hardware acceleration platform for executing the task to be calculated is determined. The embodiment of the present application can predetermine the evaluation value of the computational cost required for different target hardware acceleration platforms to execute computational tasks through the preset computational cost gradient information of the target hardware acceleration platform, and quantify the computational situation of the target hardware acceleration platform through the computational cost. The evaluation value based on the quantified computational cost can accurately reflect the adaptability of different target hardware acceleration platforms to the task to be calculated, and reasonably determine the platform that is most suitable for executing the current task to be calculated, which can improve the execution efficiency of the computational task and improve the computing power utilization of the platform. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 A flowchart of a cross-platform task adaptation method provided in an embodiment of the present application;
[0018] Figure 2 A computational cost gradient graph of a target hardware acceleration platform provided in an embodiment of the present application;
[0019] Figure 3 A schematic diagram of the structure of a cross-platform task adaptation device provided in an embodiment of the present application;
[0020] Figure 4 A schematic diagram of the workflow of an architecture affinity reasoner provided in an embodiment of the present application;
[0021] Figure 5 A schematic diagram of a workflow of an architecture optimization component provided in an embodiment of the present application;
[0022] Figure 6 A schematic diagram of a user manual configuration interface provided in an embodiment of the present application;
[0023] Figure 7 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0024] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions of this application are further elaborated in detail below with reference to the accompanying drawings and embodiments. The described embodiments should not be regarded as limiting this application. All other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0025] In the following description, references to "some embodiments" describe a subset of all possible embodiments. However, it is understood that "some embodiments" may be the same subset or different subsets of all possible embodiments, and may be combined with each other without conflict. The terms "first" and "second" are used merely to distinguish similar objects and do not represent a specific ordering of the objects. It is understood that the specific order or sequence of "first" and "second" may be interchanged where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.
[0026] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this application pertains. The terms used herein are for the purpose of describing this application only and are not intended to limit this application.
[0027] In the existing technology, artificial intelligence application scenarios such as video analysis, image recognition, and smart brains face a large amount of data processing and analysis. In order to improve computing efficiency, the industry generally accelerates data computing by introducing accelerator cards (accelerator chips). Each hardware acceleration chip equipment manufacturer will develop a dedicated compiler, dedicated runtime, dedicated driver and other software tool chains for its chip to support the development and operation of different applications for the acceleration chip. The software tool chains of each manufacturer are strongly bound to the chip and are incompatible with each other. In the case of multiple platforms performing computing tasks, most of them rely on users to manually select the platform, which requires users to have a deep understanding of the information of the current task, and the usage threshold is high. At the same time, users manually judge the platform to perform the task, and the platform's computing power matching granularity is large, which cannot give full play to the computing advantages of the platform and makes it difficult to determine the appropriate platform to perform the task.
[0028] Specifically, in a cross-chip architecture fusion platform, when the platform receives a computer acceleration task request, it needs to prioritize which architecture acceleration chip to use within the platform to perform the computing acceleration task. To solve this problem, the technical solutions of the existing technology mainly include:
[0029] Solution 1: Based on the required computing resource type and quantity specifications manually selected by the user when issuing a computing task, the system filters and sorts the available resources in the platform resource pool based on information such as the accelerator chip status (temperature, power), resource margin quota (number of cores, cache space, storage space), and load balancing. Based on the filtering and sorting results, the node where the corresponding accelerator chip is located is selected to execute the submitted computing task.
[0030] Solution 2: Based on the application type information (model training, model inference, image rendering, scientific computing, big data processing, etc.) manually added by the user when issuing the computing acceleration task, among the acceleration chip types supported by the platform, according to the rules formed by experience or historical analysis recognition results and application type priority matching (for example, neural network model training tasks use machine learning (Machine Learning, ML), image rendering tasks use graphics processing units (Graphics Processing Unit, GPU)), etc., the platform's currently available resources are filtered and sorted, and the node where the corresponding acceleration chip is located is selected to perform the computing acceleration task based on the filtering and sorting results.
[0031] Regarding the first solution mentioned above, when creating this accelerated computing task, the user needs to manually select the resource type and specification data required for this computing task, which is relatively complicated and provides a poor user experience. At the same time, the user needs to have a relatively in-depth understanding of the resource occupation type and resource consumption scale of the current computing task. The usage threshold is high and the matching granularity is coarse. The acceleration capability cannot be associated with the task type, resulting in insufficient flexibility in application. In addition, the advantages of various types of hardware acceleration chips in the cross-chip architecture integration platform cannot be fully utilized, and there is a large room for optimization in the execution efficiency or resource utilization of the selected target architecture chip.
[0032] Regarding the above-mentioned solution 2, the optimal application scenarios of hardware acceleration chips with different architectures overlap (for example, embedded neural network processors and machine learning both have strong acceleration capabilities for model training and inference scenarios). Based on the application type or application scenario identification and the judgment method combined with empirical rules, the computing power matching granularity is large, and quantifiable and accurate matching cannot be achieved. There is a large room for optimization in computing task execution efficiency or resource utilization.
[0033] In view of this, this application proposes a cross-platform task adaptation method to address the above-mentioned problems. Based on user product applications, users can flexibly and unconsciously use more efficient hardware acceleration chips on the cross-chip architecture integration platform launched by various manufacturers to complete their submitted computing tasks. At the user level, it improves task execution efficiency and simplifies the interaction process with the platform. At the same time, at the system level, it better leverages the hybrid heterogeneous computing power advantages of the cross-chip architecture integration platform and improves the overall computing power resource utilization efficiency of the system.
[0034] Figure 1 A flow chart of a cross-platform task adaptation method provided in an embodiment of the present application is shown as follows: Figure 1 As shown, the method includes steps 101 to 103, wherein:
[0035] Step 101: Obtain tasks to be calculated.
[0036] In some embodiments, after obtaining the task to be calculated, it is necessary to compile the task to be calculated to convert it into a programming language that the platform can recognize. Here, the task to be calculated can be a task such as model training, model reasoning, image rendering, scientific computing, big data processing, etc., or it can be a subtask or partial stage task of the above-mentioned task that requires calculation acceleration. The acquisition here can refer to identifying or reading the task to be calculated through the interface.
[0037] Step 102: Based on multiple preset computational cost gradient information corresponding to each target hardware acceleration platform among multiple target hardware acceleration platforms, determine the evaluation value of the computational cost of each target hardware acceleration platform executing the task to be computed; each preset computational cost gradient information corresponds to an computational action, and each preset computational cost gradient information represents the computational cost when the corresponding target hardware acceleration platform executes the same computational action of different data scales; the computational cost represents the efficiency and / or computing power utilization of the target hardware acceleration platform when executing the task to be computed;
[0038] The execution efficiency of different computational actions on different target hardware acceleration platforms varies for different scales of operational data, and this efficiency is correlated with the chip structure and cache size strength. Therefore, the computational cost gradient information corresponding to each acceleration platform can be determined based on historical experimental experience. Computational cost is a comprehensive evaluation of the target hardware acceleration platform's ability to execute computational tasks. For example, if target hardware acceleration platform a executes task A efficiently and consumes less computing power, then the computational cost of target hardware acceleration platform a is considered low. If target hardware acceleration platform b executes task A with similar efficiency but requires more computing power, then the computational cost of task b executing task A is higher than that of task a. It should be noted that the quantitative calculation of computational cost depends not only on the aforementioned efficiency and computing power consumption, but also includes the target hardware acceleration platform's power consumption when executing the task, the performance of the task, and its compatibility with other tasks. When actually calculating the computational cost of a hardware platform, other models can be used to learn the weights of the various factors that influence the computational cost of the target hardware acceleration platform executing the task, thereby obtaining a quantitative calculation result. In the cross-platform architecture integration platform (referring to a fusion platform that integrates multiple target hardware acceleration platforms), the computational cost results of the full amount of computing operations of the supported full amount of target hardware acceleration platforms in different scenarios of operated data scales are shown in Table 1. Through this abstract method, the computational operation costs of different hardware acceleration chips and under different scales of operated data can be obtained more quickly and accurately. The initial value configuration of the computational cost can be obtained through sampling in the experimental environment, or refreshed regularly after statistical analysis through platform monitoring, which is not limited in this embodiment. Under the same architecture (target hardware acceleration platform) and the same computational operation, the evaluation values of the computational costs corresponding to different scales of operation data are shown in Table 1 (for example, operation 1 in Table 1 corresponds to GPU cost A1 to cost An).
[0039]
[0040]
[0041] Table 1
[0042] Figure 2 The computation cost gradient graph of a target hardware acceleration platform provided in the embodiment of the present application is as follows: Figure 2 As shown in Figure 2, when the data scale increases from scale 1 to the maximum scale, the platform's computing cost increases from cost 1 to the maximum cost. Figure 2 The computation cost gradient graph shown is only an example provided in the embodiment of the present application. In actual applications, different target hardware acceleration platforms may correspond to different computation cost gradient information, that is, have different cost gradient graphs. For example, the computation cost of a target hardware acceleration platform may increase linearly with the data scale or the computation cost may increase nonlinearly with the data scale. Based on the above Table 1 and Figure 2The corresponding computing costs required by different target hardware acceleration platforms to perform the same computing tasks can be estimated.
[0043] Step 103 : determining a target hardware acceleration platform for executing the task to be calculated based on an evaluation value of the computational cost of the target hardware acceleration platform executing the task to be calculated.
[0044] In some embodiments, after determining the evaluation value of the computational cost of the target hardware acceleration platform executing the task to be computed, these target hardware acceleration platforms can be sorted based on their running costs, and the target hardware acceleration platform with the lowest evaluation value of the computational cost is selected to execute the task.
[0045] For some special cases, such as the need to quickly complete the task to be calculated, the target hardware acceleration platform with the lowest evaluation value of the computational cost can be selected from the target hardware acceleration platforms with higher efficiency in executing the task to be calculated. High computational efficiency can indicate that the target hardware acceleration platform executes the task quickly. Here, multiple platforms with the top N task execution speeds can be selected. In addition, based on the needs of other scenarios and other priority selection conditions such as task execution effect and power consumption, a hardware platform with a lower evaluation value of the computational cost among the qualified target hardware acceleration platforms can be selected to execute the task to be calculated. For example, the target hardware acceleration platform with the lowest execution cost can be selected from several platforms with better task execution effect or several platforms with lower task execution power consumption to execute the task to be calculated. The top N platforms in task execution effect or the top N platforms in reverse order of power consumption can be selected. Here, the task execution effect can be the clarity of the rendered image, the degree of convergence of the model training, etc. The specific criteria for judging the quality of the effect can be determined according to the different tasks to be executed.
[0046] The embodiment of the present application determines the evaluation value of the computational cost of the target hardware acceleration platform executing the task to be calculated based on multiple preset computational cost gradient information corresponding to the target hardware acceleration platform. Among them, the preset computational cost gradient information characterizes the computational cost of the corresponding target hardware acceleration platform when executing operation data of different scales. Then, based on the computational cost of the target hardware acceleration platform executing the task to be calculated, the target hardware acceleration platform for executing the task to be calculated is determined. The embodiment of the present application can evaluate the computational cost required for different platforms to run computational tasks before the platform runs the task to be calculated through the preset platform cost gradient information, and can quantify the computational situation of the platform. The evaluation value based on the quantified computational cost can accurately reflect the adaptability of different platforms to the task to be calculated, reasonably determine the platform that is most suitable for executing the current task to be calculated, improve the execution efficiency of the computational task, and improve the utilization rate of the platform computing power.
[0047] In some embodiments, the task to be computed includes multiple computing actions; and determining an evaluation value of the computing cost of each target hardware acceleration platform executing the task to be computed based on multiple preset computing cost gradient information corresponding to each target hardware acceleration platform includes:
[0048] Determining a sub-operation cost for executing each operation action by the target hardware acceleration platform based on the size of the operation data corresponding to each operation action in the to-be-operated task and a plurality of preset operation cost gradient information corresponding to the target hardware acceleration platform;
[0049] Based on the sub-operation cost of each operation action executed by the target hardware acceleration platform, an evaluation value of the operation cost of the target hardware acceleration platform executing the task to be calculated is determined.
[0050] In some embodiments, a task to be calculated may be composed of a combination of multiple calculation actions (options) and operated data (data), that is, task: {<Op,[Data...]> ,<Op,[Data...]> ,……,<Op,[Data...]>}, the number of operated data here can be multiple, as shown in Table 2.
[0051] OpName%358_specConstat"358_specConstat" OpName%360_specConstat "360_specConstat" OpName%366_specConstat"366_specConstat" OpName%370_specConstat"370_specConstat" OpName%376_specConstat"376_specConstat" OpName%378_specConstat"378_specConstat" OpName%380_specConstat"380_specConstat" OpName%388_specConstat"388_specConstat" OpName%390_specConstat"390_specConstat" OpName%394_specConstat"394_specConstat"
[0052] Table 2
[0053] Among them, OpName represents the operation name, specConstat represents the operation data, Table 2 lists some operations and operation data in the task to be calculated. For each target hardware acceleration platform, Figure 2 , Table 1 and Table 2 determine the sub-operation cost generated by the target hardware acceleration platform when executing each operation. Specifically, the scale of operation data corresponding to each operation in the task to be calculated is known. Based on the known scale of operation data, the corresponding operation cost is searched in the operation cost gradient information corresponding to the target hardware acceleration platform to obtain the sub-operation cost corresponding to each operation. The sub-operation cost corresponding to all operations executed by the target hardware acceleration platform is summed up to estimate the operation cost of the target hardware acceleration platform when executing the task to be calculated. It should be noted that even if the same target hardware acceleration platform executes the same operation with the same operation data scale, its actual operation cost may be affected by other factors such as the environment and produce differences. Therefore, the operation cost of the target hardware acceleration platform obtained based on the preset operation cost gradient information can be understood as an evaluation of the operation cost.
[0054] Based on the above embodiment, based on the preset computational cost gradient information, the sub-computational cost of each computational action in the task to be computed is calculated separately, and the computational cost calculation of the hardware platform executing the task to be computed is refined, so that a more accurate evaluation of the computational cost of the target hardware acceleration platform can be obtained. On this basis, more convincing and accurate quantitative data support can be provided for the principles of the hardware platform.
[0055] In some embodiments, determining an evaluation value of the computation cost of each target hardware acceleration platform executing the task to be computed based on the sub-computation cost of each computation action executed by each target hardware acceleration platform includes:
[0056] Based on the preset affinity weight corresponding to the target hardware acceleration platform, the preset sub-affinity weight corresponding to each operation action and the sum of the sub-operation costs of executing all operation actions in the task to be calculated, the evaluation value of the operation cost of the target hardware acceleration platform executing the task to be calculated is determined; the preset affinity weight represents the priority of the target hardware acceleration platform, and the preset sub-affinity weight represents the adaptability of the operation action to the target hardware acceleration platform.
[0057] In some embodiments, each target hardware platform is provided with a corresponding affinity weight, which can represent the priority of each platform. Specifically, the affinity weight can be set by the user based on the experience gained from historical experiments. By default, the affinity weight of the target hardware acceleration platform is set to 1. In some cases, such as for a newly added target hardware acceleration platform, its affinity weight can be set to slightly greater than 1, such as 1.05. The purpose of this operation is to test the performance of the newly added target hardware acceleration platform. After reliable performance parameters are obtained through testing, its affinity weight can be adjusted.
[0058] In some embodiments, a corresponding affinity weight can also be set for each computing action. Different target hardware acceleration platforms also have different affinity weights for different computing actions. For example, if a task includes three computing actions a, b, and c, the affinity weights of target hardware acceleration platform A for the aforementioned three computing actions are 1.0, 0.8, and 1.1, respectively. By using the affinity weight of the target hardware acceleration platform and the affinity weight for each computing operation, the computing cost calculation of the target hardware acceleration platform can be further refined to obtain a more accurate and reliable computing cost evaluation result. Specifically, the evaluation value of the computing cost of the target hardware acceleration platform can be calculated using Formula 1.
[0059] Cost = Weight platform *(n op1 *Weight op1 *Cost <op1,[data1…]> +n op2 Weightop2 *Cost <op2,[data2…]> +…+(Formula 1)
[0060] n opN *Weight opN *Cost <opN,[dataN...]> )
[0061] Cost represents the computational cost of the target hardware acceleration platform, and Weight platform Indicates the affinity weight of the target hardware acceleration platform, Weight op1 to Weight opN Indicates the sub-affinity weights corresponding to different operations performed by the target hardware acceleration platform, n Op1 *Cost <Op1 ,[data1...]>n Op1 to n OpN *Cost <OpN ,[dataN...]>n OpN The sub-operation cost generated by the target hardware acceleration platform when executing the operation data corresponding to the multiple operation actions in the task to be calculated is represented by: Formula 2 can be obtained by rearranging the above formula 1.
[0062]
[0063] For example, the task A to be calculated includes 10 small-scale calculations and 5 large-scale calculations. Among them, by querying the calculation cost gradient information, it can be known that the calculation cost of executing a small-scale operation on the GPU is 0.01, the cost of executing a large-scale operation is 0.1, the cost of executing a small-scale operation on the NPU is 0.02, and the cost of a large-scale operation is 0.05. The affinity weights for GPU and NPU in the current cross-chip architecture integration platform are both 1.0. It can be preliminarily calculated that the calculation cost of the task to be calculated running on the GPU is 0.6, and the calculation cost of running on the NPU is 0.27. The task to be calculated is more friendly to the NPU supported by the cross-chip architecture integration platform, that is, it has stronger affinity. Similarly, the calculation cost evaluation method of the task to be calculated can also be converted into an evaluation method based on priority value, such as the higher the calculation cost, the lower the priority.
[0064] Based on the above embodiment, the computing cost of the target hardware acceleration platform is finally determined by calculations at different granularities. That is, after calculating multiple sub-computational costs for the target hardware acceleration platform at a smaller granularity, the sum of all sub-computational costs is adjusted at a larger granularity level. The computing cost is adjusted by combining the affinity weights obtained by the machine calculation of the fine-grained computing cost with the user's experience and the historical operating parameters of the target hardware acceleration platform. This can make the computing cost evaluation results of the target hardware acceleration platform more reasonable and closer to the actual situation.
[0065] In some embodiments, determining a target hardware acceleration platform for executing the task to be calculated based on an evaluation value of a computational cost of each target hardware acceleration platform executing the task to be calculated includes:
[0066] Calculate the difference in the evaluation value of the computational cost between each two target hardware acceleration platforms;
[0067] If the difference is greater than the threshold, determining a target hardware acceleration platform for executing the task to be calculated based on an evaluation value of the computational cost of the target hardware acceleration platform executing the task to be calculated;
[0068] If there is no case where the difference is greater than the threshold, the target hardware acceleration platform for executing the task to be calculated is determined based on a preset selection order of the target hardware acceleration platform.
[0069] In some embodiments, after calculating the evaluation value of the computational cost of the target hardware acceleration platform, the difference in the evaluation value of the computational cost between each two target hardware acceleration platforms is calculated. Here, the difference in the computational cost between the target hardware acceleration platform with the largest evaluation value of the computational cost and the target hardware acceleration platform with the smallest evaluation value of the computational cost can also be directly calculated. If the difference in the calculated evaluation value of the computational cost is greater than the threshold, it means that the affinity between different target hardware acceleration platforms for the task to be computed is relatively large, and the affinity is negatively correlated with the evaluation value of the computational cost. At this time, the target hardware acceleration platform for executing the task to be computed can be determined based on the evaluation value of the computational cost of the target hardware acceleration platform. Specifically, the target hardware acceleration platform with the smallest evaluation value of the computational cost can be selected to execute the task to be computed, or multiple target hardware acceleration platforms with an evaluation value of the computational cost less than the threshold can be determined. The user can choose which target hardware acceleration platform to use to execute the task to be run or select from the target hardware acceleration platforms with the top N resource inventory based on the resource inventory.
[0070] In some embodiments, if the difference in the evaluation values of the computational costs between the target hardware acceleration platforms is less than a threshold, it means that the affinity of each computational acceleration platform for the task to be computed is roughly the same. In this case, the target hardware acceleration platform for executing the task to be computed can be determined not based on the evaluation value of the computational cost, but based on the preset target hardware acceleration platform selection order to determine the available target hardware acceleration platform for executing the task to be computed. Here, the preset target hardware acceleration platform selection order can be determined based on the target hardware acceleration platform's execution records for multiple types of computational tasks. For example, if platform A has a lower computational cost evaluation value for most computational tasks, its selection order will be relatively high. Platform B has the lowest computational cost evaluation value for a certain type of computational task, but a higher computational cost evaluation value for other types of computational tasks, and its selection order will be relatively low. In general, the selection order mainly depends on the versatility of the target hardware acceleration platform or the resource inventory of the current platform, that is, the average affinity or average computational cost for multiple types of computational tasks.
[0071] Based on the above embodiment, the difference calculation is performed on the evaluation value of the computing cost of each target hardware acceleration platform. When the difference is less than the threshold, there is no need to perform the subsequent optimization step, that is, the target hardware acceleration platform with the smallest evaluation value of the computing cost is selected as the main body for executing the task to be calculated, and the general target hardware acceleration platform allocation process can be followed. In this way, the data processing amount in the process of selecting the target hardware acceleration platform by the system can be reduced without reducing the task execution effect, thereby improving the efficiency of task processing from the process perspective.
[0072] In some embodiments, if the difference is greater than a threshold, determining a target hardware acceleration platform for computing the task to be computed based on a computational cost of the target hardware acceleration platform executing the task to be computed includes:
[0073] A target hardware acceleration platform with the smallest evaluation value of the computation cost is selected to execute the task to be computed.
[0074] In some embodiments, the target hardware acceleration platform with the smallest evaluation value of the computational cost among multiple target hardware acceleration platforms is determined as the target hardware acceleration platform for executing the task to be operated. Furthermore, if there are multiple target hardware acceleration platforms with the same evaluation value of the computational cost and all of them are the minimum computational cost, the variance of the sub-computational costs of the aforementioned target hardware acceleration platforms can be calculated respectively, and the target hardware acceleration platform with the smallest variance value can be selected to execute the task to be run. It can be understood that the variance of the sub-computational cost represents the fluctuation of the sub-computational cost of the target hardware acceleration platform when executing multiple computational actions in the task to be operated. The smaller the fluctuation, the more stable the operating state of the target hardware acceleration platform. Selecting a target hardware acceleration platform with a more stable operating state can protect the target hardware acceleration platform while obtaining a better task execution effect.
[0075] Based on the above embodiment, by selecting the target hardware acceleration platform with the lowest computational cost to execute the task to be calculated, the existing target hardware acceleration platform can be utilized with the highest efficiency. At the same time, selecting a relatively stable target hardware acceleration platform can also protect the target hardware acceleration platform to a certain extent and reduce the aging of the platform.
[0076] In some embodiments, after determining a target hardware acceleration platform for computing the task to be computed based on an evaluation value of a computational cost of each target hardware acceleration platform executing the task to be computed, the method further includes:
[0077] Obtaining an execution result of the task to be calculated; the execution result includes a real sub-calculation cost of each calculation action in the task to be calculated executed by the target hardware acceleration platform;
[0078] Based on the actual sub-operation cost of each operation action in the task to be calculated executed by the target hardware acceleration platform that executes the task to be calculated, the preset operation cost gradient information of the corresponding target hardware acceleration platform is updated.
[0079] In some embodiments, after determining a target hardware acceleration platform for executing a pending computation task, the pending computation task is executed based on the target hardware acceleration platform. During the target hardware acceleration platform's execution of the computation task, the target hardware acceleration platform's operating parameters are monitored. Specifically, this may include the actual sub-computational cost of each action executed by the target hardware acceleration platform during the computation task. It should be noted that the preset computational cost gradient information of the target hardware acceleration platform is highly versatile reference information that can be used by the target hardware acceleration platform when executing various types of computation tasks. Its data source is the target hardware acceleration platform's historical records of running tasks. As the target hardware acceleration platform executes more tasks, its corresponding computational cost gradient information becomes closer to the actual computational cost, i.e., the computational cost incurred when the target hardware acceleration platform actually executes the computation task. Therefore, the operating parameters of the target hardware acceleration platform are recorded each time it executes a computation task to calculate the target hardware acceleration platform's actual computational cost. Specifically, the target hardware acceleration platform's actual computational cost can be calculated based on parameters such as its efficiency and computing power consumption when executing the task. For example, the weights between different parameters learned through other models can be used to calculate the computational cost of the target hardware acceleration platform by weighted weighting. For example, the time taken by multiple target hardware acceleration platforms to complete tasks is 37 minutes, 42 minutes, 35 minutes, and 28 minutes, respectively, and the core occupancy rates when running tasks are 85%, 75%, 90%, and 70%, respectively. For the above two parameters, the hardware platform can be scored according to the length of time consumed, and the shorter the time, the higher the score. The score can also be scored according to the core occupancy rate, and the lower the occupancy rate, the higher the score. Finally, each score is multiplied by the corresponding weight to obtain the score of the target hardware platform. Based on the score, it can be converted into the computational cost of the target hardware acceleration platform at a certain ratio, and the higher the score, the lower the computational cost. It should be noted that the operating parameters of the monitored target hardware acceleration platform can also include the power consumption, core frequency, temperature, etc. of the target hardware acceleration platform. After the target hardware acceleration platform completes the computational task, the computational cost gradient information for the target hardware acceleration platform is updated based on the actual computational cost. Specifically, the original computational cost gradient information can be updated by taking the average of the actual computational cost and the computational cost gradient information, or the information can be calculated and updated based on a certain weight. The specific weight value can be determined based on the actual situation or learned through other models.
[0080] Based on the above embodiment, by monitoring the results of the target hardware acceleration platform executing the task, the actual computational cost is obtained and then the computational cost gradient information of the corresponding target hardware acceleration platform is updated. This can make the computational cost gradient information of the target hardware acceleration platform closer to the actual value, and can improve the reliability of subsequent computational cost evaluation, so as to make a more reasonable target hardware acceleration platform selection decision.
[0081] In some embodiments, obtaining the execution result of the task to be calculated includes:
[0082] Generate a native transfer file based on preset rules; the native transfer file includes device description information of the target hardware acceleration platform and description information of the computing task;
[0083] Updating the estimated value of the computation cost of the target hardware acceleration platform into the device description information of the native streaming file;
[0084] Based on the device description information and computing task description information in the updated native flow file, the task to be computed is pushed to a target hardware acceleration platform for executing the task to be computed.
[0085] In some embodiments, the native transfer file is a necessary file in the system process, which is used to transmit the information generated by the system in the entire process. Specifically, the task to be calculated is run on the system through a unified native transfer file, as shown in Table 3 below. The native transfer file mainly includes: 1. Public information header: device information of each target hardware acceleration platform, such as acceleration device type, acceleration node information, evaluation value of calculation cost, task start execution time and task end execution time, etc. 2. Executable program part of general computing power chip (such as x86), such as assembly instructions. 3. Executable program part of acceleration chip (such as GPU), such as PTX execution. Since the cross-chip architecture fusion platform supports different acceleration chips (such as GPU / NPU / TPU, etc.), the acceleration chip executable program part is divided into multiple blocks, each block corresponding to a different acceleration chip executable program execution, namely "Device image1, Device image2" in "Table 3 Native transfer file format example", etc., where the HOST part stores the mapping address of the target hardware acceleration platform, Device image1 to Device imageN represent the device description, including the public information header, the general computing power chip executable program part and the acceleration chip executable program part in the above embodiment.
[0086] In some embodiments, in actual applications, the cross-chip architecture fusion platform compiles and generates an initial native flow file. After obtaining the computational cost of the target hardware acceleration platform, the public information header content in the native flow file is updated, that is, the device description in Table 3. According to the evaluation value of the computational cost, the target acceleration node is selected in the cross-chip architecture fusion platform, and the acceleration node information part in the device description in the native flow file is updated. When the acceleration node executes the task, the start execution time, operating temperature, core occupancy and other data in the native flow file are updated. When the task is completed, the end execution time, operating temperature, core occupancy and other data in the native flow file are updated. Finally, the task status tracker calculates and saves the actual execution task status information of this task based on the above updated results as a reference for updating the cost gradient.
[0087] HOST part Device image1 Device image2 …… Device imageN
[0088] Table 3
[0089] In some embodiments, after determining the target hardware acceleration platform for executing the task to be run, a tag can be added to the device description portion of the corresponding target hardware acceleration platform in the native streaming file. When the system recognizes the tag, the task can be pushed directly to the corresponding target hardware acceleration platform.
[0090] Based on the above embodiment, the information generated in the entire target hardware acceleration platform is transferred through the flow file, and there is no need to transfer the tasks to be calculated along with the process, which reduces the burden on the system and improves the overall execution efficiency of the system.
[0091] In some embodiments, the present application also provides a cross-platform task adaptation device, which improves the execution efficiency of computing tasks and the utilization of computing resources on the cross-chip architecture integration platform by more accurately quantifying the running cost of the computing tasks submitted by the user on different hardware acceleration chips. The structural diagram of the cross-platform task adaptation device of the device is shown as follows: Figure 3 shown.
[0092] The following examples are combined with Figure 3 The device shown in the figure is described, and the device mainly includes:
[0093] Product application: This part can be considered as the interface for obtaining the task to be calculated. The task to be calculated is connected to the device in the form of a product application.
[0094] Architecture affinity reasoner: Based on the computational cost calculation method proposed in the above embodiment, the affinity reasoning result of the task to be accelerated under each target hardware acceleration platform is provided in the cross-platform task adaptation device. Here, the affinity reasoning result can be expressed as the computational cost of the target hardware acceleration platform. This module passes the affinity reasoning result to the cross-architecture compiler, which updates it to each device description part in the native flow file. Specifically, Figure 4 A schematic diagram of a workflow of an architecture affinity reasoner provided in an embodiment of the present application, including steps 401 to 409.
[0095] Step 401: Initialize the computation cost evaluation module.
[0096] In some embodiments, the architecture affinity reasoner includes an operation cost evaluation module for calculating operation costs, and the module needs to be initialized first.
[0097] Step 402: Configure the initial value of the computation cost gradient.
[0098] In some embodiments, the initial computation cost gradient value refers to the computation cost gradient information in the aforementioned embodiments.
[0099] Step 403: Is there a computation cost evaluation request?
[0100] In some embodiments, when a computing task is waiting to be accessed, a computing cost evaluation request is received, and the process proceeds to step 404 . If no computing cost evaluation request is received, the process proceeds to step 409 .
[0101] Step 404: Waiting for the computing task to be parsed.
[0102] In some embodiments, the architecture affinity reasoner analyzes the pending computing task and identifies the type and size of the operation data of the action to be performed in the pending computing task.
[0103] Step 405: Count the operation type and operation data size.
[0104] In some embodiments, it is necessary to count the types of operations in the tasks to be computed and the scale of computational data corresponding to each execution action.
[0105] Step 406: Obtain the computation cost of the task.
[0106] In some embodiments, the task operation cost corresponding to each platform is obtained in combination with the configured budget cost gradient initial value.
[0107] Step 407: push the cost calculation results of each architecture.
[0108] In some embodiments, the cost results of each architecture operation are updated to the native streaming file.
[0109] Step 408: Update the native transfer file.
[0110] In some embodiments, after the computation cost result is updated to the native streaming file, step 409 is entered.
[0111] Step 409: Wait for a cost evaluation request.
[0112] In some embodiments, when no cost evaluation request is received, the architecture affinity reasoner is in a standby state, and the process is between step 402 and step 403 .
[0113] Architecture optimization plug-in: The native flow file with architecture affinity information obtained by the cross-architecture compiler can be used to run the user-submitted computing tasks on the cross-chip architecture integration platform. According to the types of target hardware acceleration platforms supported by the current cross-chip architecture integration platform, it can be judged whether the impact of the architecture affinity difference on the execution efficiency of the computing tasks exceeds the impact threshold. For the computing tasks that exceed the impact threshold, it is considered that the task can obtain significant benefits by adopting the architecture affinity matching strategy. Then, according to the architecture affinity recommendation results, the target hardware acceleration platform with the top N architecture affinity (Top1 is used by default, and the task execution is postponed if it is abnormal) is selected as the main body of the computing task, and the computing task is executed on the specified platform through adaptive runtime.
[0114] Figure 5 FIG. 1 is a flow chart of an architecture preferred component provided in an embodiment of the present application, such as Figure 5 As shown, the process includes steps 501 to 509:
[0115] Step 501: Query the status of each target hardware acceleration platform.
[0116] In some embodiments, the status of the target hardware acceleration platform includes whether the platform is already working or in a faulty state, mainly determining whether the target hardware acceleration platform is available.
[0117] Step 502: Filter out platforms that do not meet the operating conditions or obtain a list of recommended platforms.
[0118] In some embodiments, target hardware acceleration platforms that do not meet the operating conditions are filtered out, such as faulty platforms, occupied platforms, etc., or a list of recommended target hardware acceleration platforms is obtained.
[0119] Step 503: parse the native streaming file.
[0120] It should be noted here that the native flow file here has been added with the inference results obtained based on the aforementioned architecture affinity reasoner, that is, the computing costs of each target hardware acceleration platform. The native flow file here is the updated native flow file.
[0121] Step 504: Obtain description information of each device.
[0122] Get the device description information in the native streaming file. The purpose here is to obtain the computing cost of each target hardware acceleration platform.
[0123] Step 505: Check whether the cost difference between the platforms is greater than the affinity threshold.
[0124] In some embodiments, the difference in computing costs of each platform is compared to see if it is greater than an affinity threshold. If the cost difference is less than the affinity threshold, it means that the difference in executing tasks of each target hardware acceleration platform is not large, and the process goes to step 508. If the difference is greater than the affinity threshold, the process goes to step 506.
[0125] Step 506: Select the platform with the best architecture affinity from the list of available platforms.
[0126] In some embodiments, selecting the platform with the best affinity from the list of available target hardware acceleration platforms may refer to selecting the target hardware acceleration platform with the lowest computational cost.
[0127] Step 507: Update task node information.
[0128] In some embodiments, the device description of the selected target hardware acceleration platform is updated. Specifically, a tag may be added to the device description of the target hardware acceleration platform so that the target hardware acceleration platform can be correctly identified and task pushed.
[0129] Step 508: Select a task execution node according to the existing method.
[0130] In some embodiments, the target hardware acceleration platform is selected according to an existing method, that is, the target hardware acceleration platform is selected according to a default order to execute the task to be calculated.
[0131] Step 509: Push the task to be calculated to the adaptive runtime for execution.
[0132] In some embodiments, the adaptive runtime is a type of virtual machine. Each target hardware acceleration platform actually executes the task to be calculated through the virtual machine. From the software level, the virtual machine calls the corresponding target hardware acceleration platform device to execute the task to be run, so the task is finally pushed to the adaptive runtime for execution.
[0133] Task status tracker: Continuously monitors the historical task execution status and execution cost within the target hardware acceleration platform, collects statistics on the execution costs of different computing operations and the scale of the operated data in each architecture target hardware acceleration platform, and periodically updates the computing cost gradient information configured in the architecture affinity thruster through the cost average method (for example, the total amount of historical data that meets the conditions exceeds N, N ≥ 10000), thereby improving the timeliness of performance optimization of each target hardware acceleration platform.
[0134] Cross-architecture compiler: used to compile computing tasks, convert them into a language that can be recognized by the computer, and generate native flow files according to unified rules.
[0135] Adaptive runtime: A unified abstraction and dynamic mapping execution for multi-platform hybrid devices.
[0136] In some embodiments, Figure 3 The device shown can implement a cross-platform task adaptation method according to steps ① to ⑦:
[0137] Step 1: The computing task is pushed to the cross-architecture compiler for compilation, and the native flow file is generated according to unified rules.
[0138] Step 2: Push the computation task to the architecture affinity reasoner to obtain the computation cost of each architecture target hardware acceleration platform. To improve processing efficiency, steps 1 and 2 can be performed simultaneously.
[0139] Step 3: The architecture affinity result data of the task to be calculated is passed to the cross-architecture compiler through active push of the architecture affinity reasoner or message subscription of the cross-architecture compiler. The cross-architecture compiler updates the result to the device description part of each device in the native flow file.
[0140] Step 4: The cross-architecture compiler passes the updated native flow file to the architecture optimization plug-in to determine whether the architecture optimization logic needs to be triggered.
[0141] Step 5: For computing tasks that need to trigger the architecture optimization logic, the architecture optimization plug-in passes the information of the task to be calculated and the target hardware acceleration platform with the highest architecture affinity to the adaptive runtime.
[0142] Step 6: During adaptive runtime, the computing task is executed on the recommended target hardware acceleration platform according to the optimization result of the target hardware acceleration platform.
[0143] Step 7: The task status tracker monitors, records and analyzes the status and execution cost of each execution of the computing task.
[0144] Step ⑧: The task state tracker periodically updates the computational cost gradient information configured in the architecture affinity thruster.
[0145] Based on the above embodiment method, there is no need for manual configuration by the user. Directly based on the user's product application, the user can flexibly use a more efficient target hardware acceleration platform on the cross-chip architecture integration platform to complete the computing tasks they submit. While improving the task execution efficiency at the user level, at the system level, it better leverages the hybrid heterogeneous computing power advantages of the cross-chip architecture integration platform and improves the overall computing power utilization efficiency of the system. Figure 6 This is a schematic diagram of the user manual configuration interface in the prior art. It can be seen that there is a lot of content to configure, and the user threshold is high. Whether or not the appropriate target hardware acceleration platform can be selected is closely related to the configuration information filled in by the user. There is no guarantee that the most reasonable target hardware acceleration platform will be stably selected to execute the task to be calculated. In addition, in the above embodiment, an intuitive and quantitative method is used to accurately and finely recommend and guide the execution efficiency of computing tasks, reducing the errors introduced into the system by subjective experience, insufficient reference samples, or incomplete rules. While improving the overall computing power utilization efficiency of the system, the execution effect can be continuously optimized.
[0146] In order to implement the method of the embodiment of the present application, the embodiment of the present application also provides a cross-platform task adaptation device, which corresponds to the above-mentioned cross-platform task adaptation method, and each step in the above-mentioned cross-platform task adaptation method embodiment is also fully applicable to the embodiment of the cross-platform task adaptation device.
[0147] The device includes:
[0148] The acquisition module is used to obtain tasks to be calculated.
[0149] A processing module is used to determine an evaluation value of the computational cost of each target hardware acceleration platform performing the task to be computed based on multiple preset computational cost gradient information corresponding to each target hardware acceleration platform among multiple target hardware acceleration platforms; each preset computational cost gradient information corresponds to a computing action, and each preset computational cost gradient information represents the computational cost of the corresponding target hardware acceleration platform when performing the same computing action of different data scales; the computational cost represents the efficiency and / or computing power utilization of the target hardware acceleration platform when performing the task to be computed.
[0150] The processing module is further configured to determine a target hardware acceleration platform for executing the task to be calculated based on an evaluation value of a computational cost of each target hardware acceleration platform executing the task to be calculated.
[0151] The determination module is further used to determine the sub-operational cost of each target hardware acceleration platform performing each operation action based on the scale of the operation data corresponding to each operation action and the preset operation cost gradient information corresponding to each target hardware acceleration platform; based on the sub-operational cost of each target hardware acceleration platform performing each operation action, determine the evaluation value of the operation cost of each target hardware acceleration platform performing the task to be calculated.
[0152] The processing module is further used to determine an evaluation value of the computational cost of each target hardware acceleration platform executing the task to be computed based on a preset affinity weight corresponding to each target hardware acceleration platform, a preset sub-affinity weight corresponding to each computational action, and a sub-computational cost of executing all computational actions in the task to be computed; the preset affinity weight represents the priority of the target hardware acceleration platform, and the preset sub-affinity weight represents the compatibility of the computational action with the target hardware acceleration platform.
[0153] The processing module is further configured to calculate the difference in the evaluation values of the computational costs between each two target hardware acceleration platforms; if the difference is greater than a threshold, the target hardware acceleration platform for executing the task to be executed is determined based on the evaluation value of the computational cost of each target hardware acceleration platform executing the task to be executed; if the difference is not greater than the threshold, the target hardware acceleration platform for executing the task to be executed is determined based on a preset target hardware acceleration platform selection order.
[0154] The processing module is further configured to select a target hardware acceleration platform with the smallest evaluation value of computation cost, for executing the task to be computed.
[0155] The device also includes an execution module, which is used to obtain the execution result of the task to be calculated; the execution result includes the real sub-operation cost of each operation action in the task to be calculated executed by the target hardware acceleration platform; based on the real sub-operation cost of each operation action in the task to be calculated executed by the target hardware acceleration platform, the preset operation cost gradient information of the corresponding target hardware acceleration platform is updated.
[0156] The execution module is also used to generate a native flow file based on preset rules; the native flow file includes device description information and computing task description information of the target hardware acceleration platform; the evaluation value of the computing cost of the target hardware acceleration platform is updated to the device description information of the native flow file; based on the device description information and computing task description information in the updated native flow file, the task to be calculated is pushed to the target hardware acceleration platform used to execute the task to be calculated.
[0157] It should be noted that the cross-platform task adaptation device provided in the above embodiment only uses the division of the above-mentioned program modules as an example to illustrate cross-platform task adaptation. In actual applications, the above-mentioned processing can be assigned to different program modules as needed, that is, the internal structure of the device can be divided into different program modules to complete all or part of the processing described above. In addition, the cross-platform task adaptation device provided in the above embodiment and the cross-platform task adaptation method embodiment are based on the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0158] Based on the hardware implementation of the above program modules, and in order to implement the method of the embodiment of the present application, the embodiment of the present application also provides an electronic device. Figure 7 This is a schematic diagram of the hardware structure of the electronic device according to the embodiment of the present application. Figure 7 As shown, the electronic device includes:
[0159] Communication interface 701, capable of exchanging information with other devices such as network devices;
[0160] The processor 702 is connected to the communication interface 701 to implement information exchange with other devices and is used to execute the method provided by one or more technical solutions when running a computer program. The computer program is stored in the memory 703.
[0161] Of course, in actual application, the various components in the electronic device are coupled together through the bus system 704. It is understood that the bus system 704 is used to realize the connection and communication between these components. In addition to the data bus, the bus system also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, Figure 7 Various buses are labeled as bus system 704 .
[0162] The memory 703 in the embodiment of the present application is used to store various types of data to support the operation of the computer device. Examples of such data include: any computer program used to operate on the electronic device.
[0163] It is understood that the memory 703 can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a flash memory, a magnetic surface memory, an optical disc, or a compact disc read-only memory (CD-ROM); the magnetic surface memory can be a magnetic disk memory or a magnetic tape memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), synchronous static random access memory (SSRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct rambus random access memory (DRRAM).The memories described in the embodiments of this application are intended to include, but are not limited to, these and any other suitable types of memories.
[0164] The methods disclosed in the above embodiments of the present application can be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. During implementation, the steps of the above methods can be completed by hardware integrated logic circuits in the processor or instructions in software form. The above processor may be a general-purpose processor, a DSP, or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The processor can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor may be a microprocessor or any conventional processor, etc. The steps of the methods disclosed in the embodiments of the present application can be directly embodied as being executed by a hardware decoding processor, or can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium, which is located in a memory. The processor reads the program in the memory and completes the steps of the above methods in combination with its hardware.
[0165] Optionally, when the processor 702 executes the program, it implements the corresponding processes implemented by the computer device in each method of the embodiment of the present application, which will not be described here for the sake of brevity.
[0166] In an exemplary embodiment, the present application also provides a storage medium, namely, a computer storage medium, specifically a computer-readable storage medium, including, for example, a first memory storing a computer program. The computer program can be executed by a processor of a computer device to perform the steps of the aforementioned method. The computer-readable storage medium can be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, Flash Memory, magnetic surface mount storage, optical disk, or CD-ROM.
[0167] In the several embodiments provided in this application, it should be understood that the disclosed devices, computer equipment and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.
[0168] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0169] In addition, all functional units in the embodiments of the present application can be integrated into one processing unit, or each unit can be a separate unit, or two or more units can be integrated into one unit; the above-mentioned integrated units can be implemented in the form of hardware or in the form of hardware plus software functional units.
[0170] Those skilled in the art will understand that all or part of the steps of implementing the above-mentioned method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above-mentioned method embodiment; and the aforementioned storage medium includes: mobile storage devices, ROM, RAM, disks or optical disks, etc. Various media that can store program codes.
[0171] Alternatively, if the above-mentioned integrated unit of the present application is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application can be essentially or in other words, the part that contributes to the relevant technology can be embodied in the form of a software product, which is stored in a storage medium and includes a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROM, RAM, magnetic disks or optical disks.
[0172] In an exemplary embodiment, the embodiment of the present application further provides a computer program product, including a computer program, which can be executed by the processor 702 of the electronic device to complete the steps described in the cross-platform task adaptation method of the embodiment of the present application.
[0173] It should be noted that: "first", "second", etc. are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0174] In addition, the technical solutions described in the embodiments of the present application can be arbitrarily combined without conflict.
[0175] The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in the present application should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.
Claims
1. A cross-platform task adaptation method, characterized in that: The method comprises: Get the task to be calculated; Determining an evaluation value of the computational cost of each target hardware acceleration platform executing the task to be computed based on multiple preset computational cost gradient information corresponding to each target hardware acceleration platform among the multiple target hardware acceleration platforms; each preset computational cost gradient information corresponds to a computing action, and each preset computational cost gradient information represents the computational cost of the corresponding target hardware acceleration platform when executing the same computing action of different data scales; the computational cost represents the efficiency and / or computing power utilization of the target hardware acceleration platform when executing the task to be computed; Based on the evaluation value of the computation cost of each target hardware acceleration platform in executing the task to be computed, a target hardware acceleration platform for executing the task to be computed is determined.
2. The method according to claim 1, characterized in that The task to be calculated includes multiple calculation actions; based on multiple preset calculation cost gradient information corresponding to each target hardware acceleration platform in the multiple target hardware acceleration platforms, determining an evaluation value of the calculation cost of each target hardware acceleration platform performing the task to be calculated, including: Determining a sub-operation cost for each target hardware acceleration platform to execute each operation action based on a size of operation data corresponding to each operation action in the to-be-operated task and a plurality of preset operation cost gradient information corresponding to each target hardware acceleration platform; Based on the sub-operation cost of each target hardware acceleration platform executing each operation action, an evaluation value of the operation cost of each target hardware acceleration platform executing the task to be calculated is determined.
3. The method according to claim 2, characterized in that The step of determining an evaluation value of the computation cost of the target hardware acceleration platform executing the task to be computed based on the sub-computation cost of each computation action executed by the target hardware acceleration platform includes: Based on the preset affinity weight corresponding to each target hardware acceleration platform, the preset sub-affinity weight corresponding to each computing action, and the sub-computation cost of executing all computing actions in the task to be calculated, the evaluation value of the computing cost of each target hardware acceleration platform executing the task to be calculated is determined; the preset affinity weight represents the priority of the target hardware acceleration platform, and the preset sub-affinity weight represents the adaptability of the computing action to the target hardware acceleration platform.
4. The method according to claim 1, characterized in that The step of determining a target hardware acceleration platform for executing the task to be calculated based on an evaluation value of a computational cost of the target hardware acceleration platform executing the task to be calculated comprises: Calculate the difference in the evaluation value of the computational cost between each two target hardware acceleration platforms; If the difference is greater than the threshold, determining a target hardware acceleration platform for executing the task to be calculated based on an evaluation value of the computational cost of the target hardware acceleration platform executing the task to be calculated; If there is no case where the difference is greater than the threshold, the target hardware acceleration platform for executing the task to be calculated is determined based on a preset selection order of the target hardware acceleration platform.
5. The method according to claim 4, characterized in that: If the difference is greater than the threshold, determining a target hardware acceleration platform for executing the task to be calculated based on an evaluation value of a computational cost of each target hardware acceleration platform executing the task to be calculated includes: A target hardware acceleration platform with the smallest evaluation value of the computation cost is selected to execute the task to be computed.
6. The method according to claim 1, characterized in that After determining a target hardware acceleration platform for computing the task to be computed based on an evaluation value of a computational cost of each target hardware acceleration platform executing the task to be computed, the method further includes: Obtaining an execution result of the task to be calculated; the execution result includes a real sub-operation cost of each operation action in the task to be calculated executed by the target hardware acceleration platform of the task to be calculated; Based on the actual sub-operation cost of each operation action in the task to be calculated executed by the target hardware acceleration platform that executes the task to be calculated, the preset operation cost gradient information of the corresponding target hardware acceleration platform is updated.
7. The method according to claim 6, characterized in that The obtaining of the execution result of the task to be calculated includes: Generate a native transfer file based on preset rules; the native transfer file includes device description information and computing task description information of the target hardware acceleration platform; Updating the estimated value of the computation cost of the target hardware acceleration platform into the device description information of the native streaming file; Based on the device description information and computing task description information in the updated native flow file, the task to be computed is pushed to a target hardware acceleration platform for executing the task to be computed.
8. An electronic device, characterized in that: include: A processor and a memory for storing a computer program capable of being executed on the processor, wherein The processor is configured to execute the steps of the method according to claims 1 to 7 when running a computer program.
9. A computer storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to claims 1 to 7 are implemented.
10. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the computer program implements the steps of the method according to any one of claims 1 to 7.
