44 for (i = 0; i < c->
n; ++i) {
68 for (i = 0; i < c->
n; ++i)
72 for (i = 0; i < c->
n; ++i)
117 int i, best = graph->
n_edge, best_dist, best_weight;
119 for (i = 0; i < graph->
n_edge; ++i) {
139 if (best < graph->n_edge) {
142 if (best_weight ==
weight && best_dist <= dist)
182 if (data->
src == i && data->
dst == j)
184 if (data->
src == j && data->
dst == i)
186 if (scc_cluster[graph->
node[i].
scc] == scc_cluster[graph->
node[j].
scc])
222 for (i = 0; i < c->
n; ++i)
238 "expecting at least two nodes in component",
240 if (g->
order[--i] != -1)
242 "expecting end of component marker",
goto error);
244 for (--i; i >= 0 && g->
order[i] != -1; --i) {
262 snprintf(
name,
sizeof(
name),
"cluster_%d", i);
305 for (i = 0; i < graph->
scc; ++i) {
331 for (i = 0; i < graph->
scc; ++i) {
341 for (j = 0; j < c->
scc[i].
n; ++j) {
481 for (i = 0; i < graph->
n_edge; ++i) {
484 if (!scc_in_merge[edge->
src->
scc])
486 if (!scc_in_merge[edge->
dst->
scc])
544 for (i = 0; i < c->
n; ++i) {
551 nvar =
scc->n_total_row -
scc->band_start;
554 for (j = 0; j <
scc->n; ++j) {
561 if (slack > max_slack)
584 for (i = 0; i < c->
n; ++i) {
591 nvar =
scc->n_total_row -
scc->band_start;
594 for (j = 0; j <
scc->n; ++j) {
601 if (slack > max_slack) {
639 if (maxvar < merge_graph->maxvar) {
643 merge_graph->
maxvar = maxvar;
656 for (i = graph->
band_start; i < graph->n_total_row; ++i)
679 for (i = 0; i < c->
n; ++i) {
683 if (n_coincident > max_coincident)
684 max_coincident = n_coincident;
689 return isl_bool_ok(n_coincident >= max_coincident);
760 if (bounded < 0 || !bounded)
803 if (single < 0 || single)
863 for (i = 0; i <
n; ++i) {
884 if (!bounded && i >=
n && edge->
weight >= 0)
913 for (i = 0; i < graph->
n_edge; ++i) {
928 if (bounded < 0 || bounded)
997 if (n_row < 0 || n_col < 0)
1002 for (i = 0; i < n_row; ++i) {
1005 for (j = 0; j <
n; ++j)
1007 t_node->
sched->
row[i][1 + n_param + j],
1009 1 + n_param + n_var);
1037 for (i = 0; i < graph->
n; ++i) {
1047 for (j = 0; j < n_new; ++j)
1053 graph->
n_row += n_new;
1075 for (i = 0; i < c->
n; ++i) {
1089 "unable to find cluster",
1145 merged =
ok_to_merge(ctx, graph, c, &merge_graph);
1146 if (merged &&
merge(ctx, c, &merge_graph) < 0)
1174 for (i = 0; i < graph->
n_edge; ++i) {
1177 if (!scc_in_merge[edge->
src->
scc])
1179 if (!scc_in_merge[edge->
dst->
scc])
1225 if (!merged && edge_weight == graph->
edge[edge].
weight)
1235 return node->
cluster == cluster;
1257 sched = node1->
sched;
1259 node2->
sched = sched;
1286 for (i = 0; i < graph->
n; ++i) {
1337 for (i = 0; i < graph->
n; ++i)
1340 for (i = 0; i < graph->
scc; ++i) {
1356 for (i = 0; i < graph->
n; ++i)
1385 for (i = 0; i < graph->
n_edge; ++i) {
1417 if (n_in < 0 || n_out < 0)
__isl_overload __isl_give isl_multi_aff * isl_multi_aff_pullback_multi_aff(__isl_take isl_multi_aff *ma1, __isl_take isl_multi_aff *ma2)
struct isl_multi_aff isl_multi_aff
for(int c0=1;c0< 3 *M - 1;c0+=3)
#define isl_die(ctx, errno, msg, code)
isl_bool isl_bool_ok(int b)
#define isl_calloc_array(ctx, type, n)
isl_bool isl_bool_not(isl_bool b)
isl_stat isl_stat(*) void user)
isl_bool isl_bool(* test)(__isl_keep ISL_KEY *key, __isl_keep ISL_VAL *val, void *user)
__isl_null isl_id * isl_id_free(__isl_take isl_id *id)
__isl_give isl_id * isl_id_copy(isl_id *id)
__isl_give isl_id * isl_id_alloc(isl_ctx *ctx, __isl_keep const char *name, void *user)
isl_size isl_basic_map_n_equality(__isl_keep isl_basic_map *bmap)
static unsigned pos(__isl_keep isl_space *space, enum isl_dim_type type)
__isl_give isl_basic_map * isl_basic_map_transform_dims(__isl_take isl_basic_map *bmap, enum isl_dim_type type, unsigned first, __isl_take isl_mat *trans)
__isl_give isl_schedule_constraints * isl_schedule_constraints_add(__isl_take isl_schedule_constraints *sc, enum isl_edge_type type, __isl_take isl_union_map *c)
@ isl_edge_conditional_validity
isl_bool isl_sched_graph_has_validity_edge(struct isl_sched_graph *graph, struct isl_sched_node *src, struct isl_sched_node *dst)
int isl_sched_edge_has_type(struct isl_sched_edge *edge, enum isl_edge_type type)
__isl_give isl_multi_aff * isl_sched_node_extract_partial_schedule_multi_aff(struct isl_sched_node *node, int first, int n)
int isl_sched_edge_is_proximity(struct isl_sched_edge *edge)
__isl_give isl_schedule_node * isl_schedule_node_compute_finish_band(__isl_take isl_schedule_node *node, struct isl_sched_graph *graph, int initialized)
isl_stat isl_sched_node_update_vmap(struct isl_sched_node *node)
int isl_sched_graph_is_node(struct isl_sched_graph *graph, struct isl_sched_node *node)
isl_stat isl_sched_graph_init(struct isl_sched_graph *graph, __isl_keep isl_schedule_constraints *sc)
int isl_sched_edge_is_conditional_validity(struct isl_sched_edge *edge)
isl_stat isl_schedule_node_compute_wcc_band(isl_ctx *ctx, struct isl_sched_graph *graph)
int isl_sched_edge_scc_exactly(struct isl_sched_edge *edge, int scc)
struct isl_sched_node * isl_sched_graph_find_node(isl_ctx *ctx, struct isl_sched_graph *graph, __isl_keep isl_space *space)
__isl_give isl_union_set_list * isl_sched_graph_extract_sccs(isl_ctx *ctx, struct isl_sched_graph *graph)
int isl_sched_edge_is_condition(struct isl_sched_edge *edge)
isl_stat isl_sched_graph_detect_ccs(isl_ctx *ctx, struct isl_sched_graph *graph, isl_bool(*follows)(int i, int j, void *user))
isl_stat isl_sched_graph_extract_sub_graph(isl_ctx *ctx, struct isl_sched_graph *graph, int(*node_pred)(struct isl_sched_node *node, int data), int(*edge_pred)(struct isl_sched_edge *edge, int data), int data, struct isl_sched_graph *sub)
isl_stat isl_sched_graph_compute_maxvar(struct isl_sched_graph *graph)
int isl_sched_node_scc_exactly(struct isl_sched_node *node, int scc)
void isl_sched_graph_free(isl_ctx *ctx, struct isl_sched_graph *graph)
static int merge_edge(struct isl_sched_edge *edge1, struct isl_sched_edge *edge2)
static isl_bool ok_to_merge(isl_ctx *ctx, struct isl_sched_graph *graph, struct isl_clustering *c, struct isl_sched_graph *merge_graph)
static __isl_give isl_schedule_node * finish_bands_clustering(__isl_take isl_schedule_node *node, struct isl_sched_graph *graph, struct isl_clustering *c)
static __isl_give isl_mat * node_transformation(isl_ctx *ctx, struct isl_sched_node *t_node, struct isl_sched_node *node, int first, int n)
static isl_stat init_merge_graph(isl_ctx *ctx, struct isl_sched_graph *graph, struct isl_clustering *c, struct isl_sched_graph *merge_graph)
static __isl_give isl_schedule_node * finish_bands_decompose(__isl_take isl_schedule_node *node, struct isl_sched_graph *graph, struct isl_clustering *c)
static __isl_give isl_schedule_constraints * collect_constraints(struct isl_sched_graph *graph, int *scc_in_merge, __isl_keep isl_union_map *cluster_map, __isl_take isl_schedule_constraints *sc)
static int get_n_coincident(struct isl_sched_graph *graph)
static int find_proximity(struct isl_sched_graph *graph, struct isl_clustering *c)
static isl_bool distance_is_bounded(__isl_keep isl_set *set, int pos)
static void clustering_free(isl_ctx *ctx, struct isl_clustering *c)
static int edge_cluster_exactly(struct isl_sched_edge *edge, int cluster)
static isl_bool has_bounded_distances(isl_ctx *ctx, struct isl_sched_edge *edge, struct isl_sched_graph *graph, struct isl_clustering *c, struct isl_sched_graph *merge_graph)
static isl_stat adjust_maxvar_to_slack(isl_ctx *ctx, struct isl_sched_graph *merge_graph, struct isl_clustering *c)
static isl_size compute_maxvar_max_slack(int maxvar, struct isl_clustering *c)
static __isl_give isl_schedule_constraints * add_non_conditional_constraints(struct isl_sched_edge *edge, __isl_keep isl_union_map *umap, __isl_take isl_schedule_constraints *sc)
static __isl_give isl_union_map * collect_cluster_map(isl_ctx *ctx, struct isl_sched_graph *graph, struct isl_clustering *c)
static isl_stat merge_clusters_along_edge(isl_ctx *ctx, struct isl_sched_graph *graph, int edge, struct isl_clustering *c)
static isl_bool ok_to_merge_coincident(struct isl_clustering *c, struct isl_sched_graph *merge_graph)
static __isl_give isl_schedule_constraints * add_conditional_constraints(struct isl_sched_edge *edge, __isl_keep isl_union_map *umap, __isl_take isl_schedule_constraints *sc)
static isl_bool has_singular_src_or_dst(__isl_keep isl_map *map, int pos)
static void swap_sched(struct isl_sched_node *node1, struct isl_sched_node *node2)
static __isl_give isl_schedule_constraints * collect_edge_constraints(struct isl_sched_edge *edge, __isl_keep isl_union_map *cluster_map, __isl_take isl_schedule_constraints *sc)
static int node_cluster_exactly(struct isl_sched_node *node, int cluster)
static __isl_give isl_space * cluster_space(struct isl_sched_graph *scc, int i)
static isl_stat mark_merge_sccs(isl_ctx *ctx, struct isl_sched_graph *graph, int edge, struct isl_clustering *c)
static __isl_give isl_map * extract_node_transformation(isl_ctx *ctx, struct isl_sched_node *node, struct isl_clustering *c, struct isl_sched_graph *merge_graph)
static isl_stat clustering_init(isl_ctx *ctx, struct isl_clustering *c, struct isl_sched_graph *graph)
static isl_stat transform(isl_ctx *ctx, struct isl_sched_graph *graph, struct isl_sched_node *t_node)
static isl_bool is_non_empty_proximity(struct isl_sched_edge *edge)
static isl_bool try_merge(isl_ctx *ctx, struct isl_sched_graph *graph, struct isl_clustering *c)
static __isl_give isl_id * cluster_id(isl_ctx *ctx, int i)
static isl_stat merge(isl_ctx *ctx, struct isl_clustering *c, struct isl_sched_graph *merge_graph)
static isl_stat copy_partial(struct isl_sched_graph *graph, struct isl_clustering *c, int pos)
static isl_bool cluster_follows(int i, int j, void *user)
__isl_give isl_schedule_node * isl_schedule_node_compute_wcc_clustering(__isl_take isl_schedule_node *node, struct isl_sched_graph *graph)
static __isl_give isl_union_set * collect_domain(isl_ctx *ctx, struct isl_sched_graph *graph, struct isl_clustering *c)
static isl_stat extract_clusters(isl_ctx *ctx, struct isl_sched_graph *graph, struct isl_clustering *c)
static int bad_cluster(struct isl_sched_graph *graph)
static isl_bool has_single_value(__isl_keep isl_set *set, int pos)
static isl_bool node_follows_strong_or_same_cluster(int i, int j, void *user)
static isl_size limit_maxvar_to_slack(int maxvar, int max_slack, struct isl_clustering *c)
static int any_no_merge(struct isl_sched_graph *graph, int *scc_in_merge, struct isl_sched_edge *merge_edge)
static isl_bool ok_to_merge_proximity(isl_ctx *ctx, struct isl_sched_graph *graph, struct isl_clustering *c, struct isl_sched_graph *merge_graph)
static isl_stat compute_weights(struct isl_sched_graph *graph, struct isl_clustering *c)
__isl_give isl_schedule_node * isl_scc_graph_decompose(struct isl_scc_graph *scc_graph, __isl_take isl_schedule_node *node)
struct isl_scc_graph * isl_scc_graph_from_sched_graph(isl_ctx *ctx, struct isl_sched_graph *graph, struct isl_clustering *c)
struct isl_scc_graph * isl_scc_graph_free(struct isl_scc_graph *scc_graph)
void isl_seq_clr(isl_int *p, unsigned len)
void isl_seq_cpy(isl_int *dst, isl_int *src, unsigned len)
void isl_seq_addmul(isl_int *dst, isl_int f, isl_int *src, unsigned len)
struct isl_tarjan_graph * isl_tarjan_graph_component(isl_ctx *ctx, int len, int node, isl_bool(*follows)(int i, int j, void *user), void *user)
struct isl_tarjan_graph * isl_tarjan_graph_free(struct isl_tarjan_graph *g)
#define isl_union_set_list
__isl_give isl_basic_map * isl_basic_map_drop_constraints_not_involving_dims(__isl_take isl_basic_map *bmap, enum isl_dim_type type, unsigned first, unsigned n)
__isl_export __isl_give isl_set * isl_map_domain(__isl_take isl_map *bmap)
__isl_export __isl_give isl_map * isl_map_apply_domain(__isl_take isl_map *map1, __isl_take isl_map *map2)
__isl_give isl_basic_map * isl_basic_map_project_out(__isl_take isl_basic_map *bmap, enum isl_dim_type type, unsigned first, unsigned n)
__isl_export __isl_give isl_map * isl_map_apply_range(__isl_take isl_map *map1, __isl_take isl_map *map2)
__isl_give isl_map * isl_map_copy(__isl_keep isl_map *map)
__isl_null isl_basic_map * isl_basic_map_free(__isl_take isl_basic_map *bmap)
__isl_export __isl_give isl_space * isl_map_get_space(__isl_keep isl_map *map)
isl_size isl_basic_map_dim(__isl_keep isl_basic_map *bmap, enum isl_dim_type type)
__isl_give isl_basic_map * isl_basic_map_remove_divs(__isl_take isl_basic_map *bmap)
__isl_export __isl_give isl_set * isl_map_deltas(__isl_take isl_map *map)
isl_bool isl_map_plain_is_empty(__isl_keep isl_map *map)
__isl_export __isl_give isl_basic_map * isl_map_affine_hull(__isl_take isl_map *map)
__isl_null isl_map * isl_map_free(__isl_take isl_map *map)
__isl_export __isl_give isl_set * isl_map_range(__isl_take isl_map *map)
__isl_give isl_map * isl_map_from_multi_aff(__isl_take isl_multi_aff *maff)
__isl_give isl_mat * isl_mat_copy(__isl_keep isl_mat *mat)
isl_size isl_mat_cols(__isl_keep isl_mat *mat)
isl_size isl_mat_rows(__isl_keep isl_mat *mat)
__isl_give isl_mat * isl_mat_drop_rows(__isl_take isl_mat *mat, unsigned row, unsigned n)
__isl_give isl_mat * isl_mat_alloc(isl_ctx *ctx, unsigned n_row, unsigned n_col)
__isl_give isl_mat * isl_mat_concat(__isl_take isl_mat *top, __isl_take isl_mat *bot)
__isl_null isl_schedule_constraints * isl_schedule_constraints_free(__isl_take isl_schedule_constraints *sc)
int isl_options_get_schedule_maximize_coincidence(isl_ctx *ctx)
__isl_export __isl_give isl_schedule_constraints * isl_schedule_constraints_on_domain(__isl_take isl_union_set *domain)
int isl_options_get_schedule_maximize_band_depth(isl_ctx *ctx)
__isl_give isl_schedule_node * isl_schedule_node_grandchild(__isl_take isl_schedule_node *node, int pos1, int pos2)
__isl_give isl_schedule_node * isl_schedule_node_grandparent(__isl_take isl_schedule_node *node)
__isl_null isl_schedule_node * isl_schedule_node_free(__isl_take isl_schedule_node *node)
__isl_export __isl_give isl_schedule_node * isl_schedule_node_insert_sequence(__isl_take isl_schedule_node *node, __isl_take isl_union_set_list *filters)
isl_ctx * isl_schedule_node_get_ctx(__isl_keep isl_schedule_node *node)
__isl_export __isl_give isl_set * isl_set_universe(__isl_take isl_space *space)
__isl_give isl_set * isl_set_lower_bound_si(__isl_take isl_set *set, enum isl_dim_type type, unsigned pos, int value)
__isl_export isl_bool isl_set_is_singleton(__isl_keep isl_set *set)
__isl_null isl_set * isl_set_free(__isl_take isl_set *set)
__isl_give isl_set * isl_set_copy(__isl_keep isl_set *set)
__isl_give isl_set * isl_set_project_out(__isl_take isl_set *set, enum isl_dim_type type, unsigned first, unsigned n)
isl_size isl_set_dim(__isl_keep isl_set *set, enum isl_dim_type type)
__isl_give isl_set * isl_set_upper_bound_si(__isl_take isl_set *set, enum isl_dim_type type, unsigned pos, int value)
__isl_export isl_bool isl_set_is_empty(__isl_keep isl_set *set)
__isl_give isl_space * isl_space_set_tuple_id(__isl_take isl_space *space, enum isl_dim_type type, __isl_take isl_id *id)
__isl_null isl_space * isl_space_free(__isl_take isl_space *space)
__isl_export __isl_give isl_space * isl_space_params(__isl_take isl_space *space)
isl_ctx * isl_space_get_ctx(__isl_keep isl_space *space)
__isl_give isl_id * isl_space_get_tuple_id(__isl_keep isl_space *space, enum isl_dim_type type)
__isl_give isl_space * isl_space_set_from_params(__isl_take isl_space *space)
__isl_give isl_space * isl_space_copy(__isl_keep isl_space *space)
__isl_export __isl_give isl_space * isl_space_range(__isl_take isl_space *space)
__isl_give isl_space * isl_space_add_dims(__isl_take isl_space *space, enum isl_dim_type type, unsigned n)
__isl_give isl_space * isl_space_params_alloc(isl_ctx *ctx, unsigned nparam)
__isl_export __isl_give isl_space * isl_space_domain(__isl_take isl_space *space)
struct isl_sched_graph * cluster
struct isl_sched_graph * scc
struct isl_sched_graph * graph
struct isl_sched_graph * graph
struct isl_clustering * c
struct isl_sched_node * dst
isl_union_map * tagged_validity
isl_union_map * tagged_condition
struct isl_sched_node * src
struct isl_sched_node * node
struct isl_sched_edge * edge
__isl_null isl_union_map * isl_union_map_free(__isl_take isl_union_map *umap)
__isl_give isl_union_map * isl_union_map_add_map(__isl_take isl_union_map *umap, __isl_take isl_map *map)
__isl_export __isl_give isl_union_map * isl_union_map_apply_range(__isl_take isl_union_map *umap1, __isl_take isl_union_map *umap2)
__isl_give isl_union_map * isl_union_map_copy(__isl_keep isl_union_map *umap)
__isl_export __isl_give isl_union_map * isl_union_map_apply_domain(__isl_take isl_union_map *umap1, __isl_take isl_union_map *umap2)
__isl_export __isl_give isl_union_map * isl_union_map_product(__isl_take isl_union_map *umap1, __isl_take isl_union_map *umap2)
__isl_give isl_union_map * isl_union_map_empty(__isl_take isl_space *space)
__isl_constructor __isl_give isl_union_map * isl_union_map_from_map(__isl_take isl_map *map)
__isl_give isl_union_map * isl_union_map_intersect_domain(__isl_take isl_union_map *umap, __isl_take isl_union_set *uset)
__isl_export __isl_give isl_union_map * isl_union_map_zip(__isl_take isl_union_map *umap)
struct isl_union_set isl_union_set
__isl_give isl_union_set * isl_union_set_add_set(__isl_take isl_union_set *uset, __isl_take isl_set *set)
__isl_give isl_union_set * isl_union_set_empty(__isl_take isl_space *space)
__isl_constructor __isl_give isl_union_set * isl_union_set_from_set(__isl_take isl_set *set)