int isl_options_set_tile_scale_tile_loops(isl_ctx *ctx,
int val);
int isl_options_get_tile_scale_tile_loops(isl_ctx *ctx);
+ int isl_options_set_tile_shift_point_loops(isl_ctx *ctx,
+ int val);
+ int isl_options_get_tile_shift_point_loops(isl_ctx *ctx);
The C<isl_band_tile> function tiles the band using the given tile sizes
inside its schedule.
inserted between the modified band and its children.
The C<tile_scale_tile_loops> option specifies whether the tile
loops iterators should be scaled by the tile sizes.
+If the C<tile_shift_point_loops> option is set, then the point loops
+are shifted to start at zero.
A representation of the band can be printed using
int isl_options_set_tile_scale_tile_loops(isl_ctx *ctx, int val);
int isl_options_get_tile_scale_tile_loops(isl_ctx *ctx);
+int isl_options_set_tile_shift_point_loops(isl_ctx *ctx, int val);
+int isl_options_get_tile_shift_point_loops(isl_ctx *ctx);
int isl_band_tile(__isl_keep isl_band *band, __isl_take isl_vec *sizes);
/*
* Copyright 2011 INRIA Saclay
+ * Copyright 2012-2013 Ecole Normale Superieure
*
* Use of this software is governed by the MIT license
*
* Written by Sven Verdoolaege, INRIA Saclay - Ile-de-France,
* Parc Club Orsay Universite, ZAC des vignes, 4 rue Jacques Monod,
* 91893 Orsay, France
+ * and Ecole Normale Superieure, 45 rue d'Ulm, 75230 Paris, France
*/
#include <isl_band_private.h>
* a child band is created to refer to the point loops.
* The children of this point loop band are the children
* of the original band.
+ *
+ * If the scale tile loops option is set, then the tile loops
+ * are scaled by the tile sizes. If the shift point loops option is set,
+ * then the point loops are shifted to start at zero.
+ * In particular, these options affect the tile and point loop schedules
+ * as follows
+ *
+ * scale shift original tile point
+ *
+ * 0 0 i floor(i/s) i
+ * 1 0 i s * floor(i/s) i
+ * 0 1 i floor(i/s) i - s * floor(i/s)
+ * 1 1 i s * floor(i/s) i - s * floor(i/s)
*/
int isl_band_tile(__isl_keep isl_band *band, __isl_take isl_vec *sizes)
{
isl_ctx *ctx;
isl_band *child;
isl_band_list *list = NULL;
- isl_union_pw_multi_aff *sched;
+ isl_union_pw_multi_aff *sched = NULL, *child_sched = NULL;
if (!band || !sizes)
goto error;
sched = isl_union_pw_multi_aff_copy(band->pma);
sched = isl_union_pw_multi_aff_tile(sched, sizes);
- if (!sched)
+
+ child_sched = isl_union_pw_multi_aff_copy(child->pma);
+ if (isl_options_get_tile_shift_point_loops(ctx)) {
+ isl_union_pw_multi_aff *scaled;
+ scaled = isl_union_pw_multi_aff_copy(sched);
+ if (!isl_options_get_tile_scale_tile_loops(ctx))
+ scaled = isl_union_pw_multi_aff_scale_vec(scaled,
+ isl_vec_copy(sizes));
+ child_sched = isl_union_pw_multi_aff_sub(child_sched, scaled);
+ }
+ if (!sched || !child_sched)
goto error;
child->children = band->children;
child->parent = band;
isl_union_pw_multi_aff_free(band->pma);
band->pma = sched;
+ isl_union_pw_multi_aff_free(child->pma);
+ child->pma = child_sched;
isl_vec_free(sizes);
return 0;
error:
+ isl_union_pw_multi_aff_free(sched);
+ isl_union_pw_multi_aff_free(child_sched);
isl_band_list_free(list);
isl_vec_free(sizes);
return -1;
ISL_SCHEDULE_FUSE_MAX, "level of fusion during scheduling")
ISL_ARG_BOOL(struct isl_options, tile_scale_tile_loops, 0,
"tile-scale-tile-loops", 1, "scale tile loops")
+ISL_ARG_BOOL(struct isl_options, tile_shift_point_loops, 0,
+ "tile-shift-point-loops", 1, "shift point loops to start at zero")
ISL_ARG_STR(struct isl_options, ast_iterator_type, 0,
"ast-iterator-type", "type", "int",
"type used for iterators during printing of AST")
tile_scale_tile_loops)
ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
+ tile_shift_point_loops)
+ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
+ tile_shift_point_loops)
+
+ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
ast_build_atomic_upper_bound)
ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
ast_build_atomic_upper_bound)
int schedule_fuse;
int tile_scale_tile_loops;
+ int tile_shift_point_loops;
char *ast_iterator_type;