Search

CN-121309844-B - Video task scheduling method and device, electronic equipment and storage medium

CN121309844BCN 121309844 BCN121309844 BCN 121309844BCN-121309844-B

Abstract

The invention provides a video task scheduling method, a device, electronic equipment and a storage medium, which belong to the technical field of artificial intelligent chips and comprise the steps of receiving a video task instruction, acquiring real-time states of a plurality of video execution units when the video task instruction comprises a data stream identifier and first frame indication information, selecting a target execution unit from video execution units in an idle state when the first frame indication information indicates that a current instruction is a code stream first frame, establishing a mapping relation between the data stream identifier and the target execution unit, and sending the video task instruction to the target execution unit. According to the invention, when the code stream first frame instruction is received, the target unit is dynamically allocated and the mapping is established according to the real-time idle state of the video execution unit, so that the problems of task blocking and resource waste caused by incapability of sensing the busy and idle state of hardware in the conventional software scheduling are solved, and the overall scheduling efficiency and resource utilization rate of the video coding and decoding unit in the general graphics processor are improved.

Inventors

  • Request for anonymity
  • Request for anonymity
  • Request for anonymity

Assignees

  • 上海壁仞科技股份有限公司

Dates

Publication Date
20260505
Application Date
20251211

Claims (10)

  1. 1. A video task scheduling method is characterized in that an execution main body of the video task scheduling method is an independent hardware circuit unit integrated in a graphic processor, and the method comprises the following steps: receiving a video task instruction, wherein the video task instruction comprises a data stream identifier and first frame indication information, and the data stream identifier comprises a code stream identifier and a channel identifier; when the first frame indication information indicates that the current instruction is the first frame of the code stream, directly reading the real-time states of a plurality of video execution units through a hardware signal line, and selecting a target execution unit from the video execution units in an idle state; the mapping relation between the data stream identifier and the target execution unit is established, which comprises that the code stream identifier and the channel identifier are spliced or combined according to a preset bit width rule through a hardware logic circuit to obtain an addressing address of a hardware storage space, so that each unique channel and the code stream combination correspond to a unique physical storage unit in the storage space; And sending the video task instruction to the target execution unit.
  2. 2. The video task scheduling method according to claim 1, further comprising, after receiving the video task instruction: When the first frame indication information indicates that the current instruction is not the first frame of the code stream, searching the pre-established mapping relation according to the data stream identification, and determining a target execution unit bound with the data stream identification; and sending the video task instruction to a target execution unit bound with the data flow identifier.
  3. 3. The video task scheduling method of any one of claims 1-2, wherein the data stream identification includes a code stream identifier and a channel identifier; The establishing the mapping relation between the data flow identifier and the target execution unit includes: Splicing or combining the code stream identifier and the channel identifier to obtain an addressing address of a hardware storage space; And taking the number of the target execution unit as data content, and writing the data content into a storage unit corresponding to the addressing address.
  4. 4. The video task scheduling method according to claim 1, wherein the selecting a target execution unit from among video execution units in an idle state includes: Traversing all video execution units, and detecting the current real-time state mark of each video execution unit; determining the video execution unit with the real-time state marked as the idle state as a candidate set; And determining a video execution unit from the candidate set in sequence as the target execution unit according to a preset circulation sequence, wherein when the video execution unit allocated last time is the N-th video execution unit in the circulation sequence, whether the (n+1) -th video execution unit in the circulation sequence belongs to the candidate set is judged in priority.
  5. 5. The video task scheduling method according to claim 4, further comprising, after sending the video task instruction to the target execution unit: updating the real-time state mark of the target execution unit from the idle state to a busy state; and when a video task instruction indicating the first frame of the code stream is received next time, excluding the video execution unit in the busy state from the candidate set.
  6. 6. The video task scheduling method of claim 4, further comprising: receiving a task completion signal fed back by the target execution unit after completing a video task; In response to the task completion signal, resetting the real-time status flag of the target execution unit from a busy state to the idle state to enable the target execution unit to be re-incorporated into the candidate set.
  7. 7. The video task scheduling method according to claim 1, further comprising: When detecting that the real-time states of all the video execution units are marked as busy states, suspending the distribution operation of the current video task instruction; and continuously monitoring the real-time state until the state of at least one video execution unit is changed into the idle state.
  8. 8. A video task scheduling device, comprising: The instruction receiving module is used for receiving a video task instruction, wherein the video task instruction comprises a data stream identifier and first frame indication information, and the data stream identifier comprises a code stream identifier and a channel identifier; The allocation selection module is used for directly reading the real-time states of the video execution units through the hardware signal line when the first frame indication information indicates that the current instruction is the first frame of the code stream, and selecting a target execution unit from the video execution units in the idle state; The instruction issuing module is used for establishing a mapping relation between the data stream identifier and the target execution unit, and comprises the steps of performing binary bit-level splicing or combination operation on the code stream identifier and the channel identifier through a hardware logic circuit according to a preset bit width rule to obtain an addressing address of a hardware storage space, so that each unique channel and code stream combination corresponds to a unique physical storage unit in the storage space; and the instruction issuing module is also used for sending the video task instruction to the target execution unit.
  9. 9. An electronic device comprising a memory, a processor and a computer program stored on the memory and running on the processor, wherein the processor implements the video task scheduling method of any one of claims 1 to 7 when executing the computer program.
  10. 10. A non-transitory computer readable storage medium having stored thereon a computer program, which when executed by a processor implements the video task scheduling method of any one of claims 1 to 7.

Description

Video task scheduling method and device, electronic equipment and storage medium Technical Field The present invention relates to the field of artificial intelligence chips, and in particular, to a video task scheduling method, a video task scheduling device, an electronic device, and a storage medium. Background In general-purpose graphics processors, multiple video execution units are typically integrated to handle a large number of codec tasks in parallel, requiring accurate distribution of a video instruction stream to each execution unit through a scheduling mechanism. In order to ensure the context continuity of the same video code stream encoding and decoding, the prior art generally adopts a static binding strategy dominant by a software side. When the software issues the instruction, the target execution unit of the instruction is pre-designated according to the code stream identification, so that all instruction packets belonging to the same code stream are ensured to be fixedly distributed to the same video execution unit for processing. However, the actual load state of the underlying hardware cannot be known in real time by the scheduling manner preset by the software. Because of the lack of real-time interaction between the software layer and the busy state of the hardware execution units, when tasks are distributed, a situation often occurs in which a new task instruction is sent to the execution unit currently in the busy state, while other idle units are not effectively utilized. This mismatch in resource allocation results in a waste of hardware computational power, thereby reducing the overall scheduling efficiency and resource utilization of the video codec unit. Disclosure of Invention The invention provides a video task scheduling method, a device, electronic equipment and a storage medium, which are used for solving the defects in the prior art and improving the overall scheduling efficiency and the resource utilization rate of a video coding and decoding unit in a general graphics processor. The invention provides a video task scheduling method, which comprises the following steps: receiving a video task instruction, wherein the video task instruction comprises a data stream identifier and first frame indication information; When the first frame indication information indicates that the current instruction is the first frame of the code stream, acquiring the real-time states of a plurality of video execution units, and selecting a target execution unit from the video execution units in an idle state; establishing a mapping relation between the data flow identification and the target execution unit; And sending the video task instruction to the target execution unit. According to the video task scheduling method provided by the invention, after receiving the video task instruction, the method further comprises the following steps: When the first frame indication information indicates that the current instruction is not the first frame of the code stream, searching the pre-established mapping relation according to the data stream identification, and determining a target execution unit bound with the data stream identification; and sending the video task instruction to a target execution unit bound with the data flow identifier. According to the video task scheduling method provided by the invention, the data stream identifier comprises a code stream identifier and a channel identifier; The establishing the mapping relation between the data flow identifier and the target execution unit includes: Splicing or combining the code stream identifier and the channel identifier to obtain an addressing address of a hardware storage space; And taking the number of the target execution unit as data content, and writing the data content into a storage unit corresponding to the addressing address. According to the video task scheduling method provided by the invention, the target execution unit is selected from the video execution units in an idle state, and the method comprises the following steps: Traversing all video execution units, and detecting the current real-time state mark of each video execution unit; determining the video execution unit with the real-time state marked as the idle state as a candidate set; And determining a video execution unit from the candidate set in sequence as the target execution unit according to a preset circulation sequence, wherein when the video execution unit allocated last time is the N-th video execution unit in the circulation sequence, whether the (n+1) -th video execution unit in the circulation sequence belongs to the candidate set is judged in priority. According to the video task scheduling method provided by the invention, after the video task instruction is sent to the target execution unit, the method further comprises the following steps: updating the real-time state mark of the target execution unit from the idle state to a busy state; and when a