Halide
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 ()
 
 DeviceArgument (const std::string &_name, bool _is_buffer, Type _type, uint8_t _dimensions, size_t _size=0)
 

Public Attributes

std::string name
 The name of the argument. More...
 
bool is_buffer
 An argument is either a primitive type (for parameters), or a buffer pointer. More...
 
uint8_t dimensions
 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
 The static size of the argument if known, or zero otherwise. More...
 
size_t packed_index
 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
 For buffers, these two variables can be used to specify whether the buffer is read or written. More...
 
bool write
 
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 ( )
inline

Definition at line 67 of file DeviceArgument.h.

◆ DeviceArgument() [2/2]

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

Definition at line 76 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

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.

◆ dimensions

uint8_t Halide::Internal::DeviceArgument::dimensions

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 41 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 49 of file DeviceArgument.h.

◆ size

size_t Halide::Internal::DeviceArgument::size

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

Definition at line 52 of file DeviceArgument.h.

◆ packed_index

size_t Halide::Internal::DeviceArgument::packed_index

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 56 of file DeviceArgument.h.

◆ read

bool Halide::Internal::DeviceArgument::read

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 61 of file DeviceArgument.h.

◆ write

bool Halide::Internal::DeviceArgument::write

Definition at line 62 of file DeviceArgument.h.

◆ alignment

ModulusRemainder Halide::Internal::DeviceArgument::alignment

Alignment information for integer parameters.

Definition at line 65 of file DeviceArgument.h.


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