Data processing method, system, product, equipment and medium based on mixed precision

By unifying the operator names in the deep learning framework and using hardware operator black and white lists, the problem of inconsistent operator names between different deep learning frameworks is solved, unified adaptation of the deep learning framework and computing equipment is achieved, and maintenance costs and Adaptation difficulty.

CN118378727BActive Publication Date: 2024-09-03LANGCHAO ELECTRONIC INFORMATION IND CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202410834403.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-26
Publication Date
2024-09-03
Estimated Expiration
2044-06-26

AI Technical Summary

Technical Problem

The operator names between different deep learning frameworks are inconsistent, resulting in difficult adaptation, low efficiency, and high cost. It is necessary to maintain a separate black and white list for each deep learning framework to indicate the data accuracy of the operator in the computing device.

Method used

By unifying operator names and using hardware operator black and white lists to replace the black and white lists in each deep learning framework, we can achieve unification among deep learning frameworks and reduce adaptation difficulty and maintenance costs.

Benefits of technology

It reduces the difficulty of adaptation between deep learning frameworks and computing devices, reduces maintenance costs, improves development efficiency, and achieves unified adaptation between deep learning frameworks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118378727B
    Figure CN118378727B
Patent Text Reader

Abstract

The present invention discloses a data processing method, system, product, device and medium based on mixed precision, which relates to the field of artificial intelligence. To solve the problem of low adaptation efficiency of deep learning framework and computing device, the method includes obtaining a hardware black and white list corresponding to the target computing device; using the target deep learning framework to analyze the preset model to obtain multiple current operators; determining the execution accuracy of multiple current operators according to the standard names of multiple current operators and the hardware black and white list; and controlling the target computing device to perform operator calculation on the input data according to the execution accuracy of the executed operator. The present invention unifies the operator names in each deep learning framework, reduces the ambiguity of the operator names in different deep learning frameworks, replaces the black and white lists in each deep learning framework with the hardware operator black and white list as the benchmark, and realizes the unification between each deep learning framework, thereby reducing the adaptation difficulty of the deep learning framework and the computing device and reducing the maintenance cost.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence, and in particular to a data processing method, system, product, device and medium based on mixed precision. Background Art

[0002] Automatic Mixed Precision (AMP) training is a technology that automatically selects appropriate data precision (such as single-precision FP32, half-precision FP16, or Bfloat16) for different operators during deep learning model training to improve training performance and efficiency. It has been widely used in multiple deep learning frameworks. Due to the different characteristics of each deep learning framework, the training strategies for automatic mixed precision training applied to each deep learning framework are different. In order to meet the needs of different application scenarios, each deep learning framework and each computing device need to be adapted one-to-one. However, the same operator may correspond to different operator names in different deep learning frameworks. Each deep learning framework needs to separately maintain its own black and white lists to indicate the data precision of the operator when it is executed in the computing device, which makes adaptation difficult, inefficient, and costly.

[0003] Therefore, how to provide a solution to the above technical problems is a problem that those skilled in the art need to solve at present. Summary of the invention

[0004] The purpose of the present invention is to provide a data processing method, system, product, device and medium based on mixed precision, which unifies the operator names in various deep learning frameworks, reduces the ambiguity of operator names in different deep learning frameworks, replaces the black and white lists in various deep learning frameworks with the hardware operator black and white lists as the benchmark, and achieves unification among the deep learning frameworks, thereby reducing the adaptation difficulty of deep learning frameworks and computing devices and reducing maintenance costs.

[0005] In order to solve the above technical problems, the present invention provides a data processing method based on mixed precision, comprising:

[0006] Determine a target deep learning framework and a target computing device corresponding to the current application scenario from among a plurality of candidate deep learning frameworks and a plurality of candidate computing devices;

[0007] Obtaining a hardware black and white list corresponding to the target computing device; the hardware black and white list includes a correspondence between a standard name of an operator and an execution precision;

[0008] Analyzing a preset model using the target deep learning framework to obtain a plurality of current operators, and determining standard names of the plurality of current operators according to initial names of the plurality of current operators under the target deep learning framework;

[0009] Determine the execution precision of the multiple current operators according to the standard names of the multiple current operators and the hardware black and white lists; the execution precision of the multiple current operators includes at least two types;

[0010] Each of the multiple current operators is used as an execution operator in turn, and the target computing device is controlled to perform operator calculation on the input data corresponding to the execution operator according to the execution accuracy of the execution operator, and the calculation result is output.

[0011] The execution precision of the plurality of operators includes single-precision floating point type and half-precision floating point type;

[0012] Before obtaining the hardware blacklist and whitelist corresponding to the target computing device, the mixed precision-based data processing method further includes:

[0013] Determining characteristic information of each of the operators;

[0014] Adding the standard name of the operator to a whitelist or a blacklist according to the characteristic information of the operator; the execution precision of the operator in the whitelist is the half-precision floating point type, and the execution precision of the operator in the blacklist is the single-precision floating point type;

[0015] A hardware blacklist and whitelist corresponding to the candidate computing device is obtained according to the whitelist and the blacklist.

[0016] The blacklist includes a general blacklist and a characteristic blacklist, the whitelist includes a general whitelist and a characteristic whitelist, and the process of determining the characteristic information of each operator includes:

[0017] Determining characteristic information of each first operator, where the first operator is the operator supported by the plurality of candidate computing devices;

[0018] Determining characteristic information of each second operator, where the second operator is the operator independently supported by each of the candidate computing devices;

[0019] The process of adding the standard name of the operator to the whitelist or blacklist according to the characteristic information of the operator includes:

[0020] Adding the standard name of the first operator to a general whitelist or a general blacklist according to the characteristic information of the first operator;

[0021] The standard name of the second operator is added to a characteristic whitelist or a characteristic blacklist corresponding to the candidate computing device according to the characteristic information of the second operator.

[0022] The process of obtaining the hardware blacklist and whitelist corresponding to the candidate computing device according to the whitelist and the blacklist includes:

[0023] The hardware blacklist corresponding to the candidate computing device is obtained according to the universal whitelist, the universal whitelist, the characteristic whitelist and the characteristic blacklist corresponding to the candidate computing device.

[0024] The process of adding the standard name of the second operator to the characteristic whitelist or characteristic blacklist corresponding to the candidate computing device according to the characteristic information of the second operator includes:

[0025] Based on a custom instruction output by a user according to the characteristic information of the second operator, the standard name of the second operator is added to a characteristic whitelist or a characteristic blacklist corresponding to the candidate computing device.

[0026] Wherein, before determining the standard names of the multiple current operators according to the initial names of the multiple current operators in the target deep learning framework, the data processing method based on mixed precision further includes:

[0027] Obtaining a standard name of each of the operators and a starting name of each of the operators in a plurality of the candidate deep learning frameworks;

[0028] For each of the operators, a mapping relationship between all the starting names and the standard names is established;

[0029] The process of determining the standard names of the multiple current operators according to the initial names of the multiple current operators in the target deep learning framework includes:

[0030] Determine the standard names of the multiple current operators according to the initial names of the multiple current operators in the target deep learning framework and the mapping relationship.

[0031] The process of obtaining the standard name of each operator and the initial name of each operator in the plurality of candidate deep learning frameworks includes:

[0032] Obtaining the initial name of each of the operators in each of the deep learning frameworks;

[0033] For each of the operators, a standard name of the operator is determined according to all the initial names of the operator.

[0034] The process of controlling the target computing device to perform operator calculation on the input data corresponding to the execution operator according to the execution accuracy of the execution operator includes:

[0035] Determine an execution floating point type of the target computing device from the half-precision floating point types supported by the target computing device; the execution floating point type is a half-precision floating point or a brain floating point;

[0036] When the execution precision of the execution operator is the half-precision floating point type, controlling the target computing device to perform operator calculation on the input data corresponding to the execution operator according to the execution floating point type;

[0037] When the execution precision of the execution operator is a single-precision floating-point type, the target computing device is controlled to perform operator calculation on input data corresponding to the execution operator according to the single-precision floating-point type.

[0038] The process of determining the execution floating-point type of the target computing device from the half-precision floating-point types supported by the target computing device includes:

[0039] When the half-precision floating-point type supported by the target computing device includes the half-precision floating point and the brain floating point, the half-precision floating-point type supported by the target deep learning framework is determined as the execution floating-point type of the target computing device; the half-precision floating-point type supported by the target deep learning framework is the half-precision floating point or the brain floating point.

[0040] Before determining the half-precision floating-point type supported by the target deep learning framework as the execution floating-point type of the target computing device, the mixed-precision data processing method further includes:

[0041] The half-precision floating-point type supported by the target deep learning framework is configured based on a setting instruction output by a user according to characteristic information of the target deep learning framework.

[0042] The process of using the target deep learning framework to analyze the preset model and obtain multiple current operators includes:

[0043] Analyzing a preset model using the deep learning framework to obtain multiple current operators and the execution order of the multiple current operators;

[0044] According to the execution order, each of the multiple current operators is sequentially used as an execution operator.

[0045] Wherein, before controlling the target computing device to perform operator calculation on the input data corresponding to the execution operator according to the execution precision of the execution operator, the data processing method based on mixed precision further includes:

[0046] Determining whether the execution operator is a specialized operator;

[0047] If the execution operator is the specialized operator, controlling the target computing device to perform specialized calculations on the input data corresponding to the execution operator and outputting the calculation results;

[0048] The process of controlling the target computing device to perform operator calculation on input data corresponding to the execution operator according to the execution accuracy of the execution operator includes:

[0049] If the execution operator is not the specialized operator, perform operator calculation on the input data corresponding to the execution operator according to the execution accuracy of the execution operator, and output the calculation result.

[0050] Before determining whether the execution operator is a specialized operator, the mixed precision-based data processing method further includes:

[0051] Obtaining a specialized processing table supported by the plurality of candidate computing devices, wherein the specialized processing table includes standard names of specialized operators;

[0052] The process of determining whether the execution operator is a specialized operator includes:

[0053] Perform name matching in the specialized processing table according to the standard name of the execution operator;

[0054] If the standard name of the execution operator exists in the specialized processing table, determining that the execution operator is the specialized operator;

[0055] If the standard name of the execution operator does not exist in the specialized processing table, it is determined that the execution operator is not the specialized operator.

[0056] Wherein, the data processing method based on mixed precision also includes:

[0057] In response to a user adjustment instruction, the standard name of the specialized operator in the specialized processing table is adjusted; the user adjustment instruction includes a specialized operator adding instruction and a specialized operator deleting instruction.

[0058] The process of determining whether the execution operator is a specialized operator includes:

[0059] Determine whether the execution precision of the execution operator is a half-precision floating point type;

[0060] If the execution precision of the execution operator is the half-precision floating point type, determine whether the execution operator is a specialized operator.

[0061] Wherein, if the execution operator is the specialized operator, the process of controlling the target computing device to perform specialized calculations on the input data corresponding to the execution operator and outputting the calculation results includes:

[0062] If the execution operator is the specialized operator, convert the input data corresponding to the execution operator from the half-precision floating point type to the single-precision floating point type to obtain intermediate data;

[0063] Controlling the target computing device to perform operator calculation on the intermediate data according to the single-precision floating-point type to obtain result data;

[0064] The result data is converted from the single-precision floating-point type to the half-precision floating-point type to obtain a calculation result.

[0065] Wherein, before converting the result data from the single-precision floating-point type to the half-precision floating-point type, the mixed-precision data processing method further includes:

[0066] Assigning a value to a type identifier according to the half-precision floating-point type of the input data of the execution operator; when the half-precision floating-point type is a half-precision floating point, assigning the type identifier to a first preset value; and when the half-precision floating-point type is a half-precision floating point, assigning the type identifier to a second preset value;

[0067] The process of converting the result data from the single-precision floating-point type to the half-precision floating-point type includes:

[0068] The result data is converted from the single-precision floating-point type to the half-precision floating-point type according to the value of the type identifier.

[0069] In order to solve the above technical problems, the present invention further provides a data processing system based on mixed precision, comprising:

[0070] A first determination module determines a target deep learning framework and a target computing device corresponding to the current application scenario from among multiple candidate deep learning frameworks and multiple candidate computing devices, and uses the target deep learning framework to analyze a preset model to obtain multiple current operators;

[0071] An operator mapping module, used to determine the standard names of the multiple current operators according to the initial names of the multiple current operators in the target deep learning framework;

[0072] A precision analysis module, used to obtain a hardware black and white list corresponding to the target computing device, and determine the execution precision of multiple current operators according to the standard names of multiple current operators and the hardware black and white list; the execution precision of multiple current operators includes at least two types, and the hardware black and white list includes the corresponding relationship between the standard name of the operator and the execution precision;

[0073] The operator scheduling module is used to use each of the multiple current operators as an execution operator in turn, control the target computing device to perform operator calculation on the input data corresponding to the execution operator according to the execution accuracy of the execution operator, and output the calculation result.

[0074] To solve the above technical problems, the present invention also provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of the mixed-precision data processing method as described in any one of the above.

[0075] In order to solve the above technical problems, the present invention further provides an electronic device, comprising:

[0076] Memory for storing computer programs;

[0077] A processor is used to implement the steps of the mixed precision data processing method as described in any one of the above when executing the computer program.

[0078] To solve the above technical problems, the present invention also provides a non-volatile storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the mixed-precision data processing method as described in any one of the above are implemented.

[0079] The present invention provides a data processing method based on mixed precision, which unifies the names of operators in various alternative deep learning frameworks, reduces the ambiguity of operator names in different deep learning frameworks, replaces the black and white lists in various deep learning frameworks with the hardware operator black and white lists as the benchmark, and realizes the unification between various deep learning frameworks. The hardware black and white lists store the correspondence between the standard names of operators and the execution precision. Each deep learning framework only needs to connect to the hardware black and white lists once to connect to multiple computing devices, and control the computing devices to perform operator calculations on data input according to the corresponding execution precision, which can effectively solve the problem of investing too much development time due to differences between different deep learning frameworks, reduce the difficulty of adaptation between deep learning frameworks and computing devices, and reduce maintenance costs. The present invention also provides a data processing system, electronic device, computer program product and non-volatile storage medium based on mixed precision, which have the same beneficial effects as the above-mentioned data processing method based on mixed precision. BRIEF DESCRIPTION OF THE DRAWINGS

[0080] In order to more clearly illustrate the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0081] Figure 1 A flow chart of the steps of a data processing method based on mixed precision provided by the present invention;

[0082] Figure 2 A flowchart of another mixed precision data processing method provided by the present invention;

[0083] Figure 3 A specialized operator processing flow chart provided by the present invention;

[0084] Figure 4 A schematic diagram of an automatic mixed-precision training strategy for an artificial intelligence computing power execution framework provided by the present invention;

[0085] Figure 5 A structural schematic diagram of a mixed-precision data processing system provided by the present invention;

[0086] Figure 6 A schematic diagram of the structure of an electronic device provided by the present invention;

[0087] Figure 7 A schematic diagram of the structure of a non-volatile storage medium provided by the present invention. DETAILED DESCRIPTION

[0088] The core of the present invention is to provide a data processing method, system, product, device and medium based on mixed precision, which unifies the operator names in various deep learning frameworks, reduces the ambiguity of operator names in different deep learning frameworks, and replaces the black and white lists in various deep learning frameworks with the hardware operator black and white lists as the benchmark, thereby achieving unification among the deep learning frameworks, thereby reducing the difficulty of adapting the deep learning framework and computing equipment and reducing maintenance costs.

[0089] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0090] First, please refer to Figure 1 , Figure 1 A flow chart of the steps of a mixed precision data processing method provided by the present invention, the mixed precision data processing method comprising:

[0091] S101: Determine a target deep learning framework and a target computing device corresponding to a current application scenario from among a plurality of candidate deep learning frameworks and a plurality of candidate computing devices;

[0092] Considering that in different application scenarios, different deep learning frameworks can be selected to perform deep learning model training based on mixed precision on different computing devices, therefore, in this embodiment, the deep learning framework that can be used for deep learning model training is determined as an alternative deep learning framework, and the computing device that can be used for deep learning model training is determined as an alternative computing device. Exemplarily, the alternative deep learning frameworks include but are not limited to the PaddlePaddle deep learning framework, the PyTorch deep learning framework, the MindSpore deep learning framework, etc., and the alternative computing devices include but are not limited to CPU (Central Processing Unit), GPU (Graphics Processing Unit), MLU (Machine Learning Unit), XPU (an FPGA-based intelligent cloud accelerator), TPU (Tensor Processing Unit), etc.

[0093] In this embodiment, the correspondence between each application scenario and the target deep learning framework and the target computing device can be pre-constructed. When the selection instruction corresponding to the current application scenario output by the user is received, the target deep learning framework and the target computing device are determined according to the current application scenario and the pre-constructed correspondence. In another optional embodiment, the user can output a first selection instruction according to the current application scenario, and the first selection instruction is used to select the target deep learning framework from all candidate deep learning frameworks, and output a second selection instruction according to the current application scenario, and the second selection instruction is used to select the target computing device from all candidate computing devices.

[0094] S102: Obtain a hardware blacklist and whitelist corresponding to the target computing device; the hardware blacklist and whitelist includes a correspondence between the standard name of the operator and the execution precision;

[0095] It can be understood that operators are functions or classes used to perform various mathematical operations and operations in deep learning, including but not limited to convolution operators, pooling operators, fully connected operators, transfer operators, activation functions, etc. By selecting the execution accuracy of operators, the training speed of deep learning models can be improved, and the accuracy of deep learning models can be maintained or improved.

[0096] In this embodiment, after determining the target computing device, the hardware black and white list corresponding to the target computing device is obtained. The hardware black and white list includes the corresponding relationship between the standard name of each operator and the execution accuracy of each operator. The same operator under each deep learning framework corresponds to a standard name. The hardware black and white list in this embodiment includes the corresponding relationship between the standard name of the operator and the execution accuracy, thereby reducing the ambiguity of the operator name under different deep learning frameworks and reducing the difficulty of adaptation between the deep learning framework and the computing device. Among them, the operators in the hardware black and white list include multiple operators supported by the target computing device and obtained by analyzing the preset model by each alternative deep learning framework.

[0097] S103: Analyzing a preset model using a target deep learning framework to obtain a plurality of current operators, and determining standard names of the plurality of current operators according to initial names of the plurality of current operators in the target deep learning framework;

[0098] When a target deep learning framework is selected, the preset model is analyzed by the target deep learning framework to obtain multiple current operators. The operators in the hardware black and white list include multiple current operators. By way of example, assuming that the operators in the hardware black and white list include OP1, OP2, OP3, OP4, OP5, OP6, and OP7, the multiple current operators obtained by analyzing the preset model by the target deep learning framework may include OP1, OP2, OP3, OP4, and OP5. Of course, the multiple current operators obtained by analyzing the preset model by the target deep learning framework may also include OP1, OP2, OP3, OP4, and OP8. OP8 is not in the hardware black and white list. The execution accuracy of OP8 can be determined according to the processing rules of the target deep learning framework, such as the execution accuracy of OP8 can be determined according to the data accuracy of the input data of OP8.

[0099] Taking into account that the same operator may have different operator names in different deep learning frameworks, this embodiment calls the operator name of the current operator in each deep learning framework the initial name of the operator. In order to reduce the difficulty of adaptation, this embodiment unifies the name of the same operator in each deep learning framework, that is, the same operator corresponds to a standard name. Therefore, after obtaining the initial name of the current operator in the target deep learning framework, the standard name of each current operator is determined based on the initial name of each current operator, so that the execution accuracy of the current operator can be subsequently determined based on the standard name.

[0100] S104: determining execution precisions of multiple current operators according to standard names of multiple current operators and hardware blacklists and whitelists; the execution precisions of the multiple current operators include at least two types;

[0101] In this embodiment, after determining the standard name of each current operator, a match is performed in the hardware black and white list according to the standard name of each current operator to determine the execution precision of each current operator. In this embodiment, the execution precision of multiple current operators includes single-precision floating point type and half-precision floating point type, wherein the single-precision floating point type is FP32, and the half-precision floating point type includes FP15 or BF16.

[0102] S105: taking each of the multiple current operators as an execution operator in turn, controlling the target computing device to perform operator calculation on input data corresponding to the execution operator according to the execution accuracy of the execution operator, and outputting the calculation result.

[0103] After determining the execution accuracy of each current operator, each of the multiple current operators is determined as an execution operator in turn according to a preset order, and then the execution operator is loaded onto the target computing device through operator scheduling, and the target computing device is controlled to execute the operator operation on the input data corresponding to the execution operator according to the execution accuracy of the execution operator to obtain the calculation result. Since the execution accuracy of multiple current operators is not the same, mixed precision model training can be implemented on the target computing device to improve training efficiency.

[0104] It can be understood that in the above embodiment, after obtaining the hardware black and white list, the process of determining the standard names of multiple current operators according to the initial names of multiple current operators under the target deep learning framework can be a process of obtaining the standard names of multiple current operators at one time and then performing operator scheduling in sequence, or each of the multiple current operators can be used as an execution operator in turn, and then the standard name of the execution operator is obtained, the execution operator call is performed, and this step is repeated until all current operators have been used as execution operators once.

[0105] Reference Figure 2 The above-mentioned data processing method based on mixed precision can be applied to a host device, on which a variety of deep learning frameworks are deployed, and the host device can also be connected to a variety of computing devices. On this basis, the data processing method based on mixed precision includes:

[0106] The host device receives a selection instruction;

[0107] The host device determines, based on the selection instruction, a target deep learning framework and a target computing device corresponding to the current application scenario from among a plurality of candidate deep learning frameworks and a plurality of candidate computing devices;

[0108] The host device obtains the hardware black and white list corresponding to the target computing device; the hardware black and white list includes the correspondence between the standard name of the operator and the execution precision;

[0109] The host device uses the target deep learning framework to analyze the preset model to obtain multiple current operators, and uses each current operator as an execution operator in turn;

[0110] The host device determines the standard name of the execution operator according to the initial name of the execution operator in the target deep learning framework;

[0111] The host device determines the execution precision of the execution operator based on the standard name of the execution operator and the hardware black and white list; the execution precision is a half-precision floating point type or a single-precision floating point type;

[0112] The host device sends the execution precision and input data of the execution operator to the target computing device;

[0113] The target computing device performs operator calculation on the input data according to the execution accuracy of the execution operator, obtains the calculation result, and returns the calculation result to the host device;

[0114] The host device outputs the calculation results.

[0115] It can be seen that in this embodiment, the operator names in each alternative deep learning framework are unified, the ambiguity of the operator names of different deep learning frameworks is reduced, and the black and white lists in each deep learning framework are replaced with the hardware operator black and white lists as the benchmark to achieve unification among the deep learning frameworks. The hardware black and white lists store the correspondence between the standard names of operators and the execution precision. Each deep learning framework only needs to connect to the hardware black and white lists once to connect to multiple computing devices, and control the computing devices to perform operator calculations on the data input according to the corresponding execution precision. This can effectively solve the problem of excessive development time invested due to differences between different deep learning frameworks, reduce the adaptation difficulty of deep learning frameworks, and reduce maintenance costs.

[0116] Based on the above embodiments:

[0117] In an exemplary embodiment, the execution precision of the plurality of operators includes a single-precision floating point type and a half-precision floating point type;

[0118] Before obtaining the hardware blacklist and whitelist corresponding to the target computing device, the data processing method based on mixed precision also includes:

[0119] Determine characteristic information of each operator;

[0120] The standard name of the operator is added to the whitelist or blacklist according to the characteristic information of the operator; the execution precision of the operators in the whitelist is half-precision floating point type, and the execution precision of the operators in the blacklist is single-precision floating point type;

[0121] The hardware blacklist and whitelist corresponding to the candidate computing device are obtained according to the whitelist and the blacklist.

[0122] In this embodiment, the characteristic information of the operator includes but is not limited to characteristics, data types, precision, etc. The execution precision of the operator can be determined according to the characteristics, data types, precision, etc. of the operator. For example, an operator with numerical security and a significant impact on model performance can choose low precision (half-precision floating point type) for calculation, and an operator with unstable numerical values ​​or not supporting FP16 can choose high precision (single-precision floating point type) for calculation, or select the execution precision of the operator based on experience. The hardware black and white list in this embodiment includes a blacklist and a whitelist, wherein the whitelist includes the standard names of operators that can be selected for low precision calculation, and the blacklist includes the standard names of operators that are selected for high precision calculation. After determining the standard name of the current operator, determine whether the standard name of the current operator is in the blacklist or in the whitelist. If it is in the blacklist, determine that the execution precision of the current operator is a single-precision floating point type, and if it is in the whitelist, determine that the execution precision of the current operator is a half-precision floating point type.

[0123] In an exemplary embodiment, the blacklist includes a general blacklist and a characteristic blacklist, the whitelist includes a general whitelist and a characteristic whitelist, and the process of determining the characteristic information of each operator includes:

[0124] Determining characteristic information of each first operator, where the first operator is an operator supported by the plurality of candidate computing devices;

[0125] Determining characteristic information of each second operator, where the second operator is an operator independently supported by each candidate computing device;

[0126] The process of adding the standard name of an operator to the whitelist or blacklist according to the characteristic information of the operator includes:

[0127] Adding the standard name of the first operator to a general whitelist or a general blacklist according to the characteristic information of the first operator;

[0128] Adding the standard name of the second operator to a characteristic whitelist or a characteristic blacklist corresponding to the candidate computing device according to the characteristic information of the second operator;

[0129] The hardware blacklist corresponding to the candidate computing device is obtained according to the general whitelist, the universal whitelist, the characteristic whitelist corresponding to the candidate computing device, and the characteristic blacklist.

[0130] In this embodiment, the hardware black and white list includes two parts, one is a general black and white list, and the other is a characteristic black and white list. The first operator in the general black and white list is an operator supported by all candidate computing devices, and the second operator in the characteristic black and white list is a unique operator of different data types supported by each candidate computing device or an operator that cannot be supported due to special reasons. Therefore, the hardware black and white list in this embodiment can not only reflect the common characteristics of each candidate computing device, but also fully reflect the unique characteristics of each candidate computing device.

[0131] In an exemplary embodiment, the process of adding the standard name of the second operator to the characteristic whitelist or characteristic blacklist corresponding to the candidate computing device according to the characteristic information of the second operator includes:

[0132] Based on the custom instruction output by the user according to the characteristic information of the second operator, the standard name of the second operator is added to the characteristic whitelist or characteristic blacklist corresponding to the candidate computing device.

[0133] In this embodiment, a user-defined interface may be reserved for users to customize operators in the characteristic blacklist and whitelist as needed. Specifically, the user may choose to add the second operator to the characteristic blacklist or the characteristic whitelist according to the characteristic information of the second operator to improve the flexibility of the adaptation process.

[0134] In an exemplary embodiment, before determining the standard names of the multiple current operators according to the initial names of the multiple current operators in the target deep learning framework, the data processing method based on mixed precision further includes:

[0135] Get the standard name of each operator and the starting name of each operator in multiple alternative deep learning frameworks;

[0136] For each operator, establish a mapping relationship between all starting names and standard names;

[0137] The process of determining the standard names of multiple current operators according to the initial names of multiple current operators in the target deep learning framework includes:

[0138] The standard names of the multiple current operators are determined according to the initial names and mapping relationships of the multiple current operators in the target deep learning framework.

[0139] In this embodiment, the same operator may have different initial names under different alternative deep learning frameworks. For example, the initial name of the convolution operator in the first alternative deep learning framework may be Conv2D, and the initial name of the convolution operator in the second alternative deep learning framework may be Convolution2D. In this embodiment, a standard name is set for the convolution operator, such as AAAA, and a mapping relationship between Conv2D and AAAA is established, as well as a mapping relationship between Convolution2D and AAAA. After obtaining the initial name of the current operator, the standard name of the current operator can be determined according to the corresponding mapping relationship.

[0140] When a new alternative deep learning framework is added, a mapping relationship is established between the operator names of each operator under the deep learning framework and the standard names.

[0141] In an exemplary embodiment, the process of obtaining the standard name of each operator and the initial name of each operator under multiple candidate deep learning frameworks includes:

[0142] Get the initial name of each operator in each deep learning framework;

[0143] For each operator, the standard name of the operator is determined based on all the initial names of the operator.

[0144] In this embodiment, the standard name of each operator can be randomly set to ensure that the initial name of the same operator can be mapped to the standard name. Of course, you can also select one from each initial name as the standard name to reduce the difficulty of mapping. For example, the initial name of the convolution operator includes but is not limited to Conv2D, Convolution2D, etc., and the standard name of the convolution operator can be determined as Conv2D. Of course, you can also select the initial name with the largest number of the same as the standard name. For example, assuming that the initial name of the convolution operator in the first alternative deep learning framework can be Conv2D, the initial name of the convolution operator in the second alternative deep learning framework is Convolution2D, and the initial name of the convolution operator in the third alternative deep learning framework is also Convolution2D, then you can select Convolution2D as the standard name of the convolution operator.

[0145] In an exemplary embodiment, the process of controlling the target computing device to perform operator calculation on input data corresponding to the execution operator according to the execution precision of the execution operator includes:

[0146] Determine the execution floating point type of the target computing device from the half-precision floating point types supported by the target computing device; the execution floating point type is a half-precision floating point or a brain floating point;

[0147] When the execution precision of the execution operator is a half-precision floating point type, controlling the target computing device to perform operator calculation on input data corresponding to the execution operator according to the execution floating point type;

[0148] When the execution precision of the execution operator is a single-precision floating-point type, the target computing device is controlled to perform operator calculation on input data corresponding to the execution operator according to the single-precision floating-point type.

[0149] In this embodiment, considering that different computing devices can support single-precision floating-point types, but the supported half-precision floating-point types vary due to different hardware infrastructure frameworks, such as XPU and NPU only support FP16 (half-precision floating point), some CPUs only support BF16 (brain floating point), and some GPUs, MLUs, etc. can support both FP16 and BF16. In order to further improve computing efficiency, after determining the target computing device, this embodiment selects a half-precision floating-point type from the half-precision floating-point types supported by the target computing device as the execution floating-point type when the operator is executed.

[0150] If the execution type determined according to the hardware black and white list is a half-precision floating point type, the target computing device is controlled to perform operator calculation on the input data according to the execution floating point type to improve the accuracy of the calculation result.

[0151] It can be understood that in one model training, only one execution floating-point type is set for the target computing device, that is, in one model training, the target computing device performs operator calculations using the same execution floating-point type.

[0152] In an exemplary embodiment, the process of determining the execution floating point type of the target computing device from the half-precision floating point types supported by the target computing device includes:

[0153] When the half-precision floating point types supported by the target computing device include half-precision floating point and brain floating point;

[0154] The half-precision floating-point type supported by the target deep learning framework is determined as the execution floating-point type of the target computing device; the half-precision floating-point type supported by the target deep learning framework is half-precision floating point or brain floating point.

[0155] In this embodiment, for a target computing device that supports both BF16 and FP16, the execution floating-point type is selected according to the half-precision floating-point type supported by the target deep learning framework. If the half-precision floating-point type supported by the target deep learning framework is BF16, the execution floating-point type is BF16; if the half-precision floating-point type supported by the target deep learning framework is FP16, the execution floating-point type is FP16.

[0156] Of course, in another embodiment, for a target computing device that supports both BF16 and FP16, one of them can be randomly selected as the execution floating-point type according to actual engineering needs, and this embodiment does not limit this.

[0157] It can be understood that when the half-precision floating-point type supported by the target deep learning framework conflicts with the half-precision floating-point type supported by the target computing device, the half-precision floating-point type supported by the target computing device is used as the basis for selecting the execution floating-point type. That is, if the half-precision floating-point type supported by the target deep learning framework is BF16, and the target computing device only supports FP16, FP16 is selected as the execution floating-point type.

[0158] In an exemplary embodiment, before determining the half-precision floating-point type supported by the target deep learning framework as the execution floating-point type of the target computing device, the mixed-precision data processing method further includes:

[0159] The half-precision floating-point type supported by the target deep learning framework is configured based on the setting instructions output by the user according to the characteristic information of the target deep learning framework. In this embodiment, a user-defined interface is reserved so that the user can configure the half-precision floating-point type supported by the target deep learning framework according to the setting instructions output by the characteristic information of the target deep learning framework, thereby improving the flexibility of adaptation between the deep learning framework and the computing device.

[0160] In an exemplary embodiment, the process of analyzing a preset model using a target deep learning framework to obtain multiple current operators includes:

[0161] Use the deep learning framework to analyze the preset model to obtain multiple current operators and the execution order of multiple current operators;

[0162] In the execution order, each current operator among the multiple current operators is sequentially used as an execution operator.

[0163] In this embodiment, while a preset model is analyzed using a deep learning framework to obtain multiple current operators, the execution order of the multiple current operators can also be obtained. Assuming that the multiple current operators include OP1, OP2, OP3, OP4, and OP5, and the execution order from front to back is OP3, OP2, OP1, OP4, and OP5, OP3 is first used as the first execution operator. After the operator calculation of OP3 is completed, OP2 is used as the new execution operator, and so on, until the operator calculation of OP5 is completed. The execution order is obtained by analyzing the preset model, and the operators are scheduled in sequence according to the execution order to improve the efficiency of model mixed precision training on the target computing device.

[0164] In an exemplary embodiment, before controlling the target computing device to perform operator calculation on input data corresponding to the execution operator according to the execution precision of the execution operator, the data processing method based on mixed precision further includes:

[0165] Determine whether the executed operator is a specialized operator;

[0166] If the execution operator is a specialized operator, control the target computing device to perform specialized calculations on the input data corresponding to the execution operator and output the calculation results;

[0167] The process of controlling the target computing device to perform operator calculation on input data corresponding to the execution operator according to the execution accuracy of the execution operator includes:

[0168] If the execution operator is not a specialized operator, the operator calculation is performed on the input data corresponding to the execution operator according to the execution accuracy of the execution operator, and the calculation result is output.

[0169] This embodiment also explains the processing of specialized operators. Specialized operators are used to optimize the calculation process, and the performance of operators needs to be improved through specialized calculations. Specialized operators will not change due to different computing devices. Specialized operators are specified based on prior knowledge and mainly include reduction operators and some data function operators.

[0170] First, it is determined whether the current operator is a specialized operator. If it is a specialized operator, specialized calculation is performed. If it is not a specialized operator, the operation of S105 is executed.

[0171] In an exemplary embodiment, before determining whether the execution operator is a specialized operator, the data processing method based on mixed precision further includes:

[0172] Obtain a specialized processing table supported by multiple candidate computing devices, wherein the specialized processing table includes standard names of specialized operators;

[0173] The process of determining whether an executed operator is a specialized operator includes:

[0174] Perform name matching in the specialization table according to the standard name of the execution operator;

[0175] If the standard name of the execution operator exists in the specialization table, the execution operator is determined to be a specialization operator;

[0176] If the standard name of the execution operator does not exist in the specialized processing table, it is determined that the execution operator is not a specialized operator.

[0177] In an exemplary embodiment, the data processing method based on mixed precision further includes:

[0178] In response to a user adjustment instruction, the standard name of the specialized operator in the specialized processing table is adjusted; the user adjustment instruction includes a specialized operator adding instruction and a specialized operator deleting instruction.

[0179] In this embodiment, a specialized operator table is pre-established. The specialized operator table is a unified table that will not change due to different computing devices. It is formulated based on prior knowledge and mainly includes specification operators and some data function operators. At the same time, a custom interface is reserved for users to increase or decrease specialized operators as needed.

[0180] It can be understood that the specialized operator table includes the standard name of each specialized operator. The standard name of the current operator is matched in the specialized operator table. If the match is successful, that is, the specialized operator table includes the standard name of the current operator, it means that the current operator is a specialized operator, otherwise it is a common operator.

[0181] In this embodiment, specialized operators are processed uniformly, and developers do not need to adapt specialized operator processing functions for each deep learning framework separately, thereby accelerating the adaptation efficiency of the deep learning framework.

[0182] In an exemplary embodiment, the process of determining whether an execution operator is a specialized operator includes:

[0183] Determine whether the execution precision of the operator is half-precision floating point type;

[0184] If the execution precision of the execution operator is a half-precision floating-point type, determine whether the execution operator is a specialized operator.

[0185] In order to avoid affecting the normal execution of the operator, in this embodiment, only the half-precision floating-point type is converted into a data type, and the other data types are executed normally.

[0186] In an exemplary embodiment, if the execution operator is a specialized operator, the process of controlling the target computing device to perform specialized calculations on input data corresponding to the execution operator and outputting the calculation results includes:

[0187] If the execution operator is a specialized operator, the input data corresponding to the execution operator is converted from a half-precision floating-point type to a single-precision floating-point type to obtain intermediate data;

[0188] Control the target computing device to perform operator calculation on the intermediate data according to the single-precision floating-point type to obtain result data;

[0189] The result data is converted from single-precision floating-point type to half-precision floating-point type to obtain the calculation result.

[0190] In this embodiment, specialized processing is explained. The specialized processing is a process of converting half-precision floating-point input to single-precision floating-point type, using single-precision floating-point type for operator calculation, and converting operator output from single-precision floating-point type to half-precision floating-point type after the calculation is completed.

[0191] In an exemplary embodiment, before converting the result data from a single-precision floating-point type to a half-precision floating-point type, the mixed-precision data processing method further includes:

[0192] Assign a value to the type identifier according to the half-precision floating point type of the input data of the execution operator; when the half-precision floating point type is a half-precision floating point, assign the type identifier to a first preset value; when the half-precision floating point type is a half-precision floating point, assign the type identifier to a second preset value;

[0193] The process of converting the result data from single-precision floating-point type to half-precision floating-point type includes:

[0194] Convert the resulting data from single-precision floating-point type to half-precision floating-point type according to the value of the type identifier.

[0195] This embodiment sets a type identifier in the specialization process to distinguish whether the half-precision floating-point type is float16 (FP16) or bfloat16 (BF16), thereby ensuring that the output result data can be correctly converted to the half-precision data type. Figure 3 As shown, the specialized processing process in this embodiment includes analyzing the half-precision data type of the input data, assigning a value to the type identifier, and saving it. Secondly, the input data is converted from the half-precision floating-point type to the single-precision floating-point type. Next, through operator scheduling, the operator operation of the single-precision floating-point type is executed and the output is calculated. Finally, according to the operator execution precision recorded in the type identifier, the result data is converted from the single-precision floating-point type to the half-precision floating-point type, and the result data is output.

[0196] It can be understood that specialized operators are independent and customizable, and operator specialization will not affect the normal execution of the operator, nor will it change the execution order of the operator.

[0197] In an exemplary embodiment, the above embodiments may be executed by an AI (Artificial Intelligence) computing power execution framework deployed on a host, referring to Figure 4 As shown, Figure 4 This is a schematic diagram of the automatic mixed precision training strategy for the AI ​​computing power execution framework, including the model operator part, the deep learning framework part, the artificial intelligence computing power execution framework part, and the heterogeneous device part. The model operator part includes multiple operators, such as Figure 4The first operator, the second operator, the third operator, the fourth operator, etc. shown in FIG. 1 , the deep learning framework part includes a variety of deep learning frameworks, such as Figure 4 The first deep learning framework, the second deep learning framework, etc. shown in the figure, the computing device part includes a variety of heterogeneous devices, such as Figure 4 The central processing unit, graphics processing unit, machine learning machine, tensor processor, etc. shown in the figure, the automatic mixed precision training module in the artificial intelligence computing power execution framework is connected to different deep learning frameworks upward, and the operator scheduling module in the AI ​​computing power execution framework is connected to various computing devices downward to solve the problem of automatic mixed precision training between heterogeneous frameworks. A deep learning framework only needs to connect to the AI ​​computing power execution framework once to complete the adaptation of multiple computing devices, which greatly saves development costs, can effectively improve the model training speed of the AI ​​computing power execution framework, and improve resource utilization efficiency while ensuring accuracy. The hardware black and white lists maintained by the AI ​​computing power execution framework unify the operator names from the perspective of the AI ​​computing power execution framework, reduce the differences in the operator names of different deep learning frameworks, and reduce the difficulty of adapting the deep learning framework to the AI ​​computing power execution framework. The AI ​​computing power execution framework maintains a specialized operator table to uniformly process specialized operators. Developers do not need to adapt the specialized operator processing functions for each deep learning framework separately, which accelerates the adaptation efficiency of the deep learning framework. It can effectively solve the problem of investing too much development time due to differences between different deep learning frameworks, reduce the adaptation difficulty of the deep learning framework, and reduce maintenance costs. At the same time, the present invention provides an automatic mixed precision training solution template for the AI ​​computing power execution framework, and provides a basic solution for subsequent performance optimization of the AI ​​computing power execution framework.

[0198] Second, please refer to Figure 5 , Figure 5 A structural schematic diagram of a mixed-precision data processing system provided by the present invention, the mixed-precision data processing system comprising:

[0199] A first determination module 11 determines a target deep learning framework and a target computing device corresponding to a current application scenario from among multiple candidate deep learning frameworks and multiple candidate computing devices, and uses the target deep learning framework to analyze a preset model to obtain multiple current operators;

[0200] An operator mapping module 12, used to determine the standard names of multiple current operators according to the initial names of the multiple current operators in the target deep learning framework;

[0201] The precision analysis module 13 is used to obtain the hardware black and white list corresponding to the target computing device, and determine the execution precision of multiple current operators according to the standard names of multiple current operators and the hardware black and white list; the execution precision of multiple current operators includes at least two types, and the hardware black and white list includes the corresponding relationship between the standard name of the operator and the execution precision;

[0202] The operator scheduling module 14 is used to use each of the multiple current operators as an execution operator in turn, control the target computing device to perform operator calculation on the input data corresponding to the execution operator according to the execution accuracy of the execution operator, and output the calculation result.

[0203] In an exemplary embodiment, the execution precision of the plurality of operators includes a single-precision floating point type and a half-precision floating point type;

[0204] The mixed precision data processing system also includes:

[0205] A second determination module is used to determine characteristic information of each operator before obtaining the hardware blacklist and whitelist corresponding to the target computing device;

[0206] Add a module to add the standard name of the operator to the whitelist or blacklist according to the characteristic information of the operator; the execution precision of the operators in the whitelist is half-precision floating point type, and the execution precision of the operators in the blacklist is single-precision floating point type;

[0207] The list acquisition module is used to obtain the hardware blacklist and whitelist corresponding to the candidate computing device according to the whitelist and the blacklist.

[0208] In an exemplary embodiment, the blacklist includes a general blacklist and a characteristic blacklist, the whitelist includes a general whitelist and a characteristic whitelist, and the process of determining the characteristic information of each operator includes:

[0209] Determining characteristic information of each first operator, where the first operator is an operator supported by the plurality of candidate computing devices;

[0210] Determining characteristic information of each second operator, where the second operator is an operator independently supported by each candidate computing device;

[0211] The process of adding the standard name of an operator to the whitelist or blacklist according to the characteristic information of the operator includes:

[0212] Adding the standard name of the first operator to a general whitelist or a general blacklist according to the characteristic information of the first operator;

[0213] The standard name of the second operator is added to a characteristic whitelist or a characteristic blacklist corresponding to the candidate computing device according to the characteristic information of the second operator.

[0214] In an exemplary embodiment, the process of obtaining the hardware blacklist and whitelist corresponding to the candidate computing device according to the whitelist and the blacklist includes:

[0215] The hardware blacklist corresponding to the candidate computing device is obtained according to the general whitelist, the universal whitelist, the characteristic whitelist corresponding to the candidate computing device, and the characteristic blacklist.

[0216] In an exemplary embodiment, the process of adding the standard name of the second operator to the characteristic whitelist or characteristic blacklist corresponding to the candidate computing device according to the characteristic information of the second operator includes:

[0217] Based on the custom instruction output by the user according to the characteristic information of the second operator, the standard name of the second operator is added to the characteristic whitelist or characteristic blacklist corresponding to the candidate computing device.

[0218] In an exemplary embodiment, the mixed precision-based data processing system further includes:

[0219] A name acquisition module, used to obtain the standard name of each operator and the starting name of each operator in multiple candidate deep learning frameworks before determining the standard names of multiple current operators according to the initial names of multiple current operators in the target deep learning framework;

[0220] For each operator, establish a mapping relationship between all starting names and standard names;

[0221] The process of determining the standard names of multiple current operators according to the initial names of multiple current operators in the target deep learning framework includes:

[0222] The standard names of the multiple current operators are determined according to the initial names and mapping relationships of the multiple current operators in the target deep learning framework.

[0223] In an exemplary embodiment, the process of obtaining the standard name of each operator and the initial name of each operator under multiple candidate deep learning frameworks includes:

[0224] Get the initial name of each operator in each deep learning framework;

[0225] For each operator, the standard name of the operator is determined based on all the initial names of the operator.

[0226] In an exemplary embodiment, the process of controlling the target computing device to perform operator calculation on input data corresponding to the execution operator according to the execution precision of the execution operator includes:

[0227] Determine the execution floating point type of the target computing device from the half-precision floating point types supported by the target computing device; the execution floating point type is a half-precision floating point or a brain floating point;

[0228] When the execution precision of the execution operator is a half-precision floating point type, controlling the target computing device to perform operator calculation on input data corresponding to the execution operator according to the execution floating point type;

[0229] When the execution precision of the execution operator is a single-precision floating-point type, the target computing device is controlled to perform operator calculation on input data corresponding to the execution operator according to the single-precision floating-point type.

[0230] In an exemplary embodiment, the process of determining the execution floating point type of the target computing device from the half-precision floating point types supported by the target computing device includes:

[0231] When the half-precision floating point types supported by the target computing device include half-precision floating point and brain floating point;

[0232] The half-precision floating-point type supported by the target deep learning framework is determined as the execution floating-point type of the target computing device; the half-precision floating-point type supported by the target deep learning framework is half-precision floating point or brain floating point.

[0233] In an exemplary embodiment, a mixed precision based data processing system includes:

[0234] An information configuration module is used to configure the half-precision floating-point type supported by the target deep learning framework based on a setting instruction output by a user according to characteristic information of the target deep learning framework before determining the half-precision floating-point type supported by the target deep learning framework as the execution floating-point type of the target computing device.

[0235] In an exemplary embodiment, the process of analyzing a preset model using a target deep learning framework to obtain multiple current operators includes:

[0236] Use the deep learning framework to analyze the preset model to obtain multiple current operators and the execution order of multiple current operators;

[0237] In the execution order, each current operator among the multiple current operators is sequentially used as an execution operator.

[0238] In an exemplary embodiment, the mixed precision-based data processing system further includes:

[0239] A specialization determination module, used to determine whether an execution operator is a specialized operator before controlling the target computing device to perform operator calculation on input data corresponding to the execution operator according to the execution accuracy of the execution operator;

[0240] If the execution operator is a specialized operator, control the target computing device to perform specialized calculations on the input data corresponding to the execution operator and output the calculation results;

[0241] The process of controlling the target computing device to perform operator calculation on input data corresponding to the execution operator according to the execution accuracy of the execution operator includes:

[0242] If the execution operator is not a specialized operator, the operator calculation is performed on the input data corresponding to the execution operator according to the execution accuracy of the execution operator, and the calculation result is output.

[0243] In an exemplary embodiment, the mixed precision-based data processing system further includes:

[0244] A table acquisition module, used for acquiring a specialized processing table supported by multiple candidate computing devices before determining whether the execution operator is a specialized operator, wherein the specialized processing table includes a standard name of the specialized operator;

[0245] The process of determining whether an executed operator is a specialized operator includes:

[0246] Perform name matching in the specialization table according to the standard name of the execution operator;

[0247] If the standard name of the execution operator exists in the specialization table, the execution operator is determined to be a specialization operator;

[0248] If the standard name of the execution operator does not exist in the specialized processing table, it is determined that the execution operator is not a specialized operator.

[0249] In an exemplary embodiment, the mixed precision-based data processing system further includes:

[0250] The adjustment module is used to adjust the standard names of the specialized operators in the specialized processing table in response to user adjustment instructions; the user adjustment instructions include specialized operator addition instructions and specialized operator deletion instructions.

[0251] In an exemplary embodiment, the process of determining whether an execution operator is a specialized operator includes:

[0252] Determine whether the execution precision of the operator is half-precision floating point type;

[0253] If the execution precision of the execution operator is a half-precision floating-point type, determine whether the execution operator is a specialized operator.

[0254] In an exemplary embodiment, if the execution operator is a specialized operator, the process of controlling the target computing device to perform specialized calculations on input data corresponding to the execution operator and outputting the calculation results includes:

[0255] If the execution operator is a specialized operator, the input data corresponding to the execution operator is converted from a half-precision floating-point type to a single-precision floating-point type to obtain intermediate data;

[0256] Control the target computing device to perform operator calculation on the intermediate data according to the single-precision floating-point type to obtain result data;

[0257] The result data is converted from single-precision floating-point type to half-precision floating-point type to obtain the calculation result.

[0258] In an exemplary embodiment, the mixed precision-based data processing system further includes:

[0259] An assignment module, used for assigning a value to a type identifier according to the half-precision floating point type of the input data of the execution operator before converting the result data from the single-precision floating point type to the half-precision floating point type; when the half-precision floating point type is a half-precision floating point, assigning the type identifier to a first preset value; when the half-precision floating point type is a half-precision floating point, assigning the type identifier to a second preset value;

[0260] The process of converting the result data from single-precision floating-point type to half-precision floating-point type includes:

[0261] Convert the resulting data from single-precision floating-point type to half-precision floating-point type according to the value of the type identifier.

[0262] In a third aspect, the present invention further provides a computer program product, comprising a computer program / instruction, which, when executed by a processor, implements the steps of the mixed-precision data processing method described in any one of the above embodiments.

[0263] For an introduction to a computer program product provided by the present invention, please refer to the above embodiments, and the present invention will not be described in detail here.

[0264] A computer program product provided by the present invention has the same beneficial effects as the above-mentioned data processing method based on mixed precision.

[0265] Fourth, please refer to Figure 6 The present invention also provides an electronic device, comprising:

[0266] A memory 21, used for storing computer programs;

[0267] The processor 22 is used to implement the steps of the mixed-precision data processing method described in any one of the above embodiments when executing a computer program.

[0268] The electronic device also includes:

[0269] The input interface 23 is connected to the processor 22 via the communication bus 26, and is used to obtain the computer programs, parameters and instructions imported from the outside, and save them in the memory 21 under the control of the processor 22. The input interface can be connected to an input device to receive parameters or instructions manually input by the user. The input device can be a touch layer covered on the display screen, or a key, trackball or touchpad set on the terminal housing.

[0270] The display unit 24 is connected to the processor 22 via the communication bus 26 and is used to display the data sent by the processor 22. The display unit can be a liquid crystal display or an electronic ink display.

[0271] The network port 25 is connected to the processor 22 via the communication bus 26, and is used to communicate with various external terminal devices. The communication technology used in the communication connection can be a wired communication technology or a wireless communication technology, such as mobile high-definition link technology, universal serial bus, high-definition multimedia interface, wireless fidelity technology, Bluetooth communication technology, low-power Bluetooth communication technology, communication technology based on IEEE802.11s, etc.

[0272] For an introduction to an electronic device provided by the present invention, please refer to the above embodiments, and the present invention will not be described in detail here.

[0273] An electronic device provided by the present invention has the same beneficial effects as the above-mentioned data processing method based on mixed precision.

[0274] Fifth, please refer to Figure 7 The present invention further provides a non-volatile storage medium 30, on which a computer program 31 is stored. When the computer program 31 is executed by a processor, the steps of the mixed-precision data processing method described in any of the above embodiments are implemented.

[0275] Among them, the non-volatile storage medium 30 may include: ROM (Read-only memory), PROM (Programmable read-only memory), EAROM (Electrically alterable read only memory), EPROM (Erasable programmable read only memory), EEPROM (Electrically erasable programmable read only memory), Flash memory and other media that can store program codes.

[0276] For an introduction to a non-volatile storage medium provided by the present invention, please refer to the above embodiments, and the present invention will not be described in detail here.

[0277] A non-volatile storage medium provided by the present invention has the same beneficial effects as the above-mentioned data processing method based on mixed precision.

[0278] It should also be noted that, in this specification, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprises", "comprising" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.

[0279] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A data processing method based on mixed precision, characterized in that: include: Determine a target deep learning framework and a target computing device corresponding to the current application scenario from among a plurality of candidate deep learning frameworks and a plurality of candidate computing devices; Obtaining a hardware blacklist and whitelist corresponding to the target computing device; the hardware blacklist and whitelist includes a correspondence between a standard name of an operator and an execution precision; the hardware blacklist and whitelist includes a blacklist and a whitelist; Analyzing a preset model using the target deep learning framework to obtain a plurality of current operators, and determining standard names of the plurality of current operators according to initial names of the plurality of current operators under the target deep learning framework; Determine the execution precision of the multiple current operators according to the standard names of the multiple current operators and the hardware black and white lists; the execution precision of the multiple current operators includes at least two types; the execution precision of the multiple current operators includes a single-precision floating point type and a half-precision floating point type, the execution precision of the operators in the white list is the half-precision floating point type, and the execution precision of the operators in the black list is the single-precision floating point type; Each of the multiple current operators is used as an execution operator in turn, and the target computing device is controlled to perform operator calculation on the input data corresponding to the execution operator according to the execution accuracy of the execution operator, and the calculation result is output.

2. The mixed precision data processing method according to claim 1, characterized in that: Before obtaining the hardware blacklist and whitelist corresponding to the target computing device, the mixed precision-based data processing method further includes: Determining characteristic information of each of the operators; Adding the standard name of the operator to a whitelist or a blacklist according to the characteristic information of the operator; A hardware blacklist and whitelist corresponding to the candidate computing device is obtained according to the whitelist and the blacklist.

3. The mixed precision data processing method according to claim 2, characterized in that: The blacklist includes a general blacklist and a characteristic blacklist, and the whitelist includes a general whitelist and a characteristic whitelist. The process of determining the characteristic information of each operator includes: Determining characteristic information of each first operator, where the first operator is the operator supported by the plurality of candidate computing devices; Determining characteristic information of each second operator, where the second operator is the operator independently supported by each of the candidate computing devices; The process of adding the standard name of the operator to the whitelist or blacklist according to the characteristic information of the operator includes: Adding the standard name of the first operator to a general whitelist or a general blacklist according to the characteristic information of the first operator; The standard name of the second operator is added to a characteristic whitelist or a characteristic blacklist corresponding to the candidate computing device according to the characteristic information of the second operator.

4. The mixed precision data processing method according to claim 3, characterized in that: The process of obtaining the hardware blacklist and whitelist corresponding to the candidate computing device according to the whitelist and the blacklist includes: The hardware blacklist corresponding to the candidate computing device is obtained according to the universal whitelist, the universal whitelist, the characteristic whitelist and the characteristic blacklist corresponding to the candidate computing device.

5. The mixed precision data processing method according to claim 3, characterized in that: The process of adding the standard name of the second operator to the characteristic whitelist or characteristic blacklist corresponding to the candidate computing device according to the characteristic information of the second operator includes: Based on a custom instruction output by a user according to the characteristic information of the second operator, the standard name of the second operator is added to a characteristic whitelist or a characteristic blacklist corresponding to the candidate computing device.

6. The mixed precision data processing method according to claim 1, characterized in that: Before determining the standard names of the multiple current operators according to the initial names of the multiple current operators in the target deep learning framework, the mixed precision-based data processing method further includes: Obtaining a standard name of each of the operators and a starting name of each of the operators in a plurality of the candidate deep learning frameworks; For each of the operators, a mapping relationship between all the starting names and the standard names is established; The process of determining the standard names of the multiple current operators according to the initial names of the multiple current operators in the target deep learning framework includes: Determine the standard names of the multiple current operators according to the initial names of the multiple current operators in the target deep learning framework and the mapping relationship.

7. The mixed precision data processing method according to claim 6, characterized in that: The process of obtaining the standard name of each operator and the initial name of each operator in the plurality of candidate deep learning frameworks includes: Obtaining the initial name of each of the operators in each of the deep learning frameworks; For each of the operators, a standard name of the operator is determined according to all the initial names of the operator.

8. The mixed precision data processing method according to claim 1, characterized in that: The process of controlling the target computing device to perform operator calculation on input data corresponding to the execution operator according to the execution accuracy of the execution operator includes: Determine an execution floating point type of the target computing device from the half-precision floating point types supported by the target computing device; the execution floating point type is a half-precision floating point or a brain floating point; When the execution precision of the execution operator is the half-precision floating point type, controlling the target computing device to perform operator calculation on the input data corresponding to the execution operator according to the execution floating point type; When the execution precision of the execution operator is a single-precision floating-point type, the target computing device is controlled to perform operator calculation on input data corresponding to the execution operator according to the single-precision floating-point type.

9. The mixed precision data processing method according to claim 8, characterized in that: The process of determining the execution floating point type of the target computing device from the half-precision floating point types supported by the target computing device comprises: When the half-precision floating-point type supported by the target computing device includes the half-precision floating point and the brain floating point, the half-precision floating-point type supported by the target deep learning framework is determined as the execution floating-point type of the target computing device; the half-precision floating-point type supported by the target deep learning framework is the half-precision floating point or the brain floating point.

10. The mixed precision data processing method according to claim 9, characterized in that: Before determining the half-precision floating-point type supported by the target deep learning framework as the execution floating-point type of the target computing device, the mixed-precision-based data processing method further includes: The half-precision floating-point type supported by the target deep learning framework is configured based on a setting instruction output by a user according to characteristic information of the target deep learning framework.

11. The mixed precision data processing method according to claim 1, characterized in that: The process of using the target deep learning framework to analyze the preset model to obtain multiple current operators includes: Analyzing a preset model using the deep learning framework to obtain multiple current operators and the execution order of the multiple current operators; According to the execution order, each of the multiple current operators is sequentially used as an execution operator.

12. The mixed precision data processing method according to any one of claims 1 to 11, characterized in that: Before controlling the target computing device to perform operator calculation on the input data corresponding to the execution operator according to the execution precision of the execution operator, the data processing method based on mixed precision further includes: Determining whether the execution operator is a specialized operator; If the execution operator is the specialized operator, controlling the target computing device to perform specialized calculations on the input data corresponding to the execution operator and outputting the calculation results; The process of controlling the target computing device to perform operator calculation on input data corresponding to the execution operator according to the execution accuracy of the execution operator includes: If the execution operator is not the specialized operator, perform operator calculation on the input data corresponding to the execution operator according to the execution accuracy of the execution operator, and output the calculation result.

13. The mixed precision data processing method according to claim 12, characterized in that: Before determining whether the execution operator is a specialized operator, the mixed precision-based data processing method further includes: Obtaining a specialized processing table supported by the plurality of candidate computing devices, wherein the specialized processing table includes standard names of specialized operators; The process of determining whether the execution operator is a specialized operator includes: Perform name matching in the specialized processing table according to the standard name of the execution operator; If the standard name of the execution operator exists in the specialized processing table, determining that the execution operator is the specialized operator; If the standard name of the execution operator does not exist in the specialized processing table, it is determined that the execution operator is not the specialized operator.

14. The mixed precision data processing method according to claim 13, characterized in that: The mixed precision-based data processing method further includes: In response to a user adjustment instruction, the standard name of the specialized operator in the specialized processing table is adjusted; the user adjustment instruction includes a specialized operator adding instruction and a specialized operator deleting instruction.

15. The mixed precision data processing method according to claim 12, characterized in that: The process of determining whether the execution operator is a specialized operator includes: Determine whether the execution precision of the execution operator is a half-precision floating point type; If the execution precision of the execution operator is the half-precision floating point type, determine whether the execution operator is a specialized operator.

16. The mixed precision data processing method according to claim 15, characterized in that: If the execution operator is the specialized operator, the process of controlling the target computing device to perform specialized calculations on the input data corresponding to the execution operator and outputting the calculation results includes: If the execution operator is the specialized operator, convert the input data corresponding to the execution operator from the half-precision floating point type to the single-precision floating point type to obtain intermediate data; Controlling the target computing device to perform operator calculation on the intermediate data according to the single-precision floating-point type to obtain result data; The result data is converted from the single-precision floating-point type to the half-precision floating-point type to obtain a calculation result.

17. The mixed precision data processing method according to claim 16, characterized in that: Before converting the result data from the single-precision floating-point type to the half-precision floating-point type, the mixed-precision data processing method further includes: Assigning a value to a type identifier according to the half-precision floating-point type of the input data of the execution operator; when the half-precision floating-point type is a half-precision floating point, assigning the type identifier to a first preset value; and when the half-precision floating-point type is a half-precision floating point, assigning the type identifier to a second preset value; The process of converting the result data from the single-precision floating-point type to the half-precision floating-point type includes: The result data is converted from the single-precision floating-point type to the half-precision floating-point type according to the value of the type identifier.

18. A data processing system based on mixed precision, characterized in that: include: A first determination module determines a target deep learning framework and a target computing device corresponding to the current application scenario from among multiple candidate deep learning frameworks and multiple candidate computing devices, and uses the target deep learning framework to analyze a preset model to obtain multiple current operators; An operator mapping module, used to determine the standard names of the multiple current operators according to the initial names of the multiple current operators in the target deep learning framework; A precision analysis module, used to obtain a hardware black and white list corresponding to the target computing device, and determine the execution precision of multiple current operators according to the standard names of multiple current operators and the hardware black and white list; the execution precision of multiple current operators includes at least two types, and the hardware black and white list includes the corresponding relationship between the standard name of the operator and the execution precision; the hardware black and white list includes a black list and a white list, and the execution precision of multiple current operators includes a single-precision floating point type and a half-precision floating point type, the execution precision of the operators in the white list is the half-precision floating point type, and the execution precision of the operators in the black list is the single-precision floating point type; The operator scheduling module is used to use each of the multiple current operators as an execution operator in turn, control the target computing device to perform operator calculation on the input data corresponding to the execution operator according to the execution accuracy of the execution operator, and output the calculation result.

19. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instruction is executed by a processor, the steps of the mixed-precision data processing method described in any one of claims 1 to 17 are implemented.

20. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the mixed precision data processing method as described in any one of claims 1 to 17 when executing the computer program.

21. A non-volatile storage medium, characterized in that: The non-volatile storage medium stores a computer program, and when the computer program is executed by the processor, the steps of the mixed-precision data processing method according to any one of claims 1 to 17 are implemented.

Citation Information

Patent Citations

  • Method for automatically optimizing performance and precision of Ginseng AI processor under CANN computing framework

    CN115409165A

  • Automatic operator detection method and device, electronic equipment and medium

    CN115934346A

  • Automatic mixing precision training method and device for AI acceleration chip

    CN117829309A