# US 9,354,892 B2 · Creating SIMD efficient code by transferring register state through common memory

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

- Number: US 9,354,892 B2
- Document ID: US9354892B2
- Status: Granted
- Kind: B2
- Application number: 13/689,421
- Filed: 2012-11-29
- Published: 2014-05-29
- Granted: 2016-05-31
- Earliest claimed: 2012-11-29
- Assignees: Advanced Micro Devices, Inc.
- Applicants: Advanced Micro Devices, Inc.
- Inventors: Timothy G. Rogers; Bradford M. Beckmann; James M. O'Connor
- Web page: https://patentgrep.com/patent/US9354892B2

## CPC

- G06F 9/3851: {from multiple instruction streams, e.g. multistreaming}
- G06F 9/3887: {controlled by a single instruction for multiple data lanes [SIMD]}
- G06F 9/3888: {controlled by a single instruction for multiple threads [SIMT] in parallel}
- G06F 9/38885: {Divergence aspects}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Methods, media, and computing systems are provided. The method includes, the media are configured for, and the computing system includes a processor with control logic for allocating memory for storing a plurality of local register states for work items to be executed in single instruction multiple data hardware and for repacking wavefronts that include work items associated with a program instruction responsive to a conditional statement. The repacking is configured to create repacked wavefronts that include at least one of a wavefront containing work items that all pass the conditional statement and a wavefront containing work items that all fail the conditional statement.

## Claims

### Claim 1

A method for operating a computing system, the method comprising:
storing, in a memory, a plurality of register states, each register state associated with a corresponding one of a plurality of work items to be executed in single instruction multiple data hardware;
generating a state pointer stack, the state pointer stack comprising one or more levels of state pointer entries, each state pointer entry associated with a corresponding one of the work items and indicating a respective entry of the local register states;
analyzing a conditional statement for at least some of the work items; and
repacking wavefronts that include the work items based on a result of the analyzing, wherein the repacking comprises rearranging the state pointer entries in one or more levels of the state pointer stack to cause the work items to be executed in a corresponding order.

### Claim 2 (depends on 1)

The method of claim 1 further comprising:
generating a dereference to one of the state pointer entries responsive to a reference to a local variable.

### Claim 3 (depends on 2)

The method of claim 2 wherein repacking the wavefronts includes incrementing a level of the state pointer stack.

### Claim 4 (depends on 3)

The method of claim 3 further comprising determining whether the program instruction is a first instruction of an immediate post dominator basic block.

### Claim 5 (depends on 4)

The method of claim 4 further comprising decrementing the level of the state pointer stack when the program instruction is the first instruction of the immediate post dominator basic block.

### Claim 6 (depends on 1)

The method of claim 1 wherein the repacking comprises:
packing the rearranged state pointer entries into the repacked wavefronts.

### Claim 7 (depends on 1)

The method of claim 1 wherein the repacking further comprises repacking based on at least one of a threshold value of threads active in the wavefronts, a memory affinity of each work item, an amount of divergence of a workgroup, and a relative resource use cost of running the repacking code.

### Claim 8 (depends on 1)

The method of claim 1 wherein storing the plurality of local register states includes allocating local data store memory for storing the plurality of local register state.

### Claim 9

A method for operating a computing system, the method comprising:
allocating local data store memory for storing a plurality of local register states for work items to be executed in single instruction multiple data hardware;
allocating a state pointer stack that includes a plurality of state pointer entries that are each associated with a respective entry of the plurality of local register states;
generating a dereference to one of the state pointer entries responsive to a reference to a local variable;
sorting the state pointer entries based on results of a conditional statement; and
repacking wavefronts that include work items associated with a program instruction responsive to the conditional statement, wherein the repacking is configured to create repacked wavefronts based on the sorted state pointer entries that include at least one of a wavefront containing work items that all pass the conditional statement and a wavefront containing work items that all fail the conditional statement.

### Claim 10 (depends on 9)

The method of claim 9 wherein the repacking the wavefronts includes incrementing a level of the state pointer stack.

### Claim 11 (depends on 10)

The method of claim 10 further comprising determining whether the program instruction is a first instruction of an immediate post dominator basic block and decrementing the level of the state pointer stack when the program instruction is the first instruction of the immediate post dominator basic block.

### Claim 12 (depends on 9)

The method of claim 9 wherein the repacking further comprises repacking based on at least one of a threshold value of threads active in the wavefronts, a memory affinity of each work item, an amount of divergence of a workgroup, and a relative resource use cost of running the repacking code.

### Claim 13

A non-transitory computer readable medium storing control logic, the control logic including control logic instructions to:
store, in a memory, a plurality of register states, each register state associated with a corresponding one of a plurality of work items to be executed in single instruction multiple data hardware;
generate a state pointer stack, the state pointer stack comprising one or more levels of state pointer entries, each state pointer entry associated with a corresponding one of the work items and indicating a respective entry of the local register states;
analyze a conditional statement for at least some of the work items; and
repack wavefronts that include the work items based on a result of the analyzing, wherein the repacking comprises rearranging the state pointer entries in one or more levels of the state pointer stack to cause the work items to be executed in a corresponding order.

### Claim 14 (depends on 13)

The non-transitory computer readable medium of claim 13 wherein the control logic further comprises control logic instructions to:
dereference one of the state pointer entries when the conditional statement program instruction includes a reference to a local variable.

### Claim 15 (depends on 14)

The non-transitory computer readable medium of claim 14 wherein the repacking further increments a level of the state pointer stack.

### Claim 16 (depends on 13)

The non-transitory computer readable medium of claim 13 wherein the control logic further comprises control logic instructions to determine whether the program instruction is a first program instruction of an immediate post dominator basic block and to decrement the level of the state pointer stack when the program instruction is the first program instruction of the immediate post dominator basic block.

### Claim 17 (depends on 13)

The non-transitory computer readable medium of claim 13 wherein the repacking further comprises:
packing the rearranged state pointer entries into the repacked wavefronts.

### Claim 18 (depends on 17)

The non-transitory computer readable medium of claim 17 wherein the repacking further comprises determining whether the wavefronts are to be repacked based on at least one of a threshold value of threads active in the wavefronts, a memory affinity of each work item, an amount of divergence of a workgroup, and a relative resource use cost of running the repacking code.

### Claim 19 (depends on 13)

The non-transitory computer readable medium of claim 13 wherein the control logic further comprises control logic instructions to allocate local data store memory for storing the plurality of local register states.

### Claim 20

A computing system comprising:
a processor including control logic configured to:
store, in a memory, a plurality of register states, each register state associated with a corresponding one of a plurality of work items to be executed in single instruction multiple data hardware;
generate a state pointer stack, the state pointer stack comprising one or more levels of state pointer entries, each state pointer entry associated with a corresponding one of the work items and indicating a respective entry of the local register states;
analyze a conditional statement for at least some of the work items; and
repack wavefronts that include the work items based on a result of the analyzing, wherein the repacking comprises rearranging the state pointer entries in one or more levels of the state pointer stack to cause the work items to be executed in a corresponding order.

### Claim 21 (depends on 20)

The computing system of claim 20 wherein the control logic is further configured to:
generate a dereference to one of the state pointer entries responsive to a reference to a local variable.

### Claim 22 (depends on 21)

The computing system of claim 21 wherein repacking the wavefronts includes incrementing a level of the state pointer stack.

### Claim 23 (depends on 22)

The computing system of claim 22 wherein the control logic is further configured to determine whether the program instruction is a first instruction of an immediate post dominator basic block.

### Claim 24 (depends on 23)

The computing system of claim 23 wherein the control logic is further configured to decrement the level of the state pointer stack when the program instruction is the first instruction of the immediate post dominator basic block.

### Claim 25 (depends on 20)

The computing system of claim 20 wherein the control logic is further configured to:
pack the rearranged state pointer entries into the repacked wavefronts.

### Claim 26 (depends on 20)

The computing system of claim 20 wherein the repacking further comprises repacking based on at least one of a threshold value of threads active in the wavefronts, a memory affinity of each work item, an amount of divergence of a workgroup, and a relative resource use cost of running the repacking code.

### Claim 27 (depends on 20)

The computing system of claim 20 wherein the control logic is further configured to allocate local data store memory for storing the plurality of local register state.
