Cross-CPU architecture binary file performance optimization system and method for credential and credential adaptation
Through deep reinforcement learning and Transformer pre-trained models combined with Docker container technology and Perf tools, an intelligent binary file performance optimization system was built, solving the problems of experience dependence, local optimization and low data utilization efficiency in the existing technology, and achieving automation, adaptability and scalability performance optimization effects.
Patent Information
- Application Number
- CN202411685127.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-22
- Publication Date
- 2025-02-28
AI Technical Summary
The prior art has problems such as empirical dependence, local optimization, fixed optimization strategies, low data utilization efficiency and difficulty in scaling in complex systems and large-scale applications in application performance optimization.
A Transformer pre-trained model (BinCode-Transformer) with deep reinforcement learning and ELF binary file training is used to build a performance-optimized intelligent system. The system creates an optimization environment and agent through the deep reinforcement learning framework, dynamically generates a binary file running environment, collects performance indicators and key events, extracts sampling features, and generates the optimized binary files through the reinforcement learning optimization strategy.
It realizes automated and intelligent binary file performance optimization, can adapt to dynamically changing workloads and environments, improves data utilization efficiency and system scalability, and reduces the time and error rate of manual tuning.
Smart Images

Figure 00000000_0000_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of information technology, and in particular to a cross-CPU architecture binary file performance optimization system and method for information innovation adaptation. Background Art
[0002] There are generally several methods for optimizing existing application performance:
[0003] 1. Link-Time Optimization (LTO)
[0004] LTO optimizations performed at the link stage allow the compiler to optimize across the entire program, not just a single file. This optimization can improve program performance by eliminating redundant code, inlining function calls across files, and performing more efficient register allocation.
[0005] 2. Profile-Guided Optimization (PGO)
[0006] PGO uses profile data collected at runtime to guide the compiler to optimize. By understanding the actual operation of the program, the compiler can perform more targeted optimizations, such as function inlining, loop unrolling, and branch prediction optimization, thereby improving the execution efficiency of the program.
[0007] 3. Sample-Based Profiling
[0008] This technique collects performance data by sampling the runtime behavior of the program, rather than through instrumentation. This method has low overhead and can be used in production environments. The collected data can be used to guide optimizations such as code layout and function reordering.
[0009] 4. Auto-Vectorization
[0010] Automatic vectorization is the process by which a compiler converts scalar code into vector code, thereby taking advantage of the SIMD (Single Instruction Multiple Data) instruction set of modern CPUs. This optimization can significantly improve the performance of data-parallel computations.
[0011] 5. Memory Layout Optimization
[0012] Memory layout optimization reduces cache misses and memory access latency by rearranging the locations of data structures and variables. This optimization can improve the memory access efficiency of a program, especially in data-intensive applications.
[0013] 6. Binary Rewriting
[0014] Binary rewriting is to directly modify the compiled binary files to apply various optimization techniques. This method can be optimized without recompiling the source code, which is suitable for third-party libraries without source code.
[0015] Disadvantages of the existing technology:
[0016] Usually it relies on the developer's experience and manual tuning, which requires a deep understanding of the program's structure and performance bottlenecks, is time-consuming and prone to errors.
[0017] It often focuses on local optimization, easily falls into the local optimal solution, and has difficulty finding the global optimal solution.
[0018] Optimization strategies are usually fixed and difficult to adapt to dynamically changing workloads and environments.
[0019] Typically relies on static analysis and limited runtime data, resulting in low data utilization efficiency.
[0020] When faced with complex systems and large-scale applications, the difficulty and complexity of optimization increase significantly, and the scalability is poor.
[0021] They are usually based on existing optimization technologies and experience, have low innovation, and are difficult to quickly adapt to new technologies and new environments. Summary of the invention
[0022] The purpose of the present invention is to overcome the shortcomings of the prior art, propose a cross-CPU architecture binary file performance optimization system and method for Xinchuang adaptation, and use deep reinforcement learning and ELF binary file training Transformer pre-training model (named BinCode-Transformer) to build a performance optimized intelligent system. The system creates an optimized environment and intelligent agent through a deep reinforcement learning framework, and dynamically generates a binary file operating environment using Docker container technology. Various performance indicators and key events are collected through the Perf tool to extract sampling features.
[0023] The present invention solves the technical problem by adopting the following technical solutions:
[0024] A cross-CPU architecture binary file performance optimization system for trusted computing adaptation includes an environment model Docker and an intelligent agent model, wherein the environment model Docker and the intelligent agent model are interconnected, and the environment model Docker includes a binary code execution container, a Perf indicator collection module, an indicator library, an execution information library, a reward calculation module and a BinCode-Transformer encoder, wherein the binary code execution container is respectively connected to the execution information library and the BinCode-Transformer encoder, the Perf indicator collection module is respectively connected to the indicator library and the execution information library, and the execution information library is connected to the reward calculation module.
[0025] Furthermore, the binary code execution container is used to dynamically generate an execution environment for a binary file using a Docker container, ensuring that the generated binary file runs in a consistent and isolated environment;
[0026] The Perf indicator collection module is used to collect various performance indicators and key event data during the execution of binary files;
[0027] The reward calculation module is used to measure through four indicator dimensions: CPU, network IO, disk IO and memory;
[0028] The BinCode-Transformer encoder is used to generate feature expressions that reflect binary semantics and calling methods using the encoder of the BinCode-Transformer pre-trained model.
[0029] Moreover, the intelligent agent model includes a state feature extraction module, a feature fusion module, a BinCode-Transformer decoder, a binary file generation module, a meta-reinforcement learning model, a policy network, a value network model, an action space construction model and a reinforcement learning optimization strategy, wherein the state feature extraction module is connected to the feature fusion module, the feature fusion module is respectively connected to the BinCode-Transformer decoder, the meta-reinforcement learning model and the policy network, the value network model, the meta-reinforcement learning model and the policy network, the value network model are respectively connected to the action space construction model and the reinforcement learning optimization strategy, and the BinCode-Transformer decoder is connected to the binary file generation module.
[0030] Moreover, the state feature extraction module is used to construct the state space of the encoder of the BinCode-Transformer pre-trained model to reflect the static features and call features of the binary file, and the Profile Data collected by Perf to reflect the dynamic execution features of the binary executable file;
[0031] The feature fusion module is used to fuse the features generated by the encoder of the BinCode-Transformer pre-trained model, the Profile Data features, and the Action features optimized by the policy network, and output the fused features;
[0032] The BinCode-Transformer decoder is used to optimize the binary file using the fused feature vector as input using the BinCode-Transformer pre-trained model, and regenerate a new feature vector reflecting the optimized binary file;
[0033] The binary file generation module is used to generate an optimized binary executable file according to the feature vector of the generated optimized binary file;
[0034] Meta-reinforcement learning models are used to enable agents to learn how to quickly adapt to new tasks by training on multiple tasks;
[0035] Policy network and value network models are used for training optimization;
[0036] The action space construction model is used to generate new optimization operations to construct the action space;
[0037] Reinforcement learning optimization strategy is used to generate optimization strategy from state features and reward feedback extracted from performance data, guiding the optimization process to achieve better performance.
[0038] An optimization method for a cross-CPU architecture binary file performance optimization system for credentialed innovation adaptation comprises the following steps:
[0039] Step 1: Binary code execution container to create environment;
[0040] The binary code and the Perf collection program are automatically built into a Docker container through Dockerfile. After the construction is completed, the Docker container is automatically started. At the same time, the optimized binary program and the Perf collection program are automatically started in the container.
[0041] Step 2: The Perf performance indicator collection module collects data;
[0042] The Perf collection program collects the performance indicators and Profile Data of binary programs, collects various performance indicators and key events through the Perf tool, and saves them to the "Indicator Library" and "Execution Information Library". The database provides the data source for "Reward Calculation".
[0043] Step 3: BinCode-Transformer encoder extracts binary file features;
[0044] Steps 2 and 3 are both components of binary features. Step 3 uses the "BinCode-Transformer encoder" to understand the meaning and semantic expression of the binary program, identify the semantics of the program and call features, which are collectively referred to as binary code features.
[0045] Step 4: The action space module adversarial network generates optimization operations;
[0046] The Generator attempts to generate possible optimization actions based on the input state features (binary code features in step 3 and Profile Data features in step 2) and the reward feedback in step 9 of the previous cycle, and the Discriminator evaluates the effectiveness of these actions. Through this adversarial training, GANs generate high-quality action spaces for the policy network to select. GANs can generate new optimization operations. The Generator network generates new optimization operations, and the Discriminator network evaluates the effectiveness of these operations. Through adversarial training, the Generator network is able to generate increasingly effective optimization operations, which constitute a set of action spaces.
[0047] Step 5: Meta-reinforcement learning for action space optimization;
[0048] Using the binary code features generated in step 3, the performance data collected in step 2, the Profile Data, and the action space generated in step 4, the "meta-reinforcement learning" framework (pytorch, gym library) is used to build a "policy network" and a "value network" to understand the features and performance data of the binary program, update and optimize the action space, learn the optimization operations in different tasks, and the intelligent agent can generate an action space suitable for the current task.
[0049] Step 6: The policy network, value network model and reinforcement learning optimization strategy are used to select actions;
[0050] Using the binary code features generated in step 3, the performance data collected in step 2, the Profile Data, and the action space generated in step 4, the state features (binary code features and Profile Data features) are extracted based on the action space and the state features, and the action space features are superimposed for feature fusion to try to select the appropriate optimization action. In each optimization step, the intelligent experience will select one or more optimization operations from the action space based on the current state (i.e., the features provided by the "BinCode-Transformer encoder" and the performance data and reward features collected by the "Perf performance indicator collection" tool).
[0051] Step 7: The feature fusion module and BinCode-Transformer decoder perform binary file performance optimization;
[0052] The binary code features generated in step 3, the performance data collected in step 2, the Profile Data, and the action space generated in step 4 are used for feature fusion. The “BinCode-Transformer Decoder” then receives the fused features and generates an optimized binary program.
[0053] Step 8: Binary code execution container and Perf performance indicator collection for performance testing and feedback;
[0054] The optimized binary code and the Perf collection program generated in step 7 are automatically built into a new Docker container through the Dockerfile. After the construction is completed, the Docker container is automatically started, and the optimized new binary program and the Perf collection program are automatically started in the container.
[0055] Step 9: Reward calculation and reward mechanism construction;
[0056] By calculating the performance indicators and Profile Data of the binary program collected in step 2 and the performance indicators and Profile Data of the optimized binary program collected in step 8, a comparison is formed to form an evaluation reward mechanism, which is fed back to the "BinCode-Transformer Decoder" as the input of the next cycle to guide the preference of the binary file generation strategy.
[0057] Step 10: The meta-reinforcement learning module performs meta-reinforcement learning updates;
[0058] The action space is gradually updated by training on multiple tasks using the update mechanism built using the "meta-reinforcement learning" framework (pytorch, gym library) based on the selected action generated in step 6 and the reward value generated in step 9. The agent is able to learn how to generate and adjust the action space.
[0059] Step 11: Update the binary files.
[0060] This step simply replaces the original binary file with the optimized binary file, and then proceeds to step 1. Step 1 uses the optimized binary file to build a Docker environment and enter the next training cycle.
[0061] The advantages and positive effects of the present invention are:
[0062] The present invention includes an environment model Docker and an agent model, wherein the environment model Docker and the agent model are interconnected. The present invention uses a Transformer pre-training model (named BinCode-Transformer) trained by deep reinforcement learning and ELF binary files to build a performance-optimized intelligent system. The system creates an optimized environment and agent through a deep reinforcement learning framework, and dynamically generates a binary file operating environment using Docker container technology. Various performance indicators and key events are collected through the Perf tool to extract sampling features. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] Figure 1 is a system structure diagram of the present invention;
[0064] Figure 2 It is a flow chart of the present invention. DETAILED DESCRIPTION
[0065] The present invention is further described in detail below with reference to the accompanying drawings.
[0066] A binary file performance optimization system for cross-CPU architectures adapted to Xinchuang, such as Figure 1 As shown, it includes an environment model Docker and an agent model, wherein the environment model Docker and the agent model are connected to each other, and the environment model Docker includes a binary code execution container, a Perf indicator collection module, an indicator library, an execution information library, a reward calculation module and a BinCode-Transformer encoder, wherein the binary code execution container is respectively connected to the execution information library and the BinCode-Transformer encoder, the Perf indicator collection module is respectively connected to the indicator library and the execution information library, and the execution information library is connected to the reward calculation module.
[0067] Binary code execution container: Use Docker container to dynamically generate the execution environment of binary files, ensuring that the generated binary files run in a consistent and isolated environment. Write Dockerfile to include the required perf and other dependent libraries in the Dockerfile.
[0068] Perf indicator collection: The Perf tool collects various performance indicators and key event data during the execution of the binary file. These data are crucial to understanding the performance characteristics of the binary file. It is necessary to collect information about the use of CPU, IO, memory, and key events. For example: Hardware events: cpu-cycles, cache-misses, branch-misses, etc., Hardware cache events: L1-dcache-load-misses, L1-icache-load-misses, L1-dcache-prefetch-misses, etc., and software events. These important events need to be encoded, using a classified manual encoding method. For example: Hardware event (1): cpu-cycles (11), cache-misses (21), branch-misses (31) are encoded as 111, 121, 131. Hardware cache event (2), software event (3) represent hardware cache events that all start with 2, and the specific events inside are sequentially encoded with 2 digits. Software events are sequentially encoded starting with 3. Statistical values are encoded starting with 9, and the values of all events and statistical values are recorded as floating-point numbers.
[0069] Reward calculation: Reward calculation is measured in four indicator dimensions: CPU, network IO, disk IO, and memory. The calculation method is to subtract the collection result of the last execution from the collection result of the current execution. The smaller the result value, the worse the optimization direction.
[0070] BinCode-Transformer encoder: Use the encoder of the BinCode-Transformer pre-trained model to generate feature expressions that reflect binary semantics and calling methods.
[0071] The intelligent agent model includes a state feature extraction module, a feature fusion module, a BinCode-Transformer decoder, a binary file generation module, a meta-reinforcement learning model, a policy network, a value network model, an action space construction model and a reinforcement learning optimization strategy. The state feature extraction module is connected to the feature fusion module, the feature fusion module is respectively connected to the BinCode-Transformer decoder, the meta-reinforcement learning model and the policy network, the value network model, the meta-reinforcement learning model and the policy network, the value network model are respectively connected to the action space construction model and the reinforcement learning optimization strategy, and the BinCode-Transformer decoder is connected to the binary file generation module.
[0072] State feature extraction: The encoder of the BinCode-Transformer pre-trained model generates feature expressions that reflect binary semantics and calling methods, and the Profile Data collected by the Perf tool as the state information of the binary file executed this time. The encoder of the BinCode-Transformer pre-trained model reflects the static features and calling features of the binary file, and the Profile Data collected by Perf reflects the dynamic execution features of the binary executable file. State feature extraction constructs the state space of the above two types of information.
[0073] Feature fusion: Fusion the features generated by the encoder of the BinCode-Transformer pre-trained model, the ProfileData features, and the Action features optimized by the policy network. Output the fused features.
[0074] BinCode-Transformer decoder: Uses the fused feature vector as input to optimize the binary file using the BinCode-Transformer pre-trained model, and regenerates a new feature vector that reflects the optimized binary file.
[0075] Generate binary file: Generate an optimized binary executable file based on the feature vector of the generated optimized binary file. The file is transferred to the environment, the docker build program is started, and a new isolated operating environment is generated.
[0076] Meta-RL model: Meta-RL enables agents to learn how to quickly adapt to new tasks by training on multiple tasks. Agents learn how to construct, generate, and adjust action spaces by training on different binary optimization tasks. Agents learn which optimization operations are most effective in different tasks and apply these learned operations in new tasks. These operations are not predefined, but dynamically generated based on the characteristics and performance data of the task, which enhances the robustness and adaptability of binary optimization.
[0077] Policy network, value network model: The policy network consists of a full attention mechanism network, and the last layer outputs the probability distribution of the action. The value network consists of several fully connected layers, and the last layer outputs the value of the state. The policy network is used to generate the action taken by the agent in a given state. Through the policy network, the agent can learn the strategy of taking the best action in different states. At the same time, the reward value will be fed back to the meta-reinforcement learning model to update its strategy so that it can choose better optimization operations in future optimization steps. The value network is used to estimate the value of a given state, that is, the expected return of the agent in this state. Through the value function network, the agent can evaluate the quality of different states. Through value function estimation, the variance of policy updates can be reduced and the stability of training can be improved. It can accelerate the policy optimization process and improve training efficiency.
[0078] Action space (GAN) construction model: GANs consists of a generator and a discriminator, which are used to generate new optimization operations to construct action spaces. The generator network generates new optimization operations, and the discriminator network evaluates the effectiveness of these operations. Through adversarial training, the generator network is able to generate increasingly effective optimization operations. GANs are used to estimate the value of different states. By learning state features and reward feedback, GANs can generate value estimates for the current optimization strategy. It helps to evaluate the effectiveness of the optimization strategy and guide further optimization. The robustness of the model is improved by generating adversarial methods. The generator tries to generate realistic state features, while the discriminator tries to distinguish between real state features and generated state features. Through this adversarial training, GANs can improve the model's ability to recognize different state features, thereby estimating the value more accurately. By generating and discriminating state features, GANs can help the policy network (TD3) better understand and optimize the performance of binary programs. The value estimate provided by the value network can serve as an important reference for the policy network's optimization strategy, thereby improving the overall optimization effect.
[0079] Reinforcement Learning Optimization Policy (TD3): The policy network adopts the TD3 model to generate an optimization policy based on the state features and reward feedback extracted from the performance data, guiding the optimization process to achieve better performance.
[0080] An optimization method for a cross-CPU architecture binary file performance optimization system for trust innovation adaptation, such as Figure 2 As shown, the following steps are included:
[0081] Step 1: Binary code execution container to create environment;
[0082] The binary code and the Perf collection program are automatically built into a Docker container through Dockerfile. After the construction is completed, the Docker container is automatically started. At the same time, the optimized binary program and the Perf collection program are automatically started in the container.
[0083] Step 2: The Perf performance indicator collection module collects data;
[0084] The Perf collection program collects the performance indicators and Profile Data of binary programs, collects various performance indicators and key events through the Perf tool, and saves them to the "Indicator Library" and "Execution Information Library". The database provides the data source for "Reward Calculation".
[0085] Step 3: BinCode-Transformer encoder extracts binary file features;
[0086] There is no strict order for steps 2 and 3, both of which are components of binary features. Step 3 uses the "BinCode-Transformer encoder" to understand the meaning and semantic expression of the binary program, identify the semantics of the program, and call features. These features are collectively referred to as binary code features.
[0087] Step 4: The action space module adversarial network generates optimization operations;
[0088] The Generator attempts to generate possible optimization actions based on the input state features (binary code features in step 3 and Profile Data features in step 2) and the reward feedback in step 9 of the previous cycle, and the Discriminator evaluates the effectiveness of these actions. Through this adversarial training, GANs generate high-quality action spaces for the policy network to select. GANs can generate new optimization operations. The Generator network generates new optimization operations, and the Discriminator network evaluates the effectiveness of these operations. Through adversarial training, the Generator network is able to generate increasingly effective optimization operations, which constitute a set of action spaces.
[0089] Step 5: Meta-reinforcement learning for action space optimization;
[0090] Using the binary code features generated in step 3, the performance data collected in step 2, the Profile Data, and the action space generated in step 4, the "meta-reinforcement learning" framework (pytorch, gym library) is used to build a "policy network" and a "value network" to understand the features and performance data of the binary program, update and optimize the action space, learn the optimization operations in different tasks, and the intelligent agent can generate an action space suitable for the current task.
[0091] Step 6: The policy network, value network model and reinforcement learning optimization strategy are used to select actions;
[0092] Using the binary code features generated in step 3, the performance data collected in step 2, the Profile Data, and the action space generated in step 4, the state features (binary code features and Profile Data features) are extracted based on the action space and the state features, and the action space features are superimposed for feature fusion to try to select the appropriate optimization action. In each optimization step, the intelligent experience will select one or more optimization operations from the action space based on the current state (i.e., the features provided by the "BinCode-Transformer encoder" and the performance data and reward features collected by the "Perf performance indicator collection" tool).
[0093] Step 7: The feature fusion module and BinCode-Transformer decoder perform binary file performance optimization;
[0094] The binary code features generated in step 3, the performance data collected in step 2, the Profile Data, and the action space generated in step 4 are used for feature fusion. The “BinCode-Transformer Decoder” then receives the fused features and generates an optimized binary program.
[0095] Step 8: Binary code execution container and Perf performance indicator collection for performance testing and feedback;
[0096] The optimized binary code and the Perf collection program generated in step 7 are automatically built into a new Docker container through the Dockerfile. After the construction is completed, the Docker container is automatically started, and the optimized new binary program and the Perf collection program are automatically started in the container.
[0097] Step 9: Reward calculation and reward mechanism construction;
[0098] By calculating the performance indicators and Profile Data of the binary program collected in step 2 and the performance indicators and Profile Data of the optimized binary program collected in step 8, a comparison is formed to form an evaluation reward mechanism, which is fed back to the "BinCode-Transformer Decoder" as the input of the next cycle to guide the preference of the binary file generation strategy.
[0099] Step 10: The meta-reinforcement learning module performs meta-reinforcement learning updates;
[0100] The action space is gradually updated by training on multiple tasks using the update mechanism built using the "meta-reinforcement learning" framework (pytorch, gym library) based on the selected action generated in step 6 and the reward value generated in step 9. The agent is able to learn how to generate and adjust the action space.
[0101] Step 11: Update binary files.
[0102] This step is to simply replace the original binary file with the optimized binary file, and then proceed to step 1. Step 1 uses the optimized binary file to build a Docker environment and enter the next training cycle.
[0103] It should be emphasized that the embodiments described in the present invention are illustrative rather than restrictive. Therefore, the present invention includes but is not limited to the embodiments described in the specific implementation manner. Any other implementation manners derived by those skilled in the art based on the technical solution of the present invention also fall within the scope of protection of the present invention.
Claims
1. A cross-CPU architecture binary file performance optimization system for trusted innovation adaptation, characterized by: It includes an environment model Docker and an intelligent agent model, wherein the environment model Docker and the intelligent agent model are connected to each other, and the environment model Docker includes a binary code execution container, a Perf indicator collection module, an indicator library, an execution information library, a reward calculation module and a BinCode-Transformer encoder, wherein the binary code execution container is respectively connected to the execution information library and the BinCode-Transformer encoder, the Perf indicator collection module is respectively connected to the indicator library and the execution information library, and the execution information library is connected to the reward calculation module.
2. According to claim 1, the system and method for optimizing the performance of binary files across CPU architectures for credential creation adaptation are characterized in that: The binary code execution container is used to dynamically generate an execution environment for binary files using a Docker container, ensuring that the generated binary files run in a consistent and isolated environment; The Perf indicator collection module is used to collect various performance indicators and key event data during the execution of binary files; The reward calculation module is used to measure through four indicator dimensions: CPU, network IO, disk IO and memory; The BinCode-Transformer encoder is used to generate feature expressions that reflect binary semantics and calling methods using the encoder of the BinCode-Transformer pre-trained model.
3. The cross-CPU architecture binary file performance optimization system and method for credentialed adaptation according to claim 1 is characterized in that: The intelligent agent model includes a state feature extraction module, a feature fusion module, a BinCode-Transformer decoder, a binary file generation module, a meta-reinforcement learning model, a policy network, a value network model, an action space construction model and a reinforcement learning optimization strategy, wherein the state feature extraction module is connected to the feature fusion module, the feature fusion module is respectively connected to the BinCode-Transformer decoder, the meta-reinforcement learning model and the policy network, the value network model, the meta-reinforcement learning model and the policy network, the value network model are respectively connected to the action space construction model and the reinforcement learning optimization strategy, and the BinCode-Transformer decoder is connected to the binary file generation module.
4. The cross-CPU architecture binary file performance optimization system and method for credentialed adaptation according to claim 3 is characterized in that: The state feature extraction module is used to construct the state space of the encoder of the BinCode-Transformer pre-trained model to reflect the static features and call features of the binary file, and the Profile Data collected by Perf to reflect the dynamic execution features of the binary executable file; The feature fusion module is used to fuse the features generated by the encoder of the BinCode-Transformer pre-trained model, the ProfileData features, and the Action features optimized by the policy network, and output the fused features; The BinCode-Transformer decoder is used to optimize the binary file using the fused feature vector as input using the BinCode-Transformer pre-trained model, and regenerate a new feature vector reflecting the optimized binary file; The binary file generation module is used to generate an optimized binary executable file according to the feature vector of the generated optimized binary file; Meta-reinforcement learning models are used to enable agents to learn how to quickly adapt to new tasks by training on multiple tasks; Policy network and value network models are used for training optimization; The action space construction model is used to generate new optimization operations to construct the action space; Reinforcement learning optimization strategy is used to generate optimization strategy from state features and reward feedback extracted from performance data, guiding the optimization process to achieve better performance.
5. An optimization method for a cross-CPU architecture binary file performance optimization system for credentialed innovation adaptation as claimed in any one of claims 1 to 4, characterized in that: The following steps are involved: Step 1: Create an environment by executing a binary code container. Use Dockerfile to automatically build a Docker container with binary code and Perf collection program. After the build is completed, the Docker container is automatically started. At the same time, the optimized binary program and the Perf collection program are automatically started in the container. Step 2: The Perf performance indicator collection module collects data; The Perf collection program collects the performance indicators and Profile Data of binary programs. It collects various performance indicators and key events through the Perf tool and saves them to the indicator library and execution information library. Step 3: BinCode-Transformer encoder extracts binary file features; The BinCode-Transformer encoder is used to understand the meaning and semantic expression of binary programs, and to identify the semantics and call features of programs, which are collectively referred to as binary code features. Step 4: The action space module adversarial network generates optimization operations; The generator tries to generate possible optimization actions based on the binary code features of step 3 and the Profile Data features of step 2, as well as the reward feedback of the previous cycle, and the discriminator evaluates the effectiveness of these actions. Through this adversarial training, GANs generates high-quality action spaces for the policy network to select. GANs generates new optimization operations. Step 5: Meta-reinforcement learning for action space optimization; Using the binary code features generated in step 3, the performance data collected in step 2, the Profile Data, and the action space generated in step 4, the meta-reinforcement learning framework is used to build a policy network and a value network to understand the features and performance data of the binary program, update and optimize the action space, learn the optimization operations in different tasks, and the intelligent agent can generate an action space suitable for the current task; Step 6: The policy network, value network model and reinforcement learning optimization strategy are used to select actions; Using the binary code features generated in step 3, the performance data collected in step 2, the Profile Data, and the action space generated in step 4, the state features are obtained according to the action space and through state feature extraction, and the action space features are superimposed for feature fusion. Try to select the appropriate optimization action. In each optimization step, the intelligent experience selects one or more optimization operations from the action space according to the current state. Step 7: The feature fusion module and BinCode-Transformer decoder perform binary file performance optimization; The binary code features generated in step 3, the performance data collected in step 2, the Profile Data, and the action space generated in step 4 are used for feature fusion. The fused features are then received by the BinCode-Transformer decoder to generate an optimized binary program. Step 8: Binary code execution container and Perf performance indicator collection for performance testing and feedback; Use Dockerfile to automatically build a new Docker container with the optimized binary code and the Perf collection program generated in step 7. After the construction is completed, the Docker container is automatically started, and the optimized new binary program and the Perf collection program are automatically started in the container. Step 9: Reward calculation and reward mechanism construction; By calculating the performance indicators and Profile Data of the binary program collected in step 2 and the performance indicators and Profile Data of the optimized binary program collected in step 8, a comparison is made to form an evaluation reward mechanism, which is fed back to the BinCode-Transformer decoder as the input of the next cycle to guide the preference of the binary file generation strategy; Step 10: The meta-reinforcement learning module performs meta-reinforcement learning updates; The action selected in step 6 and the reward value generated in step 9 are used to gradually update the action space by training on multiple tasks using the update mechanism built in the meta-reinforcement learning framework. Step 11, binary file update; This step simply replaces the original binary file with the optimized binary file, and then proceeds to step 1. Step 1 uses the optimized binary file to build a Docker environment and enter the next training cycle.
Citation Information
Cited By
Application compatibility dynamic adaptation method and system of cross-domestic CPU architecture
CN121364886A
An application compatibility dynamic adaptation method and system across CPU architectures of different manufacturers
CN121364886B