RecFilter
modifiers.h File Reference
#include <Halide.h>

Go to the source code of this file.

Functions

bool is_undef (Halide::Expr e)
 Return true if all Expr in the vector are undef. More...
 
bool is_undef (std::vector< Halide::Expr > e)
 Return true if all Expr in the vector are undef. More...
 
bool is_undef (Halide::Tuple t)
 Return true if all elements of the Tuple are undef. More...
 
bool expr_depends_on_var (Halide::Expr expr, std::string var)
 Check if a given expression depends upon a variable. More...
 
bool expr_depends_on_func (Halide::Expr expr, std::string func_name)
 Check if a given expression contains calls to a Function. More...
 
Halide::Expr substitute_in_func_call (std::string func_name, std::string var, Halide::Expr replace, Halide::Expr original)
 Substitute a variable in all calls to a particular Function in a given expression. More...
 
Halide::Expr substitute_func_call_with_args (std::string func_name, std::vector< Halide::Expr > call_args, Halide::Expr replace, Halide::Expr original)
 Substitute all calls to a particular Function by a given expression the calling args match the given list. More...
 
Halide::Expr insert_arg_in_func_call (std::string func_name, size_t pos, Halide::Expr arg, Halide::Expr original)
 Add a calling argument to all calls to a particular Function. More...
 
Halide::Expr remove_arg_from_func_call (std::string func_name, size_t pos, Halide::Expr original)
 Remove a calling argument from all calls to a particular Function. More...
 
Halide::Expr swap_args_in_func_call (std::string func_name, size_t va_idx, size_t vb_idx, Halide::Expr original)
 Swap two calling arguments of given function in the expression. More...
 
Halide::Expr substitute_arg_in_feedforward_func_call (std::string func_name, std::vector< Halide::Expr > def_arg, size_t pos, Halide::Expr new_arg, Halide::Expr original)
 Substitute a calling arg in feed forward recursive calls to a Func; feedforward calls are those where all args in the Function call are identical to args in Function definition. More...
 
Halide::Expr apply_zero_boundary_in_func_call (std::string func_name, size_t dim, Halide::Expr def_arg, Halide::Expr boundary, Halide::Expr cond, Halide::Expr original)
 Apply zero boundary condition on all tiles except tiles that touch image borders; this pads tiles by zeros if the intra tile index is out of range -. More...
 
Halide::Expr augment_func_call (std::string func_name, std::vector< std::string > func_args, std::vector< Halide::Expr > extra, Halide::Expr original)
 Mathematically add an expression to all calls to a particular Function; the expression to be added is selected from a list of expressions depending upon the value index of the Function call; all occurances of arguments of the Function must be replaced by calling arguments in the selected expression before adding. More...
 
Halide::Expr substitute_func_call (std::string func_name, Halide::Internal::Function replace, Halide::Expr original)
 Substitute all calls to a particular Function by a new Function with the same calling arguments. More...
 
Halide::Expr remove_func_calls (std::string func_name, bool matching, Halide::Expr original)
 Remove all calls to a particular Function or to all Functions except for a particular Function by identity as determined by a boolean flag argument, all calls to the Function are removed if flag is set. More...
 
Halide::Expr increment_value_index_in_func_call (std::string func_name, int increment, Halide::Expr original)
 Find all calls to a particular Function and increment the value_index (Halide::Internal::Call::value_index) of the call by a given offset. More...
 
Halide::Expr swap_vars_in_expr (std::string a, std::string b, Halide::Expr original)
 Swaps two variables in an expression. More...
 
Halide::Expr remove_lets (Halide::Expr)
 Remove all lets by inlining; all sub-expressions will exist once in memory, but may have many pointers to them, so this doesn't cause a combinatorial explosion; if you walk over this as if it were a tree, however, you're going to have a bad time. More...
 
std::map< std::string, Halide::Buffer > extract_buffer_calls (Halide::Func func)
 Extract the list of buffers called in the definition a function. More...
 
void reassign_vartag_counts (std::map< std::string, VarTag > &var_tags, std::vector< std::string > args, std::map< std::string, std::string > var_splits)
 Make sure that all vars with tags INNER, OUTER or FULL have VarTag count in the same order as they appear in the function definition; this continuity was broken during tiling or by RecFilterSchedule::split() More...
 
void reassign_vartag_counts (std::map< std::string, VarTag > &var_tags, std::vector< Halide::Expr > args, std::map< std::string, std::string > var_splits)
 Make sure that all vars with tags INNER, OUTER or FULL have VarTag count in the same order as they appear in the function definition; this continuity was broken during tiling or by RecFilterSchedule::split() More...
 
void inline_function (Halide::Internal::Function f, std::vector< Halide::Func > func_list)
 Inline a pure function in a list of other functions. More...
 

Function Documentation

bool is_undef ( Halide::Expr  e)

Return true if all Expr in the vector are undef.

bool is_undef ( std::vector< Halide::Expr >  e)

Return true if all Expr in the vector are undef.

bool is_undef ( Halide::Tuple  t)

Return true if all elements of the Tuple are undef.

bool expr_depends_on_var ( Halide::Expr  expr,
std::string  var 
)

Check if a given expression depends upon a variable.

Parameters
exprexpression to be checked
varvariable name
bool expr_depends_on_func ( Halide::Expr  expr,
std::string  func_name 
)

Check if a given expression contains calls to a Function.

Parameters
exprexpression to be checked
func_namename of Function
Halide::Expr substitute_in_func_call ( std::string  func_name,
std::string  var,
Halide::Expr  replace,
Halide::Expr  original 
)

Substitute a variable in all calls to a particular Function in a given expression.

Parameters
func_namename of Function
varvariable to be substituted
replacereplacement expression
originaloriginal expression
Halide::Expr substitute_func_call_with_args ( std::string  func_name,
std::vector< Halide::Expr >  call_args,
Halide::Expr  replace,
Halide::Expr  original 
)

Substitute all calls to a particular Function by a given expression the calling args match the given list.

Parameters
func_namename of Function
call_argslist of calling args to match
replacereplacement expression
originaloriginal expression
Halide::Expr insert_arg_in_func_call ( std::string  func_name,
size_t  pos,
Halide::Expr  arg,
Halide::Expr  original 
)

Add a calling argument to all calls to a particular Function.

Parameters
func_namename of Function
posposition to add calling arg within list
argcalling argument to add
originaloriginal expression
Halide::Expr remove_arg_from_func_call ( std::string  func_name,
size_t  pos,
Halide::Expr  original 
)

Remove a calling argument from all calls to a particular Function.

Parameters
func_namename of Function
poscalling arg index within list to be removed
originaloriginal expression
Halide::Expr swap_args_in_func_call ( std::string  func_name,
size_t  va_idx,
size_t  vb_idx,
Halide::Expr  original 
)

Swap two calling arguments of given function in the expression.

Parameters
func_namename of function to modify
va_idxindex of first calling arg
vb_idxindex of second calling arg
originaloriginal expression
Halide::Expr substitute_arg_in_feedforward_func_call ( std::string  func_name,
std::vector< Halide::Expr >  def_arg,
size_t  pos,
Halide::Expr  new_arg,
Halide::Expr  original 
)

Substitute a calling arg in feed forward recursive calls to a Func; feedforward calls are those where all args in the Function call are identical to args in Function definition.

Parameters
func_namename of function to modify
def_argargs in Function definition
posindex of calling arg to be replaced
new_argnew calling arg
originaloriginal expression
Halide::Expr apply_zero_boundary_in_func_call ( std::string  func_name,
size_t  dim,
Halide::Expr  def_arg,
Halide::Expr  boundary,
Halide::Expr  cond,
Halide::Expr  original 
)

Apply zero boundary condition on all tiles except tiles that touch image borders; this pads tiles by zeros if the intra tile index is out of range -.

  • less than zero or greater than tile width. Usually, if the feedforward coeff is 1.0 zero padding is required for in the Function definition itself - which automatically pads all tiles by zeros. But in Gaussian filtering feedforward coeff is not 1.0; so Function definition cannot pad the image by zeros; in such case it is important to forcibly pad all inner tiles by zeros.
Parameters
func_namename of function to modify
dimdimension containing the RVar
def_argargs in Function definition
boundarytile width
condcondition to check tiles touching borders
originaloriginal expression
Halide::Expr augment_func_call ( std::string  func_name,
std::vector< std::string >  func_args,
std::vector< Halide::Expr >  extra,
Halide::Expr  original 
)

Mathematically add an expression to all calls to a particular Function; the expression to be added is selected from a list of expressions depending upon the value index of the Function call; all occurances of arguments of the Function must be replaced by calling arguments in the selected expression before adding.

Parameters
func_namename of Function
func_argsarguments of Function
extralist of exprs to be algebraically added
originaloriginal expression
Halide::Expr substitute_func_call ( std::string  func_name,
Halide::Internal::Function  replace,
Halide::Expr  original 
)

Substitute all calls to a particular Function by a new Function with the same calling arguments.

Parameters
func_namename of Function
replacereplacement Function
originaloriginal expression
Halide::Expr remove_func_calls ( std::string  func_name,
bool  matching,
Halide::Expr  original 
)

Remove all calls to a particular Function or to all Functions except for a particular Function by identity as determined by a boolean flag argument, all calls to the Function are removed if flag is set.

Parameters
func_namename of Function
matchingremove calls matching or not matching
originaloriginal expression
Halide::Expr increment_value_index_in_func_call ( std::string  func_name,
int  increment,
Halide::Expr  original 
)

Find all calls to a particular Function and increment the value_index (Halide::Internal::Call::value_index) of the call by a given offset.

Parameters
func_namename of Function
incrementincrement to value_index, can be negative
originaloriginal expression
Halide::Expr swap_vars_in_expr ( std::string  a,
std::string  b,
Halide::Expr  original 
)

Swaps two variables in an expression.

Parameters
afirst variable name for swapping
bsecond variable name for swapping
originaloriginal expression
Halide::Expr remove_lets ( Halide::Expr  )

Remove all lets by inlining; all sub-expressions will exist once in memory, but may have many pointers to them, so this doesn't cause a combinatorial explosion; if you walk over this as if it were a tree, however, you're going to have a bad time.

std::map<std::string, Halide::Buffer> extract_buffer_calls ( Halide::Func  func)

Extract the list of buffers called in the definition a function.

void reassign_vartag_counts ( std::map< std::string, VarTag > &  var_tags,
std::vector< std::string >  args,
std::map< std::string, std::string >  var_splits 
)

Make sure that all vars with tags INNER, OUTER or FULL have VarTag count in the same order as they appear in the function definition; this continuity was broken during tiling or by RecFilterSchedule::split()

Parameters
[in,out]var_tagslist of variable tags to be modified
[in]argspure definition args
[in]var_splitslist of variables created by RecFilterSchedule::split() and the corresponding old variables for the pure definition
void reassign_vartag_counts ( std::map< std::string, VarTag > &  var_tags,
std::vector< Halide::Expr >  args,
std::map< std::string, std::string >  var_splits 
)

Make sure that all vars with tags INNER, OUTER or FULL have VarTag count in the same order as they appear in the function definition; this continuity was broken during tiling or by RecFilterSchedule::split()

Parameters
[in,out]var_tagslist of variable tags to be modified
[in]argsupdate definition args
[in]var_splitslist of variables created by RecFilterSchedule::split() and the corresponding old variables for this update definition
void inline_function ( Halide::Internal::Function  f,
std::vector< Halide::Func >  func_list 
)

Inline a pure function in a list of other functions.

Parameters
[in]ffunction to be inlined
[in,out]func_listlist of functions in which calls to first parameter must be inlined