Tiramisu Compiler
tiramisu::constant Class Reference

A class that represents loop invariants. More...

#include <core.h>

Inherits tiramisu::computation.

Public Member Functions

 constant (std::string param_name, const tiramisu::expr &param_expr, tiramisu::primitive_t t, bool function_wide, tiramisu::computation *with_computation, int at_loop_level, tiramisu::function *func=global::get_implicit_function())
 Create a constant where param_name is the name of the constant that will hold the value of the constant. More...
 
 constant (std::string param_name, const tiramisu::expr &param_expr, tiramisu::primitive_t t, tiramisu::function *func=global::get_implicit_function())
 
 constant (std::string param_name, const tiramisu::expr &param_expr)
 Create a constant. More...
 
tiramisu::computationget_computation_with_whom_this_is_computed ()
 Get the computation with whom this constant is computed. More...
 
void dump (bool exhaustive) const
 Dump the invariant on standard output (dump most of the fields of the invariant class). More...
 
 operator expr ()
 
- Public Member Functions inherited from tiramisu::computation
 computation (std::string iteration_domain, tiramisu::expr e, bool schedule_this_computation, tiramisu::primitive_t t, tiramisu::function *fct)
 Constructor for computations. More...
 
 computation (std::string name, std::vector< var > iterator_variables, tiramisu::expr e, bool schedule_this_computation)
 Constructor for computations. More...
 
 computation (std::vector< var > iterator_variables, tiramisu::expr e)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
 computation (std::string name, std::vector< var > iterator_variables, tiramisu::expr e)
 Constructor for computations. More...
 
 computation (std::vector< var > iterator_variables, tiramisu::expr e, bool schedule_this_computation)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
 computation (std::string name, std::vector< var > iterator_variables, primitive_t t)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.t is the type of the computation, i.e. More...
 
 computation (std::vector< var > iterator_variables, primitive_t t)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
virtual bool is_send () const
 
virtual bool is_recv () const
 
virtual bool is_send_recv () const
 
virtual bool is_wait () const
 
void add_associated_let_stmt (std::string access_name, tiramisu::expr e)
 Add a let statement that is associated to this computation. More...
 
void unschedule_this_computation ()
 Don't scheduled a previously scheduled computation. More...
 
virtual void add_definitions (std::string iteration_domain_str, tiramisu::expr e, bool schedule_this_computation, tiramisu::primitive_t t, tiramisu::function *fct)
 Add definitions of computations that have the same name as this computation. More...
 
void add_predicate (tiramisu::expr predicate)
 Add a predicate (condition) on the computation. More...
 
void after (computation &comp, tiramisu::var iterator)
 Schedule this computation to run after the computation comp. More...
 
void after (computation &comp, int level)
 This function is equivalent to void after(computation &comp, tiramisu::var iterator); except that it uses loop level numbers (0, 1, 2, ...) instead of using loop variables (tiramisu::var). More...
 
void allocate_and_map_buffer_automatically (tiramisu::argument_t type=tiramisu::a_temporary)
 
void apply_transformation_on_schedule (std::string map_str)
 Apply a transformation on the schedule. More...
 
void between (computation &before_comp, tiramisu::var before_l, computation &after_comp, tiramisu::var after_l)
 Schedule this computation to run after before_comp at the loop level before_l, and before after_comp at loop level after_l. More...
 
tiramisu::bufferget_automatically_allocated_buffer ()
 Return the buffer that was allocated automatically using high level data mapping functions. More...
 
void interchange (tiramisu::var L0, tiramisu::var L1)
 Interchange (swap) the two loop levels L0 and L1. More...
 
void interchange (int L0, int L1)
 Identical to void interchange(tiramisu::var L0, tiramisu::var L1);. More...
 
void mark_as_let_statement ()
 Mark this statement as a let statement. More...
 
void mark_as_library_call ()
 Mark this statement as a library call. More...
 
void parallelize (tiramisu::var L)
 Tag the loop level L to be parallelized. More...
 
void set_wait_access (std::string access_str)
 
void set_wait_access (isl_map *access)
 
void set_expression (const tiramisu::expr &e)
 Set the expression of the computation. More...
 
void set_inline (bool is_inline=true)
 Sets whether the computation is inline or not, based on the value of is_inline. More...
 
const bool is_inline_computation () const
 Returns true if and only if the computation is inline. More...
 
void shift (tiramisu::var L0, int n)
 Shift the loop level L0 of the iteration space by n iterations. More...
 
void skew (tiramisu::var i, tiramisu::var j, int f, tiramisu::var ni, tiramisu::var nj)
 Apply loop skewing on the loop levels i and j with a skewing factor of f. More...
 
void skew (tiramisu::var i, tiramisu::var j, tiramisu::var k, int factor, tiramisu::var ni, tiramisu::var nj, tiramisu::var nk)
 Apply loop skewing on the loop levels i, j and k with a skewing factor of f. More...
 
void skew (tiramisu::var i, tiramisu::var j, tiramisu::var k, tiramisu::var l, int factor, tiramisu::var ni, tiramisu::var nj, tiramisu::var nk, tiramisu::var nl)
 Apply loop skewing on the loop levels i, j, k, l with a skewing factor of f. More...
 
void skew (tiramisu::var i, tiramisu::var j, int factor)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
void skew (tiramisu::var i, tiramisu::var j, tiramisu::var k, int factor)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
void skew (tiramisu::var i, tiramisu::var j, tiramisu::var k, tiramisu::var l, int factor)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
void skew (int i, int j, int factor)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
void skew (int i, int j, int k, int factor)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
void skew (int i, int j, int k, int l, int factor)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
void split (int L0, int sizeX)
 Identical to void split(tiramisu::var L0, int sizeX);. More...
 
void storage_fold (tiramisu::var dim, int f)
 Fold the storage of the computation. More...
 
tiramisu::computationstore_at (tiramisu::computation &comp, tiramisu::var L0)
 Allocate the storage of this computation in the loop level L0. More...
 
void tag_parallel_level (tiramisu::var L)
 Tag the loop level L to be parallelized. More...
 
void tag_parallel_level (int L)
 Identical to void tag_parallel_level(int L);. More...
 
void tag_vector_level (tiramisu::var L, int len)
 Tag the loop level L to be vectorized. More...
 
void tag_vector_level (int L, int len)
 Identical to void tag_vector_level(tiramisu::var L, int len);. More...
 
void tag_unroll_level (tiramisu::var L)
 Tag the loop level L to be unrolled. More...
 
void tag_unroll_level (int L)
 Identical to void tag_unroll_level(tiramisu::var L);. More...
 
template<typename... Args>
tiramisu::expr operator() (Args...args)
 Access operator: C0(i,j) represents an access to the element (i,j) of the computation C0. More...
 
 operator expr ()
 
void after_low_level (computation &comp, int level)
 Schedule this computation to run after the computation comp. More...
 
void after_low_level (computation &comp, std::vector< int > levels)
 Schedule this computation to run after the computation comp. More...
 
void before (computation &consumer, tiramisu::var L)
 Schedule this computation to run before the computation consumer at the loop level L. More...
 
void store_in (buffer *buff)
 Store this computation in buff. More...
 
void store_in (buffer *buff, std::vector< expr > iterators)
 Store this computation in buff. More...
 
void compute_at (computation &consumer, tiramisu::var L)
 This function assumes that consumer consumes values produced by this computation (which is the producer). More...
 
void compute_at (computation &consumer, int L)
 Store this computation in buff. More...
 
int compute_maximal_AST_depth ()
 Generates the time-space domain and construct an AST that scans that time-space domain, then compute the depth of this AST. More...
 
void dump_iteration_domain () const
 Dump the iteration domain of the computation. More...
 
void dump_schedule () const
 Dump the schedule of the computation. More...
 
void dump () const
 Dump the computation on stdout. More...
 
void fuse_after (tiramisu::var lev, computation &comp)
 Fuse this computation with the computation passed as argument in the same loop. More...
 
void gen_time_space_domain ()
 Generate the time-space domain of the computation. More...
 
void drop_rank_iter (var level)
 Specify that the rank loop iterator should be removed from linearization. More...
 
tiramisu::primitive_t get_data_type () const
 Get the data type of the computation. More...
 
const tiramisu::exprget_expr () const
 Return the Tiramisu expression associated with the computation. More...
 
isl_set * get_iteration_domain () const
 Return the iteration domain of the computation. More...
 
tiramisu::computationget_last_update ()
 Get the last update of a computation. More...
 
int get_loop_level_number_from_dimension_name (std::string dim_name)
 Search the time-space domain (the range of the schedule) and return the loop level number that correspond to the dimension named dim. More...
 
const std::string & get_name () const
 Return the name of the computation. More...
 
computationget_predecessor ()
 Returns a pointer to the computation scheduled immediately before this computation, or a null pointer if none exist. More...
 
tiramisu::computationget_update (int index)
 Returns the index update that has been added to this computation such that: More...
 
isl_map * get_schedule () const
 Get the schedule of the computation. More...
 
void gpu_tile (tiramisu::var L0, tiramisu::var L1, int sizeX, int sizeY)
 Tile the computation and then tag the outermost tile dimension to be mapped to GPU blocks and tag the innermost tile dimensions to be mapped to GPU threads. More...
 
void gpu_tile (tiramisu::var L0, tiramisu::var L1, int sizeX, int sizeY, tiramisu::var L0_outer, tiramisu::var L1_outer, tiramisu::var L0_inner, tiramisu::var L1_inner)
 Store this computation in buff. More...
 
void gpu_tile (tiramisu::var L0, tiramisu::var L1, tiramisu::var L2, int sizeX, int sizeY, int sizeZ)
 Store this computation in buff. More...
 
void gpu_tile (tiramisu::var L0, tiramisu::var L1, tiramisu::var L2, int sizeX, int sizeY, int sizeZ, tiramisu::var L0_outer, tiramisu::var L1_outer, tiramisu::var L2_outer, tiramisu::var L0_inner, tiramisu::var L1_inner, tiramisu::var L2_inner)
 Store this computation in buff. More...
 
void set_access (std::string access_str)
 Set the access relation of the computation. More...
 
void set_access (isl_map *access)
 Set the access relation of the computation. More...
 
void set_low_level_schedule (isl_map *map)
 Set the schedule indicated by map. More...
 
void set_low_level_schedule (std::string map_str)
 Set the schedule indicated by map. More...
 
void split (tiramisu::var L0, int sizeX)
 Split the loop level L0 of the iteration space into two new loop levels. More...
 
void split (tiramisu::var L0, int sizeX, tiramisu::var L0_outer, tiramisu::var L0_inner)
 Split the loop level L0 of the iteration space into two new loop levels. More...
 
void tag_gpu_level (tiramisu::var L0, tiramisu::var L1)
 Tag the loop level L0 and L1 to be mapped to GPU. More...
 
void tag_gpu_level (tiramisu::var L0, tiramisu::var L1, tiramisu::var L2, tiramisu::var L3)
 Tag the loop level L0 and L1 to be mapped to GPU. More...
 
void tag_gpu_level (tiramisu::var L0, tiramisu::var L1, tiramisu::var L2, tiramisu::var L3, tiramisu::var L4, tiramisu::var L5)
 Tag the loop level L0 and L1 to be mapped to GPU. More...
 
void tag_distribute_level (tiramisu::var L)
 Tag the loop level L to be distributed. More...
 
void tag_distribute_level (int L)
 Tag the loop level L to be distributed. More...
 
computationthen (computation &next_computation, tiramisu::var L)
 Schedule this computation to run before the computation next_computation at the loop level L and return next_computation. More...
 
void tile (tiramisu::var L0, tiramisu::var L1, int sizeX, int sizeY)
 Tile the two loop levels L0 and L1 with rectangular tiling. More...
 
void tile (tiramisu::var L0, tiramisu::var L1, int sizeX, int sizeY, tiramisu::var L0_outer, tiramisu::var L1_outer, tiramisu::var L0_inner, tiramisu::var L1_inner)
 Tile the two loop levels L0 and L1 with rectangular tiling. More...
 
void tile (tiramisu::var L0, tiramisu::var L1, tiramisu::var L2, int sizeX, int sizeY, int sizeZ)
 Tile the two loop levels L0 and L1 with rectangular tiling. More...
 
void tile (tiramisu::var L0, tiramisu::var L1, tiramisu::var L2, int sizeX, int sizeY, int sizeZ, tiramisu::var L0_outer, tiramisu::var L1_outer, tiramisu::var L2_outer, tiramisu::var L0_inner, tiramisu::var L1_inner, tiramisu::var L2_inner)
 Tile the two loop levels L0 and L1 with rectangular tiling. More...
 
void tile (int L0, int L1, int sizeX, int sizeY)
 Tile the two loop levels L0 and L1 with rectangular tiling. More...
 
void tile (int L0, int L1, int L2, int sizeX, int sizeY, int sizeZ)
 Tile the two loop levels L0 and L1 with rectangular tiling. More...
 
void unroll (tiramisu::var L, int fac)
 Unroll the loop level L with an unrolling factor fac. More...
 
void unroll (tiramisu::var L, int fac, tiramisu::var L_outer, tiramisu::var L_inner)
 Unroll the loop level L with an unrolling factor fac. More...
 
void vectorize (tiramisu::var L, int v)
 Vectorize the loop level L. More...
 
void vectorize (tiramisu::var L, int v, tiramisu::var L_outer, tiramisu::var L_inner)
 Vectorize the loop level L. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from tiramisu::computation
static xfer create_xfer (std::string send_iter_domain, std::string recv_iter_domain, tiramisu::expr send_dest, tiramisu::expr recv_src, xfer_prop send_prop, xfer_prop recv_prop, tiramisu::expr send_expr, tiramisu::function *fct)
 
static xfer create_xfer (std::string iter_domain, xfer_prop prop, tiramisu::expr expr, tiramisu::function *fct)
 
- Static Public Attributes inherited from tiramisu::computation
static const var root
 root_dimension is a number used to specify the dimension level known as root. More...
 
static const int root_dimension = -1
 Equivalent of computation::root but to be used with scheduling functions that take loop level (integers) as input instead of tiramisu::var. More...
 
- Protected Member Functions inherited from tiramisu::computation
 computation ()
 Dummy constructor for derived classes. More...
 
std::vector< tiramisu::expr > * compute_buffer_size ()
 Compute the size of the buffer allocated automatically to hold the results of this computation. More...
 
isl_ctx * get_ctx () const
 Return the context of the computations. More...
 
tiramisu::expr get_predicate ()
 Return the predicate around this computation if a predicate was added using add_predicate(). More...
 
const std::string get_unique_name () const
 Return a unique name of computation; made of the following pattern: [computation name]@[computation address in memory]. More...
 
bool has_multiple_definitions ()
 Return true if the computation has multiple definitions. More...
 
void init_computation (std::string iteration_space_str, tiramisu::function *fct, const tiramisu::expr &e, bool schedule_this_computation, tiramisu::primitive_t t)
 Initialize a computation. More...
 
void set_name (const std::string &n)
 Set the name of the computation. More...
 
void full_loop_level_collapse (int level, tiramisu::expr collapse_from_iter)
 Collapse all the iterations of a loop into one single iteration. More...
 
 computation (std::string name, std::vector< var > iterator_variables, tiramisu::expr e, bool schedule_this_computation, primitive_t t)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
void set_schedule (isl_map *map)
 Set the schedule indicated by map. More...
 
void set_schedule (std::string map_str)
 Set the schedule indicated by map. More...
 
- Protected Attributes inherited from tiramisu::computation
bool _is_library_call
 True if this computation represents a library call. More...
 
std::string library_call_name
 If the computation represents a library call, this is the name of the function. More...
 
isl_ast_expr * wait_index_expr
 An index expression just for the request buffer. More...
 

Detailed Description

A class that represents loop invariants.

An object of the invariant class can be an expression, a symbolic constant or a variable that is invariant to all the loops of the function.

Definition at line 4187 of file core.h.

Constructor & Destructor Documentation

tiramisu::constant::constant ( std::string  param_name,
const tiramisu::expr param_expr,
tiramisu::primitive_t  t,
bool  function_wide,
tiramisu::computation with_computation,
int  at_loop_level,
tiramisu::function func = global::get_implicit_function() 
)

Create a constant where param_name is the name of the constant that will hold the value of the constant.

param_expr is the expression that defines the value of the constant.

t indicates the type of the constant.

function_wide should be set to true if the constant is defined at the entry of the function and is visible to all the computations. If function_wide is set to true, then the constant is an invariant to the whole function where it is declared.

with_computation, should be set only if function_wide is false, i.e. if the constant is not function wide. In such a case the user should indicate where the constant should be assigned. with_computation indicates that the assignment should be in the loop nest that computes the computation indicated by with_computation at the loop level indicated by at_loop_level. The root level (i.e. the level outer than any other loop level) is computation::root_dimension. 0 represents the first loop level and 1 represents the second loop level, ...

func is the function in which the constant is defined. If this argument is not provided, the implicit Tiramisu function is used (i.e., the function created during Tiramisu initialization).

tiramisu::constant::constant ( std::string  param_name,
const tiramisu::expr param_expr,
tiramisu::primitive_t  t,
tiramisu::function func = global::get_implicit_function() 
)
tiramisu::constant::constant ( std::string  param_name,
const tiramisu::expr param_expr 
)

Create a constant.

Define a constant (scalar) at the entry of the function and make it visible to all the computations.

param_name is the name of the constant. param_expr is the expression that defines the value of the constant.

Member Function Documentation

void tiramisu::constant::dump ( bool  exhaustive) const

Dump the invariant on standard output (dump most of the fields of the invariant class).

This is mainly useful for debugging. If exhaustive is set to true, all the fields of the invariant class are printed. This is useful to find potential initialization problems.

tiramisu::computation* tiramisu::constant::get_computation_with_whom_this_is_computed ( )
inline

Get the computation with whom this constant is computed.

Definition at line 4266 of file core.h.

tiramisu::constant::operator expr ( )

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