Checkpoint universal generation method, system and related equipment of simulator
By establishing a simulated point acquisition module and analysis tools in the simulator, single-core and multi-core checkpoints are generated, solving the problem of slow acquisition speed in existing technologies and realizing fast and accurate checkpoint generation.
Patent Information
- Application Number
- CN202511224787.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-29
- Publication Date
- 2025-11-11
- Estimated Expiration
- 2045-08-29
AI Technical Summary
Existing simulators are slow and have limited functionality when collecting multi-core checkpoints, and cannot effectively support the generation of checkpoints for both single-core and multi-core systems.
The simulation parameters of the simulator are configured by establishing a simulation point acquisition module, basic block vector files are collected, and cluster analysis is performed using simulation point analysis tools to generate hotspot files and weight files. Finally, multiple checkpoints are generated in the simulator.
It enables rapid acquisition of single-core and multi-core checkpoints, accurately marks the code segments that need to be acquired, and filters out irrelevant code segments, thereby improving simulation speed and efficiency.
Smart Images

Figure CN120724936B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a general method, system and related equipment for generating checkpoints for simulators. Background Technology
[0002] As chip specifications become increasingly sophisticated, evaluating chip performance and exploring architectures before silicon becomes increasingly difficult. The main reason is that evaluating chip performance and exploring architectures requires running a large number of typical applications, which are often quite large and nearly impossible to complete before tape-out on a pre-silicon chip emulator. This is because pre-silicon emulators typically have a simulation speed of only a few hundred thousand instructions per second, while an application can have hundreds of billions of instructions. To accelerate chip performance evaluation and architecture exploration, the industry has proposed the theory of simpoints. This theory uses static analysis of the application's basic block vector (BBV) file, employs clustering methods to extract hotspot code segments, and then generates checkpoints at these hotspot locations. These checkpoints are then used as subsets of the application. The simulation results of these checkpoints are used to infer the overall application performance. Based on this theory, a method for collecting application checkpoints on a QEMU emulator is proposed. These checkpoints are then simulated on a chip performance emulator to accelerate the simulation process, and the simulation results are used to infer the application's performance. Since checkpoints store all system register and memory information at the time of acquisition, simulations can be performed at the time of acquisition on the emulator or hardware platform.
[0003] However, while there are already gem5 software emulators that support checkpoint acquisition, gem5 is very slow. Some software emulators are faster than gem5, but they can only acquire single-core checkpoints and do not have the function of acquiring multi-core checkpoints.
[0004] Therefore, there is an urgent need for a new general method, system, and related equipment for generating checkpoints in simulators to solve the above-mentioned technical problems. Summary of the Invention
[0005] This invention provides a general method, system, and related equipment for generating checkpoints in a simulator, aiming to quickly collect checkpoints for both single-core and multi-core processors.
[0006] In a first aspect, the present invention provides a general method for generating checkpoints in a simulator, the general method for generating checkpoints includes the following steps:
[0007] S1. Establish a simulation point acquisition module, configure the simulation parameters of the simulator through the simulation point acquisition module, and perform a first simulation through the simulator to acquire the instructions of the application to be acquired within the acquisition range, and obtain a basic block vector file.
[0008] S2. Perform cluster analysis on the basic block vector file using a simulated point analysis tool to obtain hotspot files and weight files;
[0009] 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.
[0010] Preferably, step S1 includes the following sub-steps:
[0011] S11. Based on the simulation point acquisition module, a simulation point start command and a simulation point end command are added to the simulator. The simulation point start command and the simulation point end command are used to determine the acquisition interval of the application to be acquired.
[0012] S12. The simulator starts the first simulation and executes the instructions of the application to be collected.
[0013] S13. When the current instruction is completed, the instruction information corresponding to the current instruction is transmitted to the simulation point acquisition module;
[0014] S14. Determine whether the current instruction information is the simulation point start instruction: if yes, the instruction counter in the simulation point acquisition module starts counting, the next instruction in the application to be acquired is executed, and the corresponding instruction information is transmitted to the simulation point acquisition module, proceeding to step S15; if no, the next instruction in the application to be acquired is executed, and the process returns to step S13.
[0015] S15. Increment the first calculated value of the instruction counter by one, and determine whether the current instruction information is a control instruction: if yes, update the basic block vector node information according to the hash table through the instruction counter; if no, proceed to step S17.
[0016] S16. Determine whether the first calculated value is greater than or equal to the preset acquisition interval: if so, clear the first calculated value to zero, and generate the corresponding basic block vector information to the preset path according to the basic block vector node information;
[0017] S17. Determine whether the current instruction information is the simulation point end instruction: if yes, the simulator ends the simulation and generates the basic block vector file output according to the basic block vector information; if no, execute the next instruction in the application to be acquired and pass the corresponding instruction information to the simulation point acquisition module, and return to step S15.
[0018] Preferably, step S15 includes the following sub-steps:
[0019] S151. When the current instruction information is a control instruction, the instruction counter checks whether the corresponding basic block vector information already exists in the node of the hash table: if yes, the basic block vector node information is updated according to the current instruction information; if no, a new node is created in the hash table.
[0020] Preferably, the control instructions include jump instructions and branch instructions.
[0021] Preferably, step S3 includes the following sub-steps:
[0022] S31. The simulator starts the simulation, executes the instructions in the application to be collected, and reads the hotspot file and the weight file. It sorts the hotspot positions in the hotspot file in ascending order and multiplies each hotspot position by the preset collection interval to obtain the hotspot queue.
[0023] S32. Determine whether the instruction information corresponding to the instruction currently executed by the simulator is the simulation point start instruction: if yes, proceed to step S33; if no, the simulator executes the next instruction and repeats step S32.
[0024] S33. Increment the second calculated value of the instruction counter by one, and determine whether the second calculated value is greater than or equal to the head hotspot position in the hotspot queue: if yes, remove and delete the head hotspot position in the hotspot queue to generate the corresponding checkpoint; if no, proceed to step S34.
[0025] S34. Determine whether the current instruction information is the simulation point end instruction: if yes, the simulator ends the simulation and outputs all the checkpoints; if no, the simulator executes the next instruction and returns to step S33.
[0026] Preferably, in step S2, the simulated 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.
[0027] Secondly, the present invention also provides a general checkpoint generation system for simulators, the general checkpoint generation system comprising:
[0028] The acquisition module is used to establish a simulated point acquisition module, configure the simulation parameters of the simulator through the simulated point acquisition module, and perform the first simulation through the simulator to acquire the application to be acquired, thereby obtaining the basic block vector file.
[0029] The analysis module is used to perform cluster analysis on the basic block vector file using a simulated point analysis tool to obtain hotspot files and weight files;
[0030] The generation module is used by 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.
[0031] Preferably, in the analysis module, the simulated 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.
[0032] Thirdly, the present invention also provides a computer device, comprising: a memory, a processor, and a general checkpoint generation program for an emulator stored in the memory and executable on the processor, wherein when the processor executes the general checkpoint generation program for the emulator, it implements the steps in the general checkpoint generation method for the emulator as described in any of the above embodiments.
[0033] Fourthly, the present invention also provides a computer-readable storage medium storing a general checkpoint generation program for a simulator, wherein when the general checkpoint generation program for a simulator is executed by a processor, it implements the steps in the general checkpoint generation method for a simulator as described in any of the above embodiments.
[0034] Compared with existing technologies, this invention establishes a simulated point acquisition module. This module configures the simulation parameters of the simulator and performs a first simulation to collect instructions from the application program within the acquisition range, obtaining a basic block vector file. A simulated point analysis tool then performs cluster analysis on the basic block vector file to obtain hotspot files and weight files. The simulator performs a second simulation based on the hotspot files and weight files to obtain multiple checkpoints corresponding to the hotspot files. This invention can quickly acquire checkpoints for both single-core and multi-core applications. It adds simulated point start and end commands to the simulator and determines the acquisition range of the application program by setting these commands, accurately marking the code segments to be acquired and filtering out irrelevant code segments, effectively solving the problem of multi-core checkpoint acquisition. Attached Figure Description
[0035] The present invention will now be described in detail with reference to the accompanying drawings. The above and other aspects of the present invention will become clearer and more readily understood through the detailed description following the accompanying drawings. In the drawings:
[0036] Figure 1 This is a flowchart of the general checkpoint generation method for simulators provided in this embodiment of the invention;
[0037] Figure 2 This is a schematic diagram of the structure of the universal checkpoint generation system for the simulator provided in this embodiment of the invention;
[0038] Figure 3 This is a schematic diagram of the structure of a computer device provided in an embodiment of the present invention. Detailed Implementation
[0039] To make the objectives, technical solutions, and advantages of this invention clearer, the 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 merely illustrative and not intended to limit the invention.
[0040] Example 1
[0041] Please refer to Figure 1 This invention provides a general method for generating checkpoints in a simulator, which includes the following steps:
[0042] S1. Establish a simulation point acquisition module, configure the simulation parameters of the simulator through the simulation point acquisition module, and perform the first simulation through the simulator to acquire the instructions of the application to be acquired within the acquisition range, and obtain the basic block vector file.
[0043] In this embodiment of the invention, the simulated point acquisition module is a functional module developed through programming to enable the simulator to acquire checkpoints. The simulator is a QEMU simulator, and the simulation parameters include the kernel ID of the acquired basic block vector file, the path of the simulated point acquisition module, the preset acquisition interval, the application to be acquired, and the save path of the basic block vector file. In this invention, the preset acquisition interval is 20,000,000, but other preset acquisition intervals are also feasible.
[0044] Step S1 includes the following sub-steps:
[0045] S11. Based on the simulation point acquisition module, add simulation point start and simulation point end instructions to the simulator. The simulation point start instruction (simpoint start) and simulation point end instruction (simpoint end) are used to determine the acquisition interval of the application to be acquired. At the same time, modify the application to be acquired by adding simpoint start at the beginning and simpoint end at the end. Then compile the application to be acquired.
[0046] 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.
[0047] S13. When the current instruction is completed, the instruction information corresponding to the current instruction is passed to the simulation point acquisition module. That is, during the simulation process, the simulator acquisition core calls the callback function to pass the instruction information to the simulation point acquisition module after each instruction is executed.
[0048] S14. Determine whether the current instruction information is the simulation point start instruction; if yes, the instruction counter (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, proceeding to step S15; if no, execute the next instruction in the application to be acquired, and return to step S13.
[0049] S15. The first calculated value of the instruction counter is incremented by one, and it is determined whether the current instruction information is a control instruction (the control instruction includes jump instructions and branch instructions); if yes, the basic block vector node information is updated according to the hash table through the instruction counter; if no, step S17 is performed.
[0050] In this embodiment of the invention, step S15 includes the following sub-steps:
[0051] S151. When the current instruction information is a control instruction, the instruction counter checks whether the corresponding basic block vector information already exists in the node of the hash table; if yes, the basic block vector node information is updated according to the current instruction information; if no, a new node is created in the hash table.
[0052] S16. Determine whether the first calculated value is greater than or equal to the preset acquisition interval; if so, clear the first calculated value to zero, and generate the corresponding basic block vector information to the preset path according to the basic block vector node information;
[0053] S17. Determine whether the current instruction information is the simulation point end instruction; if yes, the simulator ends the simulation and generates the basic block vector file output according to the basic block vector information; if no, execute the next instruction in the application to be acquired and pass the corresponding instruction information to the simulation point acquisition module, and return to step S15.
[0054] S2. Perform cluster analysis on the basic block vector file using a simulated point analysis tool (the simulated point analysis tool is the open-source Simpoint 3.2 program) to obtain hotspot files and weight files.
[0055] In this embodiment of the invention, in step S2, the simulated 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.
[0056] Specifically, the simulated point tool in the simulator performs cluster analysis on hotspots based on the K-means algorithm, generating a maximum of maxK hotspots. In this embodiment, maxK is set to 30, but other values for maxK are also feasible and can be set according to actual conditions. The hotspot file records the preset acquisition interval in which a hotspot occurs, and the weight file records the weight of each hotspot; the sum of all weights is 1. For example, if the preset acquisition interval is 20,000,000, and there is a point 2 in the hotspot file, then the position of the 2nd * 20,000,000 = 40,000,000th instruction after the simulated point start instruction is a hotspot, and so on, to obtain a maximum of maxK hotspots.
[0057] 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.
[0058] In this embodiment of the invention, step S3 includes the following sub-steps:
[0059] S31. The simulator starts the simulation, executes the instructions in the application to be collected, and reads the hotspot file and the weight file. It sorts the hotspot positions in the hotspot file in ascending order and multiplies each hotspot position by the preset collection interval to obtain the hotspot queue.
[0060] S32. Determine whether the instruction information corresponding to the instruction currently executed by the simulator is the simulation point start instruction; if yes, proceed to step S33; if no, the simulator executes the next instruction and repeats step S32.
[0061] S33. Increment the second calculated value of the instruction counter by one, and determine whether the second calculated value is greater than or equal to the head hotspot position in the hotspot queue; if yes, remove and delete the head hotspot position in the hotspot queue to generate the corresponding checkpoint; if no, proceed to step S34.
[0062] S34. Determine whether the current instruction information is the simulation point end instruction; if yes, the simulator ends the simulation and outputs all the checkpoints; if no, the simulator executes the next instruction and returns to step S33.
[0063] Specifically, step S3 involves the following process when generating checkpoints: The simulator starts the simulation. The checkpoint plugin in the simulator reads the hotspot file and weight file, sorts the hotspot positions from smallest to largest, and then multiplies each position by the sampling interval to obtain the accurate hotspot position. The hotspot positions are then stored in a queue, forming 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, the simulator calls back a function in the plugin after executing each instruction, incrementing the second calculated value of the instruction counter. When the simulation 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, generating a checkpoint, naming it with the hotspot position and weight, and saving the checkpoint to a specified path. Then, the head element of the queue is deleted, the head hotspot position is retrieved, and the above process is repeated until all checkpoints are generated, ending the simulation. This achieves rapid acquisition of checkpoints for both single-core and multi-core systems.
[0064] Compared with existing technologies, this invention establishes a simulated point acquisition module. This module configures the simulator's simulation parameters and performs a first simulation to collect instructions from the application program within the acquisition range, resulting in a basic block vector file. A simulated point analysis tool then performs cluster analysis on the basic block vector file to obtain hotspot files and weight files. The simulator performs a second simulation based on the hotspot files and weight files to obtain multiple checkpoints corresponding to the hotspot files. This invention can quickly acquire checkpoints for both single-core and multi-core applications. It adds simulated point start and end commands to the simulator and determines the application's acquisition range by setting these commands, accurately identifying the code segments to be acquired and filtering out irrelevant segments, effectively solving the problem of multi-core checkpoint acquisition.
[0065] Example 2
[0066] This invention also provides a universal checkpoint generation system 200 for simulators, please refer to... Figure 2 The figure is a schematic diagram of the structure of a universal checkpoint generation system 200 for a simulator provided in an embodiment of the present invention, which includes:
[0067] 201. Acquisition Module: Used to establish a simulation point acquisition module, configure the simulation parameters of the simulator through the simulation point acquisition module, and perform the first simulation through the simulator to acquire the application to be acquired, thereby obtaining a basic block vector file.
[0068] In this embodiment of the invention, the simulated point acquisition module is a functional module that enables the simulator to acquire checkpoints. The simulator is a QEMU simulator, and the simulation parameters include the kernel ID of the acquired basic block vector file, the path of the simulated point acquisition module, the preset acquisition interval, the application to be acquired, and the save path of the basic block vector file. In this invention, the preset acquisition interval is 20,000,000, but other preset acquisition intervals are also feasible.
[0069] The acquisition module 201 includes the following sub-units:
[0070] The first acquisition unit is used to set a simulation point start command and a simulation point end command in the simulator based on the simulation point acquisition module. The simulation point start command (simpoint start) and the simulation point end command (simpoint end) are used to determine the acquisition interval of the application to be acquired. At the same time, the application to be acquired is modified by adding simpoint start at the beginning of the application and simpoint end at the end. Then the application to be acquired is compiled.
[0071] The second acquisition unit is used to start the first simulation of the simulator, register the simulation point acquisition module to the simulator, and execute the instructions of the application to be acquired.
[0072] 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 completed. That is, during the simulation process, the simulator acquisition core calls the callback function to transmit the instruction information to the simulation point acquisition module after each instruction is executed.
[0073] The fourth acquisition unit is used to determine whether the current instruction information is the simulation point start instruction; if so, the instruction counter (Program Counter, PC) in the simulation point acquisition module starts counting, the next instruction in the application to be acquired is executed, and the corresponding instruction information is transmitted to the simulation point acquisition module, and then jumps to the fifth acquisition unit; if not, the next instruction in the application to be acquired is executed, and then jumps to the third acquisition unit.
[0074] The fifth acquisition unit is used 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 jump instructions and branch instructions); if yes, the basic block vector node information is updated according to the hash table through the instruction counter; if no, the process jumps to the seventh acquisition unit.
[0075] The fifth acquisition subunit is used to, when the current instruction information is a control instruction, use the instruction counter to check whether the corresponding basic block vector information already exists in the node of the hash table; if yes, then update the basic block vector node information according to the current instruction information; if no, then create a new node in the hash table.
[0076] The sixth acquisition unit is used to determine whether the first calculated value is greater than or equal to the preset acquisition interval; if so, the first calculated value is cleared to zero, and the corresponding basic block vector information is generated according to the basic block vector node information and sent to the preset path.
[0077] The seventh acquisition unit is used to determine whether the current instruction information is the simulation point end instruction; if yes, the simulator ends the simulation and generates the basic block vector file output according to the basic block vector information; if no, the next instruction in the application to be acquired is executed, and the corresponding instruction information is transmitted to the simulation point acquisition module, and the process jumps to the fifth acquisition unit.
[0078] 202. Analysis module, used to perform cluster analysis on the basic block vector file using a simulated point analysis tool (the simulated point analysis tool is the open-source Simpoint 3.2 program) to obtain hotspot files and weight files.
[0079] In this embodiment of the invention, the simulated 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.
[0080] Specifically, the simulated point tool in the simulator performs cluster analysis on hotspots based on the K-means algorithm, generating a maximum of maxK hotspots. In this embodiment, maxK is set to 30, but other values for maxK are also feasible and can be set according to actual conditions. The hotspot file records the preset acquisition interval in which a hotspot occurs, and the weight file records the weight of each hotspot; the sum of all weights is 1. For example, if the preset acquisition interval is 20,000,000, and there is a point 2 in the hotspot file, then the position of the 2nd * 20,000,000 = 40,000,000th instruction after the simulated point start instruction is a hotspot, and so on, to obtain a maximum of maxK hotspots.
[0081] 203. Generation module, used by 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.
[0082] In this embodiment of the invention, the generation module includes the following sub-units:
[0083] The first generation unit is used to start the simulation of the simulator, execute the instructions in the application to be collected, and read the hot spot file and the weight file, sort the hot spot positions in the hot spot file in ascending order, and multiply each hot spot position by the preset collection interval to obtain the hot spot queue.
[0084] The second generation unit is used to determine whether the instruction information corresponding to the instruction currently executed by the simulator is the simulation point start instruction; if yes, it jumps to the third generation unit; if no, the simulator executes the next instruction and repeats the execution of the second generation unit.
[0085] The third generation unit is used to increment the second calculated value of the instruction counter by one, 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, the head hot spot position in the hot spot queue is taken out and deleted to generate the corresponding checkpoint; if not, it jumps to the fourth generation unit.
[0086] The fourth generation unit is used to determine whether the current instruction information is the simulation point end instruction; if yes, the simulator ends the simulation and outputs all the checkpoints; if no, the simulator executes the next instruction and jumps to the third generation unit.
[0087] Specifically, the third generation unit performs the following process when generating checkpoints: The simulator starts the simulation. The checkpoint plugin in the simulator reads the hotspot file and weight file, sorts the hotspot positions from smallest to largest, and then multiplies each position by the sampling interval to obtain the accurate hotspot position. The hotspot positions are then stored in a queue, forming 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, the simulator calls back a function in the plugin after executing each instruction, incrementing the second calculated value of the instruction counter. When the simulation 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, generating a checkpoint, naming it with the hotspot position and weight, and saving the checkpoint to a specified path. Then, the head element of the queue is deleted, the head hotspot position is retrieved, and the above process is repeated until all checkpoints are generated, ending the simulation. This achieves rapid acquisition of checkpoints for both single-core and multi-core systems.
[0088] The universal checkpoint generation system 200 for the simulator can implement the steps in the universal checkpoint generation method for the simulator as described in the above embodiments, and can achieve the same technical effect. Refer to the description in the above embodiments, which will not be repeated here.
[0089] Example 3
[0090] This invention also provides a computer device, please refer to... Figure 3 , Figure 3 This is a schematic diagram of the structure of a computer device provided in an embodiment of the present invention. The computer device 300 includes: a memory 302, a processor 301, and a general checkpoint generation program for an emulator stored in the memory 302 and capable of running on the processor 301.
[0091] The processor 301 calls the universal checkpoint generation program for the simulator stored in the memory 302, and executes the steps in the universal checkpoint generation method for the simulator provided in this embodiment of the invention. Please refer to... Figure 1 Specifically, it includes the following steps:
[0092] S1. Establish a simulation point acquisition module, configure the simulation parameters of the simulator through the simulation point acquisition module, and perform the first simulation through the simulator to acquire the instructions of the application to be acquired within the acquisition range, and obtain the basic block vector file.
[0093] S2. Perform cluster analysis on the basic block vector file using a simulated point analysis tool to obtain hotspot files and weight files;
[0094] 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.
[0095] The computer device 300 provided in this embodiment of the invention can implement the steps in the general method for generating checkpoints of the simulator as described in the above embodiments, and can achieve the same technical effect. Refer to the description in the above embodiments, which will not be repeated here.
[0096] Example 4
[0097] This invention also provides a computer-readable storage medium storing a general checkpoint generation program for a simulator. When executed by a processor, this general checkpoint generation program implements the various processes and steps in the general checkpoint generation method for a simulator provided in this invention, and achieves the same technical effect. To avoid repetition, it will not be described again here.
[0098] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.
[0099] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0100] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part 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, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0101] The embodiments of the present invention have been described above with reference to the accompanying drawings. The disclosed embodiments are merely preferred embodiments of the present invention. However, the present invention is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many equivalent changes in form without departing from the spirit and scope of the claims of the present invention, and all such changes are within the protection scope of the present invention.
Claims
1. A general method for generating checkpoints in a simulator, characterized in that, The general method for generating checkpoints includes the following steps: S1. Establish a simulation point acquisition module, configure the simulation parameters of the simulator through the simulation point acquisition module, and perform the first simulation through the simulator to acquire the instructions of the application to be acquired within the acquisition range, and obtain the basic block vector file. S2. Perform cluster analysis on the basic block vector file using a simulated point analysis tool to obtain hotspot files and weight files; 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. Step S1 includes the following sub-steps: S11. Based on the simulation point acquisition module, add simulation point start command and simulation point end command to the simulator. The simulation point start command and simulation point end command are used to determine the acquisition interval of the application to be acquired. S12. The simulator starts the first simulation and executes the instructions of the application to be collected. S13. When the current instruction is completed, the instruction information corresponding to the current instruction is transmitted to the simulation point acquisition module; S14. Determine whether the current instruction information is the simulation point start instruction: if yes, the instruction counter in the simulation point acquisition module starts counting, the next instruction in the application to be acquired is executed, and the corresponding instruction information is transmitted to the simulation point acquisition module, proceeding to step S15; if no, the next instruction in the application to be acquired is executed, and the process returns to step S13. S15. Increment the first calculated value of the instruction counter by one, and determine whether the current instruction information is a control instruction: if yes, update the basic block vector node information according to the hash table through the instruction counter; if no, proceed to step S17. S16. Determine whether the first calculated value is greater than or equal to the preset acquisition interval: if so, clear the first calculated value to zero, and generate the corresponding basic block vector information to the preset path according to the basic block vector node information; S17. Determine whether the current instruction information is the simulation point end instruction: if yes, the simulator ends the simulation and generates the basic block vector file output according to the basic block vector information; if no, execute the next instruction in the application to be acquired and pass the corresponding instruction information to the simulation point acquisition module, and return to step S15. Step S15 includes the following sub-steps: S151. When the current instruction information is a control instruction, the instruction counter checks whether the corresponding basic block vector information already exists in the node of the hash table: if yes, the basic block vector node information is updated according to the current instruction information; if no, a new node is created in the hash table.
2. The general method for generating checkpoints for a simulator as described in claim 1, characterized in that, The control commands include jump commands and branch commands.
3. The general method for generating checkpoints for a simulator as described in claim 1, characterized in that, Step S3 includes the following sub-steps: S31. The simulator starts the simulation, executes the instructions in the application to be collected, and reads the hotspot file and the weight file. It sorts the hotspot positions in the hotspot file in ascending order and multiplies each hotspot position by the preset collection interval to obtain the hotspot queue. S32. Determine whether the instruction information corresponding to the instruction currently executed by the simulator is the simulation point start instruction: if yes, proceed to step S33; if no, the simulator executes the next instruction and repeats step S32. S33. Increment the second calculated value of the instruction counter by one, and determine whether the second calculated value is greater than or equal to the head hotspot position in the hotspot queue: if yes, remove and delete the head hotspot position in the hotspot queue to generate the corresponding checkpoint; if no, proceed to step S34. S34. Determine whether the current instruction information is the simulation point end instruction: if yes, the simulator ends the simulation and outputs all the checkpoints; if no, the simulator executes the next instruction and returns to step S33.
4. The general method for generating checkpoints for a simulator as described in claim 1, characterized in that, In step S2, the simulated 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.
5. A universal checkpoint generation system for a simulator, characterized in that, The general checkpoint generation system includes: The acquisition module is used to establish a simulated point acquisition module, configure the simulation parameters of the simulator through the simulated point acquisition module, and perform the first simulation through the simulator to acquire the application to be acquired, thereby obtaining the basic block vector file. The acquisition module includes a first acquisition unit, a second acquisition unit, a third acquisition unit, a fourth acquisition unit, a fifth acquisition unit, a sixth acquisition unit, and a seventh acquisition unit: The first acquisition unit is used to add a simulation point start command and a simulation point end command to the simulator based on the simulation point acquisition module. The simulation point start command and the simulation point end command are used to determine the acquisition range of the application to be acquired. The second acquisition unit is used by the simulator to start the first simulation and execute the instructions of the application to be acquired; 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 completed. The fourth acquisition unit is used to determine whether the current instruction information is the simulation point start instruction: if yes, the instruction counter in the simulation point acquisition module starts counting, the next instruction in the application to be acquired is executed, and the corresponding instruction information is transmitted to the simulation point acquisition module, and then jumps to the fifth acquisition unit; if no, the next instruction in the application to be acquired is executed, and then jumps to the third acquisition unit. The fifth acquisition unit increments the first calculated value of the instruction counter by one and determines whether the current instruction information is a control instruction: if yes, it updates the basic block vector node information according to the hash table through the instruction counter; if no, it jumps to the seventh acquisition unit. The fifth acquisition unit includes a fifth acquisition subunit, which is used to check whether the corresponding basic block vector information already exists in the nodes of the hash table when the current instruction information is a control instruction; if yes, the basic block vector node information is updated according to the current instruction information; if no, a new node is created in the hash table. The sixth acquisition unit is used to determine whether the first calculated value is greater than or equal to the preset acquisition interval: if so, the first calculated value is cleared to zero, and the corresponding basic block vector information is generated according to the basic block vector node information and sent to the preset path. The seventh acquisition unit is used to determine whether the current instruction information is the simulation point end instruction: if yes, the simulator ends the simulation and generates the basic block vector file output according to the basic block vector information; if no, the next instruction in the application to be acquired is executed, and the corresponding instruction information is passed to the simulation point acquisition module, and jumps to the fifth acquisition unit; the analysis module is used to perform cluster analysis on the basic block vector file through the simulation point analysis tool to obtain hotspot files and weight files; The generation module is used by 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.
6. The universal checkpoint generation system for simulators as described in claim 5, characterized in that, In the analysis module, the simulated 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 computer device, characterized in that, include: A memory, a processor, and a generic checkpoint generation program for a simulator stored in the memory and executable on the processor, wherein the processor, when executing the generic checkpoint generation program for the simulator, implements the steps in the generic checkpoint generation method for a simulator as described in any one of claims 1-4.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a general checkpoint generation program for the simulator, which, when executed by a processor, implements the steps of the general checkpoint generation method for the simulator as described in any one of claims 1-4.
Citation Information
Patent Citations
Method and device for evaluating performance of processor, computing equipment and readable storage medium
CN116149917A
System and method for basic block vector system-on-chip performance optimization
WO2025014488A1