From cfa97215d1919251bd970dc7ce97871313c9dd30 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Wed, 27 May 2015 15:57:39 +0200 Subject: [PATCH] replace --schedule-fuse option by --schedule-serialize-sccs option The only effect of setting the --schedule-fuse option to min was to serialize the strongly connected components in the dependence graph as soon as they arise. It is better to let the option name reflect this effect more directly since the --schedule-fuse option is not about fusion per se. In particular, the default value "max" in itself does not result in maximal fusion and may therefore be confusing to users. Internally, the schedule_fuse option is completely removed. It is also removed from the C API. However, the command line option is kept for now to ease the transition. Signed-off-by: Sven Verdoolaege --- doc/user.pod | 25 ++++++++++++++++--------- include/isl/arg.h | 10 ++++++++++ include/isl/schedule.h | 6 ++---- isl_arg.c | 2 ++ isl_options.c | 34 ++++++++++++++++++++++++++++------ isl_options_private.h | 2 +- isl_scheduler.c | 4 ++-- 7 files changed, 61 insertions(+), 22 deletions(-) diff --git a/doc/user.pod b/doc/user.pod index 4d79130c..4b957b32 100644 --- a/doc/user.pod +++ b/doc/user.pod @@ -249,6 +249,11 @@ have been renamed to C and C. The original names have been kept for backward compatibility, but they will be removed in the future. +=item * The C option has been replaced +by the C option. The effect +of setting the C option to C +is now obtained by turning on the C option. + =back =head1 License @@ -8647,8 +8652,9 @@ L. isl_ctx *ctx, int val); int isl_options_get_schedule_max_constant_term( isl_ctx *ctx); - isl_stat isl_options_set_schedule_fuse(isl_ctx *ctx, int val); - int isl_options_get_schedule_fuse(isl_ctx *ctx); + isl_stat isl_options_set_schedule_serialize_sccs( + isl_ctx *ctx, int val); + int isl_options_get_schedule_serialize_sccs(isl_ctx *ctx); isl_stat isl_options_set_schedule_maximize_band_depth( isl_ctx *ctx, int val); int isl_options_get_schedule_maximize_band_depth( @@ -8689,13 +8695,14 @@ increase the speed of the scheduling calculation and may also prevent fusing of unrelated dimensions. A value of -1 means that this option does not introduce bounds on the constant coefficients. -=item * schedule_fuse +=item * schedule_serialize_sccs -This option controls the level of fusion. -If this option is set to C, then loops in the -resulting schedule will be distributed as much as possible. -If this option is set to C, then C will -try to fuse loops in the resulting schedule. +If this option is set, then all strongly connected components +in the dependence graph are serialized as soon as they are detected. +This means in particular that instances of statements will only +appear in the same band node if these statements belong +to the same strongly connected component at the point where +the band node is constructed. =item * schedule_maximize_band_depth @@ -8704,7 +8711,7 @@ where we detect splitting is necessary. Instead, we backtrack and split bands as early as possible. This reduces the number of splits and maximizes the width of the bands. Wider bands give more possibilities for tiling. -Note that if the C option is set to C, +Note that if the C options is set, then bands will be split as early as possible, even if there is no need. The C option therefore has no effect in this case. diff --git a/include/isl/arg.h b/include/isl/arg.h index 896293a9..0d37d1ca 100644 --- a/include/isl/arg.h +++ b/include/isl/arg.h @@ -148,6 +148,16 @@ struct isl_args { .u = { .choice = { .choice = c, .default_value = d, \ .default_selected = ds, .set = NULL } } \ }, +#define ISL_ARG_PHANTOM_USER_CHOICE_F(s,l,c,setter,d,h,fl) { \ + .type = isl_arg_choice, \ + .short_name = s, \ + .long_name = l, \ + .offset = -1, \ + .help_msg = h, \ + .flags = fl, \ + .u = { .choice = { .choice = c, .default_value = d, \ + .default_selected = d, .set = setter } } \ +}, #define ISL_ARG_USER_OPT_CHOICE(st,f,s,l,c,setter,d,ds,h) { \ .type = isl_arg_choice, \ .short_name = s, \ diff --git a/include/isl/schedule.h b/include/isl/schedule.h index b28adc8c..7a037895 100644 --- a/include/isl/schedule.h +++ b/include/isl/schedule.h @@ -35,10 +35,8 @@ int isl_options_get_schedule_split_scaled(isl_ctx *ctx); isl_stat isl_options_set_schedule_separate_components(isl_ctx *ctx, int val); int isl_options_get_schedule_separate_components(isl_ctx *ctx); -#define ISL_SCHEDULE_FUSE_MAX 0 -#define ISL_SCHEDULE_FUSE_MIN 1 -isl_stat isl_options_set_schedule_fuse(isl_ctx *ctx, int val); -int isl_options_get_schedule_fuse(isl_ctx *ctx); +isl_stat isl_options_set_schedule_serialize_sccs(isl_ctx *ctx, int val); +int isl_options_get_schedule_serialize_sccs(isl_ctx *ctx); __isl_give isl_schedule_constraints *isl_schedule_constraints_copy( __isl_keep isl_schedule_constraints *sc); diff --git a/isl_arg.c b/isl_arg.c index e23911a8..70d1b345 100644 --- a/isl_arg.c +++ b/isl_arg.c @@ -20,6 +20,8 @@ ISL_ARG_PHANTOM_BOOL('h', "help", NULL, "print this help, then exit") static void set_default_choice(struct isl_arg *arg, void *opt) { + if (arg->offset == (size_t) -1) + return; *(unsigned *)(((char *)opt) + arg->offset) = arg->u.choice.default_value; } diff --git a/isl_options.c b/isl_options.c index f41b6e0e..cdb578ae 100644 --- a/isl_options.c +++ b/isl_options.c @@ -72,12 +72,30 @@ static struct isl_arg_choice convex[] = { {0} }; +#define ISL_SCHEDULE_FUSE_MAX 0 +#define ISL_SCHEDULE_FUSE_MIN 1 + static struct isl_arg_choice fuse[] = { {"max", ISL_SCHEDULE_FUSE_MAX}, {"min", ISL_SCHEDULE_FUSE_MIN}, {0} }; +/* Callback for setting the "schedule-fuse" option. + * This (now hidden) option tries to mimic an option that was + * replaced by the schedule-serialize-sccs option. + * Setting the old option to ISL_SCHEDULE_FUSE_MIN is now + * expressed by turning on the schedule-serialize-sccs option. + */ +static int set_fuse(void *opt, unsigned val) +{ + struct isl_options *options = opt; + + options->schedule_serialize_sccs = (val == ISL_SCHEDULE_FUSE_MIN); + + return 0; +} + static struct isl_arg_choice separation_bounds[] = { {"explicit", ISL_AST_BUILD_SEPARATION_BOUNDS_EXPLICIT}, {"implicit", ISL_AST_BUILD_SEPARATION_BOUNDS_IMPLICIT}, @@ -142,8 +160,12 @@ ISL_ARG_BOOL(struct isl_options, schedule_separate_components, 0, ISL_ARG_CHOICE(struct isl_options, schedule_algorithm, 0, "schedule-algorithm", isl_schedule_algorithm_choice, ISL_SCHEDULE_ALGORITHM_ISL, "scheduling algorithm to use") -ISL_ARG_CHOICE(struct isl_options, schedule_fuse, 0, "schedule-fuse", fuse, - ISL_SCHEDULE_FUSE_MAX, "level of fusion during scheduling") +ISL_ARG_BOOL(struct isl_options, schedule_serialize_sccs, 0, + "schedule-serialize-sccs", 0, + "serialize strongly connected components in dependence graph") +ISL_ARG_PHANTOM_USER_CHOICE_F(0, "schedule-fuse", fuse, &set_fuse, + ISL_SCHEDULE_FUSE_MAX, "level of fusion during scheduling", + ISL_ARG_HIDDEN) 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, @@ -239,10 +261,10 @@ ISL_CTX_SET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args, ISL_CTX_GET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args, schedule_algorithm) -ISL_CTX_SET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args, - schedule_fuse) -ISL_CTX_GET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args, - schedule_fuse) +ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args, + schedule_serialize_sccs) +ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args, + schedule_serialize_sccs) ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args, tile_scale_tile_loops) diff --git a/isl_options_private.h b/isl_options_private.h index fbf81fa6..0907d219 100644 --- a/isl_options_private.h +++ b/isl_options_private.h @@ -43,7 +43,7 @@ struct isl_options { int schedule_split_scaled; int schedule_separate_components; unsigned schedule_algorithm; - int schedule_fuse; + int schedule_serialize_sccs; int tile_scale_tile_loops; int tile_shift_point_loops; diff --git a/isl_scheduler.c b/isl_scheduler.c index 41e839e5..c1e15b79 100644 --- a/isl_scheduler.c +++ b/isl_scheduler.c @@ -4230,7 +4230,7 @@ static __isl_give isl_schedule_node *compute_component_schedule( * We first check if the graph is connected (through validity and conditional * validity dependences) and, if not, compute a schedule * for each component separately. - * If schedule_fuse is set to minimal fusion, then we check for strongly + * If the schedule_serialize_sccs option is set, then we check for strongly * connected components instead and compute a separate schedule for * each such strongly connected component. */ @@ -4243,7 +4243,7 @@ static __isl_give isl_schedule_node *compute_schedule(isl_schedule_node *node, return NULL; ctx = isl_schedule_node_get_ctx(node); - if (ctx->opt->schedule_fuse == ISL_SCHEDULE_FUSE_MIN) { + if (isl_options_get_schedule_serialize_sccs(ctx)) { if (detect_sccs(ctx, graph) < 0) return isl_schedule_node_free(node); } else { -- 2.11.4.GIT