Cross-CPU architecture binary application program conversion system
By cross-CPU architecture binary application conversion system, the Bincode-TransFormer conversion model automatically converts binary files to solve the problem of low cross-CPU architecture conversion efficiency and high threshold in existing technologies. Improvement.
Patent Information
- Application Number
- CN202411294829.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-14
- Publication Date
- 2025-01-24
AI Technical Summary
The prior art has problems such as inefficiency, poor performance and high threshold in the conversion of binary applications across CPU architectures, and it is difficult to apply in production environments.
A cross-CPU architecture binary application conversion system is proposed, which uses user interaction interface, feature embedding module, BinCode-Transformer conversion model, model training module, data loading module and file generation module to realize automatic conversion of binary files through the BinCode-Transformer conversion model. Supports batch parallel conversion and can automatically train and update models to adapt to new instruction sets.
It achieves rapid adaptation of binary applications across CPU architectures, reduces costs and thresholds, improves the efficiency of localized adaptation of different applications, and supports rapid adaptation of new instruction sets.
Smart Images

Figure CN119356729A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of system architecture, and in particular to a cross-CPU architecture binary application conversion system. Background Art
[0002] There are generally the following methods for existing applications with different CPU architectures:
[0003] 1. Recompile:
[0004] Direct compilation: If the source code is available, the most direct approach is to recompile the source code on the target architecture. This usually involves using a compiler and possible libraries suitable for the target architecture. Cross-platform compilation tools: such as CMake, GNU Autotools, etc., these tools can help automate the compilation process and adapt it to different architectures.
[0005] 2. Binary Translation:
[0006] Use a binary translator (such as QEMU) to emulate the execution environment of the source architecture on the target architecture. This approach does not require source code, but may introduce performance overhead. Static binary translators can convert binary code of the source architecture into code of the target architecture, but this approach may not fully preserve the performance characteristics of the original program.
[0007] 3. Source code conversion tool:
[0008] Some tools (such as Clang's Cross-Translation Utility, CTU) can analyze source code and generate equivalent code for the target architecture. This approach requires source code
[0009] The shortcomings of existing technologies: modifying code or compiling options based on source code, different architecture processing methods are not unified, and efficiency is low. The performance of simulators such as QEMU is low and cannot be used in production environments. The requirements for software technical capabilities are relatively high, and the threshold is high. Ordinary people cannot do it, which hinders the development of the ecosystem. Summary of the invention
[0010] The purpose of the present invention is to overcome the shortcomings of the prior art and propose a cross-CPU architecture binary application conversion system that can maintain stable operation of the power grid. By specifying a source directory, all binary programs in the source directory that can run on heterogeneous CPUs can be directly converted and generated, thereby achieving rapid adaptation and saving costs.
[0011] The present invention solves the technical problem by adopting the following technical solutions:
[0012] A cross-CPU architecture binary application conversion system includes a user interaction interface, a feature embedding module, a BinCode-Transfommer conversion model, a model training module, a data loading module and a file generation module, wherein the data loading module and the feature embedding module are connected in sequence, the feature embedding module is respectively connected to the BinCode-Transfommer conversion model and the model training module, and the BinCode-Transfommer conversion model and the model training module are respectively connected to the file generation module.
[0013] Moreover, the user interaction interface is used to specify the root directory of the application to be converted in the conversion mode. The conversion target parameters CPU instruction set, operating system, big and small end need to be selected. The system starts to call the conversion model and facilitates the conversion of all files in the directory, generating a target binary application to the specified directory.
[0014] Furthermore, the data loading includes a conversion mode and a training mode.
[0015] Moreover, the conversion mode reads the root directory specified by the interface, traverses all files that need to be converted in all folders under the root directory, reads the binary file, parses the binary file, and parses the file format, operating system, ABI and version information as metadata for management; the ELF file is split into data according to the file format definition, split into operation code, operand and Section, character table structured data.
[0016] Moreover, the training mode reads the contents of each directory according to the directory structure of the resources required for training, and saves all contents except binary files as metadata. It reads the converted source CPU architecture binary file and splits the binary file contents according to the specifications, reads the target binary file, and splits it according to the target CPU specifications.
[0017] Moreover, the feature embedding module uses the parsed binary file data as a parameter to call the GloVe word vector model trained using the binary file format language and the CPU instruction set language to generate a vector of the binary semantic table and perform position encoding feature embedding.
[0018] Moreover, the BinCode-Transfommer conversion model is an AI model trained based on the sparse Transformer model and is specifically used for model conversion between different CPUs. The input of the model is a binary language vector and a positional code.
[0019] Moreover, the model training utilizes the BinCode-Transformer pre-trained model to perform training for a new CPU architecture or instruction set.
[0020] Furthermore, the file generation module reads data from the generated original file, removes the CPU architecture information, and re-outputs the data into a new file.
[0021] The advantages and positive effects of the present invention are:
[0022] The present invention inputs conversion target key information through a user interaction interface, including CPU instruction set, operating system, ABI, big and small end, 32-bit / 64-bit, binary file format ELF, PE, etc., file format version and other information, selects the directory where the source program is located and specifies the output directory, and automatically generates the binary executable file of the target CPU through the BinCode-Transformer model. The conversion process does not require manual intervention and supports batch parallel conversion. In addition, by inputting the CPU instruction set specification, ABI library information and other contents on the newly emerged instruction set, the model can be automatically trained and updated to realize the binary conversion function for the new instruction set. Since the semantic expression space of the structure of binary file ELF or PE is small, the basic form is the operation code and the operand, and the keyword of the file structure, so the trained model is small (the space is much smaller than the complexity of natural language), and it also runs on the CPU. By specifying the source directory, all binary programs under the source directory that can run on heterogeneous CPUs can be directly converted and generated, so as to realize rapid adaptation and save costs. Directly convert binary files for different CPUs through artificial intelligence, which is easy to operate, reduces the cost and threshold of the underlying library and application multi-CPU adaptation, and greatly improves the efficiency of localization adaptation of different applications. It also supports the training and update model of the new instruction set, and quickly realizes the adaptation of the new CPU instruction set. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 It is a structural diagram of the present invention;
[0024] Figure 2 This is a data flow chart of the system conversion mode of the present invention;
[0025] Figure 3 This is a data flow chart of the training mode of the present invention. DETAILED DESCRIPTION
[0026] The present invention is further described in detail below with reference to the accompanying drawings.
[0027] Cross-CPU architecture binary application conversion system, such as Figure 1As shown, it includes a user interaction interface, a feature embedding module, a BinCode-Transfommer conversion model, a model training module, a data loading module and a file generation module, wherein the data loading module and the feature embedding module are connected in sequence, the feature embedding module is respectively connected to the BinCode-Transfommer conversion model and the model training module, and the BinCode-Transfommer conversion model and the model training module are respectively connected to the file generation module.
[0028] The user interface receives the user-specified source project binary file root directory and conversion target key parameters such as CPU architecture, big and small endian, operating system, etc. The data loading module receives the directory specified by the user interface to read the binary file content (the conversion mode does not require instruction set specifications, ABI specifications and other auxiliary information content). And parse the binary file to generate information such as opcodes, operands and symbol tables. The information parsed in the data loading module is input to the Glove pre-trained model to generate feature vectors, and position encoding is performed at the same time. The word feature vector and position encoding are input to the BinCode-Transfommer conversion model to generate the target architecture word vector. The target architecture word vector is used as input in the file generation module to generate a specific binary target file and save it in the directory specified by the interface.
[0029] The user interface is used to specify the root directory of the application to be converted in the conversion mode. You need to select the conversion target parameters CPU instruction set, operating system, big and small endian. The system starts to call the conversion model and facilitates the conversion of all files in the directory, generating the target binary application to the specified directory.
[0030] Data loading includes conversion mode and training mode.
[0031] like Figure 2 As shown, the conversion mode reads the root directory specified by the interface, traverses all files to be converted in all folders under the root directory, reads binary files, parses the binary files, and parses the file format, operating system, ABI and version information as metadata for management; the ELF file is split into data according to the file format definition, split into operation code, operand and Section, character table structured data.
[0032] like Figure 3 As shown, the training mode reads the contents of each directory according to the directory structure of the resources required for training, and saves all except binary files as metadata. It reads the converted source CPU architecture binary file and splits the binary file content according to the specification, reads the target binary file, and splits it according to the target CPU specification.
[0033] The feature embedding module uses the parsed binary file data as a parameter to call the GloVe word vector model trained using the binary file format language and the CPU instruction set language to generate vectors of the binary semantic table and perform position encoding feature embedding.
[0034] The BinCode-Transfommer conversion model is an AI model trained based on the sparse Transformer model and is specifically used for model conversion between different CPUs. The input of the model is a binary language vector and a positional code.
[0035] Model training uses the BinCode-Transformer pre-trained model to train for new CPU architectures or instruction sets.
[0036] The file generation module reads data from the generated original file, removes the CPU architecture information, and re-outputs it into a new file.
[0037] 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 application conversion system, characterized by: It includes a user interaction interface, a feature embedding module, a BinCode-Transfommer conversion model, a model training module, a data loading module and a file generation module, wherein the data loading module and the feature embedding module are connected in sequence, the feature embedding module is respectively connected to the BinCode-Transfommer conversion model and the model training module, and the BinCode-Transfommer conversion model and the model training module are respectively connected to the file generation module.
2. The BinCode-Transfommer conversion model, model training module and file generation module are connected in sequence, and the user interaction interface is connected to the data loading module, feature embedding module, BinCode-Transfommer conversion model, model training module and file generation module respectively.
3. The cross-CPU architecture binary application conversion system according to claim 1, characterized in that: The user interaction interface is used to specify the root directory of the application to be converted in the conversion mode. The conversion target parameters CPU instruction set, operating system, and big and small end need to be selected. The system starts to call the conversion model and facilitates the conversion of all files in the directory, generating a target binary application to the specified directory.
4. The cross-CPU architecture binary application conversion system according to claim 1, characterized in that: The data loading includes a conversion mode and a training mode.
5. The cross-CPU architecture binary application conversion system according to claim 3, characterized in that: The conversion mode reads the root directory specified in the interface, traverses all files to be converted in all folders under the root directory, reads the binary file, parses the binary file, and parses the file format, operating system, ABI and version information as metadata for management; ELF files are split into data according to the file format definition, split into operation codes, operands, sections, and character table structured data.
6. The cross-CPU architecture binary application conversion system according to claim 3, characterized in that: The training mode reads the contents of each directory according to the directory structure of the resources required for training, and saves all contents except binary files as metadata. It reads the converted source CPU architecture binary file and splits the binary file contents according to the specifications, reads the target binary file, and splits it according to the target CPU specifications.
7. The cross-CPU architecture binary application conversion system according to claim 1, characterized in that: The feature embedding module uses the parsed binary file data as a parameter to call the GloVe word vector model trained using the binary file format language and the CPU instruction set language to generate a vector of the binary semantic table and perform position encoding feature embedding.
8. The cross-CPU architecture binary application conversion system according to claim 1, characterized in that: The BinCode-Transfommer conversion model is an AI model trained based on the sparse Transformer model and is specifically used for model conversion between different CPUs. The input of the model is a binary language vector and a positional code.
9. The cross-CPU architecture binary application conversion system according to claim 1, characterized in that: The model training utilizes the BinCode-Transformer pre-trained model to train for a new CPU architecture or instruction set.
10. The cross-CPU architecture binary application conversion system according to claim 1, characterized in that: The file generation module reads data from the generated original file, removes the CPU architecture information, and re-outputs it into a new file.