Halide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Halide::Param< T > Class Template Reference

A scalar parameter to a halide pipeline. More...

#include <Param.h>

Public Member Functions

 Param ()
 Construct a scalar parameter of type T with a unique auto-generated name. More...
 
template<typename T2 = T, typename std::enable_if<!std::is_pointer< T2 >::value >::type * = nullptr>
 Param (T val)
 Construct a scalar parameter of type T an initial value of 'val'. More...
 
 Param (const std::string &n, T val)
 Construct a scalar parameter of type T with the given name and an initial value of 'val'. More...
 
 Param (T val, Expr min, Expr max)
 Construct a scalar parameter of type T with an initial value of 'val' and a given min and max. More...
 
 Param (const std::string &n, T val, Expr min, Expr max)
 Construct a scalar parameter of type T with the given name and an initial value of 'val' and a given min and max. More...
 
const std::string & name () const
 Get the name of this parameter. More...
 
bool is_explicit_name () const
 Return true iff the name was explicitly specified in the ctor (vs autogenerated). More...
 
NO_INLINEget () const
 Get the current value of this parameter. More...
 
NO_INLINE void set (T val)
 Set the current value of this parameter. More...
 
NO_INLINE T * get_address () const
 Get a pointer to the location that stores the current value of this parameter. More...
 
Type type () const
 Get the halide type of T. More...
 
 operator Expr () const
 You can use this parameter as an expression in a halide function definition. More...
 
 operator ExternFuncArgument () const
 Using a param as the argument to an external stage treats it as an Expr. More...
 
 operator Argument () const
 Construct the appropriate argument matching this parameter, for the purpose of generating the right type signature when statically compiling halide pipelines. More...
 
 Param (const std::string &n)
 Construct a scalar parameter of type T with the given name. More...
 
 Param (const char *n)
 Construct a scalar parameter of type T with the given name. More...
 
void set_range (Expr min, Expr max)
 Get or set the possible range of this parameter. More...
 
void set_min_value (Expr min)
 Get or set the possible range of this parameter. More...
 
void set_max_value (Expr max)
 Get or set the possible range of this parameter. More...
 
Expr get_min_value () const
 Get or set the possible range of this parameter. More...
 
Expr get_max_value () const
 Get or set the possible range of this parameter. More...
 

Detailed Description

template<typename T>
class Halide::Param< T >

A scalar parameter to a halide pipeline.

If you're jitting, this should be bound to an actual value of type T using the set method before you realize the function uses this. If you're statically compiling, this param should appear in the argument list.

Examples:
tutorial/lesson_10_aot_compilation_generate.cpp, tutorial/lesson_11_cross_compilation.cpp, and tutorial/lesson_15_generators.cpp.

Definition at line 21 of file Param.h.

Constructor & Destructor Documentation

template<typename T>
Halide::Param< T >::Param ( )
inline

Construct a scalar parameter of type T with a unique auto-generated name.

Definition at line 35 of file Param.h.

template<typename T>
Halide::Param< T >::Param ( const std::string &  n)
inlineexplicit

Construct a scalar parameter of type T with the given name.

Definition at line 40 of file Param.h.

template<typename T>
Halide::Param< T >::Param ( const char *  n)
inlineexplicit

Construct a scalar parameter of type T with the given name.

Definition at line 44 of file Param.h.

template<typename T>
template<typename T2 = T, typename std::enable_if<!std::is_pointer< T2 >::value >::type * = nullptr>
Halide::Param< T >::Param ( val)
inlineexplicit

Construct a scalar parameter of type T an initial value of 'val'.

Only triggers for non-pointer types.

Definition at line 53 of file Param.h.

References Halide::Param< T >::set().

template<typename T>
Halide::Param< T >::Param ( const std::string &  n,
val 
)
inline

Construct a scalar parameter of type T with the given name and an initial value of 'val'.

Definition at line 60 of file Param.h.

References Halide::Param< T >::set().

template<typename T>
Halide::Param< T >::Param ( val,
Expr  min,
Expr  max 
)
inline

Construct a scalar parameter of type T with an initial value of 'val' and a given min and max.

Definition at line 68 of file Param.h.

References Halide::Param< T >::set(), and Halide::Param< T >::set_range().

template<typename T>
Halide::Param< T >::Param ( const std::string &  n,
val,
Expr  min,
Expr  max 
)
inline

Construct a scalar parameter of type T with the given name and an initial value of 'val' and a given min and max.

Definition at line 76 of file Param.h.

References Halide::Param< T >::set(), and Halide::Param< T >::set_range().

Member Function Documentation

template<typename T>
const std::string& Halide::Param< T >::name ( ) const
inline

Get the name of this parameter.

Definition at line 84 of file Param.h.

References Halide::Internal::Parameter::name().

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

template<typename T>
bool Halide::Param< T >::is_explicit_name ( ) const
inline

Return true iff the name was explicitly specified in the ctor (vs autogenerated).

Definition at line 89 of file Param.h.

References Halide::Internal::Parameter::is_explicit_name().

template<typename T>
NO_INLINE T Halide::Param< T >::get ( ) const
inline

Get the current value of this parameter.

Only meaningful when jitting.

Definition at line 94 of file Param.h.

References Halide::Internal::Parameter::get_scalar().

template<typename T>
NO_INLINE void Halide::Param< T >::set ( val)
inline

Set the current value of this parameter.

Only meaningful when jitting

Definition at line 99 of file Param.h.

References Halide::Internal::Parameter::set_scalar().

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

template<typename T>
NO_INLINE T* Halide::Param< T >::get_address ( ) const
inline

Get a pointer to the location that stores the current value of this parameter.

Only meaningful for jitting.

Definition at line 105 of file Param.h.

References Halide::Internal::Parameter::get_scalar_address().

template<typename T>
Type Halide::Param< T >::type ( ) const
inline

Get the halide type of T.

Definition at line 110 of file Param.h.

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

template<typename T>
void Halide::Param< T >::set_range ( Expr  min,
Expr  max 
)
inline

Get or set the possible range of this parameter.

Use undefined Exprs to mean unbounded.

Definition at line 117 of file Param.h.

References Halide::Param< T >::set_max_value(), and Halide::Param< T >::set_min_value().

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

template<typename T>
void Halide::Param< T >::set_min_value ( Expr  min)
inline

Get or set the possible range of this parameter.

Use undefined Exprs to mean unbounded.

Definition at line 122 of file Param.h.

References Halide::Internal::Cast::make(), Halide::Internal::Parameter::set_min_value(), and Halide::Expr::type().

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

template<typename T>
void Halide::Param< T >::set_max_value ( Expr  max)
inline

Get or set the possible range of this parameter.

Use undefined Exprs to mean unbounded.

Definition at line 129 of file Param.h.

References Halide::Internal::Cast::make(), Halide::Internal::Parameter::set_max_value(), and Halide::Expr::type().

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

template<typename T>
Expr Halide::Param< T >::get_min_value ( ) const
inline

Get or set the possible range of this parameter.

Use undefined Exprs to mean unbounded.

Definition at line 136 of file Param.h.

References Halide::Internal::Parameter::get_min_value().

template<typename T>
Expr Halide::Param< T >::get_max_value ( ) const
inline

Get or set the possible range of this parameter.

Use undefined Exprs to mean unbounded.

Definition at line 140 of file Param.h.

References Halide::Internal::Parameter::get_max_value().

template<typename T>
Halide::Param< T >::operator Expr ( ) const
inline

You can use this parameter as an expression in a halide function definition.

Definition at line 147 of file Param.h.

References Halide::Internal::Variable::make(), and Halide::Param< T >::name().

template<typename T>
Halide::Param< T >::operator ExternFuncArgument ( ) const
inline

Using a param as the argument to an external stage treats it as an Expr.

Definition at line 153 of file Param.h.

template<typename T>
Halide::Param< T >::operator Argument ( ) const
inline

Construct the appropriate argument matching this parameter, for the purpose of generating the right type signature when statically compiling halide pipelines.

Definition at line 160 of file Param.h.

References Halide::Internal::Parameter::get_max_value(), Halide::Internal::Parameter::get_min_value(), Halide::Internal::Parameter::get_scalar_expr(), Halide::Argument::InputScalar, Halide::Param< T >::name(), and Halide::Param< T >::type().


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