@@ -39,6 +39,56 @@ along with GCC; see the file COPYING3. If not see
#include "dumpfile.h"
#include "graphite.h"
+/* get_schedule_for_node_st - Improve schedule for the schedule node.
+ Only Simple loop tiling is considered. */
+
+static __isl_give isl_schedule_node *
+get_schedule_for_node_st (__isl_take isl_schedule_node *node, void *user)
+{
+ if (user)
+ return node;
+
+ if (isl_schedule_node_get_type (node) != isl_schedule_node_band
+ || isl_schedule_node_n_children (node) != 1)
+ return node;
+
+ isl_space *space = isl_schedule_node_band_get_space (node);
+ unsigned dims = isl_space_dim (space, isl_dim_set);
+ isl_schedule_node *child = isl_schedule_node_get_child (node, 0);
+ isl_schedule_node_type type = isl_schedule_node_get_type (child);
+ isl_space_free (space);
+ isl_schedule_node_free (child);
+
+ if (type != isl_schedule_node_leaf)
+ return node;
+
+ if (dims <= 1 || !isl_schedule_node_band_get_permutable (node))
+ {
+ if (dump_file && dump_flags)
+ fprintf (dump_file, "not tiled\n");
+ return node;
+ }
+
+ /* Tile loops. */
+ space = isl_schedule_node_band_get_space (node);
+ isl_multi_val *sizes = isl_multi_val_zero (space);
+ long tile_size = PARAM_VALUE (PARAM_LOOP_BLOCK_TILE_SIZE);
+ isl_ctx *ctx = isl_schedule_node_get_ctx (node);
+
+ for (unsigned i = 0; i < dims; i++)
+ {
+ sizes = isl_multi_val_set_val (sizes, i,
+ isl_val_int_from_si (ctx, tile_size));
+ if (dump_file && dump_flags)
+ fprintf (dump_file, "tiled by %ld\n", tile_size);
+ }
+
+ node = isl_schedule_node_band_tile (node, sizes);
+ node = isl_schedule_node_child (node, 0);
+
+ return node;
+}
+
static isl_union_set *
scop_get_domains (scop_p scop)
{
@@ -83,6 +133,7 @@ optimize_isl (scop_p scop)
sc = isl_schedule_constraints_set_validity (sc, isl_union_map_copy (validity));
sc = isl_schedule_constraints_set_coincidence (sc, validity);
+ isl_options_set_tile_scale_tile_loops (scop->isl_context, 32);
isl_options_set_schedule_serialize_sccs (scop->isl_context, 0);
isl_options_set_schedule_maximize_band_depth (scop->isl_context, 1);
isl_options_set_schedule_max_constant_term (scop->isl_context, 20);
@@ -95,6 +146,9 @@ optimize_isl (scop_p scop)
isl_options_set_ast_build_atomic_upper_bound (scop->isl_context, 1);
scop->transformed_schedule = isl_schedule_constraints_compute_schedule (sc);
+ scop->transformed_schedule =
+ isl_schedule_map_schedule_node_bottom_up (scop->transformed_schedule,
+ get_schedule_for_node_st, NULL);
isl_options_set_on_error (scop->isl_context, ISL_ON_ERROR_ABORT);
isl_ctx_reset_operations (scop->isl_context);
@@ -833,7 +833,7 @@ DEFPARAM (PARAM_SWITCH_CONVERSION_BRANCH_RATIO,
DEFPARAM (PARAM_LOOP_BLOCK_TILE_SIZE,
"loop-block-tile-size",
"size of tiles for loop blocking.",
- 51, 0, 0)
+ 32, 0, 0)
/* Maximal number of parameters that we allow in a SCoP. */
@@ -45,4 +45,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "1" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
@@ -55,4 +55,4 @@ main (void)
}
/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
-/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "1" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "codegen error: reverting back to the original code" "1" "graphite" } } */
@@ -49,4 +49,5 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "1" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "codegen error: reverting back to the original code" "1" "graphite" } } */
@@ -21,4 +21,4 @@ main ()
return 0;
}
-/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "1" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
@@ -46,4 +46,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "2" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "2" "graphite" } } */
@@ -53,5 +53,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
-/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "1" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "2" "graphite" } } */
@@ -54,5 +54,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
-/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "1" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "2" "graphite" } } */
@@ -48,4 +48,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "2" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
@@ -46,4 +46,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "2" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "2" "graphite" } } */
@@ -47,4 +47,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "2" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "2" "graphite" } } */
@@ -82,5 +82,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "codegen error: reverting back to the original code" "1" "graphite" } } */
-/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "1" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
@@ -58,4 +58,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "2" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
@@ -45,4 +45,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "1" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
@@ -54,5 +54,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
-/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "1" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "2" "graphite" } } */
@@ -55,5 +55,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
-/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "1" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "2" "graphite" } } */
@@ -49,4 +49,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "2" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
@@ -59,4 +59,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "2" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
@@ -24,4 +24,4 @@ SUBROUTINE mult(A,B,C,N)
ENDDO
END SUBROUTINE mult
-! { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "1" "graphite" } }
+! { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } }