Dynamic binary translation method and device based on neural network assisted simulated annealing

By introducing neural network assistive technology into the simulated annealing algorithm, using sensitivity analysis and dynamic parameter adjustment, the problem of low exploration efficiency of simulated annealing algorithm in the dynamic binary translation system is solved, and more efficient optimization and translation performance is achieved.

CN119987787AActive Publication Date: 2025-05-13INST OF COMPUTING TECH CHINESE ACAD OF SCI
View PDF 18 Cites 0 Cited by

Patent Information

Application Number
CN202510467133.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-15
Publication Date
2025-05-13
Estimated Expiration
2045-04-15

AI Technical Summary

Technical Problem

In the prior art, simulation annealing algorithms are inefficient in exploration in dynamic binary translation systems, which makes it difficult to effectively explore the optimization option combination space, affecting translation efficiency and performance.

Method used

A simulated annealing algorithm based on neural network assisted is used to optimize the simulation annealing exploration process through sensitivity analysis, search path guidance and dynamic parameter adjustment to improve convergence efficiency.

Benefits of technology

It significantly improves the optimization efficiency of the dynamic binary translation system, and can intelligently select and adjust optimization options, reduce waste of computing resources, and improve translation efficiency and performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119987787A_ABST
    Figure CN119987787A_ABST
Patent Text Reader

Abstract

The invention provides a dynamic binary translation method and device based on neural network assisted simulated annealing. The dynamic binary translation method comprises the following steps: generating an optimization option of a running command; predicting an optimal optimization option value vector corresponding to the operation command; exploring an optimal optimization option for binary translation of a running command by taking the optimal optimization option value vector as initial input of simulated annealing exploration operation; and performing binary translation on the running command based on the optimal optimization option. According to the method, seamless connection from a data flow to a control flow is ensured through a highly automatic process, data are automatically transmitted among the modules, the modules work cooperatively, possible errors and delay caused by manual intervention are avoided, and the efficiency and stability of an optimization process are improved; meanwhile, parameters can be automatically monitored and adjusted, it is ensured that the whole process has the wide-area exploration capacity, and precise convergence can be achieved in the later period, so that the optimization target is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of computer technology, and particularly relates to a dynamic binary translation method and device based on neural network assisted simulated annealing. Background Art

[0002] There are many instruction set architectures. Many emerging instruction set architectures (such as RISC-V) have attracted attention from academia and industry due to their open source characteristics, flexibility and scalability. However, compared with mature instruction set architectures (such as x86 and ARM), the maturity of the ecosystem of emerging instruction set architectures needs to be improved. In order to accelerate the construction of the ecosystem and the promotion of applications, the binary translation system has become an important way to migrate software across instruction set architectures.

[0003] The binary translation system contains a large number of optimization parameters and optional values, which constitute a huge optimization combination space. Taking the Box64 simulator to translate x86 architecture instructions into RISC-V architecture instructions as an example, Box64 has provided 11 relatively mature optimization options so far, forming an exploration space of 30720. These optimization options directly affect the quality and performance of the generated target architecture instruction code. However, modifying the value of the optimization option during program execution can only affect the code that has not been translated, and has no effect on the translated code. This situation where optimized code blocks coexist with non-optimized code blocks will not only lead to distortion of performance evaluation, but may even cause program crashes. Therefore, the current setting of optimization options must be completed before the program runs, and cannot be dynamically adjusted during program execution.

[0004] In addition, the optimization options have different effects on different applications. For example, when the value of the BOX64_DYNAREC_BIGBLOCK option is set to 2, 401.bzip2 achieves a 1.61% improvement in binary translation efficiency, while 403.gcc suffers a 3.98% decrease in translation efficiency. The complex interactions between optimization options and their high dependence on application scenarios make it difficult to predict the actual benefits of each option in advance during the optimization process. If the optimization option combination is re-specified for each test and the program is fully run, a single-threaded test of the SPEC CPU 2006 INT test set takes more than 10 hours when the input size is ref. If all possible optimization combinations are exhausted for each application to find the optimal solution, more than 300,000 hours of CPU single-core time will be consumed. In order to avoid the reduction of test accuracy caused by L3 cache pollution, experiments usually avoid running multiple sets of tests on different cores of the same server at the same time, which further increases the difficulty of space exploration.

[0005] In terms of dynamic binary translation system optimization, many technologies have proposed different solutions. The following patents optimize the system from different perspectives.

[0006] China's national patent "Dynamic binary translation method and system based on speculative x86 flag calculation" (publication number: CN117234526A) proposes a dynamic binary translation method based on speculative x86 flag calculation, which obtains the basic block of the client program and translates the client instruction sequence in the basic block into a semantically equivalent host instruction sequence.

[0007] China's national patent "A binary translation method based on rule learning for virtualization" (publication number: CN113885883A) completes the pre-translation training based on the code to be translated and the target code for the translation learning model, which is used to automatically obtain translation rules and accelerate the speed of the dynamic binary translation system. The idea of ​​neural network-assisted optimization of the dynamic binary translation system is also used.

[0008] China's national patent "Casing length optimization method, system and terminal for mandrel hanger" (publication number: CN119249849A) is based on the simulated annealing algorithm. It converts the length distribution problem of the mandrel hanger casing into a combinatorial optimization problem, randomly searches in the solution space and gradually optimizes to find the optimal length closest to the target. Its problem-solving idea is to convert the actual problem into a combinatorial optimization problem and explore the optimal solution through the simulated annealing algorithm.

[0009] China's national patent "A method, system and storage medium for scheduling edge computing tasks based on genetic simulated annealing algorithm" (publication number: CN119415227A) introduces another improvement of the simulated annealing algorithm, which combines the global search characteristics of the genetic algorithm to obtain better decision results.

[0010] China's national patent "A method for solving the power system unit combination model based on an improved simulated annealing algorithm" (publication number: CN119442868A) improves the global search capability and convergence speed through a multiple starting point strategy.

[0011] China's national patent "A multi-sampling rate observation system optimization method based on improved simulated annealing" (publication number: CN119414456A) improves the efficiency and accuracy of optimization calculations by improving annealing functions and probability functions.

[0012] China's national patent "Weaving flexible workshop production scheduling method based on NSGA-II improvement" (publication number: CN118657448A) combines the rapid search capability of the artificial bee colony algorithm to conduct a preliminary search of the initial population and combines simulated annealing to conduct a local search of the Pateto solution.

[0013] The Chinese national patents "Data detection method based on simulated annealing neural network and interference elimination" (publication number: CN108282437A) and "Method for predicting water turbidity based on BP neural network optimized by simulated annealing algorithm" (publication number: CN119047295A) also introduce the strategy of combining simulated annealing algorithm with neural network. They both use simulated annealing algorithm to assist the training process of neural network and optimize the weight and threshold parameter values ​​of the network.

[0014] China's national patent "Metering task synchronization scheduling method and system based on improved simulated annealing algorithm" (publication number: CN119383187A) introduces an improved simulated annealing algorithm, the improvement of which mainly involves the introduction of the Metropolis criterion and the improvement of the ending criterion. Summary of the invention

[0015] In view of the problem of low exploration efficiency of simulated annealing algorithm in the prior art, the present invention proposes a dynamic binary translation method, including: generating multiple optimization options for binary translation according to the running command of the target application, quantifying the sensitivity corresponding to the translation efficiency of the optimization option, sorting according to the sensitivity, and dividing the optimization option into a plurality of optimization option sets with exploration weights according to the sorting result; constructing a coarse-grained exploration model, and predicting the optimal optimization option value vector corresponding to the running command based on the running command; setting the initial parameters of the simulated annealing exploration operation, taking the optimal optimization option value vector as the starting input of the simulated annealing exploration operation, and exploring the best optimization option for binary translation of the running command in the optimization option set; and performing binary translation on the running command based on the best optimization option.

[0016] Furthermore, the steps of the simulated annealing exploration operation specifically include: setting the initial parameters, which include the initial temperature, the cooling coefficient, the iterative stability threshold and the termination temperature; obtaining the dynamic threshold of the acceptable new solution for each iteration round of the simulated annealing exploration operation, and generating the perturbation range of the new parameter combination; based on the initial parameters, the dynamic threshold, the perturbation range and the starting input, performing iterative calculations to obtain the best optimization option.

[0017] Furthermore, the dynamic threshold dynamic_threshold=threshold×(temperature / T), threshold is the preset update threshold, temperature is the temperature of the current iteration round, and T is the initial temperature; the disturbance is randomly generated within the range of the maximum offset max_offset, max_offset=max(min_step_size,int(round(len(options)×step_size×(temperature / T)))), step_size is the offset step size, min_step_size is the minimum offset step size, and len(options) is the number of possible values ​​for the optimization option.

[0018] Furthermore, a neural network predictor is constructed, and the solution S' obtained in the current iteration round is evaluated by the neural network predictor. If the performance of solution S' is better than the optimal solution S obtained in the previous iteration round, the optimal solution S is updated with solution S'; if the performance of solution S' is worse than the optimal solution S, but the performance difference meets the dynamic threshold of the current iteration round, solution S' is accepted with probability P to update the optimal solution S; if the performance of solution S' is worse than the optimal solution S, and the performance difference does not meet the dynamic threshold of the current iteration round, solution S' is discarded; if after the optimal solution S is updated in a certain iteration round, the performance of each solution S' obtained in N consecutive iteration rounds does not meet the requirements for updating the optimal solution S, after N iterations, the optimal solution S is taken as the final optimal solution, and the N iteration rounds are defined as the inspection window of the optimal solution S, the optimal solution S is the solution after inspection, and N is called the iteration stability threshold; the optimal solution S when the inspection window reaches the iteration stability threshold or the simulated annealing reaches the termination temperature is the best optimization option.

[0019] The present invention also proposes a dynamic binary translation device based on neural network assisted simulated annealing, including: a preparation module, used for performing preparation operations before simulated annealing exploration operations; including: generating multiple optimization options for binary translation according to the running command of the target application, quantifying the sensitivity corresponding to the translation efficiency of the optimization option, sorting according to the sensitivity, and dividing the optimization option into a plurality of optimization option sets with exploration weights according to the sorting results; constructing a coarse-grained exploration model, based on the running command, predicting the optimal optimization option value vector corresponding to the running command; an exploration module, used for setting the initial parameters of the simulated annealing exploration operation, taking the optimal optimization option value vector as the starting input of the simulated annealing exploration operation, and exploring the best optimization option for binary translation of the running command in the optimization option set; a translation module, used for binary translation of the running command based on the best optimization option.

[0020] Furthermore, the exploration operation module includes: an initialization module for setting the initial parameters, which include initial temperature, cooling coefficient, iterative stability threshold and termination temperature; a dynamic threshold acquisition module for obtaining the dynamic threshold of an acceptable new solution for each iteration round of the simulated annealing exploration operation; a perturbation acquisition module for obtaining the perturbation range of a new parameter combination generated for each iteration round of the simulated annealing exploration operation; and an iteration module for performing iterative calculations based on the initial parameters, the dynamic threshold, the perturbation range and the starting input to obtain the best optimization option.

[0021] Furthermore, the dynamic threshold dynamic_threshold=threshold×(temperature / T), threshold is the preset update threshold, temperature is the temperature of the current iteration round, and T is the initial temperature; the disturbance is randomly generated within the range of the maximum offset max_offset, max_offset=max(min_step_size,int(round(len(options)×step_size×(temperature / T)))), step_size is the offset step size, min_step_size is the minimum offset step size, and len(options) is the number of possible values ​​for the optimization option.

[0022] Furthermore, the iteration module includes: an evaluation module, which is used to construct a neural network predictor, and evaluate the solution S' obtained in the current iteration round through the neural network predictor; a selection module, which is used for the neural network predictor to obtain the evaluation result and select the optimal solution S of the current iteration round; if the solution S' obtained in the current iteration round has better performance than the optimal solution S of the current iteration round, the optimal solution S is updated with the solution S'; if the performance of the solution S' is worse than the optimal solution S, but the performance difference meets the dynamic threshold of the current iteration round, the solution S' is accepted with probability P to update the optimal solution S; if the performance of the solution S' is worse than the optimal solution S , and its performance difference does not meet the dynamic threshold of the current iteration round, the solution S' is discarded; a result acquisition module is used to obtain the best optimization option; including: if after the optimal solution S is updated in a certain iteration round, the performance of each solution S' obtained in N consecutive iteration rounds does not meet the updated optimal solution S, after N iterations, the optimal solution S is taken as the final optimal solution, and the N iteration rounds are defined as the inspection window of the optimal solution S, and the optimal solution S is the solution after inspection, then N is called the iteration stability threshold; the optimal solution S when the inspection window reaches the iteration stability threshold or the simulated annealing reaches the termination temperature is the best optimization option.

[0023] The present invention also provides an electronic device, comprising the dynamic binary translation device based on neural network assisted simulated annealing as described above.

[0024] The present invention also proposes a computer-readable storage medium storing computer-executable instructions, characterized in that when the computer-executable instructions are executed, the dynamic binary translation method based on neural network-assisted simulated annealing as described above is implemented.

[0025] The present invention adopts neural network auxiliary technology to accelerate the convergence process and improve the optimization efficiency through sensitivity analysis, search path guidance and dynamic parameter adjustment. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] Figure 1 It is a flow chart of the dynamic binary translation method of the present invention.

[0027] Figure 2 It is a simulated annealing refinement exploration flow chart of the dynamic binary translation method of the present invention.

[0028] Figure 3 It is a pseudo code schematic diagram of simulated annealing refinement exploration of the dynamic binary translation method of the present invention.

[0029] Figure 4 It is a schematic diagram of the double-layer optimization execution of the dynamic binary translation method of the present invention.

[0030] Figure 5 It is a schematic diagram of the dynamic binary translation device of the present invention.

[0031] Figure 6 It is a schematic diagram of an electronic device of the present invention.

[0032] Figure 7 It is a schematic diagram of the hardware structure of an electronic device of the present invention.

[0033] Wherein, the accompanying drawings are marked as follows:

[0034] 100: Electronic equipment 10: Dynamic binary translation device

[0035] 11: Preparation module 111: Sensitivity detection module

[0036] 112: Neural Network Prediction Module 12: Exploration Module

[0037] 121: Initialization module 122: Dynamic threshold acquisition module

[0038] 123: Disturbance acquisition module 124: Iteration module

[0039] 13: Translation module

[0040] S1, S2, S3, S4, S401, S402, S403, S404, S405, S406, S407, S408, S409, S410, S411, S412, S413, S5, S6, S7: Steps DETAILED DESCRIPTION

[0041] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation method described herein is only used to explain the present invention and is not used to limit the present invention.

[0042] It should be noted that, in this application, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprises" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article 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, article or device.

[0043] Without more constraints, an element defined by the phrase "comprising a..." does not exclude the existence of other identical elements in the process, method, article or apparatus comprising the element.

[0044] In order to address the problem of low exploration efficiency of simulated annealing algorithms in the prior art, the present invention designs and implements an intelligent configuration method for optimization options based on a simulated annealing algorithm assisted by a neural network. More specifically, the present invention proposes a dynamic binary translation method based on simulated annealing assisted by a neural network, and introduces neural network assisted technology on the basis of the traditional simulated annealing algorithm. Through sensitivity analysis, search path guidance, and dynamic parameter adjustment, the approximate optimal optimization option combination for each application is efficiently explored. Through this method, the system can intelligently select and adjust optimization options, avoid blind trial and error, reduce the waste of computing resources in the optimization process, and improve the efficiency and performance of binary translation.

[0045] Based on the binary translation optimization combination space of the prior art, in order to cope with the challenges of high-dimensional solution space, complex interactions between optimization options, high dependence on application scenarios and high testing overhead, the present invention introduces neural network auxiliary technology to accelerate the convergence process through sensitivity analysis, search path guidance and dynamic parameter adjustment, and finally finds the approximate optimal value of each optimization option, and combines them to generate the approximate optimal option configuration.

[0046] Academia and industry generally use the “translation efficiency E” as shown in formula (1) to quantify the performance of binary translation systems. local It is the time taken for the application to execute natively, that is, the time taken to run the natively compiled binary program directly on the target platform. BinaryTranslation It is the time it takes for an application to execute based on binary translation, that is, the time it takes to simulate the execution of the source program on the target platform using binary translation technology. Taking the binary translation of x86 programs to RISC-V platform as an example, native execution means that the source code is directly compiled and executed on the RISC-V platform; binary translation execution means that the source code is compiled on the x86 platform, and the compiled application is executed on the RISC-V platform using binary translation technology. The time consumption of the two is obtained by combining the performance monitoring unit (PMU), and the ratio of the time consumption is the translation efficiency.

[0047] (1)

[0048] Figure 1 This is a flow chart of the dynamic binary translation method of the present invention. Figure 1 As shown, in the first embodiment of the present invention, a dynamic binary translation method based on neural network assisted simulated annealing is proposed, which specifically includes:

[0049] Step S1, input initialization

[0050] At the beginning of the algorithm, the input initialization operation must be performed first, that is, the running commands of the target application are provided to the binary translation system to clarify the set of optimization options that need to be explored.

[0051] Step S2, sensitivity detection

[0052] Given that different optimization options have inconsistent effects on different applications, the direction and magnitude of the effects are uncertain; and given that the exploration space is huge, the time overhead of direct comprehensive exploration is unacceptable. In order to improve the efficiency of the algorithm, it is necessary to detect and analyze the sensitivity of each optimization option to the performance. The sensitivity of each optimization option is defined as the impact of a specific optimization option on the translation efficiency of the binary translation system. Specifically, the value with the largest difference in translation efficiency between the various values ​​of an option and the translation efficiency corresponding to the default value of the option is selected, and the translation efficiency E corresponding to this value is used. test Translation efficiency E corresponding to the default value of the optimization option default The sensitivity of each optimization option is quantified by comparing the proportional changes, as shown in formula (2).

[0053] (2)

[0054] The sensitivity of each optimization option is calculated based on the test data to generate a sensitivity ranking sequence. Based on the generated sensitivity ranking sequence, after locking the high-sensitivity option, the "sensitive subspace" can be focused on in the subsequent automated exploration process: the high-sensitivity option will be given priority or given priority in the subsequent optimization space exploration, while the low-sensitivity option can be postponed or relatively fixed to reduce unnecessary combination exploration. Sensitivity detection provides intelligent guidance for traditional parameter space exploration algorithms, which is expected to improve global exploration efficiency.

[0055] The core of sensitivity detection lies in the experiment of changing the value of a single option. The binary translation system defines the default configuration of the optimization option space. First, the combination of the default values ​​of each option is used as the baseline configuration, and the application running time of the command line using the optimization combination is recorded as the baseline for translation efficiency comparison. Subsequently, the value of each option is changed item by item, and its impact on translation efficiency is tested under the premise of controlling other options to maintain the default value. By calculating the proportional change in translation efficiency of each option value relative to the default value, the sensitivity ranking of each option is obtained, and then options with high sensitivity to performance are identified. These options form a "sensitive subspace". Automated exploration based on this "sensitive subspace" helps to significantly shorten the overall exploration time and provides new ideas for the optimization of dynamic binary translation systems.

[0056] Step S3, coarse-grained exploration of neural networks

[0057] Use a pre-trained neural network model for coarse-grained exploration. The input of the neural network is the specific application and its configuration parameters, and the output is the value vector of the best optimization option predicted for the application. Through this model, the initial value recommendation of the simulated annealing algorithm is generated for each current optimization option. Through a large amount of running result data training, the predicted value generated by the neural network model is expected to be close to the optimal solution. Using this as the search starting point of the simulated annealing algorithm can effectively narrow the search range of the simulated annealing algorithm when searching for global optimization. This solves the cold start problem, helps to find the global optimal solution faster and more accurately, and avoids the shortcomings of blind exploration such as long exploration time and waste of computing resources.

[0058] Step S4: simulated annealing refinement exploration

[0059] For each optimization option, the best value predicted by the neural network is used as the starting point to start the simulated annealing refinement search process. In this process, new parameter combinations are generated through perturbations, and multiple rounds of iterative optimization are performed in combination with the dynamic threshold strategy. This includes the global prediction part and the local correction part.

[0060] The global prediction part uses the neural network prediction value as the initial solution of the simulated annealing exploration, provides a possible approximate optimal solution at the global level, and conducts simulated annealing exploration in its neighborhood. Such a global prediction unit can avoid problems such as time-consuming exploration and waste of computing resources caused by blind exploration.

[0061] The local correction part is to perform simulated annealing search dependent on temperature gradient, which includes neural network efficiency predictor, dynamic threshold calculator and temperature control perturbation generator. The neural network efficiency predictor is used to predict the translation efficiency corresponding to the new parameter combination generated by perturbation in each round of iteration, so as to avoid blindly running the commands corresponding to the inefficient parameter combination, which will lead to too long exploration time; the dynamic threshold calculator calculates the discarding condition of a parameter combination with poor performance according to the temperature, and discards it only when the performance gap exceeds the threshold. The threshold is set dynamically by temperature, and the convergence speed is adjusted at different exploration stages; the temperature control perturbation generator is used to adjust the step size according to the temperature, perturb the current parameter combination to generate a new parameter combination, and adjust the exploration accuracy at different exploration stages through dynamic temperature control.

[0062] Figure 2 This is a simulated annealing refinement exploration flow chart of the dynamic binary translation method of the present invention. Figure 3 This is a pseudo code diagram of the simulated annealing refinement exploration of the dynamic binary translation method of the present invention. Figure 2 , 3 As shown in Figure 2, the process of simulated annealing refinement exploration includes:

[0063] Step S401, initialize parameters, set initial temperature, cooling coefficient, iteration stability threshold and termination temperature; wherein, if after the optimal solution S is updated in a certain iteration round, the performance of each solution S' obtained in N consecutive iteration rounds does not meet the requirements for updating the optimal solution S, after N iterations, the optimal solution S is taken as the final optimal solution, and the N iteration rounds are defined as the inspection window of the optimal solution S, and the optimal solution S is the solution after inspection, then N is called the iteration stability threshold.

[0064] The values ​​of these parameters will directly affect the algorithm's search efficiency and final results. The initial temperature should be high enough to ensure that the algorithm can perform sufficient random search in the solution space and avoid falling into the local optimal solution too early. The cooling rate determines the speed at which the temperature decreases with the number of iterations. A suitable cooling rate can gradually focus on the vicinity of the global optimal solution while ensuring the breadth of the search. The termination temperature is one of the conditions for the algorithm to stop searching. When the temperature drops to this value, it is considered that the algorithm has converged to a better solution.

[0065] Step S402, judging whether the iteration end condition is currently met, the iteration end condition is that the investigation window of the current optimal solution reaches the iteration stability threshold or the simulated annealing reaches the termination temperature. If it has been met, that is, when the stability counter exceeds the iteration stability threshold or reaches the termination temperature, the iterative process of simulated annealing is terminated, and the process goes to step S413 to output the best optimization option for binary translation. If it has not been met, the process goes to step S403;

[0066] Step S403: According to the current temperature, a dynamic threshold dynamic_threshold is calculated using formula (3). The dynamic threshold is used to determine whether to update the optimal solution.

[0067] dynamic_threshold=threshold×(temperature / T)(3)

[0068] Where threshold is the preset solution update threshold, T is the initial temperature, and temperature is the current temperature. When the temperature is high (close to the initial temperature), it is easier to update the solution to avoid falling into the local optimum; when the temperature is low, the acceptance of new solutions is reduced, which improves the search accuracy of the optimal solution.

[0069] Step S404, perturbation generation, random perturbation is performed in the neighborhood of the current solution to generate a new parameter combination. The perturbation range is also affected by temperature. The maximum offset max_offset is calculated using formula (4), and perturbations are randomly generated within the maximum offset range:

[0070] max_offset=max(min_step_size, int(round(len(options) × step_size ×(temperature / T)))) (4)

[0071] Among them, step_size is the offset step size, min_step_size is the minimum offset step size, and len(options) is the number of possible values ​​for the optimization option.

[0072] When the temperature is high (close to the initial temperature), the maximum offset is large, ensuring global exploration capability; when the temperature is low, the maximum offset is small, thereby reducing the disturbance range and gradually converging to the optimal solution.

[0073] Step S405, the neural network predicts the performance of the new optimized combination;

[0074] The newly generated solution S' is evaluated for performance. Unlike the traditional simulated annealing algorithm, the present invention adds a neural network predictor module inside the simulated annealing algorithm, which can quickly complete the objective function evaluation of the perturbation-generated solution S' through neural network prediction, without the need to actually evaluate the solution S' after each perturbation. The above improvements to the simulated annealing algorithm can effectively reduce the overhead of the binary translation system when calculating the translation efficiency, avoid wasting the computing resources required to run a complete translation process, and save exploration time;

[0075] Step S406: If the performance of the new solution S' is far worse than the current optimal solution S, then the solution S' is directly discarded and the process returns to step S404 to regenerate a new parameter combination; otherwise, the process proceeds to step S407;

[0076] Step S407, adding the new optimization combination to generate a complete command line, and actually running a binary translation to evaluate the performance of solution S';

[0077] Step S408: After evaluation in step S407, if the solution S' is better than the current optimal solution S, proceed to step S409; if the solution S' is slightly worse than the current optimal solution S but meets the dynamic threshold, proceed to step S410; if the solution S' is far worse than the current optimal solution S, that is, the solution S' does not meet the dynamic threshold, proceed to step S411;

[0078] Step S409, update the optimal solution S with the solution S' and reset the stability counter, and proceed to step S412;

[0079] Step S410, accept the new solution S' with probability P to update the optimal solution S, and proceed to step S412;

[0080] Step S411, directly discard the new solution S', increase the stability counter, and go to step S412;

[0081] Step S412, cooling process, adjusting the temperature according to the dynamic cooling strategy, the temperature drop rate increases with the increase of the current iteration number, that is, in the early iteration, the temperature drop rate is slow and the temperature is high, so as to increase the search range; while in the later iteration, the temperature drop rate is accelerated and the temperature is low, the exploration is carried out in a small range, and gradually converges to the optimal solution; return to step S402;

[0082] Step S413: output the best optimized combination of binary translation.

[0083] In the entire algorithm, the neural network and the simulated annealing algorithm work together. The neural network provides coarse-grained guidance, and the simulated annealing algorithm is responsible for fine-grained tuning. The two are organically combined to achieve a two-layer optimization execution mode of "global prediction + local correction". Figure 4As shown in the figure, ① represents the simulated annealing exploration including the double-layer optimization execution module, and ② represents the traditional simulated annealing exploration. Compared with the single optimization method, the double-layer optimization execution mode predicts the possible optimal solution in the global solution space, provides a hot start starting point for the subsequent local correction stage, and is expected to focus on the actual optimal solution for exploration more quickly, achieving more efficient solution. Such optimization operation on the simulated annealing algorithm breaks through the limitations of traditional heuristic algorithms. At the same time, in the local correction stage, the probability jump characteristics of the simulated annealing algorithm in the local solution space are used to effectively avoid the local optimal trap caused by the prediction bias of the neural network. In addition, the optimization options are explored in descending order of sensitivity to ensure that the high-impact parameters with a large impact on performance can converge first, avoiding inefficient global search. Through this combination of intelligent guidance and random search, the algorithm significantly reduces the exploration complexity of the optimization combination space of the user-level dynamic binary translation system, and ensures that the algorithm has the ability to approach the optimal solution.

[0084] Step S5, when traversing all optimization options, process them in order of sensitivity to ensure that the global combination space can be fully covered;

[0085] Step S6, when all options have been explored, the best values ​​of each option are summarized and the final best optimization option configuration is output;

[0086] Step S7: Based on the best optimization option, binary translation is performed on the running command of the target application.

[0087] The automation feature of the present invention is reflected in many aspects, ensuring the efficiency and accuracy of the entire optimization process. First, in terms of "automatic priority allocation", through the sensitivity detection module, the system can automatically identify and determine the exploration order of the optimization options, without relying on manual configuration, thereby saving time and energy for manual intervention. Secondly, the "automatic path guidance" of the system is dominated by the neural network prediction module, which can intelligently generate the initial solution and correct the exploration direction in real time, avoiding the generation of invalid search and ensuring the efficient progress of the optimization process. In addition, the "automatic strategy adjustment" function adopted by the system dynamically adjusts the disturbance range and performance threshold based on the temperature gradient, realizes the automatic balance between accuracy and efficiency, and avoids the inconsistency and instability that may be caused by artificially setting the strategy. Finally, with the help of the "automatic configuration deployment" function, the command line generation module can automatically complete parameter verification, error detection and command generation, and directly apply the optimization results to the actual binary translation environment, reducing the manual operation links and ensuring the operability and accuracy of the results.

[0088] Overall, the system ensures seamless connection from data flow to control flow through highly automated processes. Modules automatically transmit data and work together to avoid possible errors and delays caused by human intervention, thus improving the efficiency and stability of the optimization process. At the same time, through the closed-loop control mechanism, the system can automatically monitor and adjust parameters to ensure that the entire process has both wide-area exploration capabilities and accurate convergence in the later stages to achieve the optimization goal.

[0089] Figure 5 Schematic diagram of the dynamic binary translation device of the present invention. Figure 5 As shown, in a second embodiment of the present invention, a dynamic binary translation device 10 is proposed, comprising:

[0090] The preparation module 11 is used for performing the preparation work before the simulated annealing exploration work; including: generating multiple translation options of binary translation according to the running command of the target application, quantifying the sensitivity corresponding to the translation efficiency of the translation option, selecting the translation option with a sensitivity higher than the selection threshold as the optimization option, and constructing an optimization option set; constructing a coarse-grained exploration model, based on the running command, predicting the optimal optimization option value vector corresponding to the running command; including:

[0091] Sensitivity detection module 111: This module provides intelligent guidance for traditional parameter space exploration algorithms. The sensitivity of each optimization option is defined as the impact of a specific optimization option on the translation efficiency of a binary translation system. Specifically, the value with the largest difference between the translation efficiency of a certain option and the translation efficiency corresponding to the default value of the option is selected, and the sensitivity of each optimization option is quantified by the proportional change between the translation efficiency corresponding to the value and the translation efficiency corresponding to the default value of the optimization option. The sensitivity of each optimization option is calculated based on the test data, and a sensitivity ranking sequence is generated. High-sensitivity options will be given priority in subsequent optimization space exploration, while low-sensitivity options can be deferred or relatively fixed;

[0092] Neural network prediction module 112: assists the exploration of the simulated annealing algorithm in generating initial solutions and correcting the exploration direction in real time. On the one hand, the input of the neural network is the specific application to be executed and its configuration parameters, and the output is the predicted optimal optimization option value vector, with the predicted optimization combination as the starting point of the simulated annealing exploration. This module obtains the initial value of the option exploration for a specific application through pre-training, and is expected to converge to the optimal solution more quickly and accurately. On the other hand, the neural network also predicts the efficiency of new combinations during the simulated annealing exploration process, guides the exploration path, and avoids unnecessary performance evaluation and waste of computing resources.

[0093] The exploration module 12 is used to set the initial parameters of the simulated annealing exploration operation, take the optimal optimization option value vector as the starting input of the simulated annealing exploration operation, and explore the best optimization option for binary translation of the running command; including:

[0094] Initialization module 121, used to set initial parameters, including initial temperature, temperature reduction coefficient, iteration stability threshold and termination temperature;

[0095] A dynamic threshold acquisition module 122 is used to obtain a dynamic threshold of an acceptable new solution for each iteration round of the simulated annealing exploration operation;

[0096] The disturbance acquisition module 123 is used to obtain the disturbance range of the new parameter combination generated in each iteration round of the simulated annealing exploration operation;

[0097] The iteration module 124 is used to perform iterative calculation based on the initial parameter, the dynamic threshold, the disturbance range and the starting input to obtain the best optimization option.

[0098] The translation module 13 is used to perform binary translation on the operation command based on the best optimization option.

[0099] It should be noted that, in various embodiments of the present invention, the sequence numbers of the above steps do not mean the order of execution. The order of execution of the steps should be determined by their functions and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0100] The following is a system embodiment corresponding to the above method embodiment. This embodiment can be implemented in conjunction with the above embodiment. The relevant technical details mentioned in the above embodiment are still valid in this embodiment. In order to reduce repetition, they are not repeated here. Accordingly, the relevant technical details mentioned in this embodiment can also be applied in the above embodiment.

[0101] In the third embodiment of the present invention, a computer-readable storage medium is proposed. The streaming generative model training device of the present invention, if its function is implemented in the form of a software functional unit and sold or used as an independent product, can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a computer-readable storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. Therefore, in the third embodiment of the present invention, a computer-readable storage medium is provided for storing a computer program of a dynamic binary translation method based on neural network-assisted simulated annealing. It should be understood that the computer-readable storage medium in the embodiment of the present invention may be a volatile memory and / or a non-volatile memory. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable programmable read-only memory (EEPROM) or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of random access memory (RAM) are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous connection dynamic random access memory (SLDRAM) and direct memory bus random access memory (DR RAM).

[0102] Figure 5 Schematic diagram of an electronic device of the present invention. Figure 5As shown, in the fourth embodiment of the present invention, an electronic device 100 is proposed, including a dynamic binary translation device based on neural network assisted simulated annealing as described above. A person of ordinary skill in the art can understand that all or part of the steps in the above method can be completed by instructing related hardware (such as a processor, FPGA, ASIC, etc.) through a program. All or part of the steps of the above embodiment can also be implemented using one or more integrated circuits. Accordingly, each module in the above embodiment can be implemented in the form of hardware, such as implementing its corresponding functions through an integrated circuit, or in the form of a software function module, such as implementing its corresponding functions through a processor executing a program / instruction stored in a memory. The embodiments of the present invention are not limited to any specific form of combination of hardware and software.

[0103] It should be noted that the structure of the electronic device shown in the drawings of the present invention does not constitute a limitation thereto, and the actual knowledge structure recognition device may include more or fewer components than shown in the drawings, or a combination of certain components, or a different arrangement of components.

[0104] The electronic device of the present invention may be any device with data processing capability, and the device with data processing capability may be a device or apparatus such as a computer. The device embodiment may be implemented by software, or by hardware or a combination of software and hardware. Taking software implementation as an example, as a device in a logical sense, the processor of any device with data processing capability reads the corresponding computer program instructions in the non-volatile memory into the memory and runs the instructions. Figure 6 This is a schematic diagram of the hardware structure of an electronic device of the present invention. Figure 6 As shown, from the hardware level, it is a hardware structure diagram of any device with data processing capability where the dynamic binary translation device based on neural network assisted simulated annealing of the present invention is located, except Figure 6 In addition to the processor, memory, network interface, and non-volatile memory shown, any device with data processing capabilities in which the apparatus in the embodiments is located may also include other hardware, generally based on the actual functions of the device with data processing capabilities, which will not be described in detail.

[0105] When implemented using software, the above embodiments may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wired (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media sets. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium. The semiconductor medium may be a solid-state hard disk.

[0106] The dynamic binary translation method based on neural network assisted simulated annealing of the present invention is used to solve the problem of large-scale optimization combination space exploration of dynamic binary translation system. The present invention is a global space automatic exploration algorithm implementation, which uses simulated annealing algorithm to heuristically explore neighborhood solutions and gradually converge to the optimal solution. In order to cope with the challenges of high-dimensional solution space, complex interactions between optimization options, high dependence on application scenarios and high testing overhead, the present invention introduces neural network assisted technology to accelerate the convergence process and improve optimization efficiency through sensitivity analysis, search path guidance and dynamic parameter adjustment.

[0107] The above implementation modes are only used to illustrate the present invention, but not to limit the present invention. Ordinary technicians in the relevant technical field can make various changes and modifications without departing from the spirit and scope of the present invention. Therefore, all equivalent technical solutions also belong to the scope of the present invention. The patent protection scope of the present invention should be defined by the claims.

Claims

1. A dynamic binary translation method based on neural network assisted simulated annealing, characterized in that: include: According to the running command of the target application, multiple optimization options for binary translation are generated, the sensitivity corresponding to the translation efficiency of the optimization option is quantified, the optimization option is sorted according to the sensitivity, and the optimization option is divided into multiple optimization option sets with exploration weights according to the sorting result; A coarse-grained exploration model is constructed to predict the optimal optimization option value vector corresponding to the running command based on the running command; Setting initial parameters of the simulated annealing exploration operation, using the optimal optimization option value vector as the starting input of the simulated annealing exploration operation, and exploring the optimal optimization option for binary translation of the running command in the optimization option set; Based on the best optimization option, the execution command is binary translated.

2. The dynamic binary translation method according to claim 1, characterized in that: The steps of the simulated annealing exploration operation specifically include: Set the initial parameters, which include initial temperature, temperature reduction coefficient, iteration stability threshold and termination temperature; Obtaining a dynamic threshold of acceptable new solutions for each iteration of the simulated annealing exploration operation and generating disturbances for new parameter combinations; Based on the initial parameter, the dynamic threshold, the disturbance and the starting input, iterative calculation is performed to obtain the best optimization option.

3. The dynamic binary translation method according to claim 2, characterized in that: The dynamic threshold dynamic_threshold=threshold×(temperature / T), where threshold is the preset solution update threshold, temperature is the temperature of the current iteration round, and T is the initial temperature; The disturbance is randomly generated within the range of the maximum offset max_offset, max_offset=max(min_step_size,int(round(len(options)×step_size×(temperature / T)))), where step_size is the offset step size, min_step_size is the minimum offset step size, and len(options) is the number of possible values ​​for the optimization option.

4. The dynamic binary translation method according to claim 3, characterized in that: Construct a neural network predictor and use it to evaluate the solution S' obtained in the current iteration round. If the solution S' is better than the optimal solution S obtained in the previous iteration round, update the optimal solution S with the solution S'. If the performance of solution S' is worse than that of the optimal solution S, but the performance difference meets the dynamic threshold of the current iteration round, the solution S' is accepted with probability P to update the optimal solution S; If the performance of solution S' is worse than that of the optimal solution S, and the performance difference does not meet the dynamic threshold of the current iteration round, solution S' is discarded; If after the optimal solution S is updated in a certain iteration round, the performance of each solution S' obtained in N consecutive iteration rounds does not meet the requirements of updating the optimal solution S, after N iterations, the optimal solution S is taken as the final optimal solution, and the N iteration rounds are defined as the inspection window of the optimal solution S. The optimal solution S is the solution after inspection, and N is called the iteration stability threshold. The optimal solution S when the inspection window reaches the iteration stability threshold or the simulated annealing reaches the termination temperature is the best optimization option.

5. A dynamic binary translation device based on neural network assisted simulated annealing, characterized in that: include: A preparation module is used for performing preparation work before the simulated annealing exploration operation; including: generating multiple optimization options for binary translation according to the running command of the target application, quantifying the sensitivity corresponding to the translation efficiency of the optimization option, sorting according to the sensitivity, and dividing the optimization option into multiple optimization option sets with exploration weights according to the sorting result; constructing a coarse-grained exploration model, and predicting the optimal optimization option value vector corresponding to the running command based on the running command; An exploration module is used to set initial parameters of a simulated annealing exploration operation, use the optimal optimization option value vector as the starting input of the simulated annealing exploration operation, and explore the optimal optimization option for binary translation of the running command in the optimization option set; The translation module is used for performing binary translation on the running command based on the best optimization option.

6. The dynamic binary translation device according to claim 5, characterized in that: The exploration module includes: An initialization module is used to set the initial parameters, which include initial temperature, temperature reduction coefficient, iteration stability threshold and termination temperature; A dynamic threshold acquisition module, used to obtain a dynamic threshold of an acceptable new solution for each iteration round of the simulated annealing exploration operation; A disturbance acquisition module is used to obtain the disturbance range of the new parameter combination generated in each iteration round of the simulated annealing exploration operation; The iterative module is used to perform iterative calculation based on the initial parameter, the dynamic threshold, the disturbance range and the starting input to obtain the best optimization option.

7. The dynamic binary translation device according to claim 6, characterized in that: The dynamic threshold dynamic_threshold=threshold×(temperature / T), where threshold is the preset solution update threshold, temperature is the temperature of the current iteration round, and T is the initial temperature; The disturbance is randomly generated within the range of the maximum offset max_offset, max_offset=max(min_step_size,int(round(len(options)×step_size×(temperature / T)))), where step_size is the offset step size, min_step_size is the minimum offset step size, and len(options) is the number of possible values ​​for the optimization option.

8. The dynamic binary translation device according to claim 7, characterized in that: This iterative module includes: An evaluation module is used to construct a neural network predictor and evaluate the solution S' obtained in the current iteration round through the neural network predictor; A selection module is used for the neural network predictor to obtain the evaluation result and select the optimal solution S of the current iteration round; if the solution S' obtained in the current iteration round has better performance than the optimal solution S of the current iteration round, the optimal solution S is updated with the solution S'; if the performance of the solution S' is worse than the optimal solution S, but the performance difference meets the dynamic threshold of the current iteration round, the solution S' is accepted with probability P to update the optimal solution S; if the performance of the solution S' is worse than the optimal solution S, and the performance difference does not meet the dynamic threshold of the current iteration round, the solution S' is discarded; The result acquisition module is used to obtain the best optimization option; including: if after the optimal solution S is updated in a certain iteration round, the performance of each solution S' obtained in N consecutive iteration rounds does not meet the updated optimal solution S, after N iterations, the optimal solution S is taken as the final optimal solution, the N iteration rounds are defined as the inspection window of the optimal solution S, the optimal solution S is the solution after inspection, and N is called the iteration stability threshold; the optimal solution S when the inspection window reaches the iteration stability threshold or the simulated annealing reaches the termination temperature is the best optimization option.

9. An electronic device comprising the dynamic binary translation device based on neural network assisted simulated annealing as described in any one of claims 5 to 8.

10. A computer-readable storage medium storing computer-executable instructions, characterized in that: When the computer executable instruction is executed, the dynamic binary translation method based on neural network assisted simulated annealing as described in any one of claims 1 to 4 is implemented.

Citation Information

Patent Citations

  • Data detection method based on simulated annealing neural network and interference elimination

    CN108282437A

  • Virtualization-oriented binary translation method based on rule learning

    CN113885883A

  • Dynamic binary translation method and system for calculating x86 flag bit based on speculation

    CN117234526A

  • Improved weaving flexible workshop production scheduling method based on NSGA-II

    CN118657448A

  • Method for predicting water turbidity based on BP neural network optimized by simulated annealing algorithm

    CN119047295A