Method and computing device for cross-operator computing optimization

By integrating the calculation logic of subsequent nodes into the DeQuant operation, multiplication or division nodes are reduced, the problem of low data conversion efficiency between nodes is solved, and the overall reasoning speed and energy efficiency of the artificial intelligence model are improved.

CN118245236BActive Publication Date: 2024-09-06SHENZHEN CORERAIN TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410669414.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-28
Publication Date
2024-09-06
Estimated Expiration
2044-05-28

AI Technical Summary

Technical Problem

In the artificial intelligence model, when converting data types and values ​​between nodes (dequantization DeQuant), the calculation logic of subsequent nodes is not fully considered, resulting in a loss of calculation efficiency.

Method used

By determining whether the calculation logic of the successor node meets specific optimization conditions, the calculation logic of the successor node is integrated into the DeQuant operation, reducing multiplication or division calculation nodes, and optimizing the calculation logic to improve the overall reasoning speed.

Benefits of technology

Significantly improves computing efficiency and reduces memory access and energy consumption, especially suitable for mobile devices and edge computing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118245236B
    Figure CN118245236B
Patent Text Reader

Abstract

The present invention provides a method and computing device for cross-operator computing optimization, the method is used for model compilation of artificial intelligence data flow chips, the method includes: judging whether the computing logic of the second node after the first node meets the optimization conditions, the first node is a dequantization node; when the computing logic of the second node meets the optimization conditions, the dequantization computing operation is optimized to obtain the optimized computing logic; the output result obtained by the optimized computing logic is directly output to the subsequent node of the second node, and the second node is deleted at the same time to achieve cross-operator computing optimization. According to the technical solution of the present invention, the actual computing logic can be transformed to achieve the purpose of computing acceleration and improve the overall reasoning speed.
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 technology, and in particular to a method and computing device for cross-operator computing optimization. Background Art

[0002] In AI models, computations are often quantized and stored as uint8 in some nodes to speed up calculations and conserve storage resources, while subsequent nodes may continue to use float32 floating-point calculations. When a node's output data is uint8 and the subsequent node's input data requires float32, a data type and value conversion, known as dequantization, is required. However, if each node operates solely based on its own input and output requirements without considering the specific needs of the entire computational graph or its neighboring nodes, optimization opportunities may be missed. If a node directly dequantizes data to float32 without considering the actual needs of its subsequent nodes, this can result in a loss of efficiency.

[0003] To this end, a technical solution is needed that can transform the actual computing logic to achieve the purpose of computing acceleration and improve the overall reasoning speed. Summary of the Invention

[0004] The present invention aims to provide a method and computing device for cross-operator computation optimization, which can transform the actual computation logic to achieve the purpose of computation acceleration and improve the overall reasoning speed.

[0005] According to one aspect of the present invention, a method for cross-operator computing optimization is provided, the method being used for model compilation of an artificial intelligence data flow chip, the method comprising:

[0006] Determining whether a calculation logic of a second node following a first node satisfies an optimization condition, wherein the first node is a dequantization node;

[0007] When the calculation logic of the second node meets the optimization condition, the inverse quantization calculation operation is optimized to obtain optimized calculation logic;

[0008] The output result obtained by the optimization calculation logic is directly output to the subsequent node of the second node, and the second node is deleted at the same time to achieve cross-operator calculation optimization.

[0009] According to some embodiments, the optimization conditions include:

[0010] There is only one second node;

[0011] The second node is a multiplication operation;

[0012] Another operand of the second node is constant data.

[0013] According to some embodiments, the optimization conditions include:

[0014] There is only one second node;

[0015] The second node is a division operation;

[0016] Another operand of the second node is constant data.

[0017] According to some embodiments, optimizing the inverse quantization calculation includes: when the calculation logic of the second node is a multiplication operation, using the product of the second quantization parameter and the constant parameter in the inverse quantization calculation as the optimized quantization parameter.

[0018] According to some embodiments, optimizing the inverse quantization calculation further includes: when the calculation logic of the second node is a division operation, using the ratio of the second quantization parameter to the constant parameter in the inverse quantization calculation as the optimized quantization parameter.

[0019] According to some embodiments, the optimization calculation logic is:

[0020] F=(Q-zeropoint)*scale_new

[0021] Wherein, Q is the input value of the first node, zeropoint is the first quantization parameter, scale_new is the optimized quantization parameter, and F is the output value of the first node.

[0022] According to some embodiments, the artificial intelligence data flow chip supports static configuration of quantization and dequantization parameters during compilation.

[0023] According to some embodiments, the output of the first node is a multi-dimensional array.

[0024] According to another aspect of the present invention, a computer program product is provided, comprising a computer program, wherein when the computer program is executed by a processor, the method as described above is implemented.

[0025] According to another aspect of the present invention, there is provided a computing device comprising:

[0026] processor; and

[0027] A memory stores a computer program, and when the computer program is executed by the processor, implements any of the methods described above.

[0028] According to an embodiment of the present invention, based on the computational characteristics of DeQuant and the particularity of the computational logic of subsequent computing nodes, the computational logic of the subsequent node is integrated into the DeQuant calculation, reducing one multiplication / division computation node. This enables the actual computational logic to be transformed, thereby achieving the purpose of computational acceleration and improving the overall inference speed.

[0029] According to some embodiments, the computational logic fusion strategy directly integrates multiplication / division operations. If a dequantization node is immediately followed by a multiplication or division node, and the operation factor is a known constant, this factor can be directly integrated into the dequantization process. The corresponding multiplication or division operation is performed while converting the quantized value to a floating-point number, thus skipping the separate multiplication or division node. By reducing the amount of computation, one or more computation nodes are directly eliminated, especially for relatively time-consuming operations such as multiplication and division, which can significantly improve computational efficiency.

[0030] According to some embodiments, a computing logic fusion strategy can reduce memory access and reduce storage requirements for intermediate results because it is no longer necessary to save temporary variables for fused operations, thereby reducing memory bandwidth pressure.

[0031] According to some embodiments, simplifying the computation graph can achieve lower control overhead with a simpler computation graph, making hardware scheduling more efficient. Since the number of execution steps is reduced, overall energy consumption is also reduced, which is particularly important for mobile devices and edge computing, improving energy efficiency.

[0032] It should be understood that the foregoing general description and the following detailed description are exemplary only and are not restrictive of the invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments.

[0034] Figure 1 A flow chart of a method for cross-operator computation optimization according to an example embodiment is shown.

[0035] Figure 2 A flow chart of a method for calculating a quantization parameter according to an example embodiment is shown.

[0036] Figure 3 A flow chart of a method for inverse quantization according to an example embodiment is shown.

[0037] Figure 4 A block diagram of a computing device is shown according to an exemplary embodiment. DETAILED DESCRIPTION

[0038] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be embodied in many forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete and will fully convey the concepts of the example embodiments to those skilled in the art. Like reference numerals in the drawings represent like or similar parts, and thus repeated description thereof will be omitted.

[0039] In addition, the described features, structures or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present invention. However, it will be appreciated by those skilled in the art that the technical solutions of the present invention can be practiced without one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known methods, devices, implementations or operations are not shown or described in detail to avoid blurring various aspects of the present invention.

[0040] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically separate entities. That is, these functional entities may be implemented in software, in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0041] The flowcharts shown in the accompanying drawings are for illustrative purposes only and do not necessarily include all contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may be decomposed, while others may be combined or partially combined. Therefore, the actual execution order may vary depending on the actual situation.

[0042] It should be understood that although the terms first, second, third, etc. may be used herein to describe various components, these components should not be limited by these terms. These terms are used to distinguish one component from another. Thus, the first component discussed below could be referred to as the second component without departing from the teachings of the present inventive concept. As used herein, the term "and / or" includes any one and all combinations of one or more of the associated listed items.

[0043] The user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in the present invention are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and corresponding operation entrances shall be provided for users to choose to authorize or refuse.

[0044] Those skilled in the art will understand that the drawings are merely schematic diagrams of example embodiments, and the modules or processes in the drawings are not necessarily necessary for implementing the present invention, and therefore cannot be used to limit the scope of protection of the present invention.

[0045] In AI model calculations, some computational nodes are often quantized and stored as uint8 to speed up computations and conserve storage resources, while subsequent nodes may continue to use float32 floating-point computations. When the output data of a node, node_a, is uint8, and the input data of the subsequent node, node_b, is float32, a data type and value conversion, known as dequantization, is required. In the DeQuant dequantization operation, the data is converted to float32 as input data for node_b using the formula F=(Q-zeropoint)*scale. Here, Q is the output of node_a, and zeropoint and scale are the quantization parameters of node_a. These are determined when the model is created and are independent of the input data during actual inference. They are static data, also known as constant data. Node_a only knows that its successor node requires the float32 type, so it dequantizes it through the normal DeQuant node and outputs the result to node_b for subsequent calculations, regardless of the specific calculation operations of node_b. It is unable to optimize the calculation based on the specific calculation logic of node_b.

[0046] To this end, the present invention proposes a method for cross-operator (cross-node) computation optimization. Based on the computational characteristics of DeQuant and the particularity of the computational logic of subsequent computational nodes, the computational logic of the subsequent nodes is integrated into the DeQuant computation, reducing one multiplication / division computational node. This method can transform the actual computational logic, achieve computational acceleration, and improve the overall inference speed.

[0047] Exemplary embodiments of the present invention are described below with reference to the accompanying drawings.

[0048] Figure 1 A flow chart of a method for cross-operator computation optimization according to an example embodiment is shown.

[0049] See also Figure 1 , Figure 1 This paper presents a method for optimizing cross-operator computations. This method involves dequantization. In deep learning and computer vision, dequantization refers to the process of converting quantized models or data back to their original, higher-precision representation. Quantization techniques are typically used to reduce model storage requirements and accelerate inference by converting floating-point parameters to low-bit integer representations.

[0050] Dequantization is necessary for model fine-tuning, accuracy assessment, debugging, and analysis. Model fine-tuning refers to fine-tuning a pre-trained quantized model to a specific task, where dequantization may be performed first to restore the model's accuracy potential. Accuracy assessment involves dequantizing the model and comparing its performance with the original floating-point model to accurately assess the performance loss after quantization. When debugging a model or conducting in-depth performance analysis, using an unquantized model is more intuitive and convenient. The dequantization step typically involves converting stored low-precision values ​​back to their high-precision counterparts, such as 32-bit floating-point values, to facilitate further processing or analysis.

[0051] In S101 , it is determined whether the calculation logic of a second node following a first node satisfies an optimization condition, wherein the first node is a dequantization node.

[0052] According to some embodiments, the first node is a DeQuant node, and the second node is a successor node of the DeQuant node.

[0053] When performing model compilation optimization, when encountering a DeQuant node, the calculation logic of its successor node is used to determine whether it can be optimized. Optimization is possible if the following three conditions are met: there is one and only one successor node; the successor node is a multiplication and / or division operation; and the other operand of the successor node is constant data.

[0054] Only when the subsequent multiplication / division operand is a constant can its value be determined at compile time, allowing this numerical operation to be incorporated into the DeQuant quantization operation during model compilation. The reason why the subsequent operation can only be multiplication / division is because these two operations are associative and do not introduce side effects. Furthermore, only one subsequent node is required to prevent the fusion from affecting the calculation results of other subsequent branches and introducing side effects.

[0055] In S103 , when the calculation logic of the second node meets the optimization condition, the inverse quantization calculation operation is optimized to obtain optimized calculation logic.

[0056] According to some embodiments, the product obtained by multiplying the difference between the input data of the first node and the first quantization parameter and the second quantization parameter is used as the input value of the second node. When the calculation logic of the second node is a multiplication operation, the product of the second quantization parameter and a constant parameter in the inverse quantization calculation is used as the optimized quantization parameter; when the calculation logic of the second node is a division operation, the ratio of the second quantization parameter to the constant parameter in the inverse quantization calculation is used as the optimized quantization parameter.

[0057] When the calculation logic of the successor node is a multiplication operation, the product of the second quantization parameter and the constant parameter is used as the optimized quantization parameter. When the calculation logic of the successor node is a division operation, the ratio of the second quantization parameter to the constant parameter is used as the optimized quantization parameter.

[0058] When the optimization conditions in step S101 are met, the calculation logic of subsequent nodes can be optimized based on the calculation characteristics of DeQuant F=(Q-zeropoint)*scale.

[0059] When the computation in the successor node is a multiplication operation and the other is a constant parameter const_b, the multiplication operation can be integrated into the DeQuant computation, that is, Fout = F*const_b = (Q-zeropoint)*scale*const_b. Since scale and const_b are both static constant data, they can be determined before running the actual inference, denoted as scale_new = scale*const_b.

[0060] When the computation in the successor node is a division operation and the other parameter is a constant parameter, const_b, the division operation can be integrated into the DeQuant computation: Fout = F / const_b = (Q-zeropoint)*scale / const_b. Since both scale and const_b are static constants, they can be determined before running the actual inference, using scale_new = scale / const_b.

[0061] The first quantization parameter, zeropoint, and the second quantization parameter, scale, are determined after model training. This is typically done by running inference on a small dataset, collecting the minimum and maximum values ​​(min) of the data output by that node, i.e., the output range. Scale is calculated by dividing (max-min) by 255, and zeropoint is calculated by multiplying scale by 255 + min. const_b is a constant in the model, and its value is fixed when the model is compiled.

[0062] In S105 , the output result obtained by the optimization calculation logic is directly output to the subsequent node of the second node, and the second node is deleted at the same time, so as to realize cross-operator calculation optimization.

[0063] After obtaining the optimized quantization parameter, the optimized quantization parameter is used to replace the original second quantization parameter. After replacing the original second quantization parameter with the optimized quantization parameter, the successor node is deleted, and the output result of the optimization calculation logic is directly connected to the node that originally used the successor node as input.

[0064] Based on S103, the original DeQuant operation F = (Q - zeropoint) * scale can be replaced with F = (Q - zeropoint) * scale_new. And the successor node node_b can be deleted from the model, that is, the output of DeQuant can be directly connected to the node that originally took node_b as input.

[0065] The following is an example.

[0066] For example, if the output data of a node node_a is 155.75, and the output data range of node_a is known to be [-20, 1000] during the quantization process, then the dequantized data of DeQuant is scale=(1000 - (-20)) / 255.0 = 4.705882352941177, zeropoint=round(-(-20) / scale) = 4, and the quantized value of the output of node_a 155.75 is round(155.75 / scale) + zeropoint = 37, then the output of DeQuant is (37-4)*scale=155.29411764705884, and the successor node is node_b, which is a multiplication operation. For example, if const_b=2.5, the output of node_B is 155.29411764705884*2.5=388.2352941176471.

[0067] If the multiplication operation is integrated into the previous DeQuant, the calculation process is scale_new = scale*const_b=11.764705882352942, (37-4)*scale_new= 33*11.764705882352942=

[0068] 388.2352941176471, you can get the same result.

[0069] Because scale_new can be statically determined at compile time, the multiplication operation can be completed at compile time, saving a runtime multiplication operation. In the above example, the output of node_a is a single value. When the output of node_a is a multidimensional array, the time saved in the runtime multiplication operation can be considerable.

[0070] Based on the computational characteristics of DeQuant and the specificity of the computational logic of subsequent compute nodes, the computational logic of subsequent nodes is integrated into DeQuant's calculations, reducing the number of multiplication / division nodes and improving overall inference speed. By integrating the multiplication / division operation with a constant into the dequantization operation of DeQuant, the multiplication / division operation is completed at compile time, eliminating one multiplication / division operation at runtime and thus accelerating inference speed at runtime.

[0071] Figure 2 A flow chart of a method for calculating a quantization parameter according to an example embodiment is shown.

[0072] See also Figure 2 Before performing DeQuant calculation, we need to calculate the quantization parameters scale and zero_point. First, we collect the maximum value information of the activation value x Then, according to the maximum value information of the model activation value x, the quantization parameters scale and zero_point are calculated, and quantization and dequantization operations are performed on them respectively. The quantization and dequantization operations are collectively referred to as analog quantization operations.

[0073] In S201 , the ratio of the difference between the maximum value and the minimum value of the input activation to the maximum value of the quantization bit width is used as the first quantization parameter.

[0074] Reparameterization is used to modify the quantization parameter. According to some embodiments, the ratio of the difference between the maximum output activation and the minimum output activation to the maximum quantization bit width is used as the first quantization parameter, and the calculation formula is as follows:

[0075]

[0076] Among them, q max and q min It is calculated based on the quantization bit width, which are 255 and 0 respectively.

[0077] In S203, a rounding operation is performed on the inverse of the ratio of the minimum value of the input activation to the first quantization parameter, and the minimum value is selected from the maximum value of the quantization bit width, and compared with zero, and the maximum value is selected as the second quantization parameter.

[0078]

[0079] Among them, q max The value is 255, and round indicates rounding to the nearest integer.

[0080] Figure 3 A flow chart of a method for inverse quantization according to an example embodiment is shown.

[0081] See also Figure 3 In the DeQuant dequantization operation, the data needs to be converted to float32 type according to the method F=(Q-zeropoint)*scale as the input data of the subsequent node. The dequantization is performed through the normal DeQuant node and the result is output to the subsequent node for subsequent calculation. The calculation method is Fout = F*const_b= (Q-zeropoint)*scale*const_b.

[0082] In S301, a simulated quantization result is obtained after a simulated quantization operation of the activation value.

[0083] According to some embodiments, after the first quantization parameter and the second quantization parameter are obtained by calculation, quantization and dequantization operations are performed.

[0084] Calculate the ratio of the output activation to the first quantization parameter as a third value, calculate the sum of the third value and the second quantization parameter as a fourth value, round the fourth value, and perform a truncation operation on the fourth value, the maximum value of the quantization bit width, and the minimum value of the quantization bit width to obtain a fifth value, and use the fifth value as the integer result of the quantized output activation. That is:

[0085]

[0086] Among them, Clip represents the truncation operation, and Q represents the integer result after quantization.

[0087] In S303 , a difference calculation is performed between the simulated quantization result and the first quantization parameter to obtain a difference result.

[0088] According to some embodiments, after the quantization result Q is calculated in S301, the first quantization parameter is subtracted from Q, that is, .

[0089] In S305 , the difference result is multiplied by the second quantization parameter, and the obtained product is the inverse quantization result.

[0090] Calculated in S303 The inverse quantization result is obtained by multiplying the difference between and by the second quantization parameter.

[0091]

[0092] Figure 4 A block diagram of a computing device according to an example embodiment of the present invention is shown.

[0093] like Figure 4As shown, computing device 30 includes processor 12 and memory 14. Computing device 30 may also include bus 22, network interface 16, and I / O interface 18. Processor 12, memory 14, network interface 16, and I / O interface 18 may communicate with each other via bus 22.

[0094] The processor 12 may include one or more general-purpose CPUs (Central Processing Units), microprocessors, or application-specific integrated circuits, etc., for executing relevant program instructions. According to some embodiments, the computing device 30 may also include a high-performance graphics card (GPU) 20 for accelerating the processor 12.

[0095] Memory 14 may include machine-readable media in the form of volatile memory, such as random access memory (RAM), read-only memory (ROM), and / or cache memory. Memory 14 is used to store one or more programs containing instructions and data. Processor 12 may read instructions stored in memory 14 to execute the methods according to the embodiments of the present invention described above.

[0096] The computing device 30 may also communicate with one or more networks via the network interface 16. The network interface 16 may be a wireless network interface.

[0097] The bus 22 may include an address bus, a data bus, a control bus, etc. The bus 22 provides a path for exchanging information between various components.

[0098] It should be noted that, in the specific implementation process, the computing device 30 may also include other components necessary for normal operation. In addition, those skilled in the art will understand that the above-mentioned device may also only include components necessary to implement the embodiments of this specification, and does not necessarily include all components shown in the figure.

[0099] The present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the above method. The computer-readable storage medium may include, but is not limited to, any type of disk, including a floppy disk, an optical disk, a DVD, a CD-ROM, a microdrive and a magneto-optical disk, a ROM, a RAM, an EPROM, an EEPROM, a DRAM, a VRAM, a flash memory device, a magnetic or optical card, a nanosystem (including a molecular memory IC), a network storage device, a cloud storage device, or any other type of medium or device suitable for storing instructions and / or data.

[0100] An embodiment of the present invention further provides a computer program product, which includes a computer program. The computer program is operable to enable a computer to execute part or all of the steps of any one of the methods described in the above method embodiments.

[0101] Those skilled in the art will readily appreciate that the technical solutions of the present invention can be implemented using software and / or hardware. "Unit" and "module" in this specification refer to software and / or hardware that can independently perform specific functions or work in conjunction with other components. Examples of hardware include field programmable gate arrays and integrated circuits.

[0102] It should be noted that for the aforementioned method embodiments, for simplicity of description, they are all expressed as a series of action combinations. However, those skilled in the art should be aware that the present invention is not limited by the order of the actions described, because according to the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in this specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.

[0103] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0104] In the several embodiments provided herein, it should be understood that the disclosed devices can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of units is merely a logical functional division. In actual implementation, other division methods may be used. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not implemented. In addition, the coupling or direct coupling or communication connection shown or discussed may be through some service interface. The indirect coupling or communication connection of devices or units may be electrical or other forms.

[0105] Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0106] In addition, the functional units in the various embodiments of the present invention may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0107] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present invention, or the portion that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes a number of instructions for causing a computer device (such as a personal computer, server, or network device) to execute all or part of the steps of the various embodiments of the present invention.

[0108] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0109] The exemplary embodiments of the present invention are specifically shown and described above. It should be understood that the present invention is not limited to the detailed structure, configuration or implementation described herein; on the contrary, the present invention is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended clauses.

Claims

1. A method for cross-operator computing optimization, the method is used for model compilation of artificial intelligence data flow chip, characterized in that: include: Determine whether the calculation logic of a second node after the first node meets an optimization condition, where the first node is a dequantization node, wherein the optimization condition includes that there is only one second node, the second node is a multiplication operation, and another operand of the second node is constant data; When the calculation logic of the second node meets the optimization condition, the inverse quantization calculation operation is optimized to obtain the optimized calculation logic, wherein when the calculation logic of the second node is a multiplication operation, the product of the second quantization parameter and the constant parameter in the inverse quantization calculation is used as the optimized quantization parameter; The output result obtained by the optimization calculation logic is directly output to the subsequent node of the second node, and the second node is deleted at the same time to achieve cross-operator calculation optimization.

2. The method according to claim 1, characterized in that The optimization calculation logic is: F=(Q-zeropoint)*scale_new Among them, Q is the input value of the first node, zeropoint is the first quantization parameter, scale_new is the optimized quantization parameter, and F is the output value of the first node.

3. The method according to claim 1, characterized in that The artificial intelligence data stream chip supports static configuration of quantization and dequantization parameters during compilation.

4. The method according to claim 1, characterized in that: The output of the first node is a multidimensional array.

5. A method for cross-operator computing optimization, the method is used for model compilation of artificial intelligence data flow chip, characterized in that: include: Determine whether the calculation logic of a second node after the first node meets an optimization condition, where the first node is a dequantization node, wherein the optimization condition includes that there is only one second node, the second node is a division operation, and another operand of the second node is constant data; When the calculation logic of the second node meets the optimization condition, the inverse quantization calculation operation is optimized to obtain the optimized calculation logic, wherein when the calculation logic of the second node is a division operation, the product of the second quantization parameter and the constant parameter in the inverse quantization calculation is used as the optimized quantization parameter; The output result obtained by the optimization calculation logic is directly output to the subsequent node of the second node, and the second node is deleted at the same time to achieve cross-operator calculation optimization.

6. The method according to claim 5, characterized in that The optimization calculation logic is: F=(Q-zeropoint)*scale_new Among them, Q is the input value of the first node, zeropoint is the first quantization parameter, scale_new is the optimized quantization parameter, and F is the output value of the first node.

7. The method according to claim 5, characterized in that The artificial intelligence data stream chip supports static configuration of quantization and dequantization parameters during compilation.

8. The method according to claim 5, characterized in that The output of the first node is a multidimensional array.

9. A computer program product, characterized in that The method comprises a computer program, which implements the method according to any one of claims 1 to 8 when being executed by a processor.

10. A computing device, characterized in that include: processor; as well as A memory storing a computer program, wherein when the computer program is executed by the processor, the method according to any one of claims 1 to 8 is implemented.

Citation Information

Patent Citations

  • Adjusting and optimizing method and compiling method of deep learning model, and computing device

    CN113269319A

  • Convolution operation circuit, compiling method and related product

    CN115952848A