# US 2021/0287325 A1 · Single pass downsampler

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

- Number: US 2021/0287325 A1
- Document ID: US20210287325A1
- Status: Published application
- Kind: A1
- Application number: 17/182,952
- Filed: 2021-02-23
- Published: 2021-09-16
- Earliest claimed: 2020-03-13
- Assignees: Advanced Micro Devices, Inc.
- Applicants: Advanced Micro Devices, Inc.
- Inventors: Lou Isabelle Kramer; Matthäus G. Chajdas
- Web page: https://patentgrep.com/patent/US20210287325A1

## CPC

- G06T 1/20: Processor architectures; Processor configuration, e.g. pipelining
- G06F 9/4881: {Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues}
- G06T 3/40: Scaling of whole images or parts thereof, e.g. expanding or contracting
- G06T 11/10: Texturing; Colouring; Generation of textures or colours (retouching, inpainting or scratch removal G06T5/77)
- G06T 15/04: Texture mapping
- G06T: IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Systems, apparatuses, and methods for implementing a downsampler in a single compute shader pass are disclosed. A central processing unit (CPU) issues a single-pass compute shader kernel to perform downsampling of a texture on a graphics processing unit (GPU). The GPU includes a plurality of compute units for executing thread groups of the kernel. Each thread group fetches a patch of the texture, and each individual thread downsamples four quads of texels to compute mip levels 1 and 2 independently of the other threads. For mip level 3, texel data is written back over one of the local data share (LDS) entries from which the texel data was loaded. This eliminates the need for a barrier between loads and stores for computing mip level 3. The remaining mip levels are computed in a similar fashion by the thread groups of the single-pass kernel.

## Claims

### Claim 1

An apparatus comprising:
an interface configured to access a memory storing source image texture data; and
a plurality of execution units configured to:
execute a plurality of thread groups to downsample a plurality of patches of the source image texture to generate one or more higher mipmap levels for the texture;
execute a last active thread group to compute remaining mipmap levels for the texture; and
render pixels to be driven to a display based on one or more mipmap level texels.

### Claim 2 (depends on 1)

The apparatus as recited in claim 1, further comprising a scheduling unit configured to launch the plurality of thread groups on the plurality of execution units responsive to receiving a single-pass downsampling kernel.

### Claim 3 (depends on 1)

The apparatus as recited in claim 1, wherein the plurality of execution units are further configured to execute the plurality of thread groups to downsample the plurality of patches of the texture down to a single texel, wherein each thread group executes independently of other thread groups.

### Claim 4 (depends on 3)

The apparatus as recited in claim 3, wherein each thread group of the plurality of thread groups comprises a plurality of threads, and wherein the plurality of execution units are further configured to:
execute each thread group to fetch a plurality of texels in a corresponding patch of the texture; and
downsample, by each thread of each thread group, a sub-patch of texels to compute texels at a first mipmap level and a second mipmap level.

### Claim 5 (depends on 4)

The apparatus as recited in claim 4, wherein the plurality of execution units are further configured to:
store, by each thread, one or more second mipmap level texels as a result of downsampling the sub-patch of texels; and
execute the last active thread group to compute the remaining mipmap levels using the plurality of downsampled single texels generated from the plurality of patches of the source image texture.

### Claim 6 (depends on 5)

The apparatus as recited in claim 5, wherein the plurality of execution units are further configured to alternate between executing local data share (LDS) reduction operations and wavefront reduction operations when computing texels at the first mipmap level, second mipmap level, and third mipmap level.

### Claim 7 (depends on 5)

The apparatus as recited in claim 5, wherein the plurality of execution units are further configured to execute a subset of threads of each thread group to compute texels at a third mipmap level.

### Claim 8

A method comprising:
executing, by a plurality of execution units, a plurality of thread groups to downsample a plurality of patches of a source image texture to generate one or more higher mipmap levels for the texture;
executing a last active thread group to compute remaining mipmap levels for the texture; and
rendering pixels to be driven to a display based on one or more mipmap level texels.

### Claim 9 (depends on 8)

The method as recited in claim 8, further comprising launching the plurality of thread groups on the plurality of execution units responsive to receiving a single-pass downsampling kernel, wherein the single-pass downsampling kernel is a compute shader kernel.

### Claim 10 (depends on 9)

The method as recited in claim 9, further comprising alternating between executing local data share (LDS) reduction operations and wavefront reduction operations when computing texels at a first mipmap level, second mipmap level, and third mipmap level.

### Claim 11 (depends on 9)

The method as recited in claim 9, further comprising executing a subset of threads of each thread group to compute texels at a third mipmap level.

### Claim 12 (depends on 11)

The method as recited in claim 11, further comprising executing the subset of threads to store third mipmap level texels to a subset of LDS entries which were used for loading second mip level texels.

### Claim 13 (depends on 8)

The method as recited in claim 8, further comprising:
maintaining an atomic counter;
incrementing the atomic counter each time a patch has been processed by a corresponding thread group; and
executing the last active thread group to compute the remaining mipmap levels responsive to the atomic counter reaching a threshold.

### Claim 14 (depends on 8)

The method as recited in claim 8, further comprising generating thread indices for fetching pixels based on a Morton ordering pattern.

### Claim 15

A system comprising:
a first processor; and
a second processor configured to:
receive a single-pass downsampling kernel from the first processor, wherein the kernel comprises a plurality of thread groups;
execute the plurality of thread groups to downsample a plurality of patches of a source image texture to generate one or more higher mipmap levels for the texture;
execute a last active thread group to compute remaining mipmap levels for the texture; and
render pixels to be driven to a display based on one or more mipmap level texels.

### Claim 16 (depends on 15)

The system as recited in claim 15, wherein the second processor is further configured to execute the plurality of thread groups to downsample the plurality of patches of the texture down to a single texel, wherein each thread group executes independently of other thread groups.

### Claim 17 (depends on 16)

The system as recited in claim 16, wherein the second processor is further configured to alternate between executing local data share (LDS) reduction operations and wavefront reduction operations when computing texels at a first mipmap level, second mipmap level, and third mipmap level.

### Claim 18 (depends on 16)

The system as recited in claim 16, wherein the second processor is further configured to execute a subset of threads of each thread group to compute texels at a third mipmap level.

### Claim 19 (depends on 18)

The system as recited in claim 18, wherein the second processor is further configured to execute the subset of threads to store third mipmap level texels to a subset of LDS entries which were used for loading second mip level texels.

### Claim 20 (depends on 15)

The system as recited in claim 15, wherein the second processor is further configured to:
maintain an atomic counter;
increment the atomic counter each time a patch has been processed by a corresponding thread group; and
execute the last active thread group to compute the remaining mipmap levels responsive to the atomic counter reaching a threshold.
