A queue switching method, electronic device and storage medium

By adopting a queue switching method based on sub-drawing instructions, the problem of prolonged queue switching response time is solved, fast switching is achieved, system latency is reduced, and it is suitable for high concurrency and real-time scenarios.

CN121077987BActive Publication Date: 2026-01-30METAX INTEGRATED CIRCUITS (SHANGHAI) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511579058.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-10-31
Publication Date
2026-01-30
Estimated Expiration
2045-10-31

AI Technical Summary

Technical Problem

Existing technologies employ packet-based queue switching strategies, which prolong queue switching response time and affect data transmission latency, making it difficult to meet the rapid switching requirements in high-concurrency, low-latency scenarios.

Method used

The queue switching method adopts sub-drawing instructions as the basic unit. When a switching instruction is received, the scheduling of the current queue is paused, the breakpoint information is saved and stored in a dedicated storage unit, and the target queue is directly switched to. The execution is then performed after the context is restored or initialized.

Benefits of technology

It significantly reduces the waiting time for queue switching, has low system response latency, is suitable for high concurrency and high real-time scenarios, and meets the needs of real-time rendering.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121077987B_ABST
    Figure CN121077987B_ABST
Patent Text Reader

Abstract

This invention relates to the field of chip design technology, and in particular to a queue switching method, electronic device, and storage medium. It obtains the currently executing i-th queue, and upon receiving a switching instruction to switch to the target queue, triggers a switching step between the i-th queue and the target queue: obtaining the k-th sub-drawing instruction SD of the j-th data packet currently being executed by the i-th queue. i,j,k Waiting for SD i,j,k After execution, the scheduling of the i-th queue is paused, breakpoint information is obtained, and this breakpoint information is stored in a dedicated storage unit of the i-th queue. Then, the target queue is scheduled for execution. Using sub-drawing instructions as the basic scheduling unit, it significantly reduces waiting time and is suitable for high-concurrency, high-real-time, and low-latency scenarios. Furthermore, the allocation of dedicated storage units allows for instantaneous recovery of breakpoint information when switching queues, further reducing waiting time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of chip design technology, and in particular to a queue switching method, electronic device, and storage medium. Background Technology

[0002] In queue management technology for chip design, efficient scheduling and switching of data packets plays a decisive role in system performance. Currently, a packet-based queue switching strategy is widely adopted. This strategy effectively reduces the additional consumption of system resources by eliminating the need for cleanup, while clearly defined queue boundaries greatly reduce the complexity of queue management and improve the stability and reliability of system operation, demonstrating good applicability in many application scenarios.

[0003] However, this strategy has significant drawbacks. When the system executes an operation within a data packet and receives a queue switching instruction, it cannot immediately respond and execute the queue switching due to the packet-based switching mechanism. All operations within the current data packet must be completed before the queue switching operation can be performed. As the data packet size increases and downstream processing issues cause intermittent backpressure, this waiting mechanism significantly prolongs the queue switching response time, leading to increased data transmission latency. This severely impacts the real-time performance and smoothness of chip data processing, making it difficult to meet the demands for rapid queue switching in high-concurrency, low-latency scenarios. Therefore, a queue switching method with shorter waiting times is urgently needed. Summary of the Invention

[0004] To address the aforementioned technical problems, the present invention adopts the following technical solution: a queue switching method, the method comprising the following steps:

[0005] S100, obtain the i-th queue currently being scheduled and executed; where the i-th queue contains J data packets and the j-th data packet contains K(j) sub-drawing instructions; where 1≤i≤I, 1≤j≤J, I is the total number of queues, and K(j) is a positive integer.

[0006] S200, when a switching instruction to switch to the target queue is received, the switching step between the i-th queue and the target queue is triggered, including:

[0007] S210, retrieve the k-th sub-drawing instruction SD of the j-th data packet currently being executed in the i-th queue. i,j,k , where 1≤k≤K(j).

[0008] S220, when SD i,j,k The (k+1)th sub-drawing instruction SD has been executed but not yet executed. i,j,k+1 When the scheduling of the i-th queue is paused, the information used to indicate when the queue resumes scheduling is obtained from the SD. i,j,k+1The breakpoint information at the start of execution is directly stored in the dedicated storage unit of the i-th queue; when SD i,j,k If the request has been sent but not yet completed, then wait for SD. i,j,k After execution, pause the scheduling of the i-th queue and obtain the information to indicate when the queue resumes scheduling from the SD. i,j,k+1 The breakpoint information at which execution begins is recorded, and the breakpoint information is saved in a dedicated storage unit.

[0009] S230, schedule the execution of the target queue, and execute it after restoring or initializing the context according to its state.

[0010] Furthermore, the present invention also provides a non-transitory computer-readable storage medium storing at least one instruction or at least one program segment, wherein the at least one instruction or the at least one program segment is loaded and executed by a processor to implement the above-described method.

[0011] In addition, the present invention provides an electronic device including a processor and the aforementioned non-transitory computer-readable storage medium.

[0012] The present invention has at least the following beneficial effects:

[0013] This invention provides a queue switching method, electronic device, and storage medium. Upon receiving a switching command, the method stores the breakpoint information of the currently scheduled sub-drawing command in a dedicated storage unit, and then switches to the target queue. Using sub-drawing commands within data packets as the basic scheduling unit, compared to existing technologies that use data packets as the basic unit for queue switching, resulting in waiting time for a single data packet, the processing time for a sub-drawing command is significantly shorter than that of a single packet. This substantially reduces waiting time, resulting in low system response latency, making it suitable for high-concurrency, high-real-time, and low-latency scenarios. Furthermore, by allocating an independent dedicated storage unit to each queue, breakpoint information can be instantly restored during queue switching, further reducing waiting time. Attached Figure Description

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

[0015] Figure 1 A flowchart of a queue switching method provided in an embodiment of the present invention;

[0016] Figure 2 A flowchart illustrating the switching steps between the i-th queue and the target queue, provided in an embodiment of the present invention. Detailed Implementation

[0017] 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.

[0018] Unless otherwise defined, all technical and scientific terms used in the embodiments of this invention have the same meaning as commonly understood by those skilled in the art.

[0019] Please see Figure 1 The flowchart illustrates a queue switching method, which includes the following steps:

[0020] S100, obtain the i-th queue currently being scheduled and executed; where the i-th queue contains J data packets and the j-th data packet contains K(j) sub-drawing instructions; where 1≤i≤I, 1≤j≤J, I is the total number of queues, and K(j) is a positive integer.

[0021] The queue contains multiple data packets, each a pre-created sequence of instructions by the application, containing a set of sub-drawing instructions. As an example, a queue may contain multiple rendering instruction packets, each corresponding to a set of sub-drawing commands. The queue schedules these packets sequentially to processing units for execution. The header information of each data packet includes the number of sub-drawing instructions in the current packet and basic configuration parameters shared by all sub-drawing instructions. A sub-drawing instruction is the smallest, indivisible unit of graphics rendering instruction that constitutes a larger rendering instruction packet (data packet). A sub-drawing instruction contains only one complete, self-contained graphics rendering instruction. It's important to note that all sub-drawing instructions within the same data packet share basic configuration parameters, avoiding redundant storage of the same information in each sub-drawing instruction and improving efficiency. The most crucial difference between different sub-drawing instructions within the same data packet lies in the vertex data addresses they operate on.

[0022] S200, when a switching instruction to switch to the target queue is received, the switching step between the i-th queue and the target queue is triggered.

[0023] It should be noted that the main entity interacting with the instructions is the queue manager or scheduling module. That is, the queue manager or scheduling module receives the switching instructions and performs operations such as instruction switching.

[0024] The switching instruction refers to switching the currently scheduled queue to the target queue.

[0025] In one implementation, the switching instruction is triggered by a priority preemption or an interrupt signal. Other types of triggering conditions also fall within the scope of this invention.

[0026] Please see Figure 2 The switching steps between the i-th queue and the target queue include S210-230.

[0027] S210, retrieve the k-th sub-drawing instruction SD of the j-th data packet currently being executed in the i-th queue. i,j,k , where 1≤k≤K(j).

[0028] It should be noted that the triggering condition for the switching instruction may occur at any time, such as during the execution of a sub-drawing instruction or immediately after the sub-drawing instruction has finished executing. The execution of sub-operations within a sub-drawing instruction cannot be interrupted during its execution; therefore, the maximum waiting time for switching to the target queue depends on the processing time of the current sub-drawing instruction. Compared to the processing time of a packet required when switching queues in existing technologies, the processing time of a sub-drawing instruction is much shorter than the processing time of a packet, thus significantly reducing the waiting time, resulting in low system response latency, and making it suitable for high-concurrency or high-real-time scenarios.

[0029] S220, when SD i,j,k The (k+1)th sub-drawing instruction SD has been executed but not yet executed. i,j,k+1 When the scheduling of the i-th queue is paused, the information used to indicate when the queue resumes scheduling is obtained from the SD. i,j,k+1 The breakpoint information at the start of execution is directly stored in the dedicated storage unit of the i-th queue; when SD i,j,k If the request has been sent but not yet completed, then wait for SD. i,j,k After execution, pause the scheduling of the i-th queue and obtain the information to indicate when the queue resumes scheduling from the SD. i,j,k+1 The breakpoint information at which execution begins is recorded, and the breakpoint information is saved in a dedicated storage unit.

[0030] Among them, if SD i,j,k Just finished executing and SD not executed i,j,k+1 When this happens, there's no need to wait; the system will directly pause and save the corresponding breakpoint information. If SD... i,j,k If the request has been sent but not yet completed, then it is necessary to wait for SD. i,j,k After execution, pause scheduling and save the corresponding breakpoint information. The maximum waiting time is equal to SD. i,j,k Processing time.

[0031] In one implementation, completed sub-drawing instructions include instructions that complete the entire rendering process and write the results to the target buffer, instructions that indicate that data has been acknowledged and received by downstream modules and completed synchronously, and instructions whose corresponding hardware or software status is marked as complete and whose occupied resources have been released. Other types of completed sub-drawing instructions also fall within the scope of protection of this invention.

[0032] In one implementation, issued but not yet completed sub-drawing instructions include instructions waiting for resource allocation, instructions paused during execution due to incomplete data loading, instructions that have generated intermediate results but have not completed the entire process, and instructions that have been executed but have not been acknowledged by downstream modules. Other types of issued but not yet completed sub-drawing instructions also fall within the protection scope of this invention.

[0033] In one embodiment, breakpoint information includes a queue identifier, an index of the currently executing data packet, and a pointer to a sub-draw instruction to be executed. It may also include one or more of intermediate calculation results, configuration parameters, or resource occupancy status. Other types of information included in the breakpoint information also fall within the scope of this invention. In one embodiment, intermediate calculation results include generated but uncommitted temporary data and read but unprocessed input data. In one embodiment, configuration parameters include priority settings, timeout thresholds, and the identifier of the currently used shader program. In one embodiment, resource occupancy status includes the address of the occupied video memory block.

[0034] In one embodiment, the dedicated storage unit is a hardware register set, local memory, or dedicated cache; other types of dedicated storage units also fall within the scope of protection of this invention.

[0035] By allocating a dedicated storage unit to each queue, the system ensures that its state data is stored exclusively and without interference. This prevents data confusion between queues and allows for instant context recovery when switching queues, avoiding time-consuming repeated initialization and meeting real-time rendering requirements.

[0036] S230, schedule the execution of the target queue, and execute it after restoring or initializing the context according to its state.

[0037] It should be noted that after saving the breakpoint information in a dedicated storage unit, the execution of the scheduling is switched to the target queue. When it is necessary to switch back later, the execution of the corresponding sub-drawing instruction in the i-th queue can be resumed directly based on the breakpoint information.

[0038] The queue may be in a state of paused scheduling or a state of no paused scheduling, and the scheduling execution logic is different in different scheduling states.

[0039] In one implementation, in S230, when the target queue is in a paused scheduling state, breakpoint information is loaded from the dedicated storage unit of the target queue, and the scheduling logic for the target queue is restored according to the breakpoint information, so that the target queue starts executing scheduling from the sub-drawing instruction locked by the breakpoint information.

[0040] In one implementation, in S230, when the target queue is not in a paused scheduling state, the context is initialized from the beginning position of the target queue and then the scheduling is performed.

[0041] As one implementation, the method further includes: S300, when a scheduling instruction to restore the i-th queue is received, loading breakpoint information from the dedicated storage unit of the i-th queue, restoring the scheduling logic for the i-th queue according to the breakpoint information, and causing the i-th queue to start scheduling execution from the sub-drawing instruction position locked by the breakpoint information.

[0042] As one implementation, the method further includes: S400, when receiving an instruction to clear the i-th queue, clearing the breakpoint information in the i-th queue and its dedicated storage unit.

[0043] As one implementation method, when the execution of a sub-drawing instruction depends on internal parameters and does not require access to external storage units, the sub-drawing instruction is explicitly split into multiple operation steps during data packet construction, with each operation step constituting a new sub-drawing instruction. For example, a sub-drawing instruction might include the following steps: first, preparing multiple data points; second, calculating the result based on the prepared data points; third, storing the calculation result in a designated storage unit; and fourth, returning the calculation result. It should be noted that the prepared data points are all data already carried in the current data packet and do not require memory access. Therefore, this sub-drawing instruction can be further split into multiple new sub-drawing instructions according to the operation steps. The new sub-drawing instructions obtained by splitting by operation steps have a finer granularity and shorter processing time compared to sub-drawing instructions based on graphics drawing instruction units.

[0044] In summary, this invention provides a queue switching method that, upon receiving a switching instruction, stores the breakpoint information of the currently scheduled sub-drawing instruction in a dedicated storage unit, and then switches to the target queue. Using sub-drawing instructions as the basic scheduling unit, it significantly reduces waiting time and system response latency, making it suitable for high-concurrency or high-real-time scenarios. Simultaneously, it allocates an independent dedicated storage unit to each queue to prevent data confusion between queues, and can instantly restore breakpoint information when switching queues, avoiding time-consuming repeated initialization and meeting real-time rendering requirements.

[0045] Embodiments of the present invention also provide a non-transitory computer-readable storage medium that can be disposed in an electronic device to store at least one instruction or at least one program related to implementing a method in the method embodiments, wherein the at least one instruction or the at least one program is loaded and executed by the processor to implement the method provided in the above embodiments.

[0046] Embodiments of the present invention also provide an electronic device, including a processor and the aforementioned non-transitory computer-readable storage medium.

[0047] Embodiments of the present invention also provide a computer program product including program code, which, when the program product is run on an electronic device, causes the electronic device to perform the steps of the methods described above in various exemplary embodiments of the present invention.

[0048] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.

[0049] While specific embodiments of the invention have been described in detail by way of example, those skilled in the art should understand that the examples are for illustrative purposes only and not intended to limit the scope of the invention. Those skilled in the art should also understand that various modifications can be made to the embodiments without departing from the scope and spirit of the invention. The scope of this invention is defined by the appended claims.

Claims

1. A method of queue switching, the method comprising: The method comprises the following steps: S100, acquiring a i-th queue which is currently being scheduled to execute; wherein the i-th queue comprises J data packets, and the j-th data packet comprises K(j) sub-drawing instructions; wherein 1≤i≤I, 1≤j≤J, I is the total number of queues, and K(j) is a positive integer; S200, when a switching instruction of switching to a target queue is received, triggering a switching step between the i-th queue and the target queue, comprising: S210, acquire the kth sub-rendering instruction SD of the jth data packet being executed by the ith queue i,j,k wherein 1≤k≤K(j); S220, when the SD i,j,k has been executed and the (k+1)th sub-drawing instruction SD i,j,k+1 is not executed, suspending the scheduling of the ith queue, obtaining breakpoint information indicating that the queue resumes scheduling from the execution of the SD i,j,k+1 , and directly saving the breakpoint information in the special storage unit of the ith queue; when the SD i,j,k has been issued and not executed, waiting until the SD i,j,k is executed, suspending the scheduling of the ith queue, obtaining breakpoint information indicating that the queue resumes scheduling from the execution of the SD i,j,k+1 , and saving the breakpoint information in the special storage unit. S230, scheduling to execute the target queue, and executing after resuming or initializing the context according to the state thereof.

2. The method of claim 1, wherein, The method further comprises: S300, when a scheduling instruction of resuming the i-th queue is received, loading breakpoint information from a dedicated storage unit of the i-th queue, resuming scheduling logic of the i-th queue according to the breakpoint information, and enabling the i-th queue to start scheduling execution from a sub-drawing instruction position locked by the breakpoint information.

3. The method of claim 1, wherein, The method further comprises: S400, when an instruction of clearing the i-th queue is received, clearing the i-th queue and breakpoint information in the dedicated storage unit thereof.

4. The method of claim 1, wherein, When execution of a sub-drawing instruction depends on an internal parameter and does not need to access an external storage unit, the sub-drawing instruction is explicitly split into multiple operation steps when a data packet is constructed, and each operation step is a new sub-drawing instruction.

5. The method of claim 1, wherein, In S230, when the target queue is in a state of pausing scheduling, breakpoint information is loaded from a dedicated storage unit of the target queue, scheduling logic of the target queue is resumed according to the breakpoint information, and the target queue starts scheduling execution from a sub-drawing instruction locked by the breakpoint information.

6. The method of claim 1, wherein, In S230, when the target queue is in a state of not pausing scheduling, the target queue is executed after initializing a context from a starting position thereof.

7. The method of claim 1, wherein, The breakpoint information comprises a queue identifier, an index of a data packet which is currently being executed, and a sub-drawing instruction pointer to be executed.

8. The method of claim 1, wherein, The dedicated storage unit is a hardware register group, a local memory or a dedicated cache. 9.A non-transitory computer-readable storage medium having stored therein at least one instruction or at least one piece of program, characterized in that, The at least one instruction or the at least one program is loaded and executed by a processor to implement the method according to any one of claims 1-8.

10. An electronic device, comprising: A processor and a non-transitory computer readable storage medium as claimed in claim 9 are comprised.

Citation Information

Patent Citations

  • Task processing method and device, storage medium and electronic device

    CN116450360A

  • Router unit, network-on-chip system, computer system and chip

    CN118337735A