Halide 22.0.0 Halide compiler and libraries

Public Member Functions | Public Attributes | List of all members
Halide::Internal::DeviceArgument Struct Reference

A DeviceArgument looks similar to an Halide::Argument, but has behavioral differences that make it specific to the GPU pipeline; the fact that neither is-a nor has-a Halide::Argument is deliberate. More...

`#include <DeviceArgument.h>`

## Public Member Functions
| DeviceArgument ()=default
| DeviceArgument (const std::string &_name, bool _is_buffer, MemoryType _mem, Type _type, uint8_t _dimensions, size_t _size=0)

## Public Attributes
std::string | name
| The name of the argument. More...
bool | is_buffer = false
| An argument is either a primitive type (for parameters), or a buffer pointer. More...
MemoryType | memory_type = MemoryType::Auto
| If is_buffer == true and memory_type == GPUTexture, this argument should be passed and accessed through texture sampler operations instead of directly as a memory array. More...
uint8_t | dimensions = 0
| If is_buffer is true, this is the dimensionality of the buffer. More...
Type | type
| If this is a scalar parameter, then this is its type. More...
size_t | size = 0
| The static size of the argument if known, or zero otherwise. More...
size_t | packed_index = 0
| The index of the first element of the argument when packed into a wider type, such as packing scalar floats into vec4 for GLSL. More...
bool | read = false
| For buffers, these two variables can be used to specify whether the buffer is read or written. More...
bool | write = false
ModulusRemainder | alignment
| Alignment information for integer parameters. More...

## Detailed Description

A DeviceArgument looks similar to an Halide::Argument, but has behavioral differences that make it specific to the GPU pipeline; the fact that neither is-a nor has-a Halide::Argument is deliberate.

In particular, note that a Halide::Argument that is a buffer can be read or write, but not both, while a DeviceArgument that is a buffer can be read and write for some GPU backends.

Definition at line 22 of file DeviceArgument.h.

## Constructor & Destructor Documentation

## ◆ DeviceArgument() [1/2]

Halide::Internal::DeviceArgument::DeviceArgument | ( |  | ) |
| default

## ◆ DeviceArgument() [2/2]

Halide::Internal::DeviceArgument::DeviceArgument | ( | const std::string & | _name,
|  | bool | _is_buffer,
|  | MemoryType | _mem,
|  | Type | _type,
|  | uint8_t | _dimensions,
|  | size_t | _size = `0`
| ) |  |
| inline

Definition at line 75 of file DeviceArgument.h.

## Member Data Documentation

## ◆ name

std::string Halide::Internal::DeviceArgument::name

The name of the argument.

Definition at line 24 of file DeviceArgument.h.

## ◆ is_buffer

bool Halide::Internal::DeviceArgument::is_buffer = false

An argument is either a primitive type (for parameters), or a buffer pointer.

If is_buffer == false, then type fully encodes the expected type of the scalar argument.

If is_buffer == true, then type.bytes() should be used to determine elem_size of the buffer; additionally, type.code should reflect the expected interpretation of the buffer data (e.g. float vs int), but there is no runtime enforcement of this at present.

Definition at line 37 of file DeviceArgument.h.

## ◆ memory_type

MemoryType Halide::Internal::DeviceArgument::memory_type = MemoryType::Auto

If is_buffer == true and memory_type == GPUTexture, this argument should be passed and accessed through texture sampler operations instead of directly as a memory array.

Definition at line 43 of file DeviceArgument.h.

## ◆ dimensions

uint8_t Halide::Internal::DeviceArgument::dimensions = 0

If is_buffer is true, this is the dimensionality of the buffer.

If is_buffer is false, this value is ignored (and should always be set to zero)

Definition at line 47 of file DeviceArgument.h.

## ◆ type

Type Halide::Internal::DeviceArgument::type

If this is a scalar parameter, then this is its type.

If this is a buffer parameter, this is used to determine elem_size of the halide_buffer_t.

Note that type.lanes() should always be 1 here.

Definition at line 55 of file DeviceArgument.h.

## ◆ size

size_t Halide::Internal::DeviceArgument::size = 0

The static size of the argument if known, or zero otherwise.

Definition at line 58 of file DeviceArgument.h.

## ◆ packed_index

size_t Halide::Internal::DeviceArgument::packed_index = 0

The index of the first element of the argument when packed into a wider type, such as packing scalar floats into vec4 for GLSL.

Definition at line 62 of file DeviceArgument.h.

## ◆ read

bool Halide::Internal::DeviceArgument::read = false

For buffers, these two variables can be used to specify whether the buffer is read or written.

By default, we assume that the argument buffer is read-write and set both flags.

Definition at line 67 of file DeviceArgument.h.

## ◆ write

bool Halide::Internal::DeviceArgument::write = false

Definition at line 68 of file DeviceArgument.h.

## ◆ alignment

ModulusRemainder Halide::Internal::DeviceArgument::alignment

Alignment information for integer parameters.

Definition at line 71 of file DeviceArgument.h.

The documentation for this struct was generated from the following file:

- src/DeviceArgument.h