A large language model code generation optimization method for M6678 multi-core DSP platform
Patent Information
- Application Number
- CN202611327011.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-30
- Publication Date
- 2026-10-27
AI Technical Summary
但传统的代码生成方法未能充分利用这些硬件特性,导致生成的代码性能低下,开发周期长,且需要底层硬件专家的大量参与
[0117]本发明相比现有技术,具有以下显著有益效果:
Smart Images

Figure CN122985140A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of next-generation information technology, and in particular to an optimization method for generating large language model code for the M6678 multi-core DSP platform. Background Technology
[0002] Currently, large language models are widely used for code generation in software development, with the advantage of rapidly generating large amounts of code. However, the code generated by these general-purpose models is often "usable but not ideal," failing to be fully optimized to suit the characteristics of specific hardware platforms, especially for domestically produced high-performance processors such as the M6678 DSP platform. The M6678 DSP platform has multi-core parallel processing capabilities and an efficient caching mechanism, which can significantly improve algorithm execution efficiency. However, traditional code generation methods fail to fully utilize these hardware features, resulting in low-performance generated code, long development cycles, and the need for extensive involvement from low-level hardware experts. Summary of the Invention
[0003] To address the existing technical problems, this invention provides a method for optimizing the generation of large language model code for the M6678 multi-core DSP platform.
[0004] The specific content of this invention is as follows: A method for optimizing large language model code generation for the M6678 multi-core DSP platform, comprising the following steps:
[0005] S1, Building a dedicated knowledge base for M6678: Build a dedicated knowledge base for M6678 that includes interface monitoring templates, multi-core programming rules, cache optimization strategies, high-performance operator libraries, and sample code;
[0006] S2, Automatic Code Conversion and Optimization: Converts MATLAB algorithms into C code highly adapted to the M6678 hardware architecture, enabling the generated code to be deployed and run directly on the M6678 platform. This includes: initial code generation, MATLAB algorithm checking and repair, computation buffer checking and repair, high-performance operator library checking and repair, and compilation error checking and repair.
[0007] Furthermore, in S1, multi-core programming rules include:
[0008] Data parallel processing decomposition: The data to be processed is decomposed into multiple independent data blocks so that it can be processed in parallel on multiple cores;
[0009] Compute buffer splitting: Allocate an independent compute buffer to each core to ensure that each core does not interfere with each other when processing data in its own buffer;
[0010] Data synchronization mechanism: After multi-core computing is completed, a data synchronization mechanism is used to merge the results of each core to ensure accurate data synchronization between all cores.
[0011] Furthermore, in S1, the cache optimization strategies include:
[0012] Data prefetching and shifting: During the data calculation process, the data on DDR is first shifted to the L2SRAM or MSMC calculation cache area through the DMA controller for calculation;
[0013] Data partitioning strategy: When L2SRAM and MSMC cache space are insufficient, a data partitioning strategy is adopted, that is, the data is divided into smaller blocks and moved to the computing cache area one by one for processing.
[0014] Furthermore, in S1, the high-performance operator library is a set of basic computational operation functions optimized for the M6678 hardware platform. This includes vectorized instruction sets and SIMD; through the operator library, large models can directly call these optimized functions.
[0015] Furthermore, in S1, the example code is a series of code snippets optimized for specific scenarios and tasks, demonstrating how to apply various rules and strategies from the M6678 proprietary knowledge base to actual code development.
[0016] Furthermore, in S2, the initial code generation utilizes the pre-edited M6678 platform-specific knowledge base, MATLAB algorithms, and C code interface definitions to organize and generate prompt words. The specific steps are as follows:
[0017] Generate prompt words: Based on the structure and function of the MATLAB algorithm and combined with the knowledge base of the M6678 platform, organize a detailed prompt word. The prompt word includes the main logic of the algorithm, the interfaces to be used, multi-core programming rules, cache optimization strategies, and reference to sample code.
[0018] Input prompts: Input the generated prompts into the large model;
[0019] Extracting C code: The large model generates corresponding C code based on the prompt words, and extracts and saves the generated C code.
[0020] Furthermore, in S2, MATLAB algorithm checks and fixes include:
[0021] Generate check prompts: Based on the logic and structure of the MATLAB algorithm and combined with the knowledge base of the M6678 platform, organize a detailed check prompt, which includes the specific functional points to be verified, the expected behavior of the algorithm, and related interfaces and strategies;
[0022] Input check prompts: Input the generated check prompts into the large model;
[0023] Execution checks and code repair: Based on the check prompts, the large model verifies the execution logic of the generated C code item by item to ensure it meets the requirements of the MATLAB algorithm. The checks include, but are not limited to, the correctness of the algorithm, the accuracy of interface calls, and the completeness of data processing. Based on the check results, the generated C code is directly modified to conform to the MATLAB algorithm requirements.
[0024] Furthermore, in S2, the computation buffer check and repair include:
[0025] Generate buffer check prompts: Organize a detailed prompt that clarifies the rules for allocating and using compute buffers for each core;
[0026] Input buffer check prompts: Input the generated buffer check prompts into the large model;
[0027] Perform buffer checks and code repairs: Based on the prompts, the large model checks whether the allocation and use of computation buffers in the generated C code conforms to the rules. Verification includes buffer initialization, correct data reading and writing, and the use of synchronization mechanisms. Based on the check results, the generated C code is directly modified to ensure correct buffer usage.
[0028] Furthermore, in S2, the high-performance operator library checks and fixes include:
[0029] Generate operator library check prompts: Organize a detailed prompt, list all possible computational logic parts, and analyze whether these parts can be optimized by the high-performance operator library functions provided by the M6678 platform. The prompt should include the usage rules, constraints and related example code of the operator library functions.
[0030] Input operator library check prompts: Input the generated operator library check prompts into the large model;
[0031] Perform operator library checks and code optimization: Based on the prompt words, the large model analyzes whether the generated C code contains computational logic that can use high-performance operator library functions. For parts that can be optimized, they are directly replaced with the corresponding operator library function calls, or the code is refactored to adapt to the requirements of the operator library.
[0032] Furthermore, in S2, the checking and fixing of compilation errors includes:
[0033] The generated C code is compiled using the M6678 platform's compilation toolchain.
[0034] Check for compilation errors: Record all errors and warnings that occur during the compilation process;
[0035] Generate compilation error repair prompts: Based on the compilation error information, organize a detailed prompt to guide the large model on how to fix these errors;
[0036] Input compilation error repair prompts: Input the generated compilation error repair prompts into the large model;
[0037] Automatic compilation error repair: The large model repairs compilation errors one by one based on the prompt words. The repair content includes syntax errors, type mismatches, undefined variables or functions, etc.
[0038] Recompile: After fixing the problem, recompile the generated C code to ensure that all errors and warnings are resolved. If there are still compilation errors, repeat the above steps until compilation succeeds.
[0039] The proposed method for generating and optimizing large language model code specifically for the domestic M6678 multi-core DSP platform can deeply integrate the general code generation capability of large language models with the deep optimization knowledge of specific hardware platforms, thereby generating high-performance, directly deployable C code. Attached Figure Description
[0040] The specific embodiments of the present invention will be further explained below with reference to the accompanying drawings.
[0041] Figure 1 This is a flowchart illustrating the overall process of the large language model code generation optimization method for the M6678 multi-core DSP platform of the present invention. Detailed Implementation
[0042] Combination Figure 1 The present invention provides an optimization method for generating large language model code for the M6678 multi-core DSP platform, comprising the following steps:
[0043] 1. Construct a dedicated knowledge base for M6678
[0044] We constructed a dedicated knowledge base for the M6678, including interface monitoring templates, multi-core programming rules, cache optimization strategies, a high-performance operator library, and sample code, providing an expert-level knowledge system for large-scale models. The knowledge base's content is structured and quantifiable, capable of transforming complex hardware optimization knowledge into explicit instructions that large-scale models can understand and follow. This transforms large-scale models from "generalists" into "specialists" in specific domains, thereby addressing the performance bottleneck of AI code generation.
[0045] 1.1 Interface Monitoring Template
[0046] The introduction of "code interface monitoring templates" transforms the work of creating large models from "creating from scratch" to filling logic into the skeleton of the template.
[0047] 1,2 Multi-core programming rules
[0048] Multicore programming rules are a set of guidelines that direct large models on how to effectively utilize the multicore architecture of the M6678 for parallel computing. These rules include:
[0049] Data parallel processing decomposition: The data to be processed is broken down into multiple independent data blocks so that they can be processed in parallel on multiple cores. This data decomposition method can take full advantage of multi-core processors and improve computational efficiency.
[0050] Compute buffer splitting: An independent compute buffer is allocated to each core, ensuring that each core does not interfere with each other while processing data within its own buffer. This reduces memory access conflicts, improves the locality of data processing, and thus enhances overall performance.
[0051] Data synchronization mechanism: After multi-core computation is complete, an appropriate data synchronization mechanism is used to merge the results from each core. This ensures accurate data synchronization between all cores and avoids data races and inconsistencies.
[0052] 1.3 Cache Optimization Strategies
[0053] Caching optimization strategies guide large models on how to write efficient code to fully utilize the M6678's caching system, thereby improving code execution efficiency. Specific strategies are as follows:
[0054] Data prefetching and migration: During data computation, data is first migrated from DDR to L2SRAM or MSMC (Multi-Standard Memory Controller) cache via DMA (Direct Memory Access) controller for computation. This method reduces latency caused by directly accessing data from DDR, significantly improving computational performance.
[0055] Data partitioning strategy: When L2SRAM and MSMC cache space are insufficient, a data partitioning strategy is adopted. This involves dividing data into smaller blocks and moving them one by one to the computation cache for processing. This maximizes the utilization of limited cache resources, ensuring the efficiency and stability of the computation process.
[0056] 1.4 High-performance operator library
[0057] The high-performance operator library is a set of basic computational operation functions optimized for the M6678 hardware platform. These operators are hardware-accelerated, providing extremely high performance in specific computational scenarios. Large models can utilize these operators for efficient mathematical operations, data processing, and other operations without needing to implement their own low-level optimizations. The high-performance operator library is designed with the characteristics of the hardware architecture in mind, such as vectorized instruction sets and SIMD (Single Instruction, Multiple Data), making these operators run faster and more stably on the M6678. By providing these operator libraries, large models can directly call optimized functions, reducing the complexity and time cost of implementing their own low-level code, while ensuring code efficiency and reliability.
[0058] 1.5 Example Code
[0059] The example code is a series of code snippets optimized for specific scenarios and tasks. These snippets demonstrate how to apply the various rules and strategies from the aforementioned knowledge base to actual code development. By learning from these example codes, the large model can more quickly master the programming skills of the M6678 platform and improve the quality and efficiency of code generation.
[0060] 2. Automatic code conversion and optimization
[0061] The method of this invention automatically converts MATLAB algorithms into C code that is highly adapted to the M6678 hardware architecture. The generated code can be directly deployed and run on the M6678 platform, which significantly shortens the development cycle of high-performance embedded software and reduces the dependence on low-level hardware experts.
[0062] 2.1 Initial Code Generation
[0063] The initial code generation process utilizes a pre-edited M6678 platform-specific knowledge base, MATLAB algorithms, and C code interface definitions to organize and generate prompt words. The specific steps are as follows:
[0064] Generate hints: Based on the structure and function of the MATLAB algorithm, and combined with the knowledge base of the M6678 platform, organize a detailed hint. The hint includes the main logic of the algorithm, the interfaces to be used, multi-core programming rules, cache optimization strategies, and sample code references.
[0065] Input prompts: Input the generated prompts into the large model.
[0066] Extracting C Code: The large model generates corresponding C code based on the prompt words. The generated C code is extracted and saved for later review and optimization.
[0067] 2.2 MATLAB Algorithm Checking and Repair
[0068] To ensure that the generated C code correctly implements the functionality of the MATLAB algorithm, the M6678 platform-specific knowledge base and MATLAB algorithm organization are used to check for prompt words. The specific steps are as follows:
[0069] Generate check prompts: Based on the logic and structure of the MATLAB algorithm and combined with the knowledge base of the M6678 platform, organize a detailed check prompt. The prompt includes the specific functional points that need to be verified, the expected behavior of the algorithm, and the relevant interfaces and strategies.
[0070] Input check prompts: Input the generated check prompts into the large model.
[0071] Execution checks and code repair: The large model verifies the execution logic of the generated C code against the MATLAB algorithm's requirements, item by item, based on the check prompts. The checks include, but are not limited to, the correctness of the algorithm, the accuracy of interface calls, and the completeness of data processing. Based on the check results, the generated C code is directly modified to meet the MATLAB algorithm's requirements.
[0072] 2.3 Calculate buffer check and repair
[0073] Ensure each core correctly uses its independent compute buffer to avoid memory access conflicts and data races. The specific steps are as follows:
[0074] Generate buffer check prompts: Organize a detailed prompt that clarifies the rules for allocating and using compute buffers for each core.
[0075] Input buffer check prompt: Input the generated buffer check prompt into the large model.
[0076] Perform buffer checks and code repairs: Based on the prompts, the large model checks the allocation and use of computation buffers in the generated C code to ensure they comply with the rules. Verification includes buffer initialization, correct data reading and writing, and the use of synchronization mechanisms. Based on the check results, the generated C code is directly modified to ensure correct buffer usage.
[0077] 2.4 High-performance operator library inspection and repair
[0078] To further optimize the generated C code and leverage the high-performance operator library of the M6678 platform, ensuring efficient hardware execution of the algorithm, the following are the specific checking steps:
[0079] Generate operator library check hints: Compile a detailed hint that lists all possible computational logic components and analyzes whether these components can be optimized using the high-performance operator library functions provided by the M6678 platform. The hint should include the usage rules, constraints, and relevant example code for the operator library functions.
[0080] Input operator library check prompts: Input the generated operator library check prompts into the large model.
[0081] Operator library checks and code optimizations are performed: Based on the prompts, the large model analyzes the generated C code to determine if it contains computational logic that can utilize high-performance operator library functions. For parts that can be optimized, they are either directly replaced with the corresponding operator library function calls, or the code is refactored to meet the requirements of the operator library.
[0082] 2.5 Checking and fixing compilation errors
[0083] Ensure the generated C code can be compiled successfully and run correctly on the M6678 platform. The specific steps are as follows:
[0084] The generated C code is compiled using the M6678 platform's compilation toolchain.
[0085] Check for compilation errors: Record all errors and warnings that occur during the compilation process.
[0086] Generate compilation error repair prompts: Based on the compilation error information, organize a detailed prompt to guide the large model on how to fix these errors.
[0087] Input compilation error repair prompts: Input the generated compilation error repair prompts into the large model.
[0088] Automatic compilation error repair: The large model repairs compilation errors item by item based on the prompts. The repairs include syntax errors, type mismatches, undefined variables or functions, etc.
[0089] Recompile: After fixing the issues, recompile the generated C code to ensure all errors and warnings are resolved. If compilation errors persist, repeat the above steps until compilation succeeds.
[0090] The following examples will further illustrate this application.
[0091] Example 1: Signal Processing Algorithm Conversion
[0092] Input: A MATLAB signal processing algorithm containing 850 lines, implementing adaptive filtering and spectrum analysis.
[0093] Step 1: Initial Code Generation
[0094] 1.1 Based on the structure and function of MATLAB signal processing algorithms, and combined with the knowledge base of the M6678 platform, a detailed hint text is organized. The hint text includes the main logic of the algorithm, the interfaces to be used, multi-core programming rules, cache optimization strategies, and reference to example code.
[0095] 1.2 Input the generated prompt words into the large model LLM (Tsinghua Zhipu GLM4.5).
[0096] 1.3 The main model generates corresponding C code based on the prompt words. The generated C code is extracted and saved for subsequent inspection and optimization.
[0097] Step 2: Check if the generated C code conforms to the MATLAB algorithm.
[0098] 2.1 Based on the logic and structure of the MATLAB algorithm and combined with the knowledge base of the M6678 platform, organize a detailed check prompt word.
[0099] 2.2 Input the generated check prompts into the large model LLM (Tsinghua Zhipu GLM4.5).
[0100] 2.3 The main model verifies the execution logic of the generated C code item by item according to the check prompts to ensure it meets the requirements of the MATLAB algorithm. Based on the check results, the generated C code is directly modified to conform to the requirements of the MATLAB algorithm.
[0101] Step 3: Check if the computation buffer is being used correctly.
[0102] 3.1 Organize a detailed cue word that clearly defines the rules for allocating and using the compute buffers for each core.
[0103] 3.2 Input the generated buffer check prompts into the large model LLM (Tsinghua Zhipu GLM4.5).
[0104] 3.3 The main model checks whether the allocation of the computation buffer in the generated C code conforms to the rules based on the prompt words. Then, it directly modifies the generated C code based on the check results to ensure that the buffer is used correctly.
[0105] Step 4: Check the high-performance operator library
[0106] 4.1 Based on the logic and structure of MATLAB signal processing algorithms and combined with the knowledge base of the M6678 platform, organize a detailed hint word. The hint word should include all possible computational logic parts, and analyze whether these parts can be optimized using the high-performance operator library functions provided by the M6678 platform.
[0107] 4.2 Input the generated operator library check prompt words into the large model LLM (Tsinghua Zhipu GLM4.5).
[0108] 4.3 The main model analyzes the generated C code based on the prompt words to determine if it contains computational logic that can utilize high-performance operator library functions. For parts that can be optimized, they are directly replaced with the corresponding operator library function calls, or the code is refactored to adapt to the requirements of the operator library.
[0109] Step 5: Check and fix compilation errors
[0110] 5.1 Compile the generated C code using the M6678 platform's compilation toolchain.
[0111] 5.2 Record all errors and warnings that occur during the compilation process.
[0112] 5.3 Based on the compilation error information, organize a detailed prompt to tell the large model what compilation errors occurred and where the error code is located.
[0113] 5.4 Input the generated compilation error repair prompts into the large model LLM (Tsinghua Zhipu GLM4.5).
[0114] The 5.5 main model corrects compilation errors one by one based on the prompt words.
[0115] 5.6 After fixing the issue, recompile the generated C code to ensure all errors and warnings are resolved. If compilation errors persist, repeat the above steps until compilation succeeds.
[0116] Through the above steps, this method can effectively convert a complex MATLAB signal processing algorithm into C code that conforms to the M6678 hardware architecture, and ensure its correctness, efficiency and compilability.
[0117] Compared with the prior art, the present invention has the following significant advantages:
[0118] 1. Improved Code Generation Quality: By building a knowledge base specifically for the M6678 hardware platform, large models can generate code that better matches the hardware characteristics, thereby improving code execution efficiency and stability. This solves the performance bottleneck problem in traditional AI code generation.
[0119] 2. Shortened Development Cycle: The method of this invention can automatically convert MATLAB algorithms into C code that is highly adapted to the M6678 hardware architecture, greatly shortening the development cycle of high-performance embedded software. Developers no longer need to write low-level code from scratch, but instead use large models to automatically generate and optimize the code.
[0120] 3. Reduced reliance on low-level hardware experts: Because the knowledge base contains detailed hardware optimization strategies and multi-core programming rules, the large model can generate efficient C code, reducing reliance on low-level hardware experts. Developers can focus more on algorithm design and business logic, while the large model handles the code optimization.
[0121] 4. Enhanced code maintainability: By providing detailed sample code, large-scale models can more quickly master the programming skills of the M6678 platform, resulting in a clearer code structure that is easier to understand and maintain. This facilitates subsequent software maintenance and upgrades.
[0122] Many specific details have been set forth in the foregoing description to provide a thorough understanding of the present invention. However, the above description is merely a preferred embodiment of the present invention, and the present invention can be implemented in many other ways different from those described herein. Therefore, the present invention is not limited to the specific embodiments disclosed above. Furthermore, any person skilled in the art can make many possible variations and modifications to the technical solutions of the present invention, or modify them into equivalent embodiments, using the methods and techniques disclosed above, without departing from the scope of the present invention. Any simple modifications, equivalent changes, and modifications made to the above embodiments based on the technical essence of the present invention, without departing from the content of the present invention, shall still fall within the protection scope of the present invention.
Claims
1. A method for optimizing large language model code generation for the M6678 multi-core DSP platform, characterized in that: Includes the following steps: S1, Building a dedicated knowledge base for M6678: Build a dedicated knowledge base for M6678 that includes interface monitoring templates, multi-core programming rules, cache optimization strategies, high-performance operator libraries, and sample code; S2, Automatic Code Conversion and Optimization: Converts MATLAB algorithms into C code highly adapted to the M6678 hardware architecture, enabling the generated code to be deployed and run directly on the M6678 platform. This includes: initial code generation, MATLAB algorithm checking and repair, computation buffer checking and repair, high-performance operator library checking and repair, and compilation error checking and repair.
2. The method for optimizing large language model code generation for the M6678 multi-core DSP platform according to claim 1, characterized in that: In S1, multi-core programming rules include: Data parallel processing decomposition: The data to be processed is decomposed into multiple independent data blocks so that it can be processed in parallel on multiple cores; Compute buffer splitting: Allocate an independent compute buffer to each core to ensure that each core does not interfere with each other when processing data in its own buffer; Data synchronization mechanism: After multi-core computing is completed, a data synchronization mechanism is used to merge the results of each core to ensure accurate data synchronization between all cores.
3. The method for optimizing large language model code generation for the M6678 multi-core DSP platform according to claim 1, characterized in that: In S1, cache optimization strategies include: Data prefetching and shifting: During the data calculation process, the data on DDR is first shifted to the L2SRAM or MSMC calculation cache area through the DMA controller for calculation; Data partitioning strategy: When L2SRAM and MSMC cache space are insufficient, a data partitioning strategy is adopted, that is, the data is divided into smaller blocks and moved to the computing cache area one by one for processing.
4. The method for optimizing large language model code generation for the M6678 multi-core DSP platform according to claim 1, characterized in that: In S1, the high-performance operator library is a set of basic computational operation functions optimized for the M6678 hardware platform, including vectorized instruction sets and SIMD. Through the operator library, large models can directly call the optimized functions.
5. The method for optimizing large language model code generation for the M6678 multi-core DSP platform according to claim 1, characterized in that: In S1, the example code is a series of code snippets optimized for specific scenarios and tasks, demonstrating how to apply various rules and strategies from the M6678 proprietary knowledge base to actual code development.
6. The method for optimizing large language model code generation for the M6678 multi-core DSP platform according to claim 1, characterized in that: In S2, the initial code generation utilizes the pre-edited M6678 platform-specific knowledge base, MATLAB algorithms, and C code interface definitions to organize and generate prompt words. The specific steps are as follows: Generate prompt words: Based on the structure and function of the MATLAB algorithm and combined with the knowledge base of the M6678 platform, organize a detailed prompt word. The prompt word includes the main logic of the algorithm, the interfaces to be used, multi-core programming rules, cache optimization strategies, and reference to sample code. Input prompts: Input the generated prompts into the large model; Extracting C code: The large model generates corresponding C code based on the prompt words, and extracts and saves the generated C code.
7. The method for optimizing large language model code generation for the M6678 multi-core DSP platform according to claim 1, characterized in that: In S2, MATLAB algorithm checks and fixes include: Generate check prompts: Based on the logic and structure of the MATLAB algorithm and combined with the knowledge base of the M6678 platform, organize a detailed check prompt, which includes the specific functional points to be verified, the expected behavior of the algorithm, and related interfaces and strategies; Input check prompts: Input the generated check prompts into the large model; Execution checks and code repair: Based on the check prompts, the large model verifies the execution logic of the generated C code item by item to ensure it meets the requirements of the MATLAB algorithm. The checks include, but are not limited to, the correctness of the algorithm, the accuracy of interface calls, and the completeness of data processing. Based on the check results, the generated C code is directly modified to conform to the MATLAB algorithm requirements.
8. The method for optimizing large language model code generation for the M6678 multi-core DSP platform according to claim 1, characterized in that: In S2, the computation buffer check and repair include: Generate buffer check prompts: Organize a detailed prompt that clarifies the rules for allocating and using compute buffers for each core; Input buffer check prompts: Input the generated buffer check prompts into the large model; Perform buffer checks and code repairs: Based on the prompts, the large model checks whether the allocation and use of computation buffers in the generated C code conforms to the rules. Verification includes buffer initialization, correct data reading and writing, and the use of synchronization mechanisms. Based on the check results, the generated C code is directly modified to ensure correct buffer usage.
9. The method for optimizing large language model code generation for the M6678 multi-core DSP platform according to claim 1, characterized in that: In S2, the high-performance operator library check and repair includes: Generate operator library check prompts: Organize a detailed prompt, list all possible computational logic parts, and analyze whether these parts can be optimized by the high-performance operator library functions provided by the M6678 platform. The prompts should include the usage rules, constraints, and relevant example code of the operator library functions. Input operator library check prompts: Input the generated operator library check prompts into the large model; Perform operator library checks and code optimization: Based on the prompt words, the large model analyzes whether the generated C code contains computational logic that can use high-performance operator library functions. For parts that can be optimized, they are directly replaced with the corresponding operator library function calls, or the code is refactored to adapt to the requirements of the operator library.
10. The method for optimizing large language model code generation for the M6678 multi-core DSP platform according to claim 1, characterized in that: In S2, the checking and fixing of compilation errors includes: The generated C code is compiled using the M6678 platform's compilation toolchain. Check for compilation errors: Record all errors and warnings that occur during the compilation process; Generate compilation error repair prompts: Based on the compilation error information, organize a detailed prompt to guide the large model on how to fix these errors; Input compilation error repair prompts: Input the generated compilation error repair prompts into the large model; Automatic compilation error repair: The large model repairs compilation errors item by item based on the prompt words. The repair content includes syntax errors, type mismatches, undefined variables or functions, etc. Recompile: After fixing the problem, recompile the generated C code to ensure that all errors and warnings are resolved. If there are still compilation errors, repeat the above steps until compilation succeeds.