Segmentation strategy determination and segmentation method and device of operator data, equipment and medium

By generating and screening multiple segmentation strategies, combined with computing hardware information and operator data shapes, the optimal segmentation strategy is determined, solving the problem of complex and error-prone segmentation strategies in the existing technology, and improving the performance of deep learning models. Hardware execution efficiency.

CN118690876APending Publication Date: 2024-09-24SHANGHAI BIREN TECH CO LTD
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202410884267.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-02
Publication Date
2024-09-24

AI Technical Summary

Technical Problem

In the deployment process of deep learning and neural network models, the logic of determining the segmentation strategy of operator data is complex and error-prone, and the overall performance cannot be guaranteed to be optimal. The existing method only segments the operator data based on the shape and cannot find Global optimal solution.

Method used

By searching for the preset segmentation strategy, if it does not exist, multiple initial segmentation strategies are generated based on the computing hardware information and the shape of the operator data, and effectiveness screening is performed to obtain the computational cost of each effective segmentation strategy and determine the target segmentation strategy. , to ensure optimal cost-effectiveness.

Benefits of technology

It improves the efficiency and accuracy of determining the operator data segmentation strategy, ensures the best data processing effect under the constraints of hardware resources, reduces the use of computing resources, and improves the execution efficiency of the model on the hardware.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118690876A
    Figure CN118690876A
Patent Text Reader

Abstract

The invention relates to the technical field of artificial intelligence, and provides an operator data segmentation strategy determination method and device, an operator data segmentation method and device, equipment and a medium, and the segmentation strategy determination method comprises the steps: searching whether a preset segmentation strategy exists or not; under the condition that the preset segmentation strategy is not found, generating a plurality of initial segmentation strategies based on the calculation hardware information and the shape of the operator data; performing effective screening on the plurality of initial segmentation strategies to obtain a plurality of effective segmentation strategies; and obtaining a calculation cost corresponding to each effective segmentation strategy, and determining a target segmentation strategy for segmenting the operator data from each effective segmentation strategy based on the calculation cost. According to the method, the flow of determining the segmentation strategy is unified and simplified, the determination efficiency and accuracy of the operator data segmentation strategy can be effectively improved, and a more efficient and flexible operator data segmentation solution is provided for a neural network and deep learning.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a segmentation strategy determination and segmentation method, device, equipment and medium for operator data. Background Art

[0002] In the process of deploying deep learning and neural network models, the operator data segmentation strategy is a key step, which directly affects the execution efficiency and performance of the model on hardware (especially dedicated chips). With the continuous increase in model complexity and the limitation of hardware resources, how to effectively segment operator data into blocks suitable for hardware processing has become an urgent problem to be solved.

[0003] However, currently, the splitting strategy is usually determined only based on the shape of the operator data. This method can only achieve a local optimal solution, but cannot find a global optimal solution. In addition, this method needs to estimate the upper bound of resources based on the shape of the operator data, and check whether the validity requirements are met multiple times during the parameter determination process, which makes the logic of determining the splitting strategy complex and prone to errors. Summary of the invention

[0004] The present invention provides a method, device, equipment and medium for determining a segmentation strategy for operator data, so as to solve the defects in the related art that the segmentation strategy determination logic for operator data is complex, prone to errors and cannot guarantee the optimal overall performance.

[0005] The present invention provides a method for determining a segmentation strategy for operator data, comprising: Check whether there is a preset segmentation strategy; If the preset segmentation strategy is not found, generating multiple initial segmentation strategies based on computing hardware information and the shape of operator data; Screening the multiple initial segmentation strategies for effectiveness to obtain multiple effective segmentation strategies; The computational cost corresponding to each effective segmentation strategy is obtained, and a target segmentation strategy for segmenting the operator data is determined from the effective segmentation strategies based on the computational cost.

[0006] According to a method for determining a segmentation strategy for operator data provided by the present invention, the method generates multiple initial segmentation strategies based on computing hardware information and the shape of operator data, including: Determining the minimum granularity of each segmentation dimension parameter based on the computing hardware information and the shape of the operator data; Based on the minimum granularity of each segmentation dimension parameter and the shape of the operator data, obtaining the value range of each segmentation dimension parameter; The value ranges of the segmentation dimension parameters are traversed, and multiple initial segmentation strategies are generated based on the values ​​of the segmentation dimension parameters obtained in each round of traversal.

[0007] According to a method for determining a segmentation strategy for operator data provided by the present invention, the effectiveness screening of the multiple initial segmentation strategies to obtain multiple effective segmentation strategies includes: Obtain the required number of registers and required cache size corresponding to each initial segmentation strategy; Based on the computing hardware information, the required number of registers and the required size of the cache, the effectiveness of each initial segmentation strategy is screened to obtain a plurality of effective segmentation strategies.

[0008] According to a method for determining a segmentation strategy for operator data provided by the present invention, the effectiveness screening of each initial segmentation strategy based on the computing hardware information, the required number of registers, and the required cache size includes: Compare the required number of registers and the required size of cache corresponding to any initial segmentation strategy with the number of registers and the size of cache in the computing hardware information to obtain a comparison result; When the comparison result is passed, any one of the initial segmentation strategies is determined to be a valid segmentation strategy.

[0009] According to a method for determining a splitting strategy for operator data provided by the present invention, the required number of registers and required cache size corresponding to any initial splitting strategy are compared with the number of registers and cache size in the computing hardware information to obtain a comparison result, including: In a case where the required number of registers is not greater than the number of registers and the required size of the cache is not greater than the cache size, determining that the comparison result is passed; In a case where the required number of registers is greater than the number of registers or the required cache size is greater than the cache size, the comparison result is determined to be failed.

[0010] According to a method for determining a segmentation strategy for operator data provided by the present invention, determining a target segmentation strategy for segmenting the operator data from the valid segmentation strategies based on the computational cost includes: Based on the calculation cost, the effective segmentation strategies are arranged in ascending order; if the calculation costs of at least two effective segmentation strategies are the same, the at least two effective segmentation strategies are arranged in ascending order based on a preset sorting condition; The first-ranked effective segmentation strategy is determined as the target segmentation strategy for segmenting the operator data.

[0011] A method for determining a segmentation strategy for operator data provided by the present invention further includes: When the preset segmentation strategy is found, the preset segmentation strategy is used as a target segmentation strategy for segmenting the operator data.

[0012] The present invention also provides a method for segmenting operator data, comprising: Determine the operator data to be split; The target segmentation strategy is applied to segment the operator data, wherein the target segmentation strategy is obtained based on any of the above-mentioned methods for determining the segmentation strategy of the operator data.

[0013] The present invention also provides a device for determining a segmentation strategy for operator data, comprising: A search unit, used to search whether a preset segmentation strategy exists; A generating unit, configured to generate a plurality of initial segmentation strategies based on computing hardware information and shapes of operator data when the preset segmentation strategy is not found; A screening unit, used for screening the effectiveness of the multiple initial segmentation strategies to obtain multiple effective segmentation strategies; A determination unit is used to obtain the computational cost corresponding to each effective segmentation strategy, and determine a target segmentation strategy for segmenting the operator data from the effective segmentation strategies based on the computational cost.

[0014] The present invention also provides an operator data segmentation device, comprising: An acquisition unit, used to determine the operator data to be segmented; A segmentation unit is used to apply a target segmentation strategy to segment the operator data, wherein the target segmentation strategy is obtained based on any of the above-mentioned methods for determining the segmentation strategy of the operator data.

[0015] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method for determining a segmentation strategy for operator data or the method for segmenting operator data as described above is implemented.

[0016] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the above-mentioned methods for determining a segmentation strategy for operator data or the above-mentioned method for segmenting operator data.

[0017] The present invention also provides a computer program product, including a computer program, which, when executed by a processor, implements any of the above-mentioned methods for determining a segmentation strategy for operator data or the above-mentioned method for segmenting operator data.

[0018] The segmentation strategy determination and segmentation method, device, equipment and medium of operator data provided by the present invention, when the preset segmentation strategy is not found, multiple initial segmentation strategies are generated based on the shape of computing hardware information and operator data. Since all relevant dimensions of computing hardware information and operator data are comprehensively considered in this process, the multiple initial segmentation strategies generated are more extensive and comprehensive, and can cover different computing scenarios and data layouts. By screening the effectiveness of the generated multiple initial segmentation strategies, those initial segmentation strategies that do not meet the hardware resource restrictions or specific conditions can be quickly excluded, and only the effective segmentation strategies that can be executed in actual operation are retained, avoiding processing invalid strategies in subsequent steps, thereby improving the determination efficiency of the segmentation strategy. In addition, by further considering the computational cost corresponding to each effective segmentation strategy and determining the final target segmentation strategy based on the computational cost, it can be ensured that the selected strategy is optimal in terms of cost-effectiveness, which helps to reduce the use of computing resources. At the same time, the performance of different segmentation strategies can be more intuitively evaluated through the computational cost, and the optimal segmentation strategy can be more accurately found, thereby improving the segmentation efficiency and performance of the operator data. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0020] Figure 1 It is a schematic diagram of a flow chart for determining a segmentation strategy for operator data in the related technology provided by the present invention; Figure 2 This is one of the flow charts of the method for determining the segmentation strategy of operator data provided by the present invention; Figure 3 This is the second flow chart of the method for determining the segmentation strategy of operator data provided by the present invention; Figure 4 It is a flow chart of the operator data segmentation method provided by the present invention; Figure 5 It is a structural schematic diagram of a device for determining a segmentation strategy for operator data provided by the present invention; Figure 6 It is a structural schematic diagram of the operator data segmentation device provided by the present invention; Figure 7 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

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

[0022] In convolution operations, the Tiling method usually refers to a data processing strategy, especially when using a GPU (Graphics Processing Unit) for image processing. The core idea of ​​this method is to first divide the input data (such as an image) into multiple small rectangular blocks, each of which will be processed independently on the GPU. In most cases, the Tiling strategy has a significant impact on the performance of the GPU. A suitable Tiling strategy can increase the cache hit rate, reduce memory access latency, and thus improve overall performance.

[0023] Figure 1 is a flow chart of determining the segmentation strategy of operator data in the related technology provided by the present invention, such as Figure 1 As shown, taking Conv (convolution) as an example, the determination of the segmentation strategy includes the following steps: Step 110, before performing the convolution operation, it is first necessary to plan the upper limit of the available hardware resources, such as the number of TLRs (Thread Local Registers, which refers to the registers in the chip used to temporarily store data during calculations), the size of the buffer, etc. These resources are crucial to the performance and efficiency of the convolution operation.

[0024] Step 120, determining whether the data loading method meets the requirements, that is, determining whether the input data can be loaded into the two cache areas A and B at one time according to the planned upper limit of the hardware resources.

[0025] Here, buffer A refers to a space for caching activation values, and buffer B refers to a space for caching weights. In a neural network, activation values ​​refer to the output values ​​of neurons after being processed by the activation function. These values ​​are usually cached for use in subsequent calculations without the need for recalculation. It should be understood that recalculation means that in the forward propagation process of the neural network, for a specific input, if its corresponding activation value is not cached, then in the subsequent layers or calculation steps, when the activation value is needed, it is necessary to start from the input again and recalculate the activation value through all the previous calculation steps. In order to avoid this unnecessary repeated calculation, the intermediate calculation results (i.e., activation values) are usually cached, so that in subsequent calculations, if the activation value is needed, it can be read directly from the cache without recalculation. Weights are adjustable parameters in neural networks that control the signal strength input to neurons. Weights are also cached for updating during training.

[0026] In step 130, if the input data can be loaded into both cache areas A and B at one time, the inner dimension limitation, including the size of N, H, W, IC, OC, etc. of the inner layer, can be determined based on the total space limitation (i.e., the upper limit of the available hardware resources planned in step 110).

[0027] Here, the inner dimension refers to the dimension actually processed in the convolution operation (including N, H, W, IC, OC, etc.). The inner dimension limitation refers to the maximum value that can be taken on these dimensions due to the limitation of hardware resources, including the size of the inner N, H, W, IC, OC, etc. Among them, N represents the batch size, that is, the number of data samples processed by each convolution operation; H represents the height of the input data, and W represents the width of the input data, that is, the height and width of the input data processed by each convolution operation; IC (Input Channels) represents the number of channels of the input data, and OC (Output Channels) represents the number of channels of the output data. The size of IC and OC is the number of channels processed by each convolution operation. The size of these dimensions determines the computational complexity and memory requirements of the convolution operation.

[0028] It is understandable that if the input data can be loaded into both caches A and B at once, it means that the current hardware resources are sufficient to support the current computing requirements. In this case, the size of the inner dimension in the convolution operation (i.e., the size of N, H, W, IC, OC, etc.) can be calculated based on the upper bound of the hardware resources.

[0029] Step 140: If the input data cannot be loaded into both cache areas A and B at one time, consider whether it can be loaded into cache area A alone or into cache area B alone.

[0030] Here, if the input data cannot be loaded into both caches A and B at once, it is necessary to consider how to optimize the data loading and storage method to make full use of limited hardware resources. In this case, loading into cache A or cache B separately is a feasible optimization strategy.

[0031] It is understandable that loading into the A buffer or B buffer separately means that when the hardware resources are limited, the system cannot load both the activation value and the weight into the memory at once. For example, if the A buffer (used to cache the activation value) has enough space, but the B buffer (user cache weight) has insufficient space, you can consider loading only part of the weights into the B buffer, and then gradually load the remaining weights in multiple iterations. Similarly, if the B buffer has enough space but the A buffer has insufficient space, a similar strategy can be adopted.

[0032] Step 150 , if both the A and B buffers cannot load all the data individually, it is necessary to consider splitting based on the number of channels (ie, IC and OC) and size (N, H, W).

[0033] Here, by dividing the data into the number of channels and the size, a larger data block can be split into multiple smaller data blocks, and then loaded into the cache one by one for calculation, which can avoid the memory overflow problem caused by loading too much data at one time, and the entire convolution operation can be completed in a loop iteration. Specifically, first, at the minimum granularity of IC, determine whether the OC can be loaded at one time. If not, further determine whether the H (height) and W (width) of the input data can be loaded at one time under the given upper limit of the hardware resources. It should be understood that the purpose of this step is to find the most suitable segmentation granularity so that when hardware resources are limited, the convolution operation can be ensured to proceed smoothly by optimizing the loading and storage methods of data.

[0034] It should be noted that in the convolution operation, the dimensions of the weight tensor (i.e., the convolution kernel) usually include the number of output channels (OC), the number of input channels (IC), the height and width of the convolution kernel. The weight tensor here is a multidimensional array representation of the weights in the neural network. Since the weight tensor is fixed and does not change with the batch size, height, or width of the input data, when considering data segmentation, the dimensions of the weight tensor are usually the first focus. Judging whether the OC can be loaded at one time at the minimum granularity of IC is actually judging whether the currently available cache resources are sufficient to store a complete convolution kernel. This is because each output channel needs to be convolved with all input channels, so the weight tensor is usually inseparable in the OC and IC dimensions.

[0035] If the OC can be loaded at the minimum granularity of IC at one time, that is, the weight tensor can be fully loaded in the B buffer, the size of other dimensions of the input data (N, H, W, IC) can be calculated based on the size of the A buffer. This is because the computational complexity of the convolution operation depends mainly on these dimensions of the input data given the weight tensor. By setting the size of these dimensions reasonably, it can be ensured that the capacity of the buffer will not be exceeded during the calculation process.

[0036] If it is not possible to load OC at the minimum granularity of IC at one time, that is, the weight tensor cannot be fully loaded in the B buffer, then you need to further consider how to split the input data. In this case, a common strategy is to split the input data on the spatial dimensions (i.e., height H and width W). This is because H and W are usually more flexible than OC and IC. By reducing the size of H and W loaded each time, the demand for cache capacity can be reduced, thereby ensuring that the calculation is completed with limited resources.

[0037] It is understandable that in the above step 140, when judging whether it can be loaded into the B-buffer separately, it refers to checking whether there is enough B-buffer space to load a specific data block (such as a weight tensor). The judgment process may not focus on which dimension of the data (such as IC or OC), but simply see whether there is enough space to store the entire data block. If not, further refinement of the analysis is required to see whether these cache resources can be effectively used in specific dimensions of the data (i.e., loading OC at one time at the minimum granularity of IC). Compared with judging whether the B-buffer can be loaded separately, judging whether the OC can be loaded at one time at the minimum granularity of IC is a more specific judgment. It focuses on the specific dimensions of the weight tensor (IC and OC) and considers how to effectively use cache resources in these dimensions.

[0038] Step 160, after considering the above-mentioned number of channels and sizes, determine the limitations of the inner dimensions according to the limitations of the total space (i.e., the upper limit of the available hardware resources planned in step 110), i.e., the sizes of N, H, W, IC, OC, etc. of the inner layers.

[0039] It should be noted that the above steps 110 to 160 are segmentation strategies determined based on shape. Here, determining the segmentation strategy based on shape means that in convolution operations or other computing tasks, the segmentation strategy is determined according to the shapes of the input and output data. The shape here includes the size of each dimension of the data, such as the number of input channels IC, the number of output channels OC, the height H, the width W, etc.

[0040] Step 170, finally, based on the above planning and judgment, the number of registers and cache size required to actually perform the convolution operation are calculated.

[0041] Here, the number of registers and cache size required for the actual convolution operation is calculated to ensure that the convolution operation is completed efficiently within limited hardware resources. This calculation process is based on the resource upper bound planned in the previous step and the judgment of the loading method to determine the amount of resources that can be used during the specific execution. Only when the required amount of resources does not exceed the planned resource upper bound, the convolution operation can proceed smoothly without performance degradation or failure due to the resource step.

[0042] It should be noted that the splitting strategy includes the specific values ​​of each inner dimension (i.e., the splitting dimension). The determination of the splitting strategy is essentially to find the values ​​of each dimension in step 160. These dimension values ​​determine how the convolution operation is split and executed on the hardware to achieve calculations under limited hardware resources. By carefully selecting these dimension values, it can be ensured that the convolution operation achieves a balance between performance and resource utilization. The above steps together constitute the basis of the splitting strategy. Through continuous judgment and adjustment, a splitting strategy that meets resource constraints and can perform convolution operations is finally determined.

[0043] However, the above process often determines the segmentation strategy based on shape, which may result in the inability to find the global optimal solution. This is because each time the value of a dimension is determined, the optimal value of the dimension is greedily found, and all dimensions are not considered together, and only the local optimal solution can be achieved in the end. For example, in the above step 3, it is first considered whether the OC can be loaded at one time when the IC is the smallest granularity. If not, it will further determine whether H and W can be loaded at one time. This process does not take all dimensions into consideration, so the global optimal solution cannot be found. The legality of the operator on the hardware and the performance requirements are related to each dimension, and the optimization problem is non-convex. For example, for IC, whether to load all at once, load the smallest IC, or load a part of the IC, which strategy is better cannot be determined separately. It should be understood that in the optimization problem, if the objective function (i.e., the function to be minimized or maximized) does not have only one local minimum or maximum value on the entire domain, then the problem is called a non-convex optimization problem. In the optimization problem of convolution operation, due to the correlation and mutual influence between various dimensions (such as IC, OC, H, W, etc.), as well as the limitation and constraint of hardware resources, the entire optimization problem (i.e., the determination of the segmentation strategy) becomes a non-convex optimization problem. Therefore, optimizing a single dimension to determine resource allocation and computing strategy can often only achieve a local optimal solution, but cannot find a global optimal solution.

[0044] Secondly, it is difficult to determine a slicing strategy that meets the legality requirements. The legality requirements here refer to a series of constraints that must be met when performing calculations on hardware, that is, the resource limitations corresponding to the hardware, such as the number of registers, the size of the cache space, etc.; a slicing strategy that meets the legality requirements is an effective slicing strategy that can be executed in actual operations. In the above method, it is necessary to estimate the upper limit of resources based on the shape of the operator data, and to check whether the legality requirements are met multiple times in the process of determining the values ​​of each dimension, resulting in complex logic and prone to errors. You can only choose one of several existing strategies based on experience. When none of the existing strategies meet the requirements, it is easy to fall back to a default tiling strategy with poor performance, affecting the overall performance.

[0045] In addition, due to the linkage between various dimensions, when it is found that the current strategy does not meet the requirements, it is more complicated to modify it without affecting the previous strategy. This leads to poor configurability and maintainability of the strategy, and the complexity of conditions may increase exponentially, posing a greater challenge to developers.

[0046] In this regard, the present invention provides a method for determining an operator data segmentation strategy, which unifies and simplifies the process of determining the segmentation strategy. By comprehensively considering the computing hardware information and the shape of the operator data and introducing the computing cost, the efficiency and accuracy of determining the operator data segmentation strategy can be effectively improved, and a more efficient and flexible operator data segmentation solution is provided for neural networks and deep learning, thereby overcoming the above-mentioned defects.

[0047] Figure 2 This is one of the flow charts of the method for determining the segmentation strategy of operator data provided by the present invention. Figure 2 As shown, the method includes: Step 210, searching whether there is a preset segmentation strategy; It should be noted that operator data refers to data associated with a specific computing operator in the fields of deep learning, machine learning or numerical calculation. The operator here can be understood as a calculation or operation, such as matrix multiplication, convolution, pooling, etc. Operator data includes not only the input data required to be processed when the operator is executed, such as image data input to the convolution layer, feature vectors input to the fully connected layer, etc., but also the intermediate data generated during the execution of the operator and the final output data. The method provided in the embodiment of the present invention can be applied to any computing hardware that needs to perform operator data segmentation, such as GPU chips, CPUs (Central Processing Units), GPGPUs (General-purpose computing on graphics processing units, general-purpose graphics processors), etc. Exemplarily, the present invention can be applied to the fields of computer vision, artificial intelligence and deep learning, and is used to optimize the computing efficiency of convolution operators in CNNs (Convolutional Neural Networks) on chips.

[0048] Specifically, a preset splitting strategy refers to a predefined way or method of splitting operator data. This splitting strategy can be designed based on a certain optimization goal (such as minimizing computing costs, maximizing resource utilization, etc.), and has been proven to be effective in similar scenarios. For example, the preset splitting strategy can be obtained by developers after continuous debugging and verification. Here, the preset splitting strategy can be stored in a configuration file, a database, or a code library. By reading the configuration file, querying the database, or calling the corresponding API (Application Programming Interface, application programming interface), you can find out whether there is a preset splitting strategy.

[0049] It is understandable that if effective segmentation strategies have been defined for similar data and computing scenarios, these strategies can be used directly to save computing resources and time and improve system efficiency. If no preset segmentation strategy can be found, a new segmentation strategy can be generated based on the current specific situation (such as computing hardware information, the shape of operator data, etc.), and legality screening (i.e. effectiveness screening) and cost evaluation can be performed to determine the optimal segmentation solution.

[0050] Step 220, if the preset segmentation strategy is not found, generate multiple initial segmentation strategies based on computing hardware information and the shape of operator data; Specifically, if no preset splitting strategy is found, it indicates that no suitable splitting strategy is predefined or stored in the current system or environment for the current operator data and computing hardware environment. In this case, multiple initial splitting strategies can be generated based on the computing hardware information and the shape of the operator data. Here, computing hardware information refers to the characteristics and parameters of the computing hardware (such as GPU chips, etc.) on which the operator data processing task depends, which may include the number of registers currently available on the chip and the cache size, etc.

[0051] After obtaining the computing hardware information, the shape of the operator data can be analyzed, that is, its dimension, size, data type and other characteristics can be analyzed to determine the dimensions on which the data can be split, such as batch size, height, width, number of channels, etc. Subsequently, all optional parameter values ​​on each split dimension can be obtained. By traversing these optional parameter values ​​and combining them, multiple initial split strategies can be obtained. Here, the initial split strategy refers to a preliminary set of multiple possible data splitting methods generated based on the computing hardware information and the shape of the operator data. These strategies are the starting point for subsequent optimization and screening, with the goal of ensuring data processing efficiency while satisfying the rational use of computing resources as much as possible.

[0052] Step 230, screening the effectiveness of the multiple initial segmentation strategies to obtain multiple effective segmentation strategies; Specifically, after generating multiple initial segmentation strategies, these initial segmentation strategies can be screened for effectiveness to exclude those strategies that are obviously unreasonable or infeasible. Here, effectiveness screening is also legality screening, which means that among multiple initial segmentation strategies, strategies are screened according to certain standards and requirements (such as whether they meet hardware resource restrictions) to exclude those strategies that do not meet regulations or are not effective, ensuring that the remaining segmentation strategies are legal and executable.

[0053] Specifically, for each initial segmentation strategy, the amount of resources (such as the number of registers and cache size) required to actually perform the convolution operation can be calculated, and the effectiveness of the initial segmentation strategy can be judged based on this. Only when the required amount of resources does not exceed the hardware resource limit can the convolution operation proceed smoothly. At this time, it can be determined that the initial segmentation strategy is effective, otherwise the initial segmentation strategy is invalid.

[0054] It can be understood that an effective segmentation strategy refers to a segmentation strategy that has been screened for effectiveness, meets hardware resource constraints, and is feasible and effective. These strategies can ensure that data is reasonably allocated and arranged during processing, thereby improving data processing efficiency and resource utilization.

[0055] Step 240 , obtaining the computational cost corresponding to each valid segmentation strategy, and determining a target segmentation strategy for segmenting the operator data from the valid segmentation strategies based on the computational cost.

[0056] Specifically, for each effective splitting strategy, the effective splitting strategy can be evaluated through a cost model (a model used to evaluate and predict the cost of computing, storage or communication operations) to evaluate the computational cost required for the operator to complete the calculation, that is, the effective splitting strategy is input into the cost model to obtain the computational cost output by the model. Here, the computational cost corresponding to the effective splitting strategy refers to the cost (such as time cycle, resource consumption, etc.) required when using the strategy for data processing.

[0057] Through the evaluation of the cost model, we can get the computational cost of the operator under different effective splitting strategies. After obtaining the computational costs corresponding to all effective splitting strategies, we can sort all effective splitting strategies according to the computational costs, so that we can select the splitting strategy with the lowest cost as the target splitting strategy, thereby ensuring the highest efficiency and lowest resource consumption when processing data. Here, the target splitting strategy refers to the optimal splitting strategy determined after evaluation and comparison among multiple effective splitting strategies. This strategy can achieve the best data processing effect while meeting the hardware resource constraints.

[0058] The method provided by the embodiment of the present invention generates multiple initial segmentation strategies based on the shape of computing hardware information and operator data when the preset segmentation strategy is not found. Since all relevant dimensions of computing hardware information and operator data are comprehensively considered in this process, the multiple initial segmentation strategies generated are more extensive and comprehensive, and can cover different computing scenarios and data layouts. By screening the effectiveness of the generated multiple initial segmentation strategies, those initial segmentation strategies that do not meet the hardware resource restrictions or specific conditions can be quickly excluded, and only the effective segmentation strategies that can be executed in actual operations are retained, avoiding processing invalid strategies in subsequent steps, thereby improving the efficiency of determining the segmentation strategy. In addition, by further considering the computational cost corresponding to each effective segmentation strategy and determining the final target segmentation strategy based on the computational cost, it can be ensured that the selected strategy is optimal in terms of cost-effectiveness, which helps to reduce the use of computing resources. At the same time, the performance of different segmentation strategies can be more intuitively evaluated through the computational cost, and the optimal segmentation strategy can be more accurately found, thereby improving the efficiency and performance of the segmentation of the operator data.

[0059] Based on the above embodiment, step 220 specifically includes: Step 221, determining the minimum granularity of each segmentation dimension parameter based on the computing hardware information and the shape of the operator data; Specifically, when generating the initial segmentation strategy, the minimum granularity of each segmentation dimension parameter can be calculated based on the computing hardware information and the shape of the operator data. Here, in the segmentation process of the operator data, the data can usually be segmented in multiple dimensions for parallel processing or to adapt to different hardware resources. These segmentation dimensions are called segmentation dimension parameters. For example, when processing image data, the segmentation dimension parameters may include the batch size N, the number of channels C (for convolutional neural networks), the height H, the width W, etc. of the image. It should be understood that the minimum granularity of each segmentation dimension parameter refers to the size of the smallest unit into which the data can be segmented in each segmentation dimension.

[0060] For example, taking the minimum granularity of IC (i.e., the number of channels of input data) as an example, in the possible value range [8, 16, 32, 64, 128], the value that is less than or equal to ic_temp and closest to 2 is selected. n (n is an integer). For example, if the calculated ic_temp is 63, 32 will be selected as the minimum granularity of IC, because 32 is less than 63 and the power of 2 closest to 63. ic_temp can be calculated by the following formula:

[0061] Among them, ic_temp refers to a temporary value calculated based on information such as the cache size and the shape of the operator data, which is used to determine the minimum granularity of IC. Buffer B size refers to the size of the B buffer area, which is used to store intermediate calculation results or data. KH and KW are the height (Height) and width (Width) values ​​of the operator data in the convolution operation, respectively, which define the size of the convolution kernel. dem_size represents the data size of different data types. BF16=2 indicates that when BF16 (half-precision floating point number) is used, the size of each data element is 2 bytes (16 bits). It should be understood that when calculating the minimum granularity of the dimension parameter, the actual size of the data type needs to be considered.

[0062] In addition, when determining the minimum granularity of IC, different granularities can also be selected according to the data type. For example, in the possible range [32, 64, 128], for an 8-bit integer data type (Int8), 128 can be selected as the minimum granularity of IC; for a 16-bit half-precision floating-point data type (bf16), 64 can be selected as the minimum granularity of IC; for a 32-bit single-precision floating-point data type (fp32), 32 can be selected as the minimum granularity of IC.

[0063] Step 222, based on the minimum granularity of each segmentation dimension parameter and the shape of the operator data, obtaining the value range of each segmentation dimension parameter; It should be noted that the shape of the operator usually describes the size of the data in each dimension in deep learning and computational optimization. When performing a tiling operation, the purpose is to split the data into multiple smaller blocks for more efficient parallel processing or to adapt to specific hardware resources. However, the size of these blocks (i.e., the tiling dimension parameter) must be less than or equal to the shape size of the original data, because the blocks cannot exceed the boundaries of the original data. Therefore, the shape of the operator data is the upper bound of each tiling dimension parameter, because the tiling operation cannot produce a data block larger than the original data.

[0064] Specifically, after determining the minimum granularity of each segmentation dimension parameter and the shape of the operator data as the upper bound, the value range of each segmentation dimension parameter can be obtained. Here, the value range of each segmentation dimension parameter refers to the set of possible segmentation block sizes on each dimension when performing data segmentation operations. This set is determined by the minimum granularity of the segmentation dimension parameter and the shape of the data, and includes all possible values ​​starting from the minimum granularity, with the minimum granularity as the step size, and gradually increasing until the data shape size is reached. This value range will be used in the subsequent traversal and strategy generation process to find the optimal segmentation strategy.

[0065] Specifically, for each split dimension parameter, after determining the minimum granularity of the split dimension parameter and determining the upper bound of the split dimension parameter according to the shape of the operator data, we can start from the minimum granularity and gradually increase it with the minimum granularity as the step size until the upper bound is reached. All values ​​in this process (including the minimum granularity and the upper bound) constitute the value range of the split dimension parameter. For example, assuming that the data shape of an operator is (1024, 512, 512, 128), for the first batch dimension, the minimum granularity is determined to be 64, then for this dimension, its value range will be [64, 128, 192,……, 1024].

[0066] Step 223, traverse the value ranges of the segmentation dimension parameters, and generate multiple initial segmentation strategies based on the values ​​of the segmentation dimension parameters obtained in each round of traversal.

[0067] Specifically, after obtaining the value range of each segmentation dimension parameter, one or more loops can be initialized to traverse the value range of these parameters. For each segmentation dimension, traverse according to its value range, and select a specific segmentation dimension parameter value in each step of traversal; for each set of segmentation dimension parameter values ​​(i.e., a specific value on each dimension) obtained in each round of traversal, combine them to form a complete initial segmentation strategy. Repeat the above traversal process until the value range of all segmentation dimension parameters is traversed, and multiple initial segmentation strategies can be generated. When all possible segmentation dimension parameter combinations have been traversed and the corresponding initial segmentation strategies have been generated, step 223 ends, that is, the traversal process ends.

[0068] It can be understood that the values ​​of the above-mentioned segmentation dimension parameters refer to the specific segmentation size on each dimension obtained by traversing the value range of each segmentation dimension parameter. These values ​​are specific segmentation dimension parameter values ​​selected in each step of the traversal based on the value range determined in step 222.

[0069] In an embodiment of the present invention, the minimum granularity of each segmentation dimension parameter is first determined by calculating the shape of hardware information and operator data, so that the generated multiple initial segmentation strategies can contain the parameter space of all feasible solutions. Here, the parameter space of all feasible solutions refers to all possible effective and satisfactory segmentation strategy combinations under given constraints (such as hardware limitations, data shape, etc.). In addition, since it is calculated based on the minimum granularity, the generated parameter space is effectively controlled, avoiding an excessively large search space and improving efficiency.

[0070] The method provided by the embodiment of the present invention comprehensively considers all relevant dimensional parameters of computing hardware information and operator data, and generates multiple initial segmentation strategies that can cover all possible combinations in this parameter space, thereby avoiding ignoring certain potential optimal solutions due to only considering some factors, and ensuring the integrity of the final solution space. This comprehensive consideration avoids premature exclusion of certain possible optimal solutions, and also prevents local optimal problems caused by greedy search.

[0071] Based on any of the above embodiments, step 230 specifically includes: Step 231, obtaining the required number of registers and required cache size corresponding to each initial segmentation strategy; Specifically, the number of register requirements and cache requirements corresponding to the initial split strategy refer to the number of registers and cache sizes required to actually execute operator operations (such as convolution operations) under the initial split strategy. Different initial split strategies may require different numbers of registers to store intermediate results, variables, or temporary data. The number of register requirements refers to the amount of register resources required by the operator when executing a specific split strategy. The cache requirement size refers to the size of the cache space required by the operator when executing a specific split strategy.

[0072] It is understandable that for each initial segmentation strategy, the number of registers required and the cache required size can be obtained through specific analysis and calculation. For example, for each initial segmentation strategy, it can be determined which variables, intermediate results or temporary data need to be stored in registers when executing the segmentation strategy, and the number of required registers can be calculated accordingly. Similarly, by analyzing the data access pattern corresponding to the segmentation strategy, it is determined which data will be frequently accessed, and the required cache space size is estimated accordingly, thereby obtaining the cache requirement size.

[0073] Step 232 , based on the computing hardware information, the required number of registers and the required cache size, screening the effectiveness of each of the initial segmentation strategies to obtain a plurality of effective segmentation strategies.

[0074] Specifically, based on the computing hardware information, the available register capacity and cache capacity of the current computing hardware can be obtained first. Then, for each initial segmentation strategy, after calculating the required number of registers and the required cache size required for the segmentation strategy, the required number of registers and the required cache size can be compared with the actual capacity of the current computing hardware to screen the effectiveness of the initial segmentation strategy and exclude those segmentation strategies whose requirements exceed the hardware capacity. After completing the screening of all initial segmentation strategies, all valid segmentation strategies can be obtained.

[0075] Based on any of the above embodiments, step 232 specifically includes: Step 2321, comparing the required number of registers and the required cache size corresponding to any initial segmentation strategy with the number of registers and the cache size in the computing hardware information, respectively, to obtain a comparison result; Step 2322: if the comparison result is passed, determine that any of the initial segmentation strategies is a valid segmentation strategy.

[0076] Specifically, for any initial splitting strategy, when screening the effectiveness of the splitting strategy, the number of register requirements and the cache requirement size corresponding to the splitting strategy can be compared with the number of registers and the cache size of the computing hardware to obtain a comparison result. If the resource requirements of the initial splitting strategy (i.e., the number of register requirements and the cache requirement size) do not exceed the resource capacity provided by the hardware (i.e., the number of registers and the cache size of the computing hardware), the comparison result is passed. In this case, the initial splitting strategy can be determined to be a valid splitting strategy and retained, indicating that the splitting strategy can be successfully executed on the given hardware without causing insufficient resources or overflow. If the resource requirements of the initial splitting strategy exceed the resource capacity provided by the hardware, the comparison result is failed. At this time, it can be determined that the initial splitting strategy is invalid and needs to be discarded.

[0077] It is understandable that in the computing hardware information, the number of registers and cache size refer to the register capacity and cache capacity provided by the hardware resources (such as CPU or GPU). Before screening the effectiveness of each initial segmentation strategy, the number of registers and cache size of the computing hardware can be obtained, for example, by querying the hardware specification manual, using system commands or programming interfaces, etc.

[0078] Based on any of the above embodiments, step 2321 specifically includes: In a case where the required number of registers is not greater than the number of registers and the required size of the cache is not greater than the cache size, determining that the comparison result is passed; In a case where the required number of registers is greater than the number of registers or the required cache size is greater than the cache size, the comparison result is determined to be failed.

[0079] Specifically, for any initial split strategy, when determining the comparison result based on the number of register requirements and cache requirement size of the split strategy, and the actual number of registers and cache size of the computing hardware, if the number of registers required by the initial split strategy (i.e., the number of registers required) is not greater than the number of registers provided by the computing hardware, and at the same time, the cache size required by the initial split strategy (i.e., the cache requirement size) is not greater than the cache size provided by the computing hardware, then it indicates that the number of register requirements and the cache requirement size of the initial split strategy do not exceed the corresponding resource capacity of the computing hardware. In this case, the comparison result can be determined to be passed, which means that the initial split strategy is legal and valid in terms of resource requirements and can be executed on the hardware.

[0080] If either the number of register requirements or the cache requirement size of the initial split strategy exceeds the corresponding resource capacity of the computing hardware, the comparison result will fail, indicating that the initial split strategy is illegal and invalid in terms of resource requirements because the resources it requires exceed the capabilities of the hardware.

[0081] Based on any of the above embodiments, in step 240, determining a target segmentation strategy for segmenting the operator data from the valid segmentation strategies based on the computational cost includes: Step 241, based on the calculation cost, the effective segmentation strategies are arranged in ascending order. If the calculation costs of at least two effective segmentation strategies are the same, the at least two effective segmentation strategies are arranged in ascending order based on a preset sorting condition. Step 242: determine the first-ranked effective segmentation strategy as the target segmentation strategy for segmenting the operator data.

[0082] Specifically, when selecting the best splitting strategy from multiple valid splitting strategies, it can be determined by measuring the computational cost. After screening all valid splitting strategies, each valid splitting strategy can be input into the costmodel to evaluate the computational cost corresponding to each valid splitting strategy. For example, the computational cost can be a costcycle (i.e., a time cycle). Subsequently, all valid splitting strategies can be sorted in ascending order according to the values ​​of these computational costs. Here, ascending order means sorting the valid splitting strategies in order of computational cost from small to large. Specifically, the splitting strategy with the lowest computational cost will be ranked first, the splitting strategy with the second lowest computational cost will be ranked second, and so on.

[0083] Furthermore, when there are multiple valid splitting strategies with the same computational cost, additional sorting conditions can be introduced to determine which strategy should be given priority. These conditions can be based on other requirements or limitations of the system. For example, some strategies may be more conducive to the balanced utilization of hardware resources, or some strategies may have lower communication overhead. By arranging in ascending order by preset sorting conditions, it can be ensured that a strategy that best meets the overall needs of the system is selected from multiple strategies. Here, the preset sorting condition refers to an additional condition set to determine the relative order between these strategies when at least two valid splitting strategies have the same computational cost. Since the computational costs are the same, the priority of these strategies cannot be determined only by the computational cost, so additional conditions are required for sorting.

[0084] Exemplarily, the preset sorting condition may be to give priority to a segmentation strategy without ICP (Input Channels Partition), give priority to a segmentation strategy with a height dimension parameter value greater than a width dimension parameter value (i.e., H greater than W), etc. For example, for segmentation strategies with the same computational cost, you can first compare whether they have input channel segmentation, and the strategy without input channel segmentation is ranked first; if both have input channel segmentation or neither has input channel segmentation, you can compare their H and W values ​​respectively, and the strategy with H greater than W is ranked first. In this way, you can sort in ascending order according to these two preset sorting conditions to determine the relative order between these strategies.

[0085] After all valid split strategies are sorted and the ranking of all valid split strategies is obtained, the first-ranked valid split strategy can be used as the target split strategy. Here, the first-ranked valid split strategy refers to the first-ranked strategy among all valid split strategies that have been screened for effectiveness and sorted in ascending order according to computational cost (or according to preset sorting conditions). It should be understood that among all valid split strategies, selecting the strategy with the lowest computational cost (i.e., ranked first) as the target split strategy can be expected to obtain better system performance, higher resource utilization, or lower energy consumption, etc.

[0086] The method provided in the embodiment of the present invention can make the performance evaluation more accurate and objective by introducing the cost model to calculate the computational cost of each segmentation strategy, and can more intuitively evaluate the performance of different segmentation strategies by calculating the time period. In addition, combined with other customized sorting strategies, the optimal segmentation strategy can be found more accurately, thereby improving the efficiency and performance of data processing.

[0087] Based on any of the above embodiments, the method further includes: When the preset segmentation strategy is found, the preset segmentation strategy is used as a target segmentation strategy for segmenting the operator data.

[0088] Specifically, if a preset splitting strategy is found, it indicates that the current system or environment has pre-defined or stored a suitable splitting strategy for the current operator data and computing hardware environment. In this case, the preset splitting strategy can be directly used as the target splitting strategy, that is, the optimal splitting strategy, and the target splitting strategy can be applied to split the operator data.

[0089] It is understandable that when a developer finds a segmentation strategy with good performance in all aspects during the debugging process, the strategy can be stored as a preset segmentation strategy so that the segmentation strategy can be directly applied later. Since the preset segmentation strategy is the optimal segmentation strategy found by the developer through debugging, continuous debugging and verification, its effect is usually better than the segmentation strategy found through the cost model. Therefore, the preset segmentation strategy can be used as a supplement to solve the scenario where the cost model is inaccurate or the sorting rule cannot find the optimal segmentation strategy.

[0090] The method provided by the embodiment of the present invention facilitates the expansion of new segmentation dimension parameters and new segmentation functions by supporting the saving and retrieval of preset segmentation strategies. When the evaluation of the cost model is not accurate enough or the sorting rule cannot find the optimal solution, the preset segmentation strategy can be retrieved as the target segmentation strategy, thereby increasing the flexibility and adaptability of the solution.

[0091] Based on any of the above embodiments, Figure 3 This is the second flow chart of the method for determining the segmentation strategy of operator data provided by the present invention. Figure 3 As shown, the method can be applied to the fields of computer vision, artificial intelligence and deep learning, and is used to optimize the computational efficiency of the convolution operator in the convolutional neural network on the chip. The method includes: Step S1, searching whether there is a preset optimal segmentation strategy, and if found, directly returning the optimal segmentation strategy; Step S2: If the preset optimal segmentation strategy is not found, the minimum granularity of segmentation in each dimension is calculated according to the shape of the operator data and the computing hardware information (such as the number of registers TLR, cache size, etc.), that is, the minimum granularity of parameters such as N, C, H, and W is determined, where C includes IC and OC; Step S3, according to the minimum granularity and the upper bound of shape, obtain all optional parameters for segmentation in each dimension, that is, obtain the optional range of parameters such as N, C, H, and W; Step S4, traverse the optional range of each parameter to generate the entire parameter space, that is, obtain the segmentation strategy; Step S5: For each segmentation strategy, calculate the number of registers required and the cache size required, and judge its legality (i.e. validity) accordingly. If it is illegal, discard it; if it is legal, pass the legal segmentation strategy through the cost model evaluation operator to complete the required cost cycle. Continue to traverse the parameter range until the traversal ends.

[0092] Step S6: sort all legal segmentation strategies in ascending order according to cost cycle and other priority conditions (such as giving priority to those without ICP, H being greater than W, etc.), and select the strategy ranked first as the optimal segmentation strategy according to the sorting result.

[0093] The method provided in the embodiment of the present invention can effectively improve the efficiency and accuracy of determining the operator data segmentation strategy by simplifying and unifying the process of determining the segmentation strategy, comprehensively considering relevant parameters, introducing an accurate cost model, and supporting the storage and retrieval of preset segmentation strategies.

[0094] Based on any of the above embodiments, Figure 4 is a flow chart of the operator data segmentation method provided by the present invention, such as Figure 4 As shown, the method includes: Step 410, determining the operator data to be segmented; Step 420: Apply a target segmentation strategy to segment the operator data, wherein the target segmentation strategy is obtained based on any of the above-mentioned methods for determining the segmentation strategy of the operator data.

[0095] It should be noted that, according to the method for determining the segmentation strategy of operator data in the above embodiment, a target segmentation strategy is obtained, and the target segmentation strategy can be applied to segment the operator data according to the actual operator data segmentation requirements.

[0096] Specifically, the operator data to be segmented refers to a specific type of data that needs to be processed or optimized. In the field of artificial intelligence and deep learning, operator data refers to data blocks or tensors used in the model training or reasoning process, which may contain the input, output or intermediate layer data of the model. After determining the target segmentation strategy according to the methods of the above embodiments, the operator data can be segmented using the various dimensional parameters included in the segmentation strategy to segment the data into smaller blocks, thereby facilitating more efficient processing during model training or reasoning.

[0097] The method provided by the embodiment of the present invention can optimize the computing cost and improve the hardware utilization by applying the target segmentation strategy to segment the operator data, thereby effectively improving the computing performance and computing efficiency of the operator on the chip. In addition, the target segmentation strategy is the segmentation strategy with the lowest computing cost, which helps to reduce the consumption of computing resources while maintaining the data processing effect.

[0098] Based on any of the above embodiments, Figure 5 is a schematic diagram of the structure of the device for determining the segmentation strategy of operator data provided by the present invention, such as Figure 5 As shown, the device comprises: A searching unit 510 is used to search whether there is a preset segmentation strategy; A generating unit 520, configured to generate a plurality of initial segmentation strategies based on computing hardware information and shapes of operator data when the preset segmentation strategy is not found; A screening unit 530 is used to screen the multiple initial segmentation strategies for effectiveness, and obtain multiple effective segmentation strategies; The determination unit 540 is configured to obtain the computational cost corresponding to each valid segmentation strategy, and determine a target segmentation strategy for segmenting the operator data from the valid segmentation strategies based on the computational cost.

[0099] The device provided by the embodiment of the present invention generates multiple initial segmentation strategies based on the shape of computing hardware information and operator data when the preset segmentation strategy is not found. Since all relevant dimensions of computing hardware information and operator data are comprehensively considered in this process, the multiple initial segmentation strategies generated are more extensive and comprehensive, and can cover different computing scenarios and data layouts. By screening the effectiveness of the generated multiple initial segmentation strategies, those initial segmentation strategies that do not meet the hardware resource restrictions or specific conditions can be quickly excluded, and only the effective segmentation strategies that can be executed in actual operations are retained, avoiding processing invalid strategies in subsequent steps, thereby improving the efficiency of determining the segmentation strategy. In addition, by further considering the computational cost corresponding to each effective segmentation strategy and determining the final target segmentation strategy based on the computational cost, it can be ensured that the selected strategy is optimal in terms of cost-effectiveness, which helps to reduce the use of computing resources. At the same time, the performance of different segmentation strategies can be more intuitively evaluated through the computational cost, and the optimal segmentation strategy can be more accurately found, thereby improving the efficiency and performance of the segmentation of the operator data.

[0100] Based on any of the above embodiments, the generating unit 520 is specifically configured to: Determining the minimum granularity of each segmentation dimension parameter based on the computing hardware information and the shape of the operator data; Based on the minimum granularity of each segmentation dimension parameter and the shape of the operator data, obtaining the value range of each segmentation dimension parameter; The value ranges of the segmentation dimension parameters are traversed, and multiple initial segmentation strategies are generated based on the values ​​of the segmentation dimension parameters obtained in each round of traversal.

[0101] Based on any of the above embodiments, the screening unit 530 includes: An acquisition subunit, used to acquire the required number of registers and required cache size corresponding to each initial segmentation strategy; The screening subunit is used to screen the effectiveness of each of the initial segmentation strategies based on the computing hardware information, the required number of registers and the required cache size to obtain multiple effective segmentation strategies.

[0102] Based on any of the above embodiments, the screening subunit includes: A comparison subunit, used to compare the required number of registers and the required size of cache corresponding to any initial segmentation strategy with the number of registers and the size of cache in the computing hardware information, respectively, to obtain a comparison result; The determination subunit is used to determine that any of the initial segmentation strategies is a valid segmentation strategy when the comparison result is passed.

[0103] Based on any of the above embodiments, the comparison subunit is specifically used for: In a case where the required number of registers is not greater than the number of registers and the required size of the cache is not greater than the cache size, determining that the comparison result is passed; In a case where the required number of registers is greater than the number of registers or the required cache size is greater than the cache size, the comparison result is determined to be failed.

[0104] Based on any of the foregoing embodiments, the determining unit 540 is specifically configured to: Based on the calculation cost, the effective segmentation strategies are arranged in ascending order; if the calculation costs of at least two effective segmentation strategies are the same, the at least two effective segmentation strategies are arranged in ascending order based on a preset sorting condition; The first-ranked effective segmentation strategy is determined as the target segmentation strategy for segmenting the operator data.

[0105] Based on any of the above embodiments, the device further includes: A strategy selection unit is used to use the preset segmentation strategy as a target segmentation strategy for segmenting the operator data when the preset segmentation strategy is found.

[0106] Based on any of the above embodiments, Figure 6: is a schematic diagram of the structure of the operator data segmentation device provided by the present invention, such as Figure 6 As shown, the device comprises: An acquisition unit 610 is used to determine the operator data to be segmented; The segmentation unit 620 is used to apply a target segmentation strategy to segment the operator data, where the target segmentation strategy is obtained based on any of the above-mentioned methods for determining the segmentation strategy of the operator data.

[0107] The device provided by the embodiment of the present invention can optimize the computing cost and improve the hardware utilization by applying the target segmentation strategy to segment the operator data, thereby effectively improving the computing performance and computing efficiency of the operator on the chip. In addition, the target segmentation strategy is the segmentation strategy with the lowest computing cost, which helps to reduce the consumption of computing resources while maintaining the data processing effect.

[0108] Figure 7 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 7 As shown, the electronic device may include: a processor 710, a communication interface 720, a memory 730 and a communication bus 740, wherein the processor 710, the communication interface 720 and the memory 730 communicate with each other through the communication bus 740. The processor 710 may call the logic instructions in the memory 730 to execute the method for determining the segmentation strategy of the operator data, the method comprising: finding whether there is a preset segmentation strategy; if the preset segmentation strategy is not found, generating multiple initial segmentation strategies based on the computing hardware information and the shape of the operator data; screening the effectiveness of the multiple initial segmentation strategies to obtain multiple effective segmentation strategies; obtaining the computational cost corresponding to each effective segmentation strategy, and determining the target segmentation strategy for segmenting the operator data from the effective segmentation strategies based on the computational cost.

[0109] In addition, the processor 710 can call the logic instructions in the memory 730 to execute the operator data segmentation method, which includes: determining the operator data to be segmented; applying the target segmentation strategy to segment the operator data, and the target segmentation strategy is obtained based on any of the above-mentioned operator data segmentation strategy determination methods.

[0110] In addition, the logic instructions in the above-mentioned memory 730 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the relevant technology or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0111] On the other hand, the present invention also provides a computer program product, which includes a computer program, which can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the operator data segmentation strategy determination method provided by the above methods, the method including: searching whether there is a preset segmentation strategy; if the preset segmentation strategy is not found, generating multiple initial segmentation strategies based on computing hardware information and the shape of the operator data; screening the multiple initial segmentation strategies for effectiveness to obtain multiple valid segmentation strategies; obtaining the computational cost corresponding to each valid segmentation strategy, and determining a target segmentation strategy for segmenting the operator data from the valid segmentation strategies based on the computational cost.

[0112] In addition, when the computer program is executed by the processor, the computer can execute the operator data segmentation method provided by the above methods, the method including: determining the operator data to be segmented; applying a target segmentation strategy to segment the operator data, the target segmentation strategy being obtained based on any of the above-mentioned operator data segmentation strategy determination methods.

[0113] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, it is implemented to execute the operator data segmentation strategy determination method provided by the above-mentioned methods, the method comprising: searching whether there is a preset segmentation strategy; if the preset segmentation strategy is not found, generating multiple initial segmentation strategies based on computing hardware information and the shape of the operator data; screening the multiple initial segmentation strategies for effectiveness to obtain multiple valid segmentation strategies; obtaining the computational cost corresponding to each valid segmentation strategy, and determining a target segmentation strategy for segmenting the operator data from the valid segmentation strategies based on the computational cost.

[0114] In addition, when the computer program is executed by the processor, it is implemented to execute the operator data segmentation method provided by the above-mentioned methods, and the method includes: determining the operator data to be segmented; applying the target segmentation strategy to segment the operator data, and the target segmentation strategy is obtained based on any of the above-mentioned operator data segmentation strategy determination methods.

[0115] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0116] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiment.

[0117] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for determining a segmentation strategy for operator data, characterized in that: include: Check whether there is a preset segmentation strategy; If the preset segmentation strategy is not found, generating multiple initial segmentation strategies based on computing hardware information and the shape of operator data; Screening the multiple initial segmentation strategies for effectiveness to obtain multiple effective segmentation strategies; The computational cost corresponding to each effective segmentation strategy is obtained, and a target segmentation strategy for segmenting the operator data is determined from the effective segmentation strategies based on the computational cost.

2. The method for determining the segmentation strategy of operator data according to claim 1, characterized in that: The method generates multiple initial segmentation strategies based on the computing hardware information and the shape of the operator data, including: Determining the minimum granularity of each segmentation dimension parameter based on the computing hardware information and the shape of the operator data; Based on the minimum granularity of each segmentation dimension parameter and the shape of the operator data, obtaining the value range of each segmentation dimension parameter; The value ranges of the segmentation dimension parameters are traversed, and multiple initial segmentation strategies are generated based on the values ​​of the segmentation dimension parameters obtained in each round of traversal.

3. The method for determining the segmentation strategy of operator data according to claim 1, characterized in that: The effectiveness screening of the multiple initial segmentation strategies to obtain multiple effective segmentation strategies includes: Obtain the required number of registers and required cache size corresponding to each initial segmentation strategy; Based on the computing hardware information, the required number of registers and the required size of the cache, the effectiveness of each initial segmentation strategy is screened to obtain a plurality of effective segmentation strategies.

4. The method for determining the segmentation strategy of operator data according to claim 3, characterized in that: The screening of the effectiveness of each of the initial segmentation strategies based on the computing hardware information, the required number of registers, and the required cache size includes: Compare the required number of registers and the required size of cache corresponding to any initial segmentation strategy with the number of registers and the size of cache in the computing hardware information to obtain a comparison result; When the comparison result is passed, any one of the initial segmentation strategies is determined to be a valid segmentation strategy.

5. The method for determining the segmentation strategy of operator data according to claim 4, characterized in that: The step of comparing the required number of registers and the required size of cache corresponding to any initial segmentation strategy with the number of registers and the size of cache in the computing hardware information to obtain a comparison result includes: In a case where the required number of registers is not greater than the number of registers and the required size of the cache is not greater than the cache size, determining that the comparison result is passed; In a case where the required number of registers is greater than the number of registers or the required cache size is greater than the cache size, the comparison result is determined to be failed.

6. The method for determining the segmentation strategy of operator data according to claim 1, characterized in that: The determining a target segmentation strategy for segmenting the operator data from the effective segmentation strategies based on the computational cost includes: Based on the calculation cost, the effective segmentation strategies are arranged in ascending order; if the calculation costs of at least two effective segmentation strategies are the same, the at least two effective segmentation strategies are arranged in ascending order based on a preset sorting condition; The first-ranked effective segmentation strategy is determined as the target segmentation strategy for segmenting the operator data.

7. The method for determining a segmentation strategy for operator data according to any one of claims 1 to 6, characterized in that: Also includes: When the preset segmentation strategy is found, the preset segmentation strategy is used as a target segmentation strategy for segmenting the operator data.

8. A method for segmenting operator data, characterized in that: include: Determine the operator data to be split; The target segmentation strategy is applied to segment the operator data, wherein the target segmentation strategy is obtained based on the segmentation strategy determination method for operator data according to any one of claims 1 to 7.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the method for determining the operator data segmentation strategy according to any one of claims 1 to 7 or the method for segmenting operator data according to claim 8 is implemented.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for determining a segmentation strategy for operator data according to any one of claims 1 to 7 or the method for segmenting operator data according to claim 8 is implemented.

Citation Information

Cited By

  • Operator parallel processing method, electronic equipment, storage medium and program product

    CN119718675A

  • Data segmentation method and device, computer equipment and storage medium

    CN121579539A

  • Data slicing method and apparatus, computer device, and storage medium

    CN121579539B