General generation method and system for check points of simulator and related equipment
By combining the simulation point acquisition module and analysis tools, the problem that existing simulators have difficulty in quickly acquiring single-core and multi-core checkpoints is solved, fast and accurate checkpoint generation is achieved, and the efficiency of simulator performance evaluation and architecture exploration is improved.
Patent Information
- Application Number
- CN202511224787.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-29
- Publication Date
- 2025-09-30
- Estimated Expiration
- 2045-08-29
AI Technical Summary
Existing simulators have difficulty in quickly acquiring single-core and multi-core checkpoints for pre-silicon chip performance evaluation and architecture exploration. In particular, the gem5 simulator has a slow acquisition speed and insufficient multi-core checkpoint capabilities.
By establishing a simulation point acquisition module and simulation point analysis tools, configuring simulator parameters, collecting basic block vector files and performing cluster analysis, generating hotspot files and weight files, and realizing the rapid acquisition of single-core and multi-core checkpoints.
It realizes the rapid acquisition of single-core and multi-core checkpoints in the simulator, accurately marks the required code segments, filters out irrelevant code segments, and improves the simulation speed and accuracy.
Smart Images

Figure CN120724936A_ABST
Abstract
Description
Technical Field
[0001] The present invention is applicable to the field of computer technology, and in particular relates to a universal checkpoint generation method and system for a simulator and related equipment. Background Art
[0002] As chip specifications increase, pre-silicon chip performance evaluation and architectural exploration become increasingly difficult. This is primarily due to the fact that chip performance evaluation and architectural exploration require running a large number of typical applications, which are typically large and nearly impossible to complete on pre-silicon chip simulators before tapeout. This is because pre-silicon simulators can only simulate a few hundred thousand instructions per second, while an application can contain hundreds of billions of instructions. To accelerate chip performance evaluation and architectural exploration, the industry has proposed the concept of simulation points (simpoints). This concept statically analyzes the application's signature basic block vector (BBV) file, uses clustering to extract hotspot code segments, and then generates checkpoints at these hotspots. These checkpoints serve as subsets of the application. The simulation results from these checkpoints can be used to infer the performance of the entire application. Based on this concept, a method for collecting application checkpoints on the QEMU emulator is proposed. These checkpoints are then simulated on a chip performance simulator, accelerating simulation speed and enabling inference of application performance from the simulation results. Checkpoints store all register and memory information of the system at the time of acquisition, allowing simulation to be restored to that point in time on the simulator or hardware platform.
[0003] However, there is already a gem5 software simulator that supports collecting checkpoints, but the gem5 collection speed is very slow. Some software simulators are faster than gem5, but can only collect checkpoints of a single core and do not have the function of collecting multi-core checkpoints.
[0004] Therefore, there is an urgent need for a new universal checkpoint generation method, system and related equipment for simulators to solve the above technical problems. Summary of the Invention
[0005] The present invention provides a universal checkpoint generation method, system and related equipment for a simulator, aiming to enable rapid acquisition of single-core and multi-core checkpoints.
[0006] In a first aspect, the present invention provides a general checkpoint generation method for an emulator, the general checkpoint generation method comprising the following steps: S1. Establish a simulation point acquisition module, configure simulation parameters of a simulator through the simulation point acquisition module, and perform a first simulation on the simulator to acquire instructions of a target application within a collection interval to obtain a basic block vector file; S2. Performing cluster analysis on the basic block vector file using a simulation point analysis tool to obtain a hotspot file and a weight file; S3. The simulator performs a second simulation based on the hotspot file and the weight file to obtain multiple checkpoints corresponding to the hotspot file.
[0007] Preferably, step S1 includes the following sub-steps: S11, adding a simulation point start instruction and a simulation point end instruction in the simulator based on the simulation point acquisition module, wherein the simulation point start instruction and the simulation point end instruction are used to determine the acquisition interval of the application to be acquired; S12, the simulator starts a first simulation and executes the instructions of the application to be collected; S13, when the current instruction is executed, the instruction information corresponding to the current instruction is transmitted to the simulation point acquisition module; S14, determining whether the current instruction information is the simulation point start instruction: if so, the instruction counter in the simulation point acquisition module starts counting, executes the next instruction in the application to be acquired, and transmits the corresponding instruction information to the simulation point acquisition module, and proceeds to step S15; if not, executes the next instruction in the application to be acquired, and returns to step S13; S15, adding one to the first calculated value of the instruction counter, and determining whether the current instruction information is a control instruction: if so, updating the basic block vector node information according to the hash table through the instruction counter; if not, proceeding to step S17; S16. Determine whether the first calculated value is greater than or equal to a preset collection interval: if so, clear the first calculated value to zero, and generate corresponding basic block vector information according to the basic block vector node information to a preset path; S17. Determine whether the current instruction information is the simulation point end instruction: if so, the simulator ends the simulation and generates the basic block vector file output according to the basic block vector information; if not, execute the next instruction in the application to be collected, and pass the corresponding instruction information to the simulation point collection module, and return to step S15.
[0008] Preferably, step S15 includes the following sub-steps: S151. When the current instruction information is a control instruction, the instruction counter searches the node of the hash table to see whether the corresponding basic block vector information already exists. If so, the basic block vector node information is updated according to the current instruction information. If not, a new node is created in the hash table.
[0009] Preferably, the control instructions include jump instructions and branch instructions.
[0010] Preferably, step S3 includes the following sub-steps: S31, the simulator starts simulation, executes instructions in the application to be collected, reads the hotspot file and the weight file, sorts the hotspot positions in the hotspot file in ascending order, and multiplies each hotspot position by the preset collection interval to obtain a hotspot queue; S32, determining whether the instruction information corresponding to the instruction currently executed by the simulator is the simulation point start instruction: if so, proceeding to step S33; if not, the simulator executes the next instruction and repeats step S32; S33, adding one to the second calculated value of the instruction counter, and determining whether the second calculated value is greater than or equal to the head hotspot position in the hotspot queue: if so, taking out and deleting the head hotspot position in the hotspot queue, and generating the corresponding checkpoint; if not, proceeding to step S34; S34. Determine whether the current instruction information is the simulation point end instruction: if so, the simulator ends the simulation and outputs all the checkpoints; if not, the simulator executes the next instruction and returns to step S33.
[0011] Preferably, in step S2, the simulation point analysis tool performs cluster analysis on the basic block vector file based on the K-means algorithm to obtain the hotspot file and the weight file.
[0012] In a second aspect, the present invention further provides a universal checkpoint generation system for an emulator, the universal checkpoint generation system comprising: An acquisition module is used to establish a simulation point acquisition module, configure simulation parameters of the simulator through the simulation point acquisition module, and perform a first simulation on the simulator to acquire the application program to be acquired, thereby obtaining a basic block vector file; An analysis module, configured to perform cluster analysis on the basic block vector file using a simulation point analysis tool to obtain a hotspot file and a weight file; A generation module is used for the simulator to perform a second simulation based on the hotspot file and the weight file to obtain multiple checkpoints corresponding to the hotspot file.
[0013] Preferably, in the analysis module, the simulation point analysis tool performs cluster analysis on the basic block vector file based on a K-means algorithm to obtain the hotspot file and the weight file.
[0014] In a third aspect, the present invention also provides a computer device comprising: a memory, a processor, and a general checkpoint generation program for an emulator stored on the memory and runnable on the processor, wherein when the processor executes the general checkpoint generation program for the emulator, the processor implements the steps in the general checkpoint generation method for the emulator as described in any one of the above embodiments.
[0015] In a fourth aspect, the present invention also provides a computer-readable storage medium, on which a general checkpoint generation program for an emulator is stored. When the general checkpoint generation program for an emulator is executed by a processor, the steps in the general checkpoint generation method for an emulator as described in any one of the above embodiments are implemented.
[0016] Compared with the prior art, the present invention establishes a simulation point acquisition module, which configures the simulation parameters of the simulator and performs a first simulation on the simulator to collect instructions within the acquisition interval of the application to be collected, thereby obtaining a basic block vector file; a simulation point analysis tool performs cluster analysis on the basic block vector file to obtain a hotspot file and a weight file; the simulator performs a second simulation based on the hotspot file and the weight file to obtain multiple checkpoints corresponding to the hotspot file. The present invention can quickly collect checkpoints for single-core and multi-core systems, add a simulated point start instruction and a simulated point end instruction to the simulator, and can also determine the acquisition interval of the application by setting the simulated point start instruction and the simulated point end instruction, so as to accurately mark the code segments that need to be collected and filter out irrelevant code segments, effectively solving the problem of collecting multi-core checkpoints. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The present invention will be described in detail below with reference to the accompanying drawings. The above and other aspects of the present invention will become clearer and easier to understand through the detailed description made with reference to the following drawings. In the accompanying drawings: Figure 1 It is a flowchart of a general checkpoint generation method for a simulator provided by an embodiment of the present invention; Figure 2 1 is a schematic diagram of the structure of a universal checkpoint generation system for a simulator provided by an embodiment of the present invention; Figure 3 It is a structural diagram of a computer device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0018] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0019] Example 1 Please refer to Figure 1 The present invention provides a general checkpoint generation method for an emulator, the general checkpoint generation method for an emulator comprising the following steps: S1. Establish a simulation point acquisition module, configure simulation parameters of the simulator through the simulation point acquisition module, and perform a first simulation on the simulator to acquire instructions within a collection interval of the application to be acquired, thereby obtaining a basic block vector file; In an embodiment of the present invention, the simulation point acquisition module is a functional module developed through programming to enable the simulator to have the checkpoint acquisition function. The simulator is a QEMU simulator. Simulation parameters include the core ID for collecting basic block vector files, the simulation point acquisition module path, a preset acquisition interval, the application to be collected, and the path where the basic block vector files are saved. In the present invention, the preset acquisition interval is 20,000,000, although other preset acquisition intervals are also feasible.
[0020] Wherein, step S1 includes the following sub-steps: S11. Adding a simulation point start instruction and a simulation point end instruction in the simulator based on the simulation point acquisition module. The simulation point start instruction (simpoint start) and the simulation point end instruction (simpoint end) are used to determine the acquisition interval of the application to be acquired. Simultaneously, the application to be acquired is modified by adding a simpoint start instruction at the beginning of the application to be acquired and a simpoint end instruction at the end of the application to be acquired. The application to be acquired is then compiled.
[0021] S12, the simulator starts the first simulation, registers the simulation point acquisition module to the simulator, and executes the instructions of the application to be acquired; S13: When the current instruction is executed, the instruction information corresponding to the current instruction is transmitted to the simulation point acquisition module. That is, during the simulation process, the simulator acquisition core will call the callback function to transmit the instruction information to the simulation point acquisition module every time an instruction is executed.
[0022] S14, determining whether the current instruction information is the simulation point start instruction; if so, the instruction counter (PC) in the simulation point acquisition module starts counting, executes the next instruction in the application to be acquired, and transmits the corresponding instruction information to the simulation point acquisition module, and proceeds to step S15; if not, executes the next instruction in the application to be acquired, and returns to step S13; S15, adding one to the first calculated value of the instruction counter, and determining whether the current instruction information is a control instruction (the control instruction includes a jump instruction and a branch instruction); if so, updating the basic block vector node information according to the hash table through the instruction counter; if not, proceeding to step S17; In this embodiment of the present invention, step S15 includes the following sub-steps: S151. When the current instruction information is a control instruction, the instruction counter searches the node of the hash table to see whether the corresponding basic block vector information already exists; if so, the basic block vector node information is updated according to the current instruction information; if not, a new node is created in the hash table.
[0023] S16. Determine whether the first calculated value is greater than or equal to a preset collection interval; if so, clear the first calculated value to zero, and generate corresponding basic block vector information according to the basic block vector node information to a preset path; S17. Determine whether the current instruction information is the simulation point end instruction; if so, the simulator ends the simulation and generates the basic block vector file output according to the basic block vector information; if not, execute the next instruction in the application to be collected, and pass the corresponding instruction information to the simulation point collection module, and return to step S15.
[0024] S2. Perform cluster analysis on the basic block vector file using a simulation point analysis tool (the simulation point analysis tool is the open source Simpoint3.2 program) to obtain a hotspot file and a weight file.
[0025] In an embodiment of the present invention, in step S2, the simulation point analysis tool performs cluster analysis on the basic block vector file based on the K-means algorithm to obtain the hotspot file and the weight file.
[0026] Specifically, the simulation point tool in the simulator is used to perform cluster analysis on the hotspots based on the K-means algorithm to generate a maximum of maxK hotspots. In the embodiment of the present invention, maxK is set to 30. Of course, other values of maxK are also feasible and can be set according to actual conditions. The hotspot file is used to record the preset collection interval in which the hotspot is located, and the weight file is used to record the weight of each hotspot. The sum of all weights is 1. For example, when the preset collection interval is 20000000, there is a point 2 in the hotspot file, then the position of the 2*20000000=40000000 instruction after the simulation point start instruction is a hotspot, and so on, to obtain a maximum of maxK hotspots.
[0027] S3. The simulator performs a second simulation based on the hotspot file and the weight file to obtain multiple checkpoints corresponding to the hotspot file.
[0028] In this embodiment of the present invention, step S3 includes the following sub-steps: S31, the simulator starts simulation, executes instructions in the application to be collected, reads the hotspot file and the weight file, sorts the hotspot positions in the hotspot file in ascending order, and multiplies each hotspot position by the preset collection interval to obtain a hotspot queue; S32, determining whether the instruction information corresponding to the instruction currently executed by the simulator is the simulation point start instruction; if so, proceeding to step S33; if not, the simulator executes the next instruction and repeats step S32; S33, adding one to the second calculated value of the instruction counter, and determining whether the second calculated value is greater than or equal to the head hotspot position in the hotspot queue; if so, taking out and deleting the head hotspot position in the hotspot queue, and generating the corresponding checkpoint; if not, proceeding to step S34; S34. Determine whether the current instruction information is the simulation point end instruction; if so, the simulator ends the simulation and outputs all the checkpoints; if not, the simulator executes the next instruction and returns to step S33.
[0029] Specifically, step S3 will perform the following process when generating a checkpoint: the simulator starts the simulation. The checkpoint plug-in in the simulator reads the hotspot file and the weight file, sorts the hotspot positions from small to large, and then multiplies each position by the sampling interval to be the accurate hotspot position. The hotspot position is then stored in the queue to obtain a hotspot queue. A checkpoint is generated for each hotspot position. The first hotspot position is read from the head of the hotspot queue. During the simulation process, the simulator will call back the function in the plug-in every time it executes an instruction, and add one to the second calculated value of the instruction counter. When the simulation point start instruction is executed, the instruction counter starts counting. When the value of the instruction counter is greater than or equal to the retrieved hotspot position, a checkpoint generation instruction is sent to the simulator to generate a checkpoint, which is named with the hotspot position and weight, and saved to the specified path. Then delete the queue head element, retrieve the head hotspot position, repeat the above process until all checkpoints are generated, and end the simulation. This achieves rapid collection of single-core and multi-core checkpoints.
[0030] Compared with the prior art, the present invention establishes a simulation point acquisition module, configures the simulation parameters of the simulator through the simulation point acquisition module, and performs a first simulation on the simulator to collect instructions within the acquisition interval of the application to be collected, thereby obtaining a basic block vector file; a simulation point analysis tool performs cluster analysis on the basic block vector file to obtain a hotspot file and a weight file; the simulator performs a second simulation based on the hotspot file and the weight file to obtain multiple checkpoints corresponding to the hotspot file. The present invention can quickly collect checkpoints for single-core and multi-core, adds a simulated point start instruction and a simulated point end instruction to the simulator, and can also determine the acquisition interval of the application by setting the simulated point start instruction and the simulated point end instruction, so as to accurately mark the code segments that need to be collected and filter out irrelevant code segments, effectively solving the problem of collecting multi-core checkpoints.
[0031] Example 2 The embodiment of the present invention also provides a general checkpoint generation system 200 for a simulator, please refer to Figure 2 , FIG is a schematic diagram of the structure of a general checkpoint generation system 200 for a simulator provided in an embodiment of the present invention, which includes: 201. An acquisition module is configured to establish a simulation point acquisition module, configure simulation parameters of the simulator through the simulation point acquisition module, and perform a first simulation on the application to be acquired through the simulator to obtain a basic block vector file.
[0032] In an embodiment of the present invention, the simulation point acquisition module is a functional module that enables the emulator to collect checkpoints. The emulator is a QEMU emulator. Simulation parameters include the core ID for collecting basic block vector files, the simulation point acquisition module path, a preset acquisition interval, the application to be collected, and the path where the basic block vector files are saved. In the present invention, the preset acquisition interval is 20,000,000, although other preset acquisition intervals are also feasible.
[0033] The acquisition module 201 includes the following subunits: The first acquisition unit is configured to set a simulation point start instruction and a simulation point end instruction in the simulator based on the simulation point acquisition module. The simulation point start instruction (simpoint start) and the simulation point end instruction (simpoint end) are used to determine the acquisition interval of the application to be acquired; modify the application to be acquired by adding simpoint start at the beginning of the application to be acquired and simpoint end at the end of the application to be acquired; and then compile the application to be acquired.
[0034] A second collection unit is configured to start a first simulation on the simulator, register a simulation point collection module to the simulator, and execute instructions of the application program to be collected; The third acquisition unit is used to transmit the instruction information corresponding to the current instruction to the simulation point acquisition module when the current instruction is executed. That is, during the simulation process, the simulator acquisition core will call the callback function to transmit the instruction information to the simulation point acquisition module every time it completes the execution of an instruction.
[0035] a fourth acquisition unit, configured to determine whether the current instruction information is the simulation point start instruction; if so, the program counter (PC) in the simulation point acquisition module starts counting, executes the next instruction in the application to be acquired, and transmits the corresponding instruction information to the simulation point acquisition module, and jumps to the fifth acquisition unit; if not, executes the next instruction in the application to be acquired, and jumps to the third acquisition unit; a fifth acquisition unit, configured to increment the first calculated value of the instruction counter by one and determine whether the current instruction information is a control instruction (the control instruction includes a jump instruction and a branch instruction); if so, update the basic block vector node information according to the hash table using the instruction counter; if not, jump to the seventh acquisition unit; The fifth acquisition subunit is configured to, when the current instruction information is a control instruction, cause the instruction counter to search whether the corresponding basic block vector information already exists in the node of the hash table; if so, update the basic block vector node information according to the current instruction information; if not, create a new node in the hash table.
[0036] a sixth collection unit, configured to determine whether the first calculated value is greater than or equal to a preset collection interval; if so, clear the first calculated value to zero, and generate corresponding basic block vector information according to the basic block vector node information to a preset path; The seventh acquisition unit is used to determine whether the current instruction information is the simulation point end instruction; if so, the simulator ends the simulation and generates the basic block vector file output based on the basic block vector information; if not, execute the next instruction in the application to be acquired, and pass the corresponding instruction information to the simulation point acquisition module, and jump to the fifth acquisition unit.
[0037] 202. An analysis module is configured to perform cluster analysis on the basic block vector file using a simulation point analysis tool (the simulation point analysis tool is an open source Simpoint 3.2 program) to obtain a hotspot file and a weight file.
[0038] In an embodiment of the present invention, the simulation point analysis tool performs cluster analysis on the basic block vector file based on the K-means algorithm to obtain the hotspot file and the weight file.
[0039] Specifically, the simulation point tool in the simulator is used to perform cluster analysis on the hotspots based on the K-means algorithm to generate a maximum of maxK hotspots. In the embodiment of the present invention, maxK is set to 30. Of course, other values of maxK are also feasible and can be set according to actual conditions. The hotspot file is used to record the preset collection interval in which the hotspot is located, and the weight file is used to record the weight of each hotspot. The sum of all weights is 1. For example, when the preset collection interval is 20000000, there is a point 2 in the hotspot file, then the position of the 2*20000000=40000000 instruction after the simulation point start instruction is a hotspot, and so on, to obtain a maximum of maxK hotspots.
[0040] 203. A generation module is used for the simulator to perform a second simulation based on the hotspot file and the weight file to obtain multiple checkpoints corresponding to the hotspot file.
[0041] In an embodiment of the present invention, the generation module includes the following subunits: A first generating unit is configured to start a simulation on the simulator, execute instructions in the application to be collected, read the hotspot file and the weight file, sort the hotspot positions in the hotspot file in ascending order, and multiply each hotspot position by the preset collection interval to obtain a hotspot queue; The second generating unit is configured to determine whether the instruction information corresponding to the instruction currently executed by the simulator is the simulation point start instruction; if so, jump to the third generating unit; if not, the simulator executes the next instruction and repeats the second generating unit; a third generating unit, configured to add one to the second calculated value of the instruction counter, and determine whether the second calculated value is greater than or equal to the head hot spot position in the hot spot queue; if so, taking out and deleting the head hot spot position in the hot spot queue, and generating the corresponding checkpoint; if not, jumping to the fourth generating unit; The fourth generation unit is used to determine whether the current instruction information is the simulation point end instruction; if so, the simulator ends the simulation and outputs all the checkpoints; if not, the simulator executes the next instruction and jumps to the third generation unit.
[0042] Specifically, the third generation unit performs the following process when generating a checkpoint: The simulator starts the simulation. The checkpoint plug-in in the simulator reads the hotspot file and weight file, sorts the hotspot locations from smallest to largest, and then multiplies each location by the sampling interval to determine the accurate hotspot location. The hotspot locations are then stored in a queue, forming a hotspot queue. A checkpoint is generated for each hotspot location. The first hotspot location is read from the head of the hotspot queue. During the simulation, the simulator calls back the function in the plug-in after each instruction is executed, incrementing the second calculated value of the instruction counter by one. The instruction counter begins counting when the simulation point start instruction is executed. When the instruction counter value is greater than or equal to the retrieved hotspot location, a generate checkpoint command is sent to the simulator, generating a checkpoint, naming it with the hotspot location and weight, and saving it to the specified path. The head element of the queue is then deleted, and the head hotspot location is retrieved. The above process is repeated until all checkpoints are generated, ending the simulation. This enables rapid collection of single-core and multi-core checkpoints.
[0043] The universal checkpoint generation system 200 for the simulator can implement the steps in the universal checkpoint generation method for the simulator in the above embodiment, and can achieve the same technical effects. Please refer to the description in the above embodiment and will not be repeated here.
[0044] Example 3 The embodiment of the present invention also provides a computer device, please refer to Figure 3 , Figure 3 3 is a structural diagram of a computer device provided by an embodiment of the present invention. The computer device 300 includes: a memory 302, a processor 301, and a general checkpoint generation program for the simulator stored in the memory 302 and capable of running on the processor 301.
[0045] The processor 301 calls the simulator checkpoint general generation program stored in the memory 302 and executes the steps of the simulator checkpoint general generation method provided by the embodiment of the present invention. Figure 1 , specifically including the following steps: S1. Establish a simulation point acquisition module, configure simulation parameters of the simulator through the simulation point acquisition module, and perform a first simulation on the simulator to acquire instructions within a collection interval of the application to be acquired, thereby obtaining a basic block vector file; S2. Performing cluster analysis on the basic block vector file using a simulation point analysis tool to obtain a hotspot file and a weight file; S3. The simulator performs a second simulation based on the hotspot file and the weight file to obtain multiple checkpoints corresponding to the hotspot file.
[0046] The computer device 300 provided in the embodiment of the present invention can implement the steps in the general checkpoint generation method of the simulator in the above embodiment and can achieve the same technical effects. Please refer to the description in the above embodiment and will not be repeated here.
[0047] Example 4 An embodiment of the present invention also provides a computer-readable storage medium, on which a general checkpoint generation program for the simulator is stored. When the general checkpoint generation program for the simulator is executed by a processor, the various processes and steps in the general checkpoint generation method for the simulator provided by an embodiment of the present invention are implemented, and the same technical effects can be achieved. To avoid repetition, they will not be repeated here.
[0048] Those skilled in the art will appreciate that all or part of the processes in the above-described method embodiments can be implemented by instructing the relevant hardware through a computer program. The program can be stored in a computer-readable storage medium, and when executed, the program can include the processes in the above-described method embodiments. The storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).
[0049] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.
[0050] Through the above description of the embodiments, those skilled in the art will clearly understand that the methods of the above embodiments can be implemented using software plus the necessary general-purpose hardware platform. Of course, hardware can also be used, but in many cases the former is the more preferred implementation method. Based on this understanding, the technical solution of the present invention, or the portion that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, or optical disk) and includes a number of instructions for enabling a terminal (such as a mobile phone, computer, server, air conditioner, or network device) to execute the methods described in the various embodiments of the present invention.
[0051] The embodiments of the present invention are described above in conjunction with the accompanying drawings. What is disclosed is only a preferred embodiment of the present invention. However, the present invention is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present invention, ordinary technicians in this field can also make many forms and equivalent changes without departing from the scope of protection of the purpose of the present invention and the claims, which are all within the protection of the present invention.
Claims
1. A general checkpoint generation method for a simulator, characterized in that: The general checkpoint generation method comprises the following steps: S1. Establish a simulation point acquisition module, configure simulation parameters of the simulator through the simulation point acquisition module, and perform a first simulation on the simulator to acquire instructions within a collection interval of the application to be acquired, thereby obtaining a basic block vector file; S2. Perform cluster analysis on the basic block vector file using a simulation point analysis tool to obtain a hotspot file and a weight file; S3. The simulator performs a second simulation based on the hotspot file and the weight file to obtain multiple checkpoints corresponding to the hotspot file.
2. The universal checkpoint generation method for a simulator according to claim 1, wherein: Step S1 includes the following sub-steps: S11, adding a simulation point start instruction and a simulation point end instruction in the simulator based on the simulation point acquisition module, wherein the simulation point start instruction and the simulation point end instruction are used to determine the acquisition interval of the application to be acquired; S12, the simulator starts a first simulation and executes the instructions of the application to be collected; S13. When the current instruction is executed, the instruction information corresponding to the current instruction is transmitted to the simulation point acquisition module; S14, determining whether the current instruction information is the simulation point start instruction: if so, the instruction counter in the simulation point acquisition module starts counting, executes the next instruction in the application to be acquired, and transmits the corresponding instruction information to the simulation point acquisition module, and proceeds to step S15; If not, execute the next instruction in the application to be collected and return to step S13; S15, adding one to the first calculated value of the instruction counter, and determining whether the current instruction information is a control instruction: if so, updating the basic block vector node information according to the hash table through the instruction counter; if not, proceeding to step S17; S16. Determine whether the first calculated value is greater than or equal to a preset collection interval: if so, clear the first calculated value to zero, and generate corresponding basic block vector information according to the basic block vector node information to a preset path; S17. Determine whether the current instruction information is the simulation point end instruction: if so, the simulator ends the simulation and generates the basic block vector file output according to the basic block vector information; if not, execute the next instruction in the application to be collected, and pass the corresponding instruction information to the simulation point collection module, and return to step S15.
3. The universal checkpoint generation method for a simulator according to claim 2, wherein: Step S15 includes the following sub-steps: S151. When the current instruction information is a control instruction, the instruction counter searches the node of the hash table to see whether the corresponding basic block vector information already exists. If so, the basic block vector node information is updated according to the current instruction information. If not, a new node is created in the hash table.
4. The universal checkpoint generation method for a simulator according to claim 2, wherein: The control instructions include jump instructions and branch instructions.
5. The universal checkpoint generation method for a simulator according to claim 2, wherein: Step S3 includes the following sub-steps: S31, the simulator starts simulation, executes instructions in the application to be collected, reads the hotspot file and the weight file, sorts the hotspot positions in the hotspot file in ascending order, and multiplies each hotspot position by the preset collection interval to obtain a hotspot queue; S32, determining whether the instruction information corresponding to the instruction currently executed by the simulator is the simulation point start instruction: if so, proceeding to step S33; if not, the simulator executes the next instruction and repeats step S32; S33, adding one to the second calculated value of the instruction counter, and determining whether the second calculated value is greater than or equal to the head hotspot position in the hotspot queue: if so, taking out and deleting the head hotspot position in the hotspot queue, and generating the corresponding checkpoint; if not, proceeding to step S34; S34. Determine whether the current instruction information is the simulation point end instruction: if so, the simulator ends the simulation and outputs all the checkpoints; if not, the simulator executes the next instruction and returns to step S33.
6. The universal checkpoint generation method for a simulator according to claim 1, wherein: In step S2, the simulation point analysis tool performs cluster analysis on the basic block vector file based on the K-means algorithm to obtain the hotspot file and the weight file.
7. A universal checkpoint generation system for a simulator, characterized in that: The general checkpoint generation system includes: An acquisition module is used to establish a simulation point acquisition module, configure simulation parameters of the simulator through the simulation point acquisition module, and perform a first simulation on the simulator to acquire the application program to be acquired, thereby obtaining a basic block vector file; An analysis module, configured to perform cluster analysis on the basic block vector file using a simulation point analysis tool to obtain a hotspot file and a weight file; A generation module is used for the simulator to perform a second simulation based on the hotspot file and the weight file to obtain multiple checkpoints corresponding to the hotspot file.
8. The universal checkpoint generation system for a simulator according to claim 7, wherein: In the analysis module, the simulation point analysis tool performs cluster analysis on the basic block vector file based on the K-means algorithm to obtain the hotspot file and the weight file.
9. A computer device, characterized in that: include: A memory, a processor, and a general checkpoint generation program for an emulator stored in the memory and runnable on the processor. When the processor executes the general checkpoint generation program for the emulator, the steps in the general checkpoint generation method for the emulator as described in any one of claims 1 to 6 are implemented.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a universal checkpoint generation program for the simulator. When the universal checkpoint generation program for the simulator is executed by a processor, the steps of the universal checkpoint generation method for the simulator according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Method and device for evaluating performance of processor, computing equipment and readable storage medium
CN116149917A
Obfuscating programs using different instruction set architectures
US11741197B1
System and Method for Replicating Disk Images in a Cloud Computing Based Virtual Machine File System
US20110022574A1
System and method for basic block vector system-on-chip performance optimization
WO2025014488A1