From: Aditya Kumar <hiradi...@msn.com> The patch disables all optimizations when configuring gcc with isl 0.14 or earlier. The next patch makes use of the schedule-trees that is only availaible in isl 0.15.
ChangeLog: * Makefile.in: Regenerate. * Makefile.tpl: Export ISLVER. * configure: Regenerate. * config/isl.m4: Detect isl-0.15. gcc/ * Makefile.in: Set ISLVER in site.exp. * config.in: Regenerate. * configure: Regenerate. * configure.ac: Define HAVE_isl for isl-0.15. * graphite-isl-ast-to-gimple.c: Remove #ifdefs related to isl-0.15. * graphite-optimize-isl.c: Same. * graphite.c: Same. * graphite.h: Same. * toplev.c: Same. gcc/testsuite/ * g++.dg/graphite/graphite.exp: Only run the tests with isl-0.15. * gcc.dg/graphite/graphite.exp: Same. * gfortran.dg/graphite/graphite.exp: Same. libgomp/ * config/isl.m4: New file. * configure: Regenerate. * configure.ac: Detect isl-0.15. * testsuite/Makefile.am: Set ISLVER in libgomp-test-support.exp. * testsuite/Makefile.in: Regenerate. * testsuite/libgomp.graphite/graphite.exp: Only run the tests with isl-0.15. --- Makefile.in | 2 + Makefile.tpl | 2 + config/isl.m4 | 12 ++ configure | 29 ++++ gcc/Makefile.in | 1 + gcc/config.in | 6 - gcc/configure | 43 +---- gcc/configure.ac | 26 +-- gcc/graphite-isl-ast-to-gimple.c | 18 -- gcc/graphite-optimize-isl.c | 208 ------------------------ gcc/graphite.c | 12 +- gcc/graphite.h | 9 - gcc/testsuite/g++.dg/graphite/graphite.exp | 5 + gcc/testsuite/gcc.dg/graphite/graphite.exp | 5 + gcc/testsuite/gfortran.dg/graphite/graphite.exp | 5 + gcc/toplev.c | 6 +- libgomp/config/isl.m4 | 158 ++++++++++++++++++ libgomp/configure | 201 ++++++++++++++++++++++- libgomp/configure.ac | 24 +++ libgomp/testsuite/Makefile.am | 2 + libgomp/testsuite/Makefile.in | 3 + libgomp/testsuite/libgomp.graphite/graphite.exp | 5 + 22 files changed, 468 insertions(+), 314 deletions(-) create mode 100644 libgomp/config/isl.m4 diff --git a/Makefile.in b/Makefile.in index e9b5950..d2c5b9f 100644 --- a/Makefile.in +++ b/Makefile.in @@ -222,6 +222,7 @@ HOST_EXPORTS = \ GMPINC="$(HOST_GMPINC)"; export GMPINC; \ ISLLIBS="$(HOST_ISLLIBS)"; export ISLLIBS; \ ISLINC="$(HOST_ISLINC)"; export ISLINC; \ + ISLVER="$(HOST_ISLVER)"; export ISLVER; \ LIBELFLIBS="$(HOST_LIBELFLIBS)"; export LIBELFLIBS; \ LIBELFINC="$(HOST_LIBELFINC)"; export LIBELFINC; \ XGCC_FLAGS_FOR_TARGET="$(XGCC_FLAGS_FOR_TARGET)"; export XGCC_FLAGS_FOR_TARGET; \ @@ -315,6 +316,7 @@ HOST_GMPINC = @gmpinc@ # Where to find isl HOST_ISLLIBS = @isllibs@ HOST_ISLINC = @islinc@ +HOST_ISLVER = @islver@ # Where to find libelf HOST_LIBELFLIBS = @libelflibs@ diff --git a/Makefile.tpl b/Makefile.tpl index f7bb77e..88c2810 100644 --- a/Makefile.tpl +++ b/Makefile.tpl @@ -225,6 +225,7 @@ HOST_EXPORTS = \ GMPINC="$(HOST_GMPINC)"; export GMPINC; \ ISLLIBS="$(HOST_ISLLIBS)"; export ISLLIBS; \ ISLINC="$(HOST_ISLINC)"; export ISLINC; \ + ISLVER="$(HOST_ISLVER)"; export ISLVER; \ LIBELFLIBS="$(HOST_LIBELFLIBS)"; export LIBELFLIBS; \ LIBELFINC="$(HOST_LIBELFINC)"; export LIBELFINC; \ XGCC_FLAGS_FOR_TARGET="$(XGCC_FLAGS_FOR_TARGET)"; export XGCC_FLAGS_FOR_TARGET; \ @@ -318,6 +319,7 @@ HOST_GMPINC = @gmpinc@ # Where to find isl HOST_ISLLIBS = @isllibs@ HOST_ISLINC = @islinc@ +HOST_ISLVER = @islver@ # Where to find libelf HOST_LIBELFLIBS = @libelflibs@ diff --git a/config/isl.m4 b/config/isl.m4 index 86ccb94..2cfeb46 100644 --- a/config/isl.m4 +++ b/config/isl.m4 @@ -117,6 +117,18 @@ AC_DEFUN([ISL_CHECK_VERSION], AC_MSG_RESULT([recommended isl version is 0.15, minimum required isl version 0.14 is deprecated]) fi + AC_MSG_CHECKING([Checking for isl-0.15]) + AC_TRY_LINK([#include <isl/schedule.h>], + [isl_options_set_schedule_serialize_sccs (NULL, 0);], + [ac_has_isl_options_set_schedule_serialize_sccs=yes], + [ac_has_isl_options_set_schedule_serialize_sccs=no]) + AC_MSG_RESULT($ac_has_isl_options_set_schedule_serialize_sccs) + + if test x"$ac_has_isl_options_set_schedule_serialize_sccs" = x"yes"; then + islver="0.15" + AC_SUBST([islver]) + fi + CFLAGS=$_isl_saved_CFLAGS LDFLAGS=$_isl_saved_LDFLAGS LIBS=$_isl_saved_LIBS diff --git a/configure b/configure index f5786ed..d4e3675 100755 --- a/configure +++ b/configure @@ -650,6 +650,7 @@ extra_linker_plugin_flags extra_linker_plugin_configure_flags islinc isllibs +islver poststage1_ldflags poststage1_libs stage1_ldflags @@ -6048,6 +6049,34 @@ $as_echo "$gcc_cv_isl" >&6; } $as_echo "recommended isl version is 0.15, minimum required isl version 0.14 is deprecated" >&6; } fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking Checking for isl-0.15" >&5 +$as_echo_n "checking Checking for isl-0.15... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <isl/schedule.h> +int +main () +{ +isl_options_set_schedule_serialize_sccs (NULL, 0); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_has_isl_options_set_schedule_serialize_sccs=yes +else + ac_has_isl_options_set_schedule_serialize_sccs=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_has_isl_options_set_schedule_serialize_sccs" >&5 +$as_echo "$ac_has_isl_options_set_schedule_serialize_sccs" >&6; } + + if test x"$ac_has_isl_options_set_schedule_serialize_sccs" = x"yes"; then + islver="0.15" + + fi + CFLAGS=$_isl_saved_CFLAGS LDFLAGS=$_isl_saved_LDFLAGS LIBS=$_isl_saved_LIBS diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 726fcbb..a83e776 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -3691,6 +3691,7 @@ site.exp: ./config.status Makefile echo "set PLUGINCFLAGS \"$(PLUGINCFLAGS)\"" >> ./site.tmp; \ echo "set GMPINC \"$(GMPINC)\"" >> ./site.tmp; \ fi + @echo "set ISLVER \"$(ISLVER)\"" >> ./site.tmp # If newlib has been configured, we need to pass -B to gcc so it can find # newlib's crt0.o if it exists. This will cause a "path prefix not used" # message if it doesn't, but the testsuite is supposed to ignore the message - diff --git a/gcc/config.in b/gcc/config.in index c00cd0f..91475ee 100644 --- a/gcc/config.in +++ b/gcc/config.in @@ -1378,12 +1378,6 @@ #endif -/* Define if isl_options_set_schedule_serialize_sccs exists. */ -#ifndef USED_FOR_TARGET -#undef HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS -#endif - - /* Define to 1 if you have the `kill' function. */ #ifndef USED_FOR_TARGET #undef HAVE_KILL diff --git a/gcc/configure b/gcc/configure index e6eb999..df92baf 100755 --- a/gcc/configure +++ b/gcc/configure @@ -28926,49 +28926,12 @@ fi -if test "x${ISLLIBS}" != "x" ; then - -$as_echo "#define HAVE_isl 1" >>confdefs.h -fi - -# Check whether isl_options_set_schedule_serialize_sccs is available; -# it's new in isl 0.15. +# Check whether isl 0.15 is available. if test "x${ISLLIBS}" != "x" ; then - saved_CXXFLAGS="$CXXFLAGS" - CXXFLAGS="$CXXFLAGS $ISLINC" - saved_LIBS="$LIBS" - LIBS="$LIBS $ISLLIBS $GMPLIBS" + if test x"$ISLVER" = x"0.15"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking Checking for isl_options_set_schedule_serialize_sccs" >&5 -$as_echo_n "checking Checking for isl_options_set_schedule_serialize_sccs... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <isl/schedule.h> -int -main () -{ -isl_options_set_schedule_serialize_sccs (NULL, 0); - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : - ac_has_isl_options_set_schedule_serialize_sccs=yes -else - ac_has_isl_options_set_schedule_serialize_sccs=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_has_isl_options_set_schedule_serialize_sccs" >&5 -$as_echo "$ac_has_isl_options_set_schedule_serialize_sccs" >&6; } - - LIBS="$saved_LIBS" - CXXFLAGS="$saved_CXXFLAGS" - - if test x"$ac_has_isl_options_set_schedule_serialize_sccs" = x"yes"; then - -$as_echo "#define HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS 1" >>confdefs.h +$as_echo "#define HAVE_isl 1" >>confdefs.h fi fi diff --git a/gcc/configure.ac b/gcc/configure.ac index 3aa2737..4edd7ef 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -5910,31 +5910,11 @@ AC_ARG_VAR(GMPINC,[How to find GMP include files]) AC_ARG_VAR(ISLLIBS,[How to link isl]) AC_ARG_VAR(ISLINC,[How to find isl include files]) -if test "x${ISLLIBS}" != "x" ; then - AC_DEFINE(HAVE_isl, 1, [Define if isl is in use.]) -fi -# Check whether isl_options_set_schedule_serialize_sccs is available; -# it's new in isl 0.15. +# Check whether isl 0.15 is available. if test "x${ISLLIBS}" != "x" ; then - saved_CXXFLAGS="$CXXFLAGS" - CXXFLAGS="$CXXFLAGS $ISLINC" - saved_LIBS="$LIBS" - LIBS="$LIBS $ISLLIBS $GMPLIBS" - - AC_MSG_CHECKING([Checking for isl_options_set_schedule_serialize_sccs]) - AC_TRY_LINK([#include <isl/schedule.h>], - [isl_options_set_schedule_serialize_sccs (NULL, 0);], - [ac_has_isl_options_set_schedule_serialize_sccs=yes], - [ac_has_isl_options_set_schedule_serialize_sccs=no]) - AC_MSG_RESULT($ac_has_isl_options_set_schedule_serialize_sccs) - - LIBS="$saved_LIBS" - CXXFLAGS="$saved_CXXFLAGS" - - if test x"$ac_has_isl_options_set_schedule_serialize_sccs" = x"yes"; then - AC_DEFINE(HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS, 1, - [Define if isl_options_set_schedule_serialize_sccs exists.]) + if test x"$ISLVER" = x"0.15"; then + AC_DEFINE(HAVE_isl, 1, [Define if isl is in use.]) fi fi diff --git a/gcc/graphite-isl-ast-to-gimple.c b/gcc/graphite-isl-ast-to-gimple.c index aaca9e9..d143ef7 100644 --- a/gcc/graphite-isl-ast-to-gimple.c +++ b/gcc/graphite-isl-ast-to-gimple.c @@ -115,8 +115,6 @@ void ivs_params_clear (ivs_params &ip) } } -#ifdef HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS - /* Set the "separate" option for the schedule node. */ static __isl_give isl_schedule_node * @@ -136,7 +134,6 @@ set_separate_option (__isl_take isl_schedule_node *node, void *user) return node; } -#endif class translate_isl_ast_to_gimple { @@ -303,13 +300,11 @@ class translate_isl_ast_to_gimple __isl_give isl_union_map *generate_isl_schedule (scop_p scop); -#ifdef HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS /* Set the "separate" option for all schedules. This helps reducing control overhead. */ __isl_give isl_schedule * set_options_for_schedule_tree (__isl_take isl_schedule *schedule); -#endif /* Set the separate option for all dimensions. This helps to reduce control overhead. */ @@ -601,10 +596,7 @@ binary_op_to_tree (tree type, __isl_take isl_ast_expr *expr, ivs_params &ip) } return fold_build2 (TRUNC_DIV_EXPR, type, tree_lhs_expr, tree_rhs_expr); -#if HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS - /* isl 0.15 or later. */ case isl_ast_op_zdiv_r: -#endif case isl_ast_op_pdiv_r: /* As isl operates on arbitrary precision numbers, we may end up with division by 2^64 that is folded to 0. */ @@ -775,10 +767,7 @@ gcc_expression_from_isl_expr_op (tree type, __isl_take isl_ast_expr *expr, case isl_ast_op_pdiv_q: case isl_ast_op_pdiv_r: case isl_ast_op_fdiv_q: -#if HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS - /* isl 0.15 or later. */ case isl_ast_op_zdiv_r: -#endif case isl_ast_op_and: case isl_ast_op_or: case isl_ast_op_eq: @@ -3186,7 +3175,6 @@ ast_build_before_for (__isl_keep isl_ast_build *build, void *user) return id; } -#ifdef HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS /* Set the separate option for all schedules. This helps reducing control overhead. */ @@ -3197,7 +3185,6 @@ translate_isl_ast_to_gimple::set_options_for_schedule_tree return isl_schedule_map_schedule_node_bottom_up (schedule, set_separate_option, NULL); } -#endif /* Set the separate option for all dimensions. This helps to reduce control overhead. */ @@ -3242,7 +3229,6 @@ translate_isl_ast_to_gimple::scop_to_isl_ast (scop_p scop, ivs_params &ip) dependence); } -#ifdef HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS if (scop->schedule) { scop->schedule = set_options_for_schedule_tree (scop->schedule); @@ -3251,10 +3237,6 @@ translate_isl_ast_to_gimple::scop_to_isl_ast (scop_p scop, ivs_params &ip) } else ast_isl = isl_ast_build_ast_from_schedule (context_isl, schedule_isl); -#else - ast_isl = isl_ast_build_ast_from_schedule (context_isl, schedule_isl); - isl_schedule_free (scop->schedule); -#endif isl_ast_build_free (context_isl); return ast_isl; diff --git a/gcc/graphite-optimize-isl.c b/gcc/graphite-optimize-isl.c index 15dd5b0..1565219 100644 --- a/gcc/graphite-optimize-isl.c +++ b/gcc/graphite-optimize-isl.c @@ -39,9 +39,6 @@ along with GCC; see the file COPYING3. If not see #include "dumpfile.h" #include "graphite.h" -#ifdef HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS -/* isl 0.15 or later. */ - /* get_schedule_for_node_st - Improve schedule for the schedule node. Only Simple loop tiling is considered. */ @@ -110,201 +107,6 @@ get_schedule_map_st (__isl_keep isl_schedule *schedule) isl_union_map *schedule_map = isl_schedule_get_map (schedule); return schedule_map; } -#else - -/* get_tile_map - Create a map that describes a n-dimensonal tiling. - - get_tile_map creates a map from a n-dimensional scattering space into an - 2*n-dimensional scattering space. The map describes a rectangular tiling. - - Example: - SCHEDULE_DIMENSIONS = 2, PARAMETER_DIMENSIONS = 1, TILE_SIZE = 32 - - tile_map := [p0] -> {[s0, s1] -> [t0, t1, s0, s1]: - t0 % 32 = 0 and t0 <= s0 < t0 + 32 and - t1 % 32 = 0 and t1 <= s1 < t1 + 32} - - Before tiling: - - for (i = 0; i < N; i++) - for (j = 0; j < M; j++) - S(i,j) - - After tiling: - - for (t_i = 0; t_i < N; i+=32) - for (t_j = 0; t_j < M; j+=32) - for (i = t_i; i < min(t_i + 32, N); i++) | Unknown that N % 32 = 0 - for (j = t_j; j < t_j + 32; j++) | Known that M % 32 = 0 - S(i,j) - */ - -static isl_basic_map * -get_tile_map (isl_ctx *ctx, int schedule_dimensions, int tile_size) -{ - /* We construct - - tile_map := [p0] -> {[s0, s1] -> [t0, t1, p0, p1, a0, a1]: - s0 = a0 * 32 and s0 = p0 and t0 <= p0 < t0 + 32 and - s1 = a1 * 32 and s1 = p1 and t1 <= p1 < t1 + 32} - - and project out the auxilary dimensions a0 and a1. */ - isl_space *space - = isl_space_alloc (ctx, 0, schedule_dimensions, schedule_dimensions * 3); - isl_basic_map *tile_map = isl_basic_map_universe (isl_space_copy (space)); - - isl_local_space *local_space = isl_local_space_from_space (space); - - for (int x = 0; x < schedule_dimensions; x++) - { - int sX = x; - int tX = x; - int pX = schedule_dimensions + x; - int aX = 2 * schedule_dimensions + x; - - isl_constraint *c; - - /* sX = aX * tile_size; */ - c = isl_equality_alloc (isl_local_space_copy (local_space)); - isl_constraint_set_coefficient_si (c, isl_dim_out, sX, 1); - isl_constraint_set_coefficient_si (c, isl_dim_out, aX, -tile_size); - tile_map = isl_basic_map_add_constraint (tile_map, c); - - /* pX = sX; */ - c = isl_equality_alloc (isl_local_space_copy (local_space)); - isl_constraint_set_coefficient_si (c, isl_dim_out, pX, 1); - isl_constraint_set_coefficient_si (c, isl_dim_in, sX, -1); - tile_map = isl_basic_map_add_constraint (tile_map, c); - - /* tX <= pX */ - c = isl_inequality_alloc (isl_local_space_copy (local_space)); - isl_constraint_set_coefficient_si (c, isl_dim_out, pX, 1); - isl_constraint_set_coefficient_si (c, isl_dim_out, tX, -1); - tile_map = isl_basic_map_add_constraint (tile_map, c); - - /* pX <= tX + (tile_size - 1) */ - c = isl_inequality_alloc (isl_local_space_copy (local_space)); - isl_constraint_set_coefficient_si (c, isl_dim_out, tX, 1); - isl_constraint_set_coefficient_si (c, isl_dim_out, pX, -1); - isl_constraint_set_constant_si (c, tile_size - 1); - tile_map = isl_basic_map_add_constraint (tile_map, c); - } - - /* Project out auxiliary dimensions. - - The auxiliary dimensions are transformed into existentially quantified - ones. - This reduces the number of visible scattering dimensions and allows isl - to produces better code. */ - tile_map = - isl_basic_map_project_out (tile_map, isl_dim_out, - 2 * schedule_dimensions, schedule_dimensions); - isl_local_space_free (local_space); - return tile_map; -} - -/* get_schedule_for_band - Get the schedule for this BAND. - - Polly applies transformations like tiling on top of the isl calculated - value. - This can influence the number of scheduling dimension. The number of - schedule dimensions is returned in DIMENSIONS. */ - -static isl_union_map * -get_schedule_for_band (isl_band *band, int *dimensions) -{ - isl_union_map *partial_schedule; - isl_ctx *ctx; - isl_space *space; - isl_basic_map *tile_map; - isl_union_map *tile_umap; - - partial_schedule = isl_band_get_partial_schedule (band); - *dimensions = isl_band_n_member (band); - - /* It does not make any sense to tile a band with just one dimension. */ - if (*dimensions == 1) - { - if (dump_file && dump_flags) - fprintf (dump_file, "not tiled\n"); - return partial_schedule; - } - - if (dump_file && dump_flags) - fprintf (dump_file, "tiled by %d\n", - PARAM_VALUE (PARAM_LOOP_BLOCK_TILE_SIZE)); - - ctx = isl_union_map_get_ctx (partial_schedule); - space = isl_union_map_get_space (partial_schedule); - - tile_map = get_tile_map (ctx, *dimensions, - PARAM_VALUE (PARAM_LOOP_BLOCK_TILE_SIZE)); - tile_umap = isl_union_map_from_map (isl_map_from_basic_map (tile_map)); - tile_umap = isl_union_map_align_params (tile_umap, space); - tile_umap = isl_union_map_coalesce (tile_umap); - *dimensions = 2 * *dimensions; - - return isl_union_map_apply_range (partial_schedule, tile_umap); -} - - -/* get_schedule_for_band_list - Get the scheduling map for a list of bands. - - We walk recursively the forest of bands to combine the schedules of the - individual bands to the overall schedule. In case tiling is requested, - the individual bands are tiled. */ - -static isl_union_map * -get_schedule_for_band_list (isl_band_list *band_list) -{ - int num_bands, i; - isl_union_map *schedule; - isl_ctx *ctx; - - ctx = isl_band_list_get_ctx (band_list); - num_bands = isl_band_list_n_band (band_list); - schedule = isl_union_map_empty (isl_space_params_alloc (ctx, 0)); - - for (i = 0; i < num_bands; i++) - { - isl_band *band; - isl_union_map *partial_schedule; - int schedule_dimensions; - isl_space *space; - - band = isl_band_list_get_band (band_list, i); - partial_schedule = get_schedule_for_band (band, &schedule_dimensions); - space = isl_union_map_get_space (partial_schedule); - - if (isl_band_has_children (band)) - { - isl_band_list *children = isl_band_get_children (band); - isl_union_map *suffixSchedule - = get_schedule_for_band_list (children); - partial_schedule - = isl_union_map_flat_range_product (partial_schedule, - suffixSchedule); - isl_band_list_free (children); - } - - schedule = isl_union_map_union (schedule, partial_schedule); - - isl_band_free (band); - isl_space_free (space); - } - - return isl_union_map_coalesce (schedule); -} - -static isl_union_map * -get_schedule_map (isl_schedule *schedule) -{ - isl_band_list *band_list = isl_schedule_get_band_forest (schedule); - isl_union_map *schedule_map = get_schedule_for_band_list (band_list); - isl_band_list_free (bandList); - return schedule_map; -} -#endif static isl_stat get_single_map (__isl_take isl_map *map, void *user) @@ -375,8 +177,6 @@ optimize_isl (scop_p scop) isl_options_set_schedule_max_constant_term (scop->isl_context, CONSTANT_BOUND); isl_options_set_schedule_maximize_band_depth (scop->isl_context, 1); -#ifdef HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS - /* isl 0.15 or later. */ 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); @@ -385,9 +185,6 @@ optimize_isl (scop_p scop) isl_options_set_coalesce_bounded_wrapping (scop->isl_context, 1); isl_options_set_ast_build_exploit_nested_bounds (scop->isl_context, 1); isl_options_set_ast_build_atomic_upper_bound (scop->isl_context, 1); -#else - isl_options_set_schedule_fuse (scop->isl_context, ISL_SCHEDULE_FUSE_MIN); -#endif isl_schedule *schedule = isl_union_set_compute_schedule (domain, validity, proximity); @@ -409,12 +206,7 @@ optimize_isl (scop_p scop) schedule freeing will occur in code generation. */ scop->schedule = schedule; -#ifdef HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS - /* isl 0.15 or later. */ isl_union_map *schedule_map = get_schedule_map_st (schedule); -#else - isl_union_map *schedule_map = get_schedule_map (schedule); -#endif apply_schedule_map_to_scop (scop, schedule_map); isl_union_map_free (schedule_map); diff --git a/gcc/graphite.c b/gcc/graphite.c index 8d0d24c..877a0fb 100644 --- a/gcc/graphite.c +++ b/gcc/graphite.c @@ -341,10 +341,11 @@ graphite_transform_loops (void) static void graphite_transform_loops (void) { - sorry ("Graphite loop optimizations cannot be used (isl is not available)."); + /* Do not error when graphite is not supported. */ + return; } -#endif +#endif /* #ifdef HAVE_isl */ static unsigned int @@ -361,6 +362,11 @@ graphite_transforms (struct function *fun) static bool gate_graphite_transforms (void) { +#ifndef HAVE_isl + /* Graphite is not supported for isl version 0.14 or earlier. */ + return false; +#endif + /* Enable -fgraphite pass if any one of the graphite optimization flags is turned on. */ if (flag_graphite_identity @@ -441,5 +447,3 @@ make_pass_graphite_transforms (gcc::context *ctxt) { return new pass_graphite_transforms (ctxt); } - - diff --git a/gcc/graphite.h b/gcc/graphite.h index f9af292..5a6677a 100644 --- a/gcc/graphite.h +++ b/gcc/graphite.h @@ -36,17 +36,8 @@ along with GCC; see the file COPYING3. If not see #include <isl/ilp.h> #include <isl/schedule.h> #include <isl/ast_build.h> - -#ifdef HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS -/* isl 0.15 or later. */ #include <isl/schedule_node.h> -#else -/* isl 0.14 or 0.13. */ -# define isl_stat int -# define isl_stat_ok 0 -#endif - typedef struct poly_dr *poly_dr_p; typedef struct poly_bb *poly_bb_p; diff --git a/gcc/testsuite/g++.dg/graphite/graphite.exp b/gcc/testsuite/g++.dg/graphite/graphite.exp index 2d85cf7..639e6e9 100644 --- a/gcc/testsuite/g++.dg/graphite/graphite.exp +++ b/gcc/testsuite/g++.dg/graphite/graphite.exp @@ -19,6 +19,11 @@ # Load support procs. load_lib g++-dg.exp +global ISLVER +if { $ISLVER != "0.15" } { + return +} + if ![check_effective_target_fgraphite] { return } diff --git a/gcc/testsuite/gcc.dg/graphite/graphite.exp b/gcc/testsuite/gcc.dg/graphite/graphite.exp index 8e1a229..9ad15fc 100644 --- a/gcc/testsuite/gcc.dg/graphite/graphite.exp +++ b/gcc/testsuite/gcc.dg/graphite/graphite.exp @@ -19,6 +19,11 @@ # Load support procs. load_lib gcc-dg.exp +global ISLVER +if { $ISLVER != "0.15" } { + return +} + if ![check_effective_target_fgraphite] { return } diff --git a/gcc/testsuite/gfortran.dg/graphite/graphite.exp b/gcc/testsuite/gfortran.dg/graphite/graphite.exp index 93863c3..25cba6b 100644 --- a/gcc/testsuite/gfortran.dg/graphite/graphite.exp +++ b/gcc/testsuite/gfortran.dg/graphite/graphite.exp @@ -19,6 +19,11 @@ # Load support procs. load_lib gfortran-dg.exp +global ISLVER +if { $ISLVER != "0.15" } { + return +} + if ![check_effective_target_fgraphite] { return } diff --git a/gcc/toplev.c b/gcc/toplev.c index e61e06c..db188c4 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -675,12 +675,10 @@ print_version (FILE *file, const char *indent, bool show_global_state) fprintf (file, file == stderr ? _(fmt2) : fmt2, GCC_GMP_STRINGIFY_VERSION, MPFR_VERSION_STRING, MPC_VERSION_STRING, -#ifndef HAVE_isl - "none" -#elif HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS +#ifdef HAVE_isl "0.15" #else - "0.14 or 0.13" + "none" #endif ); if (strcmp (GCC_GMP_STRINGIFY_VERSION, gmp_version)) diff --git a/libgomp/config/isl.m4 b/libgomp/config/isl.m4 new file mode 100644 index 0000000..3d9e948 --- /dev/null +++ b/libgomp/config/isl.m4 @@ -0,0 +1,158 @@ +# This file is part of GCC. +# +# GCC is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 3, or (at your option) any later +# version. +# +# GCC is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# <http://www.gnu.org/licenses/>. +# +# Contributed by Richard Guenther <rguent...@suse.de> +# Based on cloog.m4 + +# ISL_INIT_FLAGS () +# ------------------------- +# Provide configure switches for isl support. +# Initialize isllibs/islinc according to the user input. +AC_DEFUN([ISL_INIT_FLAGS], +[ + AC_ARG_WITH([isl-include], + [AS_HELP_STRING( + [--with-isl-include=PATH], + [Specify directory for installed isl include files])]) + AC_ARG_WITH([isl-lib], + [AS_HELP_STRING( + [--with-isl-lib=PATH], + [Specify the directory for the installed isl library])]) + + AC_ARG_ENABLE(isl-version-check, + [AS_HELP_STRING( + [--disable-isl-version-check], + [disable check for isl version])], + ENABLE_ISL_CHECK=$enableval, + ENABLE_ISL_CHECK=yes) + + # Initialize isllibs and islinc. + case $with_isl in + no) + isllibs= + islinc= + ;; + "" | yes) + ;; + *) + isllibs="-L$with_isl/lib" + islinc="-I$with_isl/include" + ;; + esac + if test "x${with_isl_include}" != x ; then + islinc="-I$with_isl_include" + fi + if test "x${with_isl_lib}" != x; then + isllibs="-L$with_isl_lib" + fi + dnl If no --with-isl flag was specified and there is in-tree isl + dnl source, set up flags to use that and skip any version tests + dnl as we cannot run them before building isl. + if test "x${islinc}" = x && test "x${isllibs}" = x \ + && test -d ${srcdir}/isl; then + isllibs='-L$$r/$(HOST_SUBDIR)/isl/'"$lt_cv_objdir"' ' + islinc='-I$$r/$(HOST_SUBDIR)/isl/include -I$$s/isl/include' + ENABLE_ISL_CHECK=no + AC_MSG_WARN([using in-tree isl, disabling version check]) + fi + + isllibs="${isllibs} -lisl" +] +) + +# ISL_REQUESTED (ACTION-IF-REQUESTED, ACTION-IF-NOT) +# ---------------------------------------------------- +# Provide actions for failed isl detection. +AC_DEFUN([ISL_REQUESTED], +[ + AC_REQUIRE([ISL_INIT_FLAGS]) + + if test "x${with_isl}" = xno; then + $2 + elif test "x${with_isl}" != x \ + || test "x${with_isl_include}" != x \ + || test "x${with_isl_lib}" != x ; then + $1 + else + $2 + fi +] +) + +# ISL_CHECK_VERSION ISL_CHECK_VERSION () +# ---------------------------------------------------------------- +# Test whether isl contains functionality added to the minimum expected version. +AC_DEFUN([ISL_CHECK_VERSION], +[ + if test "${ENABLE_ISL_CHECK}" = yes ; then + _isl_saved_CFLAGS=$CFLAGS + _isl_saved_LDFLAGS=$LDFLAGS + _isl_saved_LIBS=$LIBS + + CFLAGS="${_isl_saved_CFLAGS} ${islinc} ${gmpinc}" + LDFLAGS="${_isl_saved_LDFLAGS} ${isllibs} ${gmplibs}" + LIBS="${_isl_saved_LIBS} -lisl -lgmp" + + AC_MSG_CHECKING([for isl 0.15 (or deprecated 0.14)]) + AC_TRY_LINK([#include <isl/ctx.h>], + [isl_ctx_get_max_operations (isl_ctx_alloc ());], + [gcc_cv_isl=yes], + [gcc_cv_isl=no]) + AC_MSG_RESULT([$gcc_cv_isl]) + + if test "${gcc_cv_isl}" = no ; then + AC_MSG_RESULT([recommended isl version is 0.15, minimum required isl version 0.14 is deprecated]) + fi + + AC_MSG_CHECKING([Checking for isl-0.15]) + AC_TRY_LINK([#include <isl/schedule.h>], + [isl_options_set_schedule_serialize_sccs (NULL, 0);], + [ac_has_isl_options_set_schedule_serialize_sccs=yes], + [ac_has_isl_options_set_schedule_serialize_sccs=no]) + AC_MSG_RESULT($ac_has_isl_options_set_schedule_serialize_sccs) + + if test x"$ac_has_isl_options_set_schedule_serialize_sccs" = x"yes"; then + islver="0.15" + AC_SUBST([islver]) + fi + + CFLAGS=$_isl_saved_CFLAGS + LDFLAGS=$_isl_saved_LDFLAGS + LIBS=$_isl_saved_LIBS + fi +] +) + +# ISL_IF_FAILED (ACTION-IF-FAILED) +# ---------------------------------- +# Executes ACTION-IF-FAILED, if GRAPHITE was requested and +# the checks failed. +AC_DEFUN([ISL_IF_FAILED], +[ + ISL_REQUESTED([graphite_requested=yes], [graphite_requested=no]) + + if test "${gcc_cv_isl}" = no ; then + isllibs= + islinc= + fi + + if test "${graphite_requested}" = yes \ + && test "x${isllibs}" = x \ + && test "x${islinc}" = x ; then + $1 + fi +] +) diff --git a/libgomp/configure b/libgomp/configure index aaa17c9..8ef73c2 100755 --- a/libgomp/configure +++ b/libgomp/configure @@ -638,6 +638,7 @@ PLUGIN_NVPTX CUDA_DRIVER_LIB CUDA_DRIVER_INCLUDE offload_targets +islver libtool_VERSION ac_ct_FC FCFLAGS @@ -779,6 +780,10 @@ enable_fast_install with_gnu_ld enable_libtool_lock enable_maintainer_mode +with_isl +with_isl_include +with_isl_lib +enable_isl_version_check with_cuda_driver with_cuda_driver_include with_cuda_driver_lib @@ -1432,6 +1437,8 @@ Optional Features: --disable-libtool-lock avoid locking (might break parallel builds) --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer + --disable-isl-version-check + disable check for isl version --enable-linux-futex use the Linux futex system call [default=default] --enable-tls Use thread-local storage [default=yes] --enable-symvers=STYLE enables symbol versioning of the shared library @@ -1443,6 +1450,12 @@ Optional Packages: --with-pic try to use only PIC/non-PIC objects [default=use both] --with-gnu-ld assume the C compiler uses GNU ld [default=no] + --with-isl=PATH Specify prefix directory for the installed isl + package. Equivalent to + --with-isl-include=PATH/include plus + --with-isl-lib=PATH/lib + --with-isl-include=PATH Specify directory for installed isl include files + --with-isl-lib=PATH Specify the directory for the installed isl library --with-cuda-driver=PATH specify prefix directory for installed CUDA driver package. Equivalent to --with-cuda-driver-include=PATH/include plus @@ -11121,7 +11134,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11124 "configure" +#line 11137 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11227,7 +11240,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11230 "configure" +#line 11243 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -15088,6 +15101,190 @@ rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext esac + +# This file is part of GCC. +# +# GCC is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 3, or (at your option) any later +# version. +# +# GCC is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# <http://www.gnu.org/licenses/>. +# +# Contributed by Richard Guenther <rguent...@suse.de> +# Based on cloog.m4 + +# ISL_INIT_FLAGS () +# ------------------------- +# Provide configure switches for isl support. +# Initialize isllibs/islinc according to the user input. + + +# ISL_REQUESTED (ACTION-IF-REQUESTED, ACTION-IF-NOT) +# ---------------------------------------------------- +# Provide actions for failed isl detection. + + +# ISL_CHECK_VERSION ISL_CHECK_VERSION () +# ---------------------------------------------------------------- +# Test whether isl contains functionality added to the minimum expected version. + + +# ISL_IF_FAILED (ACTION-IF-FAILED) +# ---------------------------------- +# Executes ACTION-IF-FAILED, if GRAPHITE was requested and +# the checks failed. + + + +# GCC GRAPHITE dependency isl. +# Basic setup is inlined here, actual checks are in config/isl.m4 + + +# Check whether --with-isl was given. +if test "${with_isl+set}" = set; then : + withval=$with_isl; +fi + + +# Treat --without-isl as a request to disable +# GRAPHITE support and skip all following checks. +if test "x$with_isl" != "xno"; then + # Check for isl + + +# Check whether --with-isl-include was given. +if test "${with_isl_include+set}" = set; then : + withval=$with_isl_include; +fi + + +# Check whether --with-isl-lib was given. +if test "${with_isl_lib+set}" = set; then : + withval=$with_isl_lib; +fi + + + # Check whether --enable-isl-version-check was given. +if test "${enable_isl_version_check+set}" = set; then : + enableval=$enable_isl_version_check; ENABLE_ISL_CHECK=$enableval +else + ENABLE_ISL_CHECK=yes +fi + + + # Initialize isllibs and islinc. + case $with_isl in + no) + isllibs= + islinc= + ;; + "" | yes) + ;; + *) + isllibs="-L$with_isl/lib" + islinc="-I$with_isl/include" + ;; + esac + if test "x${with_isl_include}" != x ; then + islinc="-I$with_isl_include" + fi + if test "x${with_isl_lib}" != x; then + isllibs="-L$with_isl_lib" + fi + if test "x${islinc}" = x && test "x${isllibs}" = x \ + && test -d ${srcdir}/isl; then + isllibs='-L$$r/$(HOST_SUBDIR)/isl/'"$lt_cv_objdir"' ' + islinc='-I$$r/$(HOST_SUBDIR)/isl/include -I$$s/isl/include' + ENABLE_ISL_CHECK=no + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using in-tree isl, disabling version check" >&5 +$as_echo "$as_me: WARNING: using in-tree isl, disabling version check" >&2;} + fi + + isllibs="${isllibs} -lisl" + + + + if test "${ENABLE_ISL_CHECK}" = yes ; then + _isl_saved_CFLAGS=$CFLAGS + _isl_saved_LDFLAGS=$LDFLAGS + _isl_saved_LIBS=$LIBS + + CFLAGS="${_isl_saved_CFLAGS} ${islinc} ${gmpinc}" + LDFLAGS="${_isl_saved_LDFLAGS} ${isllibs} ${gmplibs}" + LIBS="${_isl_saved_LIBS} -lisl -lgmp" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for isl 0.15 (or deprecated 0.14)" >&5 +$as_echo_n "checking for isl 0.15 (or deprecated 0.14)... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <isl/ctx.h> +int +main () +{ +isl_ctx_get_max_operations (isl_ctx_alloc ()); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gcc_cv_isl=yes +else + gcc_cv_isl=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_isl" >&5 +$as_echo "$gcc_cv_isl" >&6; } + + if test "${gcc_cv_isl}" = no ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: recommended isl version is 0.15, minimum required isl version 0.14 is deprecated" >&5 +$as_echo "recommended isl version is 0.15, minimum required isl version 0.14 is deprecated" >&6; } + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking Checking for isl-0.15" >&5 +$as_echo_n "checking Checking for isl-0.15... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <isl/schedule.h> +int +main () +{ +isl_options_set_schedule_serialize_sccs (NULL, 0); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_has_isl_options_set_schedule_serialize_sccs=yes +else + ac_has_isl_options_set_schedule_serialize_sccs=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_has_isl_options_set_schedule_serialize_sccs" >&5 +$as_echo "$ac_has_isl_options_set_schedule_serialize_sccs" >&6; } + + if test x"$ac_has_isl_options_set_schedule_serialize_sccs" = x"yes"; then + islver="0.15" + + fi + + CFLAGS=$_isl_saved_CFLAGS + LDFLAGS=$_isl_saved_LDFLAGS + LIBS=$_isl_saved_LIBS + fi + + +fi + # Plugins for offload execution, configure.ac fragment. -*- mode: autoconf -*- # # Copyright (C) 2014-2015 Free Software Foundation, Inc. diff --git a/libgomp/configure.ac b/libgomp/configure.ac index 2e41ca8..281934a 100644 --- a/libgomp/configure.ac +++ b/libgomp/configure.ac @@ -202,6 +202,30 @@ case "$host" in [AC_MSG_ERROR([Pthreads are required to build libgomp])])]) esac + +m4_include([config/isl.m4]) + +# GCC GRAPHITE dependency isl. +# Basic setup is inlined here, actual checks are in config/isl.m4 + +AC_ARG_WITH(isl, + [AS_HELP_STRING( + [--with-isl=PATH], + [Specify prefix directory for the installed isl package. + Equivalent to --with-isl-include=PATH/include + plus --with-isl-lib=PATH/lib])]) + +# Treat --without-isl as a request to disable +# GRAPHITE support and skip all following checks. +if test "x$with_isl" != "xno"; then + # Check for isl + dnl Provide configure switches and initialize islinc & isllibs + dnl with user input. + ISL_INIT_FLAGS + dnl The versions of isl that work for Graphite + ISL_CHECK_VERSION() +fi + m4_include([plugin/configfrag.ac]) # Check for functions needed. diff --git a/libgomp/testsuite/Makefile.am b/libgomp/testsuite/Makefile.am index 66a9d94..837366e 100644 --- a/libgomp/testsuite/Makefile.am +++ b/libgomp/testsuite/Makefile.am @@ -22,6 +22,8 @@ libgomp-test-support.exp: libgomp-test-support.pt.exp Makefile 'set offload_additional_options "$(offload_additional_options)"' echo >> $@.tmp \ 'set offload_additional_lib_paths "$(offload_additional_lib_paths)"' + echo >> $@.tmp \ + 'set ISLVER "$(ISLVER)"' mv $@.tmp $@ all-local: libgomp-test-support.exp diff --git a/libgomp/testsuite/Makefile.in b/libgomp/testsuite/Makefile.in index c25d21f..f01436e 100644 --- a/libgomp/testsuite/Makefile.in +++ b/libgomp/testsuite/Makefile.in @@ -116,6 +116,7 @@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +ISLVER = @islver@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ @@ -464,6 +465,8 @@ libgomp-test-support.exp: libgomp-test-support.pt.exp Makefile 'set offload_additional_options "$(offload_additional_options)"' echo >> $@.tmp \ 'set offload_additional_lib_paths "$(offload_additional_lib_paths)"' + echo >> $@.tmp \ + 'set ISLVER "$(ISLVER)"' mv $@.tmp $@ all-local: libgomp-test-support.exp diff --git a/libgomp/testsuite/libgomp.graphite/graphite.exp b/libgomp/testsuite/libgomp.graphite/graphite.exp index d737c85..ce29169 100644 --- a/libgomp/testsuite/libgomp.graphite/graphite.exp +++ b/libgomp/testsuite/libgomp.graphite/graphite.exp @@ -14,6 +14,11 @@ # along with GCC; see the file COPYING3. If not see # <http://www.gnu.org/licenses/>. +global ISLVER +if { $ISLVER != "0.15" } { + return +} + if [info exists lang_library_path] then { unset lang_library_path unset lang_link_flags -- 2.5.0