# US 2025/0165258 A1 · Instruction execution method and apparatus

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2025/0165258 A1
- Document ID: US20250165258A1
- Status: Published application
- Kind: A1
- Application number: 19/029,760
- Filed: 2025-01-17
- Published: 2025-05-22
- Earliest claimed: 2022-08-02
- Applicants: Huawei Technologies Co., Ltd.
- Inventors: Fan ZHU; Ruoyu ZHOU; Fang SU; Xiping ZHOU; Heng LIAO
- Web page: https://patentgrep.com/patent/US20250165258A1

## CPC

- G06F 9/3836: {Instruction issuing, e.g. dynamic instruction scheduling or out of order instruction execution}
- G06F 9/3854: {Instruction completion, e.g. retiring, committing or graduating}
- G06F 9/30189: {according to execution mode, e.g. mode flag}
- G06F 9/3842: {Speculative instruction execution}
- G06F 9/3856: {Reordering of instructions, e.g. using queues or age tags}
- G06F 9/3861: {Recovery, e.g. branch miss-prediction, exception handling (error detection or correction G06F11/00)}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Embodiments of this application provide instruction execution methods and related apparatuses. An example method includes: determining that an execution status of a first block in a queue is a completed state, where the queue includes a plurality of blocks including the first block, the first block is a block with a smallest number in the queue, and the first block includes at least one instruction; changing a status of a processor based on an execution result of the at least one instruction in the first block; and deleting the first block from the queue.

## Claims

### Claim 1

An instruction execution method, wherein the method comprises:
determining that an execution status of a first block in a queue is a completed state, wherein the queue comprises a plurality of blocks comprising the first block, the first block is a block with a smallest number in the queue, and the first block comprises at least one instruction;
changing a status of a processor based on an execution result of the at least one instruction in the first block; and
deleting the first block from the queue.

### Claim 2 (depends on 1)

The method according to claim 1, wherein the determining that an execution status of a first block in a queue is a completed state comprises:
determining that execution statuses of all instructions comprised in the first block are a completed state.

### Claim 3 (depends on 1)

The method according to claim 1, wherein the method further comprises:
determining that a first piece is a commission piece in a second block of the plurality of blocks and an instruction in the first piece is in a completed state, wherein the second block is different from the first block, the first piece is one of a plurality of pieces comprised in the second block, the first piece comprises at least one instruction, the plurality of pieces in the second block are connected through tail pointers, and the commission piece is a piece that is in the second block and that starts to store an instruction earliest;
deleting the first piece from the second block; and
when the first piece is not a last piece in the second block, updating the commission piece in the second block to a piece to which a tail pointer of the first piece points.

### Claim 4 (depends on 3)

The method according to claim 3, wherein the method further comprises:
determining that execution statuses of all instructions in the second block are a completed state; and
setting an execution status of the second block to a completed state.

### Claim 5 (depends on 1)

The method according to claim 1, wherein the method further comprises:
obtaining one or more third blocks, wherein each of the one or more third blocks comprises at least one instruction; and
placing the one or more third blocks in the queue in ascending order of numbers.

### Claim 6 (depends on 5)

The method according to claim 5, wherein the method further comprises:
storing an instruction in a fourth block into a second piece, wherein the fourth block is one of the one or more third blocks, and the second piece comprises at least one vacant location for storing an instruction.

### Claim 7 (depends on 1)

The method according to claim 1, wherein the method further comprises:
obtaining an abnormal signal and an abnormal instruction number; and
deleting, from the queue, an instruction whose instruction number is greater than or equal to the abnormal instruction number.

### Claim 8 (depends on 1)

The method according to claim 1, wherein the method further comprises:
obtaining an interruption signal; and
deleting an instruction other than an instruction with a smallest number from the queue.

### Claim 9 (depends on 1)

The method according to claim 1, wherein the method further comprises:
when execution of a third instruction is completed, setting an execution status of the third instruction to a completed state, wherein the third instruction is in the queue; or
when an exception occurs during execution of the third instruction, setting the execution status of the third instruction to an abnormal state.

### Claim 10

A computer apparatus, comprising an input/output interface and a logic circuit coupled to the input/output interface, wherein the logic circuit is configured to:
determine that an execution status of a first block in a queue is a completed state, wherein the queue comprises a plurality of blocks comprising the first block, the first block is a block with a smallest number in the queue, and the first block comprises at least one instruction, wherein
change a status of a processor based on an execution result of the at least one instruction in the first block; and
delete the first block from the queue.

### Claim 11 (depends on 10)

The apparatus according to claim 10, wherein the logic circuit is configured to:
determine that execution statuses of all instructions comprised in the first block are a completed state.

### Claim 12 (depends on 10)

The apparatus according to claim 10, wherein the logic circuit is configured to:
determine that a first piece is a commission piece in a second block of the plurality of blocks and an instruction in the first piece is in a completed state, wherein the second block is different from the first block, the first piece is one of a plurality of pieces comprised in the second block, the first piece comprises at least one instruction, the plurality of pieces in the second block are connected through tail pointers, and the commission piece is a piece that is in the second block and that starts to store an instruction earliest;
delete the first piece from the second block; and
when the first piece is not a last piece in the second block, update the commission piece in the second block to a piece to which a tail pointer of the first piece points.

### Claim 13 (depends on 12)

The apparatus according to claim 12, wherein the logic circuit is further configured to:
determine that execution statuses of all instructions in the second block are a completed state; and
set an execution status of the second block to a completed state.

### Claim 14 (depends on 10)

The apparatus according to claim 10,
the logic circuit is further configured to obtain one or more third blocks, wherein each of the one or more third blocks comprises at least one instruction; and place the one or more third blocks in the queue in ascending order of numbers.

### Claim 15 (depends on 14)

The apparatus according to claim 14, wherein the logic circuit is further configured to store an instruction in a fourth block into a second piece, wherein the fourth block is one of the one or more third blocks, and the second piece comprises at least one vacant location for storing an instruction.

### Claim 16 (depends on 10)

The apparatus according to claim 10, wherein the logic circuit is further configured to:
obtain an abnormal signal and an abnormal instruction number; and
delete, from the queue, an instruction whose instruction number is greater than or equal to the abnormal instruction number.

### Claim 17 (depends on 10)

The apparatus according to claim 10, wherein the logic circuit is further configured to:
obtain an interruption signal; and
delete an instruction other than an instruction with a smallest number from the queue.

### Claim 18 (depends on 10)

The apparatus according to claim 10, wherein the logic circuit is specifically configured to:
when execution of a third instruction is completed, set an execution status of the third instruction to a completed state, wherein the third instruction is in the queue; or
when an exception occurs during execution of the third instruction, set the execution status of the third instruction to an abnormal state.

### Claim 19

A computer device, comprising at least one memory and at least one processor coupled to the at least one memory, wherein the at least one memory stores programming instructions for executing by the at least one processor to cause the computer device to perform operations comprising:
determining that an execution status of a first block in a queue is a completed state, wherein the queue comprises a plurality of blocks comprising the first block, the first block is a block with a smallest number in the queue, and the first block comprises at least one instruction;
changing a status of a processor based on an execution result of the at least one instruction in the first block; and
deleting the first block from the queue.

### Claim 20 (depends on 19)

The computer device of claim 19, wherein the determining that an execution status of a first block in a queue is a completed state comprises:
determining that execution statuses of all instructions comprised in the first block are a completed state.
