Application software performance bottleneck positioning method, electronic device, storage medium and program product
By collecting and analyzing the runtime performance data of application software kernels, and using pre-trained models and kernel structure features to identify performance bottlenecks, the problem of insufficient positioning accuracy in existing technologies has been solved, and more accurate performance optimization has been achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SUGON INFORMATION IND
- Filing Date
- 2026-03-30
- Publication Date
- 2026-06-16
AI Technical Summary
In existing technologies, the basic performance statistics tools built into AI accelerator cards are not accurate enough in locating performance bottlenecks in application software and cannot identify fine-grained bottlenecks.
By collecting kernel performance data from multiple kernels called by the target application software, a pre-trained supervised learning model is used for intelligent, multi-dimensional comprehensive evaluation to determine the target kernel. Combined with kernel structure features and performance data, the type of performance bottleneck is identified.
It improves the accuracy of identifying and locating performance bottlenecks, enables the generation of more precise performance optimization strategies, and enhances the rationality and applicability of performance evaluation.
Smart Images

Figure CN122220193A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular to a method for locating performance bottlenecks in application software, electronic devices, storage media, and program products. Background Technology
[0002] With the increasing popularity of AI accelerator cards, their role in computing infrastructure is becoming more and more important. For example, in deep learning training, developers need to frequently call the underlying kernel of application software such as convolution and matrix multiplication for calculation.
[0003] In existing technologies, the basic performance statistics tools built into the AI accelerator card are typically used to collect data on the overall operator runtime and video memory usage of the application software to obtain the application software's performance data. Then, based on the application software's performance data, the performance bottleneck of the application software can be located to achieve performance optimization.
[0004] However, existing solutions suffer from insufficient accuracy in pinpointing performance bottlenecks in application software. Summary of the Invention
[0005] The application software performance bottleneck location method, electronic device, storage medium, and program product provided in this application embodiment are used to solve the problem of insufficient accuracy in locating application software performance bottlenecks caused by existing solutions.
[0006] In a first aspect, embodiments of this application provide a method for locating performance bottlenecks in application software, comprising: collecting kernel runtime performance data of multiple kernels called by a target application software according to a load task; determining a target kernel from the multiple kernels according to the load task and the kernel runtime performance data of the multiple kernels; wherein the target kernel is a kernel with a performance bottleneck; and determining the performance bottleneck type of the performance bottleneck according to the kernel structure characteristics of the target application software and the kernel runtime performance data of the multiple kernels.
[0007] In this application, kernel performance data of multiple kernels called by the target application software are collected based on the load task; the target kernel is determined from the multiple kernels based on the load task and the kernel performance data of the multiple kernels; wherein the target kernel is the kernel with a performance bottleneck; the performance bottleneck type is determined based on the kernel structure characteristics of the target application software and the kernel performance data of the target kernel; this solves the problem of insufficient accuracy in locating the performance bottleneck of the application software in the existing solution that uses the basic performance statistics tools built into the artificial intelligence accelerator card to collect data on the overall operator running time and memory usage of the application software to obtain the performance data of the application software, and then locates the performance bottleneck of the application software based on the performance data of the application software.
[0008] Optionally, in the method described above, determining the target kernel from the plurality of kernels based on the load task and the kernel performance data of the plurality of kernels includes: inputting the load task and the kernel performance data of the plurality of kernels into a pre-trained supervised learning model, and outputting a comprehensive kernel performance score for each kernel; and determining the target kernel from the plurality of kernels based on the comprehensive kernel performance score of each kernel.
[0009] In this application, by introducing a pre-trained supervised learning model, an intelligent, multi-dimensional comprehensive evaluation of kernel performance is achieved to output a comprehensive kernel performance score for each kernel. Furthermore, based on the comprehensive kernel performance score of each kernel, the target kernel with a performance bottleneck is identified from multiple kernels, thereby improving the accuracy of identifying kernels with performance bottlenecks.
[0010] Optionally, in the method described above, the pre-trained supervised learning model includes a data preprocessing model, a performance scoring mapping model, and a scoring weighting model; the kernel runtime performance data includes execution time, memory bandwidth utilization, and computing power utilization; the step of inputting the load task and the kernel runtime performance data of the multiple kernels into the pre-trained supervised learning model and outputting a comprehensive kernel performance score for each kernel includes: for the kernel runtime performance data of each kernel: inputting the kernel runtime performance data into the data preprocessing model and outputting preprocessed kernel runtime performance data; wherein, the preprocessed kernel runtime performance data includes preprocessed execution time, preprocessed memory bandwidth utilization, and preprocessed computing power utilization; inputting the preprocessed execution time, the preprocessed memory bandwidth utilization, and the preprocessed computing power utilization into the performance scoring mapping model and outputting an execution time score, a memory bandwidth score, and a computing power utilization score; inputting the execution time score, the memory bandwidth score, the computing power utilization score, and the load task into the scoring weighting model and outputting the comprehensive kernel performance score.
[0011] In this application, a data preprocessing model is used to preprocess data and remove anomalies, ensuring the stability and reliability of kernel performance data. Then, a performance scoring mapping model is used to quantify multi-dimensional performance data into standard scores, eliminating differences in dimensionality. Through a scoring weighting model, a comprehensive kernel performance score is dynamically calculated based on the load task, making the comprehensive kernel performance score more in line with the actual scenario, accurately reflecting the actual kernel operating status, and improving the accuracy and applicability of the evaluation.
[0012] Optionally, in the method described above, the step of inputting the execution time score, the memory bandwidth score, the computing power utilization score, and the load task into the scoring weighting model and outputting the comprehensive kernel performance score includes: inputting the execution time score, the memory bandwidth score, the computing power utilization score, and the load task into the scoring weighting model; using the scoring weighting model to determine the load task characteristics based on the load task; using the scoring weighting model to determine the first weighting coefficient corresponding to the execution time score, the second weighting coefficient corresponding to the memory bandwidth score, and the third weighting coefficient corresponding to the computing power utilization score based on the load task characteristics; using the scoring weighting model to perform weighted calculations on the execution time score, the first weighting coefficient, the memory bandwidth score, the second weighting coefficient, the computing power utilization score, and the third weighting coefficient to obtain the comprehensive kernel performance score; and using the scoring weighting model to output the comprehensive kernel performance score.
[0013] In this application, by introducing a dynamic weighting mechanism driven by load tasks, the weights of each performance indicator can be adaptively allocated according to the characteristics of different load tasks. That is, the weighting coefficients are dynamically matched according to the characteristics of load tasks, so as to realize differentiated weighted evaluation of execution time, memory bandwidth, and computing power utilization, improve the accuracy and relevance of the comprehensive kernel performance score, avoid the evaluation bias caused by fixed weights, and improve the rationality, accuracy and scenario adaptability of performance evaluation.
[0014] Optionally, in the method described above, the step of collecting kernel performance data of multiple kernels called by the target application software according to the load task includes: determining the real-time load status of the target application software according to the load task; determining the performance data sampling frequency according to the real-time load status; and collecting the kernel performance data of the multiple kernels according to the performance data sampling frequency.
[0015] In this application, by adapting the performance data sampling frequency to the real-time load state, the efficiency and quality of monitoring are optimized. The frequency is reduced under low load to decrease data overhead and conserve resources; the frequency is increased under high load to capture subtle performance fluctuations, providing high-quality data for accurate diagnosis and dynamic scheduling. This improves overall resource utilization efficiency while ensuring the quality of kernel performance data, and also enhances data acquisition efficiency and the timeliness and validity of the data.
[0016] Optionally, the method described above, after determining the performance bottleneck type based on the kernel structure characteristics of the target application software and the kernel runtime performance data of the target kernel, further includes: invoking a performance optimization knowledge base; wherein the performance optimization knowledge base is used to store reference performance optimization strategies, reference performance bottleneck characteristics corresponding to the reference performance optimization strategies, and reference kernel structure characteristics corresponding to the reference performance optimization strategies; generating performance bottleneck characteristics based on the performance bottleneck type, the kernel structure characteristics of the target application software, and the kernel runtime performance data of the multiple kernels; calculating the similarity between the performance bottleneck characteristics and the reference performance bottleneck characteristics in the performance optimization knowledge base to obtain a bottleneck characteristic similarity set; determining the maximum bottleneck characteristic similarity from the bottleneck characteristic similarity set; determining the target reference performance optimization strategy and the target reference kernel structure characteristics based on the maximum bottleneck characteristic similarity; and determining the performance optimization strategy of the target kernel based on the target reference performance optimization strategy, the target reference kernel structure characteristics, and the kernel structure characteristics of the target application software.
[0017] In this application, by calling a performance optimization knowledge base and combining performance bottleneck types, kernel structure characteristics of the target application software, and performance bottleneck characteristics generated from kernel running performance data of multiple kernels, the similarity matching between the performance bottleneck characteristics and reference performance bottleneck characteristics in the performance optimization knowledge base is used to determine the appropriate target reference performance optimization strategy and target reference kernel structure characteristics. Then, by combining the kernel structure characteristics of the target application software, the corresponding performance optimization strategy is determined. This improves the accuracy and efficiency of performance optimization strategy generation, avoids blind optimization, and ensures that the optimization effect of the performance optimization strategy matches the target kernel.
[0018] Optionally, in the method described above, determining the target reference performance optimization strategy and the target reference kernel structure feature based on the maximum bottleneck feature similarity includes: determining the reference performance optimization strategy corresponding to the maximum bottleneck feature similarity in the performance optimization knowledge base as the target reference performance optimization strategy based on the maximum bottleneck feature similarity; and determining the reference kernel structure feature corresponding to the maximum bottleneck feature similarity in the performance optimization knowledge base as the target reference kernel structure feature based on the maximum bottleneck feature similarity.
[0019] In this application, by directly matching one-to-one based on the maximum bottleneck feature similarity, the most suitable reference strategy and reference structure can be quickly and accurately determined from the performance optimization knowledge base, avoiding redundant screening and matching bias, ensuring that the reference basis matches the performance bottleneck of the target kernel, providing reliable support for the subsequent generation of performance optimization strategies for the target kernel, and improving optimization efficiency and targeting.
[0020] Optionally, in the method described above, generating the performance optimization strategy for the target kernel based on the target reference performance optimization strategy, the target reference kernel structure features, and the kernel structure features of the target application software includes: calculating the similarity between the target reference kernel structure features and the kernel structure features of the target application software to obtain a structural feature similarity; determining the relationship between the structural feature similarity and a structural feature similarity threshold; and if the structural feature similarity is greater than or equal to the structural feature similarity threshold, then determining the target reference performance optimization strategy as the performance optimization strategy for the target kernel.
[0021] In this application, when the structural feature similarity is greater than or equal to the structural feature similarity threshold, it indicates that the target kernel and the reference kernel are structurally similar. Therefore, the target reference performance optimization strategy can be directly reused without additional adjustment, which improves the efficiency of determining the performance optimization strategy of the target kernel. While reducing the workload of strategy adaptation, it ensures the adaptability of the performance optimization strategy and avoids optimization deviation caused by excessive adjustment of the performance optimization strategy.
[0022] Optionally, in the method described above, determining the relationship between the structural feature similarity and the structural feature similarity threshold further includes: if the structural feature similarity is less than the structural feature similarity threshold, then performing feature differentiation extraction on the target reference kernel structural features and the kernel structural features of the target application software to obtain kernel structural feature differentiation data; and adjusting the target reference performance optimization strategy based on the kernel structural feature differentiation data to generate the performance optimization strategy for the target kernel.
[0023] In this application, when the structural feature similarity is less than the structural feature similarity threshold, it indicates that the target kernel and the reference kernel are not structurally similar. Therefore, by extracting the structural differences between the target kernel and the reference kernel, and adjusting the target reference performance optimization strategy based on the structural differences (kernel structural feature difference data), the direct reuse of unsuitable optimization strategies is avoided, which leads to optimization failure. This ensures that the performance optimization strategy of the generated target kernel matches the kernel structure of the target kernel, thereby improving the adaptability and effectiveness of the performance optimization strategy.
[0024] Optionally, the method described above, after adjusting the target reference performance optimization strategy based on the kernel structure feature differentiation data to generate the target kernel performance optimization strategy, further includes: determining the target kernel performance optimization strategy as the current reference performance optimization strategy; determining the kernel structure features of the target application software as the current reference kernel structure features; determining the performance bottleneck features as the current reference performance bottleneck features; storing the current reference performance optimization strategy, the current reference kernel structure features, and the current reference performance bottleneck features in the performance optimization knowledge base; and establishing a mapping relationship between the current reference performance optimization strategy, the current reference kernel structure features, and the current reference performance bottleneck features in the performance optimization knowledge base to update the performance optimization knowledge base.
[0025] In this application, an incremental update mechanism is used to update the performance optimization knowledge base, enrich the reference data for adapting to different kernel structures, improve the accuracy and efficiency of subsequent performance bottleneck matching and performance optimization strategy generation, realize the dynamic optimization of the performance optimization knowledge base, and enhance the scalability and adaptability of the performance optimization knowledge base.
[0026] Secondly, embodiments of this application provide an application software performance bottleneck localization device, comprising: a collection module, configured to collect kernel runtime performance data of multiple kernels called by a target application software according to a load task; a processing module, configured to determine a target kernel from the multiple kernels according to the load task and the kernel runtime performance data of the multiple kernels; wherein the target kernel is a kernel with a performance bottleneck; and a determination module, configured to determine the performance bottleneck type of the performance bottleneck according to the kernel structure characteristics of the target application software and the kernel runtime performance data of the multiple kernels.
[0027] Optionally, in the apparatus described above, when the processing module determines the target kernel from the plurality of kernels based on the load task and the kernel performance data of the plurality of kernels, it is specifically configured to: input the load task and the kernel performance data of the plurality of kernels into a pre-trained supervised learning model, and output a comprehensive kernel performance score for each kernel; and determine the target kernel from the plurality of kernels based on the comprehensive kernel performance score of each kernel.
[0028] Optionally, in the apparatus described above, the pre-trained supervised learning model includes a data preprocessing model, a performance scoring mapping model, and a scoring weighting model; the kernel runtime performance data includes execution time, memory bandwidth utilization, and computing power utilization; when the processing module inputs the load task and the kernel runtime performance data of the multiple kernels into the pre-trained supervised learning model and outputs a comprehensive kernel performance score for each kernel, it specifically performs the following: for the kernel runtime performance data of each kernel: inputting the kernel runtime performance data into the data preprocessing model and outputting preprocessed kernel runtime performance data; wherein, the preprocessed kernel runtime performance data includes preprocessed execution time, preprocessed memory bandwidth utilization, and preprocessed computing power utilization; inputting the preprocessed execution time, the preprocessed memory bandwidth utilization, and the preprocessed computing power utilization into the performance scoring mapping model and outputting an execution time score, a memory bandwidth score, and a computing power utilization score; inputting the execution time score, the memory bandwidth score, the computing power utilization score, and the load task into the scoring weighting model and outputting the comprehensive kernel performance score.
[0029] Optionally, in the apparatus described above, when the processing module inputs the execution time score, the memory bandwidth score, the computing power utilization score, and the load task into the scoring weighting model and outputs the comprehensive kernel performance score, it specifically performs the following steps: inputting the execution time score, the memory bandwidth score, the computing power utilization score, and the load task into the scoring weighting model; using the scoring weighting model to determine the load task characteristics based on the load task; using the scoring weighting model to determine the first weighting coefficient corresponding to the execution time score, the second weighting coefficient corresponding to the memory bandwidth score, and the third weighting coefficient corresponding to the computing power utilization score based on the load task characteristics; using the scoring weighting model to perform weighted calculations on the execution time score, the first weighting coefficient, the memory bandwidth score, the second weighting coefficient, the computing power utilization score, and the third weighting coefficient to obtain the comprehensive kernel performance score; and using the scoring weighting model to output the comprehensive kernel performance score.
[0030] Optionally, in the apparatus described above, when the acquisition module acquires kernel performance data of multiple kernels called by the target application software according to the load task, it is specifically used to: determine the real-time load status of the target application software according to the load task; determine the performance data sampling frequency according to the real-time load status; and acquire the kernel performance data of the multiple kernels according to the performance data sampling frequency.
[0031] Optionally, in the apparatus described above, after determining the performance bottleneck type based on the kernel structure characteristics of the target application software and the kernel runtime performance data of the target kernel, the application software performance bottleneck localization device is further configured to: invoke a performance optimization knowledge base; wherein the performance optimization knowledge base is configured to store reference performance optimization strategies, reference performance bottleneck characteristics corresponding to the reference performance optimization strategies, and reference kernel structure characteristics corresponding to the reference performance optimization strategies; generate performance bottleneck characteristics based on the performance bottleneck type, the kernel structure characteristics of the target application software, and the kernel runtime performance data of the multiple kernels; perform similarity calculation on the performance bottleneck characteristics and the reference performance bottleneck characteristics in the performance optimization knowledge base to obtain a bottleneck characteristic similarity set; determine the maximum bottleneck characteristic similarity from the bottleneck characteristic similarity set; determine the target reference performance optimization strategy and the target reference kernel structure characteristics based on the maximum bottleneck characteristic similarity; and determine the performance optimization strategy of the target kernel based on the target reference performance optimization strategy, the target reference kernel structure characteristics, and the kernel structure characteristics of the target application software.
[0032] Optionally, in the apparatus described above, when determining the target reference performance optimization strategy and the target reference kernel structure feature based on the maximum bottleneck feature similarity, the application software performance bottleneck localization device is specifically configured to: determine the reference performance optimization strategy corresponding to the maximum bottleneck feature similarity in the performance optimization knowledge base as the target reference performance optimization strategy based on the maximum bottleneck feature similarity; and determine the reference kernel structure feature corresponding to the maximum bottleneck feature similarity in the performance optimization knowledge base as the target reference kernel structure feature based on the maximum bottleneck feature similarity.
[0033] Optionally, in the apparatus described above, when the application software performance bottleneck localization device generates the performance optimization strategy for the target kernel based on the target reference performance optimization strategy, the target reference kernel structural features, and the kernel structural features of the target application software, it is specifically used to: calculate the similarity between the target reference kernel structural features and the kernel structural features of the target application software to obtain a structural feature similarity; determine the relationship between the structural feature similarity and a structural feature similarity threshold; if the structural feature similarity is greater than or equal to the structural feature similarity threshold, then determine the target reference performance optimization strategy as the performance optimization strategy for the target kernel.
[0034] Optionally, in the apparatus described above, the step of determining the relationship between the structural feature similarity and the structural feature similarity threshold, the application software performance bottleneck localization device is further configured to: if the structural feature similarity is less than the structural feature similarity threshold, then perform feature differentiation extraction on the target reference kernel structural features and the kernel structural features of the target application software to obtain kernel structural feature differentiation data; and adjust the target reference performance optimization strategy based on the kernel structural feature differentiation data to generate the performance optimization strategy for the target kernel.
[0035] Optionally, in the apparatus described above, after adjusting the target reference performance optimization strategy based on the kernel structure feature differentiation data to generate the target kernel performance optimization strategy, the application software performance bottleneck localization device is further configured to: determine the target kernel performance optimization strategy as the current reference performance optimization strategy; determine the kernel structure features of the target application software as the current reference kernel structure features; determine the performance bottleneck features as the current reference performance bottleneck features; store the current reference performance optimization strategy, the current reference kernel structure features, and the current reference performance bottleneck features in the performance optimization knowledge base; and establish a mapping relationship between the current reference performance optimization strategy, the current reference kernel structure features, and the current reference performance bottleneck features in the performance optimization knowledge base to update the performance optimization knowledge base.
[0036] Thirdly, embodiments of this application provide an electronic device, including: a memory and a processor;
[0037] The memory stores computer-executed instructions;
[0038] The processor executes computer execution instructions stored in the memory, causing the processor to perform the first aspect and / or various possible implementations of the first aspect as described above.
[0039] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the first aspect and / or various possible implementations of the first aspect.
[0040] Fifthly, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the first aspect and / or various possible implementations of the first aspect.
[0041] The application software performance bottleneck localization method, electronic device, storage medium, and program product provided in this application embodiment collect kernel running performance data of multiple kernels called by the target application software according to the load task; determine the target kernel from the multiple kernels according to the load task and the kernel running performance data of multiple kernels; wherein, the target kernel is the kernel with a performance bottleneck; determine the performance bottleneck type according to the kernel structure characteristics of the target application software and the kernel running performance data of the target kernel; solve the problem of insufficient accuracy in locating the performance bottleneck of the application software in the existing solution that uses the basic performance statistics tools built into the artificial intelligence accelerator card to collect data on the overall operator running time and video memory usage of the application software to obtain the performance data of the application software, and then locates the performance bottleneck of the application software based on the performance data of the application software. Attached Figure Description
[0042] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0043] Figure 1 A schematic diagram illustrating the scenario for the application software performance bottleneck localization method provided in this application;
[0044] Figure 2 A flowchart illustrating an application software performance bottleneck localization method provided in one embodiment of this application;
[0045] Figure 3 A flowchart of an application software performance bottleneck localization method provided in another embodiment of this application;
[0046] Figure 4 A schematic diagram of the structure of an application software performance bottleneck location device provided in one embodiment of this application;
[0047] Figure 5 A schematic diagram of the structure of the electronic device provided in this application.
[0048] The accompanying drawings have illustrated specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to specific embodiments. Detailed Implementation
[0049] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0050] The technical solution of this application involves the collection, storage, use, processing, transmission, provision and disclosure of user personal information and data, which comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0051] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant regions, and corresponding operation entry points are provided for users to choose to authorize or refuse.
[0052] With the increasing prevalence of AI accelerator cards, their role in computing infrastructure is becoming increasingly important. For example, in deep learning training, developers frequently need to call low-level kernels such as convolution and matrix multiplication for computation. Current technologies typically use the basic performance statistics tools built into the AI accelerator card to collect data on overall operator runtime and memory usage to obtain performance data. Based on this performance data, performance bottlenecks can then be located to optimize the AI accelerator card's performance. However, existing solutions suffer from insufficient accuracy in pinpointing performance bottlenecks.
[0053] To address the aforementioned technical problems, this application proposes the following technical concept: Based on the workload, collect kernel performance data of multiple kernels called by the target application software; based on the workload and the kernel performance data of multiple kernels, determine the target kernel from among the multiple kernels; wherein, the target kernel is the kernel with a performance bottleneck; based on the kernel structure characteristics of the target application software and the kernel performance data of the target kernel, determine the performance bottleneck type; This solves the problem of insufficient accuracy in locating performance bottlenecks in existing technologies that use the basic performance statistics tools built into AI accelerator cards to collect data on the overall operator execution time and memory usage of the application software to obtain performance data, and then locate performance bottlenecks based on the application software's performance data. Specifically, the basic performance statistics tools built into AI accelerator cards can only provide macroscopic time distribution (such as total execution time and memory usage) and cannot identify fine-grained bottlenecks, thus resulting in insufficient accuracy in locating performance bottlenecks in the application software.
[0054] The application scenarios of the embodiments of this application are explained below:
[0055] Figure 1 A schematic diagram illustrating the scenario for the application software performance bottleneck localization method provided in this application, such as... Figure 1 As shown, the execution subject of the method provided in this application embodiment can be any form of electronic device. Taking a computer device as the execution subject, the computer device 101 collects kernel running performance data of multiple kernels called by the target application software running on the artificial intelligence accelerator card 102 according to the load task; determines the target kernel from the multiple kernels according to the load task and the kernel running performance data of multiple kernels; wherein, the target kernel is the kernel with a performance bottleneck; and determines the performance bottleneck type according to the kernel structure characteristics of the target application software and the kernel running performance data of the target kernel.
[0056] The kernel is the underlying computing unit program running on the AI accelerator card. It is used to perform basic operations such as matrix operations, convolution, and normalization, and serves as a bridge between the target application software and the AI accelerator card.
[0057] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.
[0058] Figure 2 A flowchart of an application software performance bottleneck localization method provided in one embodiment of this application is shown below. Figure 2As shown, the execution subject of the application software performance bottleneck localization method provided in this embodiment can be any form of electronic device. For example, this embodiment uses a computer device as the execution subject of the method. The application software performance bottleneck localization method provided in this embodiment includes the following steps:
[0059] Step S201: Based on the load task, collect kernel running performance data of multiple kernels called by the target application software.
[0060] For example, different workloads have different performance requirements for the target application software. Therefore, the time interval for collecting performance data of the target application software is determined based on the task type of the workload. Then, based on the determined time interval for collecting performance data of the target application software, kernel performance data of multiple kernels called by the target application software is collected. Specifically, for example, when the workload is a high-real-time video encoding / decoding task, the collection time interval is 100 milliseconds; when the workload is a low-latency database query or background computation task, the collection time interval is 1 second. Then, according to the corresponding time intervals, kernel performance data of multiple kernels called by the target application software is collected to complete the collection of differentiated and refined kernel performance data under different workloads.
[0061] Kernel performance data serves as a quantitative indicator of the kernel's real-time operational status during the execution of the target application software. Target applications include artificial intelligence models and high-performance computing applications.
[0062] In another possible implementation, step S201 is specifically implemented as follows:
[0063] Step S2011: Determine the real-time load status of the target application software based on the load task.
[0064] For example, the load task is a hybrid computing task (such as scientific computing and data querying). The hybrid computing task is identified as a computationally intensive task. Then, by monitoring the task queue of the target application software, it is found that the proportion of computationally intensive tasks is high and the queue is continuously growing. Therefore, the real-time load status of the target application software is determined to be "heavy load".
[0065] Step S2012: Determine the performance data sampling frequency based on the real-time load status.
[0066] For example, the performance data sampling frequency corresponding to the real-time load state is determined according to the real-time load state and the preset mapping relationship. For example, the preset mapping relationship is: "heavy load" corresponds to the first sampling frequency (e.g., 200Hz), "medium load" corresponds to the second sampling frequency (e.g., 100Hz), and "light load" corresponds to the third sampling frequency (e.g., 80Hz). Then, based on the real-time load state of the target application software determined in step S2011 being "heavy load", the performance data sampling frequency is obtained as the first sampling frequency.
[0067] Step S2013: Collect kernel running performance data of multiple kernels according to the performance data sampling frequency.
[0068] For example, based on the first sampling frequency determined in step S2012, kernel performance data of multiple kernels called by the target application software are periodically collected.
[0069] In this embodiment, by adapting the performance data sampling frequency to the real-time load state, the efficiency and quality of monitoring are optimized. Reducing the frequency under low load decreases data overhead and conserves resources; increasing the frequency under high load captures subtle performance fluctuations, providing high-quality data for accurate diagnosis and dynamic scheduling. This improves overall resource utilization efficiency while ensuring the quality of kernel performance data, and also enhances data acquisition efficiency and the timeliness and validity of the data.
[0070] Step S202: Based on the workload and kernel performance data of multiple kernels, determine the target kernel from multiple kernels; wherein, the target kernel is the kernel with a performance bottleneck.
[0071] For example, kernel runtime performance data includes execution time, memory bandwidth utilization, and computing power utilization. Based on the task type of the workload, target performance data is determined from the kernel runtime performance data, for example, execution time is determined as the target performance data. Then, the execution time of each kernel is calculated as the percentage of the sum of the execution times of all kernels. Then, based on the relationship between the time percentage of each kernel and the time percentage threshold, the target kernel is determined from multiple kernels, that is, the kernel whose time percentage is greater than or equal to the time percentage threshold is determined as the target kernel. Herein, the target kernel is the kernel with a performance bottleneck.
[0072] In another possible implementation, the specific steps of step S202 include:
[0073] Step S2021: Input the load task and the kernel running performance data of multiple kernels into the pre-trained supervised learning model, and output the comprehensive kernel performance score of each kernel.
[0074] Step S2022: Based on the comprehensive kernel performance score of each kernel, determine the target kernel from multiple kernels.
[0075] For example, a pre-trained supervised learning model is a machine learning algorithm that trains a model using labeled data to perform a classification or regression task; such as a random forest classification model or a neural network classification model.
[0076] Specifically, the task characteristics of the workload (e.g., task type, computational intensity) and the real-time collected kernel performance data of each kernel (e.g., execution time, memory bandwidth utilization, computational efficiency) are input into a pre-trained supervised learning model. This pre-trained supervised learning model is trained based on historical data and can comprehensively evaluate the efficiency and health of each kernel under the current workload, outputting a quantitative comprehensive kernel performance score (e.g., a comprehensive kernel performance score ranging from 0 to 100). Then, kernels with a comprehensive kernel performance score lower than the comprehensive score threshold are identified as target kernels.
[0077] In this embodiment, by introducing a pre-trained supervised learning model, intelligent and multi-dimensional comprehensive evaluation of kernel performance is achieved to output a comprehensive kernel performance score for each kernel. Furthermore, based on the comprehensive kernel performance score of each kernel, the target kernel with a performance bottleneck is identified from multiple kernels, thus improving the accuracy of identifying kernels with performance bottlenecks.
[0078] Furthermore, in one possible implementation, the pre-trained supervised learning model includes a data preprocessing model, a performance scoring mapping model, and a scoring weighting model; kernel runtime performance data includes execution time, memory bandwidth utilization, and computational power utilization; for each kernel, the specific implementation steps of step S2021 include:
[0079] Step S20211: Input the kernel running performance data into the data preprocessing model and output the preprocessed kernel running performance data.
[0080] For example, the data preprocessing model is used to clean and time-align kernel runtime performance data to obtain preprocessed kernel runtime performance data. This preprocessed data includes preprocessed execution time, preprocessed memory bandwidth utilization, and preprocessed computational power utilization. Specifically, taking execution time data cleaning as an example, the time interval range of execution time is determined based on the quartile method (IQR): the upper quartile (Q3) and lower quartile (Q1) of the execution time are calculated, and the lower limit of the anomaly threshold is determined to be Q1-1.5×(Q3-Q1) and the upper limit to be Q3+1.5×(Q3-Q1). Then, outliers in the execution time are removed according to the lower and upper limits of the anomaly threshold to obtain the preprocessed execution time.
[0081] Step S20212: Input the preprocessing execution time, preprocessing memory bandwidth utilization, and preprocessing computing power utilization into the performance scoring mapping model, and output the execution time score, memory bandwidth score, and computing power utilization score.
[0082] For example, the preprocessing execution time of 50 milliseconds, the preprocessing memory bandwidth utilization rate of 65%, and the preprocessing computing power utilization rate of 80% are input into the performance scoring mapping model; the performance scoring mapping model outputs normalized scores based on the pre-trained mapping logic: the execution time score is 85 points (the shorter the time, the higher the score), the memory bandwidth score is 70 points, and the computing power utilization rate score is 90 points.
[0083] Step S20213: Input the execution time score, memory bandwidth score, computing power utilization score, and workload task into the scoring weighting model, and output the comprehensive kernel performance score.
[0084] Specifically, the specific implementation steps of step S20213 include:
[0085] Step A: Input the execution time score, memory bandwidth score, computing power utilization score, and workload into the scoring weighting model.
[0086] Step B involves using a scoring-weighted model to determine the characteristics of the workload tasks based on their performance.
[0087] For example, if the load task is a database query, the corresponding load task characteristics are high memory bandwidth, medium computing power, and strong execution timeliness; if the load task is video encoding and decoding, the corresponding load task characteristics are high computing power, high bandwidth, and strong real-time performance; if the load task is background computing, the corresponding load task characteristics are medium computing power, low bandwidth, and weak latency sensitivity.
[0088] Step C: Using a scoring weighting model, determine the first weighting coefficient corresponding to the execution time score, the second weighting coefficient corresponding to the memory bandwidth score, and the third weighting coefficient corresponding to the computing power utilization score based on the characteristics of the load task.
[0089] For example, weighting coefficients corresponding to preprocessed kernel performance data are determined based on the characteristics of the load task. For instance, if the load task is a database query, based on the characteristics of high memory bandwidth, medium computing power, and strong execution timeliness, the first weighting coefficient for execution time score is determined to be 0.3, the second weighting coefficient for memory bandwidth score is 0.4, and the third weighting coefficient for computing power utilization score is 0.3. If the load task is video encoding / decoding, the first weighting coefficient for execution time score is 0.2, the second weighting coefficient for memory bandwidth score is 0.4, and the third weighting coefficient for computing power utilization score is 0.4. If the load task is background computation, the first weighting coefficient for execution time score is 0.4, the second weighting coefficient for memory bandwidth score is 0.2, and the third weighting coefficient for computing power utilization score is 0.4.
[0090] Step D involves using a weighted scoring model to calculate the execution time score, the first weighting coefficient, the memory bandwidth score, the second weighting coefficient, the computing power utilization score, and the third weighting coefficient to obtain a comprehensive kernel performance score.
[0091] Step E: Output a comprehensive kernel performance score using a weighted scoring model.
[0092] In steps A to E of this embodiment, by introducing a dynamic weighting mechanism driven by load tasks, the weights of each performance indicator can be adaptively allocated according to the characteristics of different load tasks. That is, the weighting coefficients are dynamically matched according to the characteristics of load tasks, so as to realize differentiated weighted evaluation of execution time, memory bandwidth, and computing power utilization, improve the accuracy and pertinence of the comprehensive kernel performance score, avoid the evaluation bias caused by fixed weights, and improve the rationality, accuracy and scenario adaptability of performance evaluation.
[0093] In steps S20211 to S20213 of this embodiment, data preprocessing is performed through a data preprocessing model to remove anomalies and ensure the stability and reliability of kernel running performance data. Then, a performance scoring mapping model is used to quantify multi-dimensional running performance data into standard scores to eliminate differences in dimensions. Through a scoring weighting model, a comprehensive kernel performance score is dynamically calculated based on the load task, making the comprehensive kernel performance score more in line with the actual scenario, accurately reflecting the actual running state of the kernel, and improving the accuracy and applicability of the evaluation.
[0094] Step S203: Based on the kernel structure characteristics of the target application software and the kernel running performance data of multiple kernels, determine the performance bottleneck type.
[0095] For example, kernel architecture features are used to indicate attributes such as kernel computational density, memory access behavior, operational logic, and data parallelism mode. Then, based on the kernel architecture features of the target application software (e.g., computational density, memory access behavior, data parallelism mode) and kernel runtime performance data (execution time, memory bandwidth utilization, and computational efficiency), the performance bottleneck type is determined. Specifically, for example, if the kernel architecture features of the target application software are medium computational density, low data locality, moderate memory access requirements, and single-instruction 4-way data parallelism; then, if the kernel runtime performance data of the target kernel is: computational share ≥ 80% of execution time, memory bandwidth utilization ≤ 30%, and computational efficiency ≥ 70%, it is determined to be a computationally intensive bottleneck; if the kernel runtime performance data of the target kernel is: memory access share ≥ 80% of execution time, memory bandwidth utilization ≥ 70%, and computational efficiency ≤ 30%, it is determined to be a memory-intensive bottleneck; if the kernel runtime performance data of multiple kernels is: synchronization and dependency waiting share ≥ 70% of execution time, memory bandwidth utilization ≤ 40%, and computational efficiency ≤ 40%, it is determined to be a low-parallelism bottleneck.
[0096] In this embodiment, kernel performance data of multiple kernels called by the target application software are collected according to the load task; the target kernel is determined from the multiple kernels based on the load task and the kernel performance data of the multiple kernels; wherein the target kernel is the kernel with a performance bottleneck; the performance bottleneck type is determined based on the kernel structure characteristics of the target application software and the kernel performance data of the target kernel; this solves the problem of insufficient accuracy in locating the performance bottleneck of the application software in the existing solution that uses the basic performance statistics tools built into the artificial intelligence accelerator card to collect data on the overall operator running time and memory usage of the application software to obtain the performance data of the application software, and then locates the performance bottleneck of the application software based on the performance data of the application software.
[0097] Furthermore, after determining the type of performance bottleneck in the target kernel, the method provided in this application embodiment further includes:
[0098] Step S204: Using a multi-objective optimization algorithm, a performance optimization strategy is generated based on the performance bottleneck type of the target kernel and the kernel running performance data of multiple kernels.
[0099] For example, multi-objective optimization algorithms include the NSGA-II algorithm and particle swarm optimization algorithm.
[0100] Specifically, taking the low parallelism bottleneck as an example, the kernel performance data for multiple kernels is that the proportion of synchronization and dependency waiting in execution time is ≥70%, memory bandwidth utilization is ≤40%, and computing power utilization is ≤40%. Using the NSGA-II algorithm, the optimization goals are to achieve a synchronization waiting ratio of ≤30%, computing power utilization of ≥65%, and a reduction in execution time of ≥35%. The resulting performance optimization strategies include: 1) splitting fine-grained dependencies into dependency-free sub-blocks to increase the number of independent parallel tasks and reduce the synchronization frequency; 2) reconstructing critical path data dependencies to reduce inter-thread waiting and maximize the efficiency of single-instruction 4-way parallelism; 3) replacing global synchronization with local lightweight synchronization to reduce the synchronization waiting ratio to below 30%; 4) improving computing power utilization by addressing the idle computing power caused by uneven distribution.
[0101] Alternatively, taking a computationally intensive bottleneck as an example, the target kernel's performance data is: computation ≥ 80% of execution time, memory bandwidth utilization ≤ 30%, and computing power utilization ≥ 70%. Using the particle swarm optimization algorithm, with the optimization objectives being: computation ≥ 80% of execution time, memory bandwidth utilization ≤ 30%, and computing power utilization ≥ 70%, the resulting performance optimization strategies are: 1) Optimize the instruction issuance window and pipeline scheduling parameters using the particle swarm algorithm to improve the throughput efficiency of computing units; 2) Adaptively adjust the allocation ratio of computing units to fully utilize hardware parallel resources and alleviate computational congestion; 3) Optimize the loop expansion factor and vectorization length using particle swarm optimization to match the 4-way data parallel width and improve computational efficiency; 4) Optimize the iterative convergence conditions and redundant computation judgment thresholds to reduce invalid computation operations and shorten the core computation path. If the optimization objective is not achieved after adopting the performance optimization strategy, the number of algorithm iterations is adjusted, and optimization is repeated until the optimization objective is reached.
[0102] In this embodiment, corresponding optimization algorithms are adapted for different performance bottleneck types, and optimization targets are set in conjunction with kernel running performance data to generate targeted performance optimization strategies to improve the computing power utilization of the target kernel and reduce latency and execution time. At the same time, iterative adjustment of algorithm parameters is supported to ensure that the optimization effect meets the target and enhance the accuracy, applicability and reliability of performance optimization.
[0103] Figure 3 A flowchart of an application software performance bottleneck localization method provided in another embodiment of this application is shown below. Figure 3 As shown, the application software performance bottleneck localization method provided in this embodiment is... Figure 2 Based on the application software performance bottleneck localization method provided in the illustrated embodiment, after determining the performance bottleneck type according to the kernel structure characteristics of the target application software and the kernel running performance data of the target kernel, the method is further refined. Therefore, the application software performance bottleneck localization method provided in this embodiment includes the following steps:
[0104] Step S301: Based on the load task, collect kernel running performance data of multiple kernels called by the target application software.
[0105] Step S302: Based on the workload and kernel performance data of multiple kernels, determine the target kernel from multiple kernels; wherein, the target kernel is the kernel with a performance bottleneck.
[0106] Step S303: Based on the kernel structure characteristics of the target application software and the kernel running performance data of multiple kernels, determine the performance bottleneck type.
[0107] Step S304: Invoke the performance optimization knowledge base; wherein, the performance optimization knowledge base is used to store reference performance optimization strategies, as well as reference performance bottleneck characteristics and reference kernel structure characteristics corresponding to the reference performance optimization strategies.
[0108] Step S305: Generate performance bottleneck characteristics based on the performance bottleneck type, the kernel structure characteristics of the target application software, and the kernel running performance data of multiple kernels.
[0109] For example, if the performance bottleneck type is a low parallelism bottleneck, then extract the kernel running performance data of multiple kernels (synchronization and dependency waiting ratio ≥70% in execution time, memory bandwidth utilization ≤40%, computing power utilization ≤40%), and combine it with the kernel structure characteristics of the target application software (medium computing density, low data locality, general memory access requirements, single instruction 4-way data parallelism), and generate the corresponding performance bottleneck characteristics as follows: medium computing density, low data locality, general memory access requirements, insufficient utilization of single instruction 4-way data parallelism, synchronization and dependency waiting ratio ≥70% in execution time, memory bandwidth utilization ≤40%, computing power utilization ≤40%, low efficiency of multi-threaded parallelism and unbalanced load between kernels.
[0110] If the performance bottleneck type is a computationally intensive bottleneck, then extract the kernel performance data of the target kernel from the kernel performance data of multiple kernels (computation share in execution time ≥80%, memory bandwidth utilization ≤30%, computing power utilization ≥70%), and combine it with the kernel structure characteristics of the target application software (medium computation density, low data locality, general memory access requirements, single instruction 4-way data parallelism) to generate performance bottleneck characteristics: significant medium computation density, computation share in kernel execution time ≥80%, memory bandwidth utilization ≤30%, computing power utilization ≥70%, low data locality and general memory access requirements, single instruction 4-way data parallelism but computing resources tend to be saturated.
[0111] If the performance bottleneck type is a memory-intensive bottleneck, then extract the kernel performance data of the target kernel from the kernel performance data of multiple kernels (memory access rate ≥80% of execution time, memory bandwidth utilization ≥70%, computing power utilization ≤30%), and combine it with the kernel structure characteristics of the target application software (medium computing density, low data locality, general memory access requirements, single instruction 4-way data parallelism) to generate the following performance bottleneck characteristics: medium computing density, low data locality, general memory access requirements, single instruction 4-way data parallelism, memory access rate ≥80% of execution time, memory bandwidth utilization ≥70%, computing power utilization ≤30%, memory access resources are saturated and computing resources are seriously idle.
[0112] Step S306: Calculate the similarity between the performance bottleneck features and the reference performance bottleneck features in the performance optimization knowledge base to obtain a bottleneck feature similarity set.
[0113] Step S307: Determine the maximum bottleneck feature similarity from the bottleneck feature similarity set.
[0114] For example, cosine similarity is calculated between the performance bottleneck feature and all reference performance bottleneck features in the knowledge base to obtain a bottleneck feature similarity set, for example, the bottleneck feature similarity set is {0.62, 0.89, 0.75}; then, the maximum bottleneck feature similarity is determined from the bottleneck feature similarity set, that is, the maximum bottleneck feature similarity is 0.89.
[0115] Step S308: Determine the target reference performance optimization strategy and target reference kernel structure features based on the maximum bottleneck feature similarity.
[0116] For example, based on the maximum bottleneck feature similarity, the corresponding target reference performance optimization strategy (task splitting, cache reuse) and target reference kernel structure features (medium computation density, low data locality, medium memory access requirements, single instruction 4-way data parallelism) are matched from the performance optimization knowledge base.
[0117] Specifically, the specific implementation steps of step S308 include: determining the reference performance optimization strategy corresponding to the maximum bottleneck feature similarity in the performance optimization knowledge base as the target reference performance optimization strategy based on the maximum bottleneck feature similarity; and determining the reference kernel structure feature corresponding to the maximum bottleneck feature similarity in the performance optimization knowledge base as the target reference kernel structure feature based on the maximum bottleneck feature similarity.
[0118] In this embodiment, by directly matching one-to-one based on the maximum bottleneck feature similarity, the most suitable reference strategy and reference structure can be quickly and accurately determined from the performance optimization knowledge base. This avoids redundant screening and matching bias, ensuring that the reference basis matches the performance bottleneck of the target kernel. This provides reliable support for the subsequent generation of performance optimization strategies for the target kernel, improving optimization efficiency and targeting.
[0119] Step S309: Determine the performance optimization strategy for the target kernel based on the target reference performance optimization strategy, the target reference kernel structure characteristics, and the kernel structure characteristics of the target application software.
[0120] For example, the target reference performance optimization strategy is task splitting and cache reuse; the target reference kernel architecture features medium computational density, low data locality, medium memory access requirements, and single-instruction 4-way data parallelism. The target application software's kernel architecture features medium computational density, low data locality, moderate memory access requirements, and single-instruction 4-way data parallelism. The target reference performance optimization strategy, target reference kernel architecture features, and target application software's kernel architecture features are adapted to generate a target kernel performance optimization strategy. Specifically, the target kernel performance optimization strategy includes: splitting large computational tasks into subtasks with no strong dependencies and balanced load based on the single-instruction 4-way data parallelism granularity, eliminating synchronization waits and serial dependencies between tasks, adapting to medium computational density characteristics, and avoiding resource idleness and load imbalance; for the kernel's low data locality and moderate memory access requirements, frequently accessed data is kept resident in the high-speed cache, data block reuse rules are optimized, cache hit rate is improved, duplicate memory accesses are reduced, memory access pressure is alleviated, and data is efficiently read using 4-way parallel instructions.
[0121] In this embodiment, by calling the performance optimization knowledge base and combining the performance bottleneck type, the kernel structure characteristics of the target application software, and the performance bottleneck characteristics generated from the kernel running performance data of multiple kernels, the similarity matching between the performance bottleneck characteristics and the reference performance bottleneck characteristics in the performance optimization knowledge base is used to determine the appropriate target reference performance optimization strategy and target reference kernel structure characteristics. Then, by combining the kernel structure characteristics of the target application software, the corresponding performance optimization strategy is determined. This improves the accuracy and efficiency of performance optimization strategy generation, avoids blind optimization, and ensures that the optimization effect of the performance optimization strategy matches the target kernel.
[0122] In another possible implementation, the specific steps of step S309 include:
[0123] Step S3091: Calculate the similarity between the target reference kernel structure features and the target application software kernel structure features to obtain the structure feature similarity.
[0124] Step S3092: Determine the relationship between the structural feature similarity and the structural feature similarity threshold.
[0125] Step S3093: If the structural feature similarity is greater than or equal to the structural feature similarity threshold, then the target reference performance optimization strategy is determined as the target kernel performance optimization strategy.
[0126] For example, the target reference kernel's structural characteristics are "medium computational density, low data locality, moderate memory access requirements, and single-instruction 8-way data parallelism," while the target application software's kernel structural characteristics are "medium computational density, low data locality, moderate memory access requirements, and single-instruction 4-way data parallelism." Using the cosine similarity algorithm, the structural feature similarity is calculated to be 0.92. Furthermore, since the structural feature similarity of 0.92 is greater than the structural feature similarity threshold of 0.8, the performance optimization strategy of the target reference kernel is directly determined as the performance optimization strategy of the target kernel.
[0127] In step S3093 of this embodiment, when the structural feature similarity is greater than or equal to the structural feature similarity threshold, it indicates that the target kernel and the reference kernel are structurally similar. Therefore, the target reference performance optimization strategy can be directly reused without additional adjustment, which improves the efficiency of determining the performance optimization strategy of the target kernel. While reducing the workload of strategy adaptation, it ensures the adaptability of the performance optimization strategy and avoids optimization deviation caused by excessive adjustment of the performance optimization strategy.
[0128] Step S3094: If the structural feature similarity is less than the structural feature similarity threshold, then feature difference extraction is performed on the target reference kernel structural features and the target application software kernel structural features to obtain kernel structural feature difference data.
[0129] Step S3095: Based on the kernel structure feature differentiation data, adjust the target reference performance optimization strategy to generate the target kernel performance optimization strategy.
[0130] For example, the target reference kernel's structural characteristics are "medium computational density, low data locality, high memory access requirements, and 8-way data parallelism per instruction," while the target application software's kernel structural characteristics are "medium computational density, low data locality, moderate memory access requirements, and 4-way data parallelism per instruction." The calculated structural feature similarity is 0.72. Furthermore, since the structural feature similarity of 0.72 is less than the structural feature similarity threshold of 0.8, feature differentiation is extracted between the target reference kernel's structural characteristics and the target application software's kernel structural characteristics, yielding the following kernel structural feature differentiation data: 1) Different memory access requirements: the target reference kernel has high memory access requirements, while the target application software's kernel has moderate memory access requirements; 2) Different data parallelism granularity: the target reference kernel corresponds to 8-way data parallelism per instruction, while the target application software's kernel corresponds to 4-way data parallelism per instruction. Therefore, the target reference performance optimization strategy is adjusted based on the kernel structural feature differentiation data to generate a performance optimization strategy adapted to the target kernel.
[0131] In steps S3094 to S3095 of this embodiment, when the structural feature similarity is less than the structural feature similarity threshold, it indicates that the target kernel and the reference kernel are not structurally similar. Therefore, by extracting the structural differences between the target kernel and the reference kernel, and adjusting the target reference performance optimization strategy based on the structural differences (kernel structural feature difference data), the optimization failure caused by directly reusing an unsuitable optimization strategy is avoided. This ensures that the performance optimization strategy of the generated target kernel matches the kernel structure of the target kernel, thereby improving the adaptability and effectiveness of the performance optimization strategy.
[0132] Furthermore, after step S3095, the method provided in this application embodiment further includes: determining the performance optimization strategy of the target kernel as the current reference performance optimization strategy; determining the kernel structure characteristics of the target application software as the current reference kernel structure characteristics; determining the performance bottleneck characteristics as the current reference performance bottleneck characteristics; storing the current reference performance optimization strategy, the current reference kernel structure characteristics, and the current reference performance bottleneck characteristics in a performance optimization knowledge base; and establishing a mapping relationship between the current reference performance optimization strategy, the current reference kernel structure characteristics, and the current reference performance bottleneck characteristics in the performance optimization knowledge base to update the performance optimization knowledge base.
[0133] Specifically, the performance optimization strategy for the target kernel generated in step S3095 does not exist in the performance optimization knowledge base. Therefore, the performance optimization strategy for the target kernel is determined as a new reference performance optimization strategy, i.e., the current reference performance optimization strategy. The kernel structure characteristics of the target application software are determined as new reference kernel structure characteristics, i.e., the current reference kernel structure characteristics. The performance bottleneck characteristics are determined as new reference performance bottleneck characteristics, i.e., the current reference performance bottleneck characteristics. Then, the current reference performance optimization strategy, the current reference kernel structure characteristics, and the current reference performance bottleneck characteristics are stored in the performance optimization knowledge base, and a mapping relationship is established between them to update the performance optimization knowledge base, resulting in an updated performance optimization knowledge base. Finally, the updated performance optimization knowledge base is redefined as the performance optimization knowledge base for application to the performance bottleneck localization and performance optimization of other application software.
[0134] In this embodiment, the performance optimization knowledge base is updated through an incremental update mechanism, enriching the reference data to adapt to different kernel structures. This improves the accuracy and efficiency of subsequent performance bottleneck matching and performance optimization strategy generation, achieving dynamic optimization of the performance optimization knowledge base and enhancing its scalability and adaptability.
[0135] In this embodiment, the implementation of steps S301-S303 is the same as that in this application. Figure 2 The implementation methods of steps S201-S203 in the illustrated embodiment are the same, and will not be described in detail here.
[0136] Figure 4 This is a schematic diagram of the structure of an application software performance bottleneck location device provided in one embodiment of this application, as shown below. Figure 4 As shown, the application software performance bottleneck location device 40 provided in this embodiment includes:
[0137] The acquisition module 401 is used to acquire kernel running performance data of multiple kernels called by the target application software according to the load task.
[0138] Processing module 402 is used to determine the target kernel from multiple kernels based on the load task and the kernel running performance data of multiple kernels; wherein the target kernel is the kernel with a performance bottleneck.
[0139] The determination module 403 is used to determine the performance bottleneck type based on the kernel structure characteristics of the target application software and the kernel running performance data of multiple kernels.
[0140] Optionally, in the application software performance bottleneck localization device 40 described above, when the processing module 402 determines the target kernel from multiple kernels based on the load task and the kernel running performance data of multiple kernels, it is specifically used to: input the load task and the kernel running performance data of multiple kernels into a pre-trained supervised learning model, and output the comprehensive kernel performance score of each kernel; and determine the target kernel from multiple kernels based on the comprehensive kernel performance score of each kernel.
[0141] Optionally, in the application software performance bottleneck localization device 40 described above, the pre-trained supervised learning model includes a data preprocessing model, a performance scoring mapping model, and a scoring weighting model; the kernel running performance data includes execution time, memory bandwidth utilization, and computing power utilization; when the processing module 402 inputs the load task and the kernel running performance data of multiple kernels into the pre-trained supervised learning model and outputs a comprehensive kernel performance score for each kernel, it specifically performs the following: For the kernel running performance data of each kernel: inputting the kernel running performance data into the data preprocessing model and outputting preprocessed kernel running performance data; wherein, the preprocessed kernel running performance data includes preprocessed execution time, preprocessed memory bandwidth utilization, and preprocessed computing power utilization; inputting the preprocessed execution time, preprocessed memory bandwidth utilization, and preprocessed computing power utilization into the performance scoring mapping model and outputting execution time score, memory bandwidth score, and computing power utilization score; inputting the execution time score, memory bandwidth score, computing power utilization score, and load task into the scoring weighting model and outputting a comprehensive kernel performance score.
[0142] Optionally, in the application software performance bottleneck localization device 40 described above, the processing module 402, when inputting the execution time score, memory bandwidth score, computing power utilization score, and load task into the scoring weighting model and outputting a comprehensive kernel performance score, specifically performs the following: inputting the execution time score, memory bandwidth score, computing power utilization score, and load task into the scoring weighting model; using the scoring weighting model to determine the load task characteristics based on the load task; using the scoring weighting model to determine the first weighting coefficient corresponding to the execution time score, the second weighting coefficient corresponding to the memory bandwidth score, and the third weighting coefficient corresponding to the computing power utilization score based on the load task characteristics; using the scoring weighting model to perform weighted calculations on the execution time score, the first weighting coefficient, the memory bandwidth score, the second weighting coefficient, the computing power utilization score, and the third weighting coefficient to obtain a comprehensive kernel performance score; and using the scoring weighting model to output the comprehensive kernel performance score.
[0143] Optionally, when the application software performance bottleneck location device 40 described above collects kernel running performance data of multiple kernels called by the target application software according to the load task, the acquisition module 401 is specifically used to: determine the real-time load status of the target application software according to the load task; determine the performance data sampling frequency according to the real-time load status; and collect kernel running performance data of multiple kernels according to the performance data sampling frequency.
[0144] Optionally, after determining the performance bottleneck type based on the kernel structure characteristics of the target application software and the kernel runtime performance data of the target kernel, the application software performance bottleneck location device 40 described above is further configured to: invoke a performance optimization knowledge base; wherein the performance optimization knowledge base stores reference performance optimization strategies, as well as reference performance bottleneck features and reference kernel structure features corresponding to the reference performance optimization strategies; generate performance bottleneck features based on the performance bottleneck type, the kernel structure characteristics of the target application software, and the kernel runtime performance data of multiple kernels; perform similarity calculation on the performance bottleneck features and the reference performance bottleneck features in the performance optimization knowledge base to obtain a bottleneck feature similarity set; determine the maximum bottleneck feature similarity from the bottleneck feature similarity set; determine the target reference performance optimization strategy and the target reference kernel structure features based on the maximum bottleneck feature similarity; and determine the performance optimization strategy of the target kernel based on the target reference performance optimization strategy, the target reference kernel structure features, and the kernel structure characteristics of the target application software.
[0145] Optionally, the application software performance bottleneck localization device 40 described above, when determining the target reference performance optimization strategy and the target reference kernel structure feature based on the maximum bottleneck feature similarity, is specifically used for: determining the reference performance optimization strategy corresponding to the maximum bottleneck feature similarity in the performance optimization knowledge base as the target reference performance optimization strategy based on the maximum bottleneck feature similarity; and determining the reference kernel structure feature corresponding to the maximum bottleneck feature similarity in the performance optimization knowledge base as the target reference kernel structure feature based on the maximum bottleneck feature similarity.
[0146] Optionally, the application software performance bottleneck location device 40 described above, when generating a target kernel performance optimization strategy based on the target reference performance optimization strategy, the target reference kernel structure features, and the kernel structure features of the target application software, specifically performs the following: calculating the similarity between the target reference kernel structure features and the kernel structure features of the target application software to obtain a structural feature similarity; determining the relationship between the structural feature similarity and the structural feature similarity threshold; and if the structural feature similarity is greater than or equal to the structural feature similarity threshold, then determining the target reference performance optimization strategy as the target kernel performance optimization strategy.
[0147] Optionally, the application software performance bottleneck location device 40 described above determines the relationship between the structural feature similarity and the structural feature similarity threshold. The application software performance bottleneck location device 40 is further configured to: if the structural feature similarity is less than the structural feature similarity threshold, perform feature differentiation extraction on the target reference kernel structural features and the target application software kernel structural features to obtain kernel structural feature differentiation data; and adjust the target reference performance optimization strategy based on the kernel structural feature differentiation data to generate a target kernel performance optimization strategy.
[0148] Optionally, after adjusting the target reference performance optimization strategy based on kernel structure feature differentiation data to generate a target kernel performance optimization strategy, the application software performance bottleneck localization device 40 described above is further configured to: determine the target kernel performance optimization strategy as the current reference performance optimization strategy; determine the kernel structure features of the target application software as the current reference kernel structure features; determine the performance bottleneck features as the current reference performance bottleneck features; store the current reference performance optimization strategy, the current reference kernel structure features, and the current reference performance bottleneck features in a performance optimization knowledge base; and establish a mapping relationship between the current reference performance optimization strategy, the current reference kernel structure features, and the current reference performance bottleneck features in the performance optimization knowledge base to update the performance optimization knowledge base.
[0149] The application software performance bottleneck location device 40 provided in this embodiment can perform the following: Figures 2-3 The technical solutions of any of the method embodiments shown are similar in implementation principle and technical effect, and will not be described again here.
[0150] Figure 5 A schematic diagram of the structure of the electronic device provided in this application. Figure 5 As shown, the electronic device 50 provided in this embodiment includes at least one processor 501 and a memory 502. Optionally, the device 50 further includes a communication component 503. The processor 501, memory 502, and communication component 503 are connected via a bus.
[0151] In a specific implementation, at least one processor 501 executes computer execution instructions stored in memory 502, causing at least one processor 501 to perform the above-described method.
[0152] The specific implementation process of processor 501 can be found in the above method embodiments, and its implementation principle and technical effect are similar. It will not be repeated here.
[0153] In the above embodiments, it should be understood that the processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor.
[0154] The memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage device.
[0155] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.
[0156] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method.
[0157] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the above-described method.
[0158] The aforementioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The readable storage medium can be any available medium accessible to a general-purpose or special-purpose computer.
[0159] An exemplary readable storage medium is coupled to a processor, enabling the processor to read information from and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and the readable storage medium can exist as discrete components in the device.
[0160] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily essential to this application.
[0161] It should be further noted that although the steps in the flowchart are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowchart may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0162] It should be understood that the above-described device embodiments are merely illustrative, and the device of this application can also be implemented in other ways. For example, the division of units / modules in the above embodiments is only a logical functional division, and there may be other division methods in actual implementation. For example, multiple units, modules, or components may be combined, or integrated into another system, or some features may be ignored or not executed.
[0163] Furthermore, unless otherwise specified, the functional units / modules in the various embodiments of this application can be integrated into one unit / module, or each unit / module can exist physically separately, or two or more units / modules can be integrated together. The integrated units / modules described above can be implemented in hardware or as software program modules.
[0164] When integrated units / modules are implemented in hardware, the hardware can be digital circuits, analog circuits, etc. The physical implementation of the hardware structure includes, but is not limited to, transistors, memristors, etc. Unless otherwise specified, the processor can be any suitable hardware processor, such as a CPU, GPU, FPGA, DSP, and ASIC, etc. Unless otherwise specified, the storage unit can be any suitable magnetic or magneto-optical storage medium, such as Resistive Random Access Memory (RRAM), Dynamic Random Access Memory (DRAM), Static Random Access Memory (SRAM), Enhanced Dynamic Random Access Memory (EDRAM), High-Bandwidth Memory (HBM), Hybrid Memory Cube (HMC), etc.
[0165] If the integrated unit / module is implemented as a software program module and sold or used as an independent product, it can be stored in a computer-readable storage device (CMD). Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned memory includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.
[0166] In the above embodiments, the descriptions of each embodiment have their own emphasis. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments. The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as the combination of these technical features does not contradict each other, it should be considered within the scope of this specification.
[0167] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the following claims.
[0168] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
Claims
1. A method for locating performance bottlenecks in application software, characterized in that, The method includes: Based on the workload, collect kernel performance data of multiple kernels called by the target application software; Based on the load task and the kernel running performance data of the multiple kernels, a target kernel is determined from the multiple kernels; wherein, the target kernel is the kernel with a performance bottleneck; Based on the kernel structure characteristics of the target application software and the kernel running performance data of the multiple kernels, the performance bottleneck type is determined.
2. The method according to claim 1, characterized in that, The step of determining the target kernel from the plurality of kernels based on the load task and the kernel performance data of the plurality of kernels includes: The load task and the kernel performance data of the multiple kernels are input into a pre-trained supervised learning model, and the comprehensive kernel performance score of each kernel is output. The target kernel is determined from the plurality of kernels based on the comprehensive kernel performance score of each kernel.
3. The method according to claim 2, characterized in that, The pre-trained supervised learning model includes a data preprocessing model, a performance scoring mapping model, and a scoring weighting model; the kernel runtime performance data includes execution time, memory bandwidth utilization, and computing power utilization. The process of inputting the load task and the kernel performance data of the multiple kernels into a pre-trained supervised learning model, and outputting a comprehensive kernel performance score for each kernel, includes: Kernel performance data for each kernel: The kernel runtime performance data is input into the data preprocessing model, and preprocessed kernel runtime performance data is output; wherein, the preprocessed kernel runtime performance data includes preprocessed execution time, preprocessed memory bandwidth utilization, and preprocessed computing power utilization. The execution time of the preprocessing, the memory bandwidth utilization rate of the preprocessing, and the computing power utilization rate of the preprocessing are input into the performance scoring mapping model, and the execution time score, memory bandwidth score, and computing power utilization rate score are output. The execution time score, memory bandwidth score, computing power utilization score, and workload are input into the scoring weighting model to output the comprehensive kernel performance score.
4. The method according to claim 3, characterized in that, The process of inputting the execution time score, memory bandwidth score, computing power utilization score, and workload into the scoring weighting model to output the comprehensive kernel performance score includes: The execution time score, the memory bandwidth score, the computing power utilization score, and the load task are input into the score weighting model; The load task characteristics are determined based on the load task using the aforementioned scoring weighting model. The scoring weighting model is used to determine the first weighting coefficient corresponding to the execution time score, the second weighting coefficient corresponding to the memory bandwidth score, and the third weighting coefficient corresponding to the computing power utilization score based on the characteristics of the load task. The execution time score, the first weighting coefficient, the memory bandwidth score, the second weighting coefficient, the computing power utilization score, and the third weighting coefficient are weighted and calculated using the aforementioned scoring weighting model to obtain the comprehensive kernel performance score. The kernel performance comprehensive score is output using the weighted scoring model.
5. The method according to claim 1, characterized in that, The step of collecting kernel performance data from multiple kernels called by the target application software based on the workload includes: Based on the load task, determine the real-time load status of the target application software; The performance data sampling frequency is determined based on the real-time load status; Based on the performance data sampling frequency, kernel running performance data of the multiple kernels are collected.
6. The method according to any one of claims 1-5, characterized in that, After determining the performance bottleneck type based on the kernel architecture characteristics of the target application software and the kernel runtime performance data of the target kernel, the method further includes: The performance optimization knowledge base is invoked; wherein, the performance optimization knowledge base is used to store reference performance optimization strategies, as well as reference performance bottleneck characteristics and reference kernel structure characteristics corresponding to the reference performance optimization strategies. Based on the performance bottleneck type, the kernel structure characteristics of the target application software, and the kernel running performance data of the multiple kernels, a performance bottleneck characteristic is generated. The similarity between the performance bottleneck feature and the reference performance bottleneck feature in the performance optimization knowledge base is calculated to obtain a bottleneck feature similarity set. Determine the maximum bottleneck feature similarity from the set of bottleneck feature similarities; Based on the maximum bottleneck feature similarity, the target reference performance optimization strategy and the target reference kernel structure features are determined; Based on the target reference performance optimization strategy, the target reference kernel structure characteristics, and the kernel structure characteristics of the target application software, the performance optimization strategy of the target kernel is determined.
7. The method according to claim 6, characterized in that, The step of determining the target reference performance optimization strategy and target reference kernel structure features based on the maximum bottleneck feature similarity includes: Based on the maximum bottleneck feature similarity, the reference performance optimization strategy corresponding to the maximum bottleneck feature similarity in the performance optimization knowledge base is determined as the target reference performance optimization strategy; Based on the maximum bottleneck feature similarity, the reference kernel structure feature corresponding to the maximum bottleneck feature similarity in the performance optimization knowledge base is determined as the target reference kernel structure feature.
8. The method according to claim 6, characterized in that, The step of generating the performance optimization strategy for the target kernel based on the target reference performance optimization strategy, the target reference kernel structure characteristics, and the kernel structure characteristics of the target application software includes: The similarity between the target reference kernel structure features and the target application software kernel structure features is calculated to obtain the structure feature similarity. Determine the relationship between the structural feature similarity and the structural feature similarity threshold; If the structural feature similarity is greater than or equal to the structural feature similarity threshold, then the target reference performance optimization strategy is determined as the performance optimization strategy for the target kernel.
9. The method according to claim 8, characterized in that, The determination of the relationship between the structural feature similarity and the structural feature similarity threshold further includes: If the structural feature similarity is less than the structural feature similarity threshold, then feature difference extraction is performed on the target reference kernel structural features and the kernel structural features of the target application software to obtain kernel structural feature difference data; Based on the kernel structure feature differentiation data, the target reference performance optimization strategy is adjusted to generate the target kernel performance optimization strategy.
10. The method according to claim 9, characterized in that, After adjusting the target reference performance optimization strategy based on the kernel structure feature differentiation data to generate the target kernel performance optimization strategy, the method further includes: The performance optimization strategy of the target kernel is determined as the current reference performance optimization strategy; The kernel structure characteristics of the target application software are determined as the current reference kernel structure characteristics; The aforementioned performance bottleneck feature is identified as the current reference performance bottleneck feature. The current reference performance optimization strategy, the current reference kernel structure characteristics, and the current reference performance bottleneck characteristics are stored in the performance optimization knowledge base; In the performance optimization knowledge base, a mapping relationship is established between the current reference performance optimization strategy, the current reference kernel structure characteristics, and the current reference performance bottleneck characteristics, so as to update the performance optimization knowledge base.
11. A device for locating performance bottlenecks in application software, characterized in that, include: The acquisition module is used to collect kernel performance data of multiple kernels called by the target application software according to the load task. A processing module is configured to determine a target kernel from the plurality of kernels based on the load task and the kernel running performance data of the plurality of kernels; wherein the target kernel is a kernel with a performance bottleneck; The determination module is used to determine the performance bottleneck type of the performance bottleneck based on the kernel structure characteristics of the target application software and the kernel running performance data of the multiple kernels.
12. An electronic device, characterized in that, include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the method as described in any one of claims 1 to 10.
13. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1 to 10.
14. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the method of any one of claims 1 to 10.