Task processing method, asynchronous hardware acceleration system and related device

By introducing an active polling mechanism into the user program within the event loop framework design, the CPU performance problem caused by the dedicated polling thread is solved, achieving more efficient resource utilization and performance improvement.

CN121523907APending Publication Date: 2026-02-13HYGON YUNXIN INTEGRATED CIRCUIT DESIGN (SHANGHAI) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511714289.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-20
Publication Date
2026-02-13

AI Technical Summary

Technical Problem

In solutions that use hardware acceleration to improve CPU performance, frequent dedicated polling threads can negatively impact overall CPU performance, leading to excessive resource consumption.

Method used

By using a user program designed based on an event loop framework, an active polling mechanism is adopted to replace the dedicated polling thread. After receiving a task pause signal, the user program actively polls the processing status of the asynchronous task, obtains the results of the completed calculations, and resumes task processing.

Benefits of technology

This reduces the resource consumption of dedicated polling threads, improving processor performance and overall system performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121523907A_ABST
    Figure CN121523907A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a task processing method, an asynchronous hardware acceleration system and a related device.The task processing method is applied to a user program based on an event loop framework and comprises the steps that all asynchronous tasks are determined and submitted; when the task pause signal is received, pausing processing of the asynchronous task indicated by the task pause signal, processing tasks except the submitted asynchronous task, and triggering a user program to start an active polling mechanism; when it is detected based on an active polling mechanism that there is an asynchronous task of which the operation is completed in a hardware acceleration operation stage in each submitted asynchronous task, obtaining a corresponding operation result; and recovering the processing of the asynchronous task of which the operation is completed, so as to continue to process a subsequent stage of the asynchronous task of which the operation is completed based on the operation result, and the subsequent stage is a stage after the hardware acceleration operation stage in the asynchronous task of which the operation is completed. According to the technical scheme provided by the embodiment of the invention, the performance of the processor can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] Embodiments of the present application relate to the technical field of computer technology, and in particular, to a task processing method, an asynchronous hardware acceleration system and related devices. BACKGROUND

[0002] In modern network security and data processing scenarios, operations such as encryption and compression consume a lot of computing resources of a processor (CPU). In order to reduce the burden of the CPU and improve performance, hardware acceleration has become an effective solution. For example, by using a dedicated hardware acceleration card, an asynchronous task with high computing resource consumption such as encryption and compression is offloaded from the CPU to the hardware acceleration card in an asynchronous mode, so that the CPU can perform other tasks in the process of processing the asynchronous task by the hardware acceleration card, thereby significantly improving the performance of the CPU.

[0003] However, in the solution of using hardware acceleration to improve the performance of the CPU, a dedicated polling thread is established to notify a user program running on the CPU to resume the re-execution of the paused asynchronous task in time. In large-scale task processing, the dedicated polling thread needs to be frequently used, which affects the overall performance of the CPU. Therefore, how to provide a technical solution to improve the performance of the processor has become a technical problem to be solved by those skilled in the art. SUMMARY

[0004] Therefore, embodiments of the present application provide a task processing method, an asynchronous hardware acceleration system and related devices to improve the performance of the processor.

[0005] To achieve the above object, embodiments of the present application provide the following technical solutions.

[0006] In a first aspect, embodiments of the present application provide a task processing method applied to a user program designed based on an event loop framework, and the task processing method comprises the following steps. determining and submitting each asynchronous task; when a task pause signal is received, pausing the processing of an asynchronous task indicated by the task pause signal, processing tasks other than the submitted asynchronous task, and triggering the user program to start an active polling mechanism; when it is detected based on the active polling mechanism that, among the submitted asynchronous tasks, there is an asynchronous task whose hardware acceleration operation phase has completed operation, obtaining an operation result corresponding to the asynchronous task whose operation has been completed; resuming the processing of the asynchronous task whose operation has been completed, to continue processing a subsequent phase of the asynchronous task whose operation has been completed based on the operation result, the subsequent phase being a phase after the hardware acceleration operation phase in the asynchronous task whose operation has been completed.

[0007] In a second aspect, an embodiment of the present application provides a task processing method applied to an asynchronous engine driver, and the task processing method comprises the following steps: receiving an asynchronous task; the asynchronous task is a task submitted by the task processing method in the first aspect; mapping a hardware acceleration operation stage of the asynchronous task to a hardware accelerator to inform the hardware accelerator to operate the hardware acceleration operation stage of the asynchronous task; generating a task suspension signal for suspending processing of the asynchronous task, and returning the task suspension signal to a user program; the task suspension signal is used to trigger the user program to start an active polling mechanism.

[0008] In a third aspect, an embodiment of the present application provides a task processing device applied to a user program designed based on an event loop framework, and the task processing device comprises the following steps: an asynchronous task determination and submission module configured to determine and submit each asynchronous task; a processing module configured to, when a task suspension signal is received, suspend processing of an asynchronous task indicated by the task suspension signal, process tasks other than the submitted asynchronous tasks, and trigger the user program to start an active polling mechanism; an operation result acquisition module configured to, when it is detected based on the active polling mechanism that, among the submitted asynchronous tasks, there is an asynchronous task whose hardware acceleration operation stage has completed operation, acquire an operation result corresponding to the asynchronous task whose operation has been completed; an asynchronous task resumption processing module configured to resume processing of the asynchronous task whose operation has been completed, so as to continue processing a subsequent stage of the asynchronous task whose operation has been completed based on the operation result, the subsequent stage being a stage after the hardware acceleration operation stage in the asynchronous task whose operation has been completed.

[0009] In a fourth aspect, an embodiment of the present application provides a task processing device applied to an asynchronous engine driver, and the task processing device comprises the following steps: an asynchronous task receiving module configured to receive an asynchronous task; the asynchronous task is a task submitted by the task processing device in the third aspect; a mapping and informing module configured to map a hardware acceleration operation stage of the asynchronous task to a hardware accelerator to inform the hardware accelerator to operate the hardware acceleration operation stage of the asynchronous task; a returning module configured to generate a task suspension signal for suspending processing of the asynchronous task, and return the task suspension signal to a user program; the task suspension signal is used to trigger the user program to start an active polling mechanism.

[0010] In a fifth aspect, an embodiment of the present application provides an asynchronous hardware acceleration system, comprising: a user program designed based on an event loop framework, the user program being configured to perform the task processing method according to the first aspect; an asynchronous engine driver configured to perform the task processing method according to the second aspect.

[0011] In a sixth aspect, an embodiment of the present application provides an electronic device, comprising a memory and a processor, the memory storing a program, and the processor invoking the program stored in the memory to perform the task processing method according to the first aspect, or perform the task processing method according to the second aspect.

[0012] In a seventh aspect, an embodiment of the present application provides a storage medium, the storage medium storing a program, and the program being executed to implement the task processing method according to the first aspect, or implement the task processing method according to the second aspect.

[0013] In an eighth aspect, an embodiment of the present application provides a computer program product, comprising a computer program, and the computer program being executed by a processor to implement the task processing method according to the first aspect, or implement the task processing method according to the second aspect.

[0014] The task processing method provided by the embodiment of the present application is applied to a user program designed based on an event loop framework, and the task processing method comprises the following steps: determining and submitting each asynchronous task; upon receiving a task suspension signal, suspending processing of an asynchronous task indicated by the task suspension signal, processing tasks other than the submitted asynchronous tasks, and triggering the user program to start an active polling mechanism; upon detecting, based on the active polling mechanism, that there is an asynchronous task in which a hardware acceleration operation phase of each submitted asynchronous task has completed operation, obtaining an operation result corresponding to the asynchronous task that has completed operation; resuming processing of the asynchronous task that has completed operation, to continue processing a subsequent phase of the asynchronous task that has completed operation based on the operation result, the subsequent phase being a phase after the hardware acceleration operation phase in the asynchronous task that has completed operation.

[0015] The technical solution provided by this invention, since the user program is based on an event loop framework, inherently functions as a data processing loop. Therefore, it can leverage the characteristics of the event loop framework to achieve active polling. Specifically, after the user program submits various asynchronous tasks and receives a task pause signal returned for the submitted asynchronous tasks, it triggers an active polling mechanism. The user program can then actively poll the processing status of each submitted asynchronous task. If it discovers an asynchronous task whose hardware acceleration phase has been completed, the user program can obtain the result of that completed task, resume the paused task, and continue processing subsequent phases after the hardware acceleration phase of that completed task is finished. Thus, the technical solution provided by this invention does not require establishing a dedicated polling thread; instead, it relies on the user program itself for active polling, reducing the resource consumption of a dedicated polling thread and improving processor performance. Attached Figure Description

[0016] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0017] Figure 1 This is a flowchart illustrating a task processing method provided in an embodiment of the present invention; Figure 2 This is another flowchart illustrating the task processing method provided in this embodiment of the invention; Figure 3 This is another flowchart illustrating the task processing method provided in this embodiment of the invention; Figure 4 This is a schematic diagram of the structure of a task processing device provided in an embodiment of the present invention; Figure 5 This is another structural schematic diagram of the task processing device provided in an embodiment of the present invention; Figure 6 This is a schematic diagram of the hardware acceleration system provided in an embodiment of the present invention; Figure 7 This is a schematic diagram illustrating the working process of an asynchronous hardware acceleration system that uses a dedicated polling thread; Figure 8 This is a schematic diagram of the working process of the hardware acceleration system provided in the embodiment of 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] With the rapid development of the Internet, data transmission over networks has become increasingly frequent. OpenSSL (OpenSecure Sockets Layer) plays a crucial role in ensuring Internet security. It meets the needs of data encryption and secure transmission in Internet communication, supports the implementation of SSL (Secure Sockets Layer) / TLS (Transport Layer Security) protocols, provides a cross-platform encryption algorithm library, and is continuously improved and developed with the support of the open-source community.

[0020] OpenSSL's asynchronous mode improves processor performance by fully utilizing the gaps in hardware accelerator computations. In asynchronous mode, user programs decouple non-CPU-intensive operations such as hardware acceleration and encapsulate them into an ASYNC_JOB (asynchronous task) structure for execution. After submitting the hardware acceleration phase of the asynchronous task to the hardware accelerator, the ASYNC_JOB structure does not wait for the hardware acceleration phase to complete but pauses the overall processing of the asynchronous task. It then returns a pause signal and notifies the user program of the response (i.e., the result of the hardware acceleration phase) when the hardware acceleration phase of the asynchronous task is complete.

[0021] The "hardware accelerator completes computation" event needs to be notified to the user program so that the user program can continue executing the suspended asynchronous task. For large-scale data computation, if the event is notified via interrupt, the excessive context switching caused by interrupt responses will severely load the CPU and degrade overall performance. Therefore, in high-performance scenarios, a polling method is generally used to obtain the "hardware accelerator completes computation" event.

[0022] However, obtaining the "hardware accelerator completes computation" event by polling requires establishing a separate dedicated polling thread to poll the processing status of the hardware accelerator for each asynchronous task's hardware acceleration computation stage. This consumes a separate timer thread (a thread specifically for handling timed tasks), consuming processor resources and affecting processor performance.

[0023] Based on this, embodiments of the present invention provide a task processing method. The method is applied to a user program designed based on an event loop framework. The user program itself actively polls to avoid establishing an independent dedicated polling mechanism for asynchronous task processing status polling, thereby reducing the occupation of processor resources and improving processor performance.

[0024] Please refer to Figure 1 , Figure 1 This is a flowchart illustrating a task processing method provided in an embodiment of the present invention, wherein the method is applied to a user program based on an event loop framework.

[0025] like Figure 1 As shown, the method includes the following steps: Step S101: Identify and submit each asynchronous task.

[0026] The asynchronous task refers to a task that can be processed using OpenSSL's asynchronous mode, such as a task that can be processed by a hardware accelerator, where the user program can execute other tasks during the hardware accelerator processing.

[0027] The asynchronous task can be, for example, a TLS / SSL handshake task, in which the computational task can be offloaded to the hardware accelerator while the CPU continues to process other tasks.

[0028] Alternatively, asynchronous tasks can also be data encryption and decryption tasks, allowing data encryption and decryption tasks that require a large number of encryption and decryption operations to be submitted to hardware accelerators, thus avoiding blocking the main thread.

[0029] Once the user program has determined which asynchronous tasks can be processed in asynchronous mode, it can submit the asynchronous tasks so that they can be processed by the hardware accelerator.

[0030] When using OpenSSL's asynchronous mode to process asynchronous tasks, the asynchronous task (job) can be submitted to the asynchronous engine driver adapted to OpenSSL through the task start function (ASYNC_start_job) provided by the OpenSSL library.

[0031] Step S102: Upon receiving a task pause signal, pause the processing of the asynchronous task indicated by the task pause signal, process tasks other than the submitted asynchronous task, and trigger the user program to start the active polling mechanism.

[0032] The user program handles tasks other than the submitted asynchronous tasks, such as processing new connection requests, executing other business logic (e.g., database operations, logging, scheduled tasks), and handling other events (e.g., network events, signal processing, user input). The processing of these tasks allows the user program to make full use of CPU resources and avoids being idle while waiting for the hardware accelerator to complete asynchronous tasks, thereby improving the overall performance and concurrency processing capabilities of the system.

[0033] When using OpenSSL's asynchronous mode to process asynchronous tasks, the asynchronous engine driver uses the task pause function (ASYNC_pause_job) provided by the OpenSSL library to pause the asynchronous task, forming a task pause signal. After receiving the task pause signal, the user program can pause processing the asynchronous task and process other tasks besides the submitted asynchronous task.

[0034] Since the user program is designed based on the event loop framework, which maintains the event loop and whose own operating mechanism is a data processing loop, the polling process can be inserted or set into the event loop framework. By taking advantage of the event loop framework's own cyclic execution characteristic, the user program can actively execute the polling (active polling mechanism).

[0035] Since the active polling mechanism is set within the user program's event loop framework, to ensure its proper execution, the user program should initiate the active polling mechanism only after submitting an asynchronous task and receiving a task pause signal. This avoids the active polling mechanism from executing when no asynchronous tasks are submitted or paused, ensuring balanced utilization of system resources.

[0036] Step S103: When it is detected based on the active polling mechanism that there is an asynchronous task whose hardware acceleration computation stage has been completed among the submitted asynchronous tasks, the computation result corresponding to the asynchronous task that has been completed is obtained.

[0037] An asynchronous task can consist of multiple stages, and the stage that requires hardware accelerators for computation can be called the hardware-accelerated computation stage.

[0038] For example, data encryption or decryption tasks can include the following stages: Task initialization phase: Prepare the data that needs to be encrypted or decrypted. The user program calls the task startup interface to submit the data encryption or decryption task to the asynchronous engine driver, so that the asynchronous engine driver can notify the hardware accelerator to perform the operation.

[0039] Hardware-accelerated computing phase: After receiving the data that needs to be encrypted or decrypted from the asynchronous engine driver mapping, the hardware accelerator begins to perform encryption or decryption operations on the data.

[0040] Task completion phase: After the hardware accelerator completes the encryption or decryption of the data, the user program obtains the calculation result and resumes the processing of the paused asynchronous task, and continues the processing of the subsequent stages of the asynchronous task based on the calculation result.

[0041] Step S104: Resume processing of the asynchronous task that has completed the calculation, so as to continue processing the subsequent stages of the asynchronous task that has completed the calculation based on the calculation result.

[0042] The subsequent stage is the stage following the hardware-accelerated computation stage in an asynchronous task that has already completed its computation.

[0043] The above process describes the task completion phase. For example, in a data encryption or decryption task, after the hardware accelerator completes the data encryption or decryption operation and the user program obtains the operation result, the subsequent processing can be: sending the encrypted data to the target location, or passing the decrypted data to the requester, or writing the encrypted data to the disk, or reading the decrypted data.

[0044] The technical solution provided by this invention, since the user program is based on an event loop framework, inherently functions as a data processing loop. Therefore, it can leverage the characteristics of the event loop framework to achieve active polling. Specifically, after the user program submits various asynchronous tasks and receives a task pause signal returned for the submitted asynchronous tasks, it triggers an active polling mechanism. The user program can then actively poll the processing status of each submitted asynchronous task. If it discovers an asynchronous task whose hardware acceleration phase has been completed, the user program can obtain the result of that completed task, resume the paused task, and continue processing subsequent phases after the hardware acceleration phase of that completed task is finished. Thus, the technical solution provided by this invention does not require establishing a dedicated polling thread; instead, it relies on the user program itself for active polling, reducing the resource consumption of a dedicated polling thread and improving processor performance.

[0045] In one embodiment, prior to step S101, the method may further include: Receive various data processing requests; Determine whether any of the data processing requests are data processing requests that perform hardware-accelerated computation based on a hardware accelerator. If so, the data processing request is encapsulated to form an asynchronous task; the asynchronous task includes a hardware-accelerated computing stage.

[0046] If a data processing request received by a user program can be processed by a hardware accelerator, i.e., if there is a data processing request under a data encryption or decryption task, then the data processing request can be encapsulated to form an asynchronous task.

[0047] Packaging and encapsulating data requests that utilize hardware accelerators to generate asynchronous tasks can improve the performance and efficiency of computer systems, optimize resource utilization, simplify management, enhance the scalability of computer systems, and ensure compatibility with OpenSSL's asynchronous mode.

[0048] After an asynchronous task is submitted, the hardware accelerator can perform operations on the data during the hardware acceleration phase of the asynchronous task, such as encrypting or decrypting the data.

[0049] In one implementation, the active polling mechanism is implemented based on the event loop maintained by the event loop framework; the active polling mechanism is executed by a coroutine executed by the user program, and the asynchronous tasks are executed by a coroutine executed by the user program, and the coroutine executing the active polling mechanism and the coroutine executing each asynchronous task belong to the same thread executed by the user program.

[0050] The active polling mechanism, implemented based on the event loop maintained by the event loop framework, means inserting the active polling mechanism task into the event loop maintained by the event loop framework. Since the user program is designed based on the event loop framework, inserting the active polling mechanism task into the user program allows the user program's loop characteristics to be used to repeatedly execute the active polling mechanism.

[0051] One of the core features of the event loop framework is its ability to continuously process events or tasks in the task queue until no more tasks need to be processed. This mechanism allows the active polling mechanism to be executed repeatedly in the event loop, thus achieving the effect of cyclic execution.

[0052] Furthermore, based on the foregoing, in order to balance resource utilization, the timing of the active polling mechanism in this embodiment of the invention is designed to be: submitting an asynchronous task and receiving a task pause signal. Therefore, it can both take advantage of the loop characteristics of the user program itself and avoid continuously executing the active polling mechanism.

[0053] For example, the event loop framework may include the VPP framework and the DPDK framework.

[0054] The VPP (Vector Packet Processing) framework refers to a high-performance, scalable, and modular network packet processing framework, primarily used for creating high-performance network data plane applications.

[0055] The VPP framework's open plugin operation mode allows a series of processing actions to be registered and invoked in the event loop maintained by its main framework. Therefore, the active polling mechanism can be registered in the event loop maintained by the VPP framework, enabling user programs to actively execute polling actions.

[0056] The DPDK (Data Plane Development Kit) framework is a high-performance network packet processing framework that helps developers build high-performance network applications.

[0057] The aforementioned "coroutine" is a lightweight user-level thread that allows for the cooperative execution of multiple tasks within a single thread. Compared to traditional threads, the switching overhead between coroutines is smaller because they run within the same thread and do not require system-level context switching. Coroutines handle asynchronous operations in a non-blocking manner, allowing for suspension and resumption during execution, thus achieving efficient concurrent processing.

[0058] This embodiment of the invention primarily focuses on the handling of asynchronous tasks in OpenSSL's asynchronous mode. As described above, in OpenSSL's asynchronous mode, the user program extracts CPU-free operations such as hardware acceleration and encapsulates the tasks into an ASYNC_JOB structure for execution.

[0059] The core principle of ASYNC_JOB is coroutines. During the execution of the ASYNC_JOB structure, the CPU can pause the asynchronous task encapsulated in the current ASYNC_JOB structure and switch the context through coroutines (the old function stack information, registers, etc. will be completely saved in the job-related structure, implemented using getcontext, makecontext, setcontext, _setjmp, _longjmp. When the coroutine switches back and resumes execution, the asynchronous task resumes, and the function stack will be restored from the asynchronous task-related structure), returning control to the user program.

[0060] Because coroutine scheduling is entirely controlled by the user, there is no kernel switching overhead, context switching is very fast, and all coroutines within a thread execute in parallel at a macro level and serially at a micro level. Therefore, thread-level global variables can be accessed without locks, avoiding the overhead of locking. During the time the hardware accelerator is computing, the user program can execute tasks other than the submitted asynchronous tasks. When the hardware accelerator completes its computation, it receives the task completion event through interrupts or polling by the upper-layer application and wakes up the coroutine containing the asynchronous task to continue execution.

[0061] Therefore, in this embodiment of the invention, the active polling mechanism is also executed by a coroutine, and the coroutine executing the active polling mechanism and the coroutine executing the asynchronous task belong to the same (business) thread executed by the user program. This avoids communication between threads or processes, reduces the number of context switches, and thus improves the overall performance of the system.

[0062] The thread executing the user program can also be called the business thread. This fully utilizes the coroutines within a business thread to execute active polling mechanisms and asynchronous tasks. It avoids the interaction between the dedicated polling thread and the thread containing the coroutine executing the asynchronous task, which is used when a dedicated polling thread is used. This reduces the number of context switches and improves the overall performance of the system.

[0063] Since the coroutines executing the active polling mechanism and the coroutines executing asynchronous tasks belong to the same business thread, inter-process or inter-thread communication is no longer involved. Therefore, the use of inter-thread or inter-process communication mechanisms (eventfd) to obtain the computing status and results of the hardware accelerator can be eliminated.

[0064] Eventfds are commonly used for inter-thread synchronization, inter-process communication, and event-driven programming. When user programs monitor eventfds, they typically use a blocking method. However, blocking can cause sleep, leading to process / thread context switching, and frequent reads and writes to eventfds can result in numerous system calls consuming significant CPU time. Therefore, this embodiment of the invention uses a bitmap approach, which avoids the need for user programs to use a blocking method to monitor eventfds for inter-thread communication, thus preventing blocking and reducing the overhead of system calls.

[0065] In one implementation, a global bitmap can be used to monitor the processing status of each asynchronous task's hardware acceleration phase. Please refer to [reference needed]. Figure 2 , Figure 2 This is another flowchart illustrating the task processing method provided in this embodiment of the invention.

[0066] like Figure 2 As shown, the method includes the following steps: Step S201: Identify and submit each asynchronous task.

[0067] Step S202: Upon receiving a task pause signal, pause the processing of the asynchronous task indicated by the task pause signal.

[0068] Step S203: Process tasks other than the submitted asynchronous tasks.

[0069] Step S204: Trigger the user program to start the active polling mechanism.

[0070] Step S205: Based on the active polling mechanism, detect asynchronous tasks that have completed computation during the hardware acceleration computation phase, and set the index bits corresponding to the asynchronous tasks that have completed computation.

[0071] Each asynchronous task has a corresponding index bit, and these index bits form a global bitmap.

[0072] Since the active polling mechanism and asynchronous tasks are executed using coroutines in the business threads of the user program, the notification of the results of the active polling mechanism does not involve inter-process or inter-thread communication. Therefore, the eventfd (event file descriptor) method is not used to pass the polling results. Instead, the notification of the results of the active polling mechanism is completed by reading and writing a global bitmap, which facilitates indexing asynchronous tasks and improves efficiency.

[0073] Bitmaps use bits to represent data, with each bit representing a Boolean value (0 or 1). This compact data structure makes bitmaps highly efficient for storing large amounts of data, requiring far less memory than other data structures.

[0074] Therefore, each asynchronous task can be marked with an index bit, and the index bits of all asynchronous tasks form a global bitmap. The value of the index bit (0 or 1) of each asynchronous task is used to indicate the processing status of the hardware acceleration stage of that asynchronous task. For example, if the hardware acceleration stage of an asynchronous task has been completed, the user program can set the value of the index bit of that asynchronous task to 1 so that when the user program executes the active polling mechanism later, it can identify the asynchronous task that has completed the operation.

[0075] Step S206: Detect whether there is a set index bit in the global bitmap based on the active polling mechanism; if yes, proceed to step S207; otherwise, proceed to step S203.

[0076] Step S207: Determine the asynchronous task corresponding to the set index bit as the asynchronous task that has completed the operation, and obtain the operation result corresponding to the asynchronous task that has completed the operation.

[0077] Each index bit corresponds to an asynchronous task, and the value of the index bit indicates the processing status of the hardware acceleration stage of the asynchronous task. Therefore, after the user program executes the active polling mechanism and detects that there is a set index bit in the global bitmap, it can index the corresponding asynchronous task according to the set index bit and then obtain the operation result of the asynchronous task.

[0078] Please continue to refer to this. Figure 2 The process of resuming asynchronous tasks that have completed computation may include: Step S208: Call the asynchronous task startup function.

[0079] The asynchronous task startup function (ASYNC_start_job) is the function in the aforementioned asynchronous task structure.

[0080] Step S209: Pass the asynchronous task that has been paused and completed through the asynchronous task start function, and resume the processing of the asynchronous task that has completed the operation.

[0081] Passing paused and completed asynchronous tasks to the asynchronous task startup function allows the user program to resume execution from the paused position (hardware-accelerated computation phase) of the completed asynchronous task, until the entire asynchronous task finishes running.

[0082] Step S210: When it is determined that the subsequent stage processing of the asynchronous task that has completed the operation is completed, the status of the asynchronous task that has completed the operation is configured as the asynchronous task end status.

[0083] Since an asynchronous task consists of multiple stages, there are other subsequent stages after the hardware-accelerated computation stage, such as storing the computation results or sending the computation results to the receiver. The processing of subsequent stages is based on the specific asynchronous task.

[0084] Therefore, when it is determined that the subsequent stages of an asynchronous task that has completed its computation are finished, it can be determined that the asynchronous task that has completed its computation is finished as a whole, and the processing status of the asynchronous task that has completed its computation can be configured as the asynchronous task completion status.

[0085] For example, the asynchronous task can be configured to complete its processing state as asynchronous task completion by using the asynchronous task termination function (ASYNC_FINISH) in the asynchronous task structure. At this point, the asynchronous task that has completed its computation is finished.

[0086] This invention also provides a task processing method applied to an asynchronous engine driver to support any of the aforementioned task processing methods applied to user programs designed based on an event loop framework.

[0087] Please refer to Figure 3 , Figure 3 This is another flowchart illustrating the task processing method provided in this embodiment of the invention.

[0088] like Figure 3 As shown, the method includes the following steps: Step S301: Receive asynchronous task.

[0089] The asynchronous task is the task submitted by the task processing method of a user program designed based on an event loop framework, as described in any of the foregoing embodiments.

[0090] User programs submit each asynchronous task to the asynchronous engine driver (OpenSSL asynchronous engine driver) through the ASYNC_start_job function, so that the asynchronous engine driver can map the hardware acceleration stage of the asynchronous task to the hardware accelerator.

[0091] Step S302: Map the hardware acceleration computation stage of the asynchronous task to the hardware accelerator to notify the hardware accelerator to perform computation on the hardware acceleration computation stage of the asynchronous task.

[0092] Mapping the hardware acceleration phase of the asynchronous task to the hardware accelerator means that the asynchronous engine driver maps the data in the hardware acceleration phase of the asynchronous task to the BD (Buffer Description) of the hardware accelerator.

[0093] After the mapping is completed, the asynchronous engine driver notifies the hardware accelerator to perform the computation.

[0094] Hardware accelerators can be chips or coprocessors with DMA functionality. The data transmission and reception units of chips or coprocessors with DMA functionality are called Data Descriptors (BDs). BDs describe the state of the data to be processed, including memory address, length, required operations, current state, etc. These descriptor structures are defined by different hardware specifications. During hardware driver initialization, a table consisting of several contiguous BDs is generated in main memory. A BD is essentially an array, mapping the array address range to a DMA-accessible region, and the array address is advertised to the hardware accelerator. All subsequent (business) data interactions between the CPU and the hardware accelerator rely on BDs. When the CPU needs data that requires the hardware accelerator's assistance in processing, it submits the data to the hardware accelerator. The implementation process may include the following steps: (1) The CPU retrieves a BD from the write pointer position of the BD table, associates the data to be processed with the current BD, sets the state of the BD, and moves the write pointer forward to point to the next free BD; (2) The CPU notifies the hardware accelerator to start processing data; (3) The hardware accelerator reads the currently valid BD from the read pointer position of the BD table, thereby finding its associated data for processing; (4) After the data processing is completed, if the hardware accelerator interrupt is enabled, the upper layer is notified through the interrupt, and the read pointer of the BD table is moved forward to point to the next data to be processed.

[0095] Since high-performance scenarios do not use interrupts, the upper layer needs to poll to determine whether the read pointer position of the BD table has passed the write pointer position of the BD table when the data is sent, so as to know whether the data has been processed.

[0096] In this embodiment of the invention, the method of using the hardware accelerator to process the data to be processed submitted by the CPU is continued to process the asynchronous tasks (data in the hardware acceleration computing stage) submitted by the user program to the asynchronous engine driver.

[0097] At this point, the processing status of the hardware acceleration phase of the asynchronous task is represented by the index bit corresponding to the asynchronous task. For example, the user program executes an active polling mechanism to poll the hardware accelerator for the processing status of the hardware acceleration phase of each asynchronous task. After finding that the hardware acceleration phase of one of the asynchronous tasks has completed its operation, the user program sets the index bit corresponding to that asynchronous task.

[0098] Step S303: Generate a task pause signal to suspend the processing of the asynchronous task, and return the task pause signal to the user program.

[0099] The task pause signal is used to trigger the user program to start the active polling mechanism.

[0100] The asynchronous engine driver can return a task pause signal to the user program. Upon receiving the task pause signal, the user program suspends processing of the asynchronous task and uses the hardware accelerator's processing time to handle tasks other than the submitted asynchronous task, thus improving processor resource utilization. Simultaneously, upon receiving the task pause signal, the user program can trigger an active polling mechanism.

[0101] As can be seen, in the technical solution provided by the embodiments of the present invention, after the asynchronous engine driver completes the mapping of asynchronous tasks and generates task pause signals, the task pause signals can be used to trigger the user program to start an active polling mechanism, thereby avoiding the establishment of an independent dedicated polling thread to implement polling operations, reducing processor resource consumption, and improving processor performance.

[0102] In one implementation, step S303 may include: calling an asynchronous task pause function; switching the coroutine corresponding to the asynchronous task through the asynchronous task pause function, configuring the state of the asynchronous task to a paused state; generating a task pause signal based on the paused state of the asynchronous task, and returning the task pause signal.

[0103] After the asynchronous engine driver notifies the hardware accelerator to perform computation, it can pause the asynchronous task. At this time, the execution of the asynchronous task is paused through an asynchronous task pause function (ASYNC_pause_job), which means switching out the coroutine that is executing the asynchronous task and returning control to the user program. At this time, the processing status of the asynchronous task is configured as "ASYNC_PAUSE", forming a task pause signal, and the processing status is paused.

[0104] This invention also provides a task processing device, please refer to... Figure 4 , Figure 4 This is a schematic diagram of a task processing device provided in an embodiment of the present invention. The device is applied to a user program designed based on an event loop framework.

[0105] like Figure 4 As shown, the device includes: The asynchronous task determination and submission module 40 is used to determine and submit each asynchronous task. The processing module 41 is used to pause the processing of the asynchronous task indicated by the task pause signal when a task pause signal is received, process tasks other than the submitted asynchronous task, and trigger the user program to start the active polling mechanism. The calculation result acquisition module 42 is used to acquire the calculation result corresponding to the asynchronous task that has completed the calculation when it is detected that there is an asynchronous task whose hardware acceleration calculation stage has been completed among the submitted asynchronous tasks based on the active polling mechanism. The asynchronous task recovery processing module 43 is used to recover the processing of the asynchronous task that has been completed, so as to continue processing the subsequent stage of the asynchronous task that has been completed based on the calculation result. The subsequent stage is the stage after the hardware acceleration calculation stage in the asynchronous task that has been completed.

[0106] The technical solution provided by this invention, since the user program is based on an event loop framework, inherently functions as a data processing loop. Therefore, it can leverage the characteristics of the event loop framework to achieve active polling. Specifically, after the user program submits various asynchronous tasks and receives a task pause signal returned for the submitted asynchronous tasks, it triggers an active polling mechanism. The user program can then actively poll the processing status of each submitted asynchronous task. If it discovers an asynchronous task whose hardware acceleration phase has been completed (a completed asynchronous task), the user program can obtain the result of the completed asynchronous task, resume the paused completed asynchronous task, and continue processing subsequent phases after the hardware acceleration phase of the completed asynchronous task is finished. Thus, the technical solution provided by this invention does not require establishing a dedicated polling thread; instead, it uses the user program itself for active polling, reducing resource consumption and improving processor performance compared to using a dedicated polling thread.

[0107] This invention also provides a task processing device, please refer to... Figure 5 , Figure 5 This is another schematic diagram of the task processing device provided in an embodiment of the present invention. The device is applied to an asynchronous engine driver.

[0108] like Figure 5 As shown, the device includes: The asynchronous task receiving module 50 is used to receive asynchronous tasks; the asynchronous task is a task submitted by the task processing device described in the foregoing embodiment. The mapping notification module 51 is used to map the hardware acceleration computation stage of the asynchronous task to the hardware accelerator, so as to notify the hardware accelerator to perform computation on the hardware acceleration computation stage of the asynchronous task. Return module 52 is used to generate a task pause signal to pause the processing of the asynchronous task and return the task pause signal to the user program; The task pause signal is used to trigger the user program to start the active polling mechanism.

[0109] As can be seen, in the technical solution provided by the embodiments of the present invention, after the asynchronous engine driver completes the mapping of asynchronous tasks and generates task pause signals, the task pause signals can be used to trigger the user program to start an active polling mechanism, thereby avoiding the establishment of an independent dedicated polling thread to implement polling operations, reducing processor resource consumption, and improving processor performance.

[0110] This invention also provides a hardware acceleration system, please refer to... Figure 6 , Figure 6This is a schematic diagram of the hardware acceleration system provided in an embodiment of the present invention.

[0111] like Figure 6 As shown, the hardware acceleration system includes: User program 61, designed based on an event loop framework, is configured to execute a task processing method as described in any of the foregoing embodiments, applied to a user program designed based on an event loop framework. The asynchronous engine driver 62 is configured to execute the task processing method applied to the asynchronous engine driver as described in any of the foregoing embodiments.

[0112] As can be seen, in the hardware acceleration system provided in this embodiment of the invention, the polling operation is designed to be actively executed by the user program, that is, triggering the user program's active polling mechanism. This eliminates the need to start a dedicated polling thread; instead, the user program actively performs the polling, reducing system resource consumption and improving overall performance. To enable active polling by the user program, the user program is designed based on an event loop framework. In such programs, since their business model is inherently a data processing loop, the polling action can be scheduled to a specific moment in the loop, achieving the goal of actively polling the hardware accelerator for the processing status of the asynchronous task's hardware acceleration transport phase.

[0113] Please continue to refer to this. Figure 6 The asynchronous hardware acceleration system may further include: The hardware accelerator 63 is used to perform calculations on the hardware acceleration calculation stage of the asynchronous task according to the hardware acceleration calculation stage of the asynchronous task mapped by the asynchronous engine driver 62, and generate the calculation result of the asynchronous task.

[0114] During the time that the hardware accelerator 63 performs in the hardware acceleration phase, the user program can execute tasks other than the submitted asynchronous tasks. At the same time, the user program can execute an active polling mechanism to detect the processing status of the hardware accelerator 63 in the hardware acceleration phase of the asynchronous tasks.

[0115] To further illustrate the effect of the asynchronous hardware acceleration system provided in the embodiments of the present invention, an asynchronous hardware acceleration system employing a dedicated polling thread will be used for explanation. Please refer to... Figure 7 and Figure 8 , Figure 7 This is a schematic diagram illustrating the working process of an asynchronous hardware acceleration system that uses a dedicated polling thread. Figure 8 This is a schematic diagram of the working process of the hardware acceleration system provided in the embodiment of the present invention.

[0116] like Figure 7 As shown, in an asynchronous hardware acceleration system employing a dedicated polling thread, the workflow includes the following steps: (1) The user program calls the ASYNC_start_job function to submit an asynchronous task.

[0117] User programs encapsulate data processing requests that require hardware accelerator computation into asynchronous tasks, and submit these asynchronous tasks to the asynchronous engine driver (OpenSSL asynchronous engine driver, such as the engine & driver for fast assist technology) through the ASYNC_start_job function provided by the OpenSSL library.

[0118] (2) Asynchronous engine driver, maps asynchronous tasks to the BD of hardware accelerator; returns a task pause signal.

[0119] During this process, the asynchronous engine driver maps the data of the hardware acceleration computation stage of the asynchronous task to the BD of the hardware accelerator, notifies the hardware accelerator to perform the computation, and then pauses the asynchronous task. The coroutine executing the asynchronous task is switched out through the ASYNC_pause_job function (or interface), and control is returned to the user program. At this time, the status of the asynchronous task is configured as "ASYNC_PAUSE", forming a task pause signal, which is returned to the user program.

[0120] (3) After the user program takes over control, it continues to execute other tasks during the time the hardware accelerator is running, and then obtains the eventfd bound to the asynchronous task and uses select / epoll to monitor the eventfd in a blocking manner. (4) The hardware accelerator performs the operation, and at this time the dedicated polling thread continuously polls the hardware accelerator.

[0121] The hardware accelerator acquires the data in the BD and begins processing the data in the hardware acceleration phase associated with the BD. During the operation of the hardware accelerator, a dedicated polling thread continuously polls the hardware accelerator to check whether the hardware acceleration phase has been completed.

[0122] (5) When the dedicated polling thread successfully polls, it writes to the eventfd and notifies the user program that the operation has been completed.

[0123] Once the hardware accelerator completes the hardware acceleration computation phase, a polling thread that successfully polls writes the computation result to the eventfd, wakes up the user program, and notifies it that the computation is complete. (6) The user program waits for the hardware accelerator to complete the calculation by selecting / epoll eventfd.

[0124] (7) Handling of user programs to resume paused asynchronous tasks.

[0125] The user program calls the ASYNC_start_job function, passing in an asynchronous task that is in the "ASYNC_PAUSE" state and has completed its computation, so that the asynchronous task can continue processing from its previous paused position (hardware accelerated transport phase) until it finishes running.

[0126] (8) After the asynchronous task is completed, configure it to end asynchronously.

[0127] The user program configures the status of the asynchronous task to "ASYNC_FINISH", at which point the entire asynchronous task is completed.

[0128] exist Figure 7 The following problems exist in the process described: 1. Start a separate thread (dedicated polling thread) to poll the processing status of the hardware accelerator, which requires a separate timer thread; 2. Because the polling action of this dedicated polling thread is run once every certain period of time by a timer, there is also context switching with other processes / threads; 3. When the user program monitors eventfd, using a blocking method will cause it to sleep, resulting in a context switch of the process / thread; 4. Frequent reading and writing of eventfd will cause a large number of system calls, which will consume CPU time.

[0129] visible, Figure 7 The illustrated process suffers from CPU resource consumption and frequent context switching, impacting overall CPU performance. Therefore, this embodiment of the invention does not use a dedicated polling thread to poll the hardware accelerator's processing status. Instead, it leverages the framework characteristics of the user program itself to implement proactive polling by the user program.

[0130] like Figure 8 As shown, in the hardware acceleration system provided in this embodiment of the invention, the working process includes the following steps: (1) The user program calls the ASYNC_start_job function to submit an asynchronous task.

[0131] The user program encapsulates data processing requests that require hardware accelerator processing into asynchronous tasks, and submits the asynchronous tasks to the OpenSSL asynchronous engine driver through the ASYNC_start_job function provided by the OpenSSL library. (2) The asynchronous engine driver maps asynchronous tasks to the BD of the hardware accelerator; returns a task pause signal.

[0132] The asynchronous engine driver maps the data in the hardware acceleration phase of the asynchronous task to the BD and notifies the hardware accelerator to perform the calculation. Then, it pauses the asynchronous task: the ASYNC_pause_job function switches out the coroutine where the asynchronous task is located and returns control to the user program. At this time, the state of the asynchronous task is set to "ASYNC_PAUSE", forming a task pause signal. (3) The user program handles tasks other than asynchronous tasks submitted by the user program and initiates an active polling mechanism.

[0133] After the user program takes over control, it continues to execute other tasks besides the submitted asynchronous tasks during the time the hardware accelerator is computing.

[0134] (4) The user program checks the bitmap to obtain the results of the asynchronous tasks that have been completed, or continues to process tasks other than the submitted asynchronous tasks if there are no index bits set.

[0135] The user program checks the global bitmap to see which asynchronous task has completed. If no asynchronous task has finished, it immediately leaves to process other tasks besides the submitted asynchronous task. If the user program finds that an asynchronous task has completed (the hardware-accelerated computation phase has ended), it calls the ASYNC_start_job function, passing in the asynchronous task that is in the "ASYNC_PAUSE" state and has completed its computation. This allows the completed asynchronous task to resume processing from its previous paused position (the hardware-accelerated computation phase) and finish running. Finally, the asynchronous task's state is configured to "ASYNC_FINISH", at which point the entire asynchronous task processing is complete.

[0136] (5) The hardware accelerator performs the operation, and the user program sets the index bit in the bitmap to indicate that there is an asynchronous task that has been completed.

[0137] The hardware accelerator acquires the data base (BD) and begins calculating its associated data. At some point after the hardware accelerator has finished processing the data, the user program actively polls the hardware accelerator. If it finds an asynchronous task that has completed its computation, it marks the index bit of the corresponding asynchronous task on the global bitmap (e.g., by setting the index bit to a bit), indicating that the hardware acceleration computation phase of the asynchronous task has been completed.

[0138] As can be seen, the hardware acceleration system provided in this embodiment of the invention eliminates the need for a dedicated polling thread. Instead, the user program actively polls asynchronous tasks at opportune times (the user program initiates the active polling mechanism), and the polling timing can be freely controlled by the user program. For example, as described in this embodiment, "after submitting an asynchronous task and receiving a task pause signal, the user program is triggered to initiate the active polling mechanism." Furthermore, the method of communication via reading and writing eventfd is eliminated, thus avoiding the overhead of blocking and system calls.

[0139] This invention provides an electronic device, such as a terminal device, a server device, or other computer device, including a memory and a processor. The memory stores a program, and the processor calls the program stored in the memory to execute a task processing method applied to a user program designed based on an event loop framework, as described in any of the foregoing embodiments, or to execute a task processing method applied to an asynchronous engine-driven system, as described in any of the foregoing embodiments.

[0140] This invention provides a storage medium storing a program that, when executed, implements a task processing method for a user program designed based on an event loop framework, as described in any of the foregoing embodiments, or implements a task processing method for an asynchronous engine-driven program, as described in any of the foregoing embodiments.

[0141] This invention provides a computer program product, including a computer program that, when executed by a processor, implements a task processing method as described in any of the foregoing embodiments, applied to a user program designed based on an event loop framework, or implements a task processing method as described in any of the foregoing embodiments, applied to an asynchronous engine-driven program.

[0142] The foregoing describes multiple embodiments of the present invention. The optional methods described in each embodiment can be combined and cross-referenced without conflict, thereby extending to a variety of possible embodiments. These can all be considered as embodiments disclosed or made public by the present invention.

[0143] While the embodiments of the present invention have been disclosed above, the present invention is not limited thereto. Any person skilled in the art can make various modifications and alterations without departing from the spirit and scope of the present invention; therefore, the scope of protection of the present invention should be determined by the scope defined in the claims.

Claims

1. A task processing method, characterized in that, The task processing method, applied to user programs designed based on an event loop framework, includes: Identify and submit each asynchronous task; Upon receiving a task pause signal, the processing of the asynchronous task indicated by the task pause signal is paused, and tasks other than the submitted asynchronous task are processed, and the user program is triggered to start an active polling mechanism. When the active polling mechanism detects that among the submitted asynchronous tasks, there is an asynchronous task whose hardware acceleration computation phase has been completed, the computation result corresponding to the asynchronous task that has been completed is obtained. Resume processing of asynchronous tasks that have completed computation, so as to continue processing subsequent stages of the asynchronous tasks that have completed computation based on the computation results. The subsequent stages are the stages of the asynchronous tasks that have completed computation after the hardware-accelerated computation stage.

2. The task processing method as described in claim 1, characterized in that, Prior to the step of identifying and submitting each asynchronous task, the method further includes: Receive various data processing requests; Determine whether any of the data processing requests are data processing requests that perform hardware-accelerated computation based on a hardware accelerator. If so, the data processing request is encapsulated to form an asynchronous task; the asynchronous task includes a hardware-accelerated computing stage.

3. The task processing method as described in claim 2, characterized in that, The active polling mechanism is implemented based on the event loop maintained by the event loop framework; the active polling mechanism is executed by a coroutine executed by the user program, and the asynchronous tasks are executed by a coroutine executed by the user program, and the coroutine executing the active polling mechanism and the coroutine executing each asynchronous task belong to the same thread executed by the user program.

4. The task processing method as described in claim 3, characterized in that, The event loop framework includes the VPP framework and the DPDK framework.

5. The task processing method as described in claim 3, characterized in that, After the step of triggering the user program to start the active polling mechanism, and before the step of obtaining the computation result corresponding to the completed asynchronous task when it is detected that among the submitted asynchronous tasks based on the active polling mechanism, there is an asynchronous task whose hardware acceleration computation phase has been completed, the method further includes: Based on the active polling mechanism, the asynchronous tasks that have completed the hardware acceleration computing phase are detected, and the index bits corresponding to the asynchronous tasks that have completed the computing are set. Each asynchronous task has a corresponding index bit, and these index bits form a global bitmap.

6. The task processing method as described in claim 5, characterized in that, When the asynchronous task submitted is detected based on the active polling mechanism as having completed its hardware-accelerated computation phase, the computation result corresponding to the completed asynchronous task is obtained, including: Based on the active polling mechanism, detect whether there is a set index bit in the global bitmap; If so, the asynchronous task corresponding to the set index bit will be identified as the asynchronous task that has been completed, and the operation result corresponding to the asynchronous task that has been completed will be obtained. If not, continue processing tasks other than the submitted asynchronous task.

7. The task processing method according to any one of claims 1-6, characterized in that, The process of resuming asynchronous tasks that have completed computation includes: Call the asynchronous task startup function; The asynchronous task is started by passing an asynchronous task that has been paused and completed to the asynchronous task startup function. The processing of the asynchronous task that has completed the operation is resumed so that the subsequent stages of the asynchronous task can be processed based on the operation result.

8. The task processing method as described in claim 7, characterized in that, After the step of resuming the processing of an asynchronous task that has completed its computation and has been paused by passing it to the asynchronous task start function, the method further includes: When it is determined that the subsequent stages of processing for an asynchronous task that has completed its computation are finished, the status of the asynchronous task that has completed its computation is configured as the asynchronous task completion status.

9. The task processing method according to any one of claims 1-6, characterized in that, The submission of each of the asynchronous tasks includes: Call the asynchronous task startup function, and submit each asynchronous task through the asynchronous task startup function.

10. A task processing method, characterized in that, Applied to asynchronous engine drivers, the task processing method includes: Receive asynchronous tasks; the asynchronous task is a task submitted by the task processing method according to any one of claims 1-9; The hardware acceleration phase of the asynchronous task is mapped to the hardware accelerator to notify the hardware accelerator to perform the hardware acceleration phase of the asynchronous task. Generate a task pause signal to suspend the processing of the asynchronous task, and return the task pause signal to the user program; The task pause signal is used to trigger the user program to start the active polling mechanism.

11. The task processing method as described in claim 10, characterized in that, The process of generating a task pause signal to suspend processing of the asynchronous task and returning the task pause signal to the user program includes: Call the asynchronous task pause function; The asynchronous task pause function switches the coroutine corresponding to the asynchronous task and configures the asynchronous task to a paused state. An asynchronous task in a paused state generates a task pause signal and returns the task pause signal.

12. A task processing device, characterized in that, The task processing device, applied to user programs designed based on an event loop framework, includes: The asynchronous task determination and submission module is used to determine and submit each asynchronous task. The processing module is used to pause the processing of the asynchronous task indicated by the task pause signal when a task pause signal is received, process tasks other than the submitted asynchronous task, and trigger the user program to start the active polling mechanism. The calculation result acquisition module is used to acquire the calculation result corresponding to the asynchronous task that has completed the calculation when it is detected that there is an asynchronous task whose hardware acceleration calculation stage has been completed among the submitted asynchronous tasks based on the active polling mechanism. An asynchronous task recovery processing module is used to recover the processing of an asynchronous task that has completed computation, so as to continue processing the subsequent stage of the asynchronous task that has completed computation based on the computation result. The subsequent stage is the stage after the hardware-accelerated computation stage in the asynchronous task that has completed computation.

13. A task processing device, characterized in that, Applied to asynchronous engine drivers, including: An asynchronous task receiving module is used to receive asynchronous tasks; the asynchronous task is a task submitted by the task processing device as described in claim 12. The mapping notification module is used to map the hardware acceleration computation stage of the asynchronous task to the hardware accelerator, so as to notify the hardware accelerator to perform computation on the hardware acceleration computation stage of the asynchronous task. The return module is used to generate a task pause signal to suspend the processing of the asynchronous task and return the task pause signal to the user program; The task pause signal is used to trigger the user program to start the active polling mechanism.

14. An asynchronous hardware acceleration system, characterized in that, include: A user program designed based on an event loop framework is configured to execute the task processing method as described in any one of claims 1-9; An asynchronous engine driver is configured to perform the task processing method as described in any one of claims 10 and 11.

15. The asynchronous hardware acceleration system as described in claim 14, characterized in that, Also includes: The hardware accelerator is used to perform calculations on the hardware acceleration phase of the asynchronous task according to the hardware acceleration phase of the asynchronous task mapped by the asynchronous engine driver, and generate the calculation result of the asynchronous task.

16. An electronic device, characterized in that, The device includes a memory and a processor, wherein the memory stores a program, and the processor calls the program stored in the memory to execute the task processing method as described in any one of claims 1-9, or to execute the task processing method as described in any one of claims 10 and 11.

17. A storage medium, characterized in that, The storage medium stores a program, which, when executed, implements the task processing method as described in any one of claims 1-9, or implements the task processing method as described in any one of claims 10 and 11.

18. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the task processing method as described in any one of claims 1-9, or implements the task processing method as described in any one of claims 10 and 11.