Search

CN-122019087-A - Interrupt method, apparatus, computer device, readable storage medium, and program product

CN122019087ACN 122019087 ACN122019087 ACN 122019087ACN-122019087-A

Abstract

The present application relates to an interrupt method, apparatus, computer device, computer readable storage medium and computer program product. The method comprises the steps of receiving a waiting command sent by an application thread, wherein the waiting command carries information of a task to be submitted, acquiring the task to be submitted from a work queue when a task flow is executed, generating an interrupt identifier of the task to be submitted according to the task information, sending the task to be submitted carrying the interrupt identifier to a GPU, and carrying out interrupt according to the interrupt notification, wherein the interrupt notification is sent to a CPU according to the interrupt identifier after the GPU finishes executing the task to be submitted. The method can reduce the load of the CPU.

Inventors

  • ZHOU ZEQIN
  • ZHOU ZHIBO
  • WU XIAOKAI

Assignees

  • 格兰菲智能科技股份有限公司

Dates

Publication Date
20260512
Application Date
20260120

Claims (12)

  1. 1. An interrupt method, the method comprising: Receiving a waiting command sent by an application thread, wherein the waiting command carries information of a task to be processed; When executing task flow, acquiring a task to be submitted from a work queue, generating an interrupt identifier of the task to be submitted according to the task information, and sending the task to be submitted carrying the interrupt identifier to a GPU; and carrying out interruption according to an interruption notification, wherein the interruption notification is sent to a CPU according to the interruption mark after the GPU finishes executing the task to be submitted.
  2. 2. The interrupt method of claim 1, wherein the method further comprises: receiving a task to be processed sent by the application thread; and adding the task to be processed to the work queue, associating the task to be processed with a synchronous time line, and generating a task number on the synchronous time line for the task to be processed.
  3. 3. The interrupt method of claim 1, wherein the task information includes a synchronization timeline identifier and a wait value, wherein the obtaining a task to be submitted from a work queue, and generating the interrupt identifier of the task to be submitted according to the task information, comprises: Comparing a current task number with a current monitoring value to obtain an interrupt judging state, wherein the current monitoring value is obtained according to each waiting value, the current task number is the task number of the task to be submitted, and the task number is generated after the GPU receives the task to be processed; And when the interrupt judging state is that the interrupt identifier needs to be inserted, generating the interrupt identifier of the task to be submitted, and sending the task to be submitted carrying the interrupt identifier to the GPU.
  4. 4. The interrupt method according to claim 3, wherein comparing the current task number with the current monitored value to obtain the interrupt determination state further comprises: and when the current task number is larger than the current monitoring value, judging that the interrupt judging state is that interrupt identification needs to be inserted.
  5. 5. The interrupt method according to claim 3, wherein after receiving the wait command sent by the application thread, the interrupt method further comprises: and adding the waiting values into a waiting queue corresponding to a synchronous time line, wherein each waiting value in the waiting queue is arranged in an ascending order, and the synchronous time line is determined according to a synchronous time line identifier.
  6. 6. The interrupt method of claim 5, wherein when the task to be submitted carries the interrupt identifier, the GPU finishes executing the task to be submitted, writes a task number into a memory and sends an interrupt notification to a CPU; the interrupting according to the interrupt notification comprises the following steps: reading the task number from the memory; Deleting the waiting value which is smaller than or equal to the task number in the waiting queue corresponding to the synchronous time line, updating the current monitoring value, and waking up the application thread corresponding to the waiting value.
  7. 7. An interrupt method according to claim 3, characterized in that the method further comprises: when the interrupt judging state is that interrupt identification is not needed to be inserted and the return value state is incomplete, inserting the waiting value into a polling waiting queue; And polling the waiting value in the polling waiting queue, and interrupting according to the waiting value and a return value, wherein the return value is the task number of the task to be submitted after the GPU finishes executing.
  8. 8. The interrupt method according to claim 7, wherein said interrupting according to the wait value and the return value comprises: and deleting the waiting value from the polling waiting queue when the returned value is greater than or equal to the waiting value, and waking up the application thread corresponding to the waiting value.
  9. 9. An interrupt device, the device comprising: The instruction receiving module is used for receiving a waiting command sent by an application thread, wherein the waiting command carries information of a task to be processed; the interrupt preprocessing module is used for acquiring a task to be submitted from a work queue when executing a task stream, generating an interrupt identifier of the task to be submitted according to the task information, and sending the task to be submitted carrying the interrupt identifier to the GPU; And the interrupt module is used for interrupting according to an interrupt notice, wherein the interrupt notice is sent to the CPU according to the interrupt mark after the GPU finishes executing the task to be submitted.
  10. 10. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any one of claims 1 to 8 when the computer program is executed.
  11. 11. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 8.
  12. 12. A computer program product comprising a computer program, characterized in that the computer program, when executed by a processor, implements the steps of the method of any one of claims 1 to 8.

Description

Interrupt method, apparatus, computer device, readable storage medium, and program product Technical Field The present application relates to the field of computer technology, and in particular, to an interrupt method, apparatus, computer device, computer readable storage medium, and computer program product. Background In existing graphics processing systems, notification and synchronization of task completion is performed between a CPU (Central Processing Unit ) and a GPU (Graphics Processing Unit, graphics processor) through an interrupt mechanism. In general, the GPU triggers an interrupt after completing a task, and notifies the CPU that the corresponding task has been executed, thereby implementing asynchronous coordination. However, in the scene of finer task granularity and frequent submission, a large number of invalid interrupts are generated, resulting in a significant increase in CPU load. Disclosure of Invention In view of the foregoing, it is desirable to provide an interruption method, apparatus, computer device, computer readable storage medium, and computer program product that are capable of interruption on demand. In a first aspect, the present application provides an interrupt method, including: Receiving a waiting command sent by an application thread, wherein the waiting command carries information of a task to be processed; When executing task flow, acquiring a task to be submitted from a work queue, generating an interrupt identifier of the task to be submitted according to the task information, and sending the task to be submitted carrying the interrupt identifier to a GPU; And carrying out interruption according to the interruption notification, wherein the interruption notification is sent to the CPU according to the interruption mark after the GPU finishes executing the task to be submitted. In one embodiment, the method further comprises: receiving a task to be processed sent by the application thread; and adding the task to be processed to the work queue, associating the task to be processed with a synchronous time line, and generating a task number on the synchronous time line for the task to be processed. In one embodiment, the task information comprises a synchronous time line identifier and a waiting value, the task to be submitted is obtained from a work queue, and the interrupt identifier of the task to be submitted is generated according to the task information, and the method comprises the following steps: Comparing a current task number with a current monitoring value to obtain an interrupt judging state, wherein the current monitoring value is obtained according to each waiting value, the current task number is the task number of the task to be submitted, and the task number is generated after the GPU receives the task to be processed; And when the interrupt judging state is that the interrupt identifier needs to be inserted, generating the interrupt identifier of the task to be submitted, and sending the task to be submitted carrying the interrupt identifier to the GPU. In one embodiment, the comparing the current task number with the current monitored value to obtain the interrupt determination state further includes: and when the current task number is larger than the current monitoring value, judging that the interrupt judging state is that interrupt identification needs to be inserted. In one embodiment, after receiving the wait command sent by the application thread, the method further includes: and adding the waiting values into a waiting queue corresponding to a synchronous time line, wherein each waiting value in the waiting queue is arranged in an ascending order, and the synchronous time line is determined according to a synchronous time line identifier. In one embodiment, the GPU executes the task to be submitted, and when the task to be submitted carries the interrupt identifier, the GPU finishes executing the task to be submitted, writes a task number into a memory and sends an interrupt notification to a CPU; the interrupting according to the interrupt notification comprises the following steps: reading the task number from the memory; Deleting the waiting value which is smaller than or equal to the task number in the waiting queue corresponding to the synchronous time line, updating the current monitoring value, and waking up the application thread corresponding to the waiting value. In one embodiment, the method further comprises: when the interrupt judging state is that interrupt identification is not needed to be inserted and the return value state is incomplete, inserting the waiting value into a polling waiting queue; And polling the waiting value in the polling waiting queue, and interrupting according to the monitoring value and a return value, wherein the return value is updated after the GPU executes the task to be submitted. In one embodiment, the interrupting according to the waiting value and the return value includes: and deleting the wait