# US 2025/0165256 A1 · Separate branch target buffers for different levels of calls

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

- Number: US 2025/0165256 A1
- Document ID: US20250165256A1
- Status: Published application
- Kind: A1
- Application number: 19/023,081
- Filed: 2025-01-15
- Published: 2025-05-22
- Earliest claimed: 2018-05-02
- Assignees: Micron Technology, Inc.
- Applicants: Micron Technology, Inc.
- Inventors: Steven Jeffrey Wallach
- Web page: https://patentgrep.com/patent/US20250165256A1

## CPC

- G06F 9/3806: {using address prediction, e.g. return stack, branch history buffer}
- G06F 9/30058: {Conditional branch instructions}
- G06F 9/323: {for indirect branch instructions}
- G06F 9/3844: {using dynamic branch prediction, e.g. using branch history tables}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A computing device (e.g., a processor) having a plurality of branch target buffers. A first branch target buffer in the plurality of branch target buffers is used in execution of a set of instructions containing a call to a subroutine. In response to the call to the subroutine, a second branch target buffer is allocated from the plurality of branch target buffers for execution of instructions in the subroutine. The second branch target buffer is cleared before the execution of the instructions in the subroutine. The execution of the instructions in the subroutine is restricted to access the second branch target buffer and blocked from accessing branch target buffers other than the second branch target buffer.

## Claims

### Claim 1

A computing device, comprising:
a processor having a first branch target buffer and a second branch target buffer;
wherein the processor is configured to:
perform branch prediction during execution of a set of instructions using first branch prediction information stored in the first branch target buffer; and
in response to a call to a subroutine, perform prediction information for execution of the instructions of the subroutine using second prediction information stored in the second branch target buffer.

### Claim 2 (depends on 1)

The computing device of claim 1, wherein the execution of the instructions of the subroutine is blocked from accessing the first branch prediction information stored in the first branch target buffer.

### Claim 3 (depends on 2)

The computing device of claim 2, wherein the execution of the set of instructions is blocked from accessing the second branch target buffer.

### Claim 4 (depends on 3)

The computing device of claim 3, wherein the second branch target buffer is cleared before the execution of the instructions of the subroutine.

### Claim 5 (depends on 3)

The computing device of claim 3, wherein the second branch target buffer is cleared after returning from the subroutine and before the second branch target buffer is used for execution of a third subroutine called from the set of instructions.

### Claim 6 (depends on 5)

The computing device of claim 5, wherein the set of instructions is one of:
a subroutine; and
a main routine of a program.

### Claim 7 (depends on 1)

The computing device of claim 1, wherein the execution of the instructions of the subroutine is prevented from accessing branch prediction information stored in the plurality of branch target buffers other than the second branch target buffer.

### Claim 8 (depends on 1)

The computing device of claim 1, wherein the execution of the set of instructions is prevented from accessing branch prediction information stored in the plurality of branch target buffers other than the first branch target buffer.

### Claim 9 (depends on 1)

The computing device of claim 1, wherein the second branch target is cleared after or upon returning from the subroutine to the set of instructions.

### Claim 10 (depends on 1)

The computing device of claim 1, wherein when the branch target buffers are in use at a time of the call to the subroutine, the second branch target buffer is selected from the plurality of branch target buffers and cleared the second branch target for allocation to the execution of the subroutine.

### Claim 11

A method implemented in a computing device, the method comprising:
executing in a program in a processor, wherein the processor has a plurality of branch target buffers, and the program has a plurality of routines; and
allocating the plurality of branch target buffers to execution of the plurality of routines respectively;
storing branch prediction information of each respective routine in a respective branch target buffer; and
executing the respective routine by accessing branch prediction information only in the respective branch target buffer allocated to the respective routine.

### Claim 12 (depends on 11)

The method of claim 11, further comprising, in response to returning from the respective routine to a calling routine that calls the respective routine:
de-allocating the respective branch target buffer; and
clearing the respective branch target buffer before the respective branch target buffer is allocated to a further routine called by the calling routine.

### Claim 13 (depends on 11)

The method of claim 11, wherein the processor has a further branch target buffer;
and when a further routine is called while execution of each of the plurality of routines is still incomplete,
allocating the further branch target buffer for execution of the further routine; and
blocking execution of the further branch target from accessing the plurality of branch target buffers.

### Claim 14 (depends on 13)

The method of claim 13, further comprising:
clearing the branch target buffer upon returning from the further routine to a calling routine in the plurality of routines.

### Claim 15 (depends on 11)

The method of claim 11, wherein the processor has no further branch target buffer; and when a further routine is called while execution of each of the plurality of routines is still incomplete:
selecting a first branch target buffer from the plurality of branch target buffers, the first branch target buffer being allocated to a first routine in the plurality of routines;
de-allocating the first branch target buffer from the first routine;
clearing the first branch target buffer;
re-allocating the first branch target buffer for execution of the further routine; and
blocking execution of the further branch target from accessing the plurality of branch target buffers other than the first branch target buffer.

### Claim 16 (depends on 15)

The method of claim 15, wherein the first routine is the last routine to complete in execution of the plurality of routines.

### Claim 17

A processor, comprising:
at least one execution unit; and
an instruction fetch stage having a first branch target buffer and a second branch target buffer;
wherein during execution of a program having a first routine and a second routine:
the first branch target buffer stores branch prediction information of the first routine;
the second branch target buffer stores branch prediction information of the second routine;
execution of the first routine only accesses the first branch target buffer; and
execution of the second routine only accesses the second branch target buffer.

### Claim 18 (depends on 17)

The processor of claim 17, wherein the second branch target buffer is cleared upon completing execution of the second routine.

### Claim 19 (depends on 17)

The processor of claim 17, wherein the plurality of branch target buffers include a third branch target buffer; in response to the second routine calls a third routine, the third branch target buffer is allocated for execution of the third routine.

### Claim 20 (depends on 19)

The processor of claim 19, wherein the execution of the third routine is blocked from accessing the first branch target buffer and the second branch target buffer.
