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 ()
 
 Argument (const std::string &_name, Kind _kind, const Type &_type, int _dimensions, Expr _def=Expr(), Expr _min=Expr(), Expr _max=Expr())
 
template<typename T >
 Argument (Buffer< T > 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
 
uint8_t dimensions
 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...
 
Expr def
 If this is a scalar parameter, then these are its default, min, max values. More...
 
Expr min
 
Expr max
 

Detailed Description

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

Used for specifying the function signature of generated code.

Definition at line 22 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 37 of file Argument.h.

Constructor & Destructor Documentation

◆ Argument() [1/3]

Halide::Argument::Argument ( )
inline

Definition at line 60 of file Argument.h.

◆ Argument() [2/3]

Halide::Argument::Argument ( const std::string &  _name,
Kind  _kind,
const Type _type,
int  _dimensions,
Expr  _def = Expr(),
Expr  _min = Expr(),
Expr  _max = Expr() 
)
inline

◆ Argument() [3/3]

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

Definition at line 78 of file Argument.h.

Member Function Documentation

◆ is_buffer()

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

Definition at line 84 of file Argument.h.

References InputBuffer, and OutputBuffer.

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

◆ is_scalar()

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

Definition at line 85 of file Argument.h.

References InputScalar.

Referenced by Argument().

◆ is_input()

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

Definition at line 87 of file Argument.h.

References InputBuffer, and InputScalar.

◆ is_output()

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

Definition at line 88 of file Argument.h.

References OutputBuffer.

◆ operator==()

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

Definition at line 90 of file Argument.h.

References def, dimensions, kind, max, min, name, Halide::Internal::IntrusivePtr< T >::same_as(), and type.

Member Data Documentation

◆ name

std::string Halide::Argument::name

The name of the argument.

Definition at line 24 of file Argument.h.

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

◆ kind

Kind Halide::Argument::kind

Definition at line 42 of file Argument.h.

Referenced by operator==().

◆ dimensions

uint8_t Halide::Argument::dimensions

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 46 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 54 of file Argument.h.

Referenced by operator==().

◆ def

Expr Halide::Argument::def

If this is a scalar parameter, then these are its default, min, max values.

By default, they are left unset, implying "no default, no min, no max".

Definition at line 58 of file Argument.h.

Referenced by operator==().

◆ min

Expr Halide::Argument::min

Definition at line 58 of file Argument.h.

Referenced by operator==().

◆ max

Expr Halide::Argument::max

Definition at line 58 of file Argument.h.

Referenced by operator==().


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