Continuous integration method, apparatus, device, storage medium and program product
By introducing an AI test orchestration agent into the continuous integration method, the testing, diagnosis, and correction of GPU operator code are automated, solving the inefficiency problem caused by reliance on manual intervention in existing technologies and achieving efficient automated continuous integration.
Patent Information
- Application Number
- CN202511894818.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-16
- Publication Date
- 2026-03-20
- Estimated Expiration
- 2045-12-16
AI Technical Summary
Existing continuous integration methods rely heavily on manual intervention in the development of high-performance GPGPU operator libraries, resulting in long code repair and optimization cycles, low efficiency, and susceptibility to interference from subjective human factors, leading to poor continuous integration performance.
By introducing a pre-trained AI test orchestration agent, code diagnostic reports are generated by calling various testing tools, code optimization suggestions are generated by combining GPU hardware information, and GPU operator code is automatically corrected, forming an automated 'test-diagnosis-repair-verification' closed loop.
It enables automated testing, diagnostic analysis, and correction of GPU operator code, shortening the repair and optimization cycle, improving the efficiency and effectiveness of continuous integration, and reducing reliance on human subjective factors.
Smart Images

Figure CN121364882B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer technology, and in particular, to a continuous integration method, device, equipment, storage medium and program product. BACKGROUND
[0002] CI / CD (Continuous Integration / Continuous Deployment) is a software development technology, and developers can continuously integrate and deploy code through automated processes and tools on a continuous integration platform. At present, in the field of high-performance GPGPU (General-Purpose computing on Graphics Processing Units) operator library development, the industry generally uses CI processes to ensure the code quality of GPU operator code.
[0003] Specifically, for the GPU operator code uploaded by the developer, the continuous integration platform needs to test the GPU operator code through the CI process first, and only when the GPU operator code passes the test can the code integration and deployment be formally carried out. The existing CI process usually adopts a linear working mode: after the developer writes and uploads the GPU operator code, different test tools need to be triggered to test the GPU operator code, and analysis reports of each test tool are generated respectively. Then, the developer manually analyzes the analysis reports of different test tools, manually repairs the GPU operator code according to the manual analysis results, and re-triggers different test tools to test after the code is repaired, until the code that meets the requirements is obtained, and the continuous integration of the GPU operator code is completed.
[0004] However, this continuous integration method seriously depends on the manual intervention of the developer in the whole process of testing the code, integrating and analyzing the analysis reports, repairing the code, and retesting, has a high requirement on the ability of the developer to interpret the analysis reports and formulate code optimization strategies, the period of code repair and optimization is long, and is easily disturbed by human subjective factors, thereby leading to low efficiency of continuous integration of the GPU operator code and poor effect of continuous integration. SUMMARY
[0005] The present application provides a continuous integration method, device, equipment, storage medium and program product to solve the defects of low efficiency and poor effect of continuous integration of the GPU operator code in the existing continuous integration method.
[0006] This invention provides a continuous integration method, comprising: acquiring GPU operator code; using a pre-trained AI test orchestration agent to call a test tool to test the GPU operator code and generate a code diagnostic report; using the AI test orchestration agent to generate code optimization suggestions based on the code diagnostic report and GPU hardware information; and using the code optimization suggestions to correct the GPU operator code and obtain the target operator code.
[0007] According to a continuous integration method provided by the present invention, the number of testing tools is at least two; based on a pre-trained AI test orchestration agent, the testing tools are invoked to test the GPU operator code and generate a code diagnostic report, including: based on the AI test orchestration agent, each testing tool is invoked to test the GPU operator code, generating a raw analysis report corresponding to each testing tool; each raw analysis report is standardized and fused to generate a comprehensive report; based on the AI test orchestration agent, root cause correlation analysis is performed on the comprehensive report to generate a code diagnostic report.
[0008] According to a continuous integration method provided by the present invention, the testing tools include at least two of the following: code quality testing tools, memory safety testing tools, GPU computational correctness testing tools, concurrency safety testing tools, code coverage testing tools, and performance analysis testing tools.
[0009] According to a continuous integration method provided by the present invention, GPU operator code is modified based on code optimization suggestions to obtain target operator code. The method includes: determining the code application method of the code optimization suggestions based on the degree of repair risk of the code optimization suggestions, and modifying the GPU operator code based on the code application method to obtain modified code; determining whether the modified code meets the application requirements; if the modified code does not meet the application requirements, the modified code is used as GPU operator code and returned to the pre-trained AI test orchestration agent to call the test tool to test the GPU operator code and generate a code diagnostic report, until the modified code meets the application requirements and the target operator code is obtained.
[0010] According to a continuous integration method provided by the present invention, the code application mode includes automated application; based on the repair risk level of the code optimization suggestion, the code application mode of the code optimization suggestion is determined, and based on the code application mode, the GPU operator code is corrected to obtain corrected code, including: if the repair risk level of the code optimization suggestion is less than a preset threshold, the code application mode of the code optimization suggestion is determined to be automated application; based on the code optimization suggestion, the GPU operator code is automatically corrected to obtain corrected code.
[0011] According to the continuous integration method provided by the application, the code application mode includes non-automatic application; the code application mode of the code optimization suggestion is determined based on the repair risk degree of the code optimization suggestion, and the GPU operator code is modified based on the code application mode to obtain modified code, including: if the repair risk degree of the code optimization suggestion is greater than or equal to a preset threshold, the code application mode of the code optimization suggestion is determined as non-automatic application; a code modification comparison result is generated based on the code optimization suggestion; in response to an audit pass instruction, the GPU operator code is modified based on the code optimization suggestion to obtain modified code.
[0012] The application further provides a continuous integration device, including: an acquisition module configured to acquire GPU operator code; a test diagnosis module configured to call a test tool to test the GPU operator code based on a pre-trained AI test arrangement agent to generate a code diagnosis report; an optimization suggestion generation module configured to generate a code optimization suggestion based on the AI test arrangement agent according to the code diagnosis report and GPU hardware information; and a modification module configured to modify the GPU operator code based on the code optimization suggestion to obtain target operator code.
[0013] The application further provides an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements any of the above continuous integration methods when executing the computer program.
[0014] The application further provides a non-transitory computer-readable storage medium having a computer program stored thereon, and the computer program is executable by a processor to implement any of the above continuous integration methods.
[0015] The application further provides a computer program product including a computer program, and the computer program is executable by a processor to implement any of the above continuous integration methods.
[0016] The continuous integration method, device, equipment, storage medium and program product provided by the application introduce artificial intelligence (Artificial Intelligence, AI) technology in the continuous integration process of the GPU operator code. After obtaining the GPU operator code, the pre-trained AI test arrangement agent is called to test the GPU operator code by calling the test tool, and a code diagnosis report is generated. Then, the AI test arrangement agent is used to generate code optimization suggestions according to the code diagnosis report and GPU hardware information, and the GPU operator code is corrected according to the code optimization suggestions to obtain the target operator code. The automatic testing, automatic diagnosis analysis, automatic correction and automatic continuous integration of the GPU operator code are realized. The artificial interpretation and analysis report and the code optimization strategy are not needed, the period of GPU operator code repair and optimization is shortened, the GPU operator code continuous integration efficiency is improved, and the continuous integration effect is optimized. At the same time, considering that the GPU operator code is different from the conventional code, the running efficiency and execution performance are related to the hardware characteristics of the GPU. Therefore, in the process of generating the code optimization suggestions, the AI test arrangement agent needs to refer to the code diagnosis report and the GPU hardware information to generate the code optimization suggestions, so that the target operator code corrected based on the code optimization suggestions can adapt to the hardware characteristics of the GPU, and the optimization effect of the GPU operator code is further improved. BRIEF DESCRIPTION OF DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the application or prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are some embodiments of the application, and other drawings can be obtained by those skilled in the art without creative labor.
[0018] Figure 1 is one of the flowcharts of the continuous integration method provided by the application.
[0019] Figure 2 is the second flowchart of the continuous integration method provided by the application.
[0020] Figure 3 is the third flowchart of the continuous integration method provided by the application.
[0021] Figure 4 is the structural schematic diagram of the continuous integration device provided by the application.
[0022] Figure 5 is the structural schematic diagram of the electronic device provided by the application. DETAILED DESCRIPTION
[0023] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0024] Please see Figures 1 to 3 , Figure 1 This is one of the flowcharts of the continuous integration method provided by the present invention. Figure 2 This is the second flowchart of the continuous integration method provided by the present invention. Figure 3 This is the third flowchart of the continuous integration method provided by the present invention.
[0025] like Figure 1 As shown, in this embodiment, the continuous integration method is applied to a continuous integration platform. The continuous integration method includes steps S110 to S140, and the specific steps are as follows:
[0026] S110: Obtain GPU operator code.
[0027] The application scenario of this embodiment is to optimize and continuously integrate the GPU operator code written by developers during the development of a high-performance GPGPU operator library.
[0028] GPU operators refer to entities that perform specific operations or functions on a GPU (Graphics Processing Unit). They can be regarded as basic components that perform mathematical operations, data transformations, or logical judgments.
[0029] Taking neural network models as an example, in the deployment and application of most neural network models, users often need to run various non-linear activation functions and other complex custom operators on the GPU for computation. Furthermore, the application process of neural network models usually requires calling some predefined operators, such as common convolution operators and matrix multiplication operators.
[0030] For example, in text recognition tasks, neural network models can use convolution operators to extract text features from the input text and matrix multiplication operators to generate query, key, and value matrices of the text features, thereby calculating attention scores for the text features based on these matrices. In image and video recognition, neural network models can use various custom operators to extract multi-scale features from input images or video frames and use pooling operators to pool the extracted multi-scale features. In voice interaction, neural network models can use convolution operators, pooling operators, normalization operators, activation function operators, etc., to achieve feature extraction, feature fusion, and voice interaction result generation for user speech. Therefore, GPU operators have a wide range of applications.
[0031] These GPU operators are usually stored in the form of code in an operator library. This code is called GPU operator code. After the operator library is developed, if you need to use the GPU operator code, you can directly call the corresponding code from the operator library to compile and run it.
[0032] Specifically, such as Figure 2 and Figure 3 As shown, during the development of the high-performance GPGPU operator library, developers can upload the written GPU operator code to the continuous integration platform. The continuous integration platform can receive the GPU operator code uploaded by developers for subsequent code changes or code testing.
[0033] S120: A pre-trained AI test orchestration agent that calls testing tools to test GPU operator code and generate code diagnostic reports.
[0034] Traditional continuous integration methods rely heavily on the experience of senior developers to interpret analysis reports and formulate code optimization strategies. This kind of tacit knowledge based on human intervention is difficult to solidify, which leads to difficulties in knowledge transfer and low decision-making efficiency.
[0035] Based on this, this embodiment introduces artificial intelligence (AI) technology into the continuous integration process of GPU operator code, solidifying and passing on the code optimization experience and code diagnosis knowledge of senior experts through AI models, so as to reduce the technical threshold for interpreting analysis reports and formulating code optimization strategies, and realize automated code diagnosis and analysis.
[0036] Optionally, a knowledge base and training dataset are first built based on the code optimization experience and code diagnosis knowledge of senior experts, and the initial large language model (LLM) is trained based on the knowledge base and training dataset to obtain an AI test orchestration agent.
[0037] Among them, since large language models themselves have powerful natural language understanding and knowledge generation capabilities, after training with professional domain knowledge such as knowledge bases and training datasets, AI test orchestration agents can have stronger reasoning capabilities, programming capabilities, and professional knowledge accumulation. They can understand the original analysis reports output by various testing tools and perform correlation analysis and code optimization based on the original analysis reports of different testing tools, thus realizing intelligent management of the code testing process.
[0038] Furthermore, after obtaining the GPU operator code, the continuous integration platform can use a pre-trained AI test orchestration agent to call different testing tools to test the GPU operator code and generate code diagnostic reports.
[0039] Optionally, the testing tools include code quality testing tools, memory safety testing tools, GPU computation correctness testing tools, concurrency safety testing tools, code coverage testing tools, and performance analysis testing tools.
[0040] Optionally, code quality testing tools include, but are not limited to, Clang-Tidy.
[0041] Clang-Tidy is a static code analysis tool for C++ provided by the LLVM project. It is mainly used to detect code style violations, potential vulnerabilities, performance issues, and code style problems. It supports automated repair suggestions and can be integrated into mainstream development environments such as Visual Studio.
[0042] Optionally, memory safety testing tools include, but are not limited to, Valgrind, Leak Sanitizer (LSan), and Address Sanitizer (ASan).
[0043] Valgrind, Leak Sanitizer, and Address Sanitizer are mainly used to detect memory safety issues or memory errors such as code memory leaks and out-of-bounds access, but they differ in their working principles, performance, and applicable scenarios.
[0044] Valgrind is an open-source memory debugging and performance analysis tool primarily used on Linux and Unix-like systems. Its core component, Memcheck, can detect issues such as memory leaks, illegal memory accesses, and the use of uninitialized values in code.
[0045] Address Sanitizer is a memory error detector integrated into the GCC and Clang compilers. It is primarily used to detect address-related errors in code, such as buffer overflows, free-after-use errors, and memory leaks.
[0046] Leak Sanitizer is mainly used to detect code memory leak problems, which can intercept memory allocation functions, scan unreleased heap memory blocks at the end of the program, and generate detailed reports.
[0047] Among them, the GPU computing correctness test tool is mainly used to detect kernel memory access errors, synchronization primitive misuse, data races and other problems in GPU applications.
[0048] Optionally, the concurrent safety test tool includes but is not limited to Thread Sanitizer (TSan).
[0049] Among them, Thread Sanitizer is mainly used to detect data race problems in multi-threaded programs.
[0050] Optionally, the code coverage test tool includes but is not limited to gcov and lcov.
[0051] Among them, gcov is a code coverage test tool provided by the GCC compiler, while lcov is a more advanced front-end tool based on gcov, which can be used to generate more readable analysis reports.
[0052] Optionally, the performance analysis test tool includes but is not limited to gprof.
[0053] Among them, gprof is mainly used to analyze GPU kernel (kernel) execution time, memory bandwidth, SM occupancy and other performance indicators; SM occupancy is a key indicator of measuring the resource utilization of GPU streaming multiprocessors (SM), which represents the ratio of the number of currently active thread bundles (warp) to the theoretical maximum number of thread bundles supported by SM.
[0054] S130: Based on the AI test arrangement agent, generate code optimization suggestions according to the code diagnosis report and GPU hardware information.
[0055] Specifically, considering that GPU operator code is different from regular code, its running efficiency and execution performance are closely related to the hardware characteristics of the GPU, therefore, after obtaining the code diagnosis report of the GPU operator code, the GPU running the GPU operator code needs to be determined first, and the GPU hardware information of the GPU is additionally obtained. The continuous integration platform can use the AI test arrangement agent to generate code optimization suggestions according to the code diagnosis report and the GPU hardware information.
[0056] For example, if the code diagnosis report mentions that the current GPU operator code has a shared memory buffer overflow error, the error reason is that the kernel allocates 70 KB (Kilobyte) of shared memory for each thread block, and the GPU hardware information clearly indicates that the shared memory capacity of each SM (streaming multiprocessor) of a certain model of GPU is only 64 KB. The AI test arrangement agent can analyze in depth according to the shared memory capacity of the certain model of GPU in the GPU hardware information and the error reason of the shared memory buffer overflow mentioned in the code diagnosis report, and determine that the shared memory buffer overflow error is caused by the shared memory allocated by the kernel exceeding the GPU hardware limit. At this time, the code optimization suggestion generated by the AI test arrangement agent can be: adjusting the shared memory allocation limit in the GPU operator code to meet the GPU hardware requirements.
[0057] Optionally, to ensure the universality of the GPU operator code, GPU hardware information corresponding to different performance and different types of GPUs can be obtained at the same time for reference by the AI test arrangement agent, so as to subsequently generate target operator code applicable to different performance and different types of GPUs.
[0058] S140: modifying the GPU operator code based on the code optimization suggestion to obtain the target operator code.
[0059] The traditional continuous integration method seriously depends on manual intervention in the whole process of testing code, integrating and analyzing analysis reports, repairing code, and retesting, so that the continuous integration effect may be affected by human subjective factors. Moreover, code performance analysis and code optimization relying on manual work is a highly complex task, especially on a heterogeneous computing platform, which requires developers to have sufficient professional knowledge and invest a lot of time, which easily leads to a long development cycle and high cost of the operator library.
[0060] The embodiment realizes the automatic testing, diagnosis report generation, code optimization suggestion generation, and code automatic modification of the GPU operator code through the pre-trained AI test arrangement agent, greatly improves the automation level of the continuous integration platform, forms an automatic "testing-diagnosis-repair-verification" closed loop of the continuous integration process, and can effectively shorten the development cycle of the operator library and reduce the development cost of the operator library.
[0061] The continuous integration method provided by the embodiment introduces an artificial intelligence (AI) technology in a continuous integration process of GPU operator code. After obtaining the GPU operator code, an AI test arrangement agent is first arranged based on pre-training, a test tool is called to test the GPU operator code, a code diagnosis report is generated, the AI test arrangement agent is used to generate a code optimization suggestion according to the code diagnosis report and GPU hardware information, the GPU operator code is corrected according to the code optimization suggestion, a target operator code is obtained, and automatic testing, automatic diagnosis analysis, automatic correction and automatic continuous integration of the GPU operator code are realized. The GPU operator code does not need to be manually interpreted and analyzed to develop a code optimization strategy, the period of repairing and optimizing the GPU operator code is shortened, the GPU operator code is not easily disturbed by human subjective factors, the efficiency of continuous integration of the GPU operator code is improved, and the effect of continuous integration is optimized. Meanwhile, considering that the GPU operator code is different from a conventional code, the running efficiency and execution performance of the GPU operator code are related to the hardware characteristics of a GPU. Therefore, in the process of generating the code optimization suggestion, the AI test arrangement agent needs to refer to the code diagnosis report and the GPU hardware information to generate the code optimization suggestion, so that the target operator code obtained by correcting based on the code optimization suggestion can adapt to the hardware characteristics of the GPU, and the optimization effect of the GPU operator code is further improved.
[0062] In some embodiments, the number of test tools is at least two; based on the pre-trained AI test arrangement agent, the test tools are called to test the GPU operator code to generate a code diagnosis report, which includes: based on the AI test arrangement agent, each test tool is called to test the GPU operator code to generate an original analysis report corresponding to each test tool; each original analysis report is standardized and fused to generate a comprehensive report; based on the AI test arrangement agent, the comprehensive report is subjected to root cause association analysis to generate the code diagnosis report.
[0063] Optionally, the test tools include at least two of a code quality test tool, a memory safety test tool, a GPU computing correctness test tool, a concurrent safety test tool, a code coverage test tool and a performance analysis test tool.
[0064] As shown in Figure 2 and Figure 3 After obtaining the GPU operator code, the continuous integration platform can dynamically and strategically call each test tool to test the GPU operator code through the AI test arrangement agent to generate an original analysis report corresponding to each test tool.
[0065] Specifically, for each test tool, the pre-trained AI test orchestration agent can call a Model Control Protocol (MCP) interface layer, call the test tool to test the GPU operator code through a standardized MCP protocol provided by the MCP interface layer, and generate an original analysis report corresponding to the test tool.
[0066] Optionally, the MCP protocol carries protocol version information, a tool number of the test tool, a memory detection level, a detection time, an output format, a storage path, and the like.
[0067] Further, each original analysis report is standardized and fused to generate a comprehensive report.
[0068] In a traditional continuous integration method, because different test tools run independently, different test tools generate original analysis reports in different formats, and developers need to integrate and analyze these original analysis reports in different formats, which requires a large amount of time cost, and manual analysis is easy to miss the relevance of key problems in different original analysis reports. For example, a memory problem reported by a test tool Valgrind and a Host (host or main device) data race problem reported by a test tool Thread Sanitizer may be caused by the same logical error in the GPU operator code, but these correlations may be missed or ignored when manually analyzed.
[0069] Based on this, the present embodiment introduces an AI test orchestration agent for automatic analysis and report generation.
[0070] Specifically, for each test tool, when the AI test orchestration agent calls the test tool through the standardized MCP protocol, the output format of the original analysis report of the test tool can be defined by using the output format parameter carried by the MCP protocol, so that the original analysis reports corresponding to different test tools have the same format.
[0071] For example, the output formats of the original analysis reports of different test tools can be uniformly defined as JSON format or XML format, and at this time, the JSON format or the XML format is a unified intermediate representation format, which can be used to parse and map the original output from different test tools.
[0072] Because the original analysis reports corresponding to different test tools have the same format, the AI test orchestration agent can perform standardized parsing and fusion processing on each original analysis report according to the standardized format specification to generate a comprehensive report.
[0073] Further, the continuous integration platform can utilize the AI test orchestration agent to perform root cause analysis such as cross-tool issue correlation, severity evaluation, impact analysis, etc. on the comprehensive report, and generate a structured code diagnosis report, so as to facilitate subsequent optimization of the GPU operator code based on the code diagnosis report and GPU hardware information.
[0074] In some embodiments, the test tools include at least two of a code quality test tool, a memory safety test tool, a GPU computing correctness test tool, a concurrency safety test tool, a code coverage test tool, and a performance analysis test tool.
[0075] Specifically, the original analysis report includes at least two of a code quality test report, a memory safety test report, a GPU computing correctness test report, a concurrency safety test report, a code coverage test report, and a performance analysis test report.
[0076] After obtaining the code to be integrated, the pre-trained AI test orchestration agent can call the code quality test tool to test the code to be integrated through the standardized MCP protocol, and generate a code quality test report.
[0077] Optionally, the code quality test tool includes but is not limited to Clang-Tidy.
[0078] Similarly, the pre-trained AI test orchestration agent can call the memory safety test tool to test the code to be integrated through the standardized MCP protocol, and generate a memory safety test report.
[0079] Optionally, the memory safety test tool includes but is not limited to Valgrind, Leak Sanitizer (LSan), and Address Sanitizer (ASan).
[0080] Similarly, the pre-trained AI test orchestration agent can call the GPU computing correctness test tool to test the code to be integrated through the standardized MCP protocol, and generate a GPU computing correctness test report.
[0081] Similarly, the pre-trained AI test orchestration agent can call the concurrency safety test tool to test the code to be integrated through the standardized MCP protocol, and generate a concurrency safety test report.
[0082] Optionally, the concurrency safety test tool includes but is not limited to Thread Sanitizer (TSan).
[0083] Similarly, the pre-trained AI test orchestration agent can call the code coverage test tool to test the code to be integrated through the standardized MCP protocol, and generate a code coverage test report.
[0084] Optionally, the code coverage test tool includes, but is not limited to, gcov and lcov.
[0085] Similarly, the pre-trained AI test arrangement intelligent agent can call the performance analysis test tool to test the code to be integrated through the standardized MCP protocol, and generate a performance analysis test report.
[0086] Optionally, the performance analysis test tool includes, but is not limited to, gprof.
[0087] Further, the AI test arrangement intelligent agent can perform standardized analysis and fusion processing on at least two of the code quality test report, the memory safety test report, the GPU computing correctness test report, the concurrent safety test report, the code coverage test report, and the performance analysis test report, to generate a comprehensive report.
[0088] Further, the continuous integration platform can use the AI test arrangement intelligent agent to perform root cause correlation analysis on the comprehensive report, such as cross-tool problem correlation, severity level evaluation, and impact range analysis, to generate a structured code diagnosis report, so as to facilitate subsequent optimization of the GPU operator code based on the code diagnosis report and GPU hardware information.
[0089] In some embodiments, based on the code optimization suggestion, the GPU operator code is modified to obtain a target operator code, including: based on the repair risk degree of the code optimization suggestion, determining a code application mode of the code optimization suggestion, and based on the code application mode, modifying the GPU operator code to obtain a modified code; determining whether the modified code meets the application requirements; if the modified code does not meet the application requirements, the modified code is used as the GPU operator code, and the step of calling the test tool to test the GPU operator code based on the pre-trained AI test arrangement intelligent agent to generate a code diagnosis report is returned until the modified code meets the application requirements, and the target operator code is obtained.
[0090] Specifically, after obtaining the code diagnosis report of the GPU operator code, the continuous integration platform can use the AI test arrangement intelligent agent to generate a code optimization suggestion or a program patch based on the code diagnosis report and GPU hardware information, and push the code optimization suggestion or the program patch to the code review system.
[0091] It can be understood that the severity of the problems existing in the GPU operator code is different, and the repair risk degree of the code optimization suggestion generated by the AI test arrangement intelligent agent is also different.
[0092] Generally, the higher the severity of the problem existing in the GPU operator code, the higher the repair risk of the code optimization suggestion generated by the AI test arrangement agent; the lower the severity of the problem existing in the GPU operator code, the lower the repair risk of the code optimization suggestion generated by the AI test arrangement agent.
[0093] Further, the code review system can determine the code application mode of the code optimization suggestion according to the repair risk of the code optimization suggestion, and correct the GPU operator code based on the code application mode to obtain the corrected code.
[0094] In this embodiment, the code application mode includes automatic application and non-automatic application.
[0095] Automatic application refers to that the code review system can automatically correct the GPU operator code according to the code optimization suggestion to obtain the corrected code without going through the manual review process.
[0096] Similarly, the code review system also provides a manual review option, and non-automatic application refers to that the code review system needs to trigger a manual review process, and can correct the GPU operator code according to the code optimization suggestion to obtain the corrected code only after the generated code optimization suggestion or program patch is reviewed by the developer or tester.
[0097] Specifically, in this embodiment, the repair risk of the code optimization suggestion can be divided into three levels, namely, a first risk level (i.e., a low risk level), a second risk level (i.e., a medium risk level), and a third risk level (i.e., a high risk level).
[0098] If the repair risk of the code optimization suggestion is less than a first preset threshold, it can be considered that the repair risk of the code optimization suggestion is at the first risk level (i.e., the low risk level), the problem existing in the GPU operator code is not serious, and the current repair using the code optimization suggestion is a low-risk repair; since the AI test arrangement agent has high reliability and accuracy for low-risk repair, it is not necessary to trigger a manual review process, at this time, the code review system can determine that the code application mode of the code optimization suggestion is automatic application, and automatically correct the GPU operator code according to the code optimization suggestion by using the AI test arrangement agent to obtain the corrected code.
[0099] For example, the formatting processing of the code and the renaming of simple variables can be considered as low-risk repair.
[0100] If the repair risk degree of the code optimization suggestion is greater than or equal to the first preset threshold and less than the second preset threshold, it can be considered that the repair risk degree of the code optimization suggestion is a second risk level (i.e., a medium risk level), the problem of the GPU operator code is relatively serious, and the current repair using the code optimization suggestion is a medium risk repair; because the reliability and accuracy of the AI test arrangement intelligent agent for the medium risk repair are low, a manual review process needs to be triggered, at this time, the code review system can determine that the code application mode of the code optimization suggestion is non-automated application, and use the AI test arrangement intelligent agent to generate and display the code modification comparison result before and after the modification of the GPU operator code according to the code optimization suggestion, for reference by the developer or tester; after the developer or tester completes the manual review of the code optimization suggestion according to the code modification comparison result, if the code optimization suggestion passes the review, the code review system can respond to the review passing instruction, use the AI test arrangement intelligent agent to modify the GPU operator code according to the code optimization suggestion, and obtain the modified code.
[0101] The second preset threshold is greater than the first preset threshold.
[0102] For example, the memory safety repair can be considered as a medium risk repair.
[0103] If the repair risk degree of the code optimization suggestion is greater than or equal to the second preset threshold, it can be considered that the repair risk degree of the code optimization suggestion is a third risk level (i.e., a high risk level), the problem of the GPU operator code is very serious, and the current repair using the code optimization suggestion is a high risk repair; because the reliability and accuracy of the AI test arrangement intelligent agent for the high risk repair are lower than those for the medium risk repair, a manual review process also needs to be triggered, at this time, the code review system can determine that the code application mode of the code optimization suggestion is non-automated application, and use the AI test arrangement intelligent agent to generate and display the code modification comparison result before and after the modification of the GPU operator code according to the code optimization suggestion, for reference by the developer or tester; after the developer or tester completes the manual review of the code optimization suggestion according to the code modification comparison result, if the code optimization suggestion passes the review, the code review system can respond to the review passing instruction, use the AI test arrangement intelligent agent to modify the GPU operator code according to the code optimization suggestion, and obtain the modified code.
[0104] For example, the algorithm reconstruction can be considered as a high risk repair.
[0105] Further, it is judged whether the modified code meets the application requirement.
[0106] If the modified code does not meet the application requirements, the modified code is taken as the GPU operator code, and the pre-training-based AI test arrangement agent is returned to, and the test tool is called to test the GPU operator code, and a code diagnosis report is generated. That is, the test process is re-run for code verification, and a new round of automatic "test-diagnosis-repair-verification" cycle is started until all indicators of the modified code meet the application requirements, and the target operator code is obtained.
[0107] In some embodiments, the code application manner includes automatic application. Based on the repair risk degree of the code optimization suggestion, the code application manner of the code optimization suggestion is determined, and the GPU operator code is modified based on the code application manner to obtain the modified code, including: if the repair risk degree of the code optimization suggestion is less than a preset threshold, the code application manner of the code optimization suggestion is determined as automatic application; and the GPU operator code is automatically modified based on the code optimization suggestion to obtain the modified code.
[0108] In this embodiment, the code application manner includes automatic application, which means that the code review system can automatically modify the GPU operator code based on the code optimization suggestion without going through the manual review process to obtain the modified code.
[0109] Specifically, the repair risk degree of the code optimization suggestion can be divided into three levels, namely, a first risk level (i.e., a low risk level), a second risk level (i.e., a medium risk level), and a third risk level (i.e., a high risk level).
[0110] If the repair risk degree of the code optimization suggestion is less than a first preset threshold, the repair risk degree of the code optimization suggestion can be considered as the first risk level (i.e., the low risk level), and the problem of the GPU operator code is not serious. The current repair using the code optimization suggestion is a low-risk repair. Since the AI test arrangement agent has high reliability and accuracy for low-risk repair, the manual review process does not need to be triggered. At this time, the code review system can determine the code application manner of the code optimization suggestion as automatic application, and automatically modify the GPU operator code based on the code optimization suggestion using the AI test arrangement agent to obtain the modified code.
[0111] For example, the formatting processing of the code and the renaming of simple variables can be considered as low-risk repair.
[0112] In some embodiments, the code application manner includes non-automated application; the code application manner of the code optimization suggestion is determined based on the repair risk degree of the code optimization suggestion, and the GPU operator code is modified based on the code application manner to obtain modified code, including: if the repair risk degree of the code optimization suggestion is greater than or equal to a preset threshold, the code application manner of the code optimization suggestion is determined as non-automated application; a code modification comparison result is generated based on the code optimization suggestion; and in response to an audit pass instruction, the GPU operator code is modified based on the code optimization suggestion to obtain modified code.
[0113] In this embodiment, the code application manner includes non-automated application, and the code review system provides a manual review option. Non-automated application means that the code review system needs to trigger a manual review process. After the generated code optimization suggestion or program patch is manually reviewed, the GPU operator code can be modified based on the code optimization suggestion to obtain modified code according to the instructions of the developer or tester.
[0114] Specifically, the repair risk degree of the code optimization suggestion can be divided into three levels, namely a first risk level (i.e., a low risk level), a second risk level (i.e., a medium risk level), and a third risk level (i.e., a high risk level).
[0115] If the repair risk degree of the code optimization suggestion is greater than or equal to the first preset threshold and less than the second preset threshold, the repair risk degree of the code optimization suggestion can be considered as the second risk level (i.e., the medium risk level), the problem of the GPU operator code is relatively serious, and the current repair using the code optimization suggestion is a medium risk repair. Since the reliability and accuracy of the AI test arrangement agent for medium risk repair are low, a manual review process needs to be triggered. At this time, the code review system can determine the code application manner of the code optimization suggestion as non-automated application, and use the AI test arrangement agent to generate and display a code modification comparison result before and after the modification of the GPU operator code based on the code optimization suggestion for reference by the developer or tester. After the developer or tester completes the manual review of the code optimization suggestion based on the code modification comparison result, if the code optimization suggestion passes the review, the code review system can respond to the audit pass instruction to modify the GPU operator code based on the code optimization suggestion using the AI test arrangement agent to obtain modified code.
[0116] The second preset threshold is greater than the first preset threshold.
[0117] For example, memory safety repair can be considered as a medium risk repair.
[0118] If the repair risk degree of the code optimization suggestion is greater than or equal to the second preset threshold, it can be considered that the repair risk degree of the code optimization suggestion is a third risk level (i.e., a high risk level), the problem of the GPU operator code is very serious, and the current repair using the code optimization suggestion is a high-risk repair; since the reliability and accuracy of the AI test arrangement intelligent agent for the high-risk repair are lower than those for the medium-risk repair, the manual review process also needs to be triggered, at this time, the code review system can determine that the code application mode of the code optimization suggestion is a non-automated application, and generate and display the code modification comparison result of the GPU operator code before and after modification according to the code optimization suggestion by using the AI test arrangement intelligent agent, for reference of the developer or tester; after the developer or tester completes the manual review of the code optimization suggestion according to the code modification comparison result, if the code optimization suggestion passes the review, the code review system can respond to the review passing instruction, modify the GPU operator code according to the code optimization suggestion by using the AI test arrangement intelligent agent, and obtain the modified code.
[0119] For example, algorithm reconstruction can be considered as a high-risk repair.
[0120] Compared with the prior art, the continuous integration method provided in the embodiment has at least the following advantages: (1) by encapsulating multiple test tools together through the AI test arrangement intelligent agent and the standardized MCP protocol, multiple test tools can be called simultaneously to test the GPU operator code, and the original analysis reports corresponding to the multiple test tools can be standardized and fused to generate a comprehensive report, which can effectively avoid the problem of missed detection and difficulty in integrating the original analysis reports, realize an automatic "test-diagnosis-repair-verification" closed loop, and improve the automation level of the continuous integration platform; (2) by the AI test arrangement intelligent agent, the correlation analysis of multi-dimensional data (i.e., the original analysis reports of multiple test tools) is beneficial to discovering deep and cross-domain problems that cannot be detected by a single test tool, and thus beneficial to improving the accuracy and efficiency of code diagnosis; (3) by using the performance optimization experience of senior experts integrated in the AI test arrangement intelligent agent, ordinary developers can also obtain high-quality code optimization suggestions, which reduces the threshold of code development and is beneficial to realizing performance optimization of the code; (4) by the AI test arrangement intelligent agent, all-round and continuous automatic monitoring and optimization are performed from aspects of source code, memory safety, concurrent safety, and running performance, which is beneficial to improving the code quality and reliability; (5) by using a unified standardized MCP protocol and original analysis report output format, subsequent developers can easily integrate new test tools, and the scalability and maintainability of the continuous integration platform are improved.
[0121] The application further provides a continuous integration device. Figure 4 , Figure 4is a structural schematic diagram of a continuous integration device provided by the present application. In the embodiment, the continuous integration device comprises an acquisition module 410, a test diagnosis module 420, an optimization suggestion generation module 430 and a correction module 440.
[0122] The acquisition module 410 is configured to acquire GPU operator code.
[0123] The test diagnosis module 420 is configured to call a test tool to test the GPU operator code based on a pre-trained AI test scheduling agent, and generate a code diagnosis report.
[0124] The optimization suggestion generation module 430 is configured to generate a code optimization suggestion based on the AI test scheduling agent and the code diagnosis report and GPU hardware information.
[0125] The correction module 440 is configured to correct the GPU operator code based on the code optimization suggestion to obtain target operator code.
[0126] In some embodiments, the number of test tools is at least two; the test tool is called to test the GPU operator code based on the pre-trained AI test scheduling agent to generate the code diagnosis report, which includes: each test tool is called to test the GPU operator code based on the AI test scheduling agent to generate an original analysis report corresponding to each test tool; each original analysis report is standardized and fused to generate a comprehensive report; the comprehensive report is analyzed for root cause association based on the AI test scheduling agent to generate the code diagnosis report.
[0127] In some embodiments, the test tool includes at least two of a code quality test tool, a memory safety test tool, a GPU computing correctness test tool, a concurrency safety test tool, a code coverage test tool and a performance analysis test tool.
[0128] In some embodiments, the GPU operator code is corrected based on the code optimization suggestion to obtain the target operator code, which includes: based on the repair risk degree of the code optimization suggestion, determining a code application mode of the code optimization suggestion, and based on the code application mode, correcting the GPU operator code to obtain a corrected code; determining whether the corrected code meets the application requirements; if the corrected code does not meet the application requirements, the corrected code is used as the GPU operator code, and the step of calling the test tool to test the GPU operator code based on the pre-trained AI test scheduling agent to generate the code diagnosis report is returned until the corrected code meets the application requirements to obtain the target operator code.
[0129] In some embodiments, the code application manner includes automatic application; based on the repair risk degree of the code optimization suggestion, determining the code application manner of the code optimization suggestion, and based on the code application manner, modifying the GPU operator code to obtain the modified code, including: if the repair risk degree of the code optimization suggestion is less than a preset threshold, determining the code application manner of the code optimization suggestion as automatic application; based on the code optimization suggestion, automatically modifying the GPU operator code to obtain the modified code.
[0130] In some embodiments, the code application manner includes non-automatic application; based on the repair risk degree of the code optimization suggestion, determining the code application manner of the code optimization suggestion, and based on the code application manner, modifying the GPU operator code to obtain the modified code, including: if the repair risk degree of the code optimization suggestion is greater than or equal to a preset threshold, determining the code application manner of the code optimization suggestion as non-automatic application; based on the code optimization suggestion, generating a code modification comparison result; in response to an audit pass instruction, modifying the GPU operator code based on the code optimization suggestion to obtain the modified code.
[0131] The application further provides an electronic device. Figure 5 is a structural schematic diagram of the electronic device provided by the application, as Figure 5 shown, the electronic device can include: a processor 510, a communication interface 520, a memory 530 and a communication bus 540, wherein the processor 510, the communication interface 520, the memory 530 complete mutual communication through the communication bus 540. The processor 510 can call the logical instructions in the memory 530 to execute the continuous integration method, and the continuous integration method includes: obtaining the GPU operator code; based on the pre-trained AI test arrangement agent, calling the test tool to test the GPU operator code to generate the code diagnosis report; based on the AI test arrangement agent, generating the code optimization suggestion according to the code diagnosis report and the GPU hardware information; based on the code optimization suggestion, modifying the GPU operator code to obtain the target operator code.
[0132] In addition, the logic instructions in the memory 530 described above can be implemented in the form of a software function unit and sold or used as an independent product, and can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application essentially or the parts that contribute to the prior art or parts of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.
[0133] The present application also provides a non-transitory computer readable storage medium having a computer program stored thereon, the computer program being executed by a processor to implement the continuous integration method provided by the above method, the continuous integration method comprising: obtaining GPU operator code; calling a test tool to test the GPU operator code based on a pre-trained AI test arrangement agent to generate a code diagnosis report; generating a code optimization suggestion based on the AI test arrangement agent and the GPU hardware information according to the code diagnosis report; and correcting the GPU operator code based on the code optimization suggestion to obtain target operator code.
[0134] The present application also provides a computer program product, the computer program product comprising a computer program, the computer program being storable on a non-transitory computer readable storage medium, and the computer being capable of executing the continuous integration method provided by the above method when the computer program is executed by a processor, the continuous integration method comprising: obtaining GPU operator code; calling a test tool to test the GPU operator code based on a pre-trained AI test arrangement agent to generate a code diagnosis report; generating a code optimization suggestion based on the AI test arrangement agent and the GPU hardware information according to the code diagnosis report; and correcting the GPU operator code based on the code optimization suggestion to obtain target operator code.
[0135] The device embodiments described above are only schematic, wherein the units illustrated as separate components can or can not be physically separate, and the components illustrated as units can or can not be physical units, i.e., can be located in one place, or can be distributed on a plurality of network units. Part or all of the modules can be selected according to actual needs to achieve the purpose of the present embodiment scheme. Those skilled in the art can understand and implement without creative labor.
[0136] Those skilled in the art can clearly understand the technical solutions of the various embodiments from the above description of the embodiments, and the various embodiments can be implemented by means of software with the necessary general hardware platforms, and of course, can also be implemented by hardware. Based on such understanding, the above technical solutions, essentially or in other words, the part of the prior art that makes a contribution, can be embodied in the form of a software product, which can be stored in a computer readable storage medium, such as a ROM / RAM, a magnetic disk, an optical disk, and the like, and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0137] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for some technical features therein; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A continuous integration method, characterized in that, include: Obtain GPU operator code; Based on a pre-trained AI test orchestration agent, the testing tool is invoked to test the GPU operator code and generate a code diagnostic report; Based on the AI test orchestration agent, code optimization suggestions are generated according to the code diagnostic report and GPU hardware information; Based on the code optimization suggestions, the GPU operator code is modified to obtain the target operator code; The number of the testing tools shall be at least two; The pre-trained AI test orchestration agent invokes testing tools to test the GPU operator code and generates a code diagnostic report, including: Based on the AI test orchestration agent, each of the aforementioned test tools is invoked to test the GPU operator code, and an original analysis report corresponding to each of the aforementioned test tools is generated; Each of the original analysis reports is standardized and merged to generate a comprehensive report; Based on the AI test orchestration agent, root cause correlation analysis is performed on the comprehensive report to generate the code diagnostic report.
2. The continuous integration method according to claim 1, characterized in that, The testing tools include at least two of the following: code quality testing tools, memory safety testing tools, GPU computation correctness testing tools, concurrency safety testing tools, code coverage testing tools, and performance analysis testing tools.
3. The continuous integration method according to claim 1, characterized in that, The step of modifying the GPU operator code based on the code optimization suggestions to obtain the target operator code includes: Based on the degree of repair risk of the code optimization suggestions, the code application method of the code optimization suggestions is determined, and based on the code application method, the GPU operator code is modified to obtain the modified code; Determine whether the corrected code meets the application requirements; If the corrected code does not meet the application requirements, the corrected code is used as the GPU operator code and returned to the pre-trained AI test orchestration agent to call the test tool to test the GPU operator code and generate a code diagnostic report, until the corrected code meets the application requirements and the target operator code is obtained.
4. The continuous integration method according to claim 3, characterized in that, The code application methods include automated applications; The process involves determining the code application method of the code optimization suggestions based on the risk level of the proposed fixes, and then modifying the GPU operator code based on the proposed code application method to obtain corrected code. This includes: If the risk level of the code optimization suggestion is less than a preset threshold, then the code application method of the code optimization suggestion is determined to be automated application; Based on the code optimization suggestions, the GPU operator code is automatically corrected to obtain the corrected code.
5. The continuous integration method according to claim 3, characterized in that, The code application methods include non-automated applications; The process involves determining the code application method of the code optimization suggestions based on the risk level of the proposed fixes, and then modifying the GPU operator code based on the proposed code application method to obtain corrected code. This includes: If the risk level of the code optimization suggestion is greater than or equal to a preset threshold, then the code application method of the code optimization suggestion is determined to be non-automatic application; Based on the code optimization suggestions, a code correction comparison result is generated; In response to the approval instruction, the GPU operator code is modified based on the code optimization suggestions to obtain the modified code.
6. A continuous integration device, characterized in that, include: The acquisition module is used to acquire GPU operator code; The test and diagnosis module is used to call test tools to test the GPU operator code based on the pre-trained AI test orchestration agent and generate a code diagnosis report. An optimization suggestion generation module is used to generate code optimization suggestions based on the AI test orchestration agent, according to the code diagnostic report and GPU hardware information. The correction module is used to correct the GPU operator code based on the code optimization suggestions to obtain the target operator code; The number of the testing tools shall be at least two; The pre-trained AI test orchestration agent invokes testing tools to test the GPU operator code and generates a code diagnostic report, including: Based on the AI test orchestration agent, each of the aforementioned test tools is invoked to test the GPU operator code, and an original analysis report corresponding to each of the aforementioned test tools is generated; Each of the original analysis reports is standardized and merged to generate a comprehensive report; Based on the AI test orchestration agent, root cause correlation analysis is performed on the comprehensive report to generate the code diagnostic report.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the continuous integration method as described in any one of claims 1 to 5.
8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the continuous integration method as described in any one of claims 1 to 5.
9. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the continuous integration method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
CPU program automatic correction method based on AI code generation and AI program correction
CN117215587A
Systems and methods for code development with generative artificial intelligence
US20240427564A1