int main(int argc, char **argv) { isl_ctx *ctx; isl_printer *p; isl_schedule_constraints *sc; isl_schedule *schedule; struct isl_options *options; options = isl_options_new_with_defaults(); argc = isl_options_parse(options, argc, argv, ISL_ARG_ALL); ctx = isl_ctx_alloc_with_options(&isl_options_args, options); sc = isl_schedule_constraints_read_from_file(ctx, stdin); schedule = isl_schedule_constraints_compute_schedule(sc); p = isl_printer_to_file(ctx, stdout); p = isl_printer_set_yaml_style(p, ISL_YAML_STYLE_BLOCK); p = isl_printer_print_schedule(p, schedule); isl_printer_free(p); isl_schedule_free(schedule); isl_ctx_free(ctx); return p ? EXIT_SUCCESS : EXIT_FAILURE; }
/* Compute a schedule on the domain of "sc" that respects the schedule * constraints in "sc". * * "schedule" is a known correct schedule that is used to combine * groups of statements if options->group_chains is set. * In particular, statements that are executed consecutively in a sequence * in this schedule and where all instances of the second depend on * the instance of the first that is executed in the same iteration * of outer band nodes are grouped together into a single statement. * The schedule constraints are then mapped to these groups of statements * and the resulting schedule is expanded again to refer to the original * statements. */ __isl_give isl_schedule *ppcg_compute_schedule( __isl_take isl_schedule_constraints *sc, __isl_keep isl_schedule *schedule, struct ppcg_options *options) { struct ppcg_grouping grouping = { sc }; isl_union_pw_multi_aff *contraction; isl_union_map *umap; isl_schedule *res, *expansion; if (!options->group_chains) return isl_schedule_constraints_compute_schedule(sc); grouping.group_id = 0; if (isl_schedule_foreach_schedule_node_top_down(schedule, &detect_groups, &grouping) < 0) goto error; if (!grouping.contraction) { ppcg_grouping_clear(&grouping); return isl_schedule_constraints_compute_schedule(sc); } complete_grouping(&grouping); contraction = isl_union_pw_multi_aff_copy(grouping.contraction); umap = isl_union_map_from_union_pw_multi_aff(contraction); sc = isl_schedule_constraints_apply(sc, umap); res = isl_schedule_constraints_compute_schedule(sc); contraction = isl_union_pw_multi_aff_copy(grouping.contraction); expansion = isl_schedule_copy(grouping.schedule); res = isl_schedule_expand(res, contraction, expansion); ppcg_grouping_clear(&grouping); return res; error: ppcg_grouping_clear(&grouping); isl_schedule_constraints_free(sc); return NULL; }