Two-dimensional convolution operator segmentation method and device, equipment and storage medium

By constructing the Roofline model and filtering the target segmentation methods, the problem of performance degradation of the two-dimensional convolution operator segmentation method in the existing technology when the parameters change is solved, and the efficient computing performance of the AI ​​processor is achieved.

CN118839733APending Publication Date: 2024-10-25SHANGHAI SUIYUAN TECH CO LTD

Patent Information

Application Number
CN202410951209.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-16
Publication Date
2024-10-25

AI Technical Summary

Technical Problem

The existing two-dimensional convolution operator segmentation method cannot guarantee the optimal segmentation for any parameter value, and it fails when the AI ​​processor operating parameters change, resulting in a decrease in computing performance.

Method used

By obtaining the current operating parameters of the AI ​​processor, a Roofline model is constructed, multiple alternative segmentation methods are determined, and target segmentation methods are selected based on simulated data flow and performance data to improve the flexibility and computing performance of the segmentation method.

Benefits of technology

It realizes the dynamic adjustment of the segmentation method according to the current AI processor parameters, ensuring that the highest computing performance is maintained under different operating conditions, and improving the flexibility and uniformity of the segmentation method.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118839733A_ABST
    Figure CN118839733A_ABST
Patent Text Reader

Abstract

The invention discloses a two-dimensional convolution operator segmentation method and device, equipment and a storage medium, and the method comprises the steps: obtaining a current operation parameter of an AI processor, determining the total calculation power and the maximum calculation density of the AI processor according to the current operation parameter, and constructing a Roofline model according to the total calculation power and the maximum calculation density; determining a plurality of alternative segmentation modes corresponding to the two-dimensional convolution operator according to a pre-constructed numerical constraint condition between the segmentation size of the two-dimensional convolution operator and the operation parameters of the AI processor; and determining a simulation data stream corresponding to each alternative segmentation mode, determining performance data corresponding to each alternative segmentation mode according to the simulation data streams and a Roofline model, and screening a target segmentation mode corresponding to the two-dimensional convolution operator according to the performance data. According to the technical scheme of the embodiment of the invention, the flexibility of the segmentation mode and the computing performance of the AI processor can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a two-dimensional convolution operator segmentation method, device, equipment and storage medium. Background Art

[0002] There are usually many independent computing threads inside the AI ​​neural network processor. These threads can undertake various computing tasks in parallel. Therefore, when implementing two-dimensional convolution (Conv2d), it is often necessary to divide the original large-size two-dimensional convolution operator into several small-size two-dimensional convolution operators, and then send these divided operator tasks to different computing threads respectively to achieve parallel acceleration of the two-dimensional convolution operator.

[0003] The existing two-dimensional convolution operator segmentation method is usually based on prior knowledge, and the two-dimensional convolution operator size is arranged into several major categories according to the convolution parameters HWCiCo (height, width, number of input channels and number of output channels). Then, several segmentation methods are preset in the AI ​​compiler, and each segmentation method is adapted to a type of parameter arrangement type.

[0004] However, the existing segmentation methods have the following problems: there is no guarantee that a preset segmentation method is always optimal for any specific parameter value in this type of arrangement area; and when the AI ​​processor runtime parameters (such as frequency, number of threads, etc.) change, the preset segmentation method is often no longer optimal. Summary of the invention

[0005] The present invention provides a two-dimensional convolution operator segmentation method, device, equipment and storage medium, which can improve the flexibility of the segmentation method and the computing performance of the AI ​​processor.

[0006] According to one aspect of the present invention, a two-dimensional convolution operator segmentation method is provided, the method comprising:

[0007] Acquire current operating parameters of the AI ​​processor, determine the total computing power and maximum computing density of the AI ​​processor according to the current operating parameters, and build a Roofline model according to the total computing power and maximum computing density;

[0008] Determine multiple alternative segmentation methods corresponding to the two-dimensional convolution operator based on the numerical constraints between the pre-built two-dimensional convolution operator segmentation size and the AI ​​processor operating parameters;

[0009] Determine the simulated data flow corresponding to each alternative segmentation method, determine the performance data corresponding to each alternative segmentation method based on the simulated data flow and the Roofline model, and screen the target segmentation method corresponding to the two-dimensional convolution operator based on the performance data.

[0010] Optionally, the current operating parameters include:

[0011] The number of physical threads corresponding to the AI ​​processor, the number of physical multiplication and addition units corresponding to the threads, the thread operating frequency, register capacity, first-level storage capacity, second-level storage capacity, and third-level storage bandwidth.

[0012] Optionally, determining the total computing power and maximum computing density of the AI ​​processor according to the current operating parameters includes:

[0013] Determine the total computing power of the AI ​​processor according to the number of physical threads corresponding to the AI ​​processor, the number of physical multiplication-addition units corresponding to the threads, and the thread operation frequency;

[0014] The maximum computing density of the AI ​​processor is determined according to the number of physical threads corresponding to the AI ​​processor, the number of physical multiplication and addition units corresponding to the threads, the thread operating frequency, and the tertiary storage bandwidth.

[0015] Optionally, according to the numerical constraints between the pre-built two-dimensional convolution operator segmentation size and the AI ​​processor operating parameters, multiple alternative segmentation methods corresponding to the two-dimensional convolution operator are determined, including:

[0016] According to the pre-built two-dimensional convolution operator segmentation size and the numerical constraints between the number of physical threads and the register capacity, multiple three-dimensional sub-thread arrangement modes and first-level storage area segmentation shapes are enumerated;

[0017] According to the pre-built two-dimensional convolution operator segmentation size and the numerical constraint between the number of physical threads, multiple three-dimensional thread arrangements are enumerated;

[0018] According to the pre-constructed two-dimensional convolution operator segmentation size and the numerical constraints between the primary storage capacity and the secondary storage capacity, enumerate the number of buffers corresponding to the multiple segments;

[0019] According to the three-dimensional arrangement of the multiple sub-threads, the shape of the first-level storage area blocks, the three-dimensional arrangement of the threads and the number of buffers corresponding to the blocks, multiple alternative segmentation methods corresponding to the two-dimensional convolution operator are determined.

[0020] Optionally, according to the simulated data flow and the Roofline model, performance data corresponding to each alternative segmentation method is determined, and according to the performance data, a target segmentation method corresponding to the two-dimensional convolution operator is screened, including:

[0021] Determine, according to the simulated data flow, the secondary storage access amount and the tertiary storage access amount corresponding to each alternative segmentation method;

[0022] Determine the computing density corresponding to each alternative splitting method according to the total computing power of the AI ​​processor and the secondary storage access amount and the tertiary storage access amount corresponding to each alternative splitting method;

[0023] Input the computational density corresponding to each of the alternative segmentation methods into the Roofline model to obtain the actual computational power corresponding to each of the alternative segmentation methods;

[0024] According to the actual computing power corresponding to each of the alternative segmentation methods, the target segmentation method corresponding to the two-dimensional convolution operator is screened.

[0025] Optionally, according to the actual computing power corresponding to each of the alternative segmentation methods, a target segmentation method corresponding to the two-dimensional convolution operator is screened, including:

[0026] Determine the proportion of the calculated area to the two-dimensional convolution operator under each alternative segmentation method;

[0027] Determine the data loading cost and data writing cost corresponding to each alternative splitting method;

[0028] The multiple alternative splitting methods are sorted according to the actual computing power, the third-level storage access amount, the second-level storage access amount, the proportion of the computing area to the two-dimensional convolution operator, the data loading overhead, and the data write-back overhead corresponding to each of the alternative splitting methods;

[0029] According to the sorting results, the target segmentation method corresponding to the two-dimensional convolution operator is determined.

[0030] According to another aspect of the present invention, a two-dimensional convolution operator segmentation device is provided, the device comprising:

[0031] A parameter acquisition module, used to acquire current operating parameters of the AI ​​processor, determine the total computing power and maximum computing density of the AI ​​processor according to the current operating parameters, and construct a Roofline model according to the total computing power and maximum computing density;

[0032] An alternative method determination module is used to determine multiple alternative segmentation methods corresponding to the two-dimensional convolution operator according to the numerical constraints between the pre-built two-dimensional convolution operator segmentation size and the AI ​​processor operating parameters;

[0033] The target mode screening module is used to determine the simulation data flow corresponding to each alternative segmentation mode, determine the performance data corresponding to each alternative segmentation mode according to the simulation data flow and the Roofline model, and screen the target segmentation mode corresponding to the two-dimensional convolution operator according to the performance data.

[0034] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:

[0035] at least one processor; and

[0036] a memory communicatively connected to the at least one processor; wherein,

[0037] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the two-dimensional convolution operator segmentation method described in any embodiment of the present invention.

[0038] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the two-dimensional convolution operator segmentation method described in any embodiment of the present invention when executed.

[0039] According to another aspect of the present invention, a computer program product is provided, the computer program product comprising a computer program, and the computer program, when executed by a processor, implements the two-dimensional convolution operator segmentation method described in any embodiment of the present invention.

[0040] The technical solution provided by the embodiment of the present invention obtains the current operating parameters of the AI ​​processor, determines the total computing power and the maximum computing density of the AI ​​processor according to the current operating parameters, and constructs a Roofline model according to the total computing power and the maximum computing density, determines a plurality of alternative segmentation methods corresponding to the two-dimensional convolution operator according to the numerical constraints between the pre-constructed segmentation size of the two-dimensional convolution operator and the operating parameters of the AI ​​processor, determines a simulation data stream corresponding to each alternative segmentation method, determines the performance data corresponding to each alternative segmentation method according to the simulation data stream and the Roofline model, and screens the target segmentation method corresponding to the two-dimensional convolution operator according to the performance data. Compared with the method of performing simple segmentation adaptation according to the AI ​​processor platform and HWCiCo arrangement classification in the prior art, the flexibility of the segmentation method and the computing performance of the AI ​​processor can be improved; secondly, since the segmentation method provided in this embodiment is unified in format, it can ensure that the code for establishing the data stream subsequently is reused to the greatest extent.

[0041] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of 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 creative work.

[0043] Figure 1a is a flow chart of a two-dimensional convolution operator segmentation method provided according to an embodiment of the present invention;

[0044] Figure 1b is a schematic diagram of a two-dimensional convolution operator partitioning block provided according to an embodiment of the present invention;

[0045] Figure 2 is a flow chart of another two-dimensional convolution operator segmentation method provided according to an embodiment of the present invention;

[0046] Figure 3 is a structural schematic diagram of a two-dimensional convolution operator segmentation device provided according to an embodiment of the present invention;

[0047] Figure 4 It is a structural schematic diagram of an electronic device for implementing the two-dimensional convolution operator segmentation method of an embodiment of the present invention. DETAILED DESCRIPTION

[0048] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme 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 only 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 should fall within the scope of protection of the present invention.

[0049] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0050] Figure 1aA flowchart of a two-dimensional convolution operator segmentation method provided by an embodiment of the present invention. This embodiment is applicable to the case of segmenting a two-dimensional convolution operator corresponding to an AI neural network. The method can be executed by a two-dimensional convolution operator segmentation device. The two-dimensional convolution operator segmentation device can be implemented in the form of hardware and / or software. The two-dimensional convolution operator segmentation device can be configured in an electronic device. Figure 1a As shown, the method includes:

[0051] Step 110: Obtain current operating parameters of the AI ​​processor, determine the total computing power and maximum computing density of the AI ​​processor according to the current operating parameters, and build a Roofline model according to the total computing power and maximum computing density.

[0052] In one implementation of this embodiment, optionally, taking the three-level storage architecture of the AI ​​processor as an example, the current operating parameters of the AI ​​processor can be obtained, including: the number of physical threads (Thread) corresponding to the AI ​​processor, the number of physical multiply-add units (MAC) corresponding to the threads, the thread operating frequency, the L0 register capacity, the first-level storage (L1 memory) capacity, the second-level storage (L2 memory) capacity and the tertiary storage (L3 memory) bandwidth.

[0053] Specifically, the tertiary storage bandwidth may be determined according to a system on chip (SOC) frequency, and a minimum value between a direct memory access (DMA) unit bandwidth and a memory controller (MC) bandwidth.

[0054] In one implementation of this embodiment, the total computing power and the maximum computing density of the AI ​​processor are determined according to the current operating parameters, including: determining the total computing power FLOPS_total of the AI ​​processor according to the number of physical threads corresponding to the AI ​​processor, the number of physical multiplication-add units corresponding to the threads, and the thread operating frequency; determining the maximum computing density Imax of the AI ​​processor according to the number of physical threads corresponding to the AI ​​processor, the number of physical multiplication-add units corresponding to the threads, the thread operating frequency, and the tertiary storage bandwidth.

[0055] Step 120: Determine multiple alternative segmentation methods corresponding to the two-dimensional convolution operator based on the numerical constraints between the pre-constructed two-dimensional convolution operator segmentation size and the AI ​​processor operating parameters.

[0056] In this embodiment, before obtaining the current operating parameters of the AI ​​processor, a three-level three-dimensional segmentation of the output Output of the two-dimensional convolution operator can be simulated in advance, and then a numerical constraint condition between the segmentation size and the actual operating parameters of the AI ​​can be established.

[0057] Specifically, Figure 1b It can be a schematic diagram of a two-dimensional convolution operator block in this embodiment. Assume that the three-dimensional sizes of the two-dimensional convolution operator block are Block_X, Block_Y and Block_Z respectively, each block corresponds to multiple threads Thread, each thread can include multiple sub-threads (Sub thread), and the size of each thread is Thread_X, Thread_Y and Thread_Z, then constraint A can be constructed: Block_X*Block_Y*Block_Z≤number of physical threads; constraint B: Thread_X*Thread_Y*Thread_Z*(L0 occupancy of each Sub thread)≤L0 register capacity; constraint C: L1 block size of Sub thread≤L1 memory capacity (L1 block includes Input block, Filter block, Output block); constraint D: L2 block size of Block≤L2 memory capacity (L2 block includes Input block, Filter block, Output block).

[0058] After establishing the above constraints, a finite set of {Block_X, Block_Y, Block_Z} can be obtained according to the current operating parameters of the AI ​​processor and constraint A, a finite set of {Thread_X, Thread_Y, Thread_Z} and {number of Sub threads} can be obtained according to constraint B, a finite set of {L1 block shape and number} can be obtained according to constraint C, and a finite set of {L2 block shape and number} can be obtained according to constraint D. Finally, multiple alternative segmentation methods corresponding to the two-dimensional convolution operator are determined based on all the above sets.

[0059] Step 130: determine the simulated data flow corresponding to each alternative segmentation method, determine the performance data corresponding to each alternative segmentation method based on the simulated data flow and the Roofline model, and screen the target segmentation method corresponding to the two-dimensional convolution operator based on the performance data.

[0060] In this step, optionally, the data flow corresponding to each alternative segmentation method can be simulated, and then the operating parameters corresponding to each alternative segmentation method can be determined according to the data flow, and the operating parameters can be input into the Roofline model to obtain the performance data corresponding to each alternative segmentation method, and finally the optimal two-dimensional convolution operator segmentation method (that is, the target segmentation method) can be screened out according to the performance data.

[0061] The technical solution provided by the embodiment of the present invention obtains the current operating parameters of the AI ​​processor, determines the total computing power and the maximum computing density of the AI ​​processor according to the current operating parameters, and builds a Roofline model according to the total computing power and the maximum computing density, determines a plurality of alternative segmentation methods corresponding to the two-dimensional convolution operator according to the numerical constraints between the pre-built two-dimensional convolution operator segmentation size and the operating parameters of the AI ​​processor, determines a simulation data stream corresponding to each alternative segmentation method, determines the performance data corresponding to each alternative segmentation method according to the simulation data stream and the Roofline model, and screens the two-dimensional convolution operator according to the performance data. The technical means of the target segmentation method can enable the segmentation method to be implemented in the AI ​​compiler or Runtime firmware, decouple the two-dimensional convolution operator segmentation scheme from the AI ​​processor, and use the current operating parameters of the AI ​​processor as input. The optimal segmentation scheme of the two-dimensional convolution operator under any HWCiCo value can be output. Compared with the simple segmentation and adaptation method based on the AI ​​processor platform and HWCiCo arrangement classification in the prior art, the flexibility of the segmentation method and the computing performance of the AI ​​processor can be improved; secondly, since the segmentation method provided in this embodiment is unified in format, it can ensure that the code for establishing the data flow subsequently is reused to the greatest extent.

[0062] Figure 2 A flowchart of another two-dimensional convolution operator segmentation method provided by an embodiment of the present invention, such as Figure 2 As shown, the method includes:

[0063] Step 210: Obtain current operating parameters of the AI ​​processor, determine the total computing power and maximum computing density of the AI ​​processor according to the current operating parameters, and build a Roofline model according to the total computing power and maximum computing density.

[0064] Step 220: enumerate multiple sub-thread three-dimensional arrangement modes and primary storage area block shapes according to the pre-constructed two-dimensional convolution operator segmentation size and the numerical constraints between the number of physical threads and the register capacity.

[0065] In this step, multiple sub-thread three-dimensional arrangements and first-level storage area block shapes can be enumerated according to the number of physical threads and the capacity of the L0 register.

[0066] Step 230: enumerate multiple three-dimensional thread arrangements according to the pre-constructed two-dimensional convolution operator segmentation size and the numerical constraints between the number of physical threads.

[0067] Step 240: enumerate the number of buffers corresponding to various types of blocks according to the pre-constructed two-dimensional convolution operator segmentation size and the numerical constraints between the primary storage capacity and the secondary storage capacity.

[0068] In this step, the number of buffers corresponding to all possible Input, Filter, and Output blocks can be enumerated based on the L1 memory capacity and L2 memory capacity.

[0069] Step 250: Determine multiple candidate segmentation methods corresponding to the two-dimensional convolution operator according to the multiple three-dimensional arrangements of the sub-threads, the shapes of the first-level storage area blocks, the three-dimensional arrangements of the threads, and the number of buffers corresponding to the blocks.

[0070] In this step, multiple alternative segmentation methods corresponding to the two-dimensional convolution operator can be determined according to the enumeration results obtained in steps 220-240.

[0071] Step 260: Determine the simulated data flow corresponding to each alternative segmentation method, and determine the secondary storage access amount and the tertiary storage access amount corresponding to each alternative segmentation method based on the simulated data flow.

[0072] In this step, a data flow corresponding to each candidate segmentation method may be simulated, and the L2 memory access amount and the L3 memory access amount corresponding to each candidate segmentation method may be determined according to the data flow.

[0073] Step 270: Determine the computing density corresponding to each alternative partitioning method according to the total computing power of the AI ​​processor and the secondary storage access amount and tertiary storage access amount corresponding to each alternative partitioning method.

[0074] Step 280: Input the calculation density corresponding to each alternative segmentation method into the Roofline model to obtain the actual computing power corresponding to each alternative segmentation method, and select the target segmentation method corresponding to the two-dimensional convolution operator according to the actual computing power corresponding to each alternative segmentation method.

[0075] In this step, the computational density I corresponding to each alternative segmentation method can be inserted into the Roofline model to obtain the actual computing power Attainable FLOPS corresponding to each alternative segmentation method. Finally, the target segmentation method corresponding to the two-dimensional convolution operator is screened according to the actual computing power Attainable FLOPS corresponding to each alternative segmentation method.

[0076] In one implementation of the present embodiment, according to the actual computing power corresponding to each of the alternative splitting methods, the target splitting method corresponding to the two-dimensional convolution operator is screened, including: determining the proportion of the calculation area to the two-dimensional convolution operator under each alternative splitting method; determining the data loading (Prologue) overhead and the data write-back (Epilogue) overhead corresponding to each alternative splitting method; sorting the multiple alternative splitting methods according to the actual computing power, tertiary storage access amount, secondary storage access amount, the proportion of the calculation area to the two-dimensional convolution operator, data loading overhead and data write-back overhead corresponding to each of the alternative splitting methods; and determining the target splitting method corresponding to the two-dimensional convolution operator according to the sorting result.

[0077] The proportion result may be the effective proportion of all the partition blocks to the original two-dimensional convolution operator. After sorting the multiple candidate partitioning methods according to the above data, the candidate partitioning method with the highest ranking may be selected as the target partitioning method.

[0078] The technical solution provided by the embodiment of the present invention obtains the current operating parameters of the AI ​​processor, determines the total computing power and maximum computing density of the AI ​​processor, constructs a Roofline model, enumerates multiple three-dimensional arrangements of sub-threads and shapes of first-level storage area blocks, enumerates multiple three-dimensional arrangements of threads, enumerates the number of buffers corresponding to multiple blocks, determines multiple alternative segmentation methods corresponding to the two-dimensional convolution operator, determines the secondary storage access amount and the tertiary storage access amount corresponding to each alternative segmentation method according to the simulated data flow, determines the computing density corresponding to each alternative segmentation method according to the total computing power of the AI ​​processor and the secondary storage access amount and the tertiary storage access amount corresponding to each alternative segmentation method, inputs the computing density corresponding to each alternative segmentation method into the Roofline model, obtains the actual computing power corresponding to each alternative segmentation method, and selects the technical means of the target segmentation method corresponding to the two-dimensional convolution operator according to the actual computing power corresponding to each alternative segmentation method, so as to improve the flexibility of the two-dimensional convolution operator segmentation method and the computing performance of the AI ​​processor.

[0079] Figure 3 A schematic diagram of a two-dimensional convolution operator segmentation device provided in an embodiment of the present invention, wherein the device is applied in an electronic device, such as Figure 3 As shown, the device includes: a parameter acquisition module 310, an alternative mode determination module 320 and a target mode screening module 330.

[0080] A parameter acquisition module 310 is used to acquire current operating parameters of the AI ​​processor, determine the total computing power and maximum computing density of the AI ​​processor according to the current operating parameters, and construct a Roofline model according to the total computing power and maximum computing density;

[0081] An alternative method determination module 320 is used to determine multiple alternative segmentation methods corresponding to the two-dimensional convolution operator according to the numerical constraints between the pre-constructed two-dimensional convolution operator segmentation size and the AI ​​processor operating parameters;

[0082] The target mode screening module 330 is used to determine the simulation data flow corresponding to each alternative segmentation mode, determine the performance data corresponding to each alternative segmentation mode based on the simulation data flow and the Roofline model, and screen the target segmentation mode corresponding to the two-dimensional convolution operator based on the performance data.

[0083] The technical solution provided by the embodiment of the present invention obtains the current operating parameters of the AI ​​processor, determines the total computing power and the maximum computing density of the AI ​​processor according to the current operating parameters, and builds a Roofline model according to the total computing power and the maximum computing density, determines a plurality of alternative segmentation methods corresponding to the two-dimensional convolution operator according to the numerical constraints between the pre-built two-dimensional convolution operator segmentation size and the operating parameters of the AI ​​processor, determines a simulation data stream corresponding to each alternative segmentation method, determines the performance data corresponding to each alternative segmentation method according to the simulation data stream and the Roofline model, and screens the two-dimensional convolution operator according to the performance data. The technical means of the target segmentation method can enable the segmentation method to be implemented in the AI ​​compiler or Runtime firmware, decouple the two-dimensional convolution operator segmentation scheme from the AI ​​processor, and use the current operating parameters of the AI ​​processor as input. The optimal segmentation scheme of the two-dimensional convolution operator under any HWCiCo value can be output. Compared with the simple segmentation and adaptation method based on the AI ​​processor platform and HWCiCo arrangement classification in the prior art, the flexibility of the segmentation method and the computing performance of the AI ​​processor can be improved; secondly, since the segmentation method provided in this embodiment is unified in format, it can ensure that the code for establishing the data flow subsequently is reused to the greatest extent.

[0084] Based on the above embodiment, the current operating parameters include:

[0085] The number of physical threads corresponding to the AI ​​processor, the number of physical multiplication and addition units corresponding to the threads, the thread operating frequency, register capacity, first-level storage capacity, second-level storage capacity, and third-level storage bandwidth.

[0086] The parameter acquisition module 310 includes:

[0087] A total computing power determining unit, used to determine the total computing power of the AI ​​processor according to the number of physical threads corresponding to the AI ​​processor, the number of physical multiplication and addition units corresponding to the threads, and the thread running frequency;

[0088] The maximum computing density determination unit is used to determine the maximum computing density of the AI ​​processor according to the number of physical threads corresponding to the AI ​​processor, the number of physical multiplication and addition units corresponding to the threads, the thread operating frequency, and the tertiary storage bandwidth.

[0089] The alternative mode determination module 320 includes:

[0090] A first enumeration unit is used to enumerate multiple sub-thread three-dimensional arrangement modes and primary storage area block shapes according to the pre-built two-dimensional convolution operator segmentation size and the numerical constraints between the number of physical threads and the register capacity;

[0091] A second enumeration unit is used to enumerate multiple thread three-dimensional arrangement modes according to the pre-constructed two-dimensional convolution operator segmentation size and the numerical constraint condition between the number of physical threads;

[0092] A third enumeration unit is used to enumerate the number of buffers corresponding to the multiple cuts according to the pre-constructed two-dimensional convolution operator cut size and the numerical constraint between the primary storage capacity and the secondary storage capacity;

[0093] The alternative segmentation method determining unit determines multiple alternative segmentation methods corresponding to the two-dimensional convolution operator according to the multiple three-dimensional sub-thread arrangement methods, the first-level storage area block shape, the three-dimensional thread arrangement method and the number of buffers corresponding to the block.

[0094] The target mode screening module 330 includes:

[0095] A memory access amount determination unit, used for determining the secondary storage memory access amount and the tertiary storage memory access amount corresponding to each alternative segmentation mode according to the simulated data stream;

[0096] A memory access processing unit, configured to determine a computing density corresponding to each alternative segmentation method according to a total computing power of the AI ​​processor and a secondary storage access amount and a tertiary storage access amount corresponding to each alternative segmentation method;

[0097] An actual computing power determining unit, used for inputting the computing density corresponding to each of the alternative segmentation methods into the Roofline model to obtain the actual computing power corresponding to each of the alternative segmentation methods;

[0098] A target mode determination unit, used for selecting a target segmentation mode corresponding to the two-dimensional convolution operator according to the actual computing power corresponding to each of the alternative segmentation modes;

[0099] A proportion calculation unit, used to determine the proportion of the calculation area to the two-dimensional convolution operator under each alternative segmentation method;

[0100] A cost determination unit, used to determine the data loading cost and data writing cost corresponding to each alternative segmentation method;

[0101] A sorting unit, configured to sort the plurality of alternative splitting methods according to actual computing power, tertiary storage access amount, secondary storage access amount, proportion of computing area to two-dimensional convolution operator, data loading overhead, and data write-back overhead corresponding to each of the alternative splitting methods;

[0102] The sorting result screening unit is used to determine the target segmentation method corresponding to the two-dimensional convolution operator according to the sorting result.

[0103] The above device can execute the methods provided by all the above embodiments of the present invention, and has the corresponding functional modules and beneficial effects of executing the above methods. For technical details not fully described in the embodiments of the present invention, please refer to the methods provided by all the above embodiments of the present invention.

[0104] Figure 4 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0105] like Figure 4 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0106] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0107] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The processor 11 performs the various methods and processes described above, such as a two-dimensional convolution operator segmentation method.

[0108] In some embodiments, the two-dimensional convolution operator segmentation method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the two-dimensional convolution operator segmentation method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the two-dimensional convolution operator segmentation method in any other appropriate manner (e.g., by means of firmware).

[0109] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0110] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0111] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0112] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0113] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0114] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0115] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0116] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A two-dimensional convolution operator segmentation method, characterized in that: The method comprises: Acquire current operating parameters of the AI ​​processor, determine the total computing power and maximum computing density of the AI ​​processor according to the current operating parameters, and build a Roofline model according to the total computing power and maximum computing density; Determine multiple alternative segmentation methods corresponding to the two-dimensional convolution operator based on the numerical constraints between the pre-built two-dimensional convolution operator segmentation size and the AI ​​processor operating parameters; Determine the simulated data flow corresponding to each alternative segmentation method, determine the performance data corresponding to each alternative segmentation method based on the simulated data flow and the Roofline model, and screen the target segmentation method corresponding to the two-dimensional convolution operator based on the performance data.

2. The method according to claim 1, characterized in that The current operating parameters include: The number of physical threads corresponding to the AI ​​processor, the number of physical multiplication and addition units corresponding to the threads, the thread operating frequency, register capacity, first-level storage capacity, second-level storage capacity, and third-level storage bandwidth.

3. The method according to claim 2, characterized in that Determining the total computing power and maximum computing density of the AI ​​processor according to the current operating parameters includes: Determine the total computing power of the AI ​​processor according to the number of physical threads corresponding to the AI ​​processor, the number of physical multiplication-addition units corresponding to the threads, and the thread operation frequency; The maximum computing density of the AI ​​processor is determined according to the number of physical threads corresponding to the AI ​​processor, the number of physical multiplication and addition units corresponding to the threads, the thread operating frequency, and the tertiary storage bandwidth.

4. The method according to claim 2, characterized in that: According to the numerical constraints between the pre-built two-dimensional convolution operator segmentation size and the AI ​​processor operating parameters, multiple alternative segmentation methods corresponding to the two-dimensional convolution operator are determined, including: According to the pre-built two-dimensional convolution operator segmentation size and the numerical constraints between the number of physical threads and the register capacity, multiple three-dimensional sub-thread arrangement modes and first-level storage area segmentation shapes are enumerated; According to the pre-built two-dimensional convolution operator segmentation size and the numerical constraint between the number of physical threads, multiple three-dimensional thread arrangements are enumerated; According to the pre-constructed two-dimensional convolution operator segmentation size and the numerical constraints between the primary storage capacity and the secondary storage capacity, enumerate the number of buffers corresponding to the multiple segments; According to the three-dimensional arrangement of the multiple sub-threads, the shape of the first-level storage area blocks, the three-dimensional arrangement of the threads and the number of buffers corresponding to the blocks, multiple alternative segmentation methods corresponding to the two-dimensional convolution operator are determined.

5. The method according to claim 1, characterized in that According to the simulated data flow and the Roofline model, performance data corresponding to each alternative segmentation method is determined, and a target segmentation method corresponding to a two-dimensional convolution operator is screened according to the performance data, including: Determine, according to the simulated data flow, the secondary storage access amount and the tertiary storage access amount corresponding to each alternative segmentation method; Determine the computing density corresponding to each alternative splitting method according to the total computing power of the AI ​​processor and the secondary storage access amount and the tertiary storage access amount corresponding to each alternative splitting method; Input the computational density corresponding to each of the alternative segmentation methods into the Roofline model to obtain the actual computational power corresponding to each of the alternative segmentation methods; According to the actual computing power corresponding to each of the alternative segmentation methods, the target segmentation method corresponding to the two-dimensional convolution operator is screened.

6. The method according to claim 5, characterized in that According to the actual computing power corresponding to each of the alternative segmentation methods, the target segmentation method corresponding to the two-dimensional convolution operator is screened, including: Determine the proportion of the calculated area to the two-dimensional convolution operator under each alternative segmentation method; Determine the data loading cost and data writing cost corresponding to each alternative splitting method; The multiple alternative splitting methods are sorted according to the actual computing power, the third-level storage access amount, the second-level storage access amount, the proportion of the computing area to the two-dimensional convolution operator, the data loading overhead, and the data write-back overhead corresponding to each of the alternative splitting methods; According to the sorting results, the target segmentation method corresponding to the two-dimensional convolution operator is determined.

7. A two-dimensional convolution operator segmentation device, characterized in that: The device comprises: A parameter acquisition module, used to acquire current operating parameters of the AI ​​processor, determine the total computing power and maximum computing density of the AI ​​processor according to the current operating parameters, and construct a Roofline model according to the total computing power and maximum computing density; An alternative method determination module is used to determine multiple alternative segmentation methods corresponding to the two-dimensional convolution operator according to the numerical constraints between the pre-built two-dimensional convolution operator segmentation size and the AI ​​processor operating parameters; The target mode screening module is used to determine the simulation data flow corresponding to each alternative segmentation mode, determine the performance data corresponding to each alternative segmentation mode according to the simulation data flow and the Roofline model, and screen the target segmentation mode corresponding to the two-dimensional convolution operator according to the performance data.

8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the two-dimensional convolution operator segmentation method described in any one of claims 1-6.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the two-dimensional convolution operator segmentation method described in any one of claims 1 to 6 when executed.

10. A computer program product, characterized in that The computer program product comprises a computer program, which, when executed by a processor, implements the two-dimensional convolution operator segmentation method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Operator operation scheduling method and device

    CN111796917A

  • Method and device for determining segmentation mode of operator, equipment and medium

    CN117785492A

  • Operator processing method and apparatus, and chip, computing device and storage medium

    WO2024131170A1

Cited By

  • Performance overhead model processing method of screening and sorting operator, data processing method based on screening and sorting operator, electronic equipment, storage medium and program

    CN122431840A