Task order preserving output method and device, chip, storage medium and program product
By assigning identifiers to tasks in a large-scale queue and updating the key position pointer table, the dequeue result of the task is determined, thus solving the timing and routing problems caused by the number of queues and the task waiting table logic, and improving task processing performance and capability.
Patent Information
- Application Number
- CN202511728620.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-24
- Publication Date
- 2026-02-27
- Estimated Expiration
- 2045-11-24
AI Technical Summary
In the case of large-scale queues, the combination of queue number and task wait table cache depth in existing technologies is huge, leading to timing convergence and wiring congestion problems, which affect task processing performance.
By receiving information about tasks to be processed, assigning task identifiers to them, querying the key position pointer table in the ordered linked list unit using the queue identifier, updating the key position pointer table of the target queue, determining the dequeue result of the task's linked list based on the head task pointer, tail task pointer, and successor task pointer, refreshing the pointer table to allow or prohibit dequeueing, and reducing the number of queues and the cache depth of the task waiting table.
It improves task processing performance, reduces timing and wiring pressure, supports task processing with large-scale queues, simplifies pipeline stages, and enhances task processing capabilities.
Smart Images

Figure CN121166402B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the chip technical field, and in particular to a task order preserving output method and device, a chip, a storage medium and a program product. BACKGROUND
[0002] In chip design, there are often scenarios that require queue order preserving. That is, in order to speed up the processing of certain tasks, a large number of parallel processor threads are used to synchronize the processing of related tasks of the business, and a queue identifier (qid) is used to mark the related tasks of the same business so that they are in the same queue, thereby preserving the order of the tasks in the same queue based on the order of entering the parallel processor threads.
[0003] In related technologies, when a task enters a parallel processor thread, it carries a queue identifier and task processing data (task data), and a hardware allocates a task identifier (task_id) for the task and passes it back with the task package. Subsequently, on the one hand, the task will enter the parallel processor for task processing, and on the other hand, the task will be enqueued according to the task identifier and added to the order preserving link list (voq link list), thereby recording the order between tasks. When the parallel processor finishes processing the task, it can output the queue identifier, task identifier and task processing result of the task, and the hardware writes the output information into the task waiting table (Wait table) using the task identifier as the address and sets the validity (valid) flag of the task to 1. Subsequently, the order preserving link list can take out the head task of all queues as an index to search for the corresponding task in the task waiting table. If the validity flag of the corresponding task found is 1, it means that the first task of the queue has been processed and is allowed to dequeue. In this way, all queue head tasks are traversed to obtain the result of whether the head tasks of all queues are allowed to dequeue, and after scheduling, the final dequeued task package is obtained.
[0004] However, taking out the head tasks of all queues as an index to search for the corresponding task in the task waiting table can only support a small number of queues. When the number of queues is large, the combination logic of the number of queues and the cache depth of the task waiting table is huge, causing timing convergence and wiring congestion problems. Therefore, in the case of large-scale queues, only the scheme of using one order preserving queue by multiple queues can reduce the timing and wiring pressure, which increases the probability of queue head blocking. When the processing speed difference between different queues is large, it seriously affects the task processing performance. SUMMARY
[0005] Therefore, it is necessary to provide a task order preserving output method, device, chip, storage medium and program product capable of improving the task processing performance of large-scale queues to solve the above technical problems.
[0006] In a first aspect, the present application provides a task order preserving output method, comprising:
[0007] receiving information of a to-be-processed task, and allocating a task identifier to the to-be-processed task, wherein the information of the to-be-processed task comprises a queue identifier of a target queue to which the to-be-processed task belongs and to-be-processed target data corresponding to the to-be-processed task;
[0008] querying a key position pointer table in an order preserving linked list unit according to the queue identifier, and updating a key position pointer table corresponding to the target queue by using the task identifier, wherein the key position pointer table comprises a head task pointer, a tail task pointer and a successor task pointer of a head task of the target queue at a current time, and the successor task pointer is used to indicate a successor task of the target queue, and the successor task is a next task of the head task at the current time;
[0009] processing the to-be-processed task by using a parallel task processor, and outputting a linked list dequeue request of the to-be-processed task, wherein the linked list dequeue request comprises the task identifier and the queue identifier of the to-be-processed task;
[0010] reading the key position pointer table corresponding to the target queue according to the queue identifier, and determining a linked list dequeue result of the to-be-processed task according to the head task pointer, the tail task pointer, the successor task pointer and the task identifier of the to-be-processed task;
[0011] in a case where the linked list dequeue result is a dequeue permission, instructing to output the to-be-processed task and to refresh the key position pointer table.
[0012] In one embodiment, the determining of the linked list dequeue result of the to-be-processed task according to the head task pointer, the tail task pointer, the successor task pointer and the task identifier of the to-be-processed task comprises:
[0013] in a case where the task identifiers indicated by the head task pointer, the tail task pointer and the successor task pointer at the current time are the same, determining that the linked list dequeue result of the to-be-processed task is the dequeue permission;
[0014] in a case where the task identifiers indicated by the head task pointer, the tail task pointer and the successor task pointer at the current time are not the same, determining the linked list dequeue result of the to-be-processed task according to the head task pointer and the task identifier of the to-be-processed task.
[0015] In one embodiment, in the case where the task identifiers indicated by the head task pointer, the tail task pointer and the successor task pointer at the current time are the same, the refreshing of the key position pointer table comprises:
[0016] refreshing validity mark information in the key position pointer table from a first value to a second value, the validity mark information representing that there is a task to be dequeued in the order preserving linked list when the validity mark information is in the first value, and the validity mark information representing that the order preserving linked list is empty when the validity mark information is in the second value.
[0017] In one of the embodiments, in a case where the task identifier indicated by the head task pointer and the successor task pointer is different at the current time and the task identifier indicated by the successor task pointer and the tail task pointer is the same at the current time, the refreshing the key position pointer table comprises:
[0018] updating, in the key position pointer table, the task identifier indicated by the head task pointer to the task identifier indicated by the successor task pointer.
[0019] In one of the embodiments, in a case where the task identifiers indicated by the head task pointer, the successor task pointer and the tail task pointer are all different at the current time, the refreshing the key position pointer table comprises:
[0020] reading a successor task table corresponding to the order preserving linked list of the target queue to determine a task identifier of a next task of the successor task in the target queue;
[0021] updating, in the key position pointer table, the task identifier indicated by the head task pointer to the task identifier indicated by the successor task pointer, and updating the task identifier indicated by the successor task pointer to the task identifier of the next task of the successor task.
[0022] In one of the embodiments, after the indicating outputting the task to be processed and refreshing the key position pointer table, the method further comprises:
[0023] in a case where the linked list dequeuing result is allowing to dequeue, querying a successor task in a task waiting table according to the task identifier indicated by the successor task pointer, wherein the task waiting table stores task information to be dequeued;
[0024] performing a dequeue loopback operation on the successor task queried in the task waiting table;
[0025] clearing a validity mark of the successor task in the task waiting table.
[0026] In one of the embodiments, after the determining the linked list dequeuing result of the task to be processed, the method further comprises:
[0027] In a case where the chain table dequeuing result is not allowed to dequeue, taking the task identifier of the to-be-processed task as an address, storing the processing result data of the to-be-processed task in the task waiting table and adding the validity mark of the to-be-processed task.
[0028] In one of the embodiments, the updating of the key position pointer table corresponding to the target queue by using the task identifier comprises:
[0029] In a case where the validity mark information in the key position pointer table is a second value, updating the head task pointer, the successor task pointer and the tail task pointer to the task identifier of the to-be-processed task and updating the value of the validity mark information from the second value to a first value.
[0030] In a case where the validity mark information in the key position pointer table is a first value, updating the key position pointer table according to the task identifiers indicated by the head task pointer, the successor task pointer and the tail task pointer at the current time.
[0031] In one of the embodiments, the updating of the key position pointer table according to the task identifiers indicated by the head task pointer, the successor task pointer and the tail task pointer at the current time comprises:
[0032] In a case where the task identifiers indicated by the head task pointer and the successor task pointer at the current time are the same, updating the task identifiers indicated by the successor task pointer and the tail task pointer to the task identifier of the to-be-processed task.
[0033] In a case where the task identifiers indicated by the head task pointer and the successor task pointer at the current time are different, updating the task identifier indicated by the tail task pointer to the task identifier of the to-be-processed task.
[0034] In a second aspect, the application further provides a task order-preserving output device, comprising:
[0035] a receiving module configured to receive information of a to-be-processed task, allocate a task identifier to the to-be-processed task, the information of the to-be-processed task comprising a queue identifier of a target queue to which the to-be-processed task belongs and to-be-processed target data corresponding to the to-be-processed task;
[0036] an order preserving module configured to query a key position pointer table in the order preserving linked list unit according to the queue identifier, and update the key position pointer table corresponding to the target queue by using the task identifier, wherein the key position pointer table comprises a head task pointer, a tail task pointer and a successor task pointer of a head task of the target queue at a current time, and the successor task pointer is configured to indicate a successor task of the target queue, and the successor task is a next task of the head task at the current time;
[0037] a processing module configured to process the to-be-processed task by using the parallel task processor, and output a linked list dequeue request of the to-be-processed task, wherein the linked list dequeue request comprises the task identifier and the queue identifier of the to-be-processed task;
[0038] an output module configured to read the key position pointer table corresponding to the target queue according to the queue identifier, determine a linked list dequeue result of the to-be-processed task according to the head task pointer, the tail task pointer, the successor task pointer and the task identifier of the to-be-processed task, and instruct to output the to-be-processed task and refresh the key position pointer table in a case that the linked list dequeue result is a dequeue permission.
[0039] In one of the embodiments, the output module is further configured to determine the linked list dequeue result of the to-be-processed task as the dequeue permission in a case that the task identifiers indicated by the head task pointer, the tail task pointer and the successor task pointer at the current time are the same, and determine the linked list dequeue result of the to-be-processed task according to the head task pointer and the task identifier of the to-be-processed task in a case that the task identifiers indicated by the head task pointer, the tail task pointer and the successor task pointer at the current time are not the same.
[0040] In one of the embodiments, in the case that the task identifiers indicated by the head task pointer, the tail task pointer and the successor task pointer at the current time are the same, the output module is further configured to refresh a validity mark information in the key position pointer table from a first value to a second value, wherein the validity mark information represents that there is a to-be-dequeued task in the order preserving linked list when the validity mark information is in the first value, and the validity mark information represents that the order preserving linked list is empty when the validity mark information is in the second value.
[0041] In one of the embodiments, in a case that the task identifiers indicated by the head task pointer and the successor task pointer at the current time are different and the task identifiers indicated by the successor task pointer and the tail task pointer at the current time are the same, the output module is further configured to update the task identifier indicated by the head task pointer to the task identifier indicated by the successor task pointer in the key position pointer table.
[0042] In one of the embodiments, when the task identifiers indicated by the head task pointer, the successor task pointer and the tail task pointer are all different at the current time, the output module is further configured to read a successor task table corresponding to the in-order linked list of the target queue, and determine a task identifier of a next task of the successor task in the target queue; in the key position pointer table, update the task identifier indicated by the head task pointer to the task identifier indicated by the successor task pointer, and update the task identifier indicated by the successor task pointer to the task identifier of the next task of the successor task.
[0043] In one of the embodiments, the output module is further configured to, when the linked list dequeue result is to allow dequeue, query the successor task in a task waiting table according to the task identifier indicated by the successor task pointer, wherein the task waiting table stores to-be-dequeued task information; perform a dequeue loopback operation on the successor task queried in the task waiting table; and clear a validity flag of the successor task in the task waiting table.
[0044] In one of the embodiments, the output module is further configured to, when the linked list dequeue result is to not allow dequeue, store processing result data of the to-be-processed task in a task waiting table with the task identifier of the to-be-processed task as an address, and add a validity flag of the to-be-processed task.
[0045] In one of the embodiments, the in-order module is further configured to, when the validity flag information in the key position pointer table is a second value, update the head task pointer, the successor task pointer and the tail task pointer to indicate the task identifier of the to-be-processed task, and update the value of the validity flag information from the second value to a first value; when the validity flag information in the key position pointer table is the first value, update the key position pointer table according to the task identifiers indicated by the head task pointer, the successor task pointer and the tail task pointer at the current time.
[0046] In one of the embodiments, the in-order module is further configured to, when the task identifiers indicated by the head task pointer and the successor task pointer are the same at the current time, update the task identifiers indicated by the successor task pointer and the tail task pointer to the task identifier of the to-be-processed task; and when the task identifiers indicated by the head task pointer and the successor task pointer are different at the current time, update the task identifier indicated by the tail task pointer to the task identifier of the to-be-processed task.
[0047] In a third aspect, the present application also provides a chip comprising a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the task-preservation output method in the first aspect.
[0048] In a fourth aspect, the present application also provides a computer-readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the task-preservation output method in the first aspect.
[0049] In a fifth aspect, the present application also provides a computer program product comprising a computer program, and the computer program is executed by a processor to implement the task-preservation output method in the first aspect.
[0050] The task-preservation output method, device, chip, storage medium and program product are configured to receive a linked list dequeue request of a to-be-processed task sent by a parallel task processor, receive information of the to-be-processed task, assign a task identifier to the to-be-processed task, wherein the information of the to-be-processed task comprises a queue identifier of a target queue to which the to-be-processed task belongs and target data corresponding to the to-be-processed task; query a key position pointer table in a preservation sequence linked list unit according to the queue identifier, and update the key position pointer table corresponding to the target queue by using the task identifier, wherein the key position pointer table comprises a head task pointer, a tail task pointer and a successor task pointer of the target queue at a current time, and the successor task pointer is used to indicate a successor task of the target queue, and the successor task is a next task of the head task at the current time; process the to-be-processed task by using the parallel task processor, and output the linked list dequeue request of the to-be-processed task, wherein the linked list dequeue request comprises the task identifier and the queue identifier of the to-be-processed task; read the key position pointer table corresponding to the target queue according to the queue identifier, and determine a linked list dequeue result of the to-be-processed task according to the head task pointer, the tail task pointer, the successor task pointer and the task identifier of the to-be-processed task; and in a case where the linked list dequeue result is to allow dequeue, instruct to output the to-be-processed task and flush the key position pointer table. Since the head task pointer, the tail task pointer, the successor task pointer in the key position pointer table corresponding to the preservation sequence linked list of the target queue and the task identifier of the to-be-processed task are used to determine whether the to-be-processed task currently processed is allowed to be dequeued from the corresponding target queue, it is not necessary to synchronize with other queues to confirm whether the head task is allowed to be dequeued, thereby reducing the combination logic of the number of queues and the cache depth of the task waiting table, and it is not necessary to use one preservation sequence queue for multiple queues to reduce the timing and wiring pressure, and thus the task processing performance is improved. BRIEF DESCRIPTION OF DRAWINGS
[0051] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related art, the drawings needed to be used in the description of the embodiments of the present application or the related art will be briefly introduced. Obviously, the drawings in the following description only constitute some embodiments of the present application, and for those skilled in the art, other related drawings can also be obtained without creative labor.
[0052] Figure 1 A flowchart of a task order preserving output method provided by an embodiment of the present application;
[0053] Figure 2 A flowchart of another task order preserving output method provided by an embodiment of the present application;
[0054] Figure 3 A schematic diagram of the principle of a task order preserving output provided by an embodiment of the present application;
[0055] Figure 4 A structural block diagram of a task order preserving output device provided by an embodiment of the present application;
[0056] Figure 5 An internal structural diagram of a chip provided by an embodiment of the present application. DETAILED DESCRIPTION
[0057] In order to make the purpose, technical solutions and advantages of the present application more clear, the present application will be further described in detail below in combination with the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and do not limit the present application.
[0058] To solve the above problems, the embodiments of the present application provide a task order preserving output method, device, chip, storage medium and program product. According to the head task pointer, tail task pointer, successor task pointer and task identifier of the to-be-processed task in the key position pointer table corresponding to the order preserving linked list of the target queue, it is determined whether the to-be-processed task completed by the current processing is allowed to be dequeued in the corresponding target queue, so that it is not necessary to synchronize with other queues to confirm whether the head task is allowed to be dequeued, thereby reducing the combination logic of the number of queues and the cache depth of the task waiting table, without multiple queues sharing one order preserving queue to reduce timing and wiring pressure, and thus improving the task processing performance.
[0059] The task order preserving output method provided by the embodiments of the present application can be applied to a task order preserving output device, which can be an arbitrary chip or an order preserving output unit in a chip, and the embodiments of the present application do not limit this.
[0060] In an exemplary embodiment, as Figure 1As shown, a task order preserving output method is provided, which is described by taking the order preserving output unit in the chip as an example, and includes S101 to S106. Wherein:
[0061] S101, receiving information of a to-be-processed task, and allocating a task identifier to the to-be-processed task.
[0062] Wherein, the information of the to-be-processed task includes a queue identifier of a target queue to which the to-be-processed task belongs and to-be-processed target data corresponding to the to-be-processed task.
[0063] In this application, after the chip receives the information of the to-be-processed task, the task allocation unit of the chip can be triggered to apply for allocating a task identifier to the to-be-processed task. After the to-be-processed task obtains the task identifier, the task allocation unit can send a processing request of the to-be-processed task to the parallel processor and send an order preserving request of the to-be-processed task to the order preserving output unit.
[0064] For example, the queue identifier can be the identifier of the target queue to which the to-be-processed task belongs, such as a queue number, etc. The queue identifiers (qids) of the tasks in the same queue are the same. If the queue size is 1 thousand (K), the bit width of the qid can be 10 bits.
[0065] For example, the task identifier can be the identifier information allocated to each task by the task allocation unit after the task is input into the chip. The task identifiers of different tasks are different before the tasks are output. If the maximum parallel number is 1k, the bit width of the task identifier can be 10 bits.
[0066] In some embodiments, the information of the to-be-processed task can include the queue identifier of the to-be-processed task and the task data of the to-be-processed task. Correspondingly, the processing request of the to-be-processed task can include the task identifier, the queue identifier and the task data. The order preserving request can include the queue identifier of the target queue.
[0067] S102, querying the key position pointer table in the order preserving linked list unit according to the queue identifier, and updating the key position pointer table corresponding to the target queue by using the task identifier.
[0068] Wherein, the key position pointer table includes a head task pointer of the target queue at the current time, a tail task pointer of the target queue at the current time, and a successor task pointer of the head task of the target queue, the successor task pointer being used to indicate a successor task of the target queue, the successor task being the next task of the head task at the current time.
[0069] In some embodiments, the in-order output unit can read the key position pointer table with the queue identifier as the address, determine the head task pointer, the tail task pointer, the successor task pointer and the validity flag of the target queue in the key position pointer table at the current time, and then update the key position pointer table of the target queue according to the head task pointer, the tail task pointer, the successor task pointer and the validity flag of the target queue at the current time.
[0070] In some embodiments, the in-order output unit can read the key position pointer table with the queue identifier as the address, determine the head task pointer, the tail task pointer, the successor task pointer and the validity flag of the target queue in the key position pointer table at the current time, and then update the key position pointer table of the target queue according to the head task pointer, the tail task pointer, the successor task pointer and the validity flag of the target queue at the current time.
[0071] In some embodiments, in the case where the validity flag information in the key position pointer table is the second value, the head task pointer, the successor task pointer and the tail task pointer are all updated to the task identifier indicating the to-be-processed task, and the value of the validity flag information is updated from the second value to the first value.
[0072] The first value can be 1, and the second value can be 0.
[0073] For example, in the case where the validity flag information valid of the target queue in the key position pointer table is 0, it is determined that the target queue is currently empty and the to-be-processed task is the first enqueued task of the target queue. The in-order output unit can set head = second, second = tail and tail = task id, and update valid from 0 to 1, so as to refresh the key position pointer table. In this case, the successor task table is not updated. The task id is the task identifier of the to-be-processed task, the head is the head task pointer, the second is the successor task pointer, and the tail is the tail task pointer.
[0074] In some embodiments, in the case where the validity flag information in the key position pointer table is the first value, the key position pointer table is updated according to the identifiers of the tasks indicated by the head task pointer, the successor task pointer and the tail task pointer at the current time.
[0075] In the case where the identifiers of the tasks indicated by the head task pointer and the successor task pointer at the current time are the same, the identifiers of the tasks indicated by the successor task pointer and the tail task pointer are updated to the task identifier of the to-be-processed task.
[0076] Exemplarily, in the case that the valid in the key position pointer table is 1, it is determined that the target queue is currently not empty. At this time, if the head is not equal to the second and the second is equal to the tail, it is determined that there are two tasks to be dequeued in the target queue currently. The tail is equal to the task id, and other values are unchanged, so as to refresh the key position pointer table. In the successor task table, the task id is written with the tail as the address.
[0077] In the case that the task identifiers indicated by the head task pointer and the successor task pointer are different at the current time, the task identifier indicated by the tail task pointer is updated to the task identifier of the task to be processed.
[0078] Exemplarily, in the case that the valid in the key position pointer table is 1, it is determined that the target queue is currently not empty. At this time, if the head is not equal to the second and the second is equal to the tail, it is determined that there are two tasks to be dequeued in the target queue currently. The tail is equal to the task id, and other values are unchanged, so as to refresh the key position pointer table. In the successor task table, the task id is written with the tail as the address.
[0079] Exemplarily, in the case that the valid in the key position pointer table is 1, it is determined that the target queue is currently not empty. At this time, if the head is not equal to the second and the second is equal to the tail, it is determined that there are two tasks to be dequeued in the target queue currently. The tail is equal to the task id, and other values are unchanged, so as to refresh the key position pointer table. In the successor task table, the task id is written with the tail as the address.
[0080] S103, processing the task to be processed by the parallel task processor, and outputting a linked list dequeuing request of the task to be processed.
[0081] The linked list dequeuing request includes the task identifier and the queue identifier of the task to be processed.
[0082] Exemplarily, the queue identifier can be the identifier of the target queue to which the task to be processed belongs, which can be, for example, a queue number, and the queue identifiers (qids) of tasks in the same queue are the same. If the queue size is 1k, the bit width of the qid can be 10 bits.
[0083] Exemplarily, the task identifier can be the identifier information allocated to each task by the task allocation unit after the task is input into the chip, and the task identifiers of different tasks are different before the tasks are output. If the maximum parallel number is 1k, the bit width of the task identifier can be 10 bits.
[0084] It should be understood that, in order to accelerate the processing of certain tasks, the related tasks of the service can be processed synchronously using a large number of parallel processor threads, and the related tasks of the same service are marked in the same queue by using a queue identifier, and the related tasks in the same queue enter the chip in a sequence, that is, the order of the queue is output in sequence.
[0085] After the exemplary parallel task processor finishes processing the to-be-processed task, the to-be-processed task is not directly stored in the task waiting table, but a linked list dequeuing request of the to-be-processed task is first sent to the in-sequence output unit, so as to determine whether the to-be-processed task is allowed to be dequeued (the to-be-processed task is at the head of the target queue), and then the to-be-processed task is output in sequence.
[0086] In other embodiments, the linked list dequeuing request described above can further include processing result data of the to-be-processed task after the to-be-processed task is processed, so that the processing result data of the to-be-processed task is sent to the subsequent task processing node synchronously when the to-be-processed task is dequeued.
[0087] S104, reading the key position pointer table corresponding to the in-sequence linked list of the target queue according to the queue identifier.
[0088] In this step, when the in-sequence output unit receives the linked list dequeuing request of the to-be-processed task sent by the parallel task processor, the key position pointer table corresponding to the in-sequence linked list of the target queue can be read according to the queue identifier.
[0089] It should be understood that the embodiments of the present application do not limit how to read the key position pointer table corresponding to the in-sequence linked list of the target queue according to the queue identifier. In some embodiments, the in-sequence output unit can read the key position pointer table corresponding to the in-sequence linked list of the target queue by using the queue identifier as an address.
[0090] In some embodiments, the key position pointer table described above is used to record the key position pointer corresponding to the in-sequence linked list of the target queue. Exemplarily, the key position pointer table includes a head task pointer, a tail task pointer, and a second task pointer of the head task of the target queue at the current time.
[0091] The head task pointer is used to indicate the head task of the target queue, the tail task pointer is used to indicate the tail task of the target queue, and the second task is the next task of the head task at the current time.
[0092] In some embodiments, the key position pointer table further comprises validity flag information (valid) indicating whether the corresponding in-order linked list is empty. For example, the validity flag information has a first value and a second value. The first value indicates that there is a task to be dequeued in the in-order linked list, and the second value indicates that the in-order linked list is empty. The first value can be 1, and the second value can be 0.
[0093] It should be understood that if the validity flag information in the key position pointer table is the second value, it means that the in-order linked list is empty, and there is no task to be dequeued in the target queue. However, if the in-order output unit receives a linked list dequeuing request of a task to be processed, it means that the task to be processed is in the target queue, which is a software error. Therefore, when the in-order output unit receives a linked list dequeuing request of a task to be processed, the validity flag information in the in-order linked list of the target queue is the first value.
[0094] S105, determining the linked list dequeuing result of the task to be processed according to the head task pointer, the tail task pointer, the successor task pointer, and the task identifier of the task to be processed.
[0095] In this step, after the in-order output unit reads the key position pointer table corresponding to the in-order linked list of the target queue, the linked list dequeuing result of the task to be processed can be determined according to the head task pointer, the tail task pointer, the successor task pointer, and the task identifier of the task to be processed.
[0096] In some embodiments, when the task identifiers indicated by the head task pointer, the tail task pointer, and the successor task pointer are the same at the current time, the in-order output unit determines that the linked list dequeuing result of the task to be processed is allowed to be dequeued.
[0097] For example, the valid in the in-order linked list of the target queue is 1 when receiving the linked list dequeuing request of the task to be processed. At this time, if the head of the in-order linked list of the target queue is equal to the second and the second is equal to the tail, it means that there is one task in the target queue. Therefore, the head must be equal to the task identifier (task id) of the task to be processed, and the task to be processed is located at the head of the target queue. Therefore, the linked list dequeuing result of the task to be processed is allowed to be dequeued.
[0098] In some embodiments, when the task identifiers indicated by the head task pointer, the tail task pointer, and the successor task pointer are not the same at the current time, the linked list dequeuing result of the task to be processed is determined according to the head task pointer and the task identifier of the task to be processed.
[0099] That is, in the case that the task identifiers indicated by the head task pointer, the tail task pointer and the successor task pointer are not all the same at the current time, the list dequeuing result of the to-be-processed task is determined by comparing whether the task identifier indicated by the head task pointer and the task identifier of the to-be-processed task are the same.
[0100] For example, in the case that the task identifier indicated by the head task pointer and the task identifier of the to-be-processed task are the same, the list dequeuing result of the to-be-processed task is that the dequeuing is allowed, and in the case that the task identifier indicated by the head task pointer and the task identifier of the to-be-processed task are not the same, the list dequeuing result of the to-be-processed task is that the dequeuing is not allowed.
[0101] For example, in the case that the valid in the in-order list of the target queue is 1 after receiving the list dequeuing request of the to-be-processed task, if head≠second and second=tail in the in-order list of the target queue, it indicates that there are two tasks in the target queue at present, and then the list dequeuing result of the to-be-processed task can be determined by determining whether the task identifier indicated by the head is the task identifier of the to-be-processed task. If the task identifier indicated by the head is the task identifier of the to-be-processed task, the list dequeuing result is that the dequeuing is allowed, and if the task identifier indicated by the head is not the task identifier of the to-be-processed task, the list dequeuing result is that the dequeuing is not allowed.
[0102] For example, in the case that the valid in the in-order list of the target queue is 1 after receiving the list dequeuing request of the to-be-processed task, if head≠second and second≠tail in the in-order list of the target queue, it indicates that there are more than two tasks in the target queue at present, and then the list dequeuing result of the to-be-processed task can be determined by determining whether the task identifier indicated by the head is the task identifier of the to-be-processed task. If the task identifier indicated by the head is the task identifier of the to-be-processed task, the list dequeuing result is that the dequeuing is allowed, and if the task identifier indicated by the head is not the task identifier of the to-be-processed task, the list dequeuing result is that the dequeuing is not allowed.
[0103] S106, in the case that the list dequeuing result is that the dequeuing is allowed, instructing to output the to-be-processed task and refreshing the key position pointer table.
[0104] In this step, after the in-order output unit determines the list dequeuing result of the to-be-processed task, in the case that the list dequeuing result is that the dequeuing is allowed, the in-order output unit can instruct to output the to-be-processed task and refresh the key position pointer table.
[0105] In some embodiments, after determining the list dequeuing result of the to-be-processed task, in the case that the list dequeuing result is that the dequeuing is not allowed, the in-order output unit can store the processing result data of the to-be-processed task in the task waiting table and add the validity mark of the to-be-processed task by taking the task identifier of the to-be-processed task as the address.
[0106] It should be understood that the embodiments of the present application do not limit how to refresh the key position pointer table, and in some embodiments, the key position pointer table can be refreshed based on the head task pointer, the tail task pointer, the successor task pointer and the task identifier of the pending task.
[0107] In some embodiments, in the case that the task identifiers indicated by the head task pointer, the tail task pointer and the successor task pointer are the same at the current time, the validity flag information in the key position pointer table can be refreshed from the first value to the second value.
[0108] Wherein, the validity flag information represents that there is a pending task in the in-order linked list when the first value is taken, and the validity flag information represents that the in-order linked list is empty when the second value is taken.
[0109] For example, in the case that the in-order linked list of the target queue receives a pending task dequeuing request, the valid in the in-order linked list of the target queue is 1, at this time, if the head = second and the second = tail in the in-order linked list of the target queue, it means that the target queue currently has one task, then the head must be equal to the task identifier of the pending task, and the in-order linked list of the pending task is allowed to be dequeued. Subsequently, the pending task is dequeued, and the valid can be refreshed from 1 to 0, so as to refresh the key position pointer table.
[0110] In some embodiments, in the case that the task identifiers indicated by the head task pointer and the successor task pointer are different at the current time, and the task identifiers indicated by the successor task pointer and the tail task pointer are the same at the current time, if the in-order linked list of the pending task is allowed to be dequeued, the task identifier indicated by the head task pointer can be updated to the task identifier indicated by the successor task pointer in the key position pointer table.
[0111] For example, in the case that the in-order linked list of the target queue receives a pending task dequeuing request, the valid in the in-order linked list of the target queue is 1, at this time, if the head ≠ second and the second = tail in the in-order linked list of the target queue, it means that the target queue currently has two tasks. Correspondingly, when the head is equal to the task identifier of the pending task, it is determined that the in-order linked list of the pending task is allowed to be dequeued, and then the pending task is dequeued, and the head task pointer is refreshed to head = second and second = tail, so as to refresh the key position pointer table. In addition, when the head is not equal to the task identifier of the pending task, it is determined that the in-order linked list of the pending task is not allowed to be dequeued, and then the task waiting table is refreshed with the task identifier of the pending task as the address, the processing result data of the pending task is stored, the valid flag of the pending task in the task waiting table is set to 1, and the pending task can be dequeued when it becomes the head of the queue.
[0112] In some embodiments, if the task identifiers indicated by the head task pointer, the second task pointer and the tail task pointer are all different, and if the result of the list dequeue operation is allowed, the next task of the second task can be determined by reading the second task table corresponding to the in-order list of the target queue. Then, in the key position pointer table, the task identifier indicated by the head task pointer is updated to the task identifier indicated by the second task pointer, and the task identifier indicated by the second task pointer is updated to the task identifier of the next task of the second task.
[0113] For example, if the valid in the in-order list of the target queue is 1 when the list dequeue request of the task to be processed is received, and if the head ≠ second and the second ≠ tail in the in-order list of the target queue, it indicates that there are more than two tasks in the target queue. Accordingly, if the head is equal to the task identifier of the task to be processed, it is determined that the result of the list dequeue operation is allowed, and then the task to be processed is dequeued, and the first task NT(head) in the second task table (NT) is obtained as the task identifier of the next task of the second task. In the next beat, the head = second and the second = NT(head) are refreshed to update the key position pointer table. In addition, if the head is not equal to the task identifier of the task to be processed, it is determined that the result of the list dequeue operation is not allowed, and then the task waiting table is refreshed with the task identifier of the task to be processed as the address, the processing result data of the task to be processed is stored, and the valid of the task to be processed in the task waiting table is marked as 1. The task to be processed can be dequeued only when it becomes the head of the queue.
[0114] In other embodiments, if there are at least two tasks in the current in-order list, the in-order output unit queries the second task in the task waiting table according to the task identifier indicated by the second task pointer when the result of the list dequeue operation is allowed. Then, the second task is executed by the dequeue loopback operation, and the valid of the second task in the task waiting table is cleared.
[0115] For example, if the head ≠ second and the second = tail or the head ≠ second and the second ≠ tail, it indicates that there are at least two tasks in the target queue. When the in-order output unit determines that the result of the list dequeue operation is allowed, the second task in the task waiting table can be queried with the second as the address. If the second task is found, the second task is executed by the dequeue loopback operation, and the valid of the second task in the task waiting table is cleared.
[0116] In the present application, the key position pointer table includes not only the head task pointer and the tail task pointer, but also the successor task pointer, so that the large-scale queue order preservation can be realized through the loopback strategy, and the continuous enqueuing or the continuous dequeuing between different queues can be realized.
[0117] In some embodiments, the order-preserving output unit can clear the valid flag of the successor task in the task waiting table and recycle the task identifier resource of the successor task to the task allocation unit while performing the dequeuing loopback operation on the successor task.
[0118] It should be noted that the key position pointer table, the successor task table and the task waiting table can be built by using a static random-access memory (SRAM), and the SRAM read delay is appropriately adjusted, and the pipeline conflict is paid attention to, so that the processing capability of thousands (K) or even tens of K queues can be realized.
[0119] The task order-preserving output method provided in the embodiments of the present application optimizes the linked list storage structure, realizes the judgment on whether the current to-be-processed task and the successor task are allowed to be dequeued through the key position pointer table, the successor task table and the task waiting table, so as to simplify the pipeline stage number and reduce the pipeline conflict. Therefore, the task order-preserving output method provided in the embodiments of the present application can support the order-preserving output of a large number of queues, significantly improves the processing capability of large-scale concurrent tasks, realizes efficient queue state management and task result query, and ensures the fast and accurate task allocation, execution and output process.
[0120] The task order preserving output method provided by the embodiments of the present application receives a linked list dequeue request of a to-be-processed task sent by a parallel task processor, receives information of the to-be-processed task, allocates a task identifier to the to-be-processed task, the information of the to-be-processed task includes a queue identifier of a target queue to which the to-be-processed task belongs and to-be-processed target data corresponding to the to-be-processed task; a key position pointer table in an order preserving linked list unit is queried according to the queue identifier, and the key position pointer table corresponding to the target queue is updated by using the task identifier, wherein the key position pointer table includes a head task pointer of the target queue at a current time, a tail task pointer of the target queue and a successor task pointer of the head task, the successor task pointer is used to indicate a successor task of the target queue, and the successor task is a next task of the head task at the current time; the to-be-processed task is processed by the parallel task processor, and a linked list dequeue request of the to-be-processed task is output, the linked list dequeue request includes the task identifier and the queue identifier of the to-be-processed task; the key position pointer table corresponding to the target queue is read according to the queue identifier, and the linked list dequeue result of the to-be-processed task is determined according to the head task pointer, the tail task pointer, the successor task pointer and the task identifier of the to-be-processed task; in the case that the linked list dequeue result is to allow dequeue, the to-be-processed task is instructed to be output and the key position pointer table is refreshed. Since the head task pointer, the tail task pointer, the successor task pointer in the key position pointer table corresponding to the order preserving linked list of the target queue and the task identifier of the to-be-processed task are used to determine whether the to-be-processed task currently processed is allowed to be dequeued in the corresponding target queue, it is not necessary to synchronize with other queues to confirm whether the head task is allowed to be dequeued, thereby reducing the combination logic of the number of queues and the cache depth of the task waiting table, it is not necessary for multiple queues to use one order preserving queue to reduce the timing and wiring pressure, and the task processing performance is improved.
[0121] Figure 2 The flowchart of another task order preserving output method provided by the embodiments of the present application is shown as Figure 2 S201 to S210.
[0122] S201, information of a to-be-processed task is received, and a task identifier is allocated to the to-be-processed task.
[0123] The information of the to-be-processed task includes a queue identifier of a target queue to which the to-be-processed task belongs and to-be-processed target data corresponding to the to-be-processed task.
[0124] S202, a key position pointer table in an order preserving linked list unit is queried according to the queue identifier, and the key position pointer table corresponding to the target queue is updated by using the task identifier.
[0125] The key position pointer table includes a head task pointer, a tail task pointer and a successor task pointer of the head task of the target queue at the current time, and the successor task pointer is used for indicating a successor task of the target queue, and the successor task is a next task of the head task at the current time.
[0126] S203, processing the to-be-processed task by the parallel task processor and outputting a linked list dequeue request of the to-be-processed task.
[0127] The linked list dequeue request includes a task identifier and a queue identifier of the to-be-processed task.
[0128] S204, reading a key position pointer table corresponding to a preservation order linked list of the target queue according to the queue identifier.
[0129] The key position pointer table includes a head task pointer, a tail task pointer and a successor task pointer of the head task of the target queue at the current time, and the successor task pointer is used for indicating a successor task of the target queue, and the successor task is a next task of the head task at the current time.
[0130] S205, determining a linked list dequeue result of the to-be-processed task according to the head task pointer, the tail task pointer, the successor task pointer and the task identifier of the to-be-processed task.
[0131] S206, determining whether the linked list dequeue result is allowed to be dequeued.
[0132] If yes, S207 is executed, and if no, S210 is executed.
[0133] S207, indicating to output the to-be-processed task and refreshing the key position pointer table.
[0134] S208, querying the successor task in a task waiting table according to a task identifier indicated by the successor task pointer.
[0135] S209, performing a dequeue loop operation on the successor task queried in the task waiting table and clearing a validity mark of the successor task in the task waiting table.
[0136] S210, storing processing result data of the to-be-processed task and adding a validity mark of the to-be-processed task in the task waiting table by taking the task identifier of the to-be-processed task as an address.
[0137] Figure 3 A principle diagram of task preservation order output provided by the embodiment is shown in FIG. 1. Figure 3 The chip includes a task allocation unit, a parallel processor and a preservation order output unit.
[0138] After the chip receives the information of the to-be-processed task, the chip can trigger the task allocation unit of the chip to apply for allocating a task identifier for the to-be-processed task. After the to-be-processed task obtains the task identifier, the task allocation unit can send a processing request of the to-be-processed task to the parallel processor and send a sequential request of the to-be-processed task to the sequential output unit. Correspondingly, the sequential output unit queries the key position pointer table in the sequential linked list unit according to the queue identifier, and updates the key position pointer table corresponding to the target queue by using the task identifier. The parallel processor processes the task data of the to-be-processed task.
[0139] Subsequently, the parallel processor outputs a linked list dequeuing request of the to-be-processed task to the sequential output unit, and the linked list dequeuing request includes the task identifier and the queue identifier of the to-be-processed task. The sequential output unit reads the key position pointer table corresponding to the sequential linked list of the target queue according to the queue identifier, and determines the linked list dequeuing result of the to-be-processed task according to the head task pointer, the tail task pointer, the successor task pointer in the key position pointer table and the task identifier of the to-be-processed task.
[0140] In the case that the linked list dequeuing result is allowed to be dequeued, the sequential output unit indicates to output the to-be-processed task and flushes the key position pointer table, queries the successor task in the task waiting table according to the task identifier indicated by the successor task pointer, executes the dequeuing loop operation on the successor task queried in the task waiting table and clears the validity mark of the successor task in the task waiting table.
[0141] In the case that the linked list dequeuing result is not allowed to be dequeued, the sequential output unit takes the task identifier of the to-be-processed task as an address, stores the processing result data of the to-be-processed task in the task waiting table and adds the validity mark of the to-be-processed task.
[0142] The task order preserving output method provided by the embodiments of the present application receives a linked list dequeue request of a to-be-processed task sent by a parallel task processor, receives information of the to-be-processed task, allocates a task identifier to the to-be-processed task, the information of the to-be-processed task includes a queue identifier of a target queue to which the to-be-processed task belongs and to-be-processed target data corresponding to the to-be-processed task; a key position pointer table in an order preserving linked list unit is queried according to the queue identifier, and a key position pointer table corresponding to the target queue is updated by using the task identifier, wherein the key position pointer table includes a head task pointer of the target queue at a current time, a tail task pointer of the target queue and a successor task pointer of the head task, the successor task pointer is used to indicate a successor task of the target queue, and the successor task is a next task of the head task at the current time; the to-be-processed task is processed by the parallel task processor, and a linked list dequeue request of the to-be-processed task is output, the linked list dequeue request includes the task identifier and the queue identifier of the to-be-processed task; the key position pointer table corresponding to the target queue is read according to the queue identifier, and the linked list dequeue result of the to-be-processed task is determined according to the head task pointer, the tail task pointer, the successor task pointer and the task identifier of the to-be-processed task; in the case that the linked list dequeue result is to allow dequeue, the to-be-processed task is instructed to be output and the key position pointer table is refreshed. Since the head task pointer, the tail task pointer, the successor task pointer in the key position pointer table corresponding to the order preserving linked list of the target queue and the task identifier of the to-be-processed task are used to determine whether the to-be-processed task currently processed is allowed to be dequeued in the corresponding target queue, it is not necessary to synchronize with other queues to confirm whether the head task is allowed to be dequeued, thereby reducing the combination logic of the number of queues and the cache depth of the task waiting table, it is not necessary for multiple queues to use one order preserving queue to reduce the timing and wiring pressure, and the task processing performance is improved.
[0143] It should be understood that, although each step in the flowchart involved in the above embodiments is shown in sequence according to the arrow, these steps are not necessarily executed in sequence according to the arrow. Unless otherwise specified herein, the execution of these steps is not strictly limited in sequence, and these steps can be executed in other sequences. Moreover, at least part of the steps in the flowchart involved in the above embodiments can include multiple steps or stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution sequence of these steps or stages is not necessarily sequential, but can be executed in rotation or alternation with at least part of other steps or steps or stages in other steps.
[0144] Based on the same inventive concept, the embodiments of the present application also provide a task order preserving output device for implementing the above-mentioned task order preserving output method. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme described in the above-mentioned method, and therefore the specific limitations in one or more task order preserving output device embodiments provided below can refer to the limitations of the task order preserving output method described above, which will not be described here again.
[0145] In one exemplary embodiment, as shown in Figure 4 A task order preserving output device 300 is provided, comprising a receiving module 301, an order preserving module 302, a processing module 303 and an output module 304, wherein:
[0146] The receiving module 301 is configured to receive information of a to-be-processed task, and assign a task identifier to the to-be-processed task, wherein the information of the to-be-processed task comprises a queue identifier of a target queue to which the to-be-processed task belongs and to-be-processed target data corresponding to the to-be-processed task.
[0147] The order preserving module 302 is configured to query a key position pointer table in an order preserving linked list unit according to the queue identifier, and update the key position pointer table corresponding to the target queue by using the task identifier, wherein the key position pointer table comprises a head task pointer, a tail task pointer and a successor task pointer of the head task of the target queue at the current time, and the successor task pointer is used to indicate a successor task of the target queue, wherein the successor task is a next task of the head task at the current time.
[0148] The processing module 303 is configured to process the to-be-processed task by using a parallel task processor, and output a linked list dequeue request of the to-be-processed task, wherein the linked list dequeue request comprises the task identifier and the queue identifier of the to-be-processed task.
[0149] The output module 304 is configured to read the key position pointer table corresponding to the target queue according to the queue identifier, determine a linked list dequeue result of the to-be-processed task according to the head task pointer, the tail task pointer, the successor task pointer and the task identifier of the to-be-processed task, and in the case that the linked list dequeue result is a dequeue permission, instruct to output the to-be-processed task and flush the key position pointer table.
[0150] In one embodiment, the output module 304 is further configured to determine that the linked list dequeue result of the to-be-processed task is the dequeue permission in the case that the task identifiers indicated by the head task pointer, the tail task pointer and the successor task pointer at the current time are the same, and determine the linked list dequeue result of the to-be-processed task according to the head task pointer and the task identifier of the to-be-processed task in the case that the task identifiers indicated by the head task pointer, the tail task pointer and the successor task pointer at the current time are not completely the same.
[0151] In one of the embodiments, when the task identifiers indicated by the head task pointer, the tail task pointer and the successor task pointer are the same at the current time, the output module 304 is further configured to update the validity flag information in the key position pointer table from the first value to a second value, the first value of the validity flag information indicating that there is a task to be dequeued in the ordered linked list, and the second value of the validity flag information indicating that the ordered linked list is empty.
[0152] In one of the embodiments, when the task identifiers indicated by the head task pointer and the successor task pointer are different at the current time and the task identifiers indicated by the successor task pointer and the tail task pointer are the same at the current time, the output module 304 is further configured to update, in the key position pointer table, the task identifier indicated by the head task pointer to the task identifier indicated by the successor task pointer.
[0153] In one of the embodiments, when the task identifiers indicated by the head task pointer, the successor task pointer and the tail task pointer are all different at the current time, the output module 304 is further configured to read a successor task table corresponding to the ordered linked list of the target queue, determine the task identifier of the next task of the successor task in the target queue, update, in the key position pointer table, the task identifier indicated by the head task pointer to the task identifier indicated by the successor task pointer, and update the task identifier indicated by the successor task pointer to the task identifier of the next task of the successor task.
[0154] In one of the embodiments, when the result of the linked list dequeuing is to allow the task to be dequeued, the output module 304 is further configured to query the successor task in the task waiting table according to the task identifier indicated by the successor task pointer, where the task waiting table stores the information of the task to be dequeued; perform a dequeuing loop operation on the successor task queried in the task waiting table; and clear the validity flag of the successor task in the task waiting table.
[0155] In one of the embodiments, when the result of the linked list dequeuing is to not allow the task to be dequeued, the output module 304 is further configured to store the processing result data of the task to be processed in the task waiting table and add the validity flag of the task to be processed, with the task identifier of the task to be processed as the address.
[0156] In one of the embodiments, when the validity flag information in the key position pointer table is the second value, the ordered module 302 is further configured to update the head task pointer, the successor task pointer and the tail task pointer to indicate the task identifier of the task to be processed, and update the value of the validity flag information from the second value to the first value; and when the validity flag information in the key position pointer table is the first value, update the key position pointer table according to the task identifiers indicated by the head task pointer, the successor task pointer and the tail task pointer at the current time.
[0157] In one of the embodiments, the order-preserving module 302 is further configured to, in a case where the task identifiers indicated by the head task pointer and the successor task pointer are the same at the current time, update the task identifiers indicated by the successor task pointer and the tail task pointer to the task identifier of the task to be processed; and in a case where the task identifiers indicated by the head task pointer and the successor task pointer are different at the current time, update the task identifier indicated by the tail task pointer to the task identifier of the task to be processed.
[0158] The modules in the task order-preserving output apparatus can be implemented by software, hardware, or a combination thereof. The modules can be embedded in or independent of a processor in a computer device in hardware form, or stored in a memory in a computer device in software form, so as to be called and executed by a processor to perform operations corresponding to the modules.
[0159] In one example embodiment, a chip is provided, and an internal structure diagram of the chip can be as shown in Figure 5 The chip includes a processor, a memory, an input / output interface (I / O), and a communication interface. The processor, the memory, and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the chip is configured to provide computing and control capabilities. The memory of the chip includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for running the operating system and the computer program in the non-volatile storage medium. The database of the chip is configured to store data. The input / output interface of the chip is configured to exchange information between the processor and external devices. The communication interface of the chip is configured to communicate with external terminals through a network connection. The computer program is executed by the processor to implement a task order-preserving output method.
[0160] Those skilled in the art can understand that Figure 5 The structure shown in the figure is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. Specifically, the computer device can include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0161] In one example embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the task order-preserving output method.
[0162] In one embodiment, a computer readable storage medium is provided, and the computer readable storage medium stores a computer program. The computer program is executed by a processor to implement the task order-preserving output method.
[0163] In one embodiment, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the above-mentioned task-preserving output method.
[0164] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer readable storage medium. When the computer program is executed, it can include the processes of the above-mentioned embodiment methods. Any reference to memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. The non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical storage, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. The volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration but not limitation, the RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The database involved in the embodiments provided in the present application can include at least one of a relational database and a non-relational database. The non-relational database can include a distributed database based on a block chain, etc., without being limited thereto. The processor involved in the embodiments provided in the present application can be a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., without being limited thereto.
[0165] The technical features of the above embodiments can be combined in any manner. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as the combinations of the technical features do not contradict each other, they should be considered as falling within the scope of the present application.
[0166] The above embodiments only express several implementation ways of the present application, and the description is more specific and detailed, but it should not be understood as a limitation to the patent scope of the present application. It should be pointed out that for ordinary skilled in the art, without departing from the concept of the present application, several modifications and improvements can be made, which all belong to the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the appended claims.
Claims
1. A task order preserving output method, characterized by, The method comprises: receiving information of a to-be-processed task, and allocating a task identifier to the to-be-processed task, wherein the information of the to-be-processed task comprises a queue identifier of a target queue to which the to-be-processed task belongs and target data corresponding to the to-be-processed task; querying a key position pointer table in a preservation order linked list unit according to the queue identifier, and updating a key position pointer table corresponding to the target queue by using the task identifier, wherein the key position pointer table comprises a head task pointer, a tail task pointer and a successor task pointer of a head task of the target queue at a current time, and the successor task pointer is used to indicate a successor task of the target queue, and the successor task is a next task of the head task at the current time; processing the to-be-processed task by using a parallel task processor, and outputting a linked list dequeue request of the to-be-processed task, wherein the linked list dequeue request comprises the task identifier and the queue identifier of the to-be-processed task; reading the key position pointer table corresponding to the target queue according to the queue identifier, and determining a linked list dequeue result of the to-be-processed task according to the head task pointer, the tail task pointer, the successor task pointer and the task identifier of the to-be-processed task; in a case where the linked list dequeue result is allowed to be dequeued, instructing to output the to-be-processed task and updating the key position pointer table.
2. The method of claim 1, wherein, The determining the linked list dequeue result of the to-be-processed task according to the head task pointer, the tail task pointer, the successor task pointer and the task identifier of the to-be-processed task comprises: in a case where the task identifiers indicated by the head task pointer, the tail task pointer and the successor task pointer at the current time are the same, determining that the linked list dequeue result of the to-be-processed task is allowed to be dequeued; in a case where the task identifiers indicated by the head task pointer, the tail task pointer and the successor task pointer at the current time are not completely the same, determining the linked list dequeue result of the to-be-processed task according to the head task pointer and the task identifier of the to-be-processed task.
3. The method of claim 2, wherein, In the case where the task identifiers indicated by the head task pointer, the tail task pointer and the successor task pointer at the current time are the same, the updating the key position pointer table comprises: updating validity mark information in the key position pointer table from a first value to a second value, wherein the validity mark information represents that there is a to-be-dequeued task in the preservation order linked list when the validity mark information is in the first value, and the validity mark information represents that the preservation order linked list is empty when the validity mark information is in the second value.
4. The method of claim 2, wherein, in a case where the task identifiers indicated by the head task pointer and the successor task pointer at the current time are different, the task identifiers indicated by the successor task pointer and the tail task pointer at the current time are the same, and the task identifier of the to-be-processed task is the same as the head task pointer, the to-be-processed task is allowed to be dequeued; the updating the key position pointer table comprises: updating the task identifier indicated by the head task pointer to the task identifier indicated by the successor task pointer in the key position pointer table.
5. The method of claim 2, wherein, In a case where the task identifiers indicated by the head task pointer, the next task pointer and the tail task pointer are all different and the task identifier of the head task pointer is the same as the task identifier of the to-be-processed task, the to-be-processed task is allowed to be dequeued; The refreshing the key position pointer table comprises: reading a next task table corresponding to the in-order linked list of the target queue to determine a task identifier of a next task of the next task in the target queue; in the key position pointer table, updating the task identifier indicated by the head task pointer to the task identifier indicated by the next task pointer, and updating the task identifier indicated by the next task pointer to the task identifier of the next task of the next task.
6. The method of claim 1, wherein, After the indication of outputting the to-be-processed task and refreshing the key position pointer table, the method further comprises: in a case where the linked list dequeuing result is to allow dequeuing, querying the next task in a task waiting table according to the task identifier indicated by the next task pointer, wherein the task waiting table stores to-be-dequeued task information; performing a dequeuing loopback operation on the next task queried in the task waiting table; clearing a validity flag of the next task in the task waiting table.
7. The method of claim 1, wherein, After the determination of the linked list dequeuing result of the to-be-processed task, the method further comprises: in a case where the linked list dequeuing result is to not allow dequeuing, storing processing result data of the to-be-processed task and adding a validity flag of the to-be-processed task in a task waiting table with the task identifier of the to-be-processed task as an address.
8. The method of claim 1, wherein, The updating the key position pointer table corresponding to the target queue with the task identifier comprises: in a case where the validity flag information in the key position pointer table is a second value, updating the head task pointer, the next task pointer and the tail task pointer to indicate the task identifier of the to-be-processed task and updating the value of the validity flag information from the second value to a first value; in a case where the validity flag information in the key position pointer table is a first value, updating the key position pointer table according to the task identifiers indicated by the head task pointer, the next task pointer and the tail task pointer at the current time.
9. The method of claim 1, wherein, The updating the key position pointer table according to the task identifiers indicated by the head task pointer, the next task pointer and the tail task pointer at the current time comprises: in a case where the task identifiers indicated by the head task pointer and the next task pointer at the current time are the same, updating the task identifiers indicated by the next task pointer and the tail task pointer to the task identifier of the to-be-processed task; in a case where the task identifiers indicated by the head task pointer and the next task pointer at the current time are different, updating the task identifier indicated by the tail task pointer to the task identifier of the to-be-processed task.
10. A task ordering output device, characterized by The apparatus comprises: The receiving module is configured to receive information of a to-be-processed task, and assign a task identifier to the to-be-processed task, wherein the information of the to-be-processed task comprises a queue identifier of a target queue to which the to-be-processed task belongs and to-be-processed target data corresponding to the to-be-processed task; The order preserving module is configured to query a key position pointer table in an order preserving linked list unit according to the queue identifier, and update a key position pointer table corresponding to the target queue by using the task identifier, wherein the key position pointer table comprises a head task pointer, a tail task pointer and a successor task pointer of a head task of the target queue at a current time, and the successor task pointer is used to indicate a successor task of the target queue, and the successor task is a next task of the head task at the current time; The processing module is configured to process the to-be-processed task by using a parallel task processor, and output a linked list dequeue request of the to-be-processed task, wherein the linked list dequeue request comprises the task identifier and the queue identifier of the to-be-processed task; The output module is configured to read the key position pointer table corresponding to the target queue according to the queue identifier, determine a linked list dequeue result of the to-be-processed task according to the head task pointer, the tail task pointer, the successor task pointer and the task identifier of the to-be-processed task, and instruct to output the to-be-processed task and update the key position pointer table in a case that the linked list dequeue result is a dequeue permission.
11. A chip comprising a memory and a processor, the memory storing a computer program, characterized in that, The processor executes the computer program to implement the steps of the method in any one of claims 1 to 9.
12. A computer readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the method in any one of claims 1 to 9.
13. A computer program product comprising a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the method in any one of claims 1 to 9.
Citation Information
Patent Citations
Task processing method and device, electronic equipment and storage medium
CN115391041A