Continuous integration method and device, equipment, storage medium and program product
By introducing an AI test orchestration agent into the continuous integration platform, the testing, diagnosis, and correction of GPU operator code are automated, solving the inefficiency problem caused by manual intervention in existing technologies and realizing an efficient and automated continuous integration process.
Patent Information
- Application Number
- CN202511894818.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-16
- Publication Date
- 2026-01-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 human interference, leading to poor continuous integration performance.
By introducing a pre-trained AI test orchestration agent, various testing tools are invoked to test GPU operator code, generate code diagnostic reports, and generate code optimization suggestions based on the reports and GPU hardware information, thus achieving automated testing, diagnostic analysis, and correction, forming an automated closed loop.
It shortens the GPU operator code repair and optimization cycle, improves the efficiency and effectiveness of continuous integration, reduces reliance on human factors, and ensures that code optimization adapts to GPU hardware characteristics.
Smart Images

Figure CN121364882A_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] In order to make the objects, technical solutions and advantages of the present application clearer, the technical solutions of the present application will be described clearly and completely below in conjunction with the drawings in the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative labor fall within the protection scope of the present application.
[0024] Please refer to Figures 1 to 3 , Figure 1 is one of the flowcharts of the continuous integration method provided by the present application, Figure 2 is another flowchart of the continuous integration method provided by the present application, Figure 3 is a third flowchart of the continuous integration method provided by the present application.
[0025] As Figure 1 shown, in the present embodiment, the continuous integration method is applied to a continuous integration platform, and the continuous integration method comprises steps S110 to S140, and each step is specifically as follows: S110: Obtain GPU operator code.
[0026] The application scenario of the present embodiment is to optimize and continuously integrate the GPU operator code written by the developer in the process of developing a high-performance GPGPU operator library.
[0027] GPU operator refers to an entity that performs a specific operation or function on a GPU (Graphics Processing Unit), which can be regarded as a basic component that performs mathematical operations, data conversion or logical judgment, etc.
[0028] Taking a neural network model as an example, in the deployment and application process of most neural network models, users often need to run various complex custom operators such as nonlinear activation functions on GPUs for operation, and the application process of the neural network model usually also needs to call part of the predefined operators, such as common convolution operators and matrix multiplication operators, etc.
[0029] For example, in a text recognition task, a neural network model can call a convolution operator to extract text features from input text, and call a matrix multiplication operator to generate a query matrix, a key matrix, and a value matrix of the text features, so as to calculate attention scores of the text features according to the query matrix, the key matrix, and the value matrix; in the field of image and video recognition, a neural network model can call various custom operators to extract multi-scale features from input images or video frames, and call a pooling operator to perform pooling processing on the extracted multi-scale features; in the field of voice interaction, a neural network model can call a convolution operator, a pooling operator, a normalization operator, an activation function operator, and the like to realize feature extraction, feature fusion, and voice interaction result generation of user voice. Therefore, GPU operators are widely used.
[0030] These GPU operators are usually stored in the form of codes in an operator library, and these codes are GPU operator codes. After the development of the operator library is completed, if the GPU operator codes are needed, the corresponding codes can be directly called from the operator library for compilation and running.
[0031] Specifically, as shown in Figure 2 and Figure 3 During the development of the high-performance GPGPU operator library, a developer can upload the written GPU operator codes to a continuous integration platform, and the continuous integration platform can receive the GPU operator codes uploaded by the developer for subsequent code changes or code testing.
[0032] S120: Based on the pre-trained AI test arrangement agent, a test tool is called to test the GPU operator codes, and a code diagnosis report is generated.
[0033] The traditional continuous integration method seriously depends on the experience of senior developers to interpret and analyze the report and formulate a code optimization strategy. Such artificial implicit knowledge is difficult to solidify, which leads to difficult knowledge inheritance and low decision-making efficiency.
[0034] Based on this, the embodiment introduces an artificial intelligence (Artificial Intelligence, AI) technology in the continuous integration process of the GPU operator codes, solidifies and inherits the code tuning experience and code diagnosis knowledge of senior experts through an AI model, so as to reduce the technical threshold of interpreting and analyzing the report and formulating the code optimization strategy, and realize automatic code diagnosis and analysis.
[0035] Optionally, a knowledge base and a training data set are constructed based on the code tuning experience and the code diagnosis knowledge of senior experts, and an initial large language model (Large Language Model, LLM) is trained based on the knowledge base and the training data set, to obtain an AI test arrangement agent.
[0036] Wherein, since the large language model itself has strong natural language understanding ability and knowledge generation ability, after training with professional knowledge such as knowledge base and training data set, the AI test arrangement agent can have stronger reasoning ability, programming ability and professional knowledge accumulation, it can understand the original analysis report output by multiple test tools, and can realize the intelligent management of code test process according to the correlation analysis and code optimization of different test tools.
[0037] Further, after obtaining the GPU operator code, the continuous integration platform can call different test tools to test the GPU operator code respectively through the pre-trained AI test arrangement agent, and generate code diagnosis report.
[0038] Optionally, the test tools include code quality test tools, memory safety test tools, GPU computing correctness test tools, concurrent safety test tools, code coverage test tools and performance analysis test tools.
[0039] Optionally, the code quality test tools include but are not limited to Clang-Tidy.
[0040] Wherein, Clang-Tidy is a C++ static code analysis tool provided by LLVM project, mainly used for detecting code specification violations, potential vulnerabilities, performance problems and code style problems, supporting automatic repair suggestions, and can be integrated into mainstream development environments such as Visual Studio.
[0041] Optionally, the memory safety test tools include but are not limited to Valgrind, Leak Sanitizer (LSan) and Address Sanitizer (ASan).
[0042] Wherein, Valgrind, Leak Sanitizer and Address Sanitizer are mainly used for detecting memory safety problems or memory errors such as code memory leaks and out-of-bound access, but they have differences in working principle, performance and applicable scenarios.
[0043] Valgrind is an open source memory debugging and performance analysis tool, mainly used for Linux systems and Unix-like systems, and its core component Memcheck can detect memory leaks, illegal memory access, uninitialized value usage and other problems in code.
[0044] Address Sanitizer is a memory error detector integrated in GCC compiler and Clang compiler, mainly used for detecting address related errors such as buffer overflow, use-after-free and memory leak in code.
[0045] Leak Sanitizer is mainly used to detect code memory leak problems, which can intercept memory allocation functions and scan unreleased heap memory blocks at the end of the program to generate detailed reports.
[0046] 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.
[0047] Optionally, the concurrent safety test tool includes but is not limited to Thread Sanitizer (TSan).
[0048] Among them, Thread Sanitizer is mainly used to detect data race problems in multi-threaded programs.
[0049] Optionally, the code coverage test tool includes but is not limited to gcov and lcov.
[0050] 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.
[0051] Optionally, the performance analysis test tool includes but is not limited to gprof.
[0052] 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.
[0053] S130: Based on the AI test arrangement agent, generate code optimization suggestions according to the code diagnosis report and GPU hardware information.
[0054] 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.
[0055] 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.
[0056] 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.
[0057] S140: modifying the GPU operator code based on the code optimization suggestion to obtain the target operator code.
[0058] 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.
[0059] 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.
[0060] The continuous integration method provided in 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, and the GPU operator code is corrected according to the code optimization suggestion to obtain target operator code. The continuous integration method realizes automatic testing, automatic diagnosis analysis, automatic correction and automatic continuous integration of the GPU operator code, does not require manual interpretation and analysis of the report and formulation of a code optimization strategy, shortens the period of GPU operator code repair and optimization, is not easily interfered by human subjective factors, is beneficial to improving the efficiency of GPU operator code continuous integration and optimizing the continuous integration effect. 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 the 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 corrected 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.
[0061] 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; and based on the AI test arrangement agent, the comprehensive report is subjected to root cause association analysis to generate the code diagnosis report.
[0062] Optionally, the test tools include at least two of a code quality test tool, a memory safety test tool, a GPU calculation correctness test tool, a concurrent safety test tool, a code coverage test tool and a performance analysis test tool.
[0063] 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.
[0064] 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.
[0065] 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.
[0066] Further, each original analysis report is standardized and fused to generate a comprehensive report.
[0067] In a traditional continuous integration method, different test tools are independently run, and thus different test tools generate original analysis reports in different formats. 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 likely 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 can be caused by the same logical error in the GPU operator code, but these relevance can be missed or ignored in manual analysis.
[0068] Based on this, the present embodiment introduces an AI test orchestration agent for automatic analysis and report generation.
[0069] 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.
[0070] For example, the output formats of the original analysis reports of different test tools can be uniformly defined as JSON format or XML format. 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 outputs from different test tools.
[0071] Since 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, and generate a comprehensive report.
[0072] 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.
[0073] 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.
[0074] 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.
[0075] 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.
[0076] Optionally, the code quality test tool includes but is not limited to Clang-Tidy.
[0077] 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.
[0078] Optionally, the memory safety test tool includes but is not limited to Valgrind, Leak Sanitizer (LSan), and Address Sanitizer (ASan).
[0079] 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.
[0080] 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.
[0081] Optionally, the concurrency safety test tool includes but is not limited to Thread Sanitizer (TSan).
[0082] 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.
[0083] Optionally, the code coverage test tool includes, but is not limited to, gcov and lcov.
[0084] 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.
[0085] Optionally, the performance analysis test tool includes, but is not limited to, gprof.
[0086] 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.
[0087] 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.
[0088] 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.
[0089] 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.
[0090] 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.
[0091] 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.
[0092] 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.
[0093] In this embodiment, the code application mode includes automatic application and non-automatic application.
[0094] 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.
[0095] 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.
[0096] 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).
[0097] 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.
[0098] For example, the formatting processing of the code and the renaming of simple variables can be considered as low-risk repair.
[0099] 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.
[0100] The second preset threshold is greater than the first preset threshold.
[0101] For example, the memory safety repair can be considered as a medium risk repair.
[0102] 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.
[0103] For example, the algorithm reconstruction can be considered as a high risk repair.
[0104] Further, it is judged whether the modified code meets the application requirements.
[0105] 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.
[0106] 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.
[0107] 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.
[0108] 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).
[0109] 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), the problem of the GPU operator code is not serious, and the current repair using the code optimization suggestion is 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.
[0110] For example, the formatting processing of the code and the renaming of simple variables can be considered as low-risk repair.
[0111] 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.
[0112] 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.
[0113] 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).
[0114] 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.
[0115] The second preset threshold is greater than the first preset threshold.
[0116] For example, memory safety repair can be considered as a medium risk repair.
[0117] 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.
[0118] For example, algorithm reconstruction can be considered as a high-risk repair.
[0119] Compared with the prior art, the continuous integration method provided by 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 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.
[0120] The application further provides a continuous integration device. Please refer to 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.
[0121] The acquisition module 410 is configured to acquire GPU operator code.
[0122] 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.
[0123] 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.
[0124] The correction module 440 is configured to correct the GPU operator code based on the code optimization suggestion to obtain target operator code.
[0125] 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 comprises: 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.
[0126] In some embodiments, the test tool comprises 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.
[0127] In some embodiments, the GPU operator code is corrected based on the code optimization suggestion to obtain the target operator code, which comprises: 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 taken 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.
[0128] 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.
[0129] 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.
[0130] 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.
[0131] 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, and the computer software product is stored in a storage medium, including a plurality of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the method described in various embodiments of the present application. The foregoing 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.
[0132] The application further 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, and the continuous integration method comprises: 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 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.
[0133] The application further provides a computer program product, the computer program product comprising a computer program, the computer program being stored 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, and the continuous integration method comprises: 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 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 device embodiments described above are only schematic, wherein the units described as separate components can or can not be physically separate, and the components displayed as units can or can not be physical units, that is, they can be located in one place, or distributed on multiple network units. Part or all of the modules can be selected to achieve the purpose of the embodiment scheme according to actual needs. Those skilled in the art can understand and implement without creative labor.
[0135] 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.
[0136] 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 by, The method comprises the following steps: acquiring GPU operator code; based on a pre-trained AI test arrangement agent, calling a test tool to test the GPU operator code and generating a code diagnosis report; based on the AI test arrangement agent, generating a code optimization suggestion according to the code diagnosis report and GPU hardware information; based on the code optimization suggestion, modifying the GPU operator code to obtain target operator code.
2. The continuous integration method of claim 1, wherein, The number of test tools is at least two. The step of based on a pre-trained AI test arrangement agent, calling a test tool to test the GPU operator code and generating a code diagnosis report comprises the following steps: based on the AI test arrangement agent, calling each test tool to test the GPU operator code and generating an original analysis report corresponding to each test tool; standardizing and fusing each original analysis report to generate a comprehensive report; based on the AI test arrangement agent, performing root cause association analysis on the comprehensive report to generate the code diagnosis report.
3. The continuous integration method of claim 2, wherein, The test tools include at least two of a code quality test tool, a memory safety test tool, a GPU calculation correctness test tool, a concurrency safety test tool, a code coverage test tool, and a performance analysis test tool.
4. The continuous integration method of claim 1, wherein, The step of based on the code optimization suggestion, modifying the GPU operator code to obtain target operator code comprises the following steps: 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 modified code; determining whether the modified code meets the application requirements; if the modified code does not meet the application requirements, regarding the modified code as the GPU operator code, and returning to the step of based on a pre-trained AI test arrangement agent, calling a test tool to test the GPU operator code and generating a code diagnosis report until the modified code meets the application requirements and the target operator code is obtained.
5. The continuous integration method of claim 4, wherein, The code application mode includes automatic application. The step of 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 modified code comprises the following steps: if the repair risk degree of the code optimization suggestion is less than a preset threshold, determining that the code application mode of the code optimization suggestion is automatic application; based on the code optimization suggestion, automatically modifying the GPU operator code to obtain the modified code.
6. The continuous integration method of claim 4, wherein, The code application mode includes non-automatic application. The step of 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 modified code comprises the following steps: if the repair risk degree of the code optimization suggestion is greater than or equal to a preset threshold, determining that the code application mode of the code optimization suggestion is non-automatic application; based on the code optimization suggestion, generating a code modification comparison result; In response to the review pass instruction, the GPU operator code is revised based on the code optimization suggestion, and the revised code is obtained.
7. A continuous integration apparatus, characterized by, The method comprises the following steps: An acquisition module is configured to acquire GPU operator code. A test diagnosis module is configured to call a test tool to test the GPU operator code based on a pre-trained AI test arrangement agent, and generate a code diagnosis report. An optimization suggestion generation module is configured to generate a code optimization suggestion based on the AI test arrangement agent and according to the code diagnosis report and GPU hardware information. A revision module is configured to revise the GPU operator code based on the code optimization suggestion, and obtain target operator code.
8. An electronic device comprising a memory, a processor, and a computer program stored on the memory and running on the processor, characterized in that, The processor executes the computer program to implement the continuous integration method of any one of claims 1 to 6. 9.A non-transitory computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the continuous integration method of any one of claims 1 to 6.
10. A computer program product comprising a computer program, characterized in that, The computer program is executed by the processor to implement the continuous integration method of any one of claims 1 to 6.
Citation Information
Patent Citations
CPU program automatic correction method based on AI code generation and AI program correction
CN117215587A
Simulation test automatic scheduling method and device, automatic simulation test system, storage medium and computer program product
CN117826630A
Software development improvement stage optimization
US20230385042A1
Systems and methods for code development with generative artificial intelligence
US20240427564A1
Test code repairing method and related device
WO2025246269A1
