An edge cloud cooperative reconfigurable accelerator prediction arrangement method and system

CN122777366APending Publication Date: 2026-09-18中邮建技术有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610645405.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-05-12
Publication Date
2026-09-18

AI Technical Summary

Technical Problem

然而,这一策略隐含一个错误假设,即所有已修改数据都是恢复所必需的;实际上,任务的执行路径具有不确定性,大量中间数据在后续计算中可能不再被读取,其保存纯属冗余,徒增开销

Benefits of technology

1、本发明通过静态数据流分析生成检查点必要性表,将程序语义引入检查点优化,从根本上解决了因无法预知未来执行路径而导致的冗余数据保存问题。传统检查点机制仅依据数据是否被修改进行全量保存,大量中间数据在任务恢复后不再被读取,其保存徒增开销;本发明基于数据流方程精确计算每个程序点上未来执行所必需的缓冲区集合,减少检查点数据量,缩短任务中断时间。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122777366A_ABST
    Figure CN122777366A_ABST
Patent Text Reader

Abstract

This invention discloses a method and system for predictive orchestration of reconfigurable accelerators in an edge-cloud collaborative manner, relating to the fields of edge-cloud collaboration and reconfigurable computing technology. The method includes: performing static data flow analysis on the executable code of a reconfigurable accelerator task to generate a checkpoint necessity table, which records the identifiers of buffers necessary for future execution at each program point; deploying the necessity table and task image to edge nodes or cloud nodes and loading them into the virtualization runtime; tracking the current program point of the task and maintaining the modification status of each buffer during runtime; responding to a pre-emption instruction, querying the necessity table based on the current program point, and writing only the modified buffer data belonging to the necessary set into the checkpoint file; and restoring the buffer data based on the checkpoint file when resuming the task, marking unwritten buffers as invalid.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of edge-cloud collaboration and reconfigurable computing technology, specifically to an edge-cloud collaborative reconfigurable accelerator prediction orchestration method and system. Background Technology

[0002] In edge-cloud collaborative environments, reconfigurable accelerators (such as FPGAs) are widely used to accelerate compute-intensive tasks. To achieve efficient resource sharing and dynamic scheduling, systems often need to pre-empt or migrate currently executing tasks, i.e., pausing the current task, saving its running state (checkpoint), and resuming execution after resources are released or the target node becomes ready. The core challenge of checkpointing lies in minimizing the amount of state data that needs to be saved, in order to reduce pre-emption overhead and task interruption time.

[0003] Existing checkpointing mechanisms typically select data to save based on whether it has been modified: the virtualization runtime maintains a modification flag for each buffer (video memory, registers, etc.), and when preemption is triggered, all buffer data marked as modified is saved in full. However, this strategy implicitly assumes that all modified data is necessary for recovery; in reality, the execution path of a task is uncertain, and a large amount of intermediate data may not be read in subsequent calculations, making its saving purely redundant and adding unnecessary overhead.

[0004] The crux of the problem lies in the fact that at the moment of pre-emption, the system cannot predict the future execution path of the task, and therefore cannot determine which modified data is truly necessary. If all data is conservatively saved, the amount of checkpoint data becomes too large; if selective saving is attempted, necessary data may be missed, leading to recovery failure. This dilemma of "unknown necessity" puts the existing checkpoint mechanism in a dilemma between overhead and correctness, urgently requiring a new method that does not rely on runtime prediction and can accurately identify necessary data solely through deterministic analysis.

[0005] To address the aforementioned issues, this invention proposes a reconfigurable accelerator prediction orchestration method and system for edge-cloud collaboration. Summary of the Invention

[0006] The purpose of this invention is to provide a reconfigurable accelerator prediction orchestration method and system for edge-cloud collaboration, so as to solve the problems raised in the prior art.

[0007] To achieve the above objectives, the present invention provides the following technical solution: A reconfigurable accelerator prediction orchestration method with edge-cloud collaboration includes the following steps: S1. Perform static data flow analysis on the executable code of the reconfigurable accelerator task to generate a checkpoint necessity table. The checkpoint necessity table records the necessary buffer identifiers of the reconfigurable accelerator task at several program points. The necessary buffer identifiers are used to indicate the buffers necessary for the future execution of the reconfigurable accelerator task at the corresponding program point. S2. Deploy the reconfigurable accelerator task on one of the edge nodes and cloud nodes, and load the checkpoint necessity table into the virtualization runtime of the node; S3. During the execution of the reconfigurable accelerator task, the virtualization runtime tracks the current program point of the reconfigurable accelerator task and maintains the modification status flag of each buffer. S4. In response to the pre-occupancy instruction, the virtualization runtime queries the checkpoint necessity table according to the current program point to obtain the necessary buffer identifier set corresponding to the current program point, traverses all buffers marked as modified, and only writes the data of the buffers belonging to the necessary buffer identifier set into the checkpoint file. S5. When the reconfigurable accelerator task is restored at the target node, the virtualization runtime restores the data of the buffer according to the checkpoint file and marks the buffer that has not been written to the checkpoint file as invalid.

[0008] S1 further includes the following: Obtain an intermediate representation of the executable code of the reconfigurable accelerator task, the intermediate representation comprising a sequence of instructions and basic blocks divided by the sequence of instructions; The basic block is a continuous instruction segment in the instruction sequence that has a single entry point and a single exit point; A control flow graph is constructed based on the basic block partitioning information in the intermediate representation, wherein the control flow graph uses the basic blocks as nodes and the jump relationships between the basic blocks as directed edges. Each basic block in the control flow graph is identified as a program point, and a unique index is assigned to each program point; For each of the basic blocks, perform local data flow analysis to extract the set of buffers read within the basic block as the usage set, and the set of buffers written within the basic block as the definition set; Using the control flow graph as a framework, backward global data flow analysis is performed. The necessary buffer set for each program point is obtained by iteratively solving the data flow equations. The data flow equations include: For each basic block B, define its entry necessary buffer set IN(B) as the set of buffers that will be read in all subsequent execution paths at the entry point of B; The set of necessary exit buffers OUT(B) is the set of buffers that will be read in all subsequent execution paths at exit B; The subsequent execution path refers to all paths reachable from the current point along the control flow graph; IN(B) and OUT(B) satisfy the following relationship: OUT(B) is equal to the union of IN(S) of all successor basic blocks S of B, expressed as follows: OUT(B)=∪{S∈succ(B)}IN(S); Where succ(B) represents all the successor basic blocks of B in the control flow graph; IN(B) is equal to OUT(B) minus the definition set DEF(B) of B, and then combined with the use set USE(B) of B, as shown in the following expression: IN(B)=(OUT(B)\DEF(B))∪USE(B); Repeatedly calculate the IN and OUT of all basic blocks until the results of two consecutive iterations are completely consistent. The IN(B) of each basic block B obtained in the end is used as the necessary buffer set for that program point. Record the identifier of each buffer in the necessary buffer set as the necessary buffer identifier; Using the unique index of the program point as the key and the set of necessary buffer identifiers as the value, a mapping relationship is established to generate the checkpoint necessity table.

[0009] S2 further includes the following: The checkpoint necessity table and the executable code of the reconfigurable accelerator task are packaged into a task image file, and the task image file is distributed to selected edge nodes or cloud nodes. The virtualized runtime of the node receives the task image file, parses the task image file, and extracts the checkpoint necessity table; The virtualization runtime establishes a necessity table index structure in memory; The necessity table index structure uses the unique index of the program point as the key and the necessary buffer identifier set as the value to form a mapping relationship between the program point and the necessary buffer identifier set; The virtualization runtime allocates an execution context for the reconfigurable accelerator task and stores an access handle to the necessity table index structure in the execution context.

[0010] S3 further includes the following: The virtualization runtime allocates a task control block to the task when the reconfigurable accelerator task starts; The task control block includes a current program point field and a buffer modification status table; The buffer modification status table uses the identifier of each buffer as an index and records the modification status of the buffer with a Boolean value. Initially, the modification status of all buffers is marked as unmodified. The virtualization runtime listens for write operation events issued by the reconfigurable accelerator hardware during the execution of the reconfigurable accelerator task. When a write operation is detected that the task initiates a write operation to the target buffer, the virtualization runtime marks the modification status of the target buffer in the buffer modification status table as modified. The virtualization runtime periodically reads the program counter register of the reconfigurable accelerator hardware; Obtain the address of the instruction currently being executed by the task, convert the instruction address into a unique index of the program point, and write the unique index into the current program point field of the task control block.

[0011] S4 further includes the following: The virtualization runtime receives a pre-occupancy instruction from the upper-layer orchestrator, the pre-occupancy instruction containing the identifier of the task to be pre-occupied; The virtualization runtime locates the corresponding task control block based on the task identifier and reads the unique index of the current program point of the reconfigurable accelerator task from the current program point field of the task control block. The virtualization runtime uses the unique index of the current program point as the key to access the necessity table index structure and query to obtain the set of necessary buffer identifiers corresponding to the unique index of the current program point. The virtualization runtime allocates storage space for checkpoint files and creates a data area header in the checkpoint files; The reserved field at the beginning of the data area is used to record the number of buffers to be written subsequently and the identifier of each buffer; The virtualization runtime iterates through all buffer identifiers in the buffer modification status table and performs the following judgment for each buffer identifier: If the modification status corresponding to the buffer identifier is not modified, then skip the buffer. If the modification status corresponding to the buffer identifier is modified, then it is further determined whether the buffer identifier exists in the set of necessary buffer identifiers; If the buffer identifier exists in the set of necessary buffer identifiers, the current data of the buffer is read from the video memory of the reconfigurable accelerator hardware; Write the buffer identifier and the current data in pairs into the data area of ​​the checkpoint file, and increment the count of the number of buffers written to the head of the data area. If the buffer identifier does not exist in the set of necessary buffer identifiers, then skip the buffer.

[0012] S4 also includes the following: After the virtualization runtime has completed traversing all buffers, it writes the number of buffers written and the identifier of each buffer recorded in the header of the data area to the header of the checkpoint file, and then closes the checkpoint file.

[0013] S5 further includes the following: The virtualization runtime receives the checkpoint file and the task identifier to be restored; The virtualization runtime creates a new task control block on the target node based on the task identifier and assigns a new execution context to the reconfigurable accelerator task. The virtualization runtime opens the checkpoint file and parses the header of the checkpoint file; Read the number of buffers written and the identifier of each buffer written from the header; For each of the identifiers written to the buffer, the virtualization runtime locates and reads the buffer data corresponding to that identifier from the data area of ​​the checkpoint file; Write the buffer data to the storage location of the corresponding buffer in the reconfigurable accelerator hardware memory of the target node, and mark the modified status of the buffer as unmodified; The virtualization runtime establishes a buffer modification status table for the buffers in the reconfigurable accelerator hardware memory on the target node; The buffer modification status table records the modification status of each buffer using its identifier as an index. For all buffer identifiers in the buffer modification status table, if the buffer identifier does not appear in the identifier set of the written buffers, then the modification status corresponding to the buffer identifier is marked as invalid. The virtualization runtime sets the current program point field of the task control block to the unique index of the program point recorded in the checkpoint file, so that the reconfigurable accelerator task can resume execution from that program point.

[0014] A reconfigurable accelerator prediction orchestration system with edge-cloud collaboration includes a static analysis module, a deployment module, a runtime tracing module, a checkpoint saving module, and a recovery module. The static analysis module is used to perform static data flow analysis on the executable code of the reconfigurable accelerator task and generate a checkpoint necessity table. The checkpoint necessity table records the necessary buffer identifiers of the reconfigurable accelerator task at several program points. The necessary buffer identifiers are used to indicate the buffers stored in the reconfigurable accelerator hardware memory that are necessary for the future execution of the reconfigurable accelerator task at the corresponding program point. The deployment module is used to deploy the reconfigurable accelerator task on one of the edge nodes and cloud nodes, and to load the checkpoint necessity table into the virtualization runtime of the node; The runtime tracing module is used to track the current program point of the reconfigurable accelerator task during the execution of the reconfigurable accelerator task and maintain a modification status flag for each buffer; the modification status flag is used to indicate whether the corresponding buffer has been written to by the reconfigurable accelerator hardware since the last checkpoint. The checkpoint saving module is used to respond to the pre-occupancy instruction, query the checkpoint necessity table according to the current program point, obtain the necessary buffer identifier set corresponding to the current program point, traverse all buffers whose modified status is marked as modified, and only read the data of the buffers belonging to the necessary buffer identifier set from the reconfigurable accelerator hardware memory and write them to the checkpoint file. The recovery module is used to write the saved buffer data into the reconfigurable accelerator hardware memory of the target node according to the checkpoint file when the target node recovers the reconfigurable accelerator task, and to mark the buffers that have not been written to the checkpoint file as invalid.

[0015] Compared with the prior art, the beneficial effects of the present invention are: 1. This invention generates a checkpoint necessity table through static data flow analysis, introducing program semantics into checkpoint optimization, fundamentally solving the problem of redundant data storage caused by the inability to predict future execution paths. Traditional checkpoint mechanisms only save all data based on whether it has been modified, and a large amount of intermediate data is no longer read after the task resumes, thus increasing storage overhead. This invention accurately calculates the set of buffers necessary for future execution at each program point based on data flow equations, reducing the amount of checkpoint data and shortening task interruption time.

[0016] 2. This invention employs a cross-layer collaborative architecture that combines compile-time analysis with runtime decision-making, achieving accurate data filtering without relying on any online prediction models. Existing technologies, if attempting selective saving, rely on complex machine learning prediction algorithms, which not only increase runtime overhead but also pose a risk of prediction errors. This invention obtains deterministic conclusions through backward global data flow analysis, requiring only simple table lookup operations at runtime, with negligible decision-making overhead, making it particularly suitable for resource-constrained edge node environments. Attached Figure Description

[0017] Figure 1 This is a flowchart of a reconfigurable accelerator prediction orchestration method for edge-cloud collaboration according to the present invention. Detailed Implementation

[0018] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0019] Example: Figure 1 As shown, the present invention provides a technical solution. A reconfigurable accelerator prediction orchestration method with edge-cloud collaboration includes the following steps: S1. Perform static data flow analysis on the executable code of the reconfigurable accelerator task to generate a checkpoint necessity table. The checkpoint necessity table records the necessary buffer identifiers of the reconfigurable accelerator task at several program points. The necessary buffer identifiers are used to indicate the buffers necessary for the future execution of the reconfigurable accelerator task at the corresponding program point. S2. Deploy the reconfigurable accelerator task on one of the edge nodes and cloud nodes, and load the checkpoint necessity table into the virtualization runtime of the node; S3. During the execution of the reconfigurable accelerator task, the virtualization runtime tracks the current program point of the reconfigurable accelerator task and maintains the modification status flag of each buffer. S4. In response to the pre-occupancy instruction, the virtualization runtime queries the checkpoint necessity table according to the current program point to obtain the necessary buffer identifier set corresponding to the current program point, traverses all buffers marked as modified, and only writes the data of the buffers belonging to the necessary buffer identifier set into the checkpoint file. S5. When the reconfigurable accelerator task is restored at the target node, the virtualization runtime restores the data of the buffer according to the checkpoint file and marks the buffer that has not been written to the checkpoint file as invalid.

[0020] S1 further includes the following: Obtain an intermediate representation of the executable code of the reconfigurable accelerator task, the intermediate representation comprising a sequence of instructions and basic blocks divided by the sequence of instructions; The basic block is a continuous instruction segment in the instruction sequence that has a single entry point and a single exit point; A control flow graph is constructed based on the basic block partitioning information in the intermediate representation, wherein the control flow graph uses the basic blocks as nodes and the jump relationships between the basic blocks as directed edges. Each basic block in the control flow graph is identified as a program point, and a unique index is assigned to each program point; For each of the basic blocks, perform local data flow analysis to extract the set of buffers read within the basic block as the usage set, and the set of buffers written within the basic block as the definition set; Using the control flow graph as a framework, backward global data flow analysis is performed. The necessary buffer set for each program point is obtained by iteratively solving the data flow equations. The data flow equations include: For each basic block B, define its entry necessary buffer set IN(B) as the set of buffers that will be read in all subsequent execution paths at the entry point of B; The set of necessary exit buffers OUT(B) is the set of buffers that will be read in all subsequent execution paths at exit B; The subsequent execution path refers to all paths reachable from the current point along the control flow graph; IN(B) and OUT(B) satisfy the following relationship: OUT(B) is equal to the union of IN(S) of all successor basic blocks S of B, expressed as follows: OUT(B)=∪{S∈succ(B)}IN(S); Where succ(B) represents all the successor basic blocks of B in the control flow graph; IN(B) is equal to OUT(B) minus the definition set DEF(B) of B, and then combined with the use set USE(B) of B, as shown in the following expression: IN(B)=(OUT(B)\DEF(B))∪USE(B); Repeatedly calculate the IN and OUT of all basic blocks until the results of two consecutive iterations are completely consistent. The IN(B) of each basic block B obtained in the end is used as the necessary buffer set for that program point. Record the identifier of each buffer in the necessary buffer set as the necessary buffer identifier; Using the unique index of the program point as the key and the set of necessary buffer identifiers as the value, a mapping relationship is established to generate the checkpoint necessity table.

[0021] S2 further includes the following: The checkpoint necessity table and the executable code of the reconfigurable accelerator task are packaged into a task image file, and the task image file is distributed to selected edge nodes or cloud nodes. The virtualized runtime of the node receives the task image file, parses the task image file, and extracts the checkpoint necessity table; The virtualization runtime establishes a necessity table index structure in memory; The necessity table index structure uses the unique index of the program point as the key and the necessary buffer identifier set as the value to form a mapping relationship between the program point and the necessary buffer identifier set; The virtualization runtime allocates an execution context for the reconfigurable accelerator task and stores an access handle to the necessity table index structure in the execution context.

[0022] S3 further includes the following: The virtualization runtime allocates a task control block to the task when the reconfigurable accelerator task starts; The task control block includes a current program point field and a buffer modification status table; The buffer modification status table uses the identifier of each buffer as an index and records the modification status of the buffer with a Boolean value. Initially, the modification status of all buffers is marked as unmodified. The virtualization runtime listens for write operation events issued by the reconfigurable accelerator hardware during the execution of the reconfigurable accelerator task. When a write operation is detected that the task initiates a write operation to the target buffer, the virtualization runtime marks the modification status of the target buffer in the buffer modification status table as modified. The virtualization runtime periodically reads the program counter register of the reconfigurable accelerator hardware; Obtain the address of the instruction currently being executed by the task, convert the instruction address into a unique index of the program point, and write the unique index into the current program point field of the task control block.

[0023] S4 further includes the following: The virtualization runtime receives a pre-occupancy instruction from the upper-layer orchestrator, the pre-occupancy instruction containing the identifier of the task to be pre-occupied; The virtualization runtime locates the corresponding task control block based on the task identifier and reads the unique index of the current program point of the reconfigurable accelerator task from the current program point field of the task control block. The virtualization runtime uses the unique index of the current program point as the key to access the necessity table index structure and query to obtain the set of necessary buffer identifiers corresponding to the unique index of the current program point. The virtualization runtime allocates storage space for checkpoint files and creates a data area header in the checkpoint files; The reserved field at the beginning of the data area is used to record the number of buffers to be written subsequently and the identifier of each buffer; The virtualization runtime iterates through all buffer identifiers in the buffer modification status table and performs the following judgment for each buffer identifier: If the modification status corresponding to the buffer identifier is not modified, then skip the buffer. If the modification status corresponding to the buffer identifier is modified, then it is further determined whether the buffer identifier exists in the set of necessary buffer identifiers; If the buffer identifier exists in the set of necessary buffer identifiers, the current data of the buffer is read from the video memory of the reconfigurable accelerator hardware; Write the buffer identifier and the current data in pairs into the data area of ​​the checkpoint file, and increment the count of the number of buffers written to the head of the data area. If the buffer identifier does not exist in the set of necessary buffer identifiers, then skip the buffer.

[0024] S4 also includes the following: After the virtualization runtime has completed traversing all buffers, it writes the number of buffers written and the identifier of each buffer recorded in the header of the data area to the header of the checkpoint file, and then closes the checkpoint file.

[0025] S5 further includes the following: The virtualization runtime receives the checkpoint file and the task identifier to be restored; The virtualization runtime creates a new task control block on the target node based on the task identifier and assigns a new execution context to the reconfigurable accelerator task. The virtualization runtime opens the checkpoint file and parses the header of the checkpoint file; Read the number of buffers written and the identifier of each buffer written from the header; For each of the identifiers written to the buffer, the virtualization runtime locates and reads the buffer data corresponding to that identifier from the data area of ​​the checkpoint file; Write the buffer data to the storage location of the corresponding buffer in the reconfigurable accelerator hardware memory of the target node, and mark the modified status of the buffer as unmodified; The virtualization runtime establishes a buffer modification status table for the buffers in the reconfigurable accelerator hardware memory on the target node; The buffer modification status table records the modification status of each buffer using its identifier as an index. For all buffer identifiers in the buffer modification status table, if the buffer identifier does not appear in the identifier set of the written buffers, then the modification status corresponding to the buffer identifier is marked as invalid. The virtualization runtime sets the current program point field of the task control block to the unique index of the program point recorded in the checkpoint file, so that the reconfigurable accelerator task can resume execution from that program point.

[0026] A reconfigurable accelerator prediction orchestration system with edge-cloud collaboration includes a static analysis module, a deployment module, a runtime tracing module, a checkpoint saving module, and a recovery module. The static analysis module is used to perform static data flow analysis on the executable code of the reconfigurable accelerator task and generate a checkpoint necessity table. The checkpoint necessity table records the necessary buffer identifiers of the reconfigurable accelerator task at several program points. The necessary buffer identifiers are used to indicate the buffers stored in the reconfigurable accelerator hardware memory that are necessary for the future execution of the reconfigurable accelerator task at the corresponding program point. The deployment module is used to deploy the reconfigurable accelerator task on one of the edge nodes and cloud nodes, and to load the checkpoint necessity table into the virtualization runtime of the node; The runtime tracing module is used to track the current program point of the reconfigurable accelerator task during the execution of the reconfigurable accelerator task and maintain a modification status flag for each buffer; the modification status flag is used to indicate whether the corresponding buffer has been written to by the reconfigurable accelerator hardware since the last checkpoint. The checkpoint saving module is used to respond to the pre-occupancy instruction, query the checkpoint necessity table according to the current program point, obtain the necessary buffer identifier set corresponding to the current program point, traverse all buffers whose modified status is marked as modified, and only read the data of the buffers belonging to the necessary buffer identifier set from the reconfigurable accelerator hardware memory and write them to the checkpoint file. The recovery module is used to write the saved buffer data into the reconfigurable accelerator hardware memory of the target node according to the checkpoint file when the target node recovers the reconfigurable accelerator task, and to mark the buffers that have not been written to the checkpoint file as invalid.

[0027] In an edge-cloud collaborative environment, an edge node deploys an FPGA accelerator to perform video inference tasks, which are responsible for object detection in real-time video streams.

[0028] To achieve efficient resource sharing, the system needs task pre-emption capability: when a high-priority task arrives, the currently executing video inference task can be paused, its running state saved, and execution resumed after resources are released. Traditional checkpoint mechanisms save all modified buffer data, but video inference tasks generate a large amount of intermediate data during execution, much of which is not read in subsequent calculations, resulting in a huge amount of checkpoint data and long task interruption time. This invention uses static data stream analysis to predict data necessity and saves only necessary data at runtime, thereby significantly reducing checkpoint overhead.

[0029] During the compilation phase, static data flow analysis is first performed on the executable code for the video inference task. This yields the intermediate representation of the task, which includes instruction sequences and basic blocks divided from the instruction sequences. A basic block is a continuous instruction segment within the instruction sequence that has a single entry point and a single exit point.

[0030] For example, a basic block in the task code sequentially executes the following steps: loading an image frame into buffer buf0, performing a convolution operation on buf0 and writing the result to buf1, calculating an activation function on buf1 and writing the result to buf2, performing a pooling operation on buf2 and writing the result to buf3, and finally writing the data in buf3 back to main memory. Then, it jumps to the next basic block based on a condition. A control flow graph is constructed based on the basic block partitioning information, with basic blocks as nodes and jump relationships as directed edges. Each basic block is defined as a program point, and a unique index is assigned to each program point.

[0031] For each basic block, a local data flow analysis is performed to extract the set of buffers read within that basic block as the usage set, and the set of buffers written to as the definition set. For the basic block mentioned above, its usage set only contains buf0, because only load instructions read this buffer; its definition set includes buf1, buf2, buf3, and the output buffer, because convolution, activation, pooling, and store instructions wrote to these buffers respectively.

[0032] A backward global data flow analysis is performed using the control flow graph as a framework. The necessary buffer set for each program point is obtained by iteratively solving the data flow equations. The data flow equations are defined as follows: For each basic block, its entry necessary buffer set represents the set of buffers that will be read in all subsequent execution paths at the entry point of that basic block, and its exit necessary buffer set represents the set of buffers that will be read in all subsequent execution paths at the exit point of that basic block. Subsequent execution paths refer to all paths reachable from the current point along the control flow graph.

[0033] The entry and exit sets satisfy the following relationship: the exit set equals the union of the entry sets of all successor basic blocks of the given basic block, and the entry set equals the sum of the definition set of the basic block minus the definition set of the basic block and then the sum of the usage set of the basic block. The entry and exit sets of all basic blocks are iteratively calculated repeatedly until the results of two consecutive iterations are completely consistent. The final entry set of each basic block is the necessary buffer set for that program point.

[0034] Suppose that the basic block in the control flow graph has two successor basic blocks. After iterative calculation, it is found that the ingress sets of these two successor basic blocks contain different combinations of buffers. Then the egress set of the current basic block is the union of these two ingress sets.

[0035] Next, the entry set is calculated using the formula. Ultimately, only buffer `buf0` is necessary at the current basic block because it will be read in subsequent paths. While `buf1`, `buf2`, and `buf3` are defined, they are either overwritten or no longer used in subsequent paths, and therefore unnecessary. Similarly, the necessary buffer set for each program point is calculated for all basic blocks, forming a checkpoint necessity table. This table uses the unique index of the program point as the key and the necessary buffer identifier set as the value. For example, at one program point, the necessary set may only contain input buffers, while at another program point, the necessary set may contain intermediate feature map buffers.

[0036] Next comes the deployment phase. The checkpoint necessity table and the executable code of the reconfigurable accelerator task are packaged into a task image file, and this image file is distributed to the selected edge nodes. The virtualized runtime of the edge node receives the task image file, parses it, extracts the checkpoint necessity table, and builds a necessity table index structure in memory. This structure uses the unique index of the program point as the key and the set of necessary buffer identifiers as the value to form a fast mapping relationship.

[0037] Meanwhile, the virtualization runtime allocates an execution context for the task and stores access handles to the necessary table index structure in the context for subsequent queries.

[0038] When a task starts, the virtualization runtime allocates a task control block to it. The task control block contains a current program point field and a buffer modification status table. The buffer modification status table uses the identifier of each buffer as an index and records the modification status of that buffer with a Boolean value. Initially, all buffers are marked as unmodified. Assume a video inference task has five buffers, storing input frames, intermediate feature maps, and output results, respectively, with each buffer being one megabyte in size.

[0039] During task execution, the virtualization runtime continuously listens for write operation events issued by the FPGA hardware. When a task writes data to a buffer, such as writing to an intermediate buffer when executing a convolution instruction, the runtime detects the write operation and immediately marks the corresponding buffer in the buffer modification status table as modified.

[0040] Simultaneously, during runtime, the program counter register of the FPGA hardware is periodically read to obtain the address of the currently executing instruction. This address is mapped to the corresponding basic block index, and the index is written to the current program point field of the task control block. Assuming that at some point the task executes to the aforementioned basic block, the current program point field points to that basic block. At this time, three buffers have already been modified, while the other two buffers have not yet been modified.

[0041] At this point, due to the arrival of a high-priority task, the system decides to pre-allocate the current video inference task. The upper-layer orchestrator issues a pre-allocation instruction, which includes the task identifier to be pre-allocated.

[0042] During virtualization runtime, the corresponding task control block is located based on the task identifier, and the unique index of the current program point is read from the current program point field. Then, using this index as the key, the necessity table index structure is accessed to retrieve the corresponding set of necessary buffer identifiers, which contains only input buffers.

[0043] Next, the checkpoint saving operation is performed. During virtualization runtime, storage space for the checkpoint file is allocated. A data area header is created in the file, with reserved fields to record the number of buffers subsequently written and the identifier of each buffer. Then, all buffer identifiers in the buffer modification status table are traversed, and a judgment is performed for each buffer: for input buffers, whose modification status is modified and exists in the necessary set, the current data of that buffer is read from the FPGA memory, the buffer identifier and data are written to the data area of ​​the checkpoint file in pairs, and the count of buffers written is incremented in the data area header.

[0044] For the other two modified intermediate buffers, although they have been modified, they do not exist in the necessary set, so they are skipped and not saved. The two unmodified buffers are also skipped. After traversal, the number of written buffers recorded in the data area header is one, and the written buffer is identified as an input buffer. The virtualization runtime writes the header information to the header of the checkpoint file and closes the file. Thus, the checkpoint file saves only one megabyte of data, while a traditional full save would require saving all three modified buffers, totaling three megabytes of data, reducing the data volume by two-thirds.

[0045] The task then needs to be resumed on another node. The virtualization runtime receives the checkpoint file and the identifier of the task to be resumed, creates a new task control block on the target node, and assigns a new execution context to the task. The checkpoint file is opened, the header is parsed, and the number of buffers written to and the identifier of each buffer are read; there is only one input buffer identifier.

[0046] For this identifier, locate and read the corresponding buffer data from the file data area, write the data to the storage location of the corresponding buffer in the target node FPGA display memory, and mark the modified status of the buffer as unmodified.

[0047] Simultaneously, a buffer modification status table is established for all buffers in the FPGA memory on the target node. Initially, the modification status of all buffers is not set. For the recovered input buffer, its status is set to unmodified; for the other four buffers, since they do not appear in the set of written buffer identifiers, their modification status is marked as invalid.

[0048] Finally, the current program point field of the task control block is set to the unique index of the program point recorded in the checkpoint file, so that the task resumes execution from that program point.

[0049] After the task resumes, when an instruction that needs to read a certain intermediate buffer is executed, the on-demand recalculation mechanism will be triggered because the modified state of the buffer is invalid.

[0050] The buffer is recalculated at runtime based on the task logic, for example, by reconvolving the input and weights to obtain intermediate feature maps, thereby ensuring correct execution.

[0051] The entire recovery process only requires loading the necessary one megabyte of data, while the traditional method requires loading three megabytes, significantly reducing the recovery time.

[0052] As can be seen from the above embodiments, the present invention uses static data stream analysis to accurately identify necessary data, and only saves and restores this data during runtime, which greatly reduces the amount of checkpoint data and task interruption time.

[0053] Compared with traditional full data saving based on whether it has been modified, this solution optimizes the amount of data while ensuring correctness. It is especially suitable for resource-constrained edge nodes and effectively improves the resource scheduling efficiency in edge-cloud collaborative environments.

[0054] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the invention can be implemented in other specific forms without departing from its spirit or essential characteristics. Therefore, the embodiments should be considered in all respects as exemplary and non-limiting, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be included within the present invention. No reference numerals in the claims should be construed as limiting the scope of the claims.

Claims

1. A reconfigurable accelerator prediction orchestration method with edge-cloud collaboration, characterized in that: Includes the following steps: S1. Perform static data flow analysis on the executable code of the reconfigurable accelerator task to generate a checkpoint necessity table. The checkpoint necessity table records the necessary buffer identifiers of the reconfigurable accelerator task at several program points. The necessary buffer identifiers are used to indicate the buffers necessary for the future execution of the reconfigurable accelerator task at the corresponding program point. S2. Deploy the reconfigurable accelerator task on one of the edge nodes and cloud nodes, and load the checkpoint necessity table into the virtualization runtime of the node; S3. During the execution of the reconfigurable accelerator task, the virtualization runtime tracks the current program point of the reconfigurable accelerator task and maintains the modification status flag of each buffer. S4. In response to the pre-occupancy instruction, the virtualization runtime queries the checkpoint necessity table according to the current program point to obtain the necessary buffer identifier set corresponding to the current program point, traverses all buffers marked as modified, and only writes the data of the buffers belonging to the necessary buffer identifier set into the checkpoint file. S5. When the reconfigurable accelerator task is restored at the target node, the virtualization runtime restores the data of the buffer according to the checkpoint file and marks the buffer that has not been written to the checkpoint file as invalid.

2. The edge-cloud collaborative reconfigurable accelerator prediction orchestration method according to claim 1, characterized in that: S1 further includes the following: Obtain an intermediate representation of the executable code of the reconfigurable accelerator task, the intermediate representation comprising a sequence of instructions and basic blocks divided by the sequence of instructions; The basic block is a continuous instruction segment in the instruction sequence that has a single entry point and a single exit point; A control flow graph is constructed based on the basic block partitioning information in the intermediate representation, wherein the control flow graph uses the basic blocks as nodes and the jump relationships between the basic blocks as directed edges. Each basic block in the control flow graph is identified as a program point, and a unique index is assigned to each program point; For each of the basic blocks, perform local data flow analysis to extract the set of buffers read within the basic block as the usage set, and the set of buffers written within the basic block as the definition set; Using the control flow graph as a framework, backward global data flow analysis is performed. The necessary buffer set for each program point is obtained by iteratively solving the data flow equations. The data flow equations include: For each basic block B, define its entry necessary buffer set IN(B) as the set of buffers that will be read in all subsequent execution paths at the entry point of B; The set of necessary exit buffers OUT(B) is the set of buffers that will be read in all subsequent execution paths at exit B; The subsequent execution path refers to all paths reachable from the current point along the control flow graph; IN(B) and OUT(B) satisfy the following relationship: OUT(B) is equal to the union of IN(S) of all successor basic blocks S of B, expressed as follows: OUT(B)=∪{S∈succ(B)}IN(S); Where succ(B) represents all the successor basic blocks of B in the control flow graph; IN(B) is equal to OUT(B) minus the definition set DEF(B) of B, and then combined with the use set USE(B) of B, as shown in the following expression: IN(B)=(OUT(B)\DEF(B))∪USE(B); Repeatedly calculate the IN and OUT of all basic blocks until the results of two consecutive iterations are completely consistent. The IN(B) of each basic block B obtained in the end is used as the necessary buffer set for that program point. Record the identifier of each buffer in the necessary buffer set as the necessary buffer identifier; Using the unique index of the program point as the key and the set of necessary buffer identifiers as the value, a mapping relationship is established to generate the checkpoint necessity table.

3. The edge-cloud collaborative reconfigurable accelerator prediction orchestration method according to claim 1, characterized in that: S2 further includes the following: The checkpoint necessity table and the executable code of the reconfigurable accelerator task are packaged into a task image file, and the task image file is distributed to selected edge nodes or cloud nodes. The virtualized runtime of the node receives the task image file, parses the task image file, and extracts the checkpoint necessity table; The virtualization runtime establishes a necessity table index structure in memory; The necessity table index structure uses the unique index of the program point as the key and the necessary buffer identifier set as the value to form a mapping relationship between the program point and the necessary buffer identifier set; The virtualization runtime allocates an execution context for the reconfigurable accelerator task and stores an access handle to the necessity table index structure in the execution context.

4. The edge-cloud collaborative reconfigurable accelerator prediction orchestration method according to claim 1, characterized in that: S3 further includes the following: The virtualization runtime allocates a task control block to the task when the reconfigurable accelerator task starts; The task control block includes a current program point field and a buffer modification status table; The buffer modification status table uses the identifier of each buffer as an index and records the modification status of the buffer with a Boolean value. Initially, the modification status of all buffers is marked as unmodified. The virtualization runtime listens for write operation events issued by the reconfigurable accelerator hardware during the execution of the reconfigurable accelerator task. When a write operation is detected that the task initiates a write operation to the target buffer, the virtualization runtime marks the modification status of the target buffer in the buffer modification status table as modified. The virtualization runtime periodically reads the program counter register of the reconfigurable accelerator hardware; Obtain the address of the instruction currently being executed by the task, convert the instruction address into a unique index of the program point, and write the unique index into the current program point field of the task control block.

5. The edge-cloud collaborative reconfigurable accelerator prediction orchestration method according to claim 1, characterized in that: S4 further includes the following: The virtualization runtime receives a pre-occupancy instruction from the upper-layer orchestrator, the pre-occupancy instruction containing the identifier of the task to be pre-occupied; The virtualization runtime locates the corresponding task control block based on the task identifier and reads the unique index of the current program point of the reconfigurable accelerator task from the current program point field of the task control block. The virtualization runtime uses the unique index of the current program point as the key to access the necessity table index structure and query to obtain the set of necessary buffer identifiers corresponding to the unique index of the current program point. The virtualization runtime allocates storage space for checkpoint files and creates a data area header in the checkpoint files; The reserved field at the beginning of the data area is used to record the number of buffers to be written subsequently and the identifier of each buffer; The virtualization runtime iterates through all buffer identifiers in the buffer modification status table and performs the following judgment for each buffer identifier: If the modification status corresponding to the buffer identifier is not modified, then skip the buffer. If the modification status corresponding to the buffer identifier is modified, then it is further determined whether the buffer identifier exists in the set of necessary buffer identifiers; If the buffer identifier exists in the set of necessary buffer identifiers, the current data of the buffer is read from the video memory of the reconfigurable accelerator hardware; Write the buffer identifier and the current data in pairs into the data area of ​​the checkpoint file, and increment the count of the number of buffers written to the head of the data area. If the buffer identifier does not exist in the set of necessary buffer identifiers, then skip the buffer.

6. The edge-cloud collaborative reconfigurable accelerator prediction orchestration method according to claim 5, characterized in that: S4 also includes the following: After the virtualization runtime has completed traversing all buffers, it writes the number of buffers written and the identifier of each buffer recorded in the header of the data area to the header of the checkpoint file, and then closes the checkpoint file.

7. The edge-cloud collaborative reconfigurable accelerator prediction orchestration method according to claim 1, characterized in that: S5 further includes the following: The virtualization runtime receives the checkpoint file and the task identifier to be restored; The virtualization runtime creates a new task control block on the target node based on the task identifier and assigns a new execution context to the reconfigurable accelerator task. The virtualization runtime opens the checkpoint file and parses the header of the checkpoint file; Read the number of buffers written and the identifier of each buffer written from the header; For each of the identifiers written to the buffer, the virtualization runtime locates and reads the buffer data corresponding to that identifier from the data area of ​​the checkpoint file; Write the buffer data to the storage location of the corresponding buffer in the reconfigurable accelerator hardware memory of the target node, and mark the modified status of the buffer as unmodified; The virtualization runtime establishes a buffer modification status table for the buffers in the reconfigurable accelerator hardware memory on the target node; The buffer modification status table records the modification status of each buffer using its identifier as an index. For all buffer identifiers in the buffer modification status table, if the buffer identifier does not appear in the identifier set of the written buffers, then the modification status corresponding to the buffer identifier is marked as invalid. The virtualization runtime sets the current program point field of the task control block to the unique index of the program point recorded in the checkpoint file, so that the reconfigurable accelerator task can resume execution from that program point.

8. An edge-cloud collaborative reconfigurable accelerator prediction orchestration system, applied to the edge-cloud collaborative reconfigurable accelerator prediction orchestration method according to any one of claims 1-7, characterized in that: It includes a static analysis module, a deployment module, a runtime tracing module, a checkpoint saving module, and a recovery module; The static analysis module is used to perform static data flow analysis on the executable code of the reconfigurable accelerator task and generate a checkpoint necessity table. The checkpoint necessity table records the necessary buffer identifiers of the reconfigurable accelerator task at several program points. The necessary buffer identifiers are used to indicate the buffers stored in the reconfigurable accelerator hardware memory that are necessary for the future execution of the reconfigurable accelerator task at the corresponding program point. The deployment module is used to deploy the reconfigurable accelerator task on one of the edge nodes and cloud nodes, and to load the checkpoint necessity table into the virtualization runtime of the node; The runtime tracing module is used to track the current program point of the reconfigurable accelerator task during the execution of the reconfigurable accelerator task and maintain a modification status flag for each buffer; the modification status flag is used to indicate whether the corresponding buffer has been written by the reconfigurable accelerator hardware since the last checkpoint. The checkpoint saving module is used to respond to the pre-occupancy instruction, query the checkpoint necessity table according to the current program point, obtain the necessary buffer identifier set corresponding to the current program point, traverse all buffers whose modified status is marked as modified, and only read the data of the buffers belonging to the necessary buffer identifier set from the reconfigurable accelerator hardware memory and write them to the checkpoint file. The recovery module is used to write the saved buffer data into the reconfigurable accelerator hardware memory of the target node according to the checkpoint file when the target node recovers the reconfigurable accelerator task, and to mark the buffers that have not been written to the checkpoint file as invalid.