src/tiramisu_core.cpp
tiramisu::computation *computation::store_at(tiramisu::computation &comp,
                                             tiramisu::var L0_var)
{
    DEBUG_FCT_NAME(3);
    DEBUG_INDENT(4);

    assert(L0_var.get_name().length() > 0);
    std::vector<int> dimensions =
        this->get_loop_level_numbers_from_dimension_names({L0_var.get_name()});
    this->check_dimensions_validity(dimensions);
    int L0 = dimensions[0];

    std::vector<tiramisu::expr> *dim_sizes = this->compute_buffer_size();

    tiramisu::buffer *buff = new tiramisu::buffer("_" + this->name + "_buffer",
            (*dim_sizes),
            this->get_data_type(),
            tiramisu::a_temporary,
            this->get_function());

    this->automatically_allocated_buffer = buff;

    tiramisu::computation *allocation = buff->allocate_at(comp, L0);
    this->store_in(buff);
    if (comp.get_predecessor() != NULL)
        allocation->between(
            *(comp.get_predecessor()),
            L0_var, comp, L0_var);
    else
        allocation->before(comp, L0);

    DEBUG_INDENT(-4);

    return allocation;
}
/**
 * Algorithm:
 * - Compute the size of the buffer:
 *      - TODO: Future work Use the same code that computes the needed area in compute_at,
 *      - TODO: From the needed area, deduce the size by computing the upper
 *              bound and the lower bound and subtracting the two.
 * - declare a buffer with a random name, and with the computed size,
 * - allocate the buffer and get the computation that allocates the buffer,
 * - map the computation to the allocated buffer (one to one mapping),
 * - schedule the computation that allocates the buffer before \p comp
 * at loop level L0,
 * - return the allocation computation.
 */
- Compute the size of the buffer:
- TODO: Future work Use the same code that computes the needed area in compute_at,
- TODO: From the needed area, deduce the size by computing the upper
bound and the lower bound and subtracting the two.
- Compute the size of the buffer : - TODO : Future work Use the same code that computes the needed area in compute_at - TODO : From the needed area deduce the size by computing the upper bound and the lower bound and subtracting the two .
tiramisu::computation *computation::store_at(tiramisu::computation &comp,
                                             tiramisu::var L0_var)
{
    DEBUG_FCT_NAME(3);
    DEBUG_INDENT(4);
    assert(L0_var.get_name().length() > 0);
    std::vector<int> dimensions =
        this->get_loop_level_numbers_from_dimension_names({L0_var.get_name()});
    this->check_dimensions_validity(dimensions);
    int L0 = dimensions[0];
    std::vector<tiramisu::expr> *dim_sizes = this->compute_buffer_size();
    tiramisu::buffer *buff = new tiramisu::buffer("_" + this->name + "_buffer",
            (*dim_sizes),
            this->get_data_type(),
            tiramisu::a_temporary,
            this->get_function());
    this->automatically_allocated_buffer = buff;
    tiramisu::computation *allocation = buff->allocate_at(comp, L0);
    this->store_in(buff);
    if (comp.get_predecessor() != NULL)
        allocation->between(
            *(comp.get_predecessor()),
            L0_var, comp, L0_var);
    else
        allocation->before(comp, L0);
    DEBUG_INDENT(-4);
    return allocation;
}
tiramisu :: computation * computation :: store_at ( tiramisu :: computation & comp , tiramisu :: var L0_var ) { DEBUG_FCT_NAME ( 3 ) ; DEBUG_INDENT ( 4 ) ; assert ( L0_var . get_name ( ) . length ( ) > 0 ) ; std :: vector < int > dimensions = this -> get_loop_level_numbers_from_dimension_names ( { L0_var . get_name ( ) } ) ; this -> check_dimensions_validity ( dimensions ) ; int L0 = dimensions [ 0 ] ; std :: vector < tiramisu :: expr > * dim_sizes = this -> compute_buffer_size ( ) ; tiramisu :: buffer * buff = new tiramisu :: buffer ( " " + this -> name + " " , ( * dim_sizes ) , this -> get_data_type ( ) , tiramisu :: a_temporary , this -> get_function ( ) ) ; this -> automatically_allocated_buffer = buff ; tiramisu :: computation * allocation = buff -> allocate_at ( comp , L0 ) ; this -> store_in ( buff ) ; if ( comp . get_predecessor ( ) != NULL ) allocation -> between ( * ( comp . get_predecessor ( ) ) , L0_var , comp , L0_var ) ; else allocation -> before ( comp , L0 ) ; DEBUG_INDENT ( -4 ) ; return allocation ; }
Algorithm:
 - Compute the size of the buffer:
      - TODO: Future work Use the same code that computes the needed area in compute_at,
      - TODO: From the needed area, deduce the size by computing the upper
              bound and the lower bound and subtracting the two.
Algorithm : - Compute the size of the buffer : - TODO : Future work Use the same code that computes the needed area in compute_at - TODO : From the needed area deduce the size by computing the upper bound and the lower bound and subtracting the two .