# US 2009/0276777 A1 · Multiple Programs for Efficient State Transitions on Multi-Threaded Processors

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

- Number: US 2009/0276777 A1
- Document ID: US20090276777A1
- Status: Published application
- Kind: A1
- Application number: 12/349,227
- Filed: 2009-01-06
- Published: 2009-11-05
- Earliest claimed: 2008-04-30
- Assignees: Advanced Micro Devices, Inc.
- Inventors: Andrew Brown; Brian Emberling
- Web page: https://patentgrep.com/patent/US20090276777A1

## CPC

- G06F 9/4843: {by program, e.g. task dispatcher, supervisor, operating system}
- G06F 9/3802: {Instruction prefetching}
- G06F 9/383: {Operand prefetching (cache prefetching G06F12/0862)}
- G06F 9/3842: {Speculative instruction execution}
- G06F 9/3851: {from multiple instruction streams, e.g. multistreaming}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A system and method to optimize processor performance and minimizing average thread latency by selectively loading a cache when a program state, resources required for execution of a program or the program itself change, is described. An embodiment of the invention supports a “cache priming program” that is selectively executed for a first thread/program/sub-routine of each process. Such a program is optimized for situations when instructions and other program data are not yet resident in cache(s), and/or whenever resources required for program execution or the program itself changes. By pre-loading the cache with two resources required for two instructions for only a first thread, average thread latency is reduced because the resources are already present in the cache. Since, such a mechanism is carried out only for one thread in a program cycle, pitfalls of a conventional general pre-fetch scheme that involves parsing of the program in advance to determine which resources and instructions will be needed at a later time, are avoided.

## Claims

### Claim 1

A method for optimizing processor performance during execution of a sequence of threads of multiple programs, comprising:
(a) creating a first and a second version of a program that performs an operation on a plurality of batches of input data; and
(b) executing the first version on a first batch of the plurality of batches of input data and executing the second version on a subsequent batch of the plurality of batches,
wherein the first and the second version result in a common output stored in a memory unit.

### Claim 2 (depends on 1)

The method of claim 1, wherein step (a) comprises executing the first version only for a first thread.

### Claim 3 (depends on 1)

The method of claim 1, wherein step (a) comprises executing a dummy instruction associated with the first version, wherein said dummy instruction loads data into a plurality of caches that are used later in at least one of the first and the second versions.

### Claim 4 (depends on 1)

The method of claim 1, wherein step (a) comprises allotting a special priority to threads running the first version.

### Claim 5 (depends on 1)

The method of claim 1, wherein step (a) results in a subsequent thread using resources loaded into a cache from earlier threads running the first version.

### Claim 6 (depends on 1)

The method of claim 1, wherein the first version performs at least one extra fetch, compared to the second version, at a beginning of the program, causing a cache to be loaded with at least two resources for two separate instructions, thereby resulting in a faster execution of the program.

### Claim 7

A system for controlling cache operation, comprising:
(a) a processor;
(b) a memory in communication with said processor, said memory used for storing a plurality of processing instructions for directing said processor to:
(i) create a first and a second version of a program that performs an operation on a plurality of batches of input data; and
(ii) process a first batch of the plurality of batches of input data using the first version and process a subsequent batch of the plurality of batches using the second version,
wherein the first and the second version result in a common output stored in the memory.

### Claim 8 (depends on 7)

The system of claim 7, said first version is executed only for a first thread.

### Claim 9 (depends on 7)

The system of claim 7, wherein the memory comprises a dummy instruction associated with the first version, wherein said dummy instruction causes the processor to load data into a plurality of caches that are used later in at least one of the first and the second versions.

### Claim 10 (depends on 7)

The system of claim 7, wherein the memory comprises further instructions for directing the processor to allot a special priority to threads running the first version.

### Claim 11 (depends on 7)

The system of claim 7, wherein resources loaded into a cache from earlier threads running the first version are used by a subsequent thread.

### Claim 12 (depends on 7)

The system of claim 7, wherein the first version performs at least one extra fetch, compared to the second version, at a beginning of the program, causing a cache to be loaded with at least two resources for two separate instructions, thereby resulting in a faster execution of the program.

### Claim 13

A computer program product comprising a computer useable medium having control logic stored therein for optimizing processor performance, the control logic comprising:
(i) a first computer readable program code means for adapting a processor to create a first and a second version of a program that performs an operation on a plurality of batches of input data; and
(ii) a second computer readable program code means for adapting the processor process a first batch of the plurality of batches of input data using the first version and process a subsequent batch of the plurality of batches using the second version, based upon the stored instructions,
wherein the first and the second version result in a common output stored in a memory.

### Claim 14 (depends on 13)

The computer program product of claim 13, wherein said first version is executed only for a first thread.

### Claim 15 (depends on 13)

The computer program product of claim 13, wherein the first computer readable program code means contains a dummy instruction associated with the first version, wherein said dummy instruction causes the processor to load data into a plurality of caches that are used later in at least one of the first and the second versions.

### Claim 16 (depends on 13)

The computer program product of claim 13, wherein the first computer readable program code means contains further instructions for directing the processor to allot a special priority to threads running the first version.

### Claim 17 (depends on 13)

The computer program product of claim 13, wherein resources loaded into a cache from earlier threads running the first version are used by a subsequent thread.

### Claim 18 (depends on 13)

The computer program product of claim 13, wherein the first version performs at least one extra fetch, compared to the second version, at a beginning of the program, causing a cache to be loaded with at least two resources for two separate instructions, thereby resulting in a faster execution of the program.

### Claim 19 (depends on 13)

The computer program product of claim 13, wherein the control logic comprises hardware description language instructions which when executed configure a manufacturing process to manufacture a second processor adapted to carry out said steps (i) and (ii).
