# US 2026/0086805 A1 · Loop detector and predictor

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

- Number: US 2026/0086805 A1
- Document ID: US20260086805A1
- Status: Published application
- Kind: A1
- Application number: 18/891,608
- Filed: 2024-09-20
- Published: 2026-03-26
- Earliest claimed: 2024-09-20
- Assignees: Ampere Computing LLC
- Applicants: Ampere Computing LLC
- Inventors: Michael CHIN; Aaron LINDSAY; Bret TOLL
- Web page: https://patentgrep.com/patent/US20260086805A1

## CPC

- G06F 9/30065: {Loop control instructions; iterative instructions, e.g. LOOP, REPEAT}
- G06F 9/30058: {Conditional branch instructions}
- G06F 9/325: {for loops, e.g. loop detection or loop counter}
- G06F 9/381: {Loop buffering}
- G06F 9/3844: {using dynamic branch prediction, e.g. using branch history tables}
- 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

Disclosed is a branch predictor unit (BPU), comprising a loop predictor configured to predict a repeatedly looping behavior before the repeatedly looping behavior occurs, a loop detector configured to detect the repeatedly looping behavior which is currently occurring, and a loop buffer, configured to treat a plurality of looping operations corresponding to the repeatedly looping behavior as a read-only circular buffer without removing the looping operations from the loop buffer.

## Claims

### Claim 1

A branch predictor unit (BPU), comprising:
a loop predictor configured to predict a repeatedly looping behavior before the repeatedly looping behavior occurs;
a loop detector configured to detect the repeatedly looping behavior which is currently occurring; and
a loop buffer, configured to treat a plurality of looping operations corresponding to the repeatedly looping behavior as a read-only circular buffer without removing the looping operations from the loop buffer, wherein a same set of instructions is repeatedly read out of the read-only circular loop buffer.

### Claim 2 (depends on 1)

The BPU of claim 1, wherein the loop detector is further configured to:
determine that the repeatedly looping behavior has been occurring by recording a branch history when a branch that is potentially part of a loop is detected, and checking whether one or more next instances of the branch have a branch history matching at least a threshold number of branches of a previous recorded branch history; and
determine that the loop has a length suitable for storage in the loop buffer.

### Claim 3 (depends on 1)

The BPU of claim 1, wherein the repeatedly looping behavior is defined by a plurality of repeatedly looping executions, wherein the loop predictor is further configured to:
determine whether the repeatedly looping executions have a duration of looping behavior longer than a threshold duration;
track a duration of each instance of the repeatedly looping executions;
record a branch history corresponding to a loop entrance of the repeatedly looping executions that have a duration of looping behavior longer than the threshold duration; and
count a number of repeatedly looping executions that have a duration of looping behavior longer than the threshold duration.

### Claim 4 (depends on 3)

The BPU of claim 3, wherein the loop predictor is further configured to train a loop mode prediction table having a plurality of desirable entries that are used to determine whether to enter a loop mode based at least in part on the branch history and the number of the repeatedly looping executions.

### Claim 5 (depends on 4)

The BPU of claim 4, wherein the loop predictor is further configured to enter the loop mode based on a determination that the branch history of a current branch matches at least one of the desirable entries in the loop mode prediction table.

### Claim 6 (depends on 5)

The BPU of claim 5, wherein the loop buffer is further configured to exit the loop mode upon receiving a flush.

### Claim 7 (depends on 6)

The BPU of claim 6, wherein a branch misprediction causes the flush.

### Claim 8 (depends on 3)

The BPU of claim 3, wherein a plurality of copies of looping operations that have a loop duration shorter than a threshold duration are installed in the loop buffer.

### Claim 9 (depends on 1)

The BPU of claim 1, wherein the loop detector is further configured to:
determine whether a first branch tracked by the loop detector having a first branch program counter (PC) is not detected again with a branch history that matches a prior instance of an operation having a sufficient branch history depth within a period of time or a number of predictions;
stop tracking the first branch based on a determination that the first branch tracked by the loop detector having the first branch PC is not detected again with a branch history that matches the prior instance to a sufficient depth; and
start tracking a second branch having a second branch PC.

### Claim 10 (depends on 1)

The BPU of claim 1, wherein the loop detector or the loop predictor, either alone or in combination, is further configured to:
determine a number of branch mispredictions; and
disable a loop prediction or a loop detection based on the number of branch mispredictions.

### Claim 11 (depends on 10)

The BPU of claim 10, wherein the loop prediction or the loop detection is disabled for a number of cycles or a number of predictions.

### Claim 12

A method performed at a branch predictor unit (BPU), the method comprising:
predicting a repeatedly looping behavior before the repeatedly looping behavior occurs;
detecting the repeatedly looping behavior which is currently occurring; and
treating a plurality of looping operations corresponding to the repeatedly looping behavior as a read-only circular buffer without removing the looping operations from a loop buffer, wherein a same set of instructions is repeatedly read out of the read-only circular loop buffer.

### Claim 13 (depends on 12)

The method of claim 12, further comprising:
determining that the repeatedly looping behavior has been occurring by recording a current branch history when a branch that is potentially part of a loop is detected, and checking whether one or more next instances of the branch have a branch history matching at least a threshold number of branches of the current branch history; and
determining that the loop has a length suitable for storage in the loop buffer.

### Claim 14 (depends on 12)

The method of claim 12, wherein the repeatedly looping behavior is defined by a plurality of repeatedly looping executions, further comprising:
determining whether the repeatedly looping executions have a duration of looping behavior longer than a threshold duration;
tracking a duration of each instance of the repeatedly looping executions;
recording a branch history corresponding to a loop entrance of the repeatedly looping executions that have a duration of looping behavior longer than the threshold duration; and
counting a number of repeatedly looping executions that have a duration of looping behavior longer than the threshold duration.

### Claim 15 (depends on 14)

The method of claim 14, further comprising:
training a loop mode prediction table having a plurality of desirable entries that are used to determine whether to enter a loop mode based at least in part on the branch history and the number of the repeatedly looping executions.

### Claim 16 (depends on 15)

The method of claim 15, further comprising:
entering the loop mode based on a determination that the branch history of a current branch matches at least one of the desirable entries in the loop mode prediction table.

### Claim 17

A branch predictor unit (BPU), comprising:
means for predicting a repeatedly looping behavior before the repeatedly looping behavior occurs;
means for detecting the repeatedly looping behavior which is currently occurring; and
means for treating a plurality of looping operations corresponding to the repeatedly looping behavior as a read-only circular buffer without removing the looping operations from a loop buffer, wherein a same set of instructions is repeatedly read out of the read-only circular loop buffer.

### Claim 18 (depends on 17)

The BPU of claim 17, further comprising:
means for determining that the repeatedly looping behavior has been occurring by recording a current branch history when a branch that is potentially part of a loop is detected, and checking whether one or more next instances of the branch have a branch history matching at least a threshold number of branches of the current branch history; and
means for determining that the loop has a length suitable for storage in the loop buffer.

### Claim 19 (depends on 17)

The BPU of claim 17, wherein the repeatedly looping behavior is defined by a plurality of repeatedly looping executions, further comprising:
means for determining whether the repeatedly looping executions have a duration of looping behavior longer than a threshold duration;
means for tracking a duration of each instance of the repeatedly looping executions;
means for recording a branch history corresponding to a loop entrance of the repeatedly looping executions that have a duration of looping behavior longer than the threshold duration; and
means for counting a number of repeatedly looping executions that have a duration of looping behavior longer than the threshold duration.

### Claim 20 (depends on 19)

The BPU of claim 19, further comprising:
means for training a loop mode prediction table having a plurality of desirable entries that are used to determine whether to enter a loop mode based at least in part on the branch history and the number of the repeatedly looping executions.
