Skip to content

Commit

Permalink
replace cloog_domain_integral_lowerbound by cloog_domain_can_stride
Browse files Browse the repository at this point in the history
What cloog_loop_stride really wants to know is whether it is allowed
to perform stride detection.  Currently, this means that lower bound
should be a constant, but some backends may want to relax this condition.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
  • Loading branch information
Sven Verdoolaege committed Jun 29, 2010
1 parent dec3e4a commit f40d196
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
2 changes: 1 addition & 1 deletion include/cloog/domain.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ CloogDomain * cloog_domain_project(CloogDomain *, int);
CloogDomain * cloog_domain_extend(CloogDomain *, int);
int cloog_domain_never_integral(CloogDomain *) ;
void cloog_domain_stride(CloogDomain *, int, cloog_int_t *, cloog_int_t *);
int cloog_domain_integral_lowerbound(CloogDomain *, int, cloog_int_t *);
int cloog_domain_can_stride(CloogDomain *domain, int level);
int cloog_domain_lazy_disjoint(CloogDomain *, CloogDomain *) ;
int cloog_domain_lazy_equal(CloogDomain *, CloogDomain *) ;
int cloog_scattering_lazy_block(CloogScattering *, CloogScattering *,
Expand Down
14 changes: 6 additions & 8 deletions source/isl/domain.c
Original file line number Diff line number Diff line change
Expand Up @@ -642,16 +642,14 @@ void cloog_domain_stride(CloogDomain *domain, int strided_level,


/**
* cloog_domain_integral_lowerbound function:
* This function returns 1 if the lower bound of an iterator (such as its
* column rank in the constraint set 'domain' is 'level') is integral,
* 0 otherwise. If the lower bound is actually integral, the function fills
* the 'lower' field with the lower bound value.
* Return 1 if CLooG is allowed to perform stride detection on level "level"
* and 0 otherwise.
* Currently, stride detection should only be performed when the lower
* bound at the given level is a constant.
*/
int cloog_domain_integral_lowerbound(CloogDomain *domain, int level,
cloog_int_t *lower)
int cloog_domain_can_stride(CloogDomain *domain, int level)
{
return isl_set_fast_dim_has_fixed_lower_bound(&domain->set, level-1, lower);
return isl_set_fast_dim_has_fixed_lower_bound(&domain->set, level-1, NULL);
}


Expand Down
9 changes: 4 additions & 5 deletions source/loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -1154,25 +1154,25 @@ CloogLoop *cloog_loop_nest(CloogLoop *loop, CloogDomain *context, int level)
*/
void cloog_loop_stride(CloogLoop * loop, int level)
{ int first_search ;
cloog_int_t stride, ref_offset, offset, potential, lower;
cloog_int_t stride, ref_offset, offset, potential;
CloogLoop * inner ;

if (!cloog_domain_can_stride(loop->domain, level))
return;

cloog_int_init(stride);
cloog_int_init(ref_offset);
cloog_int_init(offset);
cloog_int_init(potential);
cloog_int_init(lower);

cloog_int_set_si(ref_offset, 0);
cloog_int_set_si(offset, 0);
cloog_int_set_si(lower, 0);

/* Default stride. */
cloog_int_set_si(stride, 1);
first_search = 1 ;
inner = loop->inner ;

if (cloog_domain_integral_lowerbound(loop->domain,level,&lower))
while (inner != NULL)
{ /* If the minimun stride has not been found yet, find the stride. */
if ((first_search) || (!cloog_int_is_one(stride)))
Expand Down Expand Up @@ -1214,7 +1214,6 @@ void cloog_loop_stride(CloogLoop * loop, int level)
cloog_int_clear(ref_offset);
cloog_int_clear(offset);
cloog_int_clear(potential);
cloog_int_clear(lower);
}


Expand Down

0 comments on commit f40d196

Please sign in to comment.