# US 2024/0201998 A1 · Performing storage-free instruction cache hit prediction in a processor

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

- Number: US 2024/0201998 A1
- Document ID: US20240201998A1
- Status: Published application
- Kind: A1
- Application number: 18/083,185
- Filed: 2022-12-16
- Published: 2024-06-20
- Earliest claimed: 2022-12-16
- Assignees: Microsoft Technology Licensing, LLC
- Applicants: Microsoft Technology Licensing, LLC
- Inventors: Ahmed ABULILA; Rami Mohammad AL SHEIKH; Daren Eugene STREETT; Michael Scott MCILVAINE
- Web page: https://patentgrep.com/patent/US20240201998A1

## CPC

- G06F 9/3806: {using address prediction, e.g. return stack, branch history buffer}
- G06F 9/3802: {Instruction prefetching}
- G06F 12/0811: with multilevel cache hierarchies
- G06F 12/0875: with dedicated cache, e.g. instruction or stack
- G06F 2212/27: Using a specific cache architecture
- G06F 2212/452: Instruction code
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Performing storage-free instruction cache hit prediction is disclosed herein. In some aspects, a processor comprises an instruction cache hit prediction circuit that is configured to detect that a first access by a branch predictor circuit to a branch target buffer (BTB) for a first instruction in an instruction stream results in a miss on the BTB. In response to detecting the miss, the instruction cache hit prediction circuit is further configured to generate a first instruction cache prefetch request for the first instruction. The instruction cache hit prediction circuit is also configured to transmit the first instruction cache prefetch request to a prefetcher circuit.

## Claims

### Claim 1

A processor, comprising:
an instruction processing circuit configured to process an instruction stream comprising a plurality of instructions;
a prefetcher circuit; and
a branch predictor circuit comprising a branch target buffer (BTB) and an instruction cache hit prediction circuit;
the instruction cache hit prediction circuit configured to:
detect that a first access by the branch predictor circuit to the BTB for a first instruction in the instruction stream results in a miss on the BTB; and
responsive to detecting that the first access by the branch predictor circuit to the BTB for the first instruction in the instruction stream results in the miss on the BTB:
generate a first instruction cache prefetch request for the first instruction; and
transmit the first instruction cache prefetch request to the prefetcher circuit.

### Claim 2 (depends on 1)

The processor of claim 1, wherein:
the processor further comprises an instruction cache memory and a Level 2 (L2) cache memory; and
the instruction cache hit prediction circuit is configured to generate the first instruction cache prefetch request by being configured to generate a prefetch request to prefetch data from the L2 cache memory into the instruction cache memory.

### Claim 3 (depends on 1)

The processor of claim 1, wherein:
the BTB comprises a plurality of BTB levels; and
the instruction cache hit prediction circuit is configured to detect that the first access by the branch predictor circuit to the BTB for the first instruction in the instruction stream results in the miss on the BTB by being configured to detect a miss on each BTB level of the plurality of BTB levels of the BTB.

### Claim 4 (depends on 1)

The processor of claim 1, wherein:
the processor further comprises an instruction cache memory;
each BTB level of a plurality of BTB levels of the BTB is associated with an instruction cache hit counter and an instruction cache miss counter; and
the instruction cache hit prediction circuit is further configured to:
detect that a second access by the branch predictor circuit to the BTB level for a second instruction in the instruction stream results in a miss on the instruction cache memory; and
responsive to detecting that the second access by the branch predictor circuit to the BTB level for the second instruction in the instruction stream results in the miss on the instruction cache memory:
determine a ratio of a value of the instruction cache hit counter for the BTB level to a value of the instruction cache miss counter for the BTB level;
determine that the ratio exceeds a miss rate threshold; and
responsive to determining that the ratio exceeds the miss rate threshold:
generate a second instruction cache prefetch request for the second instruction; and
transmit the second instruction cache prefetch request to the prefetcher circuit.

### Claim 5 (depends on 4)

The processor of claim 4, wherein:
the instruction cache hit prediction circuit is further configured to:
detect that a third access by the branch predictor circuit to the BTB level for a third instruction in the instruction stream results in a hit on the instruction cache memory; and
responsive to detecting that the third access by the branch predictor circuit to the BTB level for the third instruction in the instruction stream results in the hit on the instruction cache memory, increment the instruction cache hit counter for the BTB level.

### Claim 6 (depends on 4)

The processor of claim 4, wherein the instruction cache hit prediction circuit is further configured to, further responsive to detecting that the second access by the branch predictor circuit to the BTB level for the second instruction in the instruction stream results in the miss on the instruction cache memory, increment the instruction cache miss counter for the BTB level.

### Claim 7 (depends on 4)

The processor of claim 4, wherein the instruction cache hit prediction circuit is further configured to reset the instruction cache hit counter and the instruction cache miss counter for the BTB level.

### Claim 8

A method for performing storage-free instruction cache hit prediction, comprising:
detecting, by an instruction cache hit prediction circuit of a processor, that a first access by a branch predictor circuit of the processor to a branch target buffer (BTB) for a first instruction in an instruction stream results in a miss on the BTB; and
responsive to detecting that the first access by the branch predictor circuit to the BTB for the first instruction in the instruction stream results in the miss on the BTB:
generating, by the instruction cache hit prediction circuit, a first instruction cache prefetch request for the first instruction; and
transmitting, by the instruction cache hit prediction circuit, the first instruction cache prefetch request to a prefetcher circuit of the processor.

### Claim 9 (depends on 8)

The method of claim 8, wherein generating the first instruction cache prefetch request comprises generating a prefetch request to prefetch data from a Level 2 (L2) cache memory of the processor into an instruction cache memory of the processor.

### Claim 10 (depends on 8)

The method of claim 8, wherein:
the BTB comprises a plurality of BTB levels; and
detecting that the first access by the branch predictor circuit to the BTB for the first instruction in the instruction stream results in the miss on the BTB comprises detecting a miss on each BTB level of the plurality of BTB levels of the BTB.

### Claim 11 (depends on 8)

The method of claim 8, wherein:
each BTB level of a plurality of BTB levels of the BTB is associated with an instruction cache hit counter and an instruction cache miss counter; and
the method further comprises:
detecting, by the instruction cache hit prediction circuit, that a second access by the branch predictor circuit to the BTB level for a second instruction in the instruction stream results in a hit on an instruction cache memory; and
responsive to detecting that the second access by the branch predictor circuit to the BTB level for the second instruction in the instruction stream results in the hit on the instruction cache memory:
determining, by the instruction cache hit prediction circuit, a ratio of a value of the instruction cache hit counter for the BTB level to a value of the instruction cache miss counter for the BTB level;
determining, by the instruction cache hit prediction circuit, that the ratio exceeds a miss rate threshold; and
responsive to determining that the ratio exceeds the miss rate threshold:
generating, by the instruction cache hit prediction circuit, a second instruction cache prefetch request for the second instruction; and
transmitting, by the instruction cache hit prediction circuit, the second instruction cache prefetch request to the prefetcher circuit.

### Claim 12 (depends on 11)

The method of claim 11, further comprising:
detecting, by the instruction cache hit prediction circuit, that a third access by the branch predictor circuit to the BTB level for a third instruction in the instruction stream results in a hit on an instruction cache memory; and
responsive to detecting that the third access by the branch predictor circuit to the BTB level for the third instruction in the instruction stream results in the hit on the instruction cache memory, incrementing, by the instruction cache hit prediction circuit, the instruction cache hit counter for the BTB level.

### Claim 13 (depends on 11)

The method of claim 11, further comprising, further responsive to detecting that the second access by the branch predictor circuit to the BTB level for the second instruction in the instruction stream results in the miss on the instruction cache memory, incrementing, by the instruction cache hit prediction circuit, the instruction cache miss counter for the BTB level.

### Claim 14 (depends on 11)

The method of claim 11, further comprising resetting, by the instruction cache hit prediction circuit, the instruction cache hit counter and the instruction cache miss counter for the BTB level.

### Claim 15

A non-transitory computer-readable medium having stored thereon computer-executable instructions that, when executed, cause a processor to:
detect that a first access by a branch predictor circuit of the processor to a branch target buffer (BTB) for a first instruction in an instruction stream results in a miss on the BTB; and
responsive to detecting that the first access by the branch predictor circuit to the BTB for the first instruction in the instruction stream results in the miss on the BTB:
generate a first instruction cache prefetch request for the first instruction; and
transmit the first instruction cache prefetch request to a prefetcher circuit of the processor.

### Claim 16 (depends on 15)

The non-transitory computer-readable medium of claim 15, wherein the computer-executable instructions cause the processor to generate the first instruction cache prefetch request by causing the processor to generate a prefetch request to prefetch data from a Level 2 (L2) cache memory of the processor into an instruction cache memory of the processor.

### Claim 17 (depends on 15)

The non-transitory computer-readable medium of claim 15, wherein:
the BTB comprises a plurality of BTB levels; and
the computer-executable instructions cause the processor to detect that the first access by the branch predictor circuit to the BTB for the first instruction in the instruction stream results in the miss on the BTB by causing the processor to detect a miss on each BTB level of the plurality of BTB levels of the BTB.

### Claim 18 (depends on 15)

The non-transitory computer-readable medium of claim 15, wherein:
each BTB level of a plurality of BTB levels of the BTB is associated with an instruction cache hit counter and an instruction cache miss counter; and
the computer-executable instructions further cause the processor to:
detect that a second access by the branch predictor circuit to the BTB level for a second instruction in the instruction stream results in a miss on an instruction cache memory; and
responsive to detecting that the second access by the branch predictor circuit to the BTB level for the second instruction in the instruction stream results in the miss on the instruction cache memory:
determine a ratio of a value of the instruction cache hit counter for the BTB level to a value of the instruction cache miss counter for the BTB level;
determine that the ratio exceeds a miss rate threshold; and
responsive to determining that the ratio exceeds the miss rate threshold:
generate a second instruction cache prefetch request for the second instruction; and
transmit the second instruction cache prefetch request to the prefetcher circuit.

### Claim 19 (depends on 18)

The non-transitory computer-readable medium of claim 18, wherein the computer-executable instructions further cause the processor to:
detect that a third access by the branch predictor circuit to the BTB level for a third instruction in the instruction stream results in a hit on an instruction cache memory; and
responsive to detecting that the third access by the branch predictor circuit to the BTB level for the third instruction in the instruction stream results in the hit on the instruction cache memory, increment the instruction cache hit counter for the BTB level.

### Claim 20 (depends on 18)

The non-transitory computer-readable medium of claim 18, wherein the computer-executable instructions further cause the processor to, further responsive to detecting that the second access by the branch predictor circuit to the BTB level for the second instruction in the instruction stream results in the miss on the instruction cache memory, increment the instruction cache miss counter for the BTB level.
