Dynamic traversal optimization method, equipment and medium

Through the dynamic ubiquitous optimization method, the genetic algorithm is used to automatically adjust the compilation order, which solves the problem that existing compilers require a lot of manual intervention when optimizing the compilation order, and improves the compilation efficiency and the stability of the compilation results.

CN119536745AActive Publication Date: 2025-02-28SHANDONG INSPUR SCI RES INST CO LTD
View PDF 27 Cites 0 Cited by

Patent Information

Application Number
CN202510105126.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-23
Publication Date
2025-02-28
Estimated Expiration
2045-01-23

AI Technical Summary

Technical Problem

Existing compilers require a lot of manual intervention when optimizing the compilation sequence, resulting in inefficient compilation and difficulty in ensuring optimal compilation results and running performance on various source programs.

Method used

A dynamic parabolic optimization method is proposed, and the genetic algorithm is used to optimize the sequential encoding of the parabolic. Through steps such as initializing populations, compiling source programs, filtering individuals, crossovers and mutations, the compilation sequence is automatically adjusted to optimize memory consumption and running time.

Benefits of technology

It improves compilation efficiency, reduces memory consumption, and controls computing costs through intelligent optimization mechanisms, ensuring the stability and reliability of compilation results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119536745A_ABST
    Figure CN119536745A_ABST
Patent Text Reader

Abstract

The invention discloses a dynamic pass optimization method and device and a medium, and relates to the technical field of program compilation, and the method comprises the steps: initializing a population, and determining a sequence code corresponding to a conversion pass for a plurality of individuals of the population; compiling the source program according to the sequential codes to determine memory consumption and running time in the compiling process, and determining indexes of a population according to the memory consumption and the running time; screening the plurality of individuals according to the index, determining a new sequence code corresponding to the conversion pass after screening, and determining a new index according to the new sequence code; determining a preset index threshold value, and comparing the new index with the index threshold value; if the new index is greater than or equal to the index threshold value, ending optimization; and if the new index is smaller than the index threshold value, optimization is performed again. According to the method, comprehensive optimization of the compiling process is realized through a flexible adjustment strategy, efficient cache utilization, a strict screening mechanism and rich operation diversity.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of program compilation technology, and in particular to a dynamic pass optimization method, device and medium. Background Art

[0002] A "pass" in the compilation process refers to a scan and processing of the source program or its intermediate results from beginning to end, aiming to generate new intermediate results or target codes. The entire compilation process is completed by multiple such passes in collaboration. Depending on whether the intermediate representation structure of the program is changed, the pass is divided into two types: transformation pass and analysis pass. The transformation pass will modify the program structure, while the analysis pass will not. There are dependencies between passes. Some transformation passes need to rely on the results of specific analysis passes as auxiliary information when they are executed. For example, the dead code elimination pass depends on the results of the dominator tree analysis. Since only the transformation pass changes the intermediate representation structure of the program, the results of the analysis pass can be cached and reused when the intermediate structure of the program has not changed.

[0003] The design of the pass follows the modular principle. Each pass is developed independently. The compiler completes the compilation task by executing different passes in coordination, which enhances the reusability and flexibility of the pass. The execution order of the pass is not fixed. Different pass arrangements will result in different memory space required for the intermediate results and different running time of the final compiled executable program.

[0004] Genetic Algorithm (GA) is a heuristic algorithm that draws on the principles of biological evolution in nature to provide a feasible solution for each instance of a combinatorial optimization problem within acceptable computing time and space. Genetic algorithms do not directly deal with the specific parameters of the problem, but encode the entire parameter space and start searching from a set of initial points rather than a single initial point. For different problems, different individual selection strategies, crossover and mutation schemes can be designed to ensure the convergence of the algorithm and the accuracy of the results. Therefore, genetic algorithms have wide applicability, high nonlinearity, easy modifiability and parallelism.

[0005] Mainstream compilers, such as LLVM, use a pass manager to automatically manage the execution order between passes with dependencies, but the order of the remaining transformation passes still needs to be sorted manually. This results in a lot of manpower costs during the compilation and development process. In addition, the fixed transformation pass order makes it difficult to ensure the best compilation results and running performance on various source programs, which has become a bottleneck in the current compiler optimization process, limiting the further improvement of compilation efficiency and generated code quality. Summary of the invention

[0006] In order to solve the above problems, the present application proposes a dynamic pass optimization method, including: initializing a population to determine sequential codes corresponding to transformation passes for multiple individuals of the population; compiling a source program according to the sequential codes to determine the memory consumption and running time of the compilation process, and determining an indicator of the population according to the memory consumption and the running time; screening the multiple individuals according to the indicators to determine new sequential codes corresponding to the transformation passes after screening, and determining new indicators according to the new sequential codes; determining a pre-set indicator threshold, and comparing the new indicator with the indicator threshold; if the new indicator is greater than or equal to the indicator threshold, terminating the optimization; if the new indicator is less than the indicator threshold, re-optimizing.

[0007] In one example, compiling a source program according to the sequential encoding specifically includes: determining whether a result of an analysis pass corresponding to the conversion pass is in a cache; if the result of the analysis pass is not in the cache, executing an analysis pass that is not in the cache to obtain an analysis result, and storing the analysis result in the cache; if the result of the analysis pass is in the cache, determining a cache result, and executing the conversion pass according to the cache result.

[0008] In one example, after executing the conversion pass according to the cached result, the method further includes: determining the analysis pass results whose structure has been changed, and invalidating the analysis pass results whose structure has been changed; checking all conversion passes to determine whether all conversion passes have completed the traversal; if all conversion passes have completed the traversal, terminating the compilation; if all conversion passes have not completed the traversal, continuing the compilation.

[0009] In one example, determining the new sequence code corresponding to the transformation after screening specifically includes: randomly selecting the multiple individuals to determine the first sequence code and the second sequence code, and determining a pre-set cross sequence code; cross-filling the cross sequence code according to the first sequence code and the second sequence code.

[0010] In one example, the cross-sequence code is cross-filled according to the first sequence code and the second sequence code, specifically including: determining the reserved number of the first sequence code, and filling the content corresponding to the reserved number into the position of the corresponding number of the cross-sequence code; determining the number of remaining numbers of the cross-sequence code after filling, and screening all the numbers of the second sequence code in sequence according to the number to determine the screening number; and filling the content corresponding to the screening number into the position of the remaining number in sequence.

[0011] In one example, determining the new sequence code corresponding to the transformation after screening specifically also includes: randomly selecting the multiple individuals to obtain a random sequence code, and determining all the numbers of the random sequence code; determining a pre-set cross sequence code, and mutating and filling the cross sequence code according to the all the numbers.

[0012] In one example, the cross-sequence code is mutated and filled according to all the numbers, specifically including: determining the variant number group of the random sequence code, exchanging the content corresponding to the variant number group, and filling the exchanged content into the position of the corresponding number of the cross-sequence code; determining the remaining numbers outside the variant number group in the random sequence code, and filling the content corresponding to the remaining numbers into the position of the corresponding number of the cross-sequence code.

[0013] In one example, the sequence code includes a plurality of positions, the plurality of positions correspond to a plurality of numbers, and the plurality of numbers correspond to a plurality of conversion passes.

[0014] On the other hand, the present application also proposes a dynamic pass optimization device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the dynamic pass optimization device can execute: initializing a population to determine sequential codes corresponding to transformation passes for multiple individuals of the population; compiling a source program according to the sequential codes to determine the memory consumption and running time of the compilation process, and determining an index of the population according to the memory consumption and the running time; screening the multiple individuals according to the index, determining a new sequential code corresponding to the transformation pass after screening, and determining a new index according to the new sequential code; determining a pre-set index threshold, and comparing the new index with the index threshold; if the new index is greater than or equal to the index threshold, terminating the optimization; if the new index is less than the index threshold, re-optimizing.

[0015] On the other hand, the present application also proposes a non-volatile computer storage medium storing computer executable instructions, wherein the computer executable instructions are configured to: initialize a population to determine sequential codes corresponding to transformation passes for multiple individuals of the population; compile a source program according to the sequential codes to determine the memory consumption and running time of the compilation process, and determine an index of the population according to the memory consumption and the running time; screen the multiple individuals according to the index to determine a new sequential code corresponding to the transformation passes after screening, and determine a new index according to the new sequential code; determine a pre-set index threshold, and compare the new index with the index threshold; if the new index is greater than or equal to the index threshold, end the optimization; if the new index is less than the index threshold, re-optimize.

[0016] The present application realizes flexible adjustment and optimization of the compilation process by initializing the population and determining the sequential encoding of the transformation pass. The optimization strategy based on the population helps to explore multiple possible compilation orders, so as to find the optimal solution for memory consumption and running time. After determining whether the analysis pass result corresponding to the sequential encoding is in the cache, the analysis pass is selectively executed or the cache result is directly used, which greatly improves the compilation efficiency and reduces unnecessary repeated calculations. The present application continuously iterates and optimizes the sequential encoding of the transformation pass through a strict screening and updating mechanism. By comparing the new index with the preset index threshold, it can be intelligently determined when to end the optimization, thereby controlling the calculation cost while ensuring the optimization effect. In operations such as cross-filling and mutation filling, randomness and diversity are introduced, which helps to jump out of the local optimal solution and explore a wider solution space, so as to find a globally better compilation order. The present application considers multiple aspects such as invalid processing of the analysis pass results with changed structures and traversal checking of the transformation pass, ensuring the stability and reliability of the compilation process. The present application proposes a sequential encoding method for the transformation pass, and a crossover and mutation method based on the sequential encoding of the transformation pass, thereby realizing the mathematical modeling and generation of feasible solutions for the pass order. On this basis, a dynamic pass optimization algorithm based on genetic algorithm was designed. Compared with the traditional pass manager, it can automatically complete the compilation, execution and search of different pass execution orders, and solve the optimal pass execution order, thereby improving the running performance of the compiled program. It not only improves the compilation efficiency and reduces memory consumption, but also provides new ideas and directions for compiler optimization. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings: Figure 1 A schematic diagram of a flow chart of a dynamic optimization method in an embodiment of the present application; Figure 2 A schematic diagram of cross-sequence coding generation in an embodiment of the present application; Figure 3 A schematic diagram of the generation of variant sequence encoding in an embodiment of the present application; Figure 4 It is a schematic diagram of a dynamic optimization device in an embodiment of the present application. DETAILED DESCRIPTION

[0018] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.

[0019] The technical solutions provided by various embodiments of the present application are described in detail below in conjunction with the accompanying drawings.

[0020] like Figure 1 As shown, in order to solve the above problems, an embodiment of the present application provides a dynamic optimization method, the method comprising: S101. Initialize a population to determine sequential codes corresponding to transformations of a plurality of individuals in the population.

[0021] The population of a genetic algorithm is a collection of individuals that represent potential solutions in the solution space. Each individual represents a solution to the problem through a specific encoding method, such as binary encoding, real number encoding, etc. During the operation of the genetic algorithm, the population continues to evolve by simulating operations such as selection, crossover, and mutation in the biological evolution process to seek the optimal solution or approximate optimal solution to the problem. At the beginning of the genetic algorithm, a population needs to be initialized. This is usually achieved by randomly generating a group of individuals, each of which represents a potential solution, and randomly initializing a transformation sequence code for each individual in the population.

[0022] In one embodiment, in the encoding method, an array of length n is used as the initialization code. Each position in the array represents the running order of the transformation pass, and the number filled in each position corresponds to a different transformation pass. For example, if the number filled in the second position of the array is 3, then this means that in the running order of the transformation pass, the number of the second transformation pass executed is 3. Such an encoding method is clear and can ensure that each transformation pass is uniquely identified and can accurately reflect their running order.

[0023] S102: Compile the source program according to the sequential encoding to determine the memory consumption and running time of the compilation process, and determine the index of the population according to the memory consumption and the running time.

[0024] The source program is compiled, optimized and executed according to the conversion pass sequence encoding, and then the memory consumption during the compilation process and the actual running time of the program are counted. These two data are used as important indicators to evaluate the performance of each individual in the population. Specifically, the lower the memory consumption, the less system resources the compilation process occupies; the shorter the program running time, the higher the program execution efficiency. Therefore, both memory consumption and program running time are negatively correlated with the indicators, that is, the lower the value, the higher the corresponding indicator. Such an evaluation mechanism helps to accurately measure and optimize the performance of individuals in the population.

[0025] In one embodiment, the number of the conversion pass that needs to be executed currently is determined according to the conversion pass sequence code. At the beginning, it is checked whether the analysis pass result required by the conversion pass is stored in the cache. If it exists in the cache, the analysis result in the cache is used to execute the task of the current conversion pass. After the conversion pass is executed, the analysis pass result that becomes invalid due to the change of the code structure is marked as invalid to ensure the data consistency in the cache. If the required analysis pass result does not exist in the cache, the corresponding analysis pass is executed, and the calculated result is saved in the cache for subsequent use.

[0026] Determine whether all the transformation passes in the transformation pass sequence encoding have been traversed. If yes, end the entire process; if not, return to the starting step and continue to execute the next transformation pass.

[0027] S103, screening the multiple individuals according to the indicator, determining a new sequence code corresponding to the transformation after screening, and determining a new indicator according to the new sequence code.

[0028] A probabilistic elimination screening mechanism is implemented based on the indicators of each individual and the pre-set elimination threshold. Specifically, individuals with higher indicators have a higher probability of being retained to continue to participate in the subsequent evolution process; on the contrary, individuals with lower indicators face a higher risk of being eliminated. This mechanism ensures the continuation of excellent individuals in the population, while promoting the overall optimization and evolution of the population.

[0029] A new sequential code is generated for the transformation passes of the screened individuals. Due to the constraints unique to the encoding method of the transformation passes, each transformation pass number can only appear once in the code to ensure the correctness and efficiency of the compilation process and prevent duplicate numbering.

[0030] In one embodiment, the crossover method is an important step in the genetic algorithm, which aims to generate new offspring individuals by combining the genetic information of two parent individuals. In the crossover process of the transformation sequence code, the transformation sequence codes of two individuals are randomly selected from the original population as parents. Then, for the selected first transformation sequence code (referred to as the first sequence code here), the numbers at each position of the first sequence code are traversed. A preset random probability is used to determine whether the number at this position is retained in the new crossover sequence code. This probability can be adjusted according to the needs of the specific problem to balance the diversity of new individuals and the inheritance of excellent genes of the parent generation. For the selected second transformation sequence code (referred to as the second sequence code here), check whether the number of the second sequence code has appeared in the crossover code. For the numbers that do not appear in the crossover code, they are filled in the remaining positions of the crossover code in sequence according to their order in the second sequence code. In this way, a new crossover sequence code is generated, which integrates the genetic information of the first sequence code and the second sequence code, while ensuring that the number of each transformation appears only once in the code. As Figure 2 As shown in the figure, there are two parent conversion sequence codes with a code length of 8. For parent conversion sequence code 1, i.e., parent 1, the index starts from 0, and the numbers 5, 1, 7, and 6 at positions 1, 3, 4, and 7 are directly retained in the corresponding positions in the cross conversion sequence code. For parent conversion sequence code 2, i.e., parent 2, the numbers 2, 4, 3, and 8 that do not appear in the cross code are filled in the remaining positions of the cross code in order. In this way, a cross sequence code that contains both excellent genes of the parent and new characteristics is generated.

[0031] In one embodiment, the mutation method is another key link in the genetic algorithm, which aims to increase the diversity of the population by introducing new gene mutations. In the mutation process of the transformation sequence code, the transformation sequence code of an individual is randomly selected from the original population as the mutation object. Then, a loop process is started, and each loop randomly selects a pair of numbers that have not been selected, that is, the transformation numbers at two positions (herein referred to as the mutation number group). Next, it is decided whether to exchange this pair of numbers with a preset random probability. This probability is usually small to ensure the sparsity of the mutation operation and the moderate impact on the diversity of the population. In each loop, it is checked whether all numbers have been queried. Once all pairs of numbers have been considered, regardless of whether they have been exchanged, the mutation process ends, and a new mutated sequence code is obtained. As Figure 3As shown in the figure, starting from index 0, the numbers at positions 1 and 5 are randomly selected, which are 5 and 4 respectively. After random probability query, it is decided to swap these two numbers. After probability query, it is decided not to swap the numbers at other positions. In this way, a mutated sequential encoding is obtained, which maintains most of the features of the original encoding while introducing new mutation elements, which helps to explore new areas in the solution space.

[0032] S104: Determine a preset indicator threshold, and compare the new indicator with the indicator threshold.

[0033] S105: If the new index is greater than or equal to the index threshold, the optimization is terminated.

[0034] S106: If the new indicator is smaller than the indicator threshold, re-optimize.

[0035] In the process of genetic evolution, the results after each round of evolution are evaluated to determine whether the expected optimization goal has been achieved. Specifically, after each genetic evolution is completed, the indicators of individuals in the current population will be calculated and judged. If this indicator reaches the preset threshold, it means that we have obtained a solution that meets the requirements or is good enough, and the cycle of genetic evolution can be terminated at this time. On the contrary, if the indicator has not reached the threshold, it is necessary to continue to evolve to find a better solution. In this case, the algorithm will jump back to step S101, that is, re-select, crossover, mutation and other genetic operations, and start a new round of evolution cycle until a solution that meets the conditions is found or the preset maximum number of evolution generations is reached. Such a design can ensure that the algorithm can find the optimal or approximately optimal solution as much as possible within limited computing resources.

[0036] like Figure 2 As shown, the embodiment of the present application also provides a dynamic optimization device, including: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the dynamic optimization device to perform: Initializing a population to determine sequential codes corresponding to transformations for a plurality of individuals of the population; Compiling the source program according to the sequential encoding to determine the memory consumption and running time of the compilation process, and determining the index of the population according to the memory consumption and the running time; Screening the multiple individuals according to the indicator, determining a new sequence code corresponding to the transformation after screening, and determining a new indicator according to the new sequence code; Determine a preset indicator threshold, and compare the new indicator with the indicator threshold; If the new index is greater than or equal to the index threshold, the optimization is terminated; If the new index is smaller than the index threshold, the optimization is performed again.

[0037] The embodiment of the present application further provides a non-volatile computer storage medium storing computer executable instructions, wherein the computer executable instructions are configured as follows: Initializing a population to determine sequential codes corresponding to transformations for a plurality of individuals of the population; Compiling the source program according to the sequential encoding to determine the memory consumption and running time of the compilation process, and determining the index of the population according to the memory consumption and the running time; Screening the multiple individuals according to the indicator, determining a new sequence code corresponding to the transformation after screening, and determining a new indicator according to the new sequence code; Determine a preset indicator threshold, and compare the new indicator with the indicator threshold; If the new index is greater than or equal to the index threshold, the optimization is terminated; If the new index is smaller than the index threshold, the optimization is performed again.

[0038] Each embodiment in this application is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device and medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.

[0039] The devices and media provided in the embodiments of the present application correspond one-to-one to the methods. Therefore, the devices and media also have similar beneficial technical effects as the corresponding methods. Since the beneficial technical effects of the methods have been described in detail above, the beneficial technical effects of the devices and media will not be repeated here.

[0040] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt 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 codes.

[0041] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0042] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0043] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

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

[0045] Memory may include non-permanent storage in a computer-readable medium, in the form of random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.

[0046] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules 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 technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0047] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0048] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims

1. A dynamic optimization method, characterized in that: include: Initializing a population to determine sequential codes corresponding to transformations for a plurality of individuals of the population; Compiling the source program according to the sequential encoding to determine the memory consumption and running time of the compilation process, and determining the index of the population according to the memory consumption and the running time; Screening the multiple individuals according to the indicator, determining a new sequence code corresponding to the transformation after screening, and determining a new indicator according to the new sequence code; Determine a preset indicator threshold, and compare the new indicator with the indicator threshold; If the new index is greater than or equal to the index threshold, the optimization is terminated; If the new index is smaller than the index threshold, the optimization is performed again.

2. The method according to claim 1, characterized in that Compiling the source program according to the sequential coding specifically includes: Determining whether a result of an analysis pass corresponding to the conversion pass is in a cache; If the result of the analysis pass is not in the cache, performing the analysis pass that is not in the cache to obtain an analysis result, and storing the analysis result in the cache; If the result of the analysis pass is in the cache, then the cached result is determined, and the conversion pass is performed based on the cached result.

3. The method according to claim 2, characterized in that After performing the conversion according to the cached result, the method further includes: Determine the analysis results whose structure has been changed, and invalidate the analysis results whose structure has been changed; Check all the conversion passes to determine whether all the conversion passes have been completed; If all transformations are completed, the compilation ends; If all the conversion passes have not been completed, continue compiling.

4. The method according to claim 1, characterized in that: Determine the new sequence code corresponding to the transformation after screening, specifically including: Randomly selecting the plurality of individuals to determine a first sequence code and a second sequence code, and determining a preset cross-sequence code; The cross-sequence code is cross-filled according to the first sequence code and the second sequence code.

5. The method according to claim 4, characterized in that The cross-sequence code is cross-filled according to the first sequence code and the second sequence code, specifically comprising: Determine the reserved number of the first sequence code, and fill the content corresponding to the reserved number into the position of the corresponding number of the cross sequence code; Determine the number of remaining serial numbers of the cross-sequence code after filling, and screen all serial numbers of the second sequence code in order according to the number to determine the screening number; The contents corresponding to the screening numbers are sequentially filled into the positions of the remaining numbers.

6. The method according to claim 1, characterized in that Determining the new sequence code corresponding to the transformation after screening, specifically also includes: Randomly selecting the multiple individuals to obtain a random sequence code, and determining all numbers of the random sequence code; A preset cross sequence code is determined, and the cross sequence code is mutated and filled according to all the serial numbers.

7. The method according to claim 6, characterized in that The cross sequence code is mutated and filled according to all the numbers, specifically including: Determine a variation number group of the random sequence code, exchange the content corresponding to the variation number group, and fill the exchanged content into the position of the number corresponding to the cross sequence code; The remaining numbers outside the variation number group are determined in the random sequence code, and the contents corresponding to the remaining numbers are filled into the positions of the numbers corresponding to the cross sequence code.

8. The method according to claim 1, characterized in that The sequential code includes a plurality of positions, the plurality of positions correspond to a plurality of numbers, and the plurality of numbers correspond to a plurality of conversion passes.

9. A dynamic optimization device, characterized in that: include: at least one processor; as well as, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the dynamic optimization device to perform: Initializing a population to determine sequential codes corresponding to transformations for a plurality of individuals of the population; Compiling the source program according to the sequential encoding to determine the memory consumption and running time of the compilation process, and determining the index of the population according to the memory consumption and the running time; Screening the multiple individuals according to the indicator, determining a new sequence code corresponding to the transformation after screening, and determining a new indicator according to the new sequence code; Determine a preset indicator threshold, and compare the new indicator with the indicator threshold; If the new index is greater than or equal to the index threshold, the optimization is terminated; If the new index is smaller than the index threshold, the optimization is performed again.

10. A non-volatile computer storage medium storing computer executable instructions, characterized in that: The computer executable instructions are configured to: Initializing a population to determine sequential codes corresponding to transformations for a plurality of individuals of the population; Compiling the source program according to the sequential encoding to determine the memory consumption and running time of the compilation process, and determining the index of the population according to the memory consumption and the running time; Screening the multiple individuals according to the indicator, determining a new sequence code corresponding to the transformation after screening, and determining a new indicator according to the new sequence code; Determine a preset indicator threshold, and compare the new indicator with the indicator threshold; If the new index is greater than or equal to the index threshold, the optimization is terminated; If the new index is smaller than the index threshold, the optimization is performed again.

Citation Information

Patent Citations

  • Efficient optimization method for calculation cost constraint problem in compilation optimization

    CN110321116A

  • Deep neural network structure optimization method based on fusion of prediction mechanism and genetic algorithm

    CN110490320A

  • Unmanned ship path planning method and system based on data forward and reverse driving linear variable parameter genetic algorithm

    CN110516877A

  • Agent modeling method for multi-objective compilation optimization sequence selection

    CN112035116A

  • Generation of dynamic design flows for integrated circuits

    CN113795843A