A processing method, apparatus and device of program code

By constructing an operational topology graph and using the RAG model to generate analysis logs, the problem of algorithm-side technical personnel being unable to understand user program code was solved, the success rate and maintainability of analysis logs were improved, performance overhead was reduced, and the accurate identification of critical paths and important events was ensured.

CN120029634BActive Publication Date: 2026-03-31ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-02-26
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

Given the limited resources, algorithm engineers often struggle to understand user program code, leading to high communication costs. Existing technologies suffer from inaccurate and incomplete log identification when adding analysis logs, poor maintainability, high performance overhead, and a tendency for logs to explode in loop code.

Method used

By constructing an operational topology graph, abstracting functional blocks, and combining them with a code database, analysis logs are generated using RAG models and large models, improving the accuracy and efficiency of identification.

Benefits of technology

It improves the success rate and maintainability of log analysis, reduces performance overhead, ensures accurate identification of critical paths and important events, and avoids log clutter and explosion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120029634B_ABST
    Figure CN120029634B_ABST
Patent Text Reader

Abstract

The embodiment of the specification discloses a processing method, device and equipment of program code, the method comprises: obtaining target program code to be processed; determining the operation topology relationship graph corresponding to the target program code is constructed based on the model operation contained in the target program code, and the function block and the description information of each function block contained in the target program code are determined based on the operation contained in the target program code and the operation topology relationship graph; based on the function block contained in the target program code and the description information of each function block, and the target program code with code line mark is set, the first prompt information is constructed, and the first program code with the similarity between the target program code greater than the preset threshold is obtained from the code database based on the target program code; the second prompt information is generated based on the first prompt information, the first program code and the target program code, and the second prompt information is input into the large model, and the analysis log of the target program code is obtained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This document relates to the field of computer technology, and in particular to a method, apparatus and device for processing program code. Background Technology

[0002] In platform-based deployment, algorithm engineers deploy inference program code on the platform. However, in the context of resource scarcity, there is often a common situation where resources are insufficient. In addition to simply adding resources, a more common approach is to analyze the performance of the deployed program code and look for areas for optimization.

[0003] In model deployment platforms, each model is deployed by algorithm-side technical personnel. To protect users' privacy data, such as program code, these personnel must not intrude on the user's code. However, when optimizing the resources of the algorithm-side technical personnel, there are situations where optimization is impossible without understanding the algorithm, resulting in significant communication costs. Performance analysis of program code aims to identify performance bottlenecks, requiring customized optimizations. This process relies on adding analysis logs to the program code, which represents the biggest communication cost between algorithm-side and model deployment platform technical personnel. Therefore, a better technical solution for setting analysis logs in program code is needed, which can improve the success rate and maintainability of adding analysis logs, while reducing the performance overhead and cost of analysis logs. Summary of the Invention

[0004] The purpose of the embodiments in this specification is to provide a better technical solution for setting analysis logs for program code, thereby improving the success rate and maintainability of adding analysis logs, and reducing the performance overhead and cost of analysis logs.

[0005] To achieve the above technical solution, the embodiments in this specification are implemented as follows:

[0006] This specification provides an embodiment of a method for processing program code. The method includes: acquiring target program code to be processed, the target program code including program code of a target model, the target model including one or more different model operations; determining and constructing an operation topology diagram corresponding to the target program code based on the model operations contained in the target program code, and determining functional blocks contained in the target program code and description information of each functional block based on the operations contained in the target program code and the operation topology diagram corresponding to the target program code; constructing first prompt information based on the functional blocks contained in the target program code and the description information of each functional block, and the target program code with code line identifiers; and acquiring first program code from a code database with a similarity greater than a preset threshold to the target program code based on the target program code; generating second prompt information based on the first prompt information, the first program code, and the target program code, and inputting the second prompt information into a large model to obtain an analysis log of the target program code.

[0007] This specification provides an embodiment of a program code processing apparatus, comprising: a code acquisition module for acquiring target program code to be processed, the target program code including program code of a target model, the target model including one or more different model operations; a code processing module for determining and constructing an operation topology diagram corresponding to the target program code based on the model operations contained in the target program code, and determining functional blocks contained in the target program code and description information of each functional block based on the operations contained in the target program code and the operation topology diagram corresponding to the target program code; a retrieval enhancement module for constructing first prompt information based on the functional blocks contained in the target program code and the description information of each functional block, and the target program code with code line identifiers, and obtaining first program code with a similarity greater than a preset threshold from a code database based on the target program code; and a log generation module for generating second prompt information based on the first prompt information, the first program code, and the target program code, and inputting the second prompt information into a large model to obtain an analysis log of the target program code.

[0008] This specification provides an embodiment of a program code processing device, comprising: a processor; and a memory arranged to store computer-executable instructions, wherein when the executable instructions are executed, the processor: acquires target program code to be processed, the target program code including program code of a target model, the target model including one or more different model operations; based on the model operations contained in the target program code, determines and constructs an operation topology diagram corresponding to the target program code, and based on the operations contained in the target program code and the operation topology diagram corresponding to the target program code, determines functional blocks contained in the target program code and descriptive information of each functional block; based on the functional blocks contained in the target program code and the descriptive information of each functional block, and the target program code with code line identifiers, constructs first prompt information, and based on the target program code, acquires first program code from a code database whose similarity to the target program code is greater than a preset threshold; generates second prompt information based on the first prompt information, the first program code, and the target program code, and inputs the second prompt information into a large model to obtain an analysis log of the target program code.

[0009] This specification also provides a storage medium for storing computer-executable instructions. When executed by a processor, the executable instructions implement the following process: obtaining target program code to be processed, the target program code including program code of a target model, the target model including one or more different model operations; determining an operation topology diagram corresponding to the target program code based on the model operations contained in the target program code, and determining functional blocks contained in the target program code and description information of each functional block based on the operations contained in the target program code and the operation topology diagram corresponding to the target program code; constructing a first prompt message based on the functional blocks contained in the target program code and the description information of each functional block, and the target program code with code line identifiers, and obtaining a first program code from a code database with a similarity greater than a preset threshold based on the target program code; generating a second prompt message based on the first prompt message, the first program code, and the target program code, and inputting the second prompt message into a large model to obtain the analysis log of the target program code.

[0010] This specification also provides a computer program product, including a computer program that, when executed by a processor, implements the following process: acquiring target program code to be processed, the target program code including program code for a target model, the target model including one or more different model operations; based on the model operations contained in the target program code, determining and constructing an operation topology diagram corresponding to the target program code, and based on the operations contained in the target program code and the operation topology diagram corresponding to the target program code, determining functional blocks contained in the target program code and descriptive information for each functional block; based on the functional blocks contained in the target program code and the descriptive information for each functional block, and the target program code with code line identifiers, constructing first prompt information, and based on the target program code, acquiring first program code from a code database whose similarity to the target program code is greater than a preset threshold; generating second prompt information based on the first prompt information, the first program code, and the target program code, and inputting the second prompt information into a large model to obtain an analysis log of the target program code. Attached Figure Description

[0011] To more clearly illustrate the technical solutions in the embodiments or prior art of this specification, the drawings used in the description of the embodiments or prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0012] Figure 1 This is a schematic diagram illustrating the analysis and optimization of program code in this specification;

[0013] Figure 2 This is a schematic diagram illustrating the analysis and optimization of another type of program code in this manual;

[0014] Figure 3 This is another schematic diagram illustrating the analysis and optimization of program code in this manual;

[0015] Figure 4 This is an embodiment of a method for processing program code as described in this specification;

[0016] Figure 5 This is a schematic diagram illustrating the processing procedure of one type of program code in this specification;

[0017] Figure 6 This is another embodiment of the program code processing method described in this specification;

[0018] Figure 7 This is yet another embodiment of a program code processing method described in this specification;

[0019] Figure 8 This is yet another embodiment of a program code processing method described in this specification;

[0020] Figure 9 This is a schematic diagram illustrating the processing procedure of another program code in this specification;

[0021] Figure 10 This is an embodiment of a program code processing device described in this specification;

[0022] Figure 11 This is an embodiment of a program code processing device described in this specification. Detailed Implementation

[0023] This specification provides a method, apparatus, and device for processing program code through its embodiments.

[0024] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this specification, and not all embodiments. Based on the embodiments in this specification, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of this specification.

[0025] This specification provides a mechanism for setting analysis logs based on large model program code. In platform-based deployment, algorithm-side technicians have a high degree of freedom in deploying inference program code on the platform. However, under resource constraints, insufficient resources are a common problem. Figure 1 As shown, besides simply adding resources, a more common approach is to analyze the performance of the deployed program code and identify areas for optimization. In a model deployment platform, each model is deployed by algorithm-side technical personnel who do not intrude on the user's program code. Figure 2 As shown, when optimizing the resources of technical personnel on the algorithm side, there are situations where optimization is impossible if the algorithm is not understood. Technical personnel on the model deployment platform may not understand the user's program code, resulting in significant communication costs. For example... Figure 3 As shown, the purpose of performance analysis on a program code is to find the performance bottlenecks in the code. Custom optimizations are needed to address these bottlenecks, and this process relies on adding analysis logs to the program code. This is also the biggest communication cost between the algorithm engineers and the model deployment platform engineers.

[0026] Currently, analysis logs can be added to program code based on expert experience and regular expression algorithms. While this is indeed an effective strategy, it has some obvious drawbacks and potential problems. For example, the above method can lead to inaccurate or incomplete identification, poor maintainability, high performance overhead, and loss of contextual information. Furthermore, analysis logs can be added to every line of the target program code, but this method results in log clutter and very high analysis costs. Additionally, adding analysis logs to loop statements can lead to log explosion. Therefore, a better technical solution for setting analysis logs for program code is needed. This solution involves abstracting the functional blocks of the program code from fine to coarse, while simultaneously combining each line of code with the functional blocks from coarse to fine, significantly improving the success rate of adding analysis logs. Moreover, based on the RAG framework, continuously enriching the correctly validated expert experience and historical cases, a positive cycle for the success rate of analysis logs can be achieved. Specific processing details can be found in the following embodiments.

[0027] like Figure 4 As shown in the embodiments of this specification, a method for processing program code is provided. The execution subject of this method can be a terminal device or a server, etc. The terminal device can be a mobile terminal device such as a mobile phone or tablet computer, or a computer device such as a laptop or desktop computer, or an IoT device (specifically, a smartwatch, in-vehicle device, etc.). The server can be a single server or a server cluster composed of multiple servers, etc. The server can be a backend server in fields such as finance or online shopping, or a backend server of an application, etc. This embodiment uses a server as the execution subject for detailed description. For the case where the execution subject is a terminal device, please refer to the following server case processing, which will not be repeated here. The method may specifically include the following steps:

[0028] In step S402, the target program code to be processed is obtained. The target program code includes the program code of the target model, and the target model includes one or more different model operations.

[0029] The target program code can be any type of program code, written in a specified programming language, such as C, C++, Java, Python, etc., depending on the specific requirements. In this embodiment, the target program code may include the target model's program code, as well as other program code besides the target model's program code. For example, it may include program code for collecting and acquiring specified data, program code for processing the specified data to obtain input data to be input into the target model, or program code for processing the target model's output data for subsequent application in a specified domain. The target model can be any model, such as a model for risk control, facial recognition, or natural language processing. The target model can be constructed using various algorithms or networks. For example, it can be constructed using a specified neural network (such as a convolutional neural network, recurrent neural network, etc.), a decision tree algorithm, a support vector machine algorithm, or BERT, etc., depending on the specific requirements. Model operations can include a variety of operations. For example, if the target model is built based on a convolutional neural network, the model operations can include convolution, activation functions, pooling, etc. The corresponding model operations can be different for target models built by different algorithms or networks, and can be set according to the actual situation.

[0030] In implementation, the target program code to be processed can be obtained in various ways. For example, a user may have written target program code including program code for a certain model (i.e., the target model). To set the analysis log for the target program code, a terminal device can access an analysis log settings page for the program code. This page may include a program code input box, an OK button, a Cancel button, and a result output box. The user can input the target program code in the program code input box on this page and click the OK button. At this time, the terminal device can obtain the target program code entered by the user in the program code input box and generate a code log setting request based on the obtained target program code. The user can then send the code log setting request to the server. The server can receive the code log setting request and extract the target program code to be processed from it. As another example, a technician can write target program code including program code for a certain model (i.e., the target model) and then directly input the target program code into the server. The server can obtain the target program code to be processed. The specific settings can be configured according to the actual situation, and this embodiment does not limit this.

[0031] In step S404, based on the model operations contained in the target program code, an operation topology diagram corresponding to the target program code is determined, and based on the operations contained in the target program code and the operation topology diagram corresponding to the target program code, the functional blocks contained in the target program code and the description information of each functional block are determined.

[0032] The operation topology diagram can be used to illustrate the dependencies between different model operations. For example, Model Operation 1 - Model Operation 2 - Model Operation 3 can represent that Model Operation 2 depends on Model Operation 1, and Model Operation 3 depends on Model Operation 2, etc. The specific settings can be configured according to the actual situation. The operations contained in the target program code can include model operations, as well as other operations contained in the program code outside the target model's program code.

[0033] In implementation, to reduce communication and code comprehension costs and to understand the contextual information of the code, the logic of the target model's code within the target program code can be analyzed. This allows for the identification of critical paths and important events. To this end, the target program code can be parsed, and based on the parsing results, the model operations contained within it can be determined. Furthermore, the logic of the target model's code can be analyzed to identify the dependencies between different model operations within the target model. Based on these dependencies, an operation topology graph corresponding to the target program code can be constructed.

[0034] Considering that model operations are relatively specific or detailed structures within the target model, these structures are difficult for those unfamiliar with the target model's structure to understand. To enable the larger model to comprehend the contextual information of the program code, these structures can be abstracted. Specifically, the target program code can be parsed, and based on the parsing results, the operations contained within the target program code can be identified. These operations can then be categorized to determine those that can be grouped into the same category. For example, model operations such as feature extraction and convolution operations can be abstracted to obtain abstracted functions (such as image information extraction). Similarly, operations such as normalization, data augmentation, and image transformation can be abstracted into a single function, which can be used for image data preprocessing. Based on the functions obtained above, corresponding functional blocks can be determined, and the specifics can be set according to the actual situation. Through the above classification and abstraction process, based on the operations contained in the target program code and the corresponding operation topology diagram, the functional blocks contained in the target program code can be determined, such as the image information extraction functional block and the image information preprocessing functional block mentioned above. In addition, the function and role of each functional block can be described to obtain the description information of each functional block, and thus the functional blocks contained in the target program code and the description information of each functional block can be obtained.

[0035] In step S406, based on the functional blocks contained in the target program code and the description information of each functional block, as well as the target program code with code line identifiers, a first prompt message is constructed, and based on the target program code, a first program code with a similarity greater than a preset threshold is obtained from the code database.

[0036] The prompt message can be a "Prompt," and the first prompt message can be a "Prompt" message used for large models. The preset threshold can be set according to the actual situation, such as 80% or 90%. The code database can be a database storing a large amount of program code. In practical applications, the code database can only store program code. In addition to storing program code, it can also store the corresponding embedding vectors (or representation vectors) or identifiers. This allows the corresponding program code to be indexed through the embedding vectors (or representation vectors) or identifiers; the specific settings can be configured according to the actual situation.

[0037] In implementation, such as Figure 5As shown, the RAG (Retrieval-Augmented Generation) model can be used to set up analysis logs for the target program code. The RAG model combines language models with information retrieval mechanisms. When text or question answers need to be generated, the RAG model first retrieves relevant information from a large database, and then uses the retrieved information to guide the generation of text or answers, thereby improving the quality and accuracy of predictions. The RAG model's processing can specifically include data extraction, vectorization (such as embedding), index creation, retrieval, automatic ranking (Rerank), and large model induction generation. Specifically, data extraction can include cleaning and processing the target program code (such as removing redundant content and format conversion), and information extraction (such as filenames, timestamps, and images). For vectorization, the target program code can be vectorized to obtain the corresponding embedding vectors. During vectorization, the target program code can also be divided into multiple blocks, and then each block is vectorized. Through the above vectorization process, a correspondence between embedding vectors and block code can be constructed, thereby obtaining the corresponding index information. For retrieval processing, a large database (i.e., a code database) can be pre-set. Retrieval processing can be performed from the code database based on the target program code. Retrieval methods can include various approaches, such as similarity-based retrieval, keyword-based retrieval, and SQL-based retrieval. For example, based on the target program code, a first program code with a similarity greater than a preset threshold can be retrieved from the code database using a similarity-based retrieval method (similarity can be determined using Euclidean distance, Manhattan distance, cosine distance, or kNN algorithms). Alternatively, a keyword-based retrieval method can be used to retrieve the first program code from the code database based on the target program code. Specifically, keywords can be extracted from the target program code, and the retrieved keywords can be used to retrieve the first program code that is similar or nearly identical to the target program code. The specific settings can be configured according to the actual situation.

[0038] Typically, search results obtained through retrieval processing are not ideal because the search dimensions may not be optimal. A single search may yield results that are not entirely relevant. In such cases, strategies are needed to reorder the search results to better suit the application scenario. A pre-set judge can assess relevance and trigger reordering. Automatic reranking can further refine the search results to better reflect the application context.

[0039] In addition to retrieval processing, the RAG model also includes augmentation processing. Specifically, a prompt message template can be pre-defined. Functional blocks and their descriptions, along with the target program code, can be embedded into this template. Specifically, a line identifier (such as a line number) can be set for each line of the target program code. Then, the functional blocks and their descriptions, along with the target program code with the line identifiers, can be embedded into the prompt message template to generate the first prompt message. Besides retrieval and augmentation processing, the RAG model also includes an important process: generation processing (i.e., large model inductive generation), which can be found in step S408 below.

[0040] In step S408, a second prompt message is generated based on the first prompt message, the first program code, and the target program code, and the second prompt message is input into the large model to obtain the analysis log of the target program code.

[0041] The large model can include various types, such as generative large models or discriminative large models. In this embodiment, the large model can be a generative large model, specifically a large language model, such as ChatGPT3.5, ChatGPT3, ChatGLM, etc., which can be set according to the actual situation. The second prompt can be a prompt that can be directly used in the large model.

[0042] In implementation, such as Figure 5 As shown, new prompt information can be regenerated based on the first prompt information, the first program code, and the target program code, thus obtaining the second prompt information. Since the first prompt information and the first program code contain rich information related to the target program code, the second prompt information generated based on these three elements enables the large model to more accurately identify critical paths and important events in the target program code. This allows for the identification of important log points and reduces the risk of missing critical logs. The second prompt information can be input into the large model, enabling it to accurately understand the contextual information of the target program code, analyze its logic, accurately identify critical paths and important events, and ultimately generate analysis logs for the target program code.

[0043] This specification provides a method for processing program code. The method involves acquiring target program code to be processed, which includes program code for a target model. The target model includes one or more different model operations. Then, based on the model operations contained in the target program code, an operation topology diagram corresponding to the target program code is determined. Based on the operations contained in the target program code and the corresponding operation topology diagram, functional blocks contained in the target program code and their descriptions are determined. Subsequently, based on the functional blocks and their descriptions, and the target program code with line identifiers, a first prompt message is constructed. Finally, based on the target program code, a code database is used to retrieve information with a similarity greater than a predetermined value. The first program code with a threshold is used. Finally, a second prompt message can be generated based on the first prompt message, the first program code, and the target program code. The second prompt message is then input into the large model to obtain the analysis log of the target program code. In this way, by abstracting the functional blocks of the program code from fine to coarse, and at the same time combining each line of the program code with the functional blocks from coarse to fine, the success rate of adding analysis logs is greatly improved. Moreover, based on the RAG framework, the correctly verified expert experience and historical cases are continuously enriched, realizing a positive cycle of analysis log success rate. In addition, the large model can understand the contextual information of the program code, analyze its logic, and accurately identify critical paths and important events. This allows the model to identify important log points in various situations, reducing the risk of missing key logs, rather than relying solely on surface patterns.

[0044] In practical applications, the specific processing method for determining the construction of the operation topology diagram corresponding to the target program code based on the model operations contained in the target program code in step S404 above can be varied. The following provides another optional processing method, such as... Figure 6 As shown, the specific process may include the following steps S40402 to S40406.

[0045] In step S40402, the application programming interface (API) provided by the target model is obtained.

[0046] In implementation, taking a neural network model as an example, the neural network model can include an input layer, hidden layers, and an output layer. The input layer is used to receive input data, the hidden layer includes many intermediate layers, such as convolutional layers and activation layers, and the output layer can be used to output the processing results (i.e., output data). For each model operation of the neural network model (such as convolution, activation function, pooling, etc.), a topological relationship needs to be established. Specifically, the API provided by the target model can be determined through the APIs provided by deep learning frameworks (such as TensorFlow, PyTorch, etc.) (such as tf.function, torch.nn.Module, etc.).

[0047] In step S40404, the model operations contained in the target program code are determined based on the API provided by the target model.

[0048] In implementation, the model operations contained in the target program code can be extracted based on the specific information of the API provided by the target model.

[0049] In step S40406, based on the model operations contained in the target program code, the operation topology diagram corresponding to the target program code is determined and constructed.

[0050] The specific processing method for step S40406 can be found in the aforementioned related content, and will not be repeated here.

[0051] In practical applications, key-value pairs can also be constructed for the operation types of the model operations, and code line identifiers can be set for the target program code. For details, please refer to the processing of steps A2 and A4 below.

[0052] In step A2, the target program code is parsed to obtain the code line identifier corresponding to each model operation.

[0053] The code line identifier can be of various types, such as the line number or code of a certain line in the program code, and can be set according to the actual situation.

[0054] In practice, the target program code can be parsed in various ways. For example, the target program code can be parsed using AST (Abstract Syntax Tree) tools to obtain the code line identifiers corresponding to each model operation.

[0055] In step A4, based on the operation type of each model operation and the code line identifier corresponding to each model operation, key-value pairs for the operation type of the model operation are constructed, and based on the code line identifier corresponding to each model operation, the target program code with the code line identifier is determined.

[0056] In implementation, a connection can be established between specific model operations and line identifiers. This allows for the creation of dictionaries or other data structures. Based on this, key-value pairs can be constructed for each model operation, using its operation type as the key and the corresponding line identifier as the value. This enables quick lookup of the corresponding line of code. Furthermore, based on the line identifier corresponding to each model operation, a corresponding line identifier can be set for each line of code in the target program, thus obtaining the target program code with the set line identifiers.

[0057] In practical applications, the specific processing method for determining the functional blocks and description information of each functional block in the target program code based on the operations contained in the target program code and the corresponding operation topology diagram in step S404 can be varied. The following provides another optional processing method, such as... Figure 7 As shown, the specific process may include the following steps S40408 and S40410.

[0058] In step S40408, based on the operation type and attribute information of the operations contained in the target program code, the model operations in the operation topology diagram corresponding to the target program code are clustered to determine the information of each first cluster category and the information of the model operations belonging to different first cluster categories.

[0059] In implementation, model operations can be categorized into a higher level of granularity, such as network granularity. Specifically, based on the operation type and attribute information (such as operation name and / or features) contained in the target program code, the model operations in the operation topology graph corresponding to the target program code can be clustered to group operations of different types into larger categories. For example, all model operations in network layers related to convolution can be clustered into convolution operations, with convolution operations being the first cluster category. Similarly, model operations in network layers containing Transformer modules can be clustered into transformation operations, with transformation operations being the first cluster category. Likewise, model operations in network layers containing max pooling and mean pooling can be clustered into pooling operations, with pooling operations being the first cluster category, and so on. Through this method, the model operations in the operation topology graph corresponding to the target program code can be clustered, thereby determining the information of each first cluster category and the information of model operations belonging to different first cluster categories.

[0060] In step S40410, based on the information of each first cluster category and the information of model operations belonging to different first cluster categories, the functional blocks contained in the target program code and the description information of each functional block are determined.

[0061] In implementation, the first cluster category can be directly set as the corresponding functional block. For example, if the first cluster category is convolution operation, then the corresponding functional block can be set as the convolution operation functional block. Using this method, the functional blocks contained in the target program code can be determined based on the information of each first cluster category. Furthermore, the information of each first cluster category and the information of model operations belonging to different first cluster categories can be analyzed to determine the function and role of each functional block, and descriptive information for each functional block can be generated based on the analyzed information.

[0062] It should be noted that other methods can also be used to determine the functional blocks and their descriptions in the target program code based on information from each first cluster category and information from model operations belonging to different first cluster categories. For example, a specified algorithm can be pre-defined to process the information from each first cluster category and information from model operations belonging to different first cluster categories. The processing results can then be used to determine the functional blocks and their descriptions in the target program code. The specific algorithm can be set according to the actual situation.

[0063] In practical applications, the specific processing method of step S40410 above can vary. The following provides another optional processing method, such as... Figure 8 As shown, the specific process may include the following steps S404102 and S404104.

[0064] In step S404102, based on the information of each first cluster category and the information of model operations belonging to different first cluster categories, the determined categories are clustered to obtain the information of each second cluster category and the information of the first cluster categories belonging to different second cluster categories.

[0065] In practice, the first cluster categories obtained through the above-described clustering may not be sufficient to achieve coarse-grained categories. Therefore, further clustering processing can be performed based on the first clustering. Specifically, the determined categories can be clustered according to the information of each first cluster category and the information of model operations belonging to different first cluster categories, so as to further abstract the different determined categories into larger categories. For example, normalization, data augmentation, and image transformation can be clustered into image data preprocessing, and the second cluster category in this case is image data preprocessing. Similarly, feature extraction, convolutional layers, and Transformer layers can be clustered into image information extraction, and the second cluster category in this case is image information extraction. Through the above method, the determined categories can be clustered, thereby determining the information of each second cluster category and the information of the first cluster categories belonging to different second cluster categories.

[0066] In step S404104, based on the information of each second cluster category and the information of the first cluster category belonging to different second cluster categories, the functional blocks contained in the target program code and the description information of each functional block are determined.

[0067] In implementation, the second cluster category can be directly set as the corresponding functional block. For example, if the second cluster category is image data preprocessing, then the corresponding functional block can be set as the image data preprocessing functional block. Using this method, the functional blocks contained in the target program code can be determined based on the information of each second cluster category. Furthermore, the information of each second cluster category and the information of the first cluster categories belonging to different second cluster categories can be analyzed to determine the function and role of each functional block, and descriptive information for each functional block can be generated based on the analyzed information.

[0068] It should be noted that other methods can also be used to determine the functional blocks and their descriptions in the target program code based on information from each second cluster category and information from first cluster categories belonging to different second cluster categories. For example, a pre-defined algorithm can be used to process the information from each second cluster category and the information from first cluster categories belonging to different second cluster categories. The processing results can then be used to determine the functional blocks and their descriptions in the target program code. The specific algorithm can be set according to the actual situation. Furthermore, further clustering processing can be performed to obtain more abstract cluster categories, thereby obtaining the corresponding functional blocks and their descriptions. The specific algorithm can be set according to the actual situation, and this specification does not limit this approach.

[0069] In practical applications, to further improve the recording performance of analysis logs, large models can be warmed up (i.e., preheated), such as... Figure 9 As shown, please refer to steps B2 and B4 below for details.

[0070] In step B2, a first number of second program codes are randomly collected.

[0071] The first quantity can be set according to the actual situation. For example, the first quantity can be 500 or 1000, or it can be 4% or 10% of the total number of program codes contained in the code database.

[0072] In implementation, a first number of program codes can be randomly collected from the code database, and the collected program codes can be used as the second program code.

[0073] In step B4, the large model is warmed up based on the second program code to obtain the warmed-up large model.

[0074] In practice, warming up the large model not only further improves the recording performance of the analysis log, but also enhances the performance of the large model on specific tasks and strengthens its general analogy ability (i.e., finding common features of limited contextual information based on each instruction in the prompt information). Specifically, for each warm-up training, the kNN algorithm, Euclidean distance similarity algorithm, etc., can be used to obtain program code from the code database that has a similarity greater than a preset threshold with the program code in the warm-up training. The label information (i.e., the analysis log) of the above program code (i.e., the program code with a similarity greater than the preset threshold with the program code in the warm-up training) can be obtained. The above program code, label information and prescribed instructions can be packaged together to generate prompt information. This prompt information can be input into the large model to adjust the model parameters, thereby warming up the large model. Finally, the warmed-up large model can be obtained.

[0075] Based on the processing in steps B2 and B4 above, the processing in step S408 above may include: generating a second prompt message based on the first prompt message, the first program code, and the target program code, and inputting the second prompt message into the large model after warming up to obtain the analysis log of the target program code.

[0076] The specific processing steps described above can be found in the aforementioned related content, and will not be repeated here.

[0077] In practical applications, considering that if logs are printed in program loop code statements that traverse more than a preset threshold, multiple logs (up to hundreds of logs) will be generated, and data objects with a data volume greater than the preset data volume threshold may be printed, the analysis logs generated above can also be verified. For details, please refer to the processing in steps C2 and C4 below.

[0078] In step C2, the analysis log of the target program code is input into the large model to determine whether there are any data objects in the analysis log that print logs in program loop code statements with a traversal number exceeding a preset threshold or whose printed data volume exceeds a preset data volume threshold, and obtain the corresponding judgment result.

[0079] The data objects can be of various types, such as images and videos, and can be specifically set according to the actual situation. The program loop code statements can also be of various types, such as for loop statements.

[0080] In implementation, the analysis log of the target program code can be input into the large model. The large model can then determine whether there are any log entries printed in program loop code statements that exceed a preset threshold number of iterations. This determination can prevent the analysis log from containing too many log entries generated due to log entries in program loop code statements. It can also determine whether to print data objects with a data size greater than a preset threshold, thus preventing the printing of data objects with a data size greater than the preset threshold. Data related to shape or size can be printed, but the entire array should not be input into the analysis log. Through the above processing, the corresponding judgment results can be obtained.

[0081] In step C4, the analysis log is adjusted based on the judgment result to obtain the adjusted analysis log.

[0082] In implementation, if the judgment result indicates that the analysis log contains logs printed in program loop code statements with a traversal count exceeding a preset threshold, then multiple log entries generated due to log printing in program loop code statements can be deleted or simplified. If the judgment result indicates that the analysis log contains data objects with a print data volume exceeding a preset data volume threshold, then the relevant log data in the analysis log can be deleted or simplified to adjust the analysis log and obtain an adjusted analysis log. If the judgment result indicates that the analysis log does not contain logs printed in program loop code statements with a traversal count exceeding the preset threshold, nor does it contain data objects with a print data volume exceeding the preset data volume threshold, then no adjustment to the analysis log is required, and the analysis log can be used as the final analysis log for the target program code.

[0083] In practical applications, in addition to providing the adjusted analysis logs to users or technical personnel, the adjusted analysis logs can also be added to the aforementioned code database.

[0084] In practical applications, the analysis log of the target program code includes processing level and processing purpose. The processing level includes one or more of the following: Fatal, Error, Warn, Info, Debug, and Try-exceed. The processing purpose includes one or more of the following: time consumption, determining the size of the tensor, and determining whether the hardware location of the tensor has changed.

[0085] This specification provides a method for processing program code. The method involves acquiring target program code to be processed, which includes program code for a target model. The target model includes one or more different model operations. Then, based on the model operations contained in the target program code, an operation topology diagram corresponding to the target program code is determined. Based on the operations contained in the target program code and the corresponding operation topology diagram, functional blocks contained in the target program code and their descriptions are determined. Subsequently, based on the functional blocks and their descriptions, and the target program code with line identifiers, a first prompt message is constructed. Finally, based on the target program code, a code database is used to retrieve information with a similarity greater than a predetermined value. The first program code with a threshold is used. Finally, a second prompt message can be generated based on the first prompt message, the first program code, and the target program code. The second prompt message is then input into the large model to obtain the analysis log of the target program code. In this way, by abstracting the functional blocks of the program code from fine to coarse, and at the same time combining each line of the program code with the functional blocks from coarse to fine, the success rate of adding analysis logs is greatly improved. Moreover, based on the RAG framework, the correctly verified expert experience and historical cases are continuously enriched, realizing a positive cycle of analysis log success rate. In addition, the large model can understand the contextual information of the program code, analyze its logic, and accurately identify critical paths and important events. This allows the model to identify important log points in various situations, reducing the risk of missing key logs, rather than relying solely on surface patterns.

[0086] In addition, a verification process for analysis logs has been added to avoid adding logs that do not meet expectations. Furthermore, logs are subdivided by type to achieve more effective log addition. This allows for the addition of logs in areas where there may be fluctuations in processing time, large computational load, unclear input and output data volume, or critical impact on model stability, in order to obtain better analysis logs.

[0087] The above describes the program code processing method provided in the embodiments of this specification. Based on the same idea, the embodiments of this specification also provide a program code processing device, such as... Figure 10 As shown.

[0088] The program code processing device includes: a code acquisition module 1001, a code processing module 1002, a retrieval enhancement module 1003, and a log generation module 1004, wherein:

[0089] The code acquisition module 1001 acquires the target program code to be processed, wherein the target program code includes the program code of the target model, and the target model includes one or more different model operations;

[0090] The code processing module 1002 determines the operation topology diagram corresponding to the target program code based on the model operations contained in the target program code, and determines the functional blocks contained in the target program code and the description information of each functional block based on the operations contained in the target program code and the operation topology diagram corresponding to the target program code.

[0091] The retrieval enhancement module 1003 constructs a first prompt message based on the functional blocks contained in the target program code and the description information of each functional block, as well as the target program code with code line identifiers, and obtains a first program code from the code database whose similarity to the target program code is greater than a preset threshold based on the target program code.

[0092] The log generation module 1004 generates a second prompt message based on the first prompt message, the first program code, and the target program code, and inputs the second prompt message into the large model to obtain the analysis log of the target program code.

[0093] In this embodiment of the specification, the code processing module 1002 includes:

[0094] The interface acquisition unit acquires the application programming interface (API) provided by the target model.

[0095] The model operation determination unit determines the model operations contained in the target program code based on the API provided by the target model.

[0096] The topology unit determines and constructs the operation topology diagram corresponding to the target program code based on the model operations contained in the target program code.

[0097] In the embodiments described in this specification, the device further includes:

[0098] The parsing module parses the target program code to obtain the code line identifier corresponding to each model operation.

[0099] The data processing module constructs key-value pairs for the operation type of each model operation based on the operation type and the code line identifier corresponding to each model operation, and determines the target program code with the code line identifier set based on the code line identifier corresponding to each model operation.

[0100] In this embodiment of the specification, the code processing module 1002 includes:

[0101] The first clustering unit, based on the operation type and attribute information of the operations contained in the target program code, clusters the model operations in the operation topology graph corresponding to the target program code, and determines the information of each first cluster category and the information of the model operations belonging to different first cluster categories;

[0102] The function determination unit determines the function blocks contained in the target program code and the description information of each function block based on the information of each first cluster category and the information of model operations belonging to different first cluster categories.

[0103] In the embodiments of this specification, the function determination unit clusters the determined categories based on the information of each first cluster category and the information of model operations belonging to different first cluster categories to obtain the information of each second cluster category and the information of the first cluster categories belonging to different second cluster categories; based on the information of each second cluster category and the information of the first cluster categories belonging to different second cluster categories, it determines the functional blocks contained in the target program code and the description information of each functional block.

[0104] In the embodiments described in this specification, the device further includes:

[0105] The sampling module randomly collects a first number of second program codes from the code database;

[0106] The warm-up module performs a warm-up process on the large model based on the second program code to obtain the warmed-up large model.

[0107] The log generation module 1004 generates a second prompt based on the first prompt, the first program code, and the target program code, and inputs the second prompt into the warm-up large model to obtain the analysis log of the target program code.

[0108] In the embodiments described in this specification, the device further includes:

[0109] The log processing module inputs the analysis log of the target program code into the large model to determine whether there are program loop code statements in the analysis log that print logs or data objects whose print data volume is greater than a preset data volume threshold, and obtains the corresponding judgment result.

[0110] The log adjustment module adjusts the analysis log based on the judgment result to obtain the adjusted analysis log.

[0111] In the embodiments of this specification, the analysis log of the target program code includes a processing level and a processing purpose. The processing level includes one or more of the following: Fatal, Error, Warn, Info, Debug, and Try-exception. The processing purpose includes one or more of the following: time consumption, determining the size of the tensor, and determining whether the hardware location of the tensor has changed.

[0112] This specification provides a program code processing apparatus. It acquires target program code to be processed, which includes program code for a target model. The target model includes one or more different model operations. Then, based on the model operations contained in the target program code, it determines and constructs an operation topology diagram corresponding to the target program code. Based on the operations contained in the target program code and the corresponding operation topology diagram, it determines the functional blocks contained in the target program code and their descriptions. Then, based on the functional blocks and their descriptions, and the target program code with line identifiers, it constructs a first prompt message. Finally, based on the target program code, it retrieves code from a code database that has a similarity greater than a predetermined value. The first program code with a threshold is used. Finally, a second prompt message can be generated based on the first prompt message, the first program code, and the target program code. The second prompt message is then input into the large model to obtain the analysis log of the target program code. In this way, by abstracting the functional blocks of the program code from fine to coarse, and at the same time combining each line of the program code with the functional blocks from coarse to fine, the success rate of adding analysis logs is greatly improved. Moreover, based on the RAG framework, the correctly verified expert experience and historical cases are continuously enriched, realizing a positive cycle of analysis log success rate. In addition, the large model can understand the contextual information of the program code, analyze its logic, and accurately identify critical paths and important events. This allows the model to identify important log points in various situations, reducing the risk of missing key logs, rather than relying solely on surface patterns.

[0113] In addition, a verification process for analysis logs has been added to avoid adding logs that do not meet expectations. Furthermore, logs are subdivided by type to achieve more effective log addition. This allows for the addition of logs in areas where there may be fluctuations in processing time, large computational load, unclear input and output data volume, or critical impact on model stability, in order to obtain better analysis logs.

[0114] The above describes the program code processing apparatus provided in the embodiments of this specification. Based on the same idea, the embodiments of this specification also provide a program code processing device, such as... Figure 11 As shown.

[0115] The processing device for the program code can be a terminal device or a server, as described in the above embodiments.

[0116] The processing device for program code can vary considerably depending on its configuration or performance, and may include one or more processors 1101 and memory 1102. Memory 1102 may store one or more application programs or data. Memory 1102 may be temporary or persistent storage. The application programs stored in memory 1102 may include one or more modules (not shown), each module including a series of computer-executable instructions in the processing device for program code. Furthermore, processor 1101 may be configured to communicate with memory 1102 and execute the series of computer-executable instructions in memory 1102 on the processing device for program code. The processing device for program code may also include one or more power supplies 1103, one or more wired or wireless network interfaces 1104, one or more input / output interfaces 1105, and one or more keyboards 1106.

[0117] Specifically, in this embodiment, the program code processing device includes a memory and one or more programs, wherein one or more programs are stored in the memory, and one or more programs may include one or more modules, and each module may include a series of computer-executable instructions for the program code processing device, and is configured to be executed by one or more processors. The one or more programs include computer-executable instructions for performing the following:

[0118] Obtain the target program code to be processed, wherein the target program code includes the program code of the target model, and the target model includes one or more different model operations;

[0119] Based on the model operations contained in the target program code, an operation topology diagram corresponding to the target program code is determined, and based on the operations contained in the target program code and the operation topology diagram corresponding to the target program code, the functional blocks contained in the target program code and the description information of each functional block are determined.

[0120] Based on the functional blocks contained in the target program code and the description information of each functional block, as well as the target program code with code line identifiers, a first prompt message is constructed, and based on the target program code, a first program code with a similarity greater than a preset threshold is obtained from the code database.

[0121] Based on the first prompt information, the first program code, and the target program code, a second prompt information is generated, and the second prompt information is input into the large model to obtain the analysis log of the target program code.

[0122] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the embodiments for processing program code are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.

[0123] This specification provides a program code processing device. It acquires target program code to be processed, which includes program code for a target model. The target model includes one or more different model operations. Then, based on the model operations contained in the target program code, it determines and constructs an operation topology diagram corresponding to the target program code. Based on the operations contained in the target program code and the corresponding operation topology diagram, it determines the functional blocks contained in the target program code and their descriptions. Then, based on the functional blocks and their descriptions, and the target program code with line identifiers, it constructs a first prompt message. Finally, based on the target program code, it retrieves code from a code database that has a similarity greater than a predetermined value. The first program code with a threshold is used. Finally, a second prompt message can be generated based on the first prompt message, the first program code, and the target program code. The second prompt message is then input into the large model to obtain the analysis log of the target program code. In this way, by abstracting the functional blocks of the program code from fine to coarse, and at the same time combining each line of the program code with the functional blocks from coarse to fine, the success rate of adding analysis logs is greatly improved. Moreover, based on the RAG framework, the correctly verified expert experience and historical cases are continuously enriched, realizing a positive cycle of analysis log success rate. In addition, the large model can understand the contextual information of the program code, analyze its logic, and accurately identify critical paths and important events. This allows the model to identify important log points in various situations, reducing the risk of missing key logs, rather than relying solely on surface patterns.

[0124] Furthermore, based on the above Figures 4 to 9 The method shown in this specification, along with one or more embodiments, also provides a storage medium for storing computer-executable instruction information. In one specific embodiment, the storage medium can be a USB flash drive, optical disc, hard disk, etc. When the computer-executable instruction information stored in the storage medium is executed by a processor, it can achieve the following process:

[0125] Obtain the target program code to be processed, wherein the target program code includes the program code of the target model, and the target model includes one or more different model operations;

[0126] Based on the model operations contained in the target program code, an operation topology diagram corresponding to the target program code is determined, and based on the operations contained in the target program code and the operation topology diagram corresponding to the target program code, the functional blocks contained in the target program code and the description information of each functional block are determined.

[0127] Based on the functional blocks contained in the target program code and the description information of each functional block, as well as the target program code with code line identifiers, a first prompt message is constructed, and based on the target program code, a first program code with a similarity greater than a preset threshold is obtained from the code database.

[0128] Based on the first prompt information, the first program code, and the target program code, a second prompt information is generated, and the second prompt information is input into the large model to obtain the analysis log of the target program code.

[0129] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to interchangeably. Each embodiment focuses on its differences from other embodiments. In particular, the above-described storage medium embodiment is relatively simple in description because it is fundamentally similar to the method embodiment; relevant parts can be referred to the description of the method embodiment.

[0130] This specification provides a storage medium that acquires target program code to be processed. The target program code includes program code for a target model, and the target model includes one or more different model operations. Then, based on the model operations contained in the target program code, an operation topology diagram corresponding to the target program code can be determined and constructed. Based on the operations contained in the target program code and the operation topology diagram corresponding to the target program code, functional blocks contained in the target program code and description information of each functional block can be determined. Subsequently, based on the functional blocks contained in the target program code and the description information of each functional block, as well as the target program code with code line identifiers, a first prompt message can be constructed. Based on the target program code, a code database is used to retrieve code with a similarity greater than a preset threshold. The first program code, based on the first prompt message, the first program code, and the target program code, can ultimately generate a second prompt message. This second prompt message is then input into the large model to obtain the analysis log of the target program code. In this way, by abstracting the functional blocks of the program code from fine to coarse, and simultaneously combining each line of the program code with the functional blocks from coarse to fine, the success rate of adding analysis logs is greatly improved. Moreover, based on the RAG framework, the correctly validated expert experience and historical cases are continuously enriched, achieving a positive cycle for the success rate of analysis logs. Furthermore, the large model can understand the contextual information of the program code, analyze its logic, and accurately identify critical paths and important events. This allows the model to identify important log points in various situations, reducing the risk of missing key logs, rather than relying solely on surface patterns.

[0131] Furthermore, based on the above Figures 4 to 9 The method shown in this specification, along with one or more embodiments, also provides a computer program product including a computer program that, when executed by a processor, performs the following process:

[0132] Obtain the target program code to be processed, wherein the target program code includes the program code of the target model, and the target model includes one or more different model operations;

[0133] Based on the model operations contained in the target program code, an operation topology diagram corresponding to the target program code is determined, and based on the operations contained in the target program code and the operation topology diagram corresponding to the target program code, the functional blocks contained in the target program code and the description information of each functional block are determined.

[0134] Based on the functional blocks contained in the target program code and the description information of each functional block, as well as the target program code with code line identifiers, a first prompt message is constructed, and based on the target program code, a first program code with a similarity greater than a preset threshold is obtained from the code database.

[0135] Based on the first prompt information, the first program code, and the target program code, a second prompt information is generated, and the second prompt information is input into the large model to obtain the analysis log of the target program code.

[0136] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the above-described embodiment of a computer program product is relatively simple in description because it is fundamentally similar to the method embodiment; relevant parts can be referred to the description of the method embodiment.

[0137] This specification provides a computer program product. By acquiring target program code to be processed, which includes program code for a target model and one or more different model operations, an operation topology diagram corresponding to the target program code can be determined based on the model operations contained in the target program code. Furthermore, based on the operations contained in the target program code and the corresponding operation topology diagram, functional blocks and their descriptions can be determined within the target program code. Then, based on the functional blocks and their descriptions, and the target program code marked with line identifiers, a first prompt message can be constructed. Finally, based on the target program code, a code database is used to retrieve information with a similarity greater than a preset value. The first program code of the threshold is used to generate a second prompt message based on the first prompt message, the first program code, and the target program code. This second prompt message is then input into the large model to obtain the analysis log of the target program code. In this way, by abstracting the functional blocks of the program code from fine to coarse, and at the same time combining each line of the program code with the functional blocks from coarse to fine, the success rate of adding analysis logs is greatly improved. Moreover, based on the RAG framework, the correctly verified expert experience and historical cases are continuously enriched to achieve a positive cycle of analysis log success rate. In addition, the large model can understand the contextual information of the program code, analyze its logic, and accurately identify critical paths and important events. This allows the model to identify important log points in various situations, reducing the risk of missing key logs, rather than relying solely on surface patterns.

[0138] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.

[0139] In the 1990s, improvements to a technology could be clearly distinguished as either hardware improvements (e.g., improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the methodology). However, with technological advancements, many methodological improvements today can be considered direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved methodology into the hardware circuit. Therefore, it cannot be said that a methodological improvement cannot be implemented using hardware physical modules. For example, a Programmable Logic Device (PLD) (such as a Field Programmable Gate Array (FPGA)) is such an integrated circuit whose logic function is determined by the user programming the device. Designers can program and "integrate" a digital system onto a PLD themselves, without needing chip manufacturers to design and manufacture dedicated integrated circuit chips. Furthermore, nowadays, instead of manually manufacturing integrated circuit chips, this programming is mostly implemented using "logic compiler" software. Similar to the software compiler used in program development, the original code before compilation must also be written in a specific programming language, called a Hardware Description Language (HDL). There are many HDLs, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, and RHDL (Ruby Hardware Description Language). Currently, the most commonly used are VHDL (Very-High-Speed ​​Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also understand that by simply performing some logic programming on the method flow using one of these hardware description languages ​​and programming it into an integrated circuit, the hardware circuit implementing the logical method flow can be easily obtained.

[0140] The controller can be implemented in any suitable manner. For example, it can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro)processor, logic gates, switches, application-specific integrated circuits (ASICs), programmable logic controllers, and embedded microcontrollers. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicon Labs C8051F320. A memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also recognize that, in addition to implementing the controller in purely computer-readable program code form, the same functionality can be achieved by logically programming the method steps to make the controller take the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers. Therefore, such a controller can be considered a hardware component, and the means included therein for implementing various functions can also be considered as structures within the hardware component. Alternatively, the means for implementing various functions can be considered as both software modules implementing the method and structures within the hardware component.

[0141] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, a computer can be, for example, a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email device, game console, tablet computer, wearable device, or any combination of these devices.

[0142] For ease of description, the above apparatus is described by dividing it into various functional units. Of course, when implementing one or more embodiments of this specification, the functions of each unit can be implemented in one or more software and / or hardware.

[0143] Those skilled in the art will understand that the embodiments of this specification can be provided as methods, systems, or computer program products. Therefore, one or more embodiments of this specification may take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, one or more embodiments of this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0144] Embodiments in this specification are described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this specification. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable parallel device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable parallel device, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0145] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable fraud device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0146] These computer program instructions can also be loaded onto a computer or other programmable device, causing a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable device for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0147] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0148] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0149] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

[0150] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0151] Those skilled in the art will understand that the embodiments of this specification can be provided as methods, systems, or computer program products. Therefore, one or more embodiments of this specification may take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, one or more embodiments of this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0152] One or more embodiments of this specification can be described in the general context of computer-executable instructions, such as program modules, that are executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform a particular task or implement a particular abstract data type. One or more embodiments of this specification can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.

[0153] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to interchangeably. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.

[0154] The above description is merely an embodiment of this specification and is not intended to limit this document. Various modifications and variations can be made to this specification by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this specification should be included within the scope of the claims of this specification.

Claims

1. A method for processing program code, the method comprising: obtaining target program code to be processed, the target program code including program code of a target model, the target model including one or more different model operations; determining, based on the model operations included in the target program code, an operation topology relationship graph corresponding to the target program code, and clustering the model operations in the operation topology relationship graph corresponding to the target program code based on the operation types and attribute information to which the operations included in the target program code belong, to determine information of each first clustering category and information of the model operations belonging to different first clustering categories; determining, based on the information of each first clustering category and the information of the model operations belonging to different first clustering categories, a function block included in the target program code and description information of each function block; based on the function block included in the target program code and the description information of each function block, and the target program code provided with a code line identifier, constructing first prompt information, and based on the target program code, obtaining a first program code from a code database, the first program code having a similarity greater than a preset threshold with the target program code; generating second prompt information based on the first prompt information, the first program code, and the target program code, and inputting the second prompt information into a large model to obtain an analysis log of the target program code.

2. The method of claim 1, wherein the determining, based on the model operations included in the target program code, an operation topology relationship graph corresponding to the target program code comprises: obtaining an application programming interface (API) provided by the target model; determining, based on the API provided by the target model, the model operations included in the target program code; determining, based on the model operations included in the target program code, an operation topology relationship graph corresponding to the target program code.

3. The method of claim 1, further comprising: performing parsing processing on the target program code to obtain a code line identifier corresponding to each model operation; based on the operation types to which each model operation belongs and the code line identifier corresponding to each model operation, constructing a key-value pair for the operation types of the model operations, and based on the code line identifier corresponding to each model operation, determining the target program code provided with the code line identifier.

4. The method of claim 1, wherein the determining, based on the information of each first clustering category and the information of the model operations belonging to different first clustering categories, a function block included in the target program code and description information of each function block comprises: based on the information of each first clustering category and the information of the model operations belonging to different first clustering categories, clustering the determined categories to obtain information of each second clustering category and information of the first clustering categories belonging to different second clustering categories; based on the information of each second clustering category and the information of the first clustering categories belonging to different second clustering categories, determining a function block included in the target program code and description information of each function block.

5. The method of claim 4, further comprising: randomly collecting a first number of second program codes from a code database; warming up the large model based on the second program codes to obtain a warmed-up large model; generating second prompt information based on the first prompt information, the first program code, and the target program code, and inputting the second prompt information into the large model to obtain an analysis log of the target program code, comprising: generating second prompt information based on the first prompt information, the first program code, and the target program code, and inputting the second prompt information into the warmed-up large model to obtain an analysis log of the target program code.

6. The method of claim 5, further comprising: inputting the analysis log of the target program code into the large model to determine whether there is a program loop code statement with a traversal number exceeding a preset number threshold or a data object with a print data volume greater than a preset data volume threshold in the analysis log, to obtain a corresponding determination result; adjusting the analysis log based on the determination result to obtain an adjusted analysis log.

7. The method of claim 6, wherein the analysis log of the target program code comprises a processing level and a processing purpose, the processing level comprises one or more of Fatal, Error, Warn, Info, Debug, and Try-excepe, and the processing purpose comprises one or more of time consumption, judgment of tensor size, and judgment of whether the hardware location of the tensor changes.

8. A program code processing apparatus, comprising: a code acquisition module that acquires a target program code to be processed, the target program code comprising program code of a target model, the target model comprising one or more different model operations; a code processing module that determines an operation topology relationship graph corresponding to the target program code based on the model operations contained in the target program code, and clusters the model operations in the operation topology relationship graph corresponding to the target program code based on the operation types and attribute information of the operations contained in the target program code, to determine information of each first clustering category and information of the model operations belonging to different first clustering categories; determines a function block contained in the target program code and description information of each function block based on the information of each first clustering category and the information of the model operations belonging to different first clustering categories; a retrieval enhancement module that constructs first prompt information based on the function block contained in the target program code and the description information of each function block, and the target program code provided with a code line identifier, and acquires a first program code with a similarity greater than a preset threshold to the target program code from a code database based on the target program code. The log generation module generates second prompt information based on the first prompt information, the first program code and the target program code, and inputs the second prompt information into a large model to obtain an analysis log of the target program code.

9. A program code processing device, the program code processing device comprising: a processor; and a memory arranged to store computer executable instructions that, when executed, cause the processor to: obtain a target program code to be processed, the target program code including program code of a target model, the target model including one or more different model operations; determine to construct an operation topology relationship graph corresponding to the target program code based on the model operations included in the target program code, and cluster the model operations in the operation topology relationship graph corresponding to the target program code based on the operation types and attribute information to which the operations belong, to determine information of each first cluster category and information of the model operations belonging to different first cluster categories; determine a function block included in the target program code and description information of each function block based on the information of each first cluster category and the information of the model operations belonging to different first cluster categories; construct first prompt information based on the function block included in the target program code and the description information of each function block, and the target program code provided with a code line identifier, and obtain a first program code from a code database based on the target program code, the first program code having a similarity to the target program code greater than a preset threshold; generate second prompt information based on the first prompt information, the first program code and the target program code, and input the second prompt information into a large model to obtain an analysis log of the target program code.

Citation Information

Patent Citations

  • System, method and computer program for generating sequence diagram

    US20090307654A1