Convolution operator shape parameter processing method and device, equipment, medium and product

By automatically generating and selecting candidate values ​​for convolution operator shape parameters, the problem of manual parameter adjustment in image processing is solved, the efficiency and accuracy of image processing is improved, and manual intervention and time cost is reduced.

CN119202495AActive Publication Date: 2024-12-27BEIJING QINGCHENG JIZHI TECHNOLOGY CO LTD
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202411211046.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-30
Publication Date
2024-12-27
Estimated Expiration
2044-08-30

AI Technical Summary

Technical Problem

During image processing, there are many convolution operators, manual parameter adjustment takes a long time, and parameter adjustment efficiency is low. The existing technology relies on manual adjustment of shape parameters, resulting in high time cost and high potential error rate.

Method used

By determining the initial value combination and search space of the convolution operator shape parameters, the candidate parameter value combination is automatically generated, the operator can perform the shortest time-consuming combination, and assign values ​​to the convolution operator shape parameters to reduce manual intervention and improve optimization efficiency.

Benefits of technology

The complexity and time cost of parameter adjustment are reduced, the accuracy and efficiency of optimization are improved, the blind search in the entire parameter space is reduced, and the efficiency of parameter tuning is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119202495A_ABST
    Figure CN119202495A_ABST
Patent Text Reader

Abstract

The invention discloses a convolution operator shape parameter processing method and device, equipment, a medium and a product, and relates to the technical field of image processing, and the method comprises the steps: determining each convolution operator shape parameter of a convolution operator in a to-be-optimized image processing project; determining an initial parameter value combination of each convolution operator shape parameter, and determining a parameter search space of each convolution operator shape parameter based on the initial parameter value combination; determining a plurality of groups of candidate parameter value combinations of each convolution operator shape parameter based on the respective parameter search space of each convolution operator shape parameter, operating each group of candidate parameter value combinations in the to-be-optimized image processing project, and determining operator execution time consumption of the convolution operators under each group of candidate parameter value combinations; and assigning the candidate parameter value combination with the shortest operator execution time consumption in each group of candidate parameter value combinations to each convolution operator shape parameter. According to the method and the device, the tuning efficiency of tuning the shape parameters of the operator is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to a convolution operator shape parameter processing method, device, equipment, medium and product. Background Art

[0002] The GPU (Graphics Processing Unit) acceleration library is a series of libraries for performing general computing tasks on graphics processing units. For example, the CUTLASS library is a high-performance CUDA (Compute Unified Device Architecture) C++ library designed by NVIDIA to accelerate matrix multiplication and convolution operations in deep learning. In the process of using the GPU acceleration library for image processing, the parameter values ​​of the shape parameters of the convolution operator required in the image processing process can be adjusted to optimize the convolution operator, thereby improving the computational efficiency in the image processing process. At present, the parameter values ​​of the shape parameters are mainly adjusted manually. However, in the image processing process, the number of convolution operators is large, and the parameter search space of the shape parameters of each operator is large. Manual parameter adjustment takes a long time and has low parameter adjustment efficiency.

[0003] The above contents are only used to assist in understanding the technical solution of the present application and do not constitute an admission that the above contents are prior art. Summary of the invention

[0004] The main purpose of this application is to provide a convolution operator shape parameter processing method, device, equipment, medium and product, aiming to solve the technical problems of time-consuming manual parameter adjustment and low parameter adjustment efficiency.

[0005] To achieve the above purpose, the present application proposes a convolution operator shape parameter processing method, the method comprising:

[0006] Determine each convolution operator shape parameter of the convolution operator in the image processing project to be optimized;

[0007] Determining an initial parameter value combination of each convolution operator shape parameter, and determining a parameter search space of each convolution operator shape parameter based on the initial parameter value combination;

[0008] Determining multiple groups of candidate parameter value combinations of each convolution operator shape parameter based on the respective parameter search spaces of each convolution operator shape parameter, running each group of the candidate parameter value combinations in the image processing project to be optimized, and determining the operator execution time of the convolution operator under each group of the candidate parameter value combinations;

[0009] The candidate parameter value combination with the shortest operator execution time in each group of the candidate parameter value combinations is assigned to each convolution operator shape parameter.

[0010] In one embodiment, the step of determining the shape parameters of the image processing project to be optimized includes:

[0011] Deploying the graphics processing project to be optimized on an image processor, and performing operator fusion on the image processing project to be optimized to obtain a fusion operator;

[0012] Determine the image input size and the image output size of the image processing project to be optimized, determine the convolution operator from each of the fusion operators, and determine the convolution operator shape parameters of the convolution operator based on the image input size and the image output size.

[0013] In one embodiment, the step of determining the initial parameter value combination of each convolution operator shape parameter includes:

[0014] Determining initial parameter values ​​corresponding to shape parameters of each convolution operator based on the image input size and the image output size;

[0015] The initial parameter values ​​of the shape parameters of the convolution operators are combined to obtain an initial parameter value combination.

[0016] In one embodiment, the step of determining the parameter search space of each convolution operator shape parameter based on the initial parameter value combination includes:

[0017] Obtaining a preset neighborhood range corresponding to each of the convolution operator shape parameters;

[0018] For any benchmark operator parameter of each convolution operator shape parameter, the parameter search space of the benchmark operator parameter is obtained by taking the initial parameter value corresponding to the benchmark operator parameter in the initial parameter value combination as the center and the preset neighborhood range corresponding to the benchmark operator parameter as the value range.

[0019] In one embodiment, before the step of determining multiple groups of candidate parameter value combinations of each convolution operator shape parameter based on the respective parameter search spaces of each convolution operator shape parameter, the method further includes:

[0020] Determine the number of calls of each of the convolution operator shape parameters;

[0021] The step of determining multiple groups of candidate parameter value combinations of each convolution operator shape parameter based on the respective parameter search spaces of each convolution operator shape parameter comprises:

[0022] The parameter search space of each convolution operator shape parameter is traversed in descending order of the number of calls to obtain multiple groups of candidate parameter value combinations of each convolution operator shape parameter.

[0023] In one embodiment, the step of running each group of the candidate parameter value combinations in the image processing project to be optimized and determining the operator execution time of the convolution operator under each group of the candidate parameter value combinations includes:

[0024] For any target parameter value combination in each group of the candidate parameter value combinations, the target parameter value combination is defined as an environment variable through a Shell script, the parameter variable is retrieved through the environment variable in the compilation setting file of the image processing project to be optimized, and the parameter variable is defined as a global macro through a compilation option;

[0025] At the to-be-optimized position of the source file of the to-be-optimized image processing project, the global macro is passed as a variable parameter in a function to obtain a target file;

[0026] Compile and run the image processing project to be optimized based on the target file, and determine the time consumed in compiling and running the image processing project to be optimized based on the target file, and use the time consumed in compiling and running as the operator execution time consumed by the convolution operator under the target parameter value combination.

[0027] In addition, to achieve the above purpose, the present application also proposes a convolution operator shape parameter processing device, the convolution operator shape parameter processing device comprising:

[0028] A first determination module is used to determine each convolution operator shape parameter of the convolution operator in the image processing project to be optimized;

[0029] A second determination module is used to determine an initial parameter value combination of each convolution operator shape parameter, and determine a parameter search space of each convolution operator shape parameter based on the initial parameter value combination;

[0030] A third determination module is used to determine multiple groups of candidate parameter value combinations of each convolution operator shape parameter based on the parameter search space of each convolution operator shape parameter, run each group of the candidate parameter value combination in the image processing project to be optimized, and determine the operator execution time of the convolution operator under each group of the candidate parameter value combination;

[0031] An assignment module is used to assign the candidate parameter value combination with the shortest operator execution time in each group of the candidate parameter value combinations to each convolution operator shape parameter.

[0032] In addition, to achieve the above-mentioned purpose, the present application also proposes a convolution operator shape parameter processing device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, and the computer program is configured to implement the steps of the convolution operator shape parameter processing method as described above.

[0033] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by the processor, the steps of the convolution operator shape parameter processing method described above are implemented.

[0034] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, it implements the steps of the convolution operator shape parameter processing method as described above.

[0035] In the present application, each convolution operator shape parameter of the convolution operator in the image processing project to be optimized is determined; an initial parameter value combination of each convolution operator shape parameter is determined, and a parameter search space of each convolution operator shape parameter is determined based on the initial parameter value combination; multiple groups of candidate parameter value combinations of each convolution operator shape parameter are determined based on the parameter search space of each convolution operator shape parameter, each group of the candidate parameter value combinations is run in the image processing project to be optimized, and the operator execution time of the convolution operator under each group of the candidate parameter value combinations is determined; and the candidate parameter value combination with the shortest operator execution time in each group of the candidate parameter value combinations is assigned to each convolution operator shape parameter.

[0036] Compared with manual parameter tuning, the present application defines an efficient search range by defining the search space for each parameter, thereby avoiding blind search in the entire parameter space and improving the efficiency of parameter tuning. In addition, the present application reduces manual intervention and the complexity and time cost of parameter tuning by automatically generating multiple sets of candidate parameter value combinations and selecting the parameter value combination with the shortest operator execution time, while improving the accuracy and efficiency of optimization. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0038] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0039] Figure 1 A schematic diagram of a flow chart provided for the first embodiment of the convolution operator shape parameter processing method of the present application;

[0040] Figure 2 A schematic diagram of a flow chart provided for the second embodiment of the convolution operator shape parameter processing method of the present application;

[0041] Figure 3 A schematic diagram of a convolution operator shape parameter processing method provided in accordance with an embodiment of the present application;

[0042] Figure 4 This is a schematic diagram of the module structure of the convolution operator shape parameter processing device according to an embodiment of the present application;

[0043] Figure 5 Schematic diagram of the device structure of the hardware operating environment involved in the convolution operator shape parameter processing method in the embodiment of the present application.

[0044] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0045] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.

[0046] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.

[0047] The main solution of the embodiment of the present application is: determining each convolution operator shape parameter of the convolution operator in the image processing project to be optimized; determining an initial parameter value combination of each convolution operator shape parameter, and determining a parameter search space of each convolution operator shape parameter based on the initial parameter value combination; determining multiple groups of candidate parameter value combinations of each convolution operator shape parameter based on the parameter search space of each convolution operator shape parameter, running each group of the candidate parameter value combination in the image processing project to be optimized, and determining the operator execution time of the convolution operator under each group of the candidate parameter value combination; assigning the candidate parameter value combination with the shortest operator execution time in each group of the candidate parameter value combination to each convolution operator shape parameter.

[0048] In this embodiment, for the convenience of description, (executing subject) is used as the executing subject for explanation below.

[0049] The CUTLASS library is a high-performance CUDA C++ library designed by NVIDIA to accelerate matrix multiplication and convolution operations in deep learning (CUDA is a parallel computing platform and programming model invented by NVIDIA). The CUTLASS library is mainly optimized for GPUs, and by using technologies such as CUDA Warp-Level Primitives and Tensor Cores, efficient parallel processing of matrix multiplication and convolution operations is achieved. The CUTLASS library provides a rich API interface and supports multiple data types and precision. The CUTLASS library is highly customizable and flexible, allowing developers to implement operator fusion on NVIDIA GPUs, thereby improving the efficiency of deep learning calculations.

[0050] The CUTLASS library implements operator fusion by merging multiple computing operations into one kernel, thereby reducing the number of data reads and writes and improving computing efficiency. Specifically, the CUTLASS library can perform other operations such as activation functions, normalization, Dropout, etc. while performing matrix multiplication or convolution operations, so as to avoid reading and writing data multiple times, reduce memory bandwidth consumption, and improve computing efficiency. For example, in deep learning models, convolutional layers are usually used in combination with activation layers, normalization layers, etc. If these layers are implemented by different kernels, then each calculation requires reading data from the GPU memory into registers and then writing it back to the GPU memory, which consumes a lot of memory bandwidth. However, if the operator fusion function of the CUTLASS library is used, these operations can be merged into one kernel, and all calculations can be completed directly in registers, avoiding the process of reading and writing data multiple times, thereby improving computing efficiency.

[0051] The CUTLASS library provides an automatic tuning function that can automatically select the optimal algorithm and CUTLASS parameters according to different hardware configurations and data types, but the automatic tuning strategy is not necessarily optimal for convolution operators of specific shapes. In specific practical application scenarios, if the shape parameters of the convolution operator required for the calculation (the dimensions of the input and output tensors, the size of the convolution kernel, the step size, padding, etc.) are known, the operator can be further optimized at a customized level. For example, for the application scenario of using the diffusion model to perform text and image tasks, if the model structure used and the input and output sizes of the image have been determined, the shape parameters of all convolution operators that the model needs to process and calculate can also be determined accordingly, and then more optimized CUTLASS parameters can be customized for convolution operators of specific shapes for operator fusion, further improving computational efficiency.

[0052] The existing solution is manual parameter tuning, which requires a lot of manpower and time for the following reasons:

[0053] 1) A large number of operators to be adjusted: Different output image sizes are required according to business needs. Each output image size corresponds to a certain number of convolution operators of different shapes, and these operators need to be manually adjusted. Taking the Stable Diffusion v1.5 model with an output image size of 512*512 as an example, the number of convolution operators to be processed is about 60. Depending on the requirements of different businesses for the output image size, the total number of operators to be processed may reach hundreds.

[0054] 2) Large parameter search space and long search time: There are 11 parameters to be debugged, which together determine the parallel execution strategy and memory access mode of the kernel. Each parameter has a discrete value and at least two possible values, so there are thousands of different parameter combinations, and the search space is very large. Each time a different parameter combination is debugged, the project needs to be recompiled. Even for projects with a faster compilation speed (about 10 seconds), the total parameter tuning time for a single operator is at least several hours.

[0055] 3) Manual parameter adjustment brings additional costs: Existing technical solutions rely on manual modification of parameters for debugging and recording, which greatly increases additional manpower and time costs as well as potential error rates.

[0056] According to practical experience, the time cost required for adjusting parameters for a single output size using existing methods is about 20 days, which poses a great obstacle to actual engineering mass production.

[0057] In view of the above reasons, the purpose of this application is to: 1) In order to address the problem of time-consuming parameter search, design a heuristic search method to narrow the search space and reduce the search time of the parameter adjustment process; 2) In order to address the problem of high cost of manual parameter adjustment, design an automated parameter adjustment method to reduce manpower requirements; This application starts from the above two aspects to reduce the manpower and time costs of the operator parameter adjustment process.

[0058] Compared with manual parameter tuning, the present application defines an efficient search range by defining the search space for each parameter, thereby avoiding blind search in the entire parameter space and improving the efficiency of parameter tuning. In addition, the present application reduces manual intervention and the complexity and time cost of parameter tuning by automatically generating multiple sets of candidate parameter value combinations and selecting the parameter value combination with the shortest operator execution time, while improving the accuracy and efficiency of optimization.

[0059] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, (execution subject), etc. The following takes (execution subject) as an example to illustrate this embodiment and the following embodiments.

[0060] Based on this, the embodiment of the present application provides a convolution operator shape parameter processing method, referring to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the convolution operator shape parameter processing method of the present application.

[0061] In this embodiment, the convolution operator shape parameter processing method includes steps S10 to S40:

[0062] Step S10, determining each convolution operator shape parameter of the convolution operator in the image processing project to be optimized;

[0063] It should be noted that the convolution operator is a mathematical tool used to perform convolution operations, and is widely used in signal processing, image processing, computer vision, and deep learning. The convolution operator is usually a small two-dimensional matrix, also known as a filter or kernel. In deep learning, especially in convolutional neural networks (CNNs), the convolution operator is used to extract features from input data. The convolution operator shape parameter is the shape parameter of the convolution operator, which usually refers to the size, step size, padding and other properties of the convolution kernel. The image processing project to be optimized refers to the image processing task or software that needs to be optimized for performance.

[0064] Identifying and listing all shape parameters of the convolution operators used in image processing projects, such as kernel size, step size, padding, etc., ensures the comprehensiveness of the optimization process and provides necessary parameter information for subsequent steps.

[0065] Step S20, determining an initial parameter value combination of each convolution operator shape parameter, and determining a parameter search space of each convolution operator shape parameter based on the initial parameter value combination;

[0066] It should be noted that the initial parameter value combination is a set of parameter values ​​set at the beginning of the optimization process as the starting point of the optimization. The parameter search space refers to the range of values ​​that each parameter can take during the optimization process.

[0067] By setting an initial parameter value for each convolution operator shape parameter, based on these initial values, the search space of each parameter, that is, the range in which the parameter may vary, is determined, which provides a starting point for subsequent parameter optimization and limits the search scope, helping to improve search efficiency.

[0068] Step S30, determining multiple groups of candidate parameter value combinations of each convolution operator shape parameter based on the respective parameter search spaces of each convolution operator shape parameter, running each group of the candidate parameter value combinations in the image processing project to be optimized, and determining the operator execution time of the convolution operator under each group of the candidate parameter value combinations;

[0069] It should be noted that the candidate parameter value combination is a set of possible parameter values ​​selected according to a certain strategy in the search space for performance evaluation. Operator execution time refers to the time spent by the convolution operator during execution, which is an important indicator for evaluating operator performance.

[0070] In this embodiment, multiple groups of candidate parameter value combinations are generated in the search space of each parameter, these candidate parameter value combinations are run in the image processing project, and the execution time of the convolution operator under each group of parameter value combinations is recorded.

[0071] Step S40, assigning the candidate parameter value combination with the shortest operator execution time in each group of the candidate parameter value combinations to the shape parameters of each convolution operator.

[0072] It can be understood that, from all candidate parameter value combinations, the combination with the shortest operator execution time is selected, which ensures that the parameter combination finally selected can minimize the consumption of computing resources and processing time while maintaining or improving the image processing quality.

[0073] Compared with manual parameter tuning, the present application defines an efficient search range by defining the search space for each parameter, thereby avoiding blind search in the entire parameter space and improving the efficiency of parameter tuning. In addition, the present application reduces manual intervention and the complexity and time cost of parameter tuning by automatically generating multiple sets of candidate parameter value combinations and selecting the parameter value combination with the shortest operator execution time, while improving the accuracy and efficiency of optimization.

[0074] In one feasible implementation, the step of determining the shape parameters of the image processing project to be optimized includes:

[0075] Step S101, deploying the graphics processing project to be optimized on the image processor, and performing operator fusion on the image processing project to be optimized to obtain a fusion operator;

[0076] It should be noted that the image processing project is first deployed on the image processor, which usually involves transferring the project code and resources to the processing hardware, analyzing and merging multiple convolution operators in the project to form one or more fusion operators. The fusion operator can reduce repeated calculations and memory accesses, thereby improving processing efficiency.

[0077] It can be understood that by reducing repeated calculations, the overall computing efficiency is improved and the computing resources of the image processor are more effectively utilized.

[0078] Step S102, determining the image input size and the image output size of the image processing project to be optimized, and determining a convolution operator from each of the fusion operators, and determining a convolution operator shape parameter of the convolution operator based on the image input size and the image output size.

[0079] It should be noted that the image input size and image output size refer to the resolution or size of the input image and output image in the image processing project. The neighborhood range refers to the range of values ​​that can be taken with the initial parameter value as the center when determining the parameter search space.

[0080] By clarifying the input and output sizes of the image processing project, the operators that actually perform the convolution operation are identified from the fusion operators. Based on the input and output sizes, the shape parameters of these convolution operators, such as the convolution kernel size and step size, are determined. This ensures that the shape parameters of the convolution operator match the image size and achieves accurate image processing effects. Appropriate convolution operator parameters can reduce unnecessary calculations and improve processing speed.

[0081] In one feasible implementation, the step of determining the initial parameter value combination of each convolution operator shape parameter includes:

[0082] Step S201, determining initial parameter values ​​corresponding to shape parameters of each convolution operator based on the image input size and the image output size;

[0083] According to the input size and output size of the image, an initial shape parameter value is determined for each convolution operator. For example, if the output size is half of the input size, the corresponding convolution kernel size and step size may be selected. This implementation can ensure that the initial parameter value is adapted to the image size, provide a reasonable starting point for subsequent optimization, narrow the search space, and reduce unnecessary calculations.

[0084] Step S202, combining the initial parameter values ​​of the shape parameters of the convolution operators to obtain an initial parameter value combination.

[0085] The initial shape parameter values ​​of all convolution operators are combined into a parameter set, which will serve as the starting point of the optimization algorithm. This ensures that the parameters of all convolution operators are coordinated and consistent at the beginning of the optimization, providing a clear starting point for evaluating the impact of subsequent parameter adjustments.

[0086] By determining the initial parameter values ​​based on the image size, a more reasonable starting point is provided for the optimization algorithm, which helps to converge to the optimal solution faster. Reasonable initial parameter values ​​can reduce the number of candidate solutions that need to be evaluated, thereby reducing the overall amount of calculation.

[0087] In one feasible implementation, the step of determining the parameter search space of each convolution operator shape parameter based on the initial parameter value combination includes:

[0088] Step S203, obtaining a preset neighborhood range corresponding to each of the convolution operator shape parameters;

[0089] A preset neighborhood range is determined for each convolution operator shape parameter. This neighborhood range defines the maximum distance or interval that the parameter can vary around the initial value, clarifies the search boundary of each parameter, helps to limit the search range, and improves the search efficiency. By limiting the neighborhood range, invalid searches can be avoided in parameter areas that have little impact on performance.

[0090] Step S204: For any benchmark operator parameter of each convolution operator shape parameter, taking the initial parameter value corresponding to the benchmark operator parameter in the initial parameter value combination as the center and taking the preset neighborhood range corresponding to the benchmark operator parameter as the value range, obtain the parameter search space of the benchmark operator parameter.

[0091] For any benchmark operator parameter of each convolution operator shape parameter, the search space of this parameter is determined with the value of the parameter in the initial parameter value combination as the center and the preset neighborhood range as the boundary.

[0092] By centering on the initial value, we can focus search resources on the area where better solutions are most likely to be found. While maintaining search flexibility, we can limit the search by the neighborhood range to avoid wasting resources.

[0093] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can refer to the above introduction, and will not be repeated later. Figure 2 , step S30: before determining the multiple groups of candidate parameter value combinations of the respective convolution operator shape parameters based on the respective parameter search spaces of the respective convolution operator shape parameters, the convolution operator shape parameter processing method further comprises step S01:

[0094] Step S01, determining the number of calls of each convolution operator shape parameter;

[0095] It should be noted that the number of calls refers to the number of times a convolution operator is executed during the optimization process.

[0096] It is understandable that by counting and recording the frequency of each convolution operator being called in the image processing project, we can identify the more critical or frequently used operators in the project, provide more attention to the optimization of these operators, reasonably allocate optimization resources according to the number of calls, and ensure that the optimization work is concentrated on the part that has the greatest impact on performance.

[0097] The step S20: determining a plurality of groups of candidate parameter value combinations of each convolution operator shape parameter based on the respective parameter search spaces of each convolution operator shape parameter, comprises:

[0098] Step S301, traversing the parameter search space of each convolution operator shape parameter in descending order of the number of calls to obtain multiple groups of candidate parameter value combinations of each convolution operator shape parameter.

[0099] It can be understood that sorting the convolution operators from high to low in terms of calling frequency, traversing the parameter search space of each convolution operator in this order, and generating multiple sets of candidate parameter value combinations can ensure that the most frequently called operators are optimized first. Optimizing the most frequently used operators can bring more significant overall performance improvements.

[0100] In one feasible implementation, the step S30: running each group of the candidate parameter value combinations in the image processing project to be optimized, and determining the operator execution time of the convolution operator under each group of the candidate parameter value combinations, includes:

[0101] Step S302, for any target parameter value combination in each group of the candidate parameter value combinations, define the target parameter value combination as an environment variable through a Shell script, retrieve the parameter variable through the environment variable in the compilation setting file of the image processing project to be optimized, and define the parameter variable as a global macro through a compilation option;

[0102] It should be noted that Shell script is a scripting language used in Linux or Unix systems to automate command line tasks. Environment variables are variables defined in the operating system that can be referenced in the program for configuration or passing information. Compile settings files are configuration files used in software development to define how the compiler compiles source code. Global macros are preprocessing instructions in programming that can be replaced with specific code snippets at compile time. Global macros are macros that are valid throughout the entire program.

[0103] It can be understood that by writing a shell script, a selected set of candidate parameter value combinations are defined as environment variables, and in the compilation setting file, parameter values ​​are obtained by reading these environment variables, and these parameter values ​​are defined as global macros using compiler options for use during the compilation process. The parameter configuration process can be automated, human errors can be reduced, and efficiency can be improved. The use of environment variables provides a high degree of flexibility and facilitates quick switching between different parameter combinations.

[0104] Step S303, at the to-be-optimized position of the source file of the to-be-optimized image processing project, the global macro is passed as a variable parameter in a function to obtain a target file;

[0105] It should be noted that the target file refers to the intermediate file generated during the compilation process, which contains the code processed by the compiler.

[0106] It can be understood that at the location to be optimized in the source code, the global macro is passed as a function parameter, allowing the behavior of the algorithm to be adjusted according to the value of the macro definition at compile time, reducing code duplication through macro definition and improving code maintainability.

[0107] Step S304, compile and run the image processing project to be optimized based on the target file, and determine the time consumed for compiling and running the image processing project to be optimized based on the target file, and use the time consumed for compiling and running as the operator execution time of the convolution operator under the target parameter value combination.

[0108] It should be noted that compilation and running refer to the process of converting source code into an executable file and executing this file.

[0109] It can be understood that by using the target file to compile and run, an executable file is generated, and the time required to compile and run the executable file is measured and recorded, and this time is used as the execution time of the convolution operator under the group of parameter value combinations. This embodiment provides a quantitative method to evaluate the impact of different parameter combinations on performance, and based on the actual measurement results, more informative optimization decisions can be made.

[0110] Exemplarily, in order to help understand the implementation process of the convolution operator shape parameter processing method obtained by combining this embodiment with the above-mentioned embodiment 1, this embodiment provides a brief process of the convolution operator shape parameter processing method.

[0111] The CUTLASS library provides an automatic tuning function. You can call the cutlass::conv::findOperation function to automatically find the default convolution operator fusion strategy. However, as mentioned above, the automatic tuning strategy is not optimal. In order to optimize the CUTLASS convolution operator fusion strategy, the existing method determines the optimal operator parameters by manual parameter adjustment. The specific steps are as follows:

[0112] Preparation: You need to have an image processing project that contains convolution operations to be optimized, and have completed the installation and configuration of the CUTLASS library. Use the CUTLASS library to perform CUTLASS default automatic optimization on the project; Determine the operator shape: After clarifying the specific sizes of the input and output images, record the shape parameters of all convolution operators used through the actual compilation and running process, including the dimension of the input tensor, the size of the convolution kernel, the step size, padding, and grouping; Manual parameter tuning: For each shape of the convolution operator, use the convolution kernel function of the CUTLASS library to replace it, and manually adjust the configuration parameters of the kernel function. Recompile the project after each parameter change, measure the average time consumption of the operator multiple times, and find the optimal parameter configuration; Determine the replacement plan: Keep the replacement plan for the operator with more obvious optimization effect during the tuning process; Test the overall performance and record the effect improvement.

[0113] The main process of the technical solution of this application includes: preparing CUTLASS project, determining operator shape, heuristic search parameter combination, automatic parameter adjustment, and testing performance improvement; the overall flow chart is as follows Figure 3 Each step is described in detail below, and at the end of this section, examples in specific scenarios are used to introduce how this application solution is implemented:

[0114] 1) Prepare CUTLASS project (system device preparation)

[0115] To apply this application, you need to be equipped with at least one NVIDIA GPU, an image processing project to be optimized (such as a diffusion model Vincent image project) and deployed on the GPU, and the CUTLASS library has been used to perform CUTLASS default operator fusion automatic optimization on the project. This application will further customize the optimization of operators of specific shapes.

[0116] 2) Determine the operator shape

[0117] First, you need to determine the required set of image input and output sizes. After determining, print out and record the shape parameters of all convolution operators used in this case in the code, and count all operators of different shapes and their number of calls. Shape parameters include: the dimension of the input tensor, the size of the convolution kernel, the step size, padding, and grouping. Prioritize operators with more calls. The following steps explain how to tune the parameters of an operator of a certain shape.

[0118] 3) Heuristic search parameter combination

[0119] 3.1 Introduction to parameters to be adjusted

[0120] First, we need to clarify the CUTLASS parameters to be adjusted and their functions. ThreadblockShape, WarpShape and InstructionShape are the configuration parameters of the convolution kernel function in the CUTLASS library, and stage and split_k are the configuration parameters of the matrix multiplication. They directly determine the parallel execution strategy and memory access mode of the kernel. The following first introduces the meaning of these parameters in detail:

[0121] ThreadblockShape defines the shape of a thread block, usually represented as a three-dimensional vector, corresponding to the output channel, output height, and output width dimensions in the convolution calculation. For example, ThreadblockShape(128,128,32) means that each thread block is responsible for calculating 128 output channels, 128 pixels in the output height direction, and 32 pixels in the output width direction in the output feature map. The size of the thread block directly affects the degree of parallelism of the calculation and the utilization of GPU resources. Larger thread blocks can improve the calculation density, but may increase the use of shared memory. On the contrary, smaller thread blocks may reduce the calculation efficiency.

[0122] The WarpShape parameter is the way ThreadblockShape is divided at the warp granularity, also expressed as a three-dimensional vector, which specifies the responsibility range of each warp in the output channel, output height, and output width dimensions. For example, if ThreadblockShape is (128,128,32) and WarpShape is (64,16,8), this means that each warp will process 64 output channels, 16 pixels in the output height direction, and 8 pixels in the output width direction. This division method helps optimize memory access and computational load balancing between warps.

[0123] The InstructionShape parameter describes the shape of the SIMT (Single Instruction, Multiple Threads) instruction, which determines how threads collaborate in matrix multiplication. In modern GPUs, MMA (Matrix Multiply-Accumulate) units are often used to perform matrix multiplication and accumulation operations. InstructionShape defines the scale of the multiplication operations in which each thread in the MMA unit participates. For example, InstructionShape(8,8,16) means that the scale of the multiplication operations in which each thread participates is 8x8x16, that is, each thread will process 8 rows of matrix A data and 8 columns of matrix B data, and perform 16 accumulation operations.

[0124] The Stage parameter mainly specifies the complexity level of the GEMM (General Matrix Multiply) kernel. More specifically, it involves the number of intermediate registers in the operation and how to reuse data between these registers. A higher stage value means a higher register reuse rate, which can reduce the number of accesses to on-chip memory and thus improve computational efficiency. However, a high stage value may also increase the latency of the operation because more computational steps are introduced. Therefore, choosing the appropriate stage value is a process of balancing computational efficiency and latency.

[0125] The split_k parameter controls whether and how matrix multiplications are split into multiple smaller multiplication operations. In matrix multiplication for deep learning, especially when the matrix size is very large, performing the multiplication directly in one go may not be feasible due to video memory limitations. Using split_k, the multiplication operation can be split into k smaller multiplications, each processing a portion of the matrix. The benefit of this is that it reduces the required video memory while improving computational efficiency by reusing intermediate results. However, this may also introduce additional overhead, such as more memory read and write operations.

[0126] The above are all the CUTLASS parameters to be adjusted, a total of 11 variable parameters. In actual applications, developers need to adjust these parameters through experiments according to the specific hardware platform and problem scale to achieve the best performance.

[0127] 3.2 Heuristic Search Method

[0128] It can be found that the complete parameter search space is very large. The following describes how this application uses a heuristic search method to narrow the search space, thereby reducing the time spent on parameter adjustment.

[0129] In general, it can be considered that the default parameter configuration of CUTLASS is close to the optimal solution. Using this prior knowledge as inspiration, the optimal solution can be found by searching within a small neighborhood of the default parameter combination.

[0130] Specifically, we first determine the shape of the operator to be optimized, and find the default parameter configuration combination of the operator through CUTLASS configuration. With this parameter combination as the center, we make corresponding fine-tuning for each parameter based on the characteristics and experimental experience to form a small neighborhood as the optimized search space.

[0131] For the ThreadblockShape parameter, restrictions are imposed on it based on experimental experience to narrow the search space. For example, the first dimension is usually taken as {256, 128, 64}, the second dimension is usually taken as {128, 64}, and the third dimension is usually taken as {64, 32}. Similarly, restrictions are imposed on the remaining parameters based on prior experience. For example, for the WarpShape parameter, which is strongly correlated with the ThreadblockShape parameter, the first dimension is usually taken as 1 / 2 or 1 / 4 of the first dimension of ThreadblockShape, the second dimension is usually taken as 1 / 2 of the second dimension of ThreadblockShape, and the third dimension is usually taken as the same as the third dimension of ThreadblockShape; for the InstructionShape parameter, the value is usually (16, 8, 16); for the stage parameter, the value is usually 3; for the split_k parameter, the value is usually {4, 2, 1}. In this way, the number of parameter combinations in the search space can be reduced to about 40, which greatly reduces the time consumption of the search process.

[0132] 4) Automated parameter adjustment

[0133] In the previous step, the parameter search space is determined. In the next step, the automated script needs to be used to cyclically debug each parameter combination in the search space. The specific logic flow inside the automated parameter tuning script is as follows: Figure 1 The details are as follows:

[0134] 4.1 First, determine whether the traversal of the search space has ended. If so, end the loop and jump to 4.5; otherwise, continue to traverse the search space, take out a set of parameter combinations that have not been debugged, and proceed to the next step;

[0135] 4.2 First, define the above parameter values ​​as environment variables through the shell script to control the compilation of the project; then in the project's compilation setting file (such as setup.py, cmake), take the parameter variables through the environment variables, and then define the parameters as global macros through the compilation options;

[0136] 4.3 Pass these macros as variable parameters in the function at the location to be optimized in the source file, so that the corresponding parameters of the source file during compilation can be controlled by automatically traversing the environment variable values ​​in the script; proceed to the next step;

[0137] 4.4 Try to compile and run the project. If both pass, measure the operator time consumption under the parameter combination, take the average of multiple measurements and record them; if it fails, capture the error and jump back to 4.1 to execute the next cycle;

[0138] 4.5 Determine the optimal parameter solution based on the operator time-consuming records, and retain the replacement solutions for operators with more obvious optimization effects.

[0139] 5) Test performance improvement

[0140] After completing the replacement optimization of a single shape operator and after completing the optimization of all operators, it is necessary to test the performance improvement to verify the effectiveness of the above steps.

[0141] The following is an example of applying the solution of this application in a specific scenario.

[0142] In this application example, the project to be optimized is a Wenshengtu project based on various diffusion models, and the CUTLASS operator fusion has been completed through the Stable Fast inference acceleration framework (https: / / github.com / chengzeyi / stable-fast). The optimization requirement is to complete the parameter tuning of operator fusion for at least two commonly used diffusion models on different GPU architectures (including V100 and A100, etc.), for several commonly used output image sizes, to replace the default parameter configuration to achieve better performance. As mentioned above, the existing manual parameter adjustment method consumes huge manpower and time costs, which is not conducive to mass engineering production. Therefore, this application can be used to reduce the manpower and time costs of the operator parameter adjustment process.

[0143] 1) Preparation: First, determine the debugging object in a single experiment, that is, the type of diffusion model and GPU architecture, and deploy the diffusion model accelerated by the Stable Fast framework to the specified GPU. Then determine the output image size to complete the preparation.

[0144] 2) Determine the operator shape: In the code part where Stable Fast takes over the convolution operator, print out and record the shape parameters of all convolution operators used, count all operators of different shapes and their call times, and give priority to operators with more calls.

[0145] 3) Heuristic search for parameter combinations: For a convolution operator of a specific shape, find the default parameter configuration combination of the operator through CUTLASS configuration. With this parameter combination as the center, make corresponding fine-tuning for each parameter characteristic and refer to the experimental experience described in Section 4.3.2 as the optimized search space.

[0146] Automatic parameter adjustment: Write an automatic script to adjust the parameters. The script logic is not described here.

[0147] 4) Test overall performance and record improvement.

[0148] 5) Effect evaluation

[0149] By applying the technical solution of the present application, the parameter adjustment time for a single output size is reduced to about 3 days; and compared with the existing manual parameter adjustment solution, the use of automated scripts replaces a large number of manual operations, greatly reducing the manpower and time costs of the operator parameter adjustment process, thereby achieving the purpose of the invention.

[0150] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the convolution operator shape parameter processing method of the present application. More forms of simple transformations based on this technical concept are all within the scope of protection of the present application.

[0151] This application also provides a convolution operator shape parameter processing device, please refer to Figure 4 , the convolution operator shape parameter processing device comprises:

[0152] A first determination module 10 is used to determine each convolution operator shape parameter of the convolution operator in the image processing project to be optimized;

[0153] A second determination module 20, configured to determine an initial parameter value combination of each convolution operator shape parameter, and determine a parameter search space of each convolution operator shape parameter based on the initial parameter value combination;

[0154] A third determination module 30 is used to determine multiple groups of candidate parameter value combinations of each convolution operator shape parameter based on the parameter search space of each convolution operator shape parameter, run each group of the candidate parameter value combination in the image processing project to be optimized, and determine the operator execution time of the convolution operator under each group of the candidate parameter value combination;

[0155] The assignment module 40 is used to assign the candidate parameter value combination with the shortest operator execution time in each group of the candidate parameter value combinations to each convolution operator shape parameter.

[0156] Optionally, the first determining module 10 is configured to:

[0157] Deploying the graphics processing project to be optimized on an image processor, and performing operator fusion on the image processing project to be optimized to obtain a fusion operator;

[0158] Determine the image input size and the image output size of the image processing project to be optimized, determine the convolution operator from each of the fusion operators, and determine the convolution operator shape parameters of the convolution operator based on the image input size and the image output size.

[0159] Optionally, the second determining module 20 is configured to:

[0160] Determining initial parameter values ​​corresponding to shape parameters of each convolution operator based on the image input size and the image output size;

[0161] The initial parameter values ​​of the shape parameters of the convolution operators are combined to obtain an initial parameter value combination.

[0162] Optionally, the second determining module 20 is configured to:

[0163] Obtaining a preset neighborhood range corresponding to each of the convolution operator shape parameters;

[0164] For any benchmark operator parameter of each convolution operator shape parameter, the parameter search space of the benchmark operator parameter is obtained by taking the initial parameter value corresponding to the benchmark operator parameter in the initial parameter value combination as the center and the preset neighborhood range corresponding to the benchmark operator parameter as the value range.

[0165] Optionally, the device further includes a fourth determining module, configured to:

[0166] Determine the number of calls of each of the convolution operator shape parameters;

[0167] The third determining module 30 is used to:

[0168] The parameter search space of each convolution operator shape parameter is traversed in descending order of the number of calls to obtain multiple groups of candidate parameter value combinations of each convolution operator shape parameter.

[0169] Optionally, the third determining module 30 is configured to:

[0170] For any target parameter value combination in each group of the candidate parameter value combinations, the target parameter value combination is defined as an environment variable through a Shell script, the parameter variable is retrieved through the environment variable in the compilation setting file of the image processing project to be optimized, and the parameter variable is defined as a global macro through a compilation option;

[0171] At the to-be-optimized position of the source file of the to-be-optimized image processing project, the global macro is passed as a variable parameter in a function to obtain a target file;

[0172] Compile and run the image processing project to be optimized based on the target file, and determine the time consumed in compiling and running the image processing project to be optimized based on the target file, and use the time consumed in compiling and running as the operator execution time consumed by the convolution operator under the target parameter value combination.

[0173] The convolution operator shape parameter processing device provided by the present application adopts the convolution operator shape parameter processing method in the above embodiment, which can solve the technical problems of time-consuming manual parameter adjustment and low parameter adjustment efficiency. Compared with the prior art, the beneficial effects of the convolution operator shape parameter processing device provided by the present application are the same as the beneficial effects of the convolution operator shape parameter processing method provided by the above embodiment, and other technical features in the convolution operator shape parameter processing device are the same as the features disclosed in the above embodiment method, which will not be repeated here.

[0174] The present application provides a convolution operator shape parameter processing device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the convolution operator shape parameter processing method in the above-mentioned embodiment one.

[0175] Reference below Figure 5 , which shows a schematic diagram of the structure of a convolution operator shape parameter processing device suitable for implementing the embodiment of the present application. The convolution operator shape parameter processing device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The convolution operator shape parameter processing device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0176] like Figure 5As shown, the convolution operator shape parameter processing device may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the convolution operator shape parameter processing device are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems may be connected to the I / O interface 1006: input devices 1007 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 1003 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 1009. The communication device 1009 may allow the convolution operator shape parameter processing device to communicate wirelessly or wired with other devices to exchange data. Although the convolution operator shape parameter processing device with various systems is shown in the figure, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems may be implemented or have instead.

[0177] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.

[0178] The convolution operator shape parameter processing device provided by the present application adopts the convolution operator shape parameter processing method in the above embodiment, which can solve the technical problems of time-consuming manual parameter adjustment and low parameter adjustment efficiency. Compared with the prior art, the beneficial effects of the convolution operator shape parameter processing device provided by the present application are the same as the beneficial effects of the convolution operator shape parameter processing method provided by the above embodiment, and the other technical features in the convolution operator shape parameter processing device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.

[0179] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.

[0180] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0181] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the convolution operator shape parameter processing method in the above-mentioned embodiment.

[0182] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM: Random Access Memory), a read-only memory (ROM: Read Only Memory), an erasable programmable read-only memory (EPROM: Erasable Programmable Read Only Memory or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM: CD-Read Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency: Radio Frequency), etc., or any suitable combination of the above.

[0183] The above-mentioned computer-readable storage medium may be included in the convolution operator shape parameter processing device; or it may exist independently without being assembled into the convolution operator shape parameter processing device.

[0184] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by the convolution operator shape parameter processing device, the convolution operator shape parameter processing device: determines each convolution operator shape parameter of the convolution operator in the image processing project to be optimized; determines an initial parameter value combination of each convolution operator shape parameter, and determines a parameter search space of each convolution operator shape parameter based on the initial parameter value combination; determines multiple groups of candidate parameter value combinations of each convolution operator shape parameter based on the parameter search space of each convolution operator shape parameter, runs each group of the candidate parameter value combinations in the image processing project to be optimized, and determines the operator execution time of the convolution operator under each group of the candidate parameter value combinations; assigns the candidate parameter value combination with the shortest operator execution time in each group of the candidate parameter value combinations to each convolution operator shape parameter.

[0185] Computer program code for performing the operations of the present application may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0186] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a sequence different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0187] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.

[0188] The readable storage medium provided in the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned convolution operator shape parameter processing method, and can solve the technical problems of time-consuming manual parameter adjustment and low parameter adjustment efficiency. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in the present application are the same as the beneficial effects of the convolution operator shape parameter processing method provided in the above-mentioned embodiment, and will not be repeated here.

[0189] The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned convolution operator shape parameter processing method when executed by a processor.

[0190] The computer program product provided by the present application can solve the technical problems of time-consuming and low efficiency of manual parameter adjustment. Compared with the prior art, the beneficial effects of the computer program product provided by the present application are the same as the beneficial effects of the convolution operator shape parameter processing method provided in the above embodiment, which will not be repeated here.

[0191] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.

Claims

1. A convolution operator shape parameter processing method, characterized in that: The convolution operator shape parameter processing method comprises: Determine each convolution operator shape parameter of the convolution operator in the image processing project to be optimized; Determining an initial parameter value combination of each convolution operator shape parameter, and determining a parameter search space of each convolution operator shape parameter based on the initial parameter value combination; Determining multiple groups of candidate parameter value combinations of each convolution operator shape parameter based on the respective parameter search spaces of each convolution operator shape parameter, running each group of the candidate parameter value combinations in the image processing project to be optimized, and determining the operator execution time of the convolution operator under each group of the candidate parameter value combinations; The candidate parameter value combination with the shortest operator execution time in each group of the candidate parameter value combinations is assigned to each convolution operator shape parameter.

2. The convolution operator shape parameter processing method according to claim 1, characterized in that: The step of determining the shape parameters of the image processing project to be optimized comprises: Deploying the graphics processing project to be optimized on an image processor, and performing operator fusion on the image processing project to be optimized to obtain a fusion operator; Determine the image input size and the image output size of the image processing project to be optimized, determine the convolution operator from each of the fusion operators, and determine the convolution operator shape parameters of the convolution operator based on the image input size and the image output size.

3. The convolution operator shape parameter processing method according to claim 2, characterized in that: The step of determining the initial parameter value combination of each convolution operator shape parameter comprises: Determining initial parameter values ​​corresponding to shape parameters of each convolution operator based on the image input size and the image output size; The initial parameter values ​​of the shape parameters of the convolution operators are combined to obtain an initial parameter value combination.

4. The convolution operator shape parameter processing method according to claim 3, characterized in that: The step of determining the parameter search space of each convolution operator shape parameter based on the initial parameter value combination comprises: Obtaining a preset neighborhood range corresponding to each of the convolution operator shape parameters; For any benchmark operator parameter of each convolution operator shape parameter, the parameter search space of the benchmark operator parameter is obtained by taking the initial parameter value corresponding to the benchmark operator parameter in the initial parameter value combination as the center and the preset neighborhood range corresponding to the benchmark operator parameter as the value range.

5. The convolution operator shape parameter processing method according to claim 1, characterized in that: Before the step of determining multiple groups of candidate parameter value combinations of each convolution operator shape parameter based on the respective parameter search spaces of each convolution operator shape parameter, the method further includes: Determine the number of calls of each of the convolution operator shape parameters; The step of determining multiple groups of candidate parameter value combinations of each convolution operator shape parameter based on the respective parameter search spaces of each convolution operator shape parameter comprises: The parameter search space of each convolution operator shape parameter is traversed in descending order of the number of calls to obtain multiple groups of candidate parameter value combinations of each convolution operator shape parameter.

6. The convolution operator shape parameter processing method according to any one of claims 1 to 5, characterized in that: The step of running each group of the candidate parameter value combinations in the image processing project to be optimized and determining the operator execution time of the convolution operator under each group of the candidate parameter value combinations includes: For any target parameter value combination in each group of the candidate parameter value combinations, the target parameter value combination is defined as an environment variable through a Shell script, the parameter variable is retrieved through the environment variable in the compilation setting file of the image processing project to be optimized, and the parameter variable is defined as a global macro through a compilation option; At the to-be-optimized position of the source file of the to-be-optimized image processing project, the global macro is passed as a variable parameter in a function to obtain a target file; Compile and run the image processing project to be optimized based on the target file, and determine the time consumed in compiling and running the image processing project to be optimized based on the target file, and use the time consumed in compiling and running as the operator execution time consumed by the convolution operator under the target parameter value combination.

7. A convolution operator shape parameter processing device, characterized in that: The convolution operator shape parameter processing device comprises: A first determination module is used to determine each convolution operator shape parameter of the convolution operator in the image processing project to be optimized; A second determination module is used to determine an initial parameter value combination of each convolution operator shape parameter, and determine a parameter search space of each convolution operator shape parameter based on the initial parameter value combination; A third determination module is used to determine multiple groups of candidate parameter value combinations of each convolution operator shape parameter based on the parameter search space of each convolution operator shape parameter, run each group of the candidate parameter value combination in the image processing project to be optimized, and determine the operator execution time of the convolution operator under each group of the candidate parameter value combination; An assignment module is used to assign the candidate parameter value combination with the shortest operator execution time in each group of the candidate parameter value combinations to each convolution operator shape parameter.

8. A convolution operator shape parameter processing device, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the convolution operator shape parameter processing method according to any one of claims 1 to 6.

9. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the convolution operator shape parameter processing method according to any one of claims 1 to 6 are implemented.

10. A computer program product, characterized in that The computer program product comprises a computer program, which, when executed by a processor, implements the steps of the convolution operator shape parameter processing method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Operator optimization method and device, storage medium and electronic equipment

    CN116663618A

  • Data processing method and device, equipment and medium

    CN117170685A

  • Neural network searching method and device, image processing method and device, equipment and medium

    CN118193182A

  • Mitigating overfitting in training machine trained networks

    US10586151B1