Halide
Halide::Argument Struct Reference

A struct representing an argument to a halide-generated function. More...

#include <Argument.h>

Inherited by Halide::Internal::LoweredArgument.

Public Types

enum  Kind { InputScalar = halide_argument_kind_input_scalar, InputBuffer = halide_argument_kind_input_buffer, OutputBuffer = halide_argument_kind_output_buffer }
 An argument is either a primitive type (for parameters), or a buffer pointer. More...
 

Public Member Functions

 Argument ()=default
 
 Argument (const std::string &_name, Kind _kind, const Type &_type, int _dimensions, const ArgumentEstimates &argument_estimates)
 
template<typename T , int Dims>
 Argument (Buffer< T, Dims > im)
 
bool is_buffer () const
 
bool is_scalar () const
 
bool is_input () const
 
bool is_output () const
 
bool operator== (const Argument &rhs) const
 

Public Attributes

std::string name
 The name of the argument. More...
 
Kind kind = InputScalar
 
uint8_t dimensions = 0
 If kind == InputBuffer|OutputBuffer, this is the dimensionality of the buffer. More...
 
Type type
 If this is a scalar parameter, then this is its type. More...
 
ArgumentEstimates argument_estimates
 

Detailed Description

A struct representing an argument to a halide-generated function.

Used for specifying the function signature of generated code.

Definition at line 37 of file Argument.h.

Member Enumeration Documentation

◆ Kind

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

If kind == InputScalar, then type fully encodes the expected type of the scalar argument.

If kind == InputBuffer|OutputBuffer, 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.

Enumerator
InputScalar 
InputBuffer 
OutputBuffer 

Definition at line 52 of file Argument.h.

Constructor & Destructor Documentation

◆ Argument() [1/3]

Halide::Argument::Argument ( )
default

◆ Argument() [2/3]

Halide::Argument::Argument ( const std::string &  _name,
Kind  _kind,
const Type _type,
int  _dimensions,
const ArgumentEstimates argument_estimates 
)

◆ Argument() [3/3]

template<typename T , int Dims>
Halide::Argument::Argument ( Buffer< T, Dims >  im)
inline

Definition at line 82 of file Argument.h.

Member Function Documentation

◆ is_buffer()

bool Halide::Argument::is_buffer ( ) const
inline

Definition at line 89 of file Argument.h.

References InputBuffer, kind, and OutputBuffer.

Referenced by Halide::Internal::InferredArgument::operator<().

◆ is_scalar()

bool Halide::Argument::is_scalar ( ) const
inline

Definition at line 92 of file Argument.h.

References InputScalar, and kind.

◆ is_input()

bool Halide::Argument::is_input ( ) const
inline

Definition at line 96 of file Argument.h.

References InputBuffer, InputScalar, and kind.

◆ is_output()

bool Halide::Argument::is_output ( ) const
inline

Definition at line 99 of file Argument.h.

References kind, and OutputBuffer.

◆ operator==()

bool Halide::Argument::operator== ( const Argument rhs) const
inline

Definition at line 103 of file Argument.h.

References argument_estimates, dimensions, kind, name, and type.

Member Data Documentation

◆ name

std::string Halide::Argument::name

The name of the argument.

Definition at line 39 of file Argument.h.

Referenced by Halide::Internal::InferredArgument::operator<(), and operator==().

◆ kind

Kind Halide::Argument::kind = InputScalar

Definition at line 57 of file Argument.h.

Referenced by is_buffer(), is_input(), is_output(), is_scalar(), and operator==().

◆ dimensions

uint8_t Halide::Argument::dimensions = 0

If kind == InputBuffer|OutputBuffer, this is the dimensionality of the buffer.

If kind == InputScalar, this value is ignored (and should always be set to zero)

Definition at line 61 of file Argument.h.

Referenced by operator==().

◆ type

Type Halide::Argument::type

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

If this is a buffer parameter, this this is the type of its elements.

Note that type.lanes should always be 1 here.

Definition at line 69 of file Argument.h.

Referenced by operator==().

◆ argument_estimates

ArgumentEstimates Halide::Argument::argument_estimates

Definition at line 72 of file Argument.h.

Referenced by operator==().


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