Halide
Halide::Internal::Parameter Class Reference

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

#include <Parameter.h>

Public Member Functions

EXPORT Parameter ()
 Construct a new undefined handle. More...
 
EXPORT Parameter (Type t, bool is_buffer, int dimensions)
 Construct a new parameter of the given type. More...
 
EXPORT Parameter (Type t, bool is_buffer, int dimensions, const std::string &name, bool is_explicit_name=false, bool register_instance=true, bool is_bound_before_lowering=false)
 Construct a new parameter of the given type with name given by the third argument. More...
 
EXPORT Parameter (const Parameter &)
 Copy ctor, operator=, and dtor, needed for ObjectRegistry accounting. More...
 
EXPORT Parameteroperator= (const Parameter &)
 
EXPORT ~Parameter ()
 
EXPORT Type type () const
 Get the type of this parameter. More...
 
EXPORT int dimensions () const
 Get the dimensionality of this parameter. More...
 
EXPORT const std::string & name () const
 Get the name of this parameter. More...
 
EXPORT bool is_explicit_name () const
 Return true iff the name was explicitly specified. More...
 
EXPORT bool is_bound_before_lowering () const
 Return true iff this Parameter is expected to be replaced with a constant at the start of lowering, and thus should not be used to infer arguments. More...
 
EXPORT bool is_buffer () const
 Does this parameter refer to a buffer/image? More...
 
template<typename T >
NO_INLINEscalar () const
 If the parameter is a scalar parameter, get its currently bound value. More...
 
EXPORT Expr scalar_expr () const
 This returns the current value of scalar<type()>() as an Expr. More...
 
template<typename T >
NO_INLINE void set_scalar (T val)
 If the parameter is a scalar parameter, set its current value. More...
 
EXPORT Buffer buffer () const
 If the parameter is a buffer parameter, get its currently bound buffer. More...
 
EXPORT void set_buffer (Buffer<> b)
 If the parameter is a buffer parameter, set its current value. More...
 
EXPORT void * scalar_address () const
 Get the pointer to the current value of the scalar parameter. More...
 
EXPORT bool same_as (const Parameter &other) const
 Tests if this handle is the same as another handle. More...
 
EXPORT bool defined () const
 Tests if this handle is non-nullptr. More...
 
EXPORT void set_min_constraint (int dim, Expr e)
 Get and set constraints for the min, extent, stride, and estimates on the min/extent. More...
 
EXPORT void set_extent_constraint (int dim, Expr e)
 Get and set constraints for the min, extent, stride, and estimates on the min/extent. More...
 
EXPORT void set_stride_constraint (int dim, Expr e)
 Get and set constraints for the min, extent, stride, and estimates on the min/extent. More...
 
EXPORT void set_min_constraint_estimate (int dim, Expr min)
 Get and set constraints for the min, extent, stride, and estimates on the min/extent. More...
 
EXPORT void set_extent_constraint_estimate (int dim, Expr extent)
 Get and set constraints for the min, extent, stride, and estimates on the min/extent. More...
 
EXPORT void set_host_alignment (int bytes)
 Get and set constraints for the min, extent, stride, and estimates on the min/extent. More...
 
EXPORT Expr min_constraint (int dim) const
 Get and set constraints for the min, extent, stride, and estimates on the min/extent. More...
 
EXPORT Expr extent_constraint (int dim) const
 Get and set constraints for the min, extent, stride, and estimates on the min/extent. More...
 
EXPORT Expr stride_constraint (int dim) const
 Get and set constraints for the min, extent, stride, and estimates on the min/extent. More...
 
EXPORT Expr min_constraint_estimate (int dim) const
 Get and set constraints for the min, extent, stride, and estimates on the min/extent. More...
 
EXPORT Expr extent_constraint_estimate (int dim) const
 Get and set constraints for the min, extent, stride, and estimates on the min/extent. More...
 
EXPORT int host_alignment () const
 Get and set constraints for the min, extent, stride, and estimates on the min/extent. More...
 
EXPORT void set_min_value (Expr e)
 Get and set constraints for scalar parameters. More...
 
EXPORT Expr min_value () const
 Get and set constraints for scalar parameters. More...
 
EXPORT void set_max_value (Expr e)
 Get and set constraints for scalar parameters. More...
 
EXPORT Expr max_value () const
 Get and set constraints for scalar parameters. More...
 
EXPORT void set_estimate (Expr e)
 Get and set constraints for scalar parameters. More...
 
EXPORT Expr estimate () const
 Get and set constraints for scalar parameters. More...
 

Detailed Description

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

May be a scalar parameter or a buffer

Definition at line 21 of file Parameter.h.

Constructor & Destructor Documentation

◆ Parameter() [1/4]

EXPORT Halide::Internal::Parameter::Parameter ( )

Construct a new undefined handle.

◆ Parameter() [2/4]

EXPORT Halide::Internal::Parameter::Parameter ( 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/4]

EXPORT Halide::Internal::Parameter::Parameter ( Type  t,
bool  is_buffer,
int  dimensions,
const std::string &  name,
bool  is_explicit_name = false,
bool  register_instance = true,
bool  is_bound_before_lowering = false 
)

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). If the sixth argument is true, the Parameter is registered in the global ObjectInstanceRegistry.

◆ Parameter() [4/4]

EXPORT Halide::Internal::Parameter::Parameter ( const Parameter )

Copy ctor, operator=, and dtor, needed for ObjectRegistry accounting.

◆ ~Parameter()

EXPORT Halide::Internal::Parameter::~Parameter ( )

Member Function Documentation

◆ operator=()

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

◆ type()

EXPORT Type Halide::Internal::Parameter::type ( ) const

Get the type of this parameter.

Referenced by Halide::Internal::Call::make(), scalar(), and set_scalar().

◆ dimensions()

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

Get the dimensionality of this parameter.

Zero for scalars.

◆ name()

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

Get the name of this parameter.

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

◆ is_explicit_name()

EXPORT bool Halide::Internal::Parameter::is_explicit_name ( ) const

Return true iff the name was explicitly specified.

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

◆ is_bound_before_lowering()

EXPORT bool Halide::Internal::Parameter::is_bound_before_lowering ( ) const

Return true iff this Parameter is expected to be replaced with a constant at the start of lowering, and thus should not be used to infer arguments.

◆ is_buffer()

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

Does this parameter refer to a buffer/image?

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

◆ scalar()

template<typename T >
NO_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 81 of file Parameter.h.

References EXPORT, scalar_address(), scalar_expr(), type(), Halide::UInt(), and user_assert.

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

◆ scalar_expr()

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

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

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

◆ set_scalar()

◆ buffer()

EXPORT Buffer Halide::Internal::Parameter::buffer ( ) const

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

Only relevant when jitting

Referenced by set_scalar().

◆ set_buffer()

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

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

Only relevant when jitting

Referenced by set_scalar().

◆ scalar_address()

EXPORT 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 Halide::Param< T >::address(), scalar(), and set_scalar().

◆ same_as()

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

Tests if this handle is the same as another handle.

Referenced by set_scalar().

◆ defined()

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

Tests if this handle is non-nullptr.

Referenced by set_scalar().

◆ set_min_constraint()

EXPORT 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.

Referenced by set_scalar().

◆ set_extent_constraint()

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

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

Referenced by set_scalar().

◆ set_stride_constraint()

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

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

Referenced by set_scalar().

◆ set_min_constraint_estimate()

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

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

Referenced by set_scalar().

◆ set_extent_constraint_estimate()

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

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

Referenced by set_scalar().

◆ set_host_alignment()

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

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

Referenced by set_scalar().

◆ min_constraint()

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

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

Referenced by set_scalar().

◆ extent_constraint()

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

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

Referenced by set_scalar().

◆ stride_constraint()

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

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

Referenced by set_scalar().

◆ min_constraint_estimate()

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

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

Referenced by set_scalar().

◆ extent_constraint_estimate()

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

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

Referenced by set_scalar().

◆ host_alignment()

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

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

Referenced by set_scalar().

◆ set_min_value()

EXPORT void Halide::Internal::Parameter::set_min_value ( 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(), Halide::Param< T >::set_min_value(), and set_scalar().

◆ min_value()

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

Get and set constraints for scalar parameters.

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

Referenced by Halide::Param< T >::min_value(), Halide::Param< T >::operator Argument(), and set_scalar().

◆ set_max_value()

EXPORT void Halide::Internal::Parameter::set_max_value ( 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(), Halide::Param< T >::set_max_value(), and set_scalar().

◆ max_value()

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

Get and set constraints for scalar parameters.

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

Referenced by Halide::Param< T >::max_value(), Halide::Param< T >::operator Argument(), and set_scalar().

◆ set_estimate()

EXPORT void Halide::Internal::Parameter::set_estimate ( Expr  e)

Get and set constraints for scalar parameters.

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

Referenced by Halide::Param< T >::set_estimate(), Halide::Internal::GeneratorInput_Scalar< T >::set_estimate(), and set_scalar().

◆ estimate()

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

Get and set constraints for scalar parameters.

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

Referenced by set_scalar().


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