A method, device, electronic device and storage medium for generating a checkpoint

By obtaining the synchronization threshold of the multi-core processor core and controlling its synchronization status, and generating and saving checkpoints to the peripheral address space, the problem of not supporting multi-core loads in the existing technology is solved, and the efficiency of correctness evaluation of the multi-core system is improved.

CN118468798BActive Publication Date: 2024-10-01BEIJING INSTITUTE OF OPEN SOURCE CHIP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410931327.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-11
Publication Date
2024-10-01
Estimated Expiration
2044-07-11

AI Technical Summary

Technical Problem

Existing checkpoint generation methods do not support multi-core workloads, limiting the efficiency of pre-silicon correctness assessment of multi-core systems.

Method used

By obtaining the synchronization threshold of each processor core in the multi-core processor, the core is controlled to enter the synchronization state, and a checkpoint is generated after reaching the checkpoint generation cycle, and is saved to the peripheral address space to avoid occupying the kernel memory space.

Benefits of technology

It realizes the progress of synchronizing different processor cores on multi-core processors, improves the efficiency of correctness evaluation of multi-core systems before silicon, and supports the simulation and evaluation of multi-core systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118468798B_ABST
    Figure CN118468798B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention provides a checkpoint generation method, device, electronic device and storage medium, which relates to the field of computer technology. The method includes: obtaining a synchronization threshold corresponding to each processor core in a multi-core processor; the synchronization threshold is used to indicate the number of instructions that the processor core needs to execute to achieve state synchronization with other processor cores; controlling each processor core to enter a synchronization state according to the synchronization threshold; after each processor core in the multi-core processor enters a synchronization state, controlling each processor core to continue to execute instructions; after each processor core reaches a checkpoint generation cycle, generating a checkpoint, and saving the checkpoint to a peripheral address space, so that a software simulator can read the checkpoint and perform simulation. The embodiment of the present invention realizes the application of checkpoint technology on a multi-core processor, which is conducive to improving the efficiency of correctness evaluation of multi-core systems before silicon.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method, device, electronic device and storage medium for generating a checkpoint. Background Art

[0002] In the chip design process, pre-silicon correctness verification and performance evaluation are very important links. Currently, pre-silicon evaluation is mostly based on various simulation schemes. Simulation generally consists of two parts: simulator and workload. Common simulators include software-based hardware description language (HDL) simulation, field-programmable gate array (FPGA)-based hardware simulation, and simulation accelerator-based hardware simulation. The workload is usually a benchmark suite.

[0003] Each simulation technology has its own limitations. For example, HDL simulation is extremely slow because it completely simulates hardware implementation. Although FPGA simulation is faster than HDL simulation, it is not very versatile and has limited capacity. As the complexity and scale of Xiangshan processors continue to increase, the cost of purchasing FPGAs is also increasing. Although simulation accelerators can accelerate simulation and have sufficient capacity, their high prices result in very limited ownership. Therefore, reducing the size (number of instructions) of the simulated workload becomes an economical and feasible solution.

[0004] Currently, there are several popular solutions to reduce workloads: 1) reduce the input set of the workload; 2) sample the workload; 3) fast-forward technology for simulating workloads. Among them, sampling the workload is the most commonly used solution, and sampling can produce checkpoints that represent program behavior. In some cases, it is even possible to run only a single checkpoint with the largest weight (40M instructions) to simulate the program, thus greatly speeding up the simulation.

[0005] However, most current checkpoint generation schemes only support single-core loads and have very limited support for multi-core loads, which restricts the efficiency of pre-silicon correctness evaluation of multi-core systems. Summary of the invention

[0006] The embodiments of the present invention provide a checkpoint generation method, device, electronic device and storage medium, which can solve the problem that the checkpoint generation method in the related art does not support multi-core load.

[0007] In order to solve the above problem, an embodiment of the present invention discloses a method for generating a checkpoint, which is applied to a simulator. The method includes:

[0008] Acquire a synchronization threshold corresponding to each processor core in the multi-core processor; the synchronization threshold is used to indicate the number of instructions that the processor core needs to execute to achieve state synchronization with other processor cores;

[0009] Control each processor core to enter a synchronization state according to the synchronization threshold;

[0010] After each processor core in the multi-core processor enters a synchronization state, controlling each processor core to continue executing instructions;

[0011] After each processor core reaches a checkpoint generation cycle, a checkpoint is generated and saved in a peripheral address space so that a software simulator can read the checkpoint and perform simulation.

[0012] Optionally, the method further comprises:

[0013] Using a software restorer to read the memory layout information of the checkpoint from the peripheral address space;

[0014] Read the register value corresponding to each processor core according to the memory layout information;

[0015] The state of the register corresponding to each processor core is restored according to the register value, so as to restore the register to the state corresponding to the checkpoint.

[0016] Optionally, obtaining a synchronization threshold corresponding to each processor core in the multi-core processor includes:

[0017] generating an initial checkpoint during operation of the simulator;

[0018] Sending the initial checkpoint to a software simulator so that the software simulator predicts a synchronization threshold according to the initial checkpoint;

[0019] A synchronization threshold predicted by the software simulator is received.

[0020] Optionally, the method further comprises:

[0021] The checkpoint is sent to the software simulator, so that the software simulator predicts a synchronization threshold corresponding to a next round of multi-core synchronization according to the checkpoint.

[0022] Optionally, obtaining a synchronization threshold corresponding to each processor core in the multi-core processor includes:

[0023] Obtaining a preset initial synchronization threshold, and performing a first round of multi-core synchronization based on the initial synchronization threshold;

[0024] The synchronization threshold predicted by the software simulator is received, and the next round of multi-core synchronization is performed based on the synchronization threshold.

[0025] Optionally, controlling each processor core to enter a synchronization state according to the synchronization threshold includes:

[0026] Calculate a first target number of instructions that each processor core needs to execute to reach a synchronization point according to the synchronization threshold and a first preset period;

[0027] The number of instructions executed is counted for each processor core respectively, and when the number of instructions executed by the processor core is equal to the first target number of instructions corresponding to the processor core, the processor core is controlled to enter a synchronization state.

[0028] On the other hand, an embodiment of the present invention discloses a checkpoint generation device, which is applied to a simulator, and the device includes:

[0029] An acquisition module, used to acquire a synchronization threshold corresponding to each processor core in a multi-core processor; the synchronization threshold is used to indicate the number of instructions that the processor core needs to execute to achieve state synchronization with other processor cores;

[0030] A synchronization module, used for controlling each processor core to enter a synchronization state according to the synchronization threshold;

[0031] A control module, used for controlling each processor core in the multi-core processor to continue to execute instructions after each processor core in the multi-core processor enters a synchronization state;

[0032] The generation module is used to generate a checkpoint after each processor core reaches a checkpoint generation cycle, and save the checkpoint to the peripheral address space so that the software simulator can read the checkpoint and perform simulation.

[0033] Optionally, the device further comprises:

[0034] A first reading module, configured to read the memory layout information of the checkpoint from the peripheral address space using a software restorer;

[0035] A second reading module, used to read the register value corresponding to each processor core according to the memory layout information;

[0036] The state recovery module is used to restore the state of the register corresponding to each processor core according to the register value, so as to restore the register to the state corresponding to the checkpoint.

[0037] Optionally, the acquisition module includes:

[0038] An initial checkpoint generation submodule, used to generate an initial checkpoint during the operation of the simulator;

[0039] An initial checkpoint sending submodule, used for sending the initial checkpoint to the software simulator, so that the software simulator predicts the synchronization threshold according to the initial checkpoint;

[0040] The first receiving submodule is used to receive the synchronization threshold predicted by the software simulator.

[0041] Optionally, the device further comprises:

[0042] The checkpoint sending module is used to send the checkpoint to the software simulator, so that the software simulator predicts the synchronization threshold corresponding to the next round of multi-core synchronization according to the checkpoint.

[0043] Optionally, the acquisition module includes:

[0044] An initial threshold acquisition submodule, used to acquire a preset initial synchronization threshold, and perform a first round of multi-core synchronization based on the initial synchronization threshold;

[0045] The second receiving submodule is used to receive the synchronization threshold predicted by the software simulator and perform the next round of multi-core synchronization based on the synchronization threshold.

[0046] Optionally, the synchronization module includes:

[0047] A calculation submodule, configured to calculate a first target number of instructions that each processor core needs to execute to reach a synchronization point according to the synchronization threshold and a first preset period;

[0048] The control submodule is used to count the number of instructions executed for each processor core respectively, and control the processor core to enter a synchronization state when the number of instructions executed by the processor core is equal to the first target number of instructions corresponding to the processor core.

[0049] On the other hand, an embodiment of the present invention further discloses an electronic device, which includes a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other through the communication bus; the memory is used to store executable instructions, and the executable instructions enable the processor to execute the aforementioned checkpoint generation method.

[0050] The embodiment of the present invention further discloses a readable storage medium. When instructions in the readable storage medium are executed by a processor of an electronic device, the electronic device can execute the aforementioned checkpoint generation method.

[0051] The embodiments of the present invention include the following advantages:

[0052] An embodiment of the present invention provides a checkpoint generation method, which can synchronize the progress of different processor cores on a simulator according to the synchronization threshold of each processor core in the multi-core processor, generate a checkpoint after each processor core reaches the checkpoint generation cycle, and save the checkpoint in the peripheral address space without occupying the kernel memory space, thereby realizing the application of checkpoint technology on multi-core processors, which is beneficial to improving the efficiency of correctness evaluation of multi-core systems before silicon. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.

[0054] Figure 1 is a flow chart of steps of an embodiment of a method for generating a checkpoint of the present invention;

[0055] Figure 2 It is a schematic diagram of the generation and recovery process of the checkpoint of the present invention;

[0056] Figure 3 It is a schematic diagram of a multi-core synchronization and checkpoint generation process of the present invention;

[0057] Figure 4 is a structural block diagram of an embodiment of a device for generating a checkpoint according to the present invention;

[0058] Figure 5 It is a structural block diagram of an electronic device provided by an example of the present invention. DETAILED DESCRIPTION

[0059] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0060] The terms "first", "second", etc. in the specification and claims of the present invention are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable when appropriate, so that the embodiments of the present invention can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, the term "and / or" in the specification and claims is used to describe the association relationship of associated objects, indicating that three relationships can exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. In the embodiments of the present invention, the term "multiple" refers to two or more, and other quantifiers are similar.

[0061] Method Embodiment

[0062] First, some professional terms involved in the embodiments of the present invention are explained.

[0063] HDL: A hardware description language used to describe the behavior of chip circuits. HDL simulation can simulate the behavior of circuits in software, helping to estimate the function and performance of circuits.

[0064] FPGA: Field Programmable Gate Array (FPGA) is an integrated circuit that is designed to be configured by customers or designers after manufacturing, hence the name field programmable. FPGA configuration is usually specified using a hardware description language (HDL). Unlike traditional fixed-function integrated circuits (ASICs), FPGAs can be flexibly reprogrammed and reconfigured according to user needs to adapt them to different applications and functions. FPGAs consist of a large number of programmable logic blocks and programmable interconnect resources. Programmable logic blocks usually consist of Look-Up Tables (LUTs), registers, and other logic elements, which can perform various logic functions. Programmable interconnect resources are used to connect logic blocks to form the required circuit structure. With FPGAs, design engineers can use hardware description languages ​​to describe the required circuit functions and convert them into bitstreams compatible with FPGA chips through programming tools. The bitstream contains information for programming and configuring the internal logic and interconnect resources of the FPGA. One of the main advantages of FPGAs is their programmability and flexibility. It allows design engineers to implement customized functions and algorithms at the hardware level without the traditional custom integrated circuit design and manufacturing process. This makes FPGAs very useful in prototyping and rapid design iterations.

[0065] Simulation accelerator: A field programmable development platform designed specifically for large chips, which has the advantages of larger capacity and easier debugging than FPGA. However, it is expensive to use and runs slower than FPGA (500KHz VS 50MHz).

[0066] Checkpoint: A data format that records the state of a program at a certain moment in its execution. It can be loaded by a specific simulator or emulator, so that the simulator or emulator can start running directly from a certain intermediate moment in the program's execution. It usually contains at least information such as architecture-visible registers and memory.

[0067] Electronic System Level (ESL) platform: A platform that uses high-level languages ​​(such as C, C++) or graphical design tools to model the behavior of the entire circuit system. A typical ESL platform is GEM5.

[0068] Benchmark suite: A test program used to evaluate processor performance, power consumption and other indicators, consisting of the program itself and the input set.

[0069] Software restorer: A program used to restore register states from a file to hardware, running in RISC-V M-state.

[0070] Functional simulator: A simulator that only simulates the target instruction set architecture (ISA) functional implementation, focuses on achieving functional consistency, and does not contain any microarchitecture information.

[0071] Reference Figure 1 , shows a flow chart of a method for generating a checkpoint according to an embodiment of the present invention, wherein the method may specifically include the following steps:

[0072] Step 101: Obtain a synchronization threshold corresponding to each processor core in a multi-core processor; the synchronization threshold is used to indicate the number of instructions that the processor core needs to execute to achieve state synchronization with other processor cores;

[0073] Step 102: Control each processor core to enter a synchronization state according to the synchronization threshold;

[0074] Step 103: After each processor core in the multi-core processor enters a synchronization state, control each processor core to continue executing instructions;

[0075] Step 104: After each processor core reaches a checkpoint generation cycle, a checkpoint is generated and saved in a peripheral address space so that a software simulator can read the checkpoint and perform simulation.

[0076] The checkpoint generation method provided in the embodiment of the present invention can be applied to a simulator. A simulator is a software tool used to simulate the behavior or function of a hardware device, system, or other software. A simulator can be used to create a virtual environment in which users can perform and test various operations without the need for actual physical hardware. The simulator in the embodiment of the present invention can simulate functions such as instruction execution and data transfer of a multi-core processor. Exemplarily, the simulator in the embodiment of the present invention can be a functional simulator, such as QEMU, Spike, etc.

[0077] A checkpoint is a snapshot of the program state saved at a specific point in time during the program execution process. It can be used to back up and restore the program state. For example, after extracting a slice from a program, it is necessary to save the checkpoint corresponding to the starting point of the program slice to facilitate the restoration of the program slice in a simulator or hardware environment. Among them, program slicing is a technology that selectively extracts subsets from a program. The slicing technology can be used to divide the program into smaller parts, making the analysis and evaluation of the program more accurate and efficient.

[0078] The checkpoint generation method provided in an embodiment of the present invention can generate checkpoints in a simulator. The user can pause the simulation at a specific point, save the current processor status, memory data, system configuration and other information, and then re-update the load checkpoint after a period of time and continue the simulation from this state.

[0079] Specifically, before generating a checkpoint, it is necessary to synchronize the progress between different cores on the simulator. In the embodiment of the present invention, a separate synchronization threshold is set for each processor core, and the synchronization threshold is used to indicate the number of instructions that the processor core needs to execute to achieve state synchronization with other processor cores. Exemplarily, the synchronization threshold can be predicted by simulating the checkpoint or test program slice using a software simulator.

[0080] After determining the synchronization threshold corresponding to each processor core, each processor core is controlled to enter the synchronization state based on the synchronization threshold. Specifically, when the number of instructions executed by a processor core Pi is equal to the number of instructions indicated by the synchronization threshold, the processor core Pi can be controlled to enter the synchronization state and wait for other processor cores to enter the synchronization state.

[0081] After all the processor cores of the multi-core processor enter the synchronization state, each processor core is controlled to continue to execute instructions. This cycle is repeated to synchronize the progress of each processor core during the operation of the simulator, thus achieving multi-core synchronization.

[0082] After all processor cores of the multi-core processor reach the checkpoint generation cycle, a checkpoint is generated and saved in the peripheral address space. The software simulator can read the checkpoint from the peripheral address space and simulate the checkpoint.

[0083] The checkpoint generation cycle may be a preset cycle, and the checkpoint generation cycle of each processor core may be the same or different.

[0084] A checkpoint is a file containing hardware status and memory image, which can be used to save the status of a program at any time. There are two common implementation schemes for checkpoint technology: one is an operating system-level checkpoint, which is implemented by saving the process control block and memory image of the process; the other is a full system-level checkpoint, which is implemented by saving the complete register status and memory image. The embodiment of the present invention does not specifically limit the generation method of the checkpoint.

[0085] Peripherals refer to external devices of a multi-core processor core, which can be mounted in an FPGA chip and belong neither to the PL side nor to the PS side. Exemplarily, the external device in the embodiment of the present invention can be an external storage device, such as a Double Data Rate Synchronous Dynamic Random Access Memory (DDR).

[0086] The peripheral address space refers to the virtual address space allocated to the external device based on the memory mapping. It should be noted that the peripheral address space in the embodiment of the present invention does not include the memory space occupied by the processor core. The embodiment of the present invention saves the checkpoint to the peripheral address space, which can avoid the need to save a large amount of hardware status to the memory to occupy the kernel memory space when generating the checkpoint due to the excessive number of processor cores in the multi-core processor, thereby realizing the use of checkpoint technology in the multi-core processor without occupying the kernel memory space.

[0087] The checkpoint generation method provided in the embodiment of the present invention can synchronize the progress of different processor cores on the simulator according to the synchronization threshold of each processor core in the multi-core processor, generate a checkpoint after each processor core reaches the checkpoint generation cycle, and save the checkpoint in the peripheral address space without occupying the kernel memory space, thereby realizing the application of checkpoint technology on multi-core processors, which is beneficial to improving the efficiency of correctness evaluation of multi-core systems before silicon.

[0088] Optionally, the method further comprises:

[0089] Step S11, using a software restorer to read the memory layout information of the checkpoint from the peripheral address space;

[0090] Step S12: reading the register value corresponding to each processor core according to the memory layout information;

[0091] Step S13: restore the state of the registers corresponding to each processor core according to the register value, so as to restore the registers to the state corresponding to the checkpoint.

[0092] In the embodiment of the present invention, a software restorer can be used to restore the hardware state in the simulator based on the checkpoint from the peripheral address space.

[0093] Specifically, the software restorer can first read the memory layout information of the checkpoint from the peripheral address space, and then read the register value corresponding to each processor core recorded in the checkpoint according to the memory layout information. Finally, based on the read register value, the state of the register used by each processor core in the simulator is restored, that is, the register is restored to the state corresponding to the checkpoint. After the checkpoint is restored, the simulator is run, and each processor core will continue to execute instructions from the position corresponding to the checkpoint.

[0094] It should be noted that the registers that need to be restored may include privileged level (CSR) registers, integer (int) registers, floating point (fp) registers, vector (vector) registers, and various peripheral registers (such as mtime registers, mtimecmp registers, etc.). Each core will read the register value from the peripheral address space and restore it to its own register, except for the mtime register. The mtime is restored by one of the cores (usually the last core that executes to the mtime restoration position during operation).

[0095] Reference Figure 2 , shows a schematic diagram of a checkpoint generation and recovery process provided by an embodiment of the present invention. Figure 2As shown in the figure, after each processor core reaches the checkpoint generation cycle, the simulator (such as QEMU) generates a checkpoint. The checkpoint is a compressed file. The structure of the file is shown in the figure pointed to by the checkpoint (CHECKPOINT) in the figure. It contains three parts. One is the checkpoint header (HEADER), which contains the basic information and memory layout of the checkpoint. The second is the register state of each core. The third is the memory image when saving (that is, when the checkpoint is generated). The software simulator (detailed model, such as GEM5 / XS) decompresses the checkpoint into the memory and peripheral address space, and reads the software restorer from the software restorer path given in the parameter to cover the address from 0x80000000 to 0x80100000. Then, the software simulator starts emulation from the address 0x80000000. It should be noted that the software simulator can directly read the memory part of the checkpoint into the memory and read other contents into the peripheral address space. The register states of different cores can be placed after the HEADER in the checkpoint in the order of the offset of hartid×1M, and then placed into the peripheral address space by the software emulator.

[0096] The simulator uses a software restorer (e.g., GCPT_RESTORE) to read the HEADER from the peripheral address space, determine the memory layout of the checkpoint, and then read the register value corresponding to each core from the peripheral address space according to the memory layout, and finally restore it to the corresponding core. Exemplarily, the software restorer can use privileged instructions to restore privileged registers, use load instructions to restore ordinary registers, and use vector instructions to restore vector registers.

[0097] Optionally, obtaining a synchronization threshold corresponding to each processor core in the multi-core processor includes:

[0098] Step S21, generating an initial checkpoint during the operation of the simulator;

[0099] Step S22, sending the initial checkpoint to the software simulator, so that the software simulator predicts the synchronization threshold according to the initial checkpoint;

[0100] Step S23: receiving the synchronization threshold predicted by the software simulator.

[0101] In the embodiment of the present invention, the software simulator can simulate the checkpoint generated in the previous cycle to predict the synchronization threshold. The simulator performs a new round of state synchronization on each processor core based on the synchronization threshold.

[0102] When performing the first round of multi-core synchronization, an initial checkpoint can be generated after the simulator starts running, and the initial checkpoint can be sent to the software simulator. The software simulator predicts the synchronization threshold of each processor core in the first round of multi-core synchronization based on the initial checkpoint.

[0103] Optionally, the method further comprises:

[0104] The checkpoint is sent to the software simulator, so that the software simulator predicts a synchronization threshold corresponding to a next round of multi-core synchronization according to the checkpoint.

[0105] The simulator controls each processor core to enter the synchronization state based on the synchronization threshold to achieve the first round of multi-core synchronization. After all processor cores reach the checkpoint generation cycle, a checkpoint is generated and sent to the software simulator, which predicts the synchronization threshold of each processor core in the next round of multi-core synchronization. This cycle repeats until the end of the operation.

[0106] Optionally, obtaining a synchronization threshold corresponding to each processor core in the multi-core processor includes:

[0107] Step S31, obtaining a preset initial synchronization threshold, and performing a first round of multi-core synchronization based on the initial synchronization threshold;

[0108] Step S32: receiving the synchronization threshold predicted by the software simulator, and performing the next round of multi-core synchronization based on the synchronization threshold.

[0109] In another optional embodiment of the present invention, an initial synchronization threshold may be set for each processor core in advance, and the simulator performs the first round of multi-core synchronization based on the initial synchronization threshold, and generates a checkpoint when each processor core reaches the checkpoint generation cycle and stores the checkpoint in the peripheral address space. The software simulator obtains the checkpoint from the peripheral address space and performs simulation, predicts a new synchronization threshold, and sends the synchronization threshold to the simulator. The simulator performs the next round of multi-core synchronization based on the received synchronization threshold.

[0110] Optionally, controlling each processor core to enter a synchronization state according to the synchronization threshold includes:

[0111] Step S41, calculating a first target number of instructions that each processor core needs to execute to reach a synchronization point according to the synchronization threshold and a first preset period;

[0112] Step S42: Count the number of instructions executed for each processor core respectively, and when the number of instructions executed by the processor core is equal to the first target number of instructions corresponding to the processor core, control the processor core to enter a synchronization state.

[0113] The first preset period may be a fixed value and does not change in each round of multi-core synchronization.

[0114] For each processor core, the number of instructions required to reach the synchronization point can be calculated based on the synchronization threshold and the first preset cycle. Exemplarily, the first target number of instructions that the processor core needs to execute to reach the synchronization point = the first preset cycle / synchronization threshold.

[0115] During the operation of the simulator, the number of instructions executed by each processor core can be counted respectively, and when the number of instructions executed by any processor core is equal to the first target number of instructions corresponding to the processor core, the processor core is controlled to enter a synchronization state.

[0116] Similarly, in the embodiment of the present invention, a checkpoint generation interval can be preset, and based on the synchronization threshold and the checkpoint generation interval corresponding to each processor core, the second target number of instructions that need to be executed when each processor core reaches the checkpoint generation cycle is calculated, and when the number of instructions executed by any processor core is equal to the second target number of instructions corresponding to the processor core, it is determined that the processor core has reached the checkpoint generation cycle. When all processor cores have reached the checkpoint generation cycle, a checkpoint is generated.

[0117] Reference Figure 3 , shows a schematic diagram of a multi-core synchronization and checkpoint generation process provided by an embodiment of the present invention. Figure 3 As shown, the simulator generates a checkpoint and submits the checkpoint to the software simulator. The software simulator simulates the checkpoint, predicts the synchronization threshold, and sends the synchronization threshold to the simulator. The simulator calculates the first target number of instructions that each processor core needs to execute to reach the synchronization point based on the synchronization threshold of each processor core and a first preset cycle, such as 600 clock cycles, and synchronizes the progress of different processor cores according to the first target number of instructions. For example, Figure 3 As shown, assuming that the first preset cycle is 600 cycles, and the synchronization threshold corresponding to core 0 is 1, then the first target number of instructions that need to be executed when core 0 reaches the synchronization point is 600; similarly, the synchronization threshold corresponding to core 1 is 2, and the first target number of instructions that need to be executed when core 1 reaches the synchronization point is 300; the synchronization threshold corresponding to core 2 is 3, and the first target number of instructions that need to be executed when core 2 reaches the synchronization point is 200; the synchronization threshold corresponding to core 3 is 1.5, and the first target number of instructions that need to be executed when core 3 reaches the synchronization point is 400. Then, the simulator calculates the second target number of instructions that need to be executed when each processor core reaches the checkpoint generation cycle based on the synchronization threshold and the checkpoint generation interval, and determines whether the processor core has reached the checkpoint generation cycle based on the second target number of instructions. Figure 3As shown, the checkpoint generation interval in the embodiment of the present invention can be an integer multiple of the first preset cycle, and the second target number of instructions executed by each processor core when reaching the checkpoint generation cycle is an integer multiple of the first target number of instructions that need to be executed when reaching the synchronization point. Therefore, in the same checkpoint generation cycle, the states of each processor core are synchronized. When all processor cores reach the checkpoint generation cycle, a checkpoint is generated, and then submitted to the software simulator, which predicts the synchronization threshold. This cycle is repeated until the operation ends.

[0118] In summary, an embodiment of the present invention provides a checkpoint generation method, which can synchronize the progress of different processor cores on a simulator according to the synchronization threshold of each processor core in the multi-core processor, generate a checkpoint after each processor core reaches the checkpoint generation cycle, and save the checkpoint in the peripheral address space without occupying the kernel memory space, thereby realizing the application of checkpoint technology on multi-core processors, which is beneficial to improving the efficiency of correctness evaluation of multi-core systems before silicon.

[0119] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.

[0120] Device Embodiment

[0121] Reference Figure 4 , shows a structural block diagram of a checkpoint generation device of the present invention, which is applied to a simulator, and the device may specifically include:

[0122] An acquisition module 401 is used to acquire a synchronization threshold corresponding to each processor core in a multi-core processor; the synchronization threshold is used to indicate the number of instructions that the processor core needs to execute to achieve state synchronization with other processor cores;

[0123] A synchronization module 402, configured to control each processor core to enter a synchronization state according to the synchronization threshold;

[0124] A control module 403, configured to control each processor core in the multi-core processor to continue executing instructions after each processor core in the multi-core processor enters a synchronization state;

[0125] The generation module 404 is used to generate a checkpoint after each processor core reaches a checkpoint generation cycle, and save the checkpoint to the peripheral address space so that the software simulator can read the checkpoint and perform simulation.

[0126] Optionally, the device further comprises:

[0127] A first reading module, configured to read the memory layout information of the checkpoint from the peripheral address space using a software restorer;

[0128] A second reading module, used to read the register value corresponding to each processor core according to the memory layout information;

[0129] The state recovery module is used to restore the state of the register corresponding to each processor core according to the register value, so as to restore the register to the state corresponding to the checkpoint.

[0130] Optionally, the acquisition module includes:

[0131] An initial checkpoint generation submodule, used to generate an initial checkpoint during the operation of the simulator;

[0132] An initial checkpoint sending submodule, used for sending the initial checkpoint to the software simulator, so that the software simulator predicts the synchronization threshold according to the initial checkpoint;

[0133] The first receiving submodule is used to receive the synchronization threshold predicted by the software simulator.

[0134] Optionally, the device further comprises:

[0135] The checkpoint sending module is used to send the checkpoint to the software simulator, so that the software simulator predicts the synchronization threshold corresponding to the next round of multi-core synchronization according to the checkpoint.

[0136] Optionally, the acquisition module includes:

[0137] An initial threshold acquisition submodule, used to acquire a preset initial synchronization threshold, and perform a first round of multi-core synchronization based on the initial synchronization threshold;

[0138] The second receiving submodule is used to receive the synchronization threshold predicted by the software simulator and perform the next round of multi-core synchronization based on the synchronization threshold.

[0139] Optionally, the synchronization module includes:

[0140] A calculation submodule, configured to calculate a first target number of instructions that each processor core needs to execute to reach a synchronization point according to the synchronization threshold and a first preset period;

[0141] The control submodule is used to count the number of instructions executed for each processor core respectively, and control the processor core to enter a synchronization state when the number of instructions executed by the processor core is equal to the first target number of instructions corresponding to the processor core.

[0142] In summary, an embodiment of the present invention provides a checkpoint generation device that can synchronize the progress of different processor cores on a simulator according to the synchronization threshold of each processor core in the multi-core processor, generate a checkpoint after each processor core reaches the checkpoint generation cycle, and save the checkpoint in the peripheral address space without occupying the kernel memory space, thereby realizing the application of checkpoint technology on multi-core processors, which is beneficial to improving the efficiency of pre-silicon correctness evaluation of multi-core systems.

[0143] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0144] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0145] Regarding the processor in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0146] Reference Figure 5 , is a structural block diagram of an electronic device for generating a checkpoint provided by an embodiment of the present invention. Figure 5 As shown, the electronic device includes: a processor, a memory, a communication interface and a communication bus, and the processor, the memory and the communication interface communicate with each other through the communication bus; the memory is used to store executable instructions, and the executable instructions enable the processor to execute the checkpoint generation method of the aforementioned embodiment.

[0147] The processor may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other editable devices, transistor logic devices, hardware components or any combination thereof. The processor may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.

[0148] The communication bus may include a path for transmitting information between the memory and the communication interface. The communication bus may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 The fact that only one line is used in the diagram does not mean that there is only one bus or only one type of bus.

[0149] The memory may be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory), a magnetic tape, a floppy disk, an optical data storage device, etc.

[0150] The embodiment of the present invention also provides a non-transitory computer-readable storage medium, when the instructions in the storage medium are executed by a processor of an electronic device (server or terminal), the processor can execute Figure 1 The checkpoint generation method shown.

[0151] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0152] It should be understood by those skilled in the art that the embodiments of the present invention may be provided as methods, devices or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware aspects. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0153] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems) and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0154] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing terminal device to operate in a predictable manner, so that the instructions stored in the computer readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0155] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0156] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.

[0157] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.

[0158] The above is a detailed introduction to the checkpoint generation method, device, electronic device and storage medium provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for general technical personnel in this field, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A method for generating a checkpoint, characterized in that: Applied to a simulator, the method comprises: Obtaining a synchronization threshold corresponding to each processor core in the multi-core processor; the synchronization threshold is used to indicate the number of instructions that the processor core needs to execute to achieve state synchronization with other processor cores; the synchronization threshold is predicted by simulating a checkpoint or a test program slice with a software simulator; Control each processor core to enter a synchronization state according to the synchronization threshold; After each processor core in the multi-core processor enters a synchronization state, controlling each processor core to continue executing instructions; After each processor core reaches a checkpoint generation cycle, a checkpoint is generated, and the checkpoint is saved in a peripheral address space so that a software simulator can read the checkpoint and perform simulation; The step of controlling each processor core to enter a synchronization state according to the synchronization threshold comprises: When the number of instructions executed by the processor core Pi is equal to the number of instructions indicated by the synchronization threshold, the processor core Pi is controlled to enter the synchronization state, and waits for other processor cores to enter the synchronization state.

2. The method according to claim 1, characterized in that The method further comprises: Using a software restorer to read the memory layout information of the checkpoint from the peripheral address space; Read the register value corresponding to each processor core according to the memory layout information; The state of the register corresponding to each processor core is restored according to the register value, so as to restore the register to the state corresponding to the checkpoint.

3. The method according to claim 1, characterized in that: The obtaining of the synchronization threshold corresponding to each processor core in the multi-core processor includes: generating an initial checkpoint during operation of the simulator; Sending the initial checkpoint to a software simulator so that the software simulator predicts a synchronization threshold according to the initial checkpoint; A synchronization threshold predicted by the software simulator is received.

4. The method according to claim 1, characterized in that: The method further comprises: The checkpoint is sent to the software simulator, so that the software simulator predicts a synchronization threshold corresponding to a next round of multi-core synchronization according to the checkpoint.

5. The method according to claim 4, characterized in that The obtaining of the synchronization threshold corresponding to each processor core in the multi-core processor includes: Obtaining a preset initial synchronization threshold, and performing a first round of multi-core synchronization based on the initial synchronization threshold; The synchronization threshold predicted by the software simulator is received, and the next round of multi-core synchronization is performed based on the synchronization threshold.

6. The method according to claim 1, characterized in that The controlling each processor core to enter a synchronization state according to the synchronization threshold comprises: Calculate a first target number of instructions that each processor core needs to execute to reach a synchronization point according to the synchronization threshold and a first preset period; The number of instructions executed is counted for each processor core respectively, and when the number of instructions executed by the processor core is equal to the first target number of instructions corresponding to the processor core, the processor core is controlled to enter a synchronization state.

7. A device for generating a checkpoint, characterized in that: Applied to a simulator, the device comprises: An acquisition module is used to acquire a synchronization threshold corresponding to each processor core in a multi-core processor; the synchronization threshold is used to indicate the number of instructions that the processor core needs to execute to achieve state synchronization with other processor cores; the synchronization threshold is predicted by simulating a checkpoint or a test program slice with a software simulator; A synchronization module, used for controlling each processor core to enter a synchronization state according to the synchronization threshold; A control module, used for controlling each processor core in the multi-core processor to continue to execute instructions after each processor core in the multi-core processor enters a synchronization state; A generation module, used for generating a checkpoint after each processor core reaches a checkpoint generation cycle, and saving the checkpoint to a peripheral address space so that a software simulator can read the checkpoint and perform simulation; Wherein, the synchronization module is specifically used for: When the number of instructions executed by the processor core Pi is equal to the number of instructions indicated by the synchronization threshold, the processor core Pi is controlled to enter the synchronization state, and waits for other processor cores to enter the synchronization state.

8. The device according to claim 7, characterized in that The device also includes: A first reading module, configured to read the memory layout information of the checkpoint from the peripheral address space using a software restorer; A second reading module, used to read the register value corresponding to each processor core according to the memory layout information; The state recovery module is used to restore the state of the register corresponding to each processor core according to the register value, so as to restore the register to the state corresponding to the checkpoint.

9. An electronic device, characterized in that: The electronic device comprises a processor, a memory, a communication interface and a communication bus, and the processor, the memory and the communication interface communicate with each other via the communication bus; The memory is used to store executable instructions, and the executable instructions enable the processor to execute the checkpoint generation method according to any one of claims 1 to 6.

10. A readable storage medium, characterized in that: When the instructions in the readable storage medium are executed by a processor of an electronic device, the processor is enabled to execute the method for generating a checkpoint according to any one of claims 1 to 6.