From 13f95cc3d10d9884acd2dbfc112e3c7079403c0a Mon Sep 17 00:00:00 2001 From: Riccardo Mori Date: Fri, 23 Jul 2021 18:46:48 +0200 Subject: [PATCH] Update isl to isl-0.24-69-g54aac5ac This is needed for having the functions isl_{set,map}_n_basic_{set,map} exported to the C++ interface --- polly/lib/External/isl/GIT_HEAD_ID | 2 +- polly/lib/External/isl/Makefile.am | 1 + polly/lib/External/isl/Makefile.in | 1 + .../isl/check_parse_fail_test_templ.c | 46 ++++++++ .../External/isl/check_reparse_test_templ.c | 1 + polly/lib/External/isl/include/isl/aff.h | 1 + .../External/isl/include/isl/cpp-checked.h | 43 +++++++- polly/lib/External/isl/include/isl/cpp.h | 65 ++++++++++- polly/lib/External/isl/include/isl/map.h | 1 + polly/lib/External/isl/include/isl/set.h | 1 + .../lib/External/isl/include/isl/typed_cpp.h | 3 + polly/lib/External/isl/interface/isl.py | 38 +++++++ .../External/isl/interface/template_cpp.cc | 6 +- polly/lib/External/isl/isl_coalesce.c | 8 ++ polly/lib/External/isl/isl_ctx_private.h | 3 + polly/lib/External/isl/isl_input.c | 18 ++- polly/lib/External/isl/isl_scheduler.c | 2 +- polly/lib/External/isl/isl_stream.c | 11 +- polly/lib/External/isl/isl_test.c | 103 +++++++++++++++--- .../isl/test_inputs/schedule/niewang.sc | 2 +- 20 files changed, 331 insertions(+), 25 deletions(-) create mode 100644 polly/lib/External/isl/check_parse_fail_test_templ.c diff --git a/polly/lib/External/isl/GIT_HEAD_ID b/polly/lib/External/isl/GIT_HEAD_ID index 56d7f7519bcf..60beb8f894c0 100644 --- a/polly/lib/External/isl/GIT_HEAD_ID +++ b/polly/lib/External/isl/GIT_HEAD_ID @@ -1 +1 @@ -isl-0.24-52-gd7be01f7 +isl-0.24-69-g54aac5ac diff --git a/polly/lib/External/isl/Makefile.am b/polly/lib/External/isl/Makefile.am index d403e26d5026..3e7d7b1f5dc0 100644 --- a/polly/lib/External/isl/Makefile.am +++ b/polly/lib/External/isl/Makefile.am @@ -498,6 +498,7 @@ EXTRA_DIST = \ bset_to_bmap.c \ bset_from_bmap.c \ isl_check_named_params_templ.c \ + check_parse_fail_test_templ.c \ check_reparse_templ.c \ check_reparse_test_templ.c \ check_single_reference_templ.c \ diff --git a/polly/lib/External/isl/Makefile.in b/polly/lib/External/isl/Makefile.in index 0abf9f221cca..a2e96d6c9d2c 100644 --- a/polly/lib/External/isl/Makefile.in +++ b/polly/lib/External/isl/Makefile.in @@ -1398,6 +1398,7 @@ EXTRA_DIST = \ bset_to_bmap.c \ bset_from_bmap.c \ isl_check_named_params_templ.c \ + check_parse_fail_test_templ.c \ check_reparse_templ.c \ check_reparse_test_templ.c \ check_single_reference_templ.c \ diff --git a/polly/lib/External/isl/check_parse_fail_test_templ.c b/polly/lib/External/isl/check_parse_fail_test_templ.c new file mode 100644 index 000000000000..6fba085ea381 --- /dev/null +++ b/polly/lib/External/isl/check_parse_fail_test_templ.c @@ -0,0 +1,46 @@ +/* + * Copyright 2021 Cerebras Systems + * + * Use of this software is governed by the MIT license + * + * Written by Sven Verdoolaege, + * Cerebras Systems, 1237 E Arques Ave, Sunnyvale, CA, USA + */ + +#define xCAT(A,B) A ## B +#define CAT(A,B) xCAT(A,B) +#undef TYPE +#define TYPE CAT(isl_,BASE) +#define xFN(TYPE,NAME) TYPE ## _ ## NAME +#define FN(TYPE,NAME) xFN(TYPE,NAME) + +#undef TESTS +#define TESTS CAT(parse_,CAT(BASE,_fail_tests)) + +/* Test parsing of objects of type TYPE + * that are expected to fail. + */ +static isl_stat FN(check,TESTS)(isl_ctx *ctx) +{ + int i, n; + int on_error; + + on_error = isl_options_get_on_error(ctx); + isl_options_set_on_error(ctx, ISL_ON_ERROR_CONTINUE); + n = ARRAY_SIZE(TESTS); + for (i = 0; i < n; ++i) { + TYPE *obj; + + obj = FN(TYPE,read_from_str)(ctx, TESTS[i]); + FN(TYPE,free)(obj); + if (obj) + break; + } + isl_options_set_on_error(ctx, on_error); + if (i < n) + isl_die(ctx, isl_error_unknown, + "parsing not expected to succeed", + return isl_stat_error); + + return isl_stat_ok; +} diff --git a/polly/lib/External/isl/check_reparse_test_templ.c b/polly/lib/External/isl/check_reparse_test_templ.c index 58c194ceae93..0a0740ac688d 100644 --- a/polly/lib/External/isl/check_reparse_test_templ.c +++ b/polly/lib/External/isl/check_reparse_test_templ.c @@ -5,6 +5,7 @@ #define xFN(TYPE,NAME) TYPE ## _ ## NAME #define FN(TYPE,NAME) xFN(TYPE,NAME) +#undef TESTS #define TESTS CAT(reparse_,CAT(BASE,_tests)) /* Test parsing of objects of type TYPE by printing diff --git a/polly/lib/External/isl/include/isl/aff.h b/polly/lib/External/isl/include/isl/aff.h index cfa0851429df..c417be165424 100644 --- a/polly/lib/External/isl/include/isl/aff.h +++ b/polly/lib/External/isl/include/isl/aff.h @@ -212,6 +212,7 @@ void isl_aff_dump(__isl_keep isl_aff *aff); isl_ctx *isl_pw_aff_get_ctx(__isl_keep isl_pw_aff *pwaff); uint32_t isl_pw_aff_get_hash(__isl_keep isl_pw_aff *pa); __isl_give isl_space *isl_pw_aff_get_domain_space(__isl_keep isl_pw_aff *pwaff); +__isl_export __isl_give isl_space *isl_pw_aff_get_space(__isl_keep isl_pw_aff *pwaff); __isl_constructor diff --git a/polly/lib/External/isl/include/isl/cpp-checked.h b/polly/lib/External/isl/include/isl/cpp-checked.h index 54417e09df3e..bde60adf04f8 100644 --- a/polly/lib/External/isl/include/isl/cpp-checked.h +++ b/polly/lib/External/isl/include/isl/cpp-checked.h @@ -1490,6 +1490,7 @@ public: inline isl::checked::map_list map_list() const; inline isl::checked::multi_pw_aff max_multi_pw_aff() const; inline isl::checked::multi_pw_aff min_multi_pw_aff() const; + inline class size n_basic_map() const; inline isl::checked::basic_map polyhedral_hull() const; inline isl::checked::map preimage_domain(const isl::checked::multi_aff &ma) const; inline isl::checked::map preimage_domain(const isl::checked::multi_pw_aff &mpa) const; @@ -1623,6 +1624,7 @@ public: inline isl::checked::val max_val(const isl::checked::aff &obj) const; inline isl::checked::multi_pw_aff min_multi_pw_aff() const; inline isl::checked::val min_val(const isl::checked::aff &obj) const; + inline class size n_basic_set() const; inline isl::checked::basic_set params() const; inline isl::checked::multi_val plain_multi_val_if_fixed() const; inline isl::checked::basic_set polyhedral_hull() const; @@ -1908,6 +1910,7 @@ public: inline isl::checked::map_list map_list() const; inline isl::checked::multi_pw_aff max_multi_pw_aff() const; inline isl::checked::multi_pw_aff min_multi_pw_aff() const; + inline class size n_basic_map() const; inline isl::checked::basic_map polyhedral_hull() const; inline isl::checked::map preimage_domain(isl::checked::multi_aff ma) const; inline isl::checked::map preimage_domain(isl::checked::multi_pw_aff mpa) const; @@ -2542,6 +2545,7 @@ public: inline isl::checked::val min_val(const isl::checked::aff &obj) const; inline isl::checked::multi_val multi_val() const; inline isl::checked::multi_val get_multi_val() const; + inline class size n_basic_set() const; inline isl::checked::basic_set params() const; inline isl::checked::multi_val plain_multi_val_if_fixed() const; inline isl::checked::basic_set polyhedral_hull() const; @@ -2719,6 +2723,7 @@ public: inline isl::checked::pw_multi_aff set_range_tuple(const std::string &id) const; inline class size size() const; inline isl::checked::space space() const; + inline isl::checked::space get_space() const; inline isl::checked::multi_pw_aff sub(const isl::checked::multi_pw_aff &multi2) const; inline isl::checked::multi_union_pw_aff sub(const isl::checked::multi_union_pw_aff &multi2) const; inline isl::checked::pw_aff sub(isl::checked::pw_aff pwaff2) const; @@ -3488,6 +3493,7 @@ public: inline isl::checked::val max_val(const isl::checked::aff &obj) const; inline isl::checked::multi_pw_aff min_multi_pw_aff() const; inline isl::checked::val min_val(const isl::checked::aff &obj) const; + inline class size n_basic_set() const; inline isl::checked::set params() const; inline isl::checked::multi_val plain_multi_val_if_fixed() const; inline isl::checked::multi_val get_plain_multi_val_if_fixed() const; @@ -4993,7 +4999,7 @@ class size aff::size() const isl::checked::space aff::space() const { - return isl::checked::multi_aff(*this).space(); + return isl::checked::pw_aff(*this).space(); } isl::checked::aff aff::sub(isl::checked::aff aff2) const @@ -7677,6 +7683,11 @@ isl::checked::multi_pw_aff basic_map::min_multi_pw_aff() const return isl::checked::map(*this).min_multi_pw_aff(); } +class size basic_map::n_basic_map() const +{ + return isl::checked::map(*this).n_basic_map(); +} + isl::checked::basic_map basic_map::polyhedral_hull() const { return isl::checked::map(*this).polyhedral_hull(); @@ -8291,6 +8302,11 @@ isl::checked::val basic_set::min_val(const isl::checked::aff &obj) const return isl::checked::set(*this).min_val(obj); } +class size basic_set::n_basic_set() const +{ + return isl::checked::set(*this).n_basic_set(); +} + isl::checked::basic_set basic_set::params() const { auto res = isl_basic_set_params(copy()); @@ -9534,6 +9550,12 @@ isl::checked::multi_pw_aff map::min_multi_pw_aff() const return manage(res); } +class size map::n_basic_map() const +{ + auto res = isl_map_n_basic_map(get()); + return manage(res); +} + isl::checked::basic_map map::polyhedral_hull() const { auto res = isl_map_polyhedral_hull(copy()); @@ -12439,6 +12461,11 @@ isl::checked::multi_val point::get_multi_val() const return multi_val(); } +class size point::n_basic_set() const +{ + return isl::checked::basic_set(*this).n_basic_set(); +} + isl::checked::basic_set point::params() const { return isl::checked::basic_set(*this).params(); @@ -13290,7 +13317,13 @@ class size pw_aff::size() const isl::checked::space pw_aff::space() const { - return isl::checked::union_pw_aff(*this).space(); + auto res = isl_pw_aff_get_space(get()); + return manage(res); +} + +isl::checked::space pw_aff::get_space() const +{ + return space(); } isl::checked::multi_pw_aff pw_aff::sub(const isl::checked::multi_pw_aff &multi2) const @@ -16217,6 +16250,12 @@ isl::checked::val set::min_val(const isl::checked::aff &obj) const return manage(res); } +class size set::n_basic_set() const +{ + auto res = isl_set_n_basic_set(get()); + return manage(res); +} + isl::checked::set set::params() const { auto res = isl_set_params(copy()); diff --git a/polly/lib/External/isl/include/isl/cpp.h b/polly/lib/External/isl/include/isl/cpp.h index 0e7c6b9d8811..42b5cb6086fd 100644 --- a/polly/lib/External/isl/include/isl/cpp.h +++ b/polly/lib/External/isl/include/isl/cpp.h @@ -1555,6 +1555,7 @@ public: inline isl::map_list map_list() const; inline isl::multi_pw_aff max_multi_pw_aff() const; inline isl::multi_pw_aff min_multi_pw_aff() const; + inline unsigned n_basic_map() const; inline isl::basic_map polyhedral_hull() const; inline isl::map preimage_domain(const isl::multi_aff &ma) const; inline isl::map preimage_domain(const isl::multi_pw_aff &mpa) const; @@ -1688,6 +1689,7 @@ public: inline isl::val max_val(const isl::aff &obj) const; inline isl::multi_pw_aff min_multi_pw_aff() const; inline isl::val min_val(const isl::aff &obj) const; + inline unsigned n_basic_set() const; inline isl::basic_set params() const; inline isl::multi_val plain_multi_val_if_fixed() const; inline isl::basic_set polyhedral_hull() const; @@ -1973,6 +1975,7 @@ public: inline isl::map_list map_list() const; inline isl::multi_pw_aff max_multi_pw_aff() const; inline isl::multi_pw_aff min_multi_pw_aff() const; + inline unsigned n_basic_map() const; inline isl::basic_map polyhedral_hull() const; inline isl::map preimage_domain(isl::multi_aff ma) const; inline isl::map preimage_domain(isl::multi_pw_aff mpa) const; @@ -2607,6 +2610,7 @@ public: inline isl::val min_val(const isl::aff &obj) const; inline isl::multi_val multi_val() const; inline isl::multi_val get_multi_val() const; + inline unsigned n_basic_set() const; inline isl::basic_set params() const; inline isl::multi_val plain_multi_val_if_fixed() const; inline isl::basic_set polyhedral_hull() const; @@ -2784,6 +2788,7 @@ public: inline isl::pw_multi_aff set_range_tuple(const std::string &id) const; inline unsigned size() const; inline isl::space space() const; + inline isl::space get_space() const; inline isl::multi_pw_aff sub(const isl::multi_pw_aff &multi2) const; inline isl::multi_union_pw_aff sub(const isl::multi_union_pw_aff &multi2) const; inline isl::pw_aff sub(isl::pw_aff pwaff2) const; @@ -3553,6 +3558,7 @@ public: inline isl::val max_val(const isl::aff &obj) const; inline isl::multi_pw_aff min_multi_pw_aff() const; inline isl::val min_val(const isl::aff &obj) const; + inline unsigned n_basic_set() const; inline isl::set params() const; inline isl::multi_val plain_multi_val_if_fixed() const; inline isl::multi_val get_plain_multi_val_if_fixed() const; @@ -5416,7 +5422,7 @@ isl::space aff::space() const { if (!ptr) exception::throw_invalid("NULL input", __FILE__, __LINE__); - return isl::multi_aff(*this).space(); + return isl::pw_aff(*this).space(); } isl::aff aff::sub(isl::aff aff2) const @@ -8980,6 +8986,13 @@ isl::multi_pw_aff basic_map::min_multi_pw_aff() const return isl::map(*this).min_multi_pw_aff(); } +unsigned basic_map::n_basic_map() const +{ + if (!ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + return isl::map(*this).n_basic_map(); +} + isl::basic_map basic_map::polyhedral_hull() const { if (!ptr) @@ -9896,6 +9909,13 @@ isl::val basic_set::min_val(const isl::aff &obj) const return isl::set(*this).min_val(obj); } +unsigned basic_set::n_basic_set() const +{ + if (!ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + return isl::set(*this).n_basic_set(); +} + isl::basic_set basic_set::params() const { if (!ptr) @@ -11875,6 +11895,18 @@ isl::multi_pw_aff map::min_multi_pw_aff() const return manage(res); } +unsigned map::n_basic_map() const +{ + if (!ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto saved_ctx = ctx(); + options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error); + auto res = isl_map_n_basic_map(get()); + if (res < 0) + exception::throw_last_error(saved_ctx); + return res; +} + isl::basic_map map::polyhedral_hull() const { if (!ptr) @@ -16592,6 +16624,13 @@ isl::multi_val point::get_multi_val() const return multi_val(); } +unsigned point::n_basic_set() const +{ + if (!ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + return isl::basic_set(*this).n_basic_set(); +} + isl::basic_set point::params() const { if (!ptr) @@ -17913,7 +17952,17 @@ isl::space pw_aff::space() const { if (!ptr) exception::throw_invalid("NULL input", __FILE__, __LINE__); - return isl::union_pw_aff(*this).space(); + auto saved_ctx = ctx(); + options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error); + auto res = isl_pw_aff_get_space(get()); + if (!res) + exception::throw_last_error(saved_ctx); + return manage(res); +} + +isl::space pw_aff::get_space() const +{ + return space(); } isl::multi_pw_aff pw_aff::sub(const isl::multi_pw_aff &multi2) const @@ -22502,6 +22551,18 @@ isl::val set::min_val(const isl::aff &obj) const return manage(res); } +unsigned set::n_basic_set() const +{ + if (!ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto saved_ctx = ctx(); + options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error); + auto res = isl_set_n_basic_set(get()); + if (res < 0) + exception::throw_last_error(saved_ctx); + return res; +} + isl::set set::params() const { if (!ptr) diff --git a/polly/lib/External/isl/include/isl/map.h b/polly/lib/External/isl/include/isl/map.h index ede0463800dd..55feb9b3b588 100644 --- a/polly/lib/External/isl/include/isl/map.h +++ b/polly/lib/External/isl/include/isl/map.h @@ -698,6 +698,7 @@ isl_bool isl_map_plain_is_equal(__isl_keep isl_map *map1, uint32_t isl_map_get_hash(__isl_keep isl_map *map); +__isl_export isl_size isl_map_n_basic_map(__isl_keep isl_map *map); __isl_export isl_stat isl_map_foreach_basic_map(__isl_keep isl_map *map, diff --git a/polly/lib/External/isl/include/isl/set.h b/polly/lib/External/isl/include/isl/set.h index 4b66b82e6f41..3e9b224fc485 100644 --- a/polly/lib/External/isl/include/isl/set.h +++ b/polly/lib/External/isl/include/isl/set.h @@ -512,6 +512,7 @@ isl_bool isl_set_plain_is_disjoint(__isl_keep isl_set *set1, uint32_t isl_set_get_hash(__isl_keep isl_set *set); +__isl_export isl_size isl_set_n_basic_set(__isl_keep isl_set *set); __isl_export isl_stat isl_set_foreach_basic_set(__isl_keep isl_set *set, diff --git a/polly/lib/External/isl/include/isl/typed_cpp.h b/polly/lib/External/isl/include/isl/typed_cpp.h index 165a61b5a615..30c47ebfc5bf 100644 --- a/polly/lib/External/isl/include/isl/typed_cpp.h +++ b/polly/lib/External/isl/include/isl/typed_cpp.h @@ -7235,6 +7235,7 @@ struct pw_aff : public isl::pw_aff { template inline typed::pw_multi_aff set_range_tuple(const std::string &id) const; inline typed::space space() const; + inline typed::space get_space() const = delete; inline typed::multi_pw_aff sub(const typed::multi_pw_aff &multi2) const; inline typed::multi_union_pw_aff sub(const typed::multi_union_pw_aff &multi2) const; inline typed::pw_aff sub(const typed::pw_aff &pwaff2) const; @@ -7448,6 +7449,7 @@ struct pw_aff : public isl::pw_aff { template inline typed::pw_multi_aff set_range_tuple(const std::string &id) const; inline typed::space space() const; + inline typed::space get_space() const = delete; inline typed::multi_pw_aff sub(const typed::multi_pw_aff &multi2) const; inline typed::multi_union_pw_aff sub(const typed::multi_union_pw_aff &multi2) const; inline typed::pw_aff sub(const typed::pw_aff &pwaff2) const; @@ -7663,6 +7665,7 @@ struct pw_aff, Anonymous> : public isl::pw_aff { template inline typed::pw_multi_aff, Arg1> set_range_tuple(const std::string &id) const; inline typed::space, Anonymous> space() const; + inline typed::space, Anonymous> get_space() const = delete; inline typed::multi_pw_aff, Anonymous> sub(const typed::multi_pw_aff, Anonymous> &multi2) const; inline typed::multi_union_pw_aff, Anonymous> sub(const typed::multi_union_pw_aff, Anonymous> &multi2) const; inline typed::pw_aff, Anonymous> sub(const typed::pw_aff, Anonymous> &pwaff2) const; diff --git a/polly/lib/External/isl/interface/isl.py b/polly/lib/External/isl/interface/isl.py index 13a951467941..f2249cbc7de1 100644 --- a/polly/lib/External/isl/interface/isl.py +++ b/polly/lib/External/isl/interface/isl.py @@ -3163,6 +3163,18 @@ class pw_aff(union_pw_aff, pw_multi_aff, multi_pw_aff): obj = pw_aff(ctx=ctx, ptr=res) return obj raise Error + def space(arg0): + try: + if not arg0.__class__ is pw_aff: + arg0 = pw_aff(arg0) + except: + raise + ctx = arg0.ctx + res = isl.isl_pw_aff_get_space(arg0.ptr) + obj = space(ctx=ctx, ptr=res) + return obj + def get_space(arg0): + return arg0.space() def sub(arg0, arg1): try: if not arg0.__class__ is pw_aff: @@ -3334,6 +3346,8 @@ isl.isl_pw_aff_scale_val.restype = c_void_p isl.isl_pw_aff_scale_val.argtypes = [c_void_p, c_void_p] isl.isl_pw_aff_scale_down_val.restype = c_void_p isl.isl_pw_aff_scale_down_val.argtypes = [c_void_p, c_void_p] +isl.isl_pw_aff_get_space.restype = c_void_p +isl.isl_pw_aff_get_space.argtypes = [c_void_p] isl.isl_pw_aff_sub.restype = c_void_p isl.isl_pw_aff_sub.argtypes = [c_void_p, c_void_p] isl.isl_pw_aff_subtract_domain.restype = c_void_p @@ -8635,6 +8649,17 @@ class map(union_map): res = isl.isl_map_min_multi_pw_aff(isl.isl_map_copy(arg0.ptr)) obj = multi_pw_aff(ctx=ctx, ptr=res) return obj + def n_basic_map(arg0): + try: + if not arg0.__class__ is map: + arg0 = map(arg0) + except: + raise + ctx = arg0.ctx + res = isl.isl_map_n_basic_map(arg0.ptr) + if res < 0: + raise + return int(res) def polyhedral_hull(arg0): try: if not arg0.__class__ is map: @@ -9072,6 +9097,7 @@ isl.isl_map_max_multi_pw_aff.restype = c_void_p isl.isl_map_max_multi_pw_aff.argtypes = [c_void_p] isl.isl_map_min_multi_pw_aff.restype = c_void_p isl.isl_map_min_multi_pw_aff.argtypes = [c_void_p] +isl.isl_map_n_basic_map.argtypes = [c_void_p] isl.isl_map_polyhedral_hull.restype = c_void_p isl.isl_map_polyhedral_hull.argtypes = [c_void_p] isl.isl_map_preimage_domain_multi_aff.restype = c_void_p @@ -10538,6 +10564,17 @@ class set(union_set): res = isl.isl_set_min_val(arg0.ptr, arg1.ptr) obj = val(ctx=ctx, ptr=res) return obj + def n_basic_set(arg0): + try: + if not arg0.__class__ is set: + arg0 = set(arg0) + except: + raise + ctx = arg0.ctx + res = isl.isl_set_n_basic_set(arg0.ptr) + if res < 0: + raise + return int(res) def params(arg0): try: if not arg0.__class__ is set: @@ -10908,6 +10945,7 @@ isl.isl_set_min_multi_pw_aff.restype = c_void_p isl.isl_set_min_multi_pw_aff.argtypes = [c_void_p] isl.isl_set_min_val.restype = c_void_p isl.isl_set_min_val.argtypes = [c_void_p, c_void_p] +isl.isl_set_n_basic_set.argtypes = [c_void_p] isl.isl_set_params.restype = c_void_p isl.isl_set_params.argtypes = [c_void_p] isl.isl_set_get_plain_multi_val_if_fixed.restype = c_void_p diff --git a/polly/lib/External/isl/interface/template_cpp.cc b/polly/lib/External/isl/interface/template_cpp.cc index bf138032b7ae..debbfcd28440 100644 --- a/polly/lib/External/isl/interface/template_cpp.cc +++ b/polly/lib/External/isl/interface/template_cpp.cc @@ -541,7 +541,7 @@ static Signature map_from_range_and_domain = static Signature map_from_domain_and_range = { { Domain, Range }, { { Domain }, { Range } } }; -/* Signatures for creating an anonymous set from a parameter set. +/* Signatures for creating an anonymous set from a parameter set * or a map from a domain, where the range is anonymous. */ static Signature anonymous_set_from_params = { { Anonymous }, { { } } }; @@ -592,7 +592,7 @@ static std::vector fn_domain = { domain, set_params }; */ static Signature map_reverse = { { Range, Domain }, { { Domain, Range } } }; static Signature map_range_reverse = - { { Domain, { Range, Range2} }, { { Domain, { Range2, Range} } } }; + { { Domain, { Range2, Range } }, { { Domain, { Range, Range2 } } } }; /* Signatures for constructing products. */ @@ -850,10 +850,10 @@ member_methods { { "range_lattice_tile", { un_map } }, { "range_map", { range_map } }, { "range_product", { range_product } }, + { "range_reverse", { map_range_reverse } }, { "range_simple_fixed_box_hull", { un_map } }, { "reverse", { map_reverse } }, - { "range_reverse", { map_range_reverse } }, { "scale", bin_val }, { "scale_down", bin_val }, { "set_at", set_at }, diff --git a/polly/lib/External/isl/isl_coalesce.c b/polly/lib/External/isl/isl_coalesce.c index e7cefa0dcc47..910c2146bd5a 100644 --- a/polly/lib/External/isl/isl_coalesce.c +++ b/polly/lib/External/isl/isl_coalesce.c @@ -1526,6 +1526,9 @@ static isl_bool has_redundant_cuts(struct isl_coalesce_info *info) * If "add_valid" is set, then the offending constraints are * simply removed. * + * If the facet turns out to be empty, then no wrapping can be performed. + * This is considered a failure, unless "add_valid" is set. + * * If any of the cut constraints of info->bmap turn out * to be redundant with respect to other constraints * then these will neither be wrapped nor added directly to the result. @@ -1550,6 +1553,11 @@ static isl_stat add_selected_wraps_around_facet(struct isl_wraps *wraps, return isl_stat_error; if (isl_tab_detect_redundant(info->tab) < 0) return isl_stat_error; + if (info->tab->empty) { + if (!add_valid) + return wraps_mark_failed(wraps); + return isl_stat_ok; + } nowrap = has_redundant_cuts(info); if (nowrap < 0) return isl_stat_error; diff --git a/polly/lib/External/isl/isl_ctx_private.h b/polly/lib/External/isl/isl_ctx_private.h index 7c66f36c999e..5083a965e927 100644 --- a/polly/lib/External/isl/isl_ctx_private.h +++ b/polly/lib/External/isl/isl_ctx_private.h @@ -42,3 +42,6 @@ struct isl_ctx { }; int isl_ctx_next_operation(isl_ctx *ctx); + +void isl_ctx_set_full_error(isl_ctx *ctx, enum isl_error error, const char *msg, + const char *file, int line); diff --git a/polly/lib/External/isl/isl_input.c b/polly/lib/External/isl/isl_input.c index 4ac2bdd7e653..4c6839d15d8f 100644 --- a/polly/lib/External/isl/isl_input.c +++ b/polly/lib/External/isl/isl_input.c @@ -509,7 +509,9 @@ static __isl_give isl_pw_aff *accept_affine_factor(__isl_keep isl_stream *s, aff = isl_aff_zero_on_domain(isl_local_space_from_space(isl_space_copy(space))); if (!aff) goto error; - isl_int_set_si(aff->v->el[2 + pos], 1); + aff->v = isl_vec_set_element_si(aff->v, 2 + pos, 1); + if (!aff->v) + aff = isl_aff_free(aff); res = isl_pw_aff_from_aff(aff); isl_token_free(tok); } else if (tok->type == ISL_TOKEN_VALUE) { @@ -3679,6 +3681,9 @@ static __isl_give isl_multi_pw_aff *extract_mpa_from_tuple( * through a call to extract_mpa_from_tuple. * The result is converted to an isl_pw_multi_aff and * its domain is intersected with the domain. + * + * Note that the last tuple may introduce new identifiers, + * but these cannot be referenced in the description of the domain. */ static __isl_give isl_pw_multi_aff *read_conditional_multi_aff( __isl_keep isl_stream *s, __isl_take isl_set *dom, struct vars *v) @@ -3687,13 +3692,16 @@ static __isl_give isl_pw_multi_aff *read_conditional_multi_aff( isl_multi_pw_aff *mpa; isl_pw_multi_aff *pma; int n = v->n; + int n_dom; + n_dom = v->n; tuple = read_tuple(s, v, 0, 0); if (!tuple) goto error; if (isl_stream_eat_if_available(s, ISL_TOKEN_TO)) { isl_map *map = map_from_tuple(tuple, dom, isl_dim_in, v, 0); dom = isl_map_domain(map); + n_dom = v->n; tuple = read_tuple(s, v, 0, 0); if (!tuple) goto error; @@ -3703,6 +3711,7 @@ static __isl_give isl_pw_multi_aff *read_conditional_multi_aff( if (!mpa) dom = isl_set_free(dom); + vars_drop(v, v->n - n_dom); dom = read_optional_formula(s, dom, v, 0); vars_drop(v, v->n - n); @@ -3987,10 +3996,14 @@ __isl_give isl_multi_aff *isl_multi_aff_read_from_str(isl_ctx *ctx, * is then converted into the isl_multi_pw_aff through a call * to extract_mpa_from_tuple and the domain of the result * is intersected with the domain. + * + * Note that the last tuple may introduce new identifiers, + * but these cannot be referenced in the description of the domain. */ __isl_give isl_multi_pw_aff *isl_stream_read_multi_pw_aff( __isl_keep isl_stream *s) { + int n_dom; struct vars *v; isl_set *dom = NULL; isl_multi_pw_aff *tuple = NULL; @@ -4009,17 +4022,20 @@ __isl_give isl_multi_pw_aff *isl_stream_read_multi_pw_aff( if (isl_stream_eat(s, '{')) goto error; + n_dom = v->n; tuple = read_tuple(s, v, 0, 0); if (!tuple) goto error; if (isl_stream_eat_if_available(s, ISL_TOKEN_TO)) { isl_map *map = map_from_tuple(tuple, dom, isl_dim_in, v, 0); dom = isl_map_domain(map); + n_dom = v->n; tuple = read_tuple(s, v, 0, 0); if (!tuple) goto error; } + vars_drop(v, v->n - n_dom); if (isl_stream_eat_if_available(s, ':')) dom = read_formula(s, v, dom, 0); diff --git a/polly/lib/External/isl/isl_scheduler.c b/polly/lib/External/isl/isl_scheduler.c index 010881173c6a..5ab65d22522b 100644 --- a/polly/lib/External/isl/isl_scheduler.c +++ b/polly/lib/External/isl/isl_scheduler.c @@ -1106,7 +1106,7 @@ static isl_stat project_out_fixed(struct isl_sched_node *node, * If any of the sizes turns out to be zero, then this means * that this dimension has a fixed value in terms of * the other dimensions. Perform an (extra) compression - * to remove this dimensions. + * to remove this dimension. */ static isl_stat compute_sizes(struct isl_sched_node *node, __isl_keep isl_set *uncompressed) diff --git a/polly/lib/External/isl/isl_stream.c b/polly/lib/External/isl/isl_stream.c index 5f2732b31d77..1052360aa326 100644 --- a/polly/lib/External/isl/isl_stream.c +++ b/polly/lib/External/isl/isl_stream.c @@ -9,11 +9,12 @@ #include #include -#include +#include #include #include #include #include +#include struct isl_keyword { char *name; @@ -134,6 +135,12 @@ void isl_stream_error(__isl_keep isl_stream *s, struct isl_token *tok, { int line = tok ? tok->line : s->line; int col = tok ? tok->col : s->col; + + isl_ctx_set_full_error(s->ctx, isl_error_invalid, "syntax error", + __FILE__, __LINE__); + + if (s->ctx->opt->on_error == ISL_ON_ERROR_CONTINUE) + return; fprintf(stderr, "syntax error (%d, %d): %s\n", line, col, msg); if (tok) { if (tok->type < 256) @@ -165,6 +172,8 @@ void isl_stream_error(__isl_keep isl_stream *s, struct isl_token *tok, else fprintf(stderr, "got token type %d\n", tok->type); } + if (s->ctx->opt->on_error == ISL_ON_ERROR_ABORT) + abort(); } static __isl_give isl_stream* isl_stream_new(struct isl_ctx *ctx) diff --git a/polly/lib/External/isl/isl_test.c b/polly/lib/External/isl/isl_test.c index 4d82f1eba915..2d0965097c47 100644 --- a/polly/lib/External/isl/isl_test.c +++ b/polly/lib/External/isl/isl_test.c @@ -135,6 +135,8 @@ static const char *reparse_multi_pw_aff_tests[] = { "[N] -> { [N] : N >= 0 }", "[N] -> { [N, N + 1] : N >= 0 }", "[N, M] -> { [(N : N >= 0), (M : M >= 0)] : N + M >= 0 }", + "{ [a] -> [b = a] }", + "{ [a] -> [b = a] : a >= 0 }", }; #undef BASE @@ -143,6 +145,16 @@ static const char *reparse_multi_pw_aff_tests[] = { #include "check_reparse_templ.c" #include "check_reparse_test_templ.c" +/* String descriptions that cannot be parsed + * as multi piecewise affine expressions. + */ +static const char *parse_multi_pw_aff_fail_tests[] = { + "{ [a] -> [b] : b = a }", + "{ [a] -> [b = a] : b >= 0 }", +}; + +#include "check_parse_fail_test_templ.c" + /* String descriptions of piecewise multi affine expressions * that are used for testing printing and parsing. */ @@ -184,6 +196,31 @@ static isl_stat test_parse_pma(isl_ctx *ctx) return isl_stat_ok; } +/* String descriptions that cannot be parsed + * as union piecewise multi affine expressions. + */ +static const char *parse_union_pw_multi_aff_fail_tests[] = { + "{ [a] -> [b] : b = a }", + "{ [a] -> [b = a] : b >= 0 }", +}; + +#undef BASE +#define BASE union_pw_multi_aff + +#include "check_parse_fail_test_templ.c" + +/* Test parsing of union piecewise multi affine expressions. + * + * In particular, check some cases where parsing is supposed to fail. + */ +static isl_stat test_parse_upma(isl_ctx *ctx) +{ + if (check_parse_union_pw_multi_aff_fail_tests(ctx) < 0) + return isl_stat_error; + + return isl_stat_ok; +} + /* Test parsing of multi piecewise affine expressions by printing * the expressions and checking that parsing the output results * in the same expression. @@ -191,6 +228,8 @@ static isl_stat test_parse_pma(isl_ctx *ctx) * an expression converted from a map with an output dimension name * that is equal to an automatically generated name, and * a set of expressions parsed from strings. + * + * Additionally, check some cases where parsing is supposed to fail. */ static int test_parse_mpa(isl_ctx *ctx) { @@ -227,6 +266,8 @@ static int test_parse_mpa(isl_ctx *ctx) if (check_reparse_multi_pw_aff_tests(ctx) < 0) return -1; + if (check_parse_multi_pw_aff_fail_tests(ctx) < 0) + return -1; return 0; } @@ -418,6 +459,8 @@ int test_parse(struct isl_ctx *ctx) return -1; if (test_parse_pma(ctx) < 0) return -1; + if (test_parse_upma(ctx) < 0) + return -1; str = "{ [i] -> [-i] }"; map = isl_map_read_from_str(ctx, str); @@ -2375,30 +2418,43 @@ static int test_coalesce_special(struct isl_ctx *ctx) return 0; } -/* A specialized coalescing test case that would result in an assertion - * in an earlier version of isl. +/* Check that the union of the basic sets described by "str1" and "str2" + * can be coalesced. * The explicit call to isl_basic_set_union prevents the implicit - * equality constraints in the first basic map from being detected prior + * equality constraints in the basic maps from being detected prior * to the call to isl_set_coalesce, at least at the point - * where this test case was introduced. + * where this function was introduced. */ -static int test_coalesce_special2(struct isl_ctx *ctx) +static isl_stat test_coalesce_union(isl_ctx *ctx, const char *str1, + const char *str2) { - const char *str; isl_basic_set *bset1, *bset2; isl_set *set; - str = "{ [x, y] : x, y >= 0 and x + 2y <= 1 and 2x + y <= 1 }"; - bset1 = isl_basic_set_read_from_str(ctx, str); - str = "{ [x,0] : -1 <= x <= 1 and x mod 2 = 1 }" ; - bset2 = isl_basic_set_read_from_str(ctx, str); + bset1 = isl_basic_set_read_from_str(ctx, str1); + bset2 = isl_basic_set_read_from_str(ctx, str2); set = isl_basic_set_union(bset1, bset2); set = isl_set_coalesce(set); isl_set_free(set); - if (!set) - return -1; - return 0; + return isl_stat_non_null(set); +} + +/* A specialized coalescing test case that would result in an assertion + * in an earlier version of isl. Use test_coalesce_union with + * an explicit call to isl_basic_set_union to prevent the implicit + * equality constraints in the first basic map from being detected prior + * to the call to isl_set_coalesce, at least at the point + * where this test case was introduced. + */ +static isl_stat test_coalesce_special2(struct isl_ctx *ctx) +{ + const char *str1; + const char *str2; + + str1 = "{ [x, y] : x, y >= 0 and x + 2y <= 1 and 2x + y <= 1 }"; + str2 = "{ [x,0] : -1 <= x <= 1 and x mod 2 = 1 }"; + return test_coalesce_union(ctx, str1, str2); } /* Check that calling isl_set_coalesce does not leave other sets @@ -2510,6 +2566,25 @@ static isl_stat test_coalesce_special6(isl_ctx *ctx) return test_coalesce_intersection(ctx, s1, s2); } +/* A specialized coalescing test case that would result in an assertion failure + * in an earlier version of isl. Use test_coalesce_union with + * an explicit call to isl_basic_set_union to prevent the implicit + * equality constraints in the basic maps from being detected prior + * to the call to isl_set_coalesce, at least at the point + * where this test case was introduced. + */ +static isl_stat test_coalesce_special7(isl_ctx *ctx) +{ + const char *str1; + const char *str2; + + str1 = "{ [a, b, c=0:17] : a <= 7 and 2b <= 11 - a and " + "c <= -7 + 2a and 2c >= - 3 + 3a - 2b }"; + str2 = "{ [a, b, c] : c > -15a and c >= -7 + 2a and c < 0 and " + "3c <= -5 + 5a - 3b and 2b >= 11 - a }"; + return test_coalesce_union(ctx, str1, str2); +} + /* Test the functionality of isl_set_coalesce. * That is, check that the output is always equal to the input * and in some cases that the result consists of a single disjunct. @@ -2539,6 +2614,8 @@ static int test_coalesce(struct isl_ctx *ctx) return -1; if (test_coalesce_special6(ctx) < 0) return -1; + if (test_coalesce_special7(ctx) < 0) + return -1; return 0; diff --git a/polly/lib/External/isl/test_inputs/schedule/niewang.sc b/polly/lib/External/isl/test_inputs/schedule/niewang.sc index 776f2e8f7ef1..816cd234c748 100644 --- a/polly/lib/External/isl/test_inputs/schedule/niewang.sc +++ b/polly/lib/External/isl/test_inputs/schedule/niewang.sc @@ -1,4 +1,4 @@ -# In earlier version of isl, this test case would take an inordinate +# In earlier versions of isl, this test case would take an inordinate # amount of time (in the order of 30s versus 0.1s in later versions) # due to a call to isl_basic_set_coefficients. # Check that this no longer happens in the sense that this test case