# US 2021/0065441 A1 · Machine learning-based technique for execution mode selection

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

- Number: US 2021/0065441 A1
- Document ID: US20210065441A1
- Status: Published application
- Kind: A1
- Application number: 16/584,750
- Filed: 2019-09-26
- Published: 2021-03-04
- Earliest claimed: 2019-08-29
- Assignees: Advanced Micro Devices, Inc.
- Applicants: Advanced Micro Devices, Inc.
- Inventors: Ian Charles Colbert; Michael John Bedy
- Web page: https://patentgrep.com/patent/US20210065441A1

## CPC

- G06T 15/80: Shading
- G06F 8/38: for implementing user interfaces
- G06F 8/4443: {Inlining}
- G06N 20/00: Machine learning
- G06T 15/005: {General purpose rendering architectures}
- G06T: IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- G06N: COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS

## Abstract

Described herein are techniques for generating a compiled shader program. The techniques include identifying input features of a shader program, providing the identified input features of the shader program to a trained model for selecting compiler operation values for shader programs, receiving, as output from the trained model, a compiler operation value for the shader program, and generating a compiled shader program based on the compiler operation value for execution on one or more compute units.

## Claims

### Claim 1

A method for generating a compiled shader program, the method comprising:
identifying input features of a shader program;
providing the identified input features of the shader program to a trained model for selecting compiler operation values for shader programs;
receiving, as output from the trained model, a compiler operation value for the shader program; and
generating a compiled shader program based on the compiler operation value for execution on one or more compute units.

### Claim 2 (depends on 1)

The method of claim 1, wherein the input features comprise features of the shader program that are determined by instructions of the shader program.

### Claim 3 (depends on 1)

The method of claim 1, wherein the input features comprise one or more of registers used by the shader program, memory used by the shader program, and number of instructions in the shader program.

### Claim 4 (depends on 1)

The method of claim 1, wherein the compiler operation values comprise one or more of wavefront size, whether to perform loop unrolling, enabling or disabling backface culling, whether to perform function inlining, the number of registers used, or other values.

### Claim 5 (depends on 1)

The method of claim 1, wherein the trained model comprises a machine learning-trained model trained for selecting a set of compiler operation values for shader programs given a set of input features.

### Claim 6 (depends on 1)

The method of claim 1, further comprising generating the trained model through a training technique.

### Claim 7 (depends on 6)

The method of claim 6, wherein generating the trained model comprises providing a set of samples to a model trainer, wherein each sample includes one or more input features for an executed test shader program and one or more compiler operation values selected to generate execution performance of the test shader deemed to be optimal.

### Claim 8 (depends on 7)

The method of claim 7, wherein the set of samples includes multiple samples for a test shader program, each sample being for execution of the test shader program compiled with a different compiler version.

### Claim 9 (depends on 1)

The method of claim 1, further comprising:
modifying the shader program based on the compiler operation value.

### Claim 10

A computer system comprising:
a compiler; and
one or more compute units configured to execute shader programs,
wherein the compiler is configured to:
identify input features of a shader program;
provide the identified input features of the shader program to a trained model for selecting compiler operation values for shader programs;
receive, as output from the trained model, a compiler operation value for the shader program; and
generate a compiled shader program based on the compiler operation value for execution on the one or more compute units.

### Claim 11 (depends on 10)

The computer system of claim 10, wherein the input features comprise features of the shader program that are determined by instructions of the shader program.

### Claim 12 (depends on 10)

The computer system of claim 10, wherein the input features comprise one or more of registers used by the shader program, memory used by the shader program, and number of instructions in the shader program.

### Claim 13 (depends on 10)

The computer system of claim 10, wherein the compiler operation values comprises one or more of wavefront size, whether to perform loop unrolling, enabling or disabling backface culling, whether to perform function inlining, the number of registers used, or other values.

### Claim 14 (depends on 10)

The computer system of claim 10, wherein the trained model comprises a machine learning-trained model trained for selecting a set of compiler operation values for shader programs given a set of input features.

### Claim 15 (depends on 10)

The computer system of claim 10, further comprising a trainer configured to generate the trained model through a training technique.

### Claim 16 (depends on 15)

The computer system of claim 15, wherein generating the trained model comprises providing a set of samples to a model trainer, wherein each sample includes one or more input features for an executed test shader program and one or more compiler operation values selected to generate execution performance of the test shader deemed to be optimal.

### Claim 17 (depends on 16)

The computer system of claim 16, wherein the set of samples includes multiple samples for a test shader program, each sample being for execution of the test shader program compiled with a different compiler version.

### Claim 18

A non-transitory computer-readable medium storing instructions that, when executed by a processor, cause the processor to generate a compiled shader program, by:
identifying input features of a shader program;
providing the identified input features of the shader program to a trained model for selecting compiler operation values for shader programs;
receiving, as output from the trained model, a compiler operation value for the shader program; and
generating a compiled shader program based on the compiler operation value for execution on one or more compute units.

### Claim 19 (depends on 18)

The non-transitory computer-readable medium of claim 18, wherein the input features comprise features of the shader program that are determined by instructions of the shader program.

### Claim 20 (depends on 18)

The non-transitory computer-readable medium of claim 18, wherein the compiler operation values comprise one or more of wavefront size, whether to perform loop unrolling, enabling or disabling backface culling, whether to perform function inlining, the number of registers used, or other values.
