IP Library › Granted Patent US 11,422,817
Granted Patent B2
US 11,422,817 · App. 16/458,381 · Granted Aug 23, 2022

Method and apparatus for executing instructions including a blocking instruction generated in response to determining that there is data dependence between instructions

Inventors: Jing Wang (Beijing, CN); Wei Qi (Beijing, CN); Yupeng Li (Beijing, CN); Xiaozhang Gong (Beijing, CN)
Assignee: Kunlunxin Technology (Beijing) Company Limited
G06F9/3836
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 11,422,817
App. No.
16/458,381
Granted
Aug 23, 2022
Kind
B2
Abstract

A method and apparatus for executing an instruction are provided. In the method, an instruction queue is first generated, and an instruction from the instruction queue in preset order is acquired. Then, a sending step including: determining a type of the acquired instruction; determining, in response to determining that the acquired instruction is an arithmetic instruction, an executing component for executing the arithmetic instruction from an executing component set; and sending the arithmetic instruction to the determined executing component is executed. Last, in response to determining that the acquired instruction is a blocking instruction, a next instruction is acquired after receiving a signal for instructing an instruction associated with the blocking instruction being completely executed.

Claims (67)

1. A method for executing instructions in an instruction queue, the instruction queue being generated from a computing task by a processor, the method comprising:

generating instructions to form the instruction queue;

acquiring an instruction from the instruction queue in preset order, and executing a sending step comprising: determining a type of the acquired instruction; in response to determining that the type of the acquired instruction is an arithmetic instruction, determining an executing component for executing the arithmetic instruction from an executing component set, and sending the arithmetic instruction to the determined executing component; and

in response to determining that the type of the acquired instruction is a blocking instruction, acquiring a next instruction from the instruction queue after receiving a signal indicating that an instruction associated with the blocking instruction is completely executed, and executing, for the next instruction, the sending step, wherein the blocking instruction is generated based on there being data dependence between the next instruction and the instruction associated with the blocking instruction, wherein the instruction associated with the blocking instruction is an arithmetic instruction previously added to the instruction queue.

2. The method according to claim 1 , further comprising:

determining a number of instructions completely executed by the executing component in the executing component set.

3. The method according to claim 2 , wherein the instruction associated with the blocking instruction comprises an arithmetic type of the instruction associated with the blocking instruction and an instruction serial number, and arithmetic instructions of a same arithmetic type are executed by a same executing component; and, in response to determining that the type of the acquired instruction is a blocking instruction, acquiring a next instruction from the instruction queue after receiving a signal indicating that an instruction associated with the blocking instruction is completely executed comprises:

using an executing component executing the instruction associated with the blocking instruction as a target executing component, and updating, in response to receiving a signal of completely executing the instruction associated with the blocking instruction returned by the target executing component, a number of instructions completely executed by the target executing component;

determining whether the updated number of instructions completely executed by the target executing component is greater than or equal to the instruction serial number; and

in response to determining that the updated number of instructions completely executed by the target executing component is greater than or equal to the instruction serial number, acquiring the next instruction.

4. The method according to claim 1 , wherein generating instructions to form the instruction queue comprises:

receiving task information of the computing task;

extracting at least two arithmetic instructions from the task information;

selecting an arithmetic instruction from the at least two arithmetic instructions in order of instruction execution for use as a to-be-added instruction, and executing an adding step comprising: determining whether there is data dependence between the to-be-added instruction and the arithmetic instruction previously added to the instruction queue; and in response to determining that there is no data dependence between the to-be-added instruction and the arithmetic instruction previously added to the instruction queue, adding the to-be-added instruction to the instruction queue; and

in response to determining that there is data dependence between the to-be-added instruction and the arithmetic instruction previously added to the instruction queue, generating the blocking instruction associated with the arithmetic instruction previously added to the instruction queue on which the to-be-added instruction depends and determining the arithmetic instruction previously added to the instruction queue as the instruction associated with the blocking instruction, adding the blocking instruction and the to-be-added instruction sequentially to the instruction queue, selecting, from the at least two arithmetic instructions, another arithmetic instruction for use as the to-be-added instruction, and executing, for the another arithmetic instruction, the adding step.

5. The method according to claim 1 , wherein generating instructions to form the instruction queue comprises:

receiving task information of the computing task;

extracting at least two arithmetic instructions from the task information;

selecting an arithmetic instruction from the at least two arithmetic instructions in order of instruction execution for use as a to-be-added instruction, and executing an adding step comprising: determining a number of cacheable instructions of an executing component for executing the to-be-added instruction; determining an instruction serial number of the to-be-added instruction according to an arithmetic type of the to-be-added instruction and an order of the to-be-added instruction being added to the instruction queue; determining whether the instruction serial number of the to-be-added instruction minus one is less than or equal to the number of cacheable instructions; and in response to determining that the instruction serial number of the to-be-added instruction minus one is less than or equal to the number of cacheable instructions, adding the to-be-added instruction to the instruction queue; and

in response to determining that the instruction serial number of the to-be-added instruction minus one is greater than the number of cacheable instructions, generating the blocking instruction associated with an arithmetic instruction having an instruction serial number identical to the number of cacheable instructions, adding the blocking instruction and the to-be-added instruction sequentially to the instruction queue, selecting another arithmetic instruction from the at least two arithmetic instructions for use as the to-be-added instruction, and executing, for the another arithmetic instruction, the adding step.

6. The method according to claim 1 , wherein generating instructions to form the instruction queue comprises:

receiving task information of the computing task;

extracting at least two arithmetic instructions from the task information;

selecting an arithmetic instruction from the at least two arithmetic instructions in order of instruction execution for use as a to-be-added instruction;

in response to determining that there is data dependence between the to-be-added instruction and the arithmetic instruction previously added to the instruction queue, generating the blocking instruction associated with the arithmetic instruction previously added to the instruction queue on which the to-be-added instruction depends, determining the arithmetic instruction previously added to the instruction queue as the instruction associated with the blocking instruction, and adding the blocking instruction and the to-be-added instruction sequentially to the instruction queue.

7. An apparatus for executing instructions in an instruction queue, the instruction queue being generated from a computing task by a processor, the apparatus comprising:

at least one processor; and

a memory storing instructions, wherein the instructions when executed by the at least one processor, cause the at least one processor to perform operations, the operations comprising:

generating instructions to form the instruction queue;

acquiring an instruction from the instruction queue in preset order, and executing a sending step comprising: determining a type of the acquired instruction; in response to determining that the type of the acquired instruction is an arithmetic instruction, determining an executing component for executing the arithmetic instruction from an executing component set, and sending the arithmetic instruction to the determined executing component; and

in response to determining that the type of the acquired instruction is a blocking instruction, acquiring a next instruction from the instruction queue after receiving a signal indicating that an instruction associated with the blocking instruction is completely executed, and executing, for the next instruction, the sending step, wherein the blocking instruction is generated based on there being data dependence between the next instruction and the instruction associated with the blocking instruction, wherein the instruction associated with the blocking instruction is an arithmetic instruction previously added to the instruction queue.

8. The apparatus according to claim 7 , wherein the operations further comprise:

counting a number of instructions completely executed by the executing component in the executing component set.

9. The apparatus according to claim 8 , wherein the instruction associated with the blocking instruction comprises an arithmetic type of the instruction associated with the blocking instruction and an instruction serial number, and arithmetic instructions of a same arithmetic type are executed by a same executing component; and, in response to determining that the type of the acquired instruction is a blocking instruction, acquiring a next instruction from the instruction queue after receiving a signal indicating that an instruction associated with the blocking instruction is completely executed comprises:

using an executing component executing the instruction associated with the blocking instruction as a target executing component, and updating, in response to receiving a signal of completely executing the instruction associated with the blocking instruction returned by the target executing component, a number of instructions completely executed by the target executing component;

determining whether the updated number of instructions completely executed by the target executing component is greater than or equal to the instruction serial number; and

in response to determining that the updated number of instructions completely executed by the target executing component is greater than or equal to the instruction serial number, acquiring the next instruction.

10. The apparatus according to claim 7 , wherein generating instructions to form the instruction queue comprises:

receiving task information of the computing task;

extracting at least two arithmetic instructions from the task information;

selecting an arithmetic instruction from the at least two arithmetic instructions in order of instruction execution for use as a to-be-added instruction, and executing an adding step comprising: determining whether there is data dependence between the to-be-added instruction and the arithmetic instruction previously added to the instruction queue; and in response to determining that there is no data dependence between the to-be-added instruction and the arithmetic instruction previously added to the instruction queue, adding the to-be-added instruction to the instruction queue; and

in response to determining that there is data dependence between the to-be-added instruction and the arithmetic instruction previously added to the instruction queue, generating the blocking instruction associated with the arithmetic instruction previously added to the instruction queue on which the to-be-added instruction depends and determining the arithmetic instruction previously added to the instruction queue as the instruction associated with the blocking instruction, adding the blocking instruction and the to-be-added instruction sequentially to the instruction queue, selecting, from the at least two arithmetic instructions, another arithmetic instruction for use as the to-be-added instruction, and executing, for the another arithmetic instruction, the adding step.

11. The apparatus according to claim 7 , wherein generating instructions to form the instruction queue comprises:

receiving task information of the computing task;

extracting at least two arithmetic instructions from the task information;

selecting an arithmetic instruction from the at least two arithmetic instructions in order of instruction execution for use as a to-be-added instruction, and executing an adding step comprising: determining a number of cacheable instructions of an executing component for executing the to-be-added instruction; determining an instruction serial number of the to-be-added instruction according to an arithmetic type of the to-be-added instruction and an order of the to-be-added instruction being added to the instruction queue; determining whether the instruction serial number of the to-be-added instruction minus one is less than or equal to the number of cacheable instructions; and in response to determining that the instruction serial number of the to-be-added instruction minus one is less than or equal to the number of cacheable instructions, adding the to-be-added instruction to the instruction queue; and

in response to determining that the instruction serial number of the to-be-added instruction minus one is greater than the number of cacheable instructions, generating the blocking instruction associated with an arithmetic instruction having an instruction serial number identical to the number of cacheable instructions, adding the blocking instruction and the to-be-added instruction sequentially to the instruction queue, selecting another arithmetic instruction from the at least two arithmetic instructions for use as the to-be-added instruction, and executing, for the another arithmetic instruction, the adding step.

12. A non-transitory computer readable medium, storing a computer program thereon, wherein the computer program, when executed by an executing component, implements operations for executing instructions in an instruction queue, the instruction queue being generated from a computing task by a processor, the operations comprising:

generating instructions to form the instruction queue;

acquiring an instruction from the instruction queue in preset order, and executing a sending step comprising: determining a type of the acquired instruction; in response to determining that the type of the acquired instruction is an arithmetic instruction, determining an executing component for executing the arithmetic instruction from an executing component set, and sending the arithmetic instruction to the determined executing component; and

in response to determining that the type of the acquired instruction is a blocking instruction, acquiring a next instruction from the instruction queue after receiving a signal indicating that an instruction associated with the blocking instruction is completely executed, and executing, for the next instruction, the sending step, wherein the blocking instruction is generated based on there being data dependence between the next instruction and the instruction associated with blocking instruction, wherein the instruction associated with the blocking instruction is an arithmetic instruction previously added to the instruction queue.

13. The non-transitory computer readable medium according to claim 12 , wherein the operations further comprise:

determining a number of instructions completely executed by the executing component in the executing component set.

14. The non-transitory computer readable medium according to claim 13 , wherein the instruction associated with the blocking instruction comprises an arithmetic type of the instruction associated with the blocking instruction and an instruction serial number, and arithmetic instructions of a same arithmetic type are executed by a same executing component; and in response to determining that the type of the acquired instruction is a blocking instruction, acquiring a next instruction from the instruction queue after receiving a signal indicating that an instruction associated with the blocking instruction is completely executed comprises:

using an executing component executing the instruction associated with the blocking instruction as a target executing component, and updating, in response to receiving a signal of completely executing the instruction associated with the blocking instruction returned by the target executing component, a number of instructions completely executed by the target executing component;

determining whether the updated number of instructions completely executed by the target executing component is greater than or equal to the instruction serial number; and

in response to determining that the updated number of instructions completely executed by the target executing component is greater than or equal to the instruction serial number, acquiring the next instruction.

15. The non-transitory computer readable medium according to claim 12 , wherein generating instructions to form the instruction queue comprises:

receiving task information of the computing task;

extracting at least two arithmetic instructions from the task information;

selecting an arithmetic instruction from the at least two arithmetic instructions in order of instruction execution for use as a to-be-added instruction, and executing an adding step comprising: determining whether there is data dependence between the to-be-added instruction and the arithmetic instruction previously added to the instruction queue; and in response to determining that there is no data dependence between the to-be-added instruction and the arithmetic instruction previously added to the instruction queue, adding the to-be-added instruction to the instruction queue; and

in response to determining that there is data dependence between the to-be-added instruction and the arithmetic instruction previously added to the instruction queue, generating the blocking instruction associated with the arithmetic instruction previously added to the instruction queue on which the to-be-added instruction depends and determining the arithmetic instruction previously added to the instructing queue as the instruction associated with the blocking instruction, adding the blocking instruction and the to-be-added instruction sequentially to the instruction queue, selecting, from the at least two arithmetic instructions, another arithmetic instruction for use as the to-be-added instruction, and executing, for the another arithmetic instruction, the adding step.

16. The non-transitory computer readable medium according to claim 12 , wherein generating instructions to form the instruction queue comprises:

receiving task information of the computing task;

extracting at least two arithmetic instructions from the task information;

selecting an arithmetic instruction from the at least two arithmetic instructions in order of instruction execution for use as a to-be-added instruction, and executing an adding step comprising: determining a number of cacheable instructions of an executing component for executing the to-be-added instruction; determining an instruction serial number of the to-be-added instruction according to an arithmetic type of the to-be-added instruction and an order of the to-be-added instruction being added to the instruction queue; determining whether the instruction serial number of the to-be-added instruction minus one is less than or equal to the number of cacheable instructions; and in response to determining that the instruction serial number minus one is less than or equal to the number of cacheable instructions, adding the to-be-added instruction to the instruction queue; and

in response to determining that the instruction serial number of the to-be-added instruction minus one is greater than the number of cacheable instructions, generating the blocking instruction associated with an arithmetic instruction having an instruction serial number identical to the number of cacheable instructions, adding the blocking instruction and the to-be-added instruction sequentially to the instruction queue, selecting another arithmetic instruction from the at least two arithmetic instructions for use as the to-be-added instruction, and executing, for the another arithmetic instruction, the adding step.

Assignments (2)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Oct 15, 2021
From: BEIJING BAIDU NETCOM SCIENCE AND TECHNOLOGY CO., LTD.
To: KUNLUNXIN TECHNOLOGY (BEIJING) COMPANY LIMITED
Reel/Frame 058705/0909 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jul 1, 2019
From: WANG, JING; QI, WEI; LI, YUPENG; GONG, XIAOZHANG
To: BEIJING BAIDU NETCOM SCIENCE AND TECHNOLOGY CO., LTD.
Reel/Frame 049638/0836 →
Priority Claims (1)
CN 201810911185.X · Aug 10, 2018 · national
Continuity (1)
Related Publication 20200050450A1 · Feb 13, 2020