# US 2021/0279177 A1 · Instruction prefetch mechanism

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

- Number: US 2021/0279177 A1
- Document ID: US20210279177A1
- Status: Published application
- Kind: A1
- Application number: 17/210,867
- Filed: 2021-03-24
- Published: 2021-09-09
- Earliest claimed: 2017-08-07
- Assignees: Intel Corporation
- Applicants: Intel Corporation
- Inventors: Vasileios Porpodas; Guei-Yuan Lueh; Subramaniam Maiyuran; Wei-Yu Chen
- Web page: https://patentgrep.com/patent/US20210279177A1

## CPC

- G06F 12/0862: with prefetch
- G06F 8/41: Compilation
- G06F 8/4442: {Reducing the number of cache misses; Data prefetching (cache prefetching G06F12/0862)}
- G06F 9/30047: {Prefetch instructions; cache control instructions}
- G06F 11/3037: {where the computing system component is a memory, e.g. virtual memory, cache (accessing, addressing or allocating within memory systems or architectures G06F12/00; checking stores for correct operation G11C29/00)}
- G06F 11/3409: {for performance assessment}
- G06F 11/3466: {Performance evaluation by tracing or monitoring}
- G06F 12/0875: with dedicated cache, e.g. instruction or stack
- G06F 2201/81: Threshold
- G06F 2201/885: Monitoring specific for caches
- G06F 2212/1016: Performance improvement
- G06F 2212/452: Instruction code
- G06F 2212/502: using adaptive policy
- G06F 2212/602: Details relating to cache prefetching
- G06F 2212/6028: Prefetching based on hints or prefetch instructions
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

An apparatus to facilitate data prefetching is disclosed. The apparatus includes a cache, one or more execution units (EUs) to execute program code, prefetch logic to maintain tracking information of memory instructions in the program code that trigger a cache miss and compiler logic to receive the tracking information, insert one or more pre-fetch instructions in updated program code to prefetch data from a memory for execution of one or more of the memory instructions that triggered a cache miss and download the updated program code for execution by the one or more EUs.

## Claims

### Claim 1

An apparatus, 00comprising:
a memory device to store first program code;
an instruction cache miss counter circuitry to maintain tracking information for cache-miss instructions; and
a prefetch circuitry to:
determine whether the tracking information indicates a miss-rate has exceeded a pre-determined threshold;
transmit a trigger to pre-fetch second program code in response to determining that the miss rate has exceeded the pre-determined threshold;
receive the second program code; and
store the second program code in the memory device.

### Claim 2 (depends on 1)

The apparatus of claim 1, wherein the second program code comprises one or more pre-fetch instructions inserted into one or more place-holder addresses in the instruction memory to prefetch data for execution of one or more of the memory instructions that triggered a cache miss in place of the first program code.

### Claim 3 (depends on 2)

The apparatus of claim 2, wherein the instruction cache miss counter circuitry maintains the tracked information by collecting an instruction pointer of an instruction that caused a cache miss.

### Claim 4 (depends on 3)

The apparatus of claim 3, wherein the instruction cache miss counter circuitry comprises:
a cache to store instructions; and
a plurality of counters to track cache misses caused by executed instructions, wherein each counter maintains a count value associated with each of one or more instruction pointers.

### Claim 5 (depends on 4)

The apparatus of claim 4, wherein the instruction cache miss counter circuitry provides a map structure that uses the instruction pointer into the cache as a key.

### Claim 6 (depends on 5)

The apparatus of claim 5, wherein the count value is incremented responsive to an occurrence of a cache miss for an associated instruction pointer.

### Claim 7 (depends on 2)

The apparatus of claim 2, wherein the pre-fetch instructions in the second program are inserted in placeholders allocated during a compilation of the first program code.

### Claim 8 (depends on 2)

The apparatus of claim 2, wherein an instruction cache is invalidated to read the second program code from the instruction memory.

### Claim 9

A method comprising:
tracking information for executed memory instructions in first program code that trigger a cache miss;
determining whether the tracking information indicates that a miss-rate has exceeded a pre-determined threshold;
transmitting a trigger to pre-fetch second program code in response to determining that the miss rate has exceeded the pre-determined threshold;
receiving the second program code; and
storing the second program code in the memory device.

### Claim 10 (depends on 9)

The method of claim 9, wherein the second program code comprises one or more pre-fetch instructions inserted into one or more place-holder addresses in the instruction memory to prefetch data for execution of one or more of the memory instructions that triggered a cache miss in place of the first program code.

### Claim 11 (depends on 10)

The method of claim 10, further comprising inserting the pre-fetch instructions in the second program code into placeholders allocated during a compilation of the first program code.

### Claim 12 (depends on 10)

The method of claim 10, wherein tracking the information comprises collecting an instruction pointer of an instruction that caused a cache miss.

### Claim 13 (depends on 12)

The method of claim 12, further comprising incrementing a counter responsive to an occurrence of a cache miss for the instruction pointer.

### Claim 14

A graphics processing unit (GPU) comprising:
a memory device to store first program code;
a plurality of processing units to execute the first program code;
an instruction cache miss counter circuitry to maintain tracking information for instructions executed at the plurality of processing units that trigger a cache miss; and
a prefetch circuitry to:
determine whether the tracking information indicates a miss-rate has exceeded a pre-determined threshold;
transmit a trigger to pre-fetch second program code in response to determining that the miss rate has exceeded the pre-determined threshold;
receive the second program code; and
store the second program code in the memory device.

### Claim 15 (depends on 14)

The GPU of claim 14, wherein the second program code comprises one or more pre-fetch instructions inserted into one or more place-holder addresses in the instruction memory to prefetch data for execution of one or more of the memory instructions that triggered a cache miss in place of the first program code.

### Claim 16 (depends on 15)

The GPU of claim 15, wherein the instruction cache miss counter circuitry to maintain the tracked information by collecting an instruction pointer of an instruction that caused a cache miss.

### Claim 17 (depends on 16)

The GPU of claim 16, wherein the instruction cache miss counter circuitry comprises:
a cache to store instructions; and
a plurality of counters to track cache misses caused by executed instructions, wherein each counter maintains a count value associated with each of one or more instruction pointers.

### Claim 18 (depends on 17)

The GPU of claim 17, wherein the count value is incremented responsive to an occurrence of a cache miss for an associated instruction pointer.

### Claim 19 (depends on 15)

The GPU of claim 15, wherein the pre-fetch instructions in the second program are inserted in placeholders allocated during a compilation of the first program code.

### Claim 20 (depends on 15)

The GPU of claim 15, wherein an instruction cache is invalidated to read the second program code from the instruction memory.
