Halide
Halide::Internal::Parameter Class Reference

A reference-counted handle to a parameter to a halide pipeline. More...

#include <Parameter.h>

Public Member Functions

 Parameter ()=default
 Construct a new undefined handle. More...
 
 Parameter (const Type &t, bool is_buffer, int dimensions)
 Construct a new parameter of the given type. More...
 
 Parameter (const Type &t, bool is_buffer, int dimensions, const std::string &name)
 Construct a new parameter of the given type with name given by the third argument. More...
 
 Parameter (const Parameter &)=default
 
Parameteroperator= (const Parameter &)=default
 
 Parameter (Parameter &&)=default
 
Parameteroperator= (Parameter &&)=default
 
Type type () const
 Get the type of this parameter. More...
 
int dimensions () const
 Get the dimensionality of this parameter. More...
 
const std::string & name () const
 Get the name of this parameter. More...
 
bool is_buffer () const
 Does this parameter refer to a buffer/image? More...
 
template<typename T >
HALIDE_NO_USER_CODE_INLINEscalar () const
 If the parameter is a scalar parameter, get its currently bound value. More...
 
Expr scalar_expr () const
 This returns the current value of scalar<type()>() as an Expr. More...
 
template<typename T >
HALIDE_NO_USER_CODE_INLINE void set_scalar (T val)
 If the parameter is a scalar parameter, set its current value. More...
 
HALIDE_NO_USER_CODE_INLINE void set_scalar (const Type &val_type, halide_scalar_value_t val)
 If the parameter is a scalar parameter, set its current value. More...
 
Buffer< void > buffer () const
 If the parameter is a buffer parameter, get its currently bound buffer. More...
 
const halide_buffer_traw_buffer () const
 Get the raw currently-bound buffer. More...
 
void set_buffer (const Buffer< void > &b)
 If the parameter is a buffer parameter, set its current value. More...
 
void * scalar_address () const
 Get the pointer to the current value of the scalar parameter. More...
 
bool same_as (const Parameter &other) const
 Tests if this handle is the same as another handle. More...
 
bool defined () const
 Tests if this handle is non-nullptr. More...
 
void set_min_constraint (int dim, Expr e)
 Get and set constraints for the min, extent, stride, and estimates on the min/extent. More...
 
void set_extent_constraint (int dim, Expr e)
 
void set_stride_constraint (int dim, Expr e)
 
void set_min_constraint_estimate (int dim, Expr min)
 
void set_extent_constraint_estimate (int dim, Expr extent)
 
void set_host_alignment (int bytes)
 
Expr min_constraint (int dim) const
 
Expr extent_constraint (int dim) const
 
Expr stride_constraint (int dim) const
 
Expr min_constraint_estimate (int dim) const
 
Expr extent_constraint_estimate (int dim) const
 
int host_alignment () const
 
void set_min_value (const Expr &e)
 Get and set constraints for scalar parameters. More...
 
Expr min_value () const
 
void set_max_value (const Expr &e)
 
Expr max_value () const
 
void set_estimate (Expr e)
 
Expr estimate () const
 
void set_default_value (const Expr &e)
 Get and set the default values for scalar parameters. More...
 
Expr default_value () const
 
bool operator< (const Parameter &other) const
 Order Parameters by their IntrusivePtr so they can be used to index maps. More...
 
ArgumentEstimates get_argument_estimates () const
 Get the ArgumentEstimates appropriate for this Parameter. More...
 
void store_in (MemoryType memory_type)
 
MemoryType memory_type () const
 

Protected Attributes

IntrusivePtr< ParameterContents > contents
 

Detailed Description

A reference-counted handle to a parameter to a halide pipeline.

May be a scalar parameter or a buffer

Definition at line 28 of file Parameter.h.

Constructor & Destructor Documentation

◆ Parameter() [1/5]

Halide::Internal::Parameter::Parameter ( )
default

Construct a new undefined handle.

◆ Parameter() [2/5]

Halide::Internal::Parameter::Parameter ( const Type t,
bool  is_buffer,
int  dimensions 
)

Construct a new parameter of the given type.

If the second argument is true, this is a buffer parameter of the given dimensionality, otherwise, it is a scalar parameter (and the dimensionality should be zero). The parameter will be given a unique auto-generated name.

◆ Parameter() [3/5]

Halide::Internal::Parameter::Parameter ( const Type t,
bool  is_buffer,
int  dimensions,
const std::string &  name 
)

Construct a new parameter of the given type with name given by the third argument.

If the second argument is true, this is a buffer parameter, otherwise, it is a scalar parameter. The third argument gives the dimensionality of the buffer parameter. It should be zero for scalar parameters. If the fifth argument is true, the the name being passed in was explicitly specified (as opposed to autogenerated).

◆ Parameter() [4/5]

Halide::Internal::Parameter::Parameter ( const Parameter )
default

◆ Parameter() [5/5]

Halide::Internal::Parameter::Parameter ( Parameter &&  )
default

Member Function Documentation

◆ operator=() [1/2]

Parameter& Halide::Internal::Parameter::operator= ( const Parameter )
default

◆ operator=() [2/2]

Parameter& Halide::Internal::Parameter::operator= ( Parameter &&  )
default

◆ type()

◆ dimensions()

int Halide::Internal::Parameter::dimensions ( ) const

Get the dimensionality of this parameter.

Zero for scalars.

◆ name()

const std::string& Halide::Internal::Parameter::name ( ) const

Get the name of this parameter.

Referenced by Halide::Internal::Call::make(), and Halide::Param< T >::name().

◆ is_buffer()

bool Halide::Internal::Parameter::is_buffer ( ) const

Does this parameter refer to a buffer/image?

Referenced by Halide::ExternFuncArgument::ExternFuncArgument().

◆ scalar()

template<typename T >
HALIDE_NO_USER_CODE_INLINE T Halide::Internal::Parameter::scalar ( ) const
inline

If the parameter is a scalar parameter, get its currently bound value.

Only relevant when jitting

Definition at line 78 of file Parameter.h.

References scalar_address().

Referenced by Halide::Param< T >::get().

◆ scalar_expr()

Expr Halide::Internal::Parameter::scalar_expr ( ) const

This returns the current value of scalar<type()>() as an Expr.

◆ set_scalar() [1/2]

template<typename T >
HALIDE_NO_USER_CODE_INLINE void Halide::Internal::Parameter::set_scalar ( val)
inline

If the parameter is a scalar parameter, set its current value.

Only relevant when jitting

Definition at line 90 of file Parameter.h.

References scalar_address().

Referenced by Halide::Param< T >::set(), and Halide::Internal::GeneratorInput_Scalar< T >::set_def_min_max().

◆ set_scalar() [2/2]

HALIDE_NO_USER_CODE_INLINE void Halide::Internal::Parameter::set_scalar ( const Type val_type,
halide_scalar_value_t  val 
)
inline

If the parameter is a scalar parameter, set its current value.

Only relevant when jitting

Definition at line 97 of file Parameter.h.

References Halide::Type::bytes(), memcpy(), and scalar_address().

◆ buffer()

Buffer<void> Halide::Internal::Parameter::buffer ( ) const

If the parameter is a buffer parameter, get its currently bound buffer.

Only relevant when jitting

◆ raw_buffer()

const halide_buffer_t* Halide::Internal::Parameter::raw_buffer ( ) const

Get the raw currently-bound buffer.

null if unbound

◆ set_buffer()

void Halide::Internal::Parameter::set_buffer ( const Buffer< void > &  b)

If the parameter is a buffer parameter, set its current value.

Only relevant when jitting

◆ scalar_address()

void* Halide::Internal::Parameter::scalar_address ( ) const

Get the pointer to the current value of the scalar parameter.

For a given parameter, this address will never change. Only relevant when jitting.

Referenced by scalar(), and set_scalar().

◆ same_as()

bool Halide::Internal::Parameter::same_as ( const Parameter other) const

Tests if this handle is the same as another handle.

◆ defined()

bool Halide::Internal::Parameter::defined ( ) const

Tests if this handle is non-nullptr.

◆ set_min_constraint()

void Halide::Internal::Parameter::set_min_constraint ( int  dim,
Expr  e 
)

Get and set constraints for the min, extent, stride, and estimates on the min/extent.

◆ set_extent_constraint()

void Halide::Internal::Parameter::set_extent_constraint ( int  dim,
Expr  e 
)

◆ set_stride_constraint()

void Halide::Internal::Parameter::set_stride_constraint ( int  dim,
Expr  e 
)

◆ set_min_constraint_estimate()

void Halide::Internal::Parameter::set_min_constraint_estimate ( int  dim,
Expr  min 
)

◆ set_extent_constraint_estimate()

void Halide::Internal::Parameter::set_extent_constraint_estimate ( int  dim,
Expr  extent 
)

◆ set_host_alignment()

void Halide::Internal::Parameter::set_host_alignment ( int  bytes)

◆ min_constraint()

Expr Halide::Internal::Parameter::min_constraint ( int  dim) const

◆ extent_constraint()

Expr Halide::Internal::Parameter::extent_constraint ( int  dim) const

◆ stride_constraint()

Expr Halide::Internal::Parameter::stride_constraint ( int  dim) const

◆ min_constraint_estimate()

Expr Halide::Internal::Parameter::min_constraint_estimate ( int  dim) const

◆ extent_constraint_estimate()

Expr Halide::Internal::Parameter::extent_constraint_estimate ( int  dim) const

◆ host_alignment()

int Halide::Internal::Parameter::host_alignment ( ) const

◆ set_min_value()

void Halide::Internal::Parameter::set_min_value ( const Expr e)

Get and set constraints for scalar parameters.

These are used directly by Param, so they must be exported.

Referenced by Halide::Internal::GeneratorInput_Arithmetic< T >::set_def_min_max(), and Halide::Param< T >::set_min_value().

◆ min_value()

Expr Halide::Internal::Parameter::min_value ( ) const

◆ set_max_value()

void Halide::Internal::Parameter::set_max_value ( const Expr e)

◆ max_value()

Expr Halide::Internal::Parameter::max_value ( ) const

◆ set_estimate()

◆ estimate()

Expr Halide::Internal::Parameter::estimate ( ) const

◆ set_default_value()

void Halide::Internal::Parameter::set_default_value ( const Expr e)

Get and set the default values for scalar parameters.

At present, these are used only to emit the default values in the metadata. There isn't yet a public API in Param<> for them (this is used internally by the Generator code).

Referenced by Halide::Internal::GeneratorInput_Scalar< T >::set_def_min_max().

◆ default_value()

Expr Halide::Internal::Parameter::default_value ( ) const

◆ operator<()

bool Halide::Internal::Parameter::operator< ( const Parameter other) const
inline

Order Parameters by their IntrusivePtr so they can be used to index maps.

Definition at line 163 of file Parameter.h.

References contents.

◆ get_argument_estimates()

ArgumentEstimates Halide::Internal::Parameter::get_argument_estimates ( ) const

Get the ArgumentEstimates appropriate for this Parameter.

Referenced by Halide::Param< T >::operator Argument().

◆ store_in()

void Halide::Internal::Parameter::store_in ( MemoryType  memory_type)

◆ memory_type()

MemoryType Halide::Internal::Parameter::memory_type ( ) const

Member Data Documentation

◆ contents

IntrusivePtr<ParameterContents> Halide::Internal::Parameter::contents
protected

Definition at line 36 of file Parameter.h.

Referenced by operator<().


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