From 6ff195efa7b337e0c4db3e06d35acdfcef8108a7 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Thu, 21 Jun 2018 15:44:54 +0200 Subject: [PATCH 001/152] bump isl for isl::{multi_,}union_pw_aff::{min,max}_{multi_,}val --- isl_interface/include/isl/cpp.h | 395 ++++++-------------------------- third-party/islpp | 2 +- 2 files changed, 73 insertions(+), 324 deletions(-) diff --git a/isl_interface/include/isl/cpp.h b/isl_interface/include/isl/cpp.h index 21b11c778..5026694eb 100644 --- a/isl_interface/include/isl/cpp.h +++ b/isl_interface/include/isl/cpp.h @@ -326,7 +326,6 @@ class aff { inline /* implicit */ aff(const isl::aff &obj); inline explicit aff(isl::local_space ls); inline explicit aff(isl::local_space ls, isl::val val); - inline explicit aff(isl::local_space ls, enum isl::dim_type type, unsigned int pos); inline explicit aff(isl::ctx ctx, const std::string &str); inline isl::aff &operator=(isl::aff obj); inline ~aff(); @@ -1516,7 +1515,6 @@ class constraint { static inline isl::constraint alloc_equality(isl::local_space ls); static inline isl::constraint alloc_inequality(isl::local_space ls); inline int cmp_last_non_zero(const isl::constraint &c2) const; - inline int dim(enum isl::dim_type type) const; inline isl::aff get_aff() const; inline isl::val get_constant_val() const; inline isl::aff get_div(int pos) const; @@ -1893,7 +1891,6 @@ class multi_aff { inline isl::multi_aff add(isl::multi_aff multi2) const; inline isl::multi_aff align_params(isl::space model) const; static inline isl::multi_aff domain_map(isl::space space); - inline isl::multi_aff drop_dims(enum isl::dim_type type, unsigned int first, unsigned int n) const; inline isl::multi_aff factor_domain() const; inline isl::multi_aff factor_range() const; inline isl::multi_aff flat_range_product(isl::multi_aff multi2) const; @@ -1905,7 +1902,6 @@ class multi_aff { inline isl::space get_domain_space() const; inline isl::space get_space() const; inline isl::id get_tuple_id(enum isl::dim_type type) const; - inline bool has_tuple_id(enum isl::dim_type type) const; static inline isl::multi_aff identity(isl::space space); inline isl::multi_aff mod(isl::multi_val mv) const; inline isl::multi_aff neg() const; @@ -1916,10 +1912,9 @@ class multi_aff { static inline isl::multi_aff range_map(isl::space space); inline isl::multi_aff range_product(isl::multi_aff multi2) const; inline isl::multi_aff range_splice(unsigned int pos, isl::multi_aff multi2) const; - inline isl::multi_aff reset_tuple_id(enum isl::dim_type type) const; inline isl::multi_aff reset_user() const; - inline isl::multi_aff scale(isl::val v) const; inline isl::multi_aff scale(isl::multi_val mv) const; + inline isl::multi_aff scale(isl::val v) const; inline isl::multi_aff scale_down(isl::val v) const; inline isl::multi_aff scale_down(isl::multi_val mv) const; inline isl::multi_aff set_aff(int pos, isl::aff el) const; @@ -2013,7 +2008,6 @@ class multi_pw_aff { inline isl::multi_pw_aff add(isl::multi_pw_aff multi2) const; inline isl::multi_pw_aff align_params(isl::space model) const; inline isl::set domain() const; - inline isl::multi_pw_aff drop_dims(enum isl::dim_type type, unsigned int first, unsigned int n) const; inline isl::multi_pw_aff factor_domain() const; inline isl::multi_pw_aff factor_range() const; inline isl::multi_pw_aff flat_range_product(isl::multi_pw_aff multi2) const; @@ -2024,7 +2018,6 @@ class multi_pw_aff { inline isl::pw_aff_list get_pw_aff_list() const; inline isl::space get_space() const; inline isl::id get_tuple_id(enum isl::dim_type type) const; - inline bool has_tuple_id(enum isl::dim_type type) const; static inline isl::multi_pw_aff identity(isl::space space); inline bool is_equal(const isl::multi_pw_aff &mpa2) const; inline isl::multi_pw_aff mod(isl::multi_val mv) const; @@ -2037,7 +2030,6 @@ class multi_pw_aff { inline isl::multi_pw_aff range_factor_range() const; inline isl::multi_pw_aff range_product(isl::multi_pw_aff multi2) const; inline isl::multi_pw_aff range_splice(unsigned int pos, isl::multi_pw_aff multi2) const; - inline isl::multi_pw_aff reset_tuple_id(enum isl::dim_type type) const; inline isl::multi_pw_aff reset_user() const; inline isl::multi_pw_aff scale(isl::val v) const; inline isl::multi_pw_aff scale(isl::multi_val mv) const; @@ -2090,7 +2082,6 @@ class multi_union_pw_aff { inline isl::multi_union_pw_aff apply(isl::multi_aff ma) const; inline isl::multi_union_pw_aff apply(isl::pw_multi_aff pma) const; inline isl::union_set domain() const; - inline isl::multi_union_pw_aff drop_dims(enum isl::dim_type type, unsigned int first, unsigned int n) const; inline isl::multi_pw_aff extract_multi_pw_aff(isl::space space) const; inline isl::multi_union_pw_aff factor_domain() const; inline isl::multi_union_pw_aff factor_range() const; @@ -2105,9 +2096,11 @@ class multi_union_pw_aff { inline isl::union_pw_aff get_union_pw_aff(int pos) const; inline isl::union_pw_aff_list get_union_pw_aff_list() const; inline isl::multi_union_pw_aff gist(isl::union_set context) const; - inline bool has_tuple_id(enum isl::dim_type type) const; inline isl::multi_union_pw_aff intersect_domain(isl::union_set uset) const; + inline isl::multi_union_pw_aff intersect_params(isl::set params) const; inline bool involves_param(const isl::id &id) const; + inline isl::multi_val max_multi_val() const; + inline isl::multi_val min_multi_val() const; inline isl::multi_union_pw_aff mod(isl::multi_val mv) const; inline isl::multi_union_pw_aff neg() const; inline isl::multi_union_pw_aff pullback(isl::union_pw_multi_aff upma) const; @@ -2115,7 +2108,6 @@ class multi_union_pw_aff { inline isl::multi_union_pw_aff range_factor_range() const; inline isl::multi_union_pw_aff range_product(isl::multi_union_pw_aff multi2) const; inline isl::multi_union_pw_aff range_splice(unsigned int pos, isl::multi_union_pw_aff multi2) const; - inline isl::multi_union_pw_aff reset_tuple_id(enum isl::dim_type type) const; inline isl::multi_union_pw_aff reset_user() const; inline isl::multi_union_pw_aff scale(isl::val v) const; inline isl::multi_union_pw_aff scale(isl::multi_val mv) const; @@ -2161,7 +2153,6 @@ class multi_val { inline isl::multi_val add(isl::multi_val multi2) const; inline isl::multi_val align_params(isl::space model) const; - inline isl::multi_val drop_dims(enum isl::dim_type type, unsigned int first, unsigned int n) const; inline isl::multi_val factor_domain() const; inline isl::multi_val factor_range() const; inline isl::multi_val flat_range_product(isl::multi_val multi2) const; @@ -2172,7 +2163,6 @@ class multi_val { inline isl::id get_tuple_id(enum isl::dim_type type) const; inline isl::val get_val(int pos) const; inline isl::val_list get_val_list() const; - inline bool has_tuple_id(enum isl::dim_type type) const; inline isl::multi_val mod(isl::multi_val mv) const; inline isl::multi_val neg() const; inline isl::multi_val product(isl::multi_val multi2) const; @@ -2180,7 +2170,6 @@ class multi_val { inline isl::multi_val range_factor_range() const; inline isl::multi_val range_product(isl::multi_val multi2) const; inline isl::multi_val range_splice(unsigned int pos, isl::multi_val multi2) const; - inline isl::multi_val reset_tuple_id(enum isl::dim_type type) const; inline isl::multi_val reset_user() const; inline isl::multi_val scale(isl::val v) const; inline isl::multi_val scale(isl::multi_val mv) const; @@ -2246,7 +2235,6 @@ class pw_aff { inline /* implicit */ pw_aff(const isl::pw_aff &obj); inline /* implicit */ pw_aff(isl::aff aff); inline explicit pw_aff(isl::local_space ls); - inline explicit pw_aff(isl::local_space ls, enum isl::dim_type type, unsigned int pos); inline explicit pw_aff(isl::set domain, isl::val v); inline explicit pw_aff(isl::ctx ctx, const std::string &str); inline isl::pw_aff &operator=(isl::pw_aff obj); @@ -2275,7 +2263,6 @@ class pw_aff { inline isl::set gt_set(isl::pw_aff pwaff2) const; inline isl::pw_aff intersect_domain(isl::set set) const; inline isl::pw_aff intersect_params(isl::set set) const; - inline bool involves_dims(enum isl::dim_type type, unsigned int first, unsigned int n) const; inline bool involves_nan() const; inline bool is_cst() const; inline bool is_equal(const isl::pw_aff &pa2) const; @@ -2842,7 +2829,6 @@ class set { inline std::string to_str() const; inline isl::set add_constraint(isl::constraint constraint) const; - inline isl::set add_dims(enum isl::dim_type type, unsigned int n) const; inline isl::basic_set affine_hull() const; inline isl::set align_params(isl::space model) const; inline isl::set apply(isl::map map) const; @@ -2850,7 +2836,6 @@ class set { inline isl::set complement() const; inline isl::set compute_divs() const; inline isl::set detect_equalities() const; - inline unsigned int dim(enum isl::dim_type type) const; inline isl::pw_aff dim_max(int pos) const; inline isl::pw_aff dim_min(int pos) const; static inline isl::set empty(isl::space space); @@ -2888,7 +2873,6 @@ class set { inline unsigned int n_param() const; static inline isl::set nat_universe(isl::space dim); inline isl::set params() const; - inline isl::val plain_get_val_if_fixed(enum isl::dim_type type, unsigned int pos) const; inline bool plain_is_universe() const; inline isl::basic_set polyhedral_hull() const; inline isl::set preimage_multi_aff(isl::multi_aff ma) const; @@ -2984,19 +2968,15 @@ class space { inline bool can_curry() const; inline bool can_uncurry() const; inline isl::space curry() const; - inline unsigned int dim(enum isl::dim_type type) const; inline isl::space domain() const; inline isl::space domain_map() const; inline isl::space domain_product(isl::space right) const; - inline int find_dim_by_name(enum isl::dim_type type, const std::string &name) const; inline isl::space from_domain() const; inline isl::space from_range() const; - inline std::string get_dim_name(enum isl::dim_type type, unsigned int pos) const; inline isl::id get_tuple_id(enum isl::dim_type type) const; inline bool has_equal_params(const isl::space &space2) const; inline bool has_equal_tuples(const isl::space &space2) const; inline bool has_param(const isl::id &id) const; - inline bool has_tuple_id(enum isl::dim_type type) const; inline bool is_equal(const isl::space &space2) const; inline bool is_params() const; inline bool is_set() const; @@ -3009,9 +2989,7 @@ class space { inline isl::space range() const; inline isl::space range_map() const; inline isl::space range_product(isl::space right) const; - inline isl::space set_dim_id(enum isl::dim_type type, unsigned int pos, isl::id id) const; inline isl::space set_from_params() const; - inline isl::space set_tuple_name(enum isl::dim_type type, const std::string &s) const; inline isl::space uncurry() const; inline isl::space unnamed_set_from_params(unsigned int dim) const; inline isl::space unwrap() const; @@ -3266,6 +3244,8 @@ class union_pw_aff { inline isl::space get_space() const; inline isl::union_pw_aff intersect_domain(isl::union_set uset) const; inline bool involves_param(const isl::id &id) const; + inline isl::val max_val() const; + inline isl::val min_val() const; inline isl::union_pw_aff mod_val(isl::val f) const; inline int n_pw_aff() const; static inline isl::union_pw_aff param_on_domain(isl::union_set domain, isl::id id); @@ -3492,8 +3472,8 @@ class val { public: inline /* implicit */ val(); inline /* implicit */ val(const isl::val &obj); - inline explicit val(isl::ctx ctx, const std::string &str); inline explicit val(isl::ctx ctx, long i); + inline explicit val(isl::ctx ctx, const std::string &str); inline isl::val &operator=(isl::val obj); inline ~val(); inline __isl_give isl_val *copy() const &; @@ -3645,18 +3625,6 @@ aff::aff(isl::local_space ls, isl::val val) throw exception::create_from_last_error(ctx); ptr = res; } -aff::aff(isl::local_space ls, enum isl::dim_type type, unsigned int pos) -{ - if (ls.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - auto ctx = ls.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); - auto res = isl_aff_var_on_domain(ls.release(), static_cast(type), pos); - if (!res) - throw exception::create_from_last_error(ctx); - ptr = res; -} aff::aff(isl::ctx ctx, const std::string &str) { options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); @@ -8461,16 +8429,6 @@ int constraint::cmp_last_non_zero(const isl::constraint &c2) const return res; } -int constraint::dim(enum isl::dim_type type) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_constraint_dim(get(), static_cast(type)); - return res; -} - isl::aff constraint::get_aff() const { if (!ptr) @@ -10808,18 +10766,6 @@ isl::multi_aff multi_aff::domain_map(isl::space space) return manage(res); } -isl::multi_aff multi_aff::drop_dims(enum isl::dim_type type, unsigned int first, unsigned int n) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_aff_drop_dims(copy(), static_cast(type), first, n); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - isl::multi_aff multi_aff::factor_domain() const { if (!ptr) @@ -10952,18 +10898,6 @@ isl::id multi_aff::get_tuple_id(enum isl::dim_type type) const return manage(res); } -bool multi_aff::has_tuple_id(enum isl::dim_type type) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_aff_has_tuple_id(get(), static_cast(type)); - if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; -} - isl::multi_aff multi_aff::identity(isl::space space) { if (space.is_null()) @@ -11086,25 +11020,25 @@ isl::multi_aff multi_aff::range_splice(unsigned int pos, isl::multi_aff multi2) return manage(res); } -isl::multi_aff multi_aff::reset_tuple_id(enum isl::dim_type type) const +isl::multi_aff multi_aff::reset_user() const { if (!ptr) throw isl::exception::create(isl_error_invalid, "NULL input", __FILE__, __LINE__); options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_aff_reset_tuple_id(copy(), static_cast(type)); + auto res = isl_multi_aff_reset_user(copy()); if (!res) throw exception::create_from_last_error(get_ctx()); return manage(res); } -isl::multi_aff multi_aff::reset_user() const +isl::multi_aff multi_aff::scale(isl::multi_val mv) const { - if (!ptr) + if (!ptr || mv.is_null()) throw isl::exception::create(isl_error_invalid, "NULL input", __FILE__, __LINE__); options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_aff_reset_user(copy()); + auto res = isl_multi_aff_scale_multi_val(copy(), mv.release()); if (!res) throw exception::create_from_last_error(get_ctx()); return manage(res); @@ -11122,18 +11056,6 @@ isl::multi_aff multi_aff::scale(isl::val v) const return manage(res); } -isl::multi_aff multi_aff::scale(isl::multi_val mv) const -{ - if (!ptr || mv.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_aff_scale_multi_val(copy(), mv.release()); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - isl::multi_aff multi_aff::scale_down(isl::val v) const { if (!ptr || v.is_null()) @@ -11693,18 +11615,6 @@ isl::set multi_pw_aff::domain() const return manage(res); } -isl::multi_pw_aff multi_pw_aff::drop_dims(enum isl::dim_type type, unsigned int first, unsigned int n) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_pw_aff_drop_dims(copy(), static_cast(type), first, n); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - isl::multi_pw_aff multi_pw_aff::factor_domain() const { if (!ptr) @@ -11825,18 +11735,6 @@ isl::id multi_pw_aff::get_tuple_id(enum isl::dim_type type) const return manage(res); } -bool multi_pw_aff::has_tuple_id(enum isl::dim_type type) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_pw_aff_has_tuple_id(get(), static_cast(type)); - if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; -} - isl::multi_pw_aff multi_pw_aff::identity(isl::space space) { if (space.is_null()) @@ -11982,18 +11880,6 @@ isl::multi_pw_aff multi_pw_aff::range_splice(unsigned int pos, isl::multi_pw_aff return manage(res); } -isl::multi_pw_aff multi_pw_aff::reset_tuple_id(enum isl::dim_type type) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_pw_aff_reset_tuple_id(copy(), static_cast(type)); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - isl::multi_pw_aff multi_pw_aff::reset_user() const { if (!ptr) @@ -12337,18 +12223,6 @@ isl::union_set multi_union_pw_aff::domain() const return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::drop_dims(enum isl::dim_type type, unsigned int first, unsigned int n) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_union_pw_aff_drop_dims(copy(), static_cast(type), first, n); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - isl::multi_pw_aff multi_union_pw_aff::extract_multi_pw_aff(isl::space space) const { if (!ptr || space.is_null()) @@ -12518,25 +12392,25 @@ isl::multi_union_pw_aff multi_union_pw_aff::gist(isl::union_set context) const return manage(res); } -bool multi_union_pw_aff::has_tuple_id(enum isl::dim_type type) const +isl::multi_union_pw_aff multi_union_pw_aff::intersect_domain(isl::union_set uset) const { - if (!ptr) + if (!ptr || uset.is_null()) throw isl::exception::create(isl_error_invalid, "NULL input", __FILE__, __LINE__); options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_union_pw_aff_has_tuple_id(get(), static_cast(type)); - if (res < 0) + auto res = isl_multi_union_pw_aff_intersect_domain(copy(), uset.release()); + if (!res) throw exception::create_from_last_error(get_ctx()); - return res; + return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::intersect_domain(isl::union_set uset) const +isl::multi_union_pw_aff multi_union_pw_aff::intersect_params(isl::set params) const { - if (!ptr || uset.is_null()) + if (!ptr || params.is_null()) throw isl::exception::create(isl_error_invalid, "NULL input", __FILE__, __LINE__); options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_union_pw_aff_intersect_domain(copy(), uset.release()); + auto res = isl_multi_union_pw_aff_intersect_params(copy(), params.release()); if (!res) throw exception::create_from_last_error(get_ctx()); return manage(res); @@ -12554,6 +12428,30 @@ bool multi_union_pw_aff::involves_param(const isl::id &id) const return res; } +isl::multi_val multi_union_pw_aff::max_multi_val() const +{ + if (!ptr) + throw isl::exception::create(isl_error_invalid, + "NULL input", __FILE__, __LINE__); + options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + auto res = isl_multi_union_pw_aff_max_multi_val(copy()); + if (!res) + throw exception::create_from_last_error(get_ctx()); + return manage(res); +} + +isl::multi_val multi_union_pw_aff::min_multi_val() const +{ + if (!ptr) + throw isl::exception::create(isl_error_invalid, + "NULL input", __FILE__, __LINE__); + options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + auto res = isl_multi_union_pw_aff_min_multi_val(copy()); + if (!res) + throw exception::create_from_last_error(get_ctx()); + return manage(res); +} + isl::multi_union_pw_aff multi_union_pw_aff::mod(isl::multi_val mv) const { if (!ptr || mv.is_null()) @@ -12638,18 +12536,6 @@ isl::multi_union_pw_aff multi_union_pw_aff::range_splice(unsigned int pos, isl:: return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::reset_tuple_id(enum isl::dim_type type) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_union_pw_aff_reset_tuple_id(copy(), static_cast(type)); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - isl::multi_union_pw_aff multi_union_pw_aff::reset_user() const { if (!ptr) @@ -12913,18 +12799,6 @@ isl::multi_val multi_val::align_params(isl::space model) const return manage(res); } -isl::multi_val multi_val::drop_dims(enum isl::dim_type type, unsigned int first, unsigned int n) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_val_drop_dims(copy(), static_cast(type), first, n); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - isl::multi_val multi_val::factor_domain() const { if (!ptr) @@ -13045,18 +12919,6 @@ isl::val_list multi_val::get_val_list() const return manage(res); } -bool multi_val::has_tuple_id(enum isl::dim_type type) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_val_has_tuple_id(get(), static_cast(type)); - if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; -} - isl::multi_val multi_val::mod(isl::multi_val mv) const { if (!ptr || mv.is_null()) @@ -13141,18 +13003,6 @@ isl::multi_val multi_val::range_splice(unsigned int pos, isl::multi_val multi2) return manage(res); } -isl::multi_val multi_val::reset_tuple_id(enum isl::dim_type type) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_val_reset_tuple_id(copy(), static_cast(type)); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - isl::multi_val multi_val::reset_user() const { if (!ptr) @@ -13459,18 +13309,6 @@ pw_aff::pw_aff(isl::local_space ls) throw exception::create_from_last_error(ctx); ptr = res; } -pw_aff::pw_aff(isl::local_space ls, enum isl::dim_type type, unsigned int pos) -{ - if (ls.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - auto ctx = ls.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); - auto res = isl_pw_aff_var_on_domain(ls.release(), static_cast(type), pos); - if (!res) - throw exception::create_from_last_error(ctx); - ptr = res; -} pw_aff::pw_aff(isl::set domain, isl::val v) { if (domain.is_null() || v.is_null()) @@ -13744,18 +13582,6 @@ isl::pw_aff pw_aff::intersect_params(isl::set set) const return manage(res); } -bool pw_aff::involves_dims(enum isl::dim_type type, unsigned int first, unsigned int n) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_pw_aff_involves_dims(get(), static_cast(type), first, n); - if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; -} - bool pw_aff::involves_nan() const { if (!ptr) @@ -16798,18 +16624,6 @@ isl::set set::add_constraint(isl::constraint constraint) const return manage(res); } -isl::set set::add_dims(enum isl::dim_type type, unsigned int n) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_set_add_dims(copy(), static_cast(type), n); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - isl::basic_set set::affine_hull() const { if (!ptr) @@ -16894,16 +16708,6 @@ isl::set set::detect_equalities() const return manage(res); } -unsigned int set::dim(enum isl::dim_type type) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_set_dim(get(), static_cast(type)); - return res; -} - isl::pw_aff set::dim_max(int pos) const { if (!ptr) @@ -17361,18 +17165,6 @@ isl::set set::params() const return manage(res); } -isl::val set::plain_get_val_if_fixed(enum isl::dim_type type, unsigned int pos) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_set_plain_get_val_if_fixed(get(), static_cast(type), pos); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - bool set::plain_is_universe() const { if (!ptr) @@ -17962,16 +17754,6 @@ isl::space space::curry() const return manage(res); } -unsigned int space::dim(enum isl::dim_type type) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_space_dim(get(), static_cast(type)); - return res; -} - isl::space space::domain() const { if (!ptr) @@ -18008,16 +17790,6 @@ isl::space space::domain_product(isl::space right) const return manage(res); } -int space::find_dim_by_name(enum isl::dim_type type, const std::string &name) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_space_find_dim_by_name(get(), static_cast(type), name.c_str()); - return res; -} - isl::space space::from_domain() const { if (!ptr) @@ -18042,17 +17814,6 @@ isl::space space::from_range() const return manage(res); } -std::string space::get_dim_name(enum isl::dim_type type, unsigned int pos) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_space_get_dim_name(get(), static_cast(type), pos); - std::string tmp(res); - return tmp; -} - isl::id space::get_tuple_id(enum isl::dim_type type) const { if (!ptr) @@ -18101,18 +17862,6 @@ bool space::has_param(const isl::id &id) const return res; } -bool space::has_tuple_id(enum isl::dim_type type) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_space_has_tuple_id(get(), static_cast(type)); - if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; -} - bool space::is_equal(const isl::space &space2) const { if (!ptr || space2.is_null()) @@ -18257,18 +18006,6 @@ isl::space space::range_product(isl::space right) const return manage(res); } -isl::space space::set_dim_id(enum isl::dim_type type, unsigned int pos, isl::id id) const -{ - if (!ptr || id.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_space_set_dim_id(copy(), static_cast(type), pos, id.release()); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - isl::space space::set_from_params() const { if (!ptr) @@ -18281,18 +18018,6 @@ isl::space space::set_from_params() const return manage(res); } -isl::space space::set_tuple_name(enum isl::dim_type type, const std::string &s) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_space_set_tuple_name(copy(), static_cast(type), s.c_str()); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - isl::space space::uncurry() const { if (!ptr) @@ -19992,6 +19717,30 @@ bool union_pw_aff::involves_param(const isl::id &id) const return res; } +isl::val union_pw_aff::max_val() const +{ + if (!ptr) + throw isl::exception::create(isl_error_invalid, + "NULL input", __FILE__, __LINE__); + options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + auto res = isl_union_pw_aff_max_val(copy()); + if (!res) + throw exception::create_from_last_error(get_ctx()); + return manage(res); +} + +isl::val union_pw_aff::min_val() const +{ + if (!ptr) + throw isl::exception::create(isl_error_invalid, + "NULL input", __FILE__, __LINE__); + options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + auto res = isl_union_pw_aff_min_val(copy()); + if (!res) + throw exception::create_from_last_error(get_ctx()); + return manage(res); +} + isl::union_pw_aff union_pw_aff::mod_val(isl::val f) const { if (!ptr || f.is_null()) @@ -21477,18 +21226,18 @@ val::val(const isl::val &obj) val::val(__isl_take isl_val *ptr) : ptr(ptr) {} -val::val(isl::ctx ctx, const std::string &str) +val::val(isl::ctx ctx, long i) { options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); - auto res = isl_val_read_from_str(ctx.release(), str.c_str()); + auto res = isl_val_int_from_si(ctx.release(), i); if (!res) throw exception::create_from_last_error(ctx); ptr = res; } -val::val(isl::ctx ctx, long i) +val::val(isl::ctx ctx, const std::string &str) { options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); - auto res = isl_val_int_from_si(ctx.release(), i); + auto res = isl_val_read_from_str(ctx.release(), str.c_str()); if (!res) throw exception::create_from_last_error(ctx); ptr = res; diff --git a/third-party/islpp b/third-party/islpp index 74bfaa242..2a9f1d393 160000 --- a/third-party/islpp +++ b/third-party/islpp @@ -1 +1 @@ -Subproject commit 74bfaa24280c341c33db2f457d72f55326577b1c +Subproject commit 2a9f1d3939f950bc1a9e1d3f31433011c178e748 From fc63411fc0d415a967b3da2c01b5787bd0ed802d Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Thu, 21 Jun 2018 16:05:41 +0200 Subject: [PATCH 002/152] move warning on positive minimal mapping to MappedScop::map tightenLaunchBounds logs a warning if the minimum of the block or thread mapping is strictly positive since it would be possible to shift the mapping over that minimum and further tighten the bounds. Given the current infrastructure of TC, it is fairly unlikely that this would happen and especially for this to happen consistently over the entire tree. Furthermore, by the time tightenLaunchBounds is called it is too late to change the mapping. Move the warning to where the mapping is constructed and where it could in principle still be adjusted. --- tc/core/polyhedral/cuda/mapped_scop.cc | 27 +++++++++++++++++-- .../polyhedral/cuda/tighten_launch_bounds.cc | 4 --- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/tc/core/polyhedral/cuda/mapped_scop.cc b/tc/core/polyhedral/cuda/mapped_scop.cc index 95a401596..d7b53a527 100644 --- a/tc/core/polyhedral/cuda/mapped_scop.cc +++ b/tc/core/polyhedral/cuda/mapped_scop.cc @@ -48,6 +48,26 @@ namespace polyhedral { namespace { +/* + * Check if the minimum of any affine function in "list" is strictly + * positive on "domain" and, if so, print a warning. + * The functions in "list" are used for mapping to block/thread identifiers. + * If the minimum is strictly positive, then this means some + * identifiers do nothing in the corresponding subtree. + * Note that tightenLaunchBounds (if extended to consider + * the minimal value of the mapping) may not help much because + * those identifiers may get used in other parts of the tree. + * Furthermore, at that point it is too late to change the mapping. + */ +static void checkMinimum(isl::union_set domain, isl::union_pw_aff_list list) { + for (auto upa : list) { + upa = upa.intersect_domain(domain); + auto min = upa.min_val(); + LOG_IF(WARNING, min.is_pos()) + << "Opportunity for shifting mapping -> min:" << min; + } +} + template inline void throwIfHasPattern( ScheduleTreeMatcher matcher, @@ -111,7 +131,8 @@ detail::ScheduleTree* MappedScop::map( TC_CHECK_LE(nToMap, extent.size()) << "dimension overflow"; auto root = scop_->scheduleRoot(); - auto domain = activeDomainPoints(root, tree).universe(); + auto domain = activeDomainPoints(root, tree); + auto universe = domain.universe(); std::vector idList; auto affList = isl::union_pw_aff_list(list.get_ctx(), 0); @@ -127,10 +148,12 @@ detail::ScheduleTree* MappedScop::map( for (size_t i = nToMap; i < extent.size(); ++i) { auto id = MappingTypeId::makeId(i); affList = affList.add( - isl::union_pw_aff(domain, isl::val::zero(domain.get_ctx()))); + isl::union_pw_aff(universe, isl::val::zero(domain.get_ctx()))); idList.emplace_back(id); } + checkMinimum(domain, affList); + auto mapping = detail::ScheduleTree::makeMapping(idList, affList); tree = insertNodeAbove(root, tree, std::move(mapping))->child({0}); diff --git a/tc/core/polyhedral/cuda/tighten_launch_bounds.cc b/tc/core/polyhedral/cuda/tighten_launch_bounds.cc index 9dd87a2a1..7bc2d273c 100644 --- a/tc/core/polyhedral/cuda/tighten_launch_bounds.cc +++ b/tc/core/polyhedral/cuda/tighten_launch_bounds.cc @@ -84,10 +84,6 @@ size_t maxValue(const Scop& scop, const MappingIdType& id) { min = std::min(min, range.first); max = std::max(max, range.second); } - // Ignore min for now but there is a future possibility for shifting - LOG_IF(WARNING, min > 0) - << "Opportunity for tightening launch bounds with shifting -> min:" - << min; TC_CHECK(max < sizetMax) << "missing mapping to " << id << "\n" << *root; TC_CHECK(min < sizetMax) << "missing mapping to " << id << " type\n" << *root; // Inclusive range needs + 1 to translate to sizes From daac7ae09c728439aea46302a77f69e07a7d8c74 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Thu, 21 Jun 2018 16:06:59 +0200 Subject: [PATCH 003/152] MappedScop::map: add extra sanity check on mappings This check is similar to one performed by tightenLaunchBounds, which will be removed when tightenLaunchBounds gets implemented in terms of the actual mapping instead of the filter derived from the mapping. --- tc/core/polyhedral/cuda/mapped_scop.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tc/core/polyhedral/cuda/mapped_scop.cc b/tc/core/polyhedral/cuda/mapped_scop.cc index d7b53a527..cb9b2dca9 100644 --- a/tc/core/polyhedral/cuda/mapped_scop.cc +++ b/tc/core/polyhedral/cuda/mapped_scop.cc @@ -58,11 +58,17 @@ namespace { * the minimal value of the mapping) may not help much because * those identifiers may get used in other parts of the tree. * Furthermore, at that point it is too late to change the mapping. + * + * Also double check that the minimum is non-negative. + * This should always be the case since the affine functions in "list" + * are all the result of a modulo operation. + * A value of NaN means that the domain is empty. */ static void checkMinimum(isl::union_set domain, isl::union_pw_aff_list list) { for (auto upa : list) { upa = upa.intersect_domain(domain); auto min = upa.min_val(); + TC_CHECK(min.is_nonneg()) << "mapping to negative block/thread" << min; LOG_IF(WARNING, min.is_pos()) << "Opportunity for shifting mapping -> min:" << min; } From 701ab917325f815dd2480d8ba9774deb57ea8c41 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Thu, 21 Jun 2018 16:38:05 +0200 Subject: [PATCH 004/152] tightenLaunchBounds: pass in MappedScop This will be needed for extracting the mapping schedule in the next commit. --- tc/core/polyhedral/cuda/mapped_scop.cc | 2 +- tc/core/polyhedral/cuda/tighten_launch_bounds.cc | 12 +++++++----- tc/core/polyhedral/cuda/tighten_launch_bounds.h | 4 ++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/tc/core/polyhedral/cuda/mapped_scop.cc b/tc/core/polyhedral/cuda/mapped_scop.cc index cb9b2dca9..8fd3f3551 100644 --- a/tc/core/polyhedral/cuda/mapped_scop.cc +++ b/tc/core/polyhedral/cuda/mapped_scop.cc @@ -906,7 +906,7 @@ std::unique_ptr makeSpecializedMappedScop( tc::Grid grid = mappedScop.numBlocks; tc::Block block = mappedScop.numThreads; - std::tie(grid, block) = tightenLaunchBounds(*scop, grid, block); + std::tie(grid, block) = tightenLaunchBounds(mappedScop, grid, block); auto res = MappedScop::makeMappedScop( std::move(scop), grid, diff --git a/tc/core/polyhedral/cuda/tighten_launch_bounds.cc b/tc/core/polyhedral/cuda/tighten_launch_bounds.cc index 7bc2d273c..e4750dbc8 100644 --- a/tc/core/polyhedral/cuda/tighten_launch_bounds.cc +++ b/tc/core/polyhedral/cuda/tighten_launch_bounds.cc @@ -17,11 +17,13 @@ #include "tc/core/polyhedral/cuda/tighten_launch_bounds.h" #include "tc/core/check.h" +#include "tc/core/polyhedral/cuda/mapped_scop.h" #include "tc/core/polyhedral/cuda/mapping_types.h" #include "tc/core/polyhedral/exceptions.h" #include "tc/core/polyhedral/functional.h" #include "tc/core/polyhedral/schedule_tree.h" #include "tc/core/polyhedral/schedule_utils.h" +#include "tc/core/polyhedral/scop.h" namespace tc { namespace polyhedral { @@ -95,11 +97,11 @@ size_t maxValue(const Scop& scop, const MappingIdType& id) { * by the tightened, actual, launch bounds used in practice. */ template -Size launchBounds(const Scop& scop, Size size) { +Size launchBounds(const MappedScop& mscop, Size size) { Size tightened; for (size_t i = 0; i < size.view.size(); ++i) { - tightened.view[i] = maxValue(scop, MappingIdType::makeId(i)); + tightened.view[i] = maxValue(mscop.scop(), MappingIdType::makeId(i)); } return tightened; @@ -111,12 +113,12 @@ Size launchBounds(const Scop& scop, Size size) { // computes the tightened, actual, launch bounds used in practice after // specialization of the ScheduleTree. std::pair tightenLaunchBounds( - const Scop& scop, + const MappedScop& mscop, const tc::Grid& grid, const tc::Block& block) { return std::make_pair( - launchBounds(scop, grid), - launchBounds(scop, block)); + launchBounds(mscop, grid), + launchBounds(mscop, block)); } } // namespace polyhedral } // namespace tc diff --git a/tc/core/polyhedral/cuda/tighten_launch_bounds.h b/tc/core/polyhedral/cuda/tighten_launch_bounds.h index 89be0a8ad..251d11bb8 100644 --- a/tc/core/polyhedral/cuda/tighten_launch_bounds.h +++ b/tc/core/polyhedral/cuda/tighten_launch_bounds.h @@ -16,12 +16,12 @@ #pragma once #include "tc/core/cuda/cuda_mapping_options.h" -#include "tc/core/polyhedral/scop.h" +#include "tc/core/polyhedral/cuda/mapped_scop.h" namespace tc { namespace polyhedral { std::pair tightenLaunchBounds( - const Scop& scop, + const MappedScop& mscop, const tc::Grid& grid, const tc::Block& block); } // namespace polyhedral From bb697dcfddd957cf316725564090dd04a3be35fc Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Thu, 21 Jun 2018 17:00:34 +0200 Subject: [PATCH 005/152] tightenLaunchBounds: use mapping schedule instead of mapping filters The mapping filters are derived from the mapping schedule. It is more natural, simpler and less error-prone to derive the tightened launch bounds directly from the mapping schedule. --- .../polyhedral/cuda/tighten_launch_bounds.cc | 88 +++++-------------- 1 file changed, 23 insertions(+), 65 deletions(-) diff --git a/tc/core/polyhedral/cuda/tighten_launch_bounds.cc b/tc/core/polyhedral/cuda/tighten_launch_bounds.cc index e4750dbc8..137aa5e78 100644 --- a/tc/core/polyhedral/cuda/tighten_launch_bounds.cc +++ b/tc/core/polyhedral/cuda/tighten_launch_bounds.cc @@ -20,76 +20,25 @@ #include "tc/core/polyhedral/cuda/mapped_scop.h" #include "tc/core/polyhedral/cuda/mapping_types.h" #include "tc/core/polyhedral/exceptions.h" -#include "tc/core/polyhedral/functional.h" -#include "tc/core/polyhedral/schedule_tree.h" -#include "tc/core/polyhedral/schedule_utils.h" -#include "tc/core/polyhedral/scop.h" namespace tc { namespace polyhedral { namespace { -// This returns the (inclusive) range of the mapping parameter "mappingId" -// within the context "mappingContext". -// This range corresponds to the blocks/threads active at the particular -// location in the tree where this mapping is active. -// -// This is used to tighten the kernel to only launch on the necessary amount -// of resources. -// -// When the range is unbounded on the right, we return the maximal positive -// range (0, max_size_t). This needs to be intersected with launch bounds to -// obtain the proper finite range. -// Otherwise, the range is asserted bounded on the left and to lie in the -// positive half of the integer axis. -std::pair rangeOfMappingParameter( - isl::set mappingContext, - mapping::MappingId mappingId) { - if (!mappingContext.involves_param(mappingId)) { - return std::make_pair(0, std::numeric_limits::max()); - } - auto space = mappingContext.get_space(); - isl::aff a(isl::aff::param_on_domain_space(space, mappingId)); - auto max = mappingContext.max_val(a); - if (max.is_nan() || max.is_infty()) { - return std::make_pair(0, std::numeric_limits::max()); - } - TC_CHECK(max.is_int()) << max.to_str(); - TC_CHECK(max.is_nonneg()) << max.to_str(); - auto min = mappingContext.min_val(a); - TC_CHECK(min.is_int()) << max.to_str(); - TC_CHECK(min.is_nonneg()) << max.to_str(); - - return std::make_pair( - static_cast(min.get_num_si()), - static_cast(max.get_num_si())); -} - /* - * Compute the maximal value attained by the mapping parameter "id". + * Return the mapping to MappingTypeId, i.e, either the mapping to blocks or + * the mapping to threads. */ -template -size_t maxValue(const Scop& scop, const MappingIdType& id) { - using namespace polyhedral::detail; - - auto root = scop.scheduleRoot(); - auto params = scop.context(); - size_t sizetMax = std::numeric_limits::max(); - size_t max = 0; - size_t min = sizetMax; - auto filters = root->collect(root, ScheduleTreeType::Mapping); - filters = functional::Filter(isMappingTo, filters); - for (auto p : filters) { - auto mappingNode = p->as(); - auto active = activeDomainPoints(root, p).intersect_params(params); - active = active.intersect(mappingNode->filter_); - auto range = rangeOfMappingParameter(active.params(), id); - min = std::min(min, range.first); - max = std::max(max, range.second); - } - TC_CHECK(max < sizetMax) << "missing mapping to " << id << "\n" << *root; - TC_CHECK(min < sizetMax) << "missing mapping to " << id << " type\n" << *root; - // Inclusive range needs + 1 to translate to sizes - return max + 1; +template +static isl::multi_union_pw_aff mappingSchedule(const MappedScop& mscop); +template <> +isl::multi_union_pw_aff mappingSchedule( + const MappedScop& mscop) { + return mscop.blockMappingSchedule(mscop.schedule()); +} +template <> +isl::multi_union_pw_aff mappingSchedule( + const MappedScop& mscop) { + return mscop.threadMappingSchedule(mscop.schedule()); } /* @@ -100,8 +49,17 @@ template Size launchBounds(const MappedScop& mscop, Size size) { Size tightened; + auto params = mscop.scop().context(); + auto mapping = mappingSchedule(mscop); + mapping = mapping.intersect_params(params); + auto max = mapping.max_multi_val(); + for (size_t i = 0; i < size.view.size(); ++i) { - tightened.view[i] = maxValue(mscop.scop(), MappingIdType::makeId(i)); + auto maxVal = max.get_val(i); + TC_CHECK(maxVal.is_int()) << maxVal.to_str(); + TC_CHECK(maxVal.is_nonneg()) << maxVal.to_str(); + // Inclusive range needs + 1 to translate to sizes + tightened.view[i] = maxVal.get_num_si() + 1; } return tightened; From c805194f716ea4c009443fe1dbb82b911ea7cc6f Mon Sep 17 00:00:00 2001 From: Nicolas Vasilache Date: Mon, 2 Jul 2018 10:32:39 -0700 Subject: [PATCH 006/152] Update to support upcoming Caffe2 API Caffe2 API killed the copy constructor so we need to update `GetNamedTensor`. So we use the Caffe2 API to return a new tensor that shares the data with the tensor from the workspace. Tested internally with the latest API. --- test/caffe2/test_harness-inl.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/caffe2/test_harness-inl.h b/test/caffe2/test_harness-inl.h index 581d4f936..5bedaa916 100644 --- a/test/caffe2/test_harness-inl.h +++ b/test/caffe2/test_harness-inl.h @@ -69,8 +69,11 @@ caffe2::Tensor GetNamedTensor( caffe2::Workspace& ws, const std::string& name) { // Resolved dynamically - return caffe2::Tensor( - ws.GetBlob(name)->Get()); + auto& t = ws.GetBlob(name)->Get(); + caffe2::Tensor res; + res.ResizeLike(t); + res.ShareData(t); + return res; } // helper functions to construct an ATen tensor from a caffe2 tensor From 995a808be7da858808cc67b7c3a51fd69805f8a3 Mon Sep 17 00:00:00 2001 From: Nicolas Vasilache Date: Thu, 5 Jul 2018 13:29:58 -0700 Subject: [PATCH 007/152] Use proper int division operator Without this, the following error occurs: `TypeError: 'float' object cannot be interpreted as an integer` --- python/examples/min_distance.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/python/examples/min_distance.py b/python/examples/min_distance.py index c85639e44..7e6e59c44 100644 --- a/python/examples/min_distance.py +++ b/python/examples/min_distance.py @@ -103,9 +103,9 @@ def argmin_1d(float(N) S, int32(D) MinIdx) -> (min_idx) { T = tc.define(lang, tc.make_naive_options_factory()) S = T.reduce_codes(luts_t, codes_t) -V = T.min_2d(S.view((D, N / D))) +V = T.min_2d(S.view((D, N // D))) v = T.min_1d(V) -MinIdx = T.argmin_2d(S.view((D, N / D)), v) +MinIdx = T.argmin_2d(S.view((D, N // D)), v) min_idx = T.argmin_1d(S, MinIdx) print("minval: {} minidx: {}".format(v, min_idx)) @@ -159,8 +159,8 @@ def argmin_1d(float(K, N) S, int32(K, D) MinIdx2) -> (MinIdx) { T = tc.define(lang, tc.make_naive_options_factory()) S = T.reduce_codes(luts_t, codes_t) -V2 = T.min_2d(S.view((K, D, N / D))) +V2 = T.min_2d(S.view((K, D, N // D))) V = T.min_1d(V2) -MinIdx2 = T.argmin_2d(S.view((K, D, N / D)), V) +MinIdx2 = T.argmin_2d(S.view((K, D, N // D)), V) MinIdx = T.argmin_1d(S, MinIdx2) print("minval: {} minidx: {}".format(V, MinIdx)) From 553203c7e296382d1bdb095aa4c5a6903c602984 Mon Sep 17 00:00:00 2001 From: Nicolas Vasilache Date: Fri, 6 Jul 2018 08:18:03 -0700 Subject: [PATCH 008/152] Update test_caffe2 to latest python bindings Tested internally --- python/tests/test_caffe2.py | 47 +++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/python/tests/test_caffe2.py b/python/tests/test_caffe2.py index 61eda3428..ad26ead5f 100644 --- a/python/tests/test_caffe2.py +++ b/python/tests/test_caffe2.py @@ -18,6 +18,7 @@ import hypothesis.strategies as st import caffe2.python.hypothesis_test_util as hu import tensor_comprehensions as tc +import torch from hypothesis import given, settings from caffe2.python import core, dyndep @@ -33,9 +34,6 @@ def matmul(float(M,N) A, float(N,K) B) -> (output) { output(m, k) +=! A(m, r_n) * B(r_n, k) } -""" - -MATMUL_GRAD_LANG = """ def matmul_grad(float(M, N) A, float(N, K) B, float(M, K) d_O) -> (d_A, d_B) { d_A(m, n) +=! d_O(m, r_k) * B(n, r_k) d_B(n, k) +=! d_O(r_m, k) * A(r_m, n) @@ -61,7 +59,7 @@ def ref(X, W): "TcOp", ["X", "Y"], "out", tc_def=MATMUL_LANG, tc_name="matmul", - tc_grad_def=MATMUL_GRAD_LANG, + tc_grad_def=MATMUL_LANG, tc_grad_name="matmul_grad", inputs_used_by_gradient=[0, 1], output_gradients_used_by_gradient=[0], @@ -91,24 +89,23 @@ def ref(X, W): **hu.gcs_gpu_only) @settings(max_examples=2) def test_matmul_tune_and_run(self, n, m, k, seed, gc, dc): - matmul = tc.define(MATMUL_LANG, name="matmul") - matmul_grad = tc.define(MATMUL_GRAD_LANG, name="matmul_grad") - - mapping_options = matmul.autotune( - (n, k), (k, m), - generations=3, - threads=32, - pop_size=2, - tuner_min_launch_total_threads=1, - ) - - grad_mapping_options = matmul_grad.autotune( - (n, k), (k, m), (n, m), - generations=1, - threads=32, - pop_size=2, - tuner_min_launch_total_threads=1, - ) + tuner = tc.Tuner(MATMUL_LANG) + tuner_config = ( + tc.TunerConfig().generations(3).threads(32).pop_size(2) + .tuner_min_launch_total_threads(1)) + matmul_top1 = tuner.tune( + 'matmul', + (torch.randn(n, k, device='cuda'), + torch.randn(k, m, device='cuda')), + tc.MappingOptions('naive'), + tuner_config) + matmul_grad_top1 = tuner.tune( + 'matmul_grad', + (torch.randn(n, k, device='cuda'), + torch.randn(k, m, device='cuda'), + torch.randn(n, m, device='cuda')), + tc.MappingOptions('naive'), + tuner_config) X = np.random.rand(m, k).astype(np.float32) W = np.random.rand(k, n).astype(np.float32) @@ -120,13 +117,13 @@ def ref(X, W): "TcOp", ["X", "Y"], "out", tc_def=MATMUL_LANG, tc_name="matmul", - tc_grad_def=MATMUL_GRAD_LANG, + tc_grad_def=MATMUL_LANG, tc_grad_name="matmul_grad", inputs_used_by_gradient=[0, 1], output_gradients_used_by_gradient=[0], inputs_to_compute_gradients_of=[0, 1], - mapping_options=mapping_options.serialize(), - grad_mapping_options=grad_mapping_options.serialize(), + mapping_options=matmul_top1.serialize(), + grad_mapping_options=matmul_grad_top1.serialize(), ) self.assertReferenceChecks( From 379a45040d43f6995555ef6d0fe54b21e4db3ef7 Mon Sep 17 00:00:00 2001 From: Nicolas Vasilache Date: Fri, 6 Jul 2018 08:19:00 -0700 Subject: [PATCH 009/152] Update caffe2_benchmak.py to latest python API Tested internally --- python/benchmarks/caffe2_benchmark.py | 29 ++++++++++++++++----------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/python/benchmarks/caffe2_benchmark.py b/python/benchmarks/caffe2_benchmark.py index 22593240a..ec23aceca 100644 --- a/python/benchmarks/caffe2_benchmark.py +++ b/python/benchmarks/caffe2_benchmark.py @@ -19,6 +19,7 @@ import numpy as np import os import tensor_comprehensions as tc +import torch from caffe2.python import core, dyndep, workspace, utils @@ -85,18 +86,22 @@ def main(): @utils.debug def tune(args): - fc = tc.define(FC_LANG, name="func_fc") - options = fc.autotune( - (args.batch_size, args.input_dim), - (args.output_dim, args.input_dim), - (args.output_dim,), - cache = args.tuner_cache_file, - threads = args.tuner_threads, - generations = args.tuner_gen_generations, - pop_size = args.tuner_gen_pop_size, - ) - print(options.toString()) - return options + tuner_config = ( + tc.TunerConfig() + .generations(args.tuner_gen_generations) + .devices(args.tuner_devices) + .threads(args.tuner_threads) + .pop_size(args.tuner_gen_pop_size)) + return tc.autotune( + FC_LANG, + 'func_fc', + torch.randn(args.batch_size, args.input_dim, device='cuda'), + torch.randn(args.output_dim, args.input_dim, device='cuda'), + torch.randn(args.output_dim, device='cuda'), + starting_options = tc.MappingOptions('naive'), + tuner_config = tuner_config, + cache_filename = args.tuner_cache_file, + store_to_cache = True) @utils.debug From 3516e6200f1e0b6bcb507f257cc19ad905a2e8c9 Mon Sep 17 00:00:00 2001 From: Nicolas Vasilache Date: Mon, 9 Jul 2018 09:13:38 -0700 Subject: [PATCH 010/152] Drop caffe2 benchmark from OSS Caffe2 benchmarks are now handled internally until they can check on the external CI. This will most likely happen when pytorch 1.0 binaries are available. --- python/benchmarks/caffe2_benchmark.py | 154 -------------------------- 1 file changed, 154 deletions(-) delete mode 100644 python/benchmarks/caffe2_benchmark.py diff --git a/python/benchmarks/caffe2_benchmark.py b/python/benchmarks/caffe2_benchmark.py deleted file mode 100644 index ec23aceca..000000000 --- a/python/benchmarks/caffe2_benchmark.py +++ /dev/null @@ -1,154 +0,0 @@ -# Copyright (c) 2018-present, Facebook, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -############################################################################## - -#!/usr/bin/env python3 - -import argparse -import numpy as np -import os -import tensor_comprehensions as tc -import torch - -from caffe2.python import core, dyndep, workspace, utils - - -CONDA_PREFIX = os.environ.get("CONDA_PREFIX") -if CONDA_PREFIX: - tc_c2_lib = os.path.join(CONDA_PREFIX, "lib/libtc_c2.so") -else: - dyndep.InitOpsLibrary("@/tc/tc:tc_c2") - -FC_LANG = """ - def func_fc(float(B,M) I, float(N,M) W1, float(N) B1) -> (O1) { - O1(b, n) +=! I(b, r_m) * W1(n, r_m) - O1(b, n) = O1(b, n) + B1(n) - } -""" - - -def GetArgumentParser(): - parser = argparse.ArgumentParser( - description="Caffe2 benchmark. Extra args will be passed to Caffe2") - parser.add_argument("--batch_size", type=int, default=32, - help="The batch size.") - parser.add_argument("--input_dim", type=int, default=512, - help="The input dense dimension.") - parser.add_argument("--output_dim", type=int, default=128, - help="The input dense dimension.") - parser.add_argument("--num_runs", type=int, default=1000, - help="how many times to run each op") - parser.add_argument("--tuner_cache_file", type=str, - default="tuner_cache", - help="File to store tuned mapping options") - parser.add_argument("--tuner_devices", type=str, - default="0", - help="String representation of gpus to use for tuning (e.g. \"0,1\")") - parser.add_argument("--tuner_threads", type=int, default=10, - help="String representation of gpus to use for tuning (e.g. \"0,1\")") - parser.add_argument("--tuner_gen_generations", type=int, default=10, - help="Number of iterations to tune") - parser.add_argument("--tuner_gen_pop_size", type=int, default=50, - help="Population size for each tuning iteration") - return parser - - -def main(): - parser = GetArgumentParser() - args, extra_args = parser.parse_known_args() - - core.GlobalInit([ - 'tc_bench', - '--caffe2_logging_operator_dyno_sampling_rate=0', - '--tuner_devices=' + args.tuner_devices, - '--caffe2_simple_net_benchmark_run_whole_net=0', - ] + extra_args) - mapping_options = tune(args) - compare_fcs( - args.batch_size, - args.input_dim, - args.output_dim, - args.num_runs, - mapping_options, - ) - - -@utils.debug -def tune(args): - tuner_config = ( - tc.TunerConfig() - .generations(args.tuner_gen_generations) - .devices(args.tuner_devices) - .threads(args.tuner_threads) - .pop_size(args.tuner_gen_pop_size)) - return tc.autotune( - FC_LANG, - 'func_fc', - torch.randn(args.batch_size, args.input_dim, device='cuda'), - torch.randn(args.output_dim, args.input_dim, device='cuda'), - torch.randn(args.output_dim, device='cuda'), - starting_options = tc.MappingOptions('naive'), - tuner_config = tuner_config, - cache_filename = args.tuner_cache_file, - store_to_cache = True) - - -@utils.debug -def compare_fcs(B, M, N, num_runs, mapping_options=None): - X = np.random.rand(B, M).astype(np.float32) - 0.5 - W = np.random.rand(N, M).astype(np.float32) - 0.5 - b = np.random.rand(N).astype(np.float32) - 0.5 - - with core.DeviceScope(core.DeviceOption(1)): - workspace.FeedBlob("X", X) - workspace.FeedBlob("W", W) - workspace.FeedBlob("b", b) - - net = core.Net("test") - - with core.DeviceScope(core.DeviceOption(1)): - net.FC(["X", "W", "b"], "Y_baseline") - net.TcOp( - ["X", "W", "b"], "Y_TC", - tc_def=FC_LANG, - tc_name="func_fc", - mapping_options=( - mapping_options.serialize() if mapping_options else None), - check_sizes=True, - ) - - workspace.CreateNet(net) - workspace.RunNet(net) - - baseline_value = workspace.blobs["Y_baseline"] - tc_value = workspace.blobs["Y_TC"] - np.testing.assert_allclose( - baseline_value, - tc_value, - rtol=1e-4, - atol=1e-4, - ) - - runtimes = workspace.BenchmarkNet( - net.Name(), - 0, # warmpup was already done - num_runs, - True, # run individual ops - )[1:] - - print(runtimes) - - -if __name__ == '__main__': - main() From 7dbb65b622d03e5d3a36578e81e781f1c9ad8d6c Mon Sep 17 00:00:00 2001 From: Nicolas Vasilache Date: Tue, 10 Jul 2018 14:16:52 -0700 Subject: [PATCH 011/152] Move to trunk LLVM This commit switches from Tapir which is based on LLVM 5.0 to trunk LLVM. The main motivation is that LLVM 5.0 NVPTX only supports ancient cuda architectures and that FB internally uses an LLVM that is much closer to trunk. --- .circleci/config.yml | 4 +- .github/ISSUE_TEMPLATE.md | 2 +- .jenkins/build.sh | 2 +- conda_recipes/README.md | 2 +- conda_recipes/conda_build_tc.sh | 31 ++++--- conda_recipes/halide/meta.yaml | 4 +- conda_recipes/llvm-trunk/build.sh | 62 +++++++++++++ conda_recipes/llvm-trunk/meta.yaml | 33 +++++++ conda_recipes/tensor_comprehensions/meta.yaml | 4 +- docs/source/installation.rst | 2 +- tc/core/polyhedral/llvm_jit.cc | 11 +-- tc/core/polyhedral/llvm_jit.h | 1 - test/CMakeLists.txt | 13 --- test/test_mapper_tapir.cc | 93 ------------------- 14 files changed, 127 insertions(+), 137 deletions(-) create mode 100644 conda_recipes/llvm-trunk/build.sh create mode 100644 conda_recipes/llvm-trunk/meta.yaml delete mode 100644 test/test_mapper_tapir.cc diff --git a/.circleci/config.yml b/.circleci/config.yml index 7972c71f9..ae07bae7c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -9,11 +9,11 @@ jobs: steps: - checkout - run: - name: conda_tapir_halide + name: conda_llvm_halide command: | . /opt/conda/anaconda/bin/activate source activate tc_build - conda install -y -c nicolasvasilache llvm-tapir50 halide + conda install -y -c nicolasvasilache llvm-trunk halide - run: name: check_formatting diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 7648102d5..757a5e21b 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -16,7 +16,7 @@ When submitting a bug report, please include the following information (where re - GCC/GXX version (if compiling from source): - LLVM/Tapir git hash used (if compiling from source): - To get the hash, run: `$HOME/clang+llvm-tapir5.0/bin/clang --version` + To get the hash, run: `$CONDA_PREFIX/bin/clang --version` - Commit hash of our repo and submodules (if compiling from source): diff --git a/.jenkins/build.sh b/.jenkins/build.sh index e0e97bf8b..1aeba7681 100755 --- a/.jenkins/build.sh +++ b/.jenkins/build.sh @@ -60,7 +60,7 @@ cd /var/lib/jenkins/workspace git submodule update --init --recursive source activate tc_build -conda install -y -c nicolasvasilache llvm-tapir50 halide +conda install -y -c nicolasvasilache llvm-trunk halide conda install -y -c conda-forge eigen conda install -y -c nicolasvasilache caffe2 diff --git a/conda_recipes/README.md b/conda_recipes/README.md index 6f64d2075..6243852fc 100644 --- a/conda_recipes/README.md +++ b/conda_recipes/README.md @@ -17,7 +17,7 @@ nvidia-docker run --rm -i -t tc-cuda9.0-cudnn7.1-ubuntu16.04-devel We are ready to build conda package for TC. To simplify the build process we ship TC dependencies as conda packages. -We need to build packages for `llvm-tapir50`, `Halide`, `Caffe2` (optional) and finally `Tensor Comprehensions`. +We need to build packages for `llvm-trunk`, `Halide`, `Caffe2` (optional) and finally `Tensor Comprehensions`. For building each package, we need to specify a `build version`, `build number` and `git hash`. This information is used to build each package. diff --git a/conda_recipes/conda_build_tc.sh b/conda_recipes/conda_build_tc.sh index 6d4f125cc..aeb682bef 100755 --- a/conda_recipes/conda_build_tc.sh +++ b/conda_recipes/conda_build_tc.sh @@ -28,27 +28,31 @@ time conda build -c $ANACONDA_USER --python 3.6 caffe2 echo "Caffe2 packaged Successfully" ############################################################################### -# LLVM_TAPIR settings -LLVM_TAPIR_BUILD_VERSION="1.0.0" -LLVM_TAPIR_BUILD_NUMBER=1 -LLVM_TAPIR_GIT_HASH="1482504e234a65bffc8c54de8de9fc877822345d" +# LLVM_TRUNK settings +LLVM_TRUNK_BUILD_VERSION="1.0.0" +LLVM_TRUNK_BUILD_NUMBER=1 +LLVM_TRUNK_SOURCE_DIR=$(mktemp -d /tmp/d.XXXXXX) +trap 'rm -rf "${LLVM_TRUNK_SOURCE_DIR}"' EXIT -echo "Building llvm-tapir50" -echo "LLVM_TAPIR_BUILD_VERSION: $LLVM_TAPIR_BUILD_VERSION LLVM_TAPIR_BUILD_NUMBER: ${LLVM_TAPIR_BUILD_NUMBER}" +svn co http://llvm.org/svn/llvm-project/llvm/trunk ${LLVM_TRUNK_SOURCE_DIR} +svn co http://llvm.org/svn/llvm-project/cfe/trunk ${LLVM_TRUNK_SOURCE_DIR}/tools/clang -export LLVM_TAPIR_BUILD_VERSION=$LLVM_TAPIR_BUILD_VERSION -export LLVM_TAPIR_BUILD_NUMBER=$LLVM_TAPIR_BUILD_NUMBER -export LLVM_TAPIR_GIT_HASH=$LLVM_TAPIR_GIT_HASH +echo "Building llvm-trunk" +echo "LLVM_TRUNK_BUILD_VERSION: $LLVM_TRUNK_BUILD_VERSION LLVM_TRUNK_BUILD_NUMBER: ${LLVM_TRUNK_BUILD_NUMBER}" -time conda build -c $ANACONDA_USER --python 3.6 llvm-tapir50 +export LLVM_TRUNK_BUILD_VERSION=$LLVM_TRUNK_BUILD_VERSION +export LLVM_TRUNK_BUILD_NUMBER=$LLVM_TRUNK_BUILD_NUMBER +export LLVM_TRUNK_SOURCE_DIR=$LLVM_TRUNK_SOURCE_DIR -echo "llvm-tapir50 packaged Successfully" +time conda build -c $ANACONDA_USER --python 3.6 llvm-trunk + +echo "llvm-trunk packaged Successfully" ############################################################################## # Halide settings HALIDE_BUILD_VERSION="1.0.0" -HALIDE_BUILD_NUMBER=0 -HALIDE_GIT_HASH="35be67b3a3e4c4461f79949109ff35c54cf307de" +HALIDE_BUILD_NUMBER=1 +HALIDE_GIT_HASH="0b29cacf636852933892bbaa61dd2050c8dcaff2" echo "Packaging HALIDE ==> HALIDE_BUILD_VERSION: ${HALIDE_BUILD_VERSION} HALIDE_BUILD_NUMBER: ${HALIDE_BUILD_NUMBER}" @@ -75,4 +79,3 @@ echo "HALIDE packaged Successfully" #time conda build -c $ANACONDA_USER --python 3.6 tensor_comprehensions # #echo "Tensor Comprehensions packaged Successfully" -# diff --git a/conda_recipes/halide/meta.yaml b/conda_recipes/halide/meta.yaml index b937193b5..61ff43826 100644 --- a/conda_recipes/halide/meta.yaml +++ b/conda_recipes/halide/meta.yaml @@ -8,10 +8,10 @@ source: requirements: build: - - llvm-tapir50==1.0.0 + - llvm-trunk==1.0.0 - cmake run: - - llvm-tapir50==1.0.0 + - llvm-trunk==1.0.0 - cmake build: diff --git a/conda_recipes/llvm-trunk/build.sh b/conda_recipes/llvm-trunk/build.sh new file mode 100644 index 000000000..fcae8ff35 --- /dev/null +++ b/conda_recipes/llvm-trunk/build.sh @@ -0,0 +1,62 @@ +#!/usr/bin/env bash + +set -e + +# code gets checked out at below: +# $SOURCE_DIR ===> /conda-bld/llvm-trunk_/work +# +# build directory gets created at $SOURCE_DIR/build +# +# CONDA environment for debugging: +# cd /conda-bld/llvm-trunk_ +# source activate ./_h_env_...... # long placeholders +# +# $CONDA_PREFIX and $PREFIX are set to the same value i.e. the environment value +# +# Installation happens in the $PREFIX which is the environment and rpath is set +# to that +# +# For tests, a new environment _test_env_.... is created +# During the tests, you will see that the llvm-trunk package gets checked out +# NOTE: once the build finished, the packaging and unpackaging step takes long +# and might seem like it's stuck but it's not. + +CMAKE_VERSION=${CMAKE_VERSION:="`which cmake3 || which cmake`"} +VERBOSE=${VERBOSE:=0} + +echo "CONDA_PREFIX: ${CONDA_PREFIX}" +echo "PREFIX: ${PREFIX}" + +echo "Building llvm-trunk conda package" + +echo "Clean up existing build packages if any" +rm -rf llvm_build || true + +mkdir -p llvm_build +cd llvm_build + +echo "Configuring llvm-trunk" +VERBOSE=${VERBOSE} ${CMAKE_VERSION} \ + -DCMAKE_INSTALL_PREFIX=${PREFIX} \ + -DCOMPILER_RT_BUILD_CILKTOOLS=OFF \ + -DLLVM_ENABLE_CXX1Y=ON \ + -DLLVM_ENABLE_TERMINFO=OFF \ + -DLLVM_BUILD_TESTS=OFF \ + -DLLVM_ENABLE_ASSERTIONS=ON \ + -DCMAKE_BUILD_TYPE=Release \ + -DLLVM_BUILD_LLVM_DYLIB=ON \ + -DLLVM_TARGETS_TO_BUILD="X86;NVPTX" \ + -DLLVM_ENABLE_EH=ON \ + -DLLVM_ENABLE_OCAMLDOC=OFF \ + -DLLVM_INSTALL_OCAMLDOC_HTML_DIR=/tmp \ + -DLLVM_OCAML_INSTALL_PATH=/tmp \ + -DLLVM_ENABLE_RTTI=ON .. || exit 1 + +echo "Installing llvm-trunk" +VERBOSE=${VERBOSE} make -j"$(nproc)" -s || exit 1 + +VERBOSE=${VERBOSE} make install -j"$(nproc)" -s || exit 1 + +echo SUCCESS || echo FAILURE + +echo "Successfully built llvm-trunk conda package" diff --git a/conda_recipes/llvm-trunk/meta.yaml b/conda_recipes/llvm-trunk/meta.yaml new file mode 100644 index 000000000..4b37aebac --- /dev/null +++ b/conda_recipes/llvm-trunk/meta.yaml @@ -0,0 +1,33 @@ +package: + name: llvm-trunk + version: "{{ environ.get('LLVM_TRUNK_BUILD_VERSION') }}" + +source: + path: "{{ environ.get('LLVM_TRUNK_SOURCE_DIR') }}" + +requirements: + build: + - cmake + run: + - cmake + +build: + number: {{ environ.get('LLVM_TRUNK_BUILD_NUMBER') }} + skip: True # [win] + +test: + commands: + - $PREFIX/bin/llvm-config --libs + - $PREFIX/bin/llc -version + - test -f $PREFIX/include/llvm/Pass.h + - test -f $PREFIX/lib/libLLVMCore.a + + - $PREFIX/bin/clang --version + - $PREFIX/bin/clang++ --version + - $PREFIX/bin/clang-check --version + - test -f $PREFIX/include/clang/Lex/Lexer.h + - test -f $PREFIX/lib/libclangBasic.a + +extra: + recipe-maintainers: + - nicolasvasilache diff --git a/conda_recipes/tensor_comprehensions/meta.yaml b/conda_recipes/tensor_comprehensions/meta.yaml index 90db013a9..e69ba0905 100644 --- a/conda_recipes/tensor_comprehensions/meta.yaml +++ b/conda_recipes/tensor_comprehensions/meta.yaml @@ -8,7 +8,7 @@ source: requirements: build: - - llvm-tapir50==1.0.0 + - llvm-trunk==1.0.0 - halide==1.0.0 - caffe2==1.0.0 - pytorch==0.4.0 @@ -17,7 +17,7 @@ requirements: - setuptools run: - - llvm-tapir50==1.0.0 + - llvm-trunk==1.0.0 - halide==1.0.0 - caffe2==1.0.0 - pytorch==0.4.0 diff --git a/docs/source/installation.rst b/docs/source/installation.rst index bfe6f2a0b..8233f2d76 100644 --- a/docs/source/installation.rst +++ b/docs/source/installation.rst @@ -66,7 +66,7 @@ Create a new environment in which TC will be built and install core dependencies conda create -y --name tc_build python=3.6 conda activate tc_build conda install -y pyyaml mkl-include pytest - conda install -y -c nicolasvasilache llvm-tapir50 halide + conda install -y -c nicolasvasilache llvm-trunk halide Then install the PyTorch version that corresponds to your system binaries (e.g. cuda 9.0): diff --git a/tc/core/polyhedral/llvm_jit.cc b/tc/core/polyhedral/llvm_jit.cc index 98937b0d4..4f624ef88 100644 --- a/tc/core/polyhedral/llvm_jit.cc +++ b/tc/core/polyhedral/llvm_jit.cc @@ -72,6 +72,7 @@ std::string find_library_path(std::string library) { namespace tc { #if LLVM_VERSION_MAJOR <= 6 + Jit::Jit() : TM_(EngineBuilder().selectTarget()), DL_(TM_->createDataLayout()), @@ -103,11 +104,13 @@ void Jit::addModule(std::shared_ptr M) { auto res = compileLayer_.addModule(M, std::move(Resolver)); TC_CHECK(res) << "Failed to jit compile."; } + #else + Jit::Jit() - : SSP(), - ES(SSP), + : ES(), Resolver(llvm::orc::createLegacyLookupResolver( + ES, [this](const std::string& Name) -> JITSymbol { if (auto Sym = compileLayer_.findSymbol(Name, false)) return Sym; @@ -136,10 +139,6 @@ Jit::Jit() } } -// Note that this copy may cause tapir tests to fail -// However, this code will never use tapir code -// and once the LLVM API churn stops, will be modified -// to be properly compatable. void Jit::addModule(std::shared_ptr M) { M->setTargetTriple(TM_->getTargetTriple().str()); auto K = ES.allocateVModule(); diff --git a/tc/core/polyhedral/llvm_jit.h b/tc/core/polyhedral/llvm_jit.h index 2326dde55..75031d106 100644 --- a/tc/core/polyhedral/llvm_jit.h +++ b/tc/core/polyhedral/llvm_jit.h @@ -34,7 +34,6 @@ class Scop; class Jit { private: #if LLVM_VERSION_MAJOR > 6 - llvm::orc::SymbolStringPool SSP; llvm::orc::ExecutionSession ES; std::shared_ptr Resolver; #endif diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 5c5f62e35..5f18be9c6 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -63,19 +63,6 @@ target_link_libraries( tc_core_cpu tc_lang tc_aten pthread) -if (WITH_TAPIR) - add_executable(test_mapper_tapir test_mapper_tapir.cc) - add_test(test_mapper_tapir test_mapper_tapir) - target_link_libraries( - test_mapper_tapir - - ${GTEST_LIBRARIES} - ${ATEN_LIBRARIES} - -lLLVM - - tc_core_cpu tc_lang tc_aten pthread) -endif() - ################################################################################ # Lang tests ################################################################################ diff --git a/test/test_mapper_tapir.cc b/test/test_mapper_tapir.cc deleted file mode 100644 index 1fd405c71..000000000 --- a/test/test_mapper_tapir.cc +++ /dev/null @@ -1,93 +0,0 @@ -/** - * Copyright (c) 2017-present, Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include -#include - -#include -#include - -#include "tc/aten/aten.h" -#include "tc/core/cpu/cpu_tc_executor.h" -#include "tc/core/mapping_options.h" -#include "tc/core/polyhedral/codegen_llvm.h" -#include "tc/core/polyhedral/llvm_jit.h" -#include "tc/core/polyhedral/scop.h" -#include "tc/core/scope_guard.h" - -#include "test_harness_aten.h" - -using namespace std; - -using namespace tc; -using namespace tc::polyhedral; -using namespace tc::polyhedral::detail; - -TEST(TapirCodegen, BasicParallel) { - string tc = R"TC( -def fun(float(N, M) A, float(N, M) B) -> (C) { - C(n, m) = A(n, m) + B(n, m) -} -)TC"; - auto N = 40; - auto M = 24; - - auto ctx = isl::with_exceptions::globalIslCtx(); - auto scop = polyhedral::Scop::makeScop(ctx, tc); - scop = Scop::makeSpecializedScop(*scop, {{"N", N}, {"M", M}}); - SchedulerOptionsProto sop; - SchedulerOptionsView sov(sop); - scop = Scop::makeScheduled(*scop, sov); - Jit jit; - auto mod = jit.codegenScop("kernel_anon", *scop); - auto fn = mod->getFunction("kernel_anon"); - - std::set calledFunctions; - for (llvm::inst_iterator I = llvm::inst_begin(fn), E = llvm::inst_end(fn); - I != E; - ++I) { - if (llvm::CallInst* c = llvm::dyn_cast(&*I)) { - if (auto called = c->getCalledFunction()) { - calledFunctions.insert(called->getName()); - } - } - } - - ASSERT_NE(0u, calledFunctions.count("__cilkrts_get_tls_worker")); - ASSERT_NE(0u, calledFunctions.count("__cilkrts_bind_thread_1")); - ASSERT_NE(0u, calledFunctions.count("llvm.stacksave")); - ASSERT_NE(0u, calledFunctions.count("__cilkrts_sync")); - - auto fptr = - (void (*)(float*, float*, float*))jit.getSymbolAddress("kernel_anon"); - - at::Tensor A = at::CPU(at::kFloat).rand({N, M}); - at::Tensor B = at::CPU(at::kFloat).rand({N, M}); - at::Tensor C = at::CPU(at::kFloat).rand({N, M}); - at::Tensor Cc = A + B; - fptr(A.data(), B.data(), C.data()); - - checkRtol(Cc - C, {A, B}, N * M); -} - -int main(int argc, char** argv) { - ::testing::InitGoogleTest(&argc, argv); - ::gflags::ParseCommandLineFlags(&argc, &argv, true); - ::google::InitGoogleLogging(argv[0]); - initialize_llvm(); - return RUN_ALL_TESTS(); -} From 20d3d4f50ef1116f600dfc2170c2383491be94c0 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Tue, 10 Jul 2018 12:34:41 +0200 Subject: [PATCH 012/152] bump isl for replacing isl_space_{un}named_set_from_params --- isl_interface/include/isl/cpp.h | 52 +++++++++++------------ tc/core/halide2isl.cc | 8 ++-- tc/core/polyhedral/cuda/codegen.cc | 4 +- tc/core/polyhedral/cuda/mapped_scop.cc | 4 +- tc/core/polyhedral/memory_promotion.cc | 4 +- tc/core/polyhedral/schedule_transforms.cc | 4 +- tc/core/polyhedral/schedule_tree_elem.cc | 4 +- tc/core/polyhedral/schedule_utils.cc | 2 +- tc/core/polyhedral/unroll.cc | 3 +- tc/external/detail/islpp.h | 7 --- test/test_cuda_mapper_memory_promotion.cc | 2 +- third-party/islpp | 2 +- 12 files changed, 45 insertions(+), 51 deletions(-) diff --git a/isl_interface/include/isl/cpp.h b/isl_interface/include/isl/cpp.h index 5026694eb..21911021d 100644 --- a/isl_interface/include/isl/cpp.h +++ b/isl_interface/include/isl/cpp.h @@ -2963,7 +2963,9 @@ class space { inline isl::ctx get_ctx() const; inline std::string to_str() const; + inline isl::space add_named_tuple_id_ui(isl::id tuple_id, unsigned int dim) const; inline isl::space add_param(isl::id id) const; + inline isl::space add_unnamed_tuple_ui(unsigned int dim) const; inline isl::space align_params(isl::space dim2) const; inline bool can_curry() const; inline bool can_uncurry() const; @@ -2983,7 +2985,6 @@ class space { inline bool is_wrapping() const; inline isl::space map_from_domain_and_range(isl::space range) const; inline isl::space map_from_set() const; - inline isl::space named_set_from_params_id(isl::id tuple_id, unsigned int dim) const; inline isl::space params() const; inline isl::space product(isl::space right) const; inline isl::space range() const; @@ -2991,7 +2992,6 @@ class space { inline isl::space range_product(isl::space right) const; inline isl::space set_from_params() const; inline isl::space uncurry() const; - inline isl::space unnamed_set_from_params(unsigned int dim) const; inline isl::space unwrap() const; inline isl::space wrap() const; typedef isl_space* isl_ptr_t; @@ -17694,6 +17694,18 @@ isl::ctx space::get_ctx() const { return isl::ctx(isl_space_get_ctx(ptr)); } +isl::space space::add_named_tuple_id_ui(isl::id tuple_id, unsigned int dim) const +{ + if (!ptr || tuple_id.is_null()) + throw isl::exception::create(isl_error_invalid, + "NULL input", __FILE__, __LINE__); + options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + auto res = isl_space_add_named_tuple_id_ui(copy(), tuple_id.release(), dim); + if (!res) + throw exception::create_from_last_error(get_ctx()); + return manage(res); +} + isl::space space::add_param(isl::id id) const { if (!ptr || id.is_null()) @@ -17706,6 +17718,18 @@ isl::space space::add_param(isl::id id) const return manage(res); } +isl::space space::add_unnamed_tuple_ui(unsigned int dim) const +{ + if (!ptr) + throw isl::exception::create(isl_error_invalid, + "NULL input", __FILE__, __LINE__); + options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + auto res = isl_space_add_unnamed_tuple_ui(copy(), dim); + if (!res) + throw exception::create_from_last_error(get_ctx()); + return manage(res); +} + isl::space space::align_params(isl::space dim2) const { if (!ptr || dim2.is_null()) @@ -17934,18 +17958,6 @@ isl::space space::map_from_set() const return manage(res); } -isl::space space::named_set_from_params_id(isl::id tuple_id, unsigned int dim) const -{ - if (!ptr || tuple_id.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_space_named_set_from_params_id(copy(), tuple_id.release(), dim); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - isl::space space::params() const { if (!ptr) @@ -18030,18 +18042,6 @@ isl::space space::uncurry() const return manage(res); } -isl::space space::unnamed_set_from_params(unsigned int dim) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_space_unnamed_set_from_params(copy(), dim); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - isl::space space::unwrap() const { if (!ptr) diff --git a/tc/core/halide2isl.cc b/tc/core/halide2isl.cc index 31c670983..a77057812 100644 --- a/tc/core/halide2isl.cc +++ b/tc/core/halide2isl.cc @@ -259,7 +259,7 @@ isl::map extractAccess( isl::space paramSpace = domain.paramSpace; isl::id tensorID(paramSpace.get_ctx(), tensor); - auto tensorSpace = paramSpace.named_set_from_params_id(tensorID, args.size()); + auto tensorSpace = paramSpace.add_named_tuple_id_ui(tensorID, args.size()); // Start with a totally unconstrained set - every point in // the allocation could be accessed. @@ -290,7 +290,7 @@ isl::map extractAccess( isl::id tagID(domain.paramSpace.get_ctx(), tag); accesses->emplace(op, tagID); isl::space domainSpace = map.get_space().domain(); - isl::space tagSpace = domainSpace.params().named_set_from_params_id(tagID, 0); + isl::space tagSpace = domainSpace.params().add_named_tuple_id_ui(tagID, 0); domainSpace = domainSpace.product(tagSpace).unwrap(); map = map.preimage_domain(isl::multi_aff::domain_map(domainSpace)); @@ -367,7 +367,7 @@ static isl::multi_aff mapToOther( list = list.add(aff); } auto domainSpace = iterationDomain.tuple.get_space(); - auto space = domainSpace.params().named_set_from_params_id(id, list.size()); + auto space = domainSpace.params().add_named_tuple_id_ui(id, list.size()); space = domainSpace.product(space).unwrap(); return isl::multi_aff(space, list); } @@ -525,7 +525,7 @@ isl::schedule makeScheduleTreeHelper( isl::id id(set.get_ctx(), kStatementLabel + std::to_string(stmtIndex)); statements->emplace(id, op); auto tupleSpace = isl::space(set.get_ctx(), 0); - tupleSpace = tupleSpace.named_set_from_params_id(id, outer.size()); + tupleSpace = tupleSpace.add_named_tuple_id_ui(id, outer.size()); IterationDomain iterationDomain; iterationDomain.paramSpace = set.get_space(); iterationDomain.tuple = isl::multi_id(tupleSpace, outer); diff --git a/tc/core/polyhedral/cuda/codegen.cc b/tc/core/polyhedral/cuda/codegen.cc index dede76d5d..bcca9e852 100644 --- a/tc/core/polyhedral/cuda/codegen.cc +++ b/tc/core/polyhedral/cuda/codegen.cc @@ -554,8 +554,8 @@ isl::multi_aff makeMultiAffAccess( << "cannot build subscript aff for a scalar"; auto domainSpace = findDomainSpaceById(context); - auto tensorSpace = domainSpace.params().named_set_from_params_id( - tensorId, subscripts.size()); + auto tensorSpace = + domainSpace.params().add_named_tuple_id_ui(tensorId, subscripts.size()); auto space = domainSpace.map_from_domain_and_range(tensorSpace); auto ma = isl::multi_aff::zero(space); diff --git a/tc/core/polyhedral/cuda/mapped_scop.cc b/tc/core/polyhedral/cuda/mapped_scop.cc index 8fd3f3551..5884cff14 100644 --- a/tc/core/polyhedral/cuda/mapped_scop.cc +++ b/tc/core/polyhedral/cuda/mapped_scop.cc @@ -514,8 +514,8 @@ isl::multi_aff constructThreadToWarp( const Block& block) { auto space = isl::space(ctx, 0); auto id = isl::id(ctx, kBlock); - auto blockSpace = space.named_set_from_params_id(id, block.view.size()); - auto warpSpace = space.named_set_from_params_id(isl::id(ctx, kWarp), 1); + auto blockSpace = space.add_named_tuple_id_ui(id, block.view.size()); + auto warpSpace = space.add_named_tuple_id_ui(isl::id(ctx, kWarp), 1); auto aff = isl::aff::zero_on_domain(blockSpace); auto nThread = block.view.size(); diff --git a/tc/core/polyhedral/memory_promotion.cc b/tc/core/polyhedral/memory_promotion.cc index bc01dad86..f892396e0 100644 --- a/tc/core/polyhedral/memory_promotion.cc +++ b/tc/core/polyhedral/memory_promotion.cc @@ -411,7 +411,7 @@ isl::set tensorElementsSet(const Scop& scop, isl::id tensorId) { auto halideParameter = scop.findArgument(tensorId).parameter(); auto space = scop.domain().get_space().params(); auto nDim = halideParameter.dimensions(); - space = space.named_set_from_params_id(tensorId, nDim); + space = space.add_named_tuple_id_ui(tensorId, nDim); auto tensorElements = isl::set::universe(space); auto identity = isl::multi_aff::identity(space.range().map_from_set()); @@ -449,7 +449,7 @@ isl::multi_aff dropDummyTensorDimensions( } } - space = addRange(space, list.size()); + space = space.add_unnamed_tuple_ui(list.size()); return isl::multi_aff(space, list); } diff --git a/tc/core/polyhedral/schedule_transforms.cc b/tc/core/polyhedral/schedule_transforms.cc index 85f062860..bf37daf69 100644 --- a/tc/core/polyhedral/schedule_transforms.cc +++ b/tc/core/polyhedral/schedule_transforms.cc @@ -366,7 +366,7 @@ detail::ScheduleTree* insertEmptyExtensionAbove( isl::map labelExtension(ScheduleTree* root, ScheduleTree* tree, isl::id id) { auto prefix = prefixScheduleMupa(root, tree); auto scheduleSpace = prefix.get_space(); - auto space = scheduleSpace.params().named_set_from_params_id(id, 0); + auto space = scheduleSpace.params().add_named_tuple_id_ui(id, 0); auto extensionSpace = scheduleSpace.map_from_domain_and_range(space); return isl::map::universe(extensionSpace); } @@ -551,7 +551,7 @@ bool canOrder( } // Create an ordering schedule function first -> 0; second -> 1. auto ctx = dependences.get_ctx(); - auto space = isl::space(ctx, 0).unnamed_set_from_params(1); + auto space = isl::space(ctx, 0).add_unnamed_tuple_ui(1); auto zero = isl::multi_val::zero(space); auto one = zero.set_val(0, isl::val::one(ctx)); auto order = isl::multi_union_pw_aff(first, zero); diff --git a/tc/core/polyhedral/schedule_tree_elem.cc b/tc/core/polyhedral/schedule_tree_elem.cc index fa77f9452..29b4f0521 100644 --- a/tc/core/polyhedral/schedule_tree_elem.cc +++ b/tc/core/polyhedral/schedule_tree_elem.cc @@ -76,7 +76,7 @@ void ScheduleTreeBand::drop(size_t pos, size_t n) { auto list = mupa_.get_union_pw_aff_list(); auto space = mupa_.get_space().domain(); list = list.drop(pos, n); - space = addRange(space, list.size()); + space = space.add_unnamed_tuple_ui(list.size()); mupa_ = isl::multi_union_pw_aff(space, list); std::copy( @@ -92,7 +92,7 @@ void ScheduleTreeBand::drop(size_t pos, size_t n) { isl::multi_union_pw_aff ScheduleTreeBand::memberRange(size_t first, size_t n) const { auto list = mupa_.get_union_pw_aff_list(); - auto space = addRange(mupa_.get_space().domain(), n); + auto space = mupa_.get_space().domain().add_unnamed_tuple_ui(n); auto end = first + n; TC_CHECK_LE(end, nMember()); list = list.drop(end, nMember() - end); diff --git a/tc/core/polyhedral/schedule_utils.cc b/tc/core/polyhedral/schedule_utils.cc index 72b4256a2..9e3dffcdc 100644 --- a/tc/core/polyhedral/schedule_utils.cc +++ b/tc/core/polyhedral/schedule_utils.cc @@ -280,7 +280,7 @@ isl::multi_union_pw_aff extractDomainToIds( auto space = isl::space(tree->ctx_, 0); auto empty = isl::union_set::empty(space); - space = space.named_set_from_params_id(tupleId, ids.size()); + space = space.add_named_tuple_id_ui(tupleId, ids.size()); auto zero = isl::multi_val::zero(space); auto domainToIds = isl::multi_union_pw_aff(empty, zero); diff --git a/tc/core/polyhedral/unroll.cc b/tc/core/polyhedral/unroll.cc index c9cf0c895..a68264c0a 100644 --- a/tc/core/polyhedral/unroll.cc +++ b/tc/core/polyhedral/unroll.cc @@ -100,7 +100,8 @@ isl::val boundInstancesAndMarkUnroll( auto outerMap = prefix; if (i > 0) { list = list.drop(i, 1); - auto outer = isl::multi_union_pw_aff(addRange(space, list.size()), list); + auto outerSpace = space.add_unnamed_tuple_ui(list.size()); + auto outer = isl::multi_union_pw_aff(outerSpace, list); outerMap = outerMap.flat_range_product(isl::union_map::from(outer)); } bound = bound.mul(relativeRange(outerMap, member)); diff --git a/tc/external/detail/islpp.h b/tc/external/detail/islpp.h index 11f487a94..71dd2c793 100644 --- a/tc/external/detail/islpp.h +++ b/tc/external/detail/islpp.h @@ -281,13 +281,6 @@ inline bool operator!=(const isl::id& id1, const isl::id& id2) { // Helper functions /////////////////////////////////////////////////////////////////////////////// -// Given a set space, construct a map space with the input as domain and -// a range of the given size. -inline isl::space addRange(isl::space space, unsigned dim) { - auto range = space.params().unnamed_set_from_params(dim); - return space.map_from_domain_and_range(range); -} - // Given a space and a list of values, this returns the corresponding multi_val. template isl::multi_val makeMultiVal(isl::space s, const std::vector& vals) { diff --git a/test/test_cuda_mapper_memory_promotion.cc b/test/test_cuda_mapper_memory_promotion.cc index 2b1b08fa9..1b501d20a 100644 --- a/test/test_cuda_mapper_memory_promotion.cc +++ b/test/test_cuda_mapper_memory_promotion.cc @@ -273,7 +273,7 @@ def fun(float(N, M) A, float(N, M) B) -> (C) { EXPECT_EQ(groups.size(), 3u); - isl::space tileSpace = isl::space(ctx, 0).unnamed_set_from_params(2); + isl::space tileSpace = isl::space(ctx, 0).add_unnamed_tuple_ui(2); auto tileZero = isl::set::from(isl::multi_aff::zero(tileSpace)); // Must have groups for these tensors, in arbitrary order. diff --git a/third-party/islpp b/third-party/islpp index 2a9f1d393..8f8a21665 160000 --- a/third-party/islpp +++ b/third-party/islpp @@ -1 +1 @@ -Subproject commit 2a9f1d3939f950bc1a9e1d3f31433011c178e748 +Subproject commit 8f8a21665883c8aef657e61947829f47c1a43fc0 From 1618c89464fd5195b6e9a4eeb78793d639571cd4 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Thu, 12 Jul 2018 10:38:16 +0200 Subject: [PATCH 013/152] schedule_print.cc: drop dead code Some prehistoric representation of TC schedule trees used to needlessly keep track of an isl::ast_loop_type field. The printing function was left in by mistake when this field was removed. --- tc/core/polyhedral/schedule_print.cc | 20 -------------------- tc/core/polyhedral/schedule_tree_elem.h | 1 - 2 files changed, 21 deletions(-) diff --git a/tc/core/polyhedral/schedule_print.cc b/tc/core/polyhedral/schedule_print.cc index fd5aba15d..c1a4ac5da 100644 --- a/tc/core/polyhedral/schedule_print.cc +++ b/tc/core/polyhedral/schedule_print.cc @@ -87,26 +87,6 @@ ostream_joiner make_ostream_joiner(std::ostream& os, const char* delimiter) { } // namespace -std::ostream& operator<<(std::ostream& os, isl::ast_loop_type lt) { - WS w; - os << "type("; - if (lt == isl::ast_loop_type::error) { - os << "error"; - } else if (lt == isl::ast_loop_type::_default) { - os << "default"; - } else if (lt == isl::ast_loop_type::atomic) { - os << "atomic"; - } else if (lt == isl::ast_loop_type::unroll) { - os << "unroll"; - } else if (lt == isl::ast_loop_type::separate) { - os << "separate"; - } else { - LOG(FATAL) << "NYI: print type: " << static_cast(lt); - } - os << ")"; - return os; -} - std::ostream& operator<<(std::ostream& os, detail::ScheduleTreeType nt) { WS w; os << w.tab() << "type("; diff --git a/tc/core/polyhedral/schedule_tree_elem.h b/tc/core/polyhedral/schedule_tree_elem.h index 77507de50..069241938 100644 --- a/tc/core/polyhedral/schedule_tree_elem.h +++ b/tc/core/polyhedral/schedule_tree_elem.h @@ -246,7 +246,6 @@ bool elemEquals( const ScheduleTree* e2, detail::ScheduleTreeType type); -std::ostream& operator<<(std::ostream& os, isl::ast_loop_type lt); std::ostream& operator<<(std::ostream& os, detail::ScheduleTreeType nt); std::ostream& operator<<( std::ostream& os, From d1e47ff5871b8ff77ce62b6b23ccd710bd7160d7 Mon Sep 17 00:00:00 2001 From: Oleksandr Zinenko Date: Fri, 22 Jun 2018 15:51:30 +0200 Subject: [PATCH 014/152] promoteToSharedGreedy: do not intersect schedule with active points A partial schedule produced by a call to partialSchedule already has its domain intersected with the parent filter nodes. There is no need to separately compute the intersection of parent filters using activeDomainPoints to include it in the schedule. Drop the unnecessary intersection and remove the variable that became unused. --- tc/core/polyhedral/cuda/memory_promotion_heuristic.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc b/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc index b7b85fb95..e60eec7c9 100644 --- a/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc +++ b/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc @@ -525,11 +525,10 @@ void promoteToSharedGreedy( // both. size_t remainingMemory = maxMemory; for (auto bandNode : bands) { - auto activePoints = activeDomainPoints(root, bandNode); auto partialSched = partialSchedule(root, bandNode); - auto groupMap = TensorReferenceGroup::accessedWithin( - partialSched.intersect_domain(activePoints), scop.body); + auto groupMap = + TensorReferenceGroup::accessedWithin(partialSched, scop.body); // Pure affine schedule without (mapping) filters. auto partialSchedMupa = partialScheduleMupa(root, bandNode); From 5f384ce7897673fa5604bf821f9f84456b269d10 Mon Sep 17 00:00:00 2001 From: Oleksandr Zinenko Date: Fri, 22 Jun 2018 16:07:10 +0200 Subject: [PATCH 015/152] promoteToSharedGreedy: extract promoteToSharedBelow This function promotes to shared memory below the given node (scope). For now, it is only expected to work when called with block-mapped node as scope. It will be extended to work on any node above thread-mapping in upcoming commits. --- .../cuda/memory_promotion_heuristic.cc | 175 ++++++++++-------- 1 file changed, 95 insertions(+), 80 deletions(-) diff --git a/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc b/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc index e60eec7c9..d98b64fda 100644 --- a/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc +++ b/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc @@ -483,6 +483,100 @@ std::vector bandsSplitAfterDepth( return functional::Map(splitAtDepth, bands); } +/* + * Promote to shared memory in "scop" below the node "bandNode". Use at most + * "remainingMemory" bytes, and update the variable to reflect the amount of + * available shared memory remaining after promotion. "fullSched" is the union + * of schedules at leaves of the schedule tree, expected to be computed by + * "fullSchedule". + */ +void promoteToSharedBelow( + Scop& scop, + detail::ScheduleTree* bandNode, + isl::union_map fullSched, + size_t& remainingMemory) { + auto root = scop.scheduleRoot(); + auto partialSched = partialSchedule(root, bandNode); + + auto groupMap = TensorReferenceGroup::accessedWithin( + partialSched, scop.reads, scop.writes); + // Pure affine schedule without (mapping) filters. + auto partialSchedMupa = partialScheduleMupa(root, bandNode); + + // Prepare groups for sorting, to have specified order necessary for + // reproducibility and tests. + using TensorGroupList = std::pair; + std::vector groupLists( + std::make_move_iterator(groupMap.begin()), + std::make_move_iterator(groupMap.end())); + + // Computes the total number of references in all groups. + auto refsCount = [](const TensorGroupsInfo& info) { + size_t refs = 0; + for (auto const& group : info) { + refs += group->referenceIds().size(); + } + return refs; + }; + + // Sort by the total number of references, then by name. Because names are + // guarenteed to be unique, the order is total. + std::sort( + groupLists.begin(), + groupLists.end(), + [refsCount](const TensorGroupList& l1, const TensorGroupList& l2) { + auto r1 = refsCount(l1.second); + auto r2 = refsCount(l2.second); + return r1 == r2 ? l1.first.get_name() < l2.first.get_name() : r1 < r2; + }); + for (auto& tensorGroups : groupLists) { + auto tensorId = tensorGroups.first; + // Sort the reference groups to prioritize groups with more references as + // they are more likely to benefit from promotion. + std::sort( + tensorGroups.second.begin(), + tensorGroups.second.end(), + [refsCount]( + const std::unique_ptr& group1, + const std::unique_ptr& group2) { + return group1->referenceIds().size() > group2->referenceIds().size(); + }); + + for (auto& group : tensorGroups.second) { + auto sizes = group->approximationSizes(); + if (sizes.size() == 0) { + throw promotion::PromotionLogicError("cannot promote a scalar"); + } + if (sizes.back() % 2 == 0) { + sizes.back() += 1; + } + auto nApproximationElements = std::accumulate( + sizes.begin(), sizes.end(), 1, std::multiplies()); + size_t memoryRequirement = + nApproximationElements * scop.findArgument(tensorId).type().bytes(); + if (memoryRequirement > remainingMemory) { + continue; + } + // Do not promote if the group features no reuse and is accessed in a + // coalesced way. + if (!hasReuseWithin(*group, partialSchedMupa) && + !promotionImprovesCoalescing(root, bandNode, *group, fullSched)) { + continue; + } + + scop.promoteGroup( + Scop::PromotedDecl::Kind::SharedMem, + tensorId, + std::move(group), + bandNode, + partialSched, + true); + remainingMemory -= memoryRequirement; + } + } + scop.insertSyncsAroundCopies(bandNode); +} + /* * For every place in the schedule tree where schedule depth (i.e., the number * of preceding band members) is "depth", promote tensor reference groups to @@ -525,86 +619,7 @@ void promoteToSharedGreedy( // both. size_t remainingMemory = maxMemory; for (auto bandNode : bands) { - auto partialSched = partialSchedule(root, bandNode); - - auto groupMap = - TensorReferenceGroup::accessedWithin(partialSched, scop.body); - // Pure affine schedule without (mapping) filters. - auto partialSchedMupa = partialScheduleMupa(root, bandNode); - - // Prepare groups for sorting, to have specified order necessary for - // reproducibility and tests. - using TensorGroupList = std::pair; - std::vector groupLists( - std::make_move_iterator(groupMap.begin()), - std::make_move_iterator(groupMap.end())); - - // Computes the total number of references in all groups. - auto refsCount = [](const TensorGroupsInfo& info) { - size_t refs = 0; - for (auto const& group : info) { - refs += group->referenceIds().size(); - } - return refs; - }; - - // Sort by the total number of references, then by name. Because names are - // guarenteed to be unique, the order is total. - std::sort( - groupLists.begin(), - groupLists.end(), - [refsCount](const TensorGroupList& l1, const TensorGroupList& l2) { - auto r1 = refsCount(l1.second); - auto r2 = refsCount(l2.second); - return r1 == r2 ? l1.first.get_name() < l2.first.get_name() : r1 < r2; - }); - for (auto& tensorGroups : groupLists) { - auto tensorId = tensorGroups.first; - // Sort the reference groups to prioritize groups with more references as - // they are more likely to benefit from promotion. - std::sort( - tensorGroups.second.begin(), - tensorGroups.second.end(), - [refsCount]( - const std::unique_ptr& group1, - const std::unique_ptr& group2) { - return group1->referenceIds().size() > - group2->referenceIds().size(); - }); - - for (auto& group : tensorGroups.second) { - auto sizes = group->approximationSizes(); - if (sizes.size() == 0) { - throw promotion::PromotionLogicError("cannot promote a scalar"); - } - if (sizes.back() % 2 == 0) { - sizes.back() += 1; - } - auto nApproximationElements = std::accumulate( - sizes.begin(), sizes.end(), 1, std::multiplies()); - size_t memoryRequirement = - nApproximationElements * scop.findArgument(tensorId).type().bytes(); - if (memoryRequirement > remainingMemory) { - continue; - } - // Do not promote if the group features no reuse and is accessed in a - // coalesced way. - if (!hasReuseWithin(*group, partialSchedMupa) && - !promotionImprovesCoalescing(root, bandNode, *group, fullSched)) { - continue; - } - - scop.promoteGroup( - Scop::PromotedDecl::Kind::SharedMem, - tensorId, - std::move(group), - bandNode, - partialSched, - true); - remainingMemory -= memoryRequirement; - } - } - scop.insertSyncsAroundCopies(bandNode); + promoteToSharedBelow(scop, bandNode, fullSched, remainingMemory); } } From a2aecd3eadb38ade7a17016945a0c092cfd9a90f Mon Sep 17 00:00:00 2001 From: Oleksandr Zinenko Date: Fri, 22 Jun 2018 16:48:59 +0200 Subject: [PATCH 016/152] promotionImprovesCoalescing: use partial schedule instead of full The check whether the promotion to shared memory improves coalescing is performed by looking at the schedule dimension that is mapped to CUDA thread x. The existing implementation relies on a so called "full schedule" that contains all schedule dimensions. In practice, the partial schedule until the dimension mapped to thread x is sufficient. Compute thie partial schedule inside of promotionImprovesCoalescing instead of precopmuting the "full schedule" externally. --- .../cuda/memory_promotion_heuristic.cc | 20 ++++++------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc b/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc index d98b64fda..1fa0a44e0 100644 --- a/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc +++ b/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc @@ -264,8 +264,7 @@ const detail::ScheduleTree* findThreadMappingAncestor( bool promotionImprovesCoalescing( const detail::ScheduleTree* root, const detail::ScheduleTree* node, - const TensorReferenceGroup& group, - isl::union_map schedule) { + const TensorReferenceGroup& group) { auto originalAccesses = group.originalAccesses(); auto tensorDim = group.approximation.dim(); @@ -279,6 +278,7 @@ bool promotionImprovesCoalescing( auto depth = marker->scheduleDepth(root); auto activePoints = activeDomainPoints(root, mapping); auto localAccesses = originalAccesses.intersect_domain(activePoints); + auto schedule = prefixSchedule(root, marker); auto scheduledAccesses = localAccesses.apply_domain(schedule); for (auto access : isl::UnionAsVector(scheduledAccesses)) { auto scheduleSpace = access.get_space().domain(); @@ -486,14 +486,11 @@ std::vector bandsSplitAfterDepth( /* * Promote to shared memory in "scop" below the node "bandNode". Use at most * "remainingMemory" bytes, and update the variable to reflect the amount of - * available shared memory remaining after promotion. "fullSched" is the union - * of schedules at leaves of the schedule tree, expected to be computed by - * "fullSchedule". + * available shared memory remaining after promotion. */ void promoteToSharedBelow( Scop& scop, detail::ScheduleTree* bandNode, - isl::union_map fullSched, size_t& remainingMemory) { auto root = scop.scheduleRoot(); auto partialSched = partialSchedule(root, bandNode); @@ -560,7 +557,7 @@ void promoteToSharedBelow( // Do not promote if the group features no reuse and is accessed in a // coalesced way. if (!hasReuseWithin(*group, partialSchedMupa) && - !promotionImprovesCoalescing(root, bandNode, *group, fullSched)) { + !promotionImprovesCoalescing(root, bandNode, *group)) { continue; } @@ -607,19 +604,14 @@ void promoteToSharedGreedy( auto bands = bandsContainingScheduleDepth(root, depth); bands = bandsSplitAfterDepth(bands, root, depth); - // 2. Compute full schedule without mapping filters. The filters would make - // it impossible to test for coalescing by incrementing a member of a band as - // only the values divisible by grid or block size pass through the filter. - auto fullSched = fullSchedule(root); - - // 3. For each band that ends at "depth", take decisions about promotion + // 2. For each band that ends at "depth", take decisions about promotion // immediately below it in the tree. In particular, promote if the // approximated footprint fits into the remaining memory, and the reference // group either features reuse or is accessed in a non-coalesced way, or // both. size_t remainingMemory = maxMemory; for (auto bandNode : bands) { - promoteToSharedBelow(scop, bandNode, fullSched, remainingMemory); + promoteToSharedBelow(scop, bandNode, remainingMemory); } } From e3c26cbeeb2acda085a0d1a20f0d2d6e92ecd603 Mon Sep 17 00:00:00 2001 From: Oleksandr Zinenko Date: Fri, 22 Jun 2018 16:49:24 +0200 Subject: [PATCH 017/152] memory_promotion_heuristic.cc: drop fullSchedule The last use of this function was removed in the previous commit. The function itself is dangerous because of its misleading name: it ignores sequence and set nodes making the caller believe statement instances separated by the sequence/set are scheduled to the same logical date. It was never intended to be used outside the memory promotion heuristic. Drop it. --- .../cuda/memory_promotion_heuristic.cc | 54 ------------------- 1 file changed, 54 deletions(-) diff --git a/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc b/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc index 1fa0a44e0..2e4290ba7 100644 --- a/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc +++ b/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc @@ -132,60 +132,6 @@ std::vector collectBranchMarkers(T root, T node) { return findThreadSpecificMarkers(node); } -/* - * Transform schedule bands into a union_map. - * Takes all partial schedules at leaves as MUPAs (without accounting for - * intermediate non-band nodes), intersects - * their domain with the filters between the root and the - * current leaves and transforms them into union maps. - * Mapping filters are ignored. - */ -isl::union_map fullSchedule(const detail::ScheduleTree* root) { - using namespace tc::polyhedral::detail; - - if (!root->as()) { - throw promotion::PromotionLogicError("expected root to be a domain node"); - } - - std::function isLeaf = - [](const ScheduleTree* tree) { return tree->numChildren() == 0; }; - - // Find all innermost nodes. - auto leaves = functional::Filter(isLeaf, ScheduleTree::collect(root)); - - // Take a union of partial schedules of the innermost nodes. Because they - // are innermost, the partial schedule can no longer be affected by deeper - // nodes and hence is full. - auto schedule = isl::union_map::empty( - root->as()->domain_.get_space()); - for (auto node : leaves) { - auto domain = root->as()->domain_; - auto prefixMupa = prefixScheduleMupa(root, node); - if (auto band = node->as()) { - prefixMupa = prefixMupa.flat_range_product(band->mupa_); - } - - auto pathToRoot = node->ancestors(root); - pathToRoot.push_back(node); - for (auto n : pathToRoot) { - if (auto filterNode = n->as()) { - domain = domain.intersect(filterNode->filter_); - } - } - - prefixMupa = prefixMupa.intersect_domain(domain); - - schedule = schedule.unite(isl::union_map::from(prefixMupa)); - if (!schedule.is_single_valued()) { - std::stringstream ss; - ss << "schedules must be single-valued " << schedule << std::endl - << *root; - throw promotion::PromotionLogicError(ss.str()); - } - } - return schedule; -} - /* * Check if a reference group features reuse within the "outer" schedule. * In particular, check that for some given point in the outer schedule and From 7c89338a8628df2ad72ae0c100194a599c3570d6 Mon Sep 17 00:00:00 2001 From: Oleksandr Zinenko Date: Fri, 22 Jun 2018 17:28:58 +0200 Subject: [PATCH 018/152] promoteToSharedBelow: take into account the mapping to blocks Currenly, promotion to shared memory is only performed below the loops mapped to blocks. Thus, tensor reference groups implictly account for blocks. The scope of mapping in the tree will be changed in upcoming commits. Explicitly include block mapping into the partial schedule within which the tensor reference groups are computed. --- tc/core/polyhedral/cuda/memory_promotion_heuristic.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc b/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc index 2e4290ba7..fcbb71577 100644 --- a/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc +++ b/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc @@ -440,9 +440,10 @@ void promoteToSharedBelow( size_t& remainingMemory) { auto root = scop.scheduleRoot(); auto partialSched = partialSchedule(root, bandNode); + auto mapping = collectMappingsTo(scop); auto groupMap = TensorReferenceGroup::accessedWithin( - partialSched, scop.reads, scop.writes); + partialSched.intersect_domain(mapping), scop.reads, scop.writes); // Pure affine schedule without (mapping) filters. auto partialSchedMupa = partialScheduleMupa(root, bandNode); From d9aef27c078ec8e742a41460c9da3443b8680a18 Mon Sep 17 00:00:00 2001 From: Oleksandr Zinenko Date: Fri, 22 Jun 2018 17:41:50 +0200 Subject: [PATCH 019/152] promoteToSharedBelow: rename argument from bandNode to node The function no longer requires the node to be a band. --- .../cuda/memory_promotion_heuristic.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc b/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc index fcbb71577..d4099a3b5 100644 --- a/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc +++ b/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc @@ -430,22 +430,22 @@ std::vector bandsSplitAfterDepth( } /* - * Promote to shared memory in "scop" below the node "bandNode". Use at most + * Promote to shared memory in "scop" below "node". Use at most * "remainingMemory" bytes, and update the variable to reflect the amount of * available shared memory remaining after promotion. */ void promoteToSharedBelow( Scop& scop, - detail::ScheduleTree* bandNode, + detail::ScheduleTree* node, size_t& remainingMemory) { auto root = scop.scheduleRoot(); - auto partialSched = partialSchedule(root, bandNode); + auto partialSched = partialSchedule(root, node); auto mapping = collectMappingsTo(scop); auto groupMap = TensorReferenceGroup::accessedWithin( - partialSched.intersect_domain(mapping), scop.reads, scop.writes); + partialSched.intersect_domain(mapping), scop.body); // Pure affine schedule without (mapping) filters. - auto partialSchedMupa = partialScheduleMupa(root, bandNode); + auto partialSchedMupa = partialScheduleMupa(root, node); // Prepare groups for sorting, to have specified order necessary for // reproducibility and tests. @@ -504,7 +504,7 @@ void promoteToSharedBelow( // Do not promote if the group features no reuse and is accessed in a // coalesced way. if (!hasReuseWithin(*group, partialSchedMupa) && - !promotionImprovesCoalescing(root, bandNode, *group)) { + !promotionImprovesCoalescing(root, node, *group)) { continue; } @@ -512,13 +512,13 @@ void promoteToSharedBelow( Scop::PromotedDecl::Kind::SharedMem, tensorId, std::move(group), - bandNode, + node, partialSched, true); remainingMemory -= memoryRequirement; } } - scop.insertSyncsAroundCopies(bandNode); + scop.insertSyncsAroundCopies(node); } /* From 56a034374dfa42681bd10c5b66894bd6fe2848ac Mon Sep 17 00:00:00 2001 From: Oleksandr Zinenko Date: Wed, 4 Jul 2018 13:39:29 +0200 Subject: [PATCH 020/152] promoteToSharedBelow: disallow promotion below sequence/set Schedule tree invariants prevent us from inserting an extension node, necessary to copy data during promotion, as a child of a sequence or a set node. --- tc/core/polyhedral/cuda/memory_promotion_heuristic.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc b/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc index d4099a3b5..9fdc78d94 100644 --- a/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc +++ b/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc @@ -439,6 +439,14 @@ void promoteToSharedBelow( detail::ScheduleTree* node, size_t& remainingMemory) { auto root = scop.scheduleRoot(); + + // Children of a sequence/set band must be filters, but promotion would + // insert an extension node. + if (node->as() || + node->as()) { + throw promotion::IncorrectScope("cannot promote below a sequence/set node"); + } + auto partialSched = partialSchedule(root, node); auto mapping = collectMappingsTo(scop); From 02e67819e86b207cf1e496648e26e9ee0a2fab34 Mon Sep 17 00:00:00 2001 From: Oleksandr Zinenko Date: Wed, 4 Jul 2018 13:43:43 +0200 Subject: [PATCH 021/152] promoteToSharedBelow: disallow promotion anywhere below thread mapping Shared memory is accessible from all threads. If promotion is requested below the thread mapping, the scoped tensor reference groups are specific to threads, guaranteeing no reuse between different threads. It does not make sense to use shared memory in such cases. Furthermore, if one attempted to use shared memory below thread mapping, e.g., to hide global memory latency, one would have to account for the pre-existing thread mapping when emitting shared<->global memory copies. --- tc/core/polyhedral/cuda/memory_promotion_heuristic.cc | 11 +++++++++++ test/test_cuda_mapper_memory_promotion.cc | 6 ++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc b/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc index 9fdc78d94..d9889ccda 100644 --- a/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc +++ b/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc @@ -440,6 +440,17 @@ void promoteToSharedBelow( size_t& remainingMemory) { auto root = scop.scheduleRoot(); + // Promotion to shared below threads does not make sense because the computed + // groups would be specific to threads thus not benefiting from coalescing or + // inter-thread communication through shared memory (use registers instead). + auto ancestors = node->ancestors(root); + ancestors.push_back(node); + for (auto ancestor : ancestors) { + if (isMappingTo(ancestor)) { + throw promotion::IncorrectScope( + "shared memory promotion below thread mapping"); + } + } // Children of a sequence/set band must be filters, but promotion would // insert an extension node. if (node->as() || diff --git a/test/test_cuda_mapper_memory_promotion.cc b/test/test_cuda_mapper_memory_promotion.cc index 1b501d20a..a0c20b53b 100644 --- a/test/test_cuda_mapper_memory_promotion.cc +++ b/test/test_cuda_mapper_memory_promotion.cc @@ -439,12 +439,10 @@ TEST_F(MapperMemoryPromotionRAW, fitAtOuterDepths) { TEST_F(MapperMemoryPromotionRAW, throwIfCopiesBelowThreads) { EXPECT_THROW( - makeWithSharedGreedy(42, 40, 64, 64, 3, 8192), - promotion::PromotionBelowThreadsException); + makeWithSharedGreedy(42, 40, 64, 64, 3, 8192), promotion::IncorrectScope); EXPECT_THROW( - makeWithSharedGreedy(42, 40, 64, 64, 4, 8192), - promotion::PromotionBelowThreadsException); + makeWithSharedGreedy(42, 40, 64, 64, 4, 8192), promotion::IncorrectScope); } class MatMulBias : public TestMapper { From fe8f5199765bfc9a39f0b2cb4d52014a349d6580 Mon Sep 17 00:00:00 2001 From: Oleksandr Zinenko Date: Fri, 22 Jun 2018 17:45:05 +0200 Subject: [PATCH 022/152] promoteToSharedGreedy: drop unused argument --- tc/core/polyhedral/cuda/memory_promotion_heuristic.cc | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc b/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc index d9889ccda..425182dd4 100644 --- a/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc +++ b/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc @@ -551,11 +551,7 @@ void promoteToSharedBelow( * Only promote if the tensor elements referenced by the group are reused or * accessed in a non-coalesced way. */ -void promoteToSharedGreedy( - Scop& scop, - const Block& block, - size_t depth, - size_t maxMemory) { +void promoteToSharedGreedy(Scop& scop, size_t depth, size_t maxMemory) { using namespace tc::polyhedral::detail; if (depth == 0) { @@ -597,8 +593,7 @@ void promoteGreedilyAtDepth( size_t sharedMemorySize, bool unrollCopies) { // 1. Promote using heuristic. - promoteToSharedGreedy( - mscop.scop(), mscop.numThreads, depth, sharedMemorySize); + promoteToSharedGreedy(mscop.scop(), depth, sharedMemorySize); // 2. Map copies to shared, state by copy mapCopiesToThreads(mscop, unrollCopies); From 5b448f084edd9f1b63368bc9b15470c499a5b0b0 Mon Sep 17 00:00:00 2001 From: Oleksandr Zinenko Date: Thu, 28 Jun 2018 13:25:08 +0200 Subject: [PATCH 023/152] merge promoteToSharedGreedy and promoteGreedilyAtDepth into one function Arguably, it was a mistake to have separate functions in the first place. This led to situations in tests where the copies between global and shared memory were not mapped to threads. Merge promoteToSharedGreedy and promoteGreedilyAtDepth into a single function, promoteToSharedAtDepth. The name is chosen for consistency with promoteToRegistersAtDepth. --- tc/core/polyhedral/cuda/mapped_scop.cc | 2 +- .../cuda/memory_promotion_heuristic.cc | 41 +++++++++---------- .../cuda/memory_promotion_heuristic.h | 5 +-- test/test_cuda_mapper_memory_promotion.cc | 2 +- 4 files changed, 23 insertions(+), 27 deletions(-) diff --git a/tc/core/polyhedral/cuda/mapped_scop.cc b/tc/core/polyhedral/cuda/mapped_scop.cc index 5884cff14..143b179f2 100644 --- a/tc/core/polyhedral/cuda/mapped_scop.cc +++ b/tc/core/polyhedral/cuda/mapped_scop.cc @@ -1079,7 +1079,7 @@ std::unique_ptr MappedScop::makeWithOuterBlockInnerThreadStrategy( !generic.proto.has_unroll()) << "requested to unroll copies to shared memory without providing the unroll size"; - promoteGreedilyAtDepth( + promoteToSharedAtDepth( *mappedScop, std::min(band->nOuterCoincident(), mappedScop->numBlocks.view.size()), sharedMemorySize, diff --git a/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc b/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc index 425182dd4..c01a13c93 100644 --- a/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc +++ b/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc @@ -540,6 +540,16 @@ void promoteToSharedBelow( scop.insertSyncsAroundCopies(node); } +/* + * Check if "tree" is a band node mapped to threads. In particular, check that + * "tree" is a band and a thread-specific node appears as its only child. + */ +inline bool isThreadMappedBand(const detail::ScheduleTree* tree) { + return matchOne(band(threadSpecific(any())), tree) || + matchOne(band(threadSpecific()), tree); +} +} // namespace + /* * For every place in the schedule tree where schedule depth (i.e., the number * of preceding band members) is "depth", promote tensor reference groups to @@ -550,14 +560,22 @@ void promoteToSharedBelow( * * Only promote if the tensor elements referenced by the group are reused or * accessed in a non-coalesced way. + * + * If "unrollCopies" is set, use the unroll factor from "mscop" to unroll the + * loops that copy values from global to shared memory and back. */ -void promoteToSharedGreedy(Scop& scop, size_t depth, size_t maxMemory) { +void promoteToSharedAtDepth( + MappedScop& mscop, + size_t depth, + size_t maxMemory, + bool unrollCopies) { using namespace tc::polyhedral::detail; if (depth == 0) { throw promotion::PromotionNYI("promotion before any band"); } + auto& scop = mscop.scop(); auto root = scop.scheduleRoot(); // 1. Collect all bands with a member located at the given depth in the @@ -575,27 +593,8 @@ void promoteToSharedGreedy(Scop& scop, size_t depth, size_t maxMemory) { for (auto bandNode : bands) { promoteToSharedBelow(scop, bandNode, remainingMemory); } -} - -/* - * Check if "tree" is a band node mapped to threads. In particular, check that - * "tree" is a band and a thread-specific node appears as its only child. - */ -inline bool isThreadMappedBand(const detail::ScheduleTree* tree) { - return matchOne(band(threadSpecific(any())), tree) || - matchOne(band(threadSpecific()), tree); -} -} // namespace - -void promoteGreedilyAtDepth( - MappedScop& mscop, - size_t depth, - size_t sharedMemorySize, - bool unrollCopies) { - // 1. Promote using heuristic. - promoteToSharedGreedy(mscop.scop(), depth, sharedMemorySize); - // 2. Map copies to shared, state by copy + // 3. Map copies to shared. mapCopiesToThreads(mscop, unrollCopies); } diff --git a/tc/core/polyhedral/cuda/memory_promotion_heuristic.h b/tc/core/polyhedral/cuda/memory_promotion_heuristic.h index 2c2ca895d..a16480002 100644 --- a/tc/core/polyhedral/cuda/memory_promotion_heuristic.h +++ b/tc/core/polyhedral/cuda/memory_promotion_heuristic.h @@ -33,10 +33,7 @@ class ScheduleTree; // promote to shared memory at "depth" until "sharedMemorySize" is used. // Map copies between global and shared memory to threads and unroll those // copies if "unrollCopies" is set, using the options in "mscop". -// "threadIdxXScheduleDepthState" contains the schedule depth at which the -// computation was mapped to thread x and is used to check whether the global -// memory is accessed in a coalesced way. -void promoteGreedilyAtDepth( +void promoteToSharedAtDepth( MappedScop& scop, std::size_t depth, std::size_t sharedMemorySize, diff --git a/test/test_cuda_mapper_memory_promotion.cc b/test/test_cuda_mapper_memory_promotion.cc index a0c20b53b..6397667c1 100644 --- a/test/test_cuda_mapper_memory_promotion.cc +++ b/test/test_cuda_mapper_memory_promotion.cc @@ -392,7 +392,7 @@ def fun(float(N, M) A) -> (B, C) { size_t maxSharedMemory) { auto mscop = prepareScop( tc, {{"N", problemSize1}, {"M", problemSize2}}, {tileSize1, tileSize2}); - promoteGreedilyAtDepth(*mscop, depth, maxSharedMemory, false); + promoteToSharedAtDepth(*mscop, depth, maxSharedMemory, false); return mscop; } }; From b0b73cb480ca8ac279d7601133ba242cb9032fd2 Mon Sep 17 00:00:00 2001 From: Oleksandr Zinenko Date: Thu, 28 Jun 2018 14:22:38 +0200 Subject: [PATCH 024/152] promoteToSharedBelow: extract out isInThreadMappedScope This function will be reused in an upcoming commit. --- .../cuda/memory_promotion_heuristic.cc | 26 ++++++++++++++----- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc b/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc index c01a13c93..2158495d0 100644 --- a/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc +++ b/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc @@ -429,6 +429,22 @@ std::vector bandsSplitAfterDepth( return functional::Map(splitAtDepth, bands); } +/* + * Check if "node" or any of its ancestors until "root" are thread mappings. + */ +bool isInThreadMappedScope( + const detail::ScheduleTree* root, + const detail::ScheduleTree* node) { + auto ancestors = node->ancestors(root); + ancestors.push_back(node); + for (auto ancestor : ancestors) { + if (isMappingTo(ancestor)) { + return true; + } + } + return false; +} + /* * Promote to shared memory in "scop" below "node". Use at most * "remainingMemory" bytes, and update the variable to reflect the amount of @@ -443,13 +459,9 @@ void promoteToSharedBelow( // Promotion to shared below threads does not make sense because the computed // groups would be specific to threads thus not benefiting from coalescing or // inter-thread communication through shared memory (use registers instead). - auto ancestors = node->ancestors(root); - ancestors.push_back(node); - for (auto ancestor : ancestors) { - if (isMappingTo(ancestor)) { - throw promotion::IncorrectScope( - "shared memory promotion below thread mapping"); - } + if (isInThreadMappedScope(root, node)) { + throw promotion::IncorrectScope( + "shared memory promotion below thread mapping"); } // Children of a sequence/set band must be filters, but promotion would // insert an extension node. From 900cb426aea194828e56c69df5b80cb3d2fb952b Mon Sep 17 00:00:00 2001 From: Oleksandr Zinenko Date: Thu, 28 Jun 2018 14:27:46 +0200 Subject: [PATCH 025/152] promoteToSharedAtDepth: ignore scopes below thread mapping Band nodes at the given depth may be above or below the thread mapping. In the latter case, promoteToSharedBelow would throw an IncorrectScope exception because promotion to shared below a thread mapping node is forbidden and is generally nonsensical. In a branching tree, there is no guarantee that nodes at the given schedule depth are all above or below the thread mapping. Simply ignore the subtrees that have a thread-mapping ancestor node when performing shared memory promotion at depth. Leaving promoteToSharedBelow as is (throwing an exception) because it may end up being reused by different callers. Arguably, promoteToSharedAtDepth is a higher-level API and should not throw if only one subtree is problematic. --- .../polyhedral/cuda/memory_promotion_heuristic.cc | 12 ++++++++++-- test/test_cuda_mapper_memory_promotion.cc | 14 ++++++++------ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc b/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc index 2158495d0..124fd7466 100644 --- a/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc +++ b/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc @@ -565,7 +565,8 @@ inline bool isThreadMappedBand(const detail::ScheduleTree* tree) { /* * For every place in the schedule tree where schedule depth (i.e., the number * of preceding band members) is "depth", promote tensor reference groups to - * shared memory. Split bands if necessary to insert promotions. + * shared memory if there is no thread mapping above this place. Split bands + * if necessary to insert promotions. * * Use at most "maxMemory" bytes. If a groups does not fit the remaining * memory, do not promote it and keep looking for a smaller group. @@ -600,9 +601,16 @@ void promoteToSharedAtDepth( // immediately below it in the tree. In particular, promote if the // approximated footprint fits into the remaining memory, and the reference // group either features reuse or is accessed in a non-coalesced way, or - // both. + // both. Do not promote if the band node is located below the thread mapping + // as promotion to shared is not allowed in this context. size_t remainingMemory = maxMemory; for (auto bandNode : bands) { + if (isInThreadMappedScope(root, bandNode)) { + LOG_IF(INFO, FLAGS_debug_tc_mapper) + << "not promoting subtree to shared because it is below " + << "a thread mapping node"; + continue; + } promoteToSharedBelow(scop, bandNode, remainingMemory); } diff --git a/test/test_cuda_mapper_memory_promotion.cc b/test/test_cuda_mapper_memory_promotion.cc index 6397667c1..f17e52ea7 100644 --- a/test/test_cuda_mapper_memory_promotion.cc +++ b/test/test_cuda_mapper_memory_promotion.cc @@ -437,12 +437,14 @@ TEST_F(MapperMemoryPromotionRAW, fitAtOuterDepths) { << "expected one reference group to be promoted"; } -TEST_F(MapperMemoryPromotionRAW, throwIfCopiesBelowThreads) { - EXPECT_THROW( - makeWithSharedGreedy(42, 40, 64, 64, 3, 8192), promotion::IncorrectScope); - - EXPECT_THROW( - makeWithSharedGreedy(42, 40, 64, 64, 4, 8192), promotion::IncorrectScope); +TEST_F(MapperMemoryPromotionRAW, noSharedPromotionBelowThreads) { + auto mscop1 = makeWithSharedGreedy(42, 40, 64, 64, 3, 8192); + EXPECT_EQ(mscop1->scop().promotedDecls().size(), 0u) + << "expected no promotion below threads"; + + auto mscop2 = makeWithSharedGreedy(42, 40, 64, 64, 4, 8192); + EXPECT_EQ(mscop2->scop().promotedDecls().size(), 0u) + << "expected no promotion below threads"; } class MatMulBias : public TestMapper { From 04f1062b4b71b53f7cbe26da3f49afdfaa50bd2e Mon Sep 17 00:00:00 2001 From: Oleksandr Zinenko Date: Thu, 28 Jun 2018 14:35:00 +0200 Subject: [PATCH 026/152] promoteToSharedAtDepth: do not throw at depth 0 The original implementation was throwing a NYI exception if promotion was requested at depth 0. This was due to bandsContainingScheduleDepth not supporting the depth 0, and is fixed in a5a88f8 (bandsContainingScheduleDepth: support depth 0). Drop the check and NYI exception. --- tc/core/polyhedral/cuda/memory_promotion_heuristic.cc | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc b/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc index 124fd7466..4888f9e03 100644 --- a/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc +++ b/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc @@ -584,10 +584,6 @@ void promoteToSharedAtDepth( bool unrollCopies) { using namespace tc::polyhedral::detail; - if (depth == 0) { - throw promotion::PromotionNYI("promotion before any band"); - } - auto& scop = mscop.scop(); auto root = scop.scheduleRoot(); From 18ace39eba511d92619a38bf07a01848ae8ef3c7 Mon Sep 17 00:00:00 2001 From: Oleksandr Zinenko Date: Thu, 28 Jun 2018 14:39:19 +0200 Subject: [PATCH 027/152] introduce shared_depth to mapping options By analogy with private_depth, introduce a "shared_depth" mapping option to control the schedule depth at which the promotion to shared memory is performed. This value is optional. If it is not provided, but the shared memory promotion is requested, then perform the promotion at depth equal to the number of block-mapped loops. This is a pragmatic choice to keep the original behavior if the new option is not provided, in particular for benchmarks with hardcoded options until we re-run the autotuning. --- tc/core/cuda/cuda_mapping_options.cc | 5 +++++ tc/core/cuda/cuda_mapping_options.h | 1 + .../cuda/cuda_mapping_options_cpp_printer.cc | 1 + tc/core/polyhedral/cuda/mapped_scop.cc | 17 ++++++++++------- tc/proto/mapping_options.proto | 2 ++ 5 files changed, 19 insertions(+), 7 deletions(-) diff --git a/tc/core/cuda/cuda_mapping_options.cc b/tc/core/cuda/cuda_mapping_options.cc index 49b2f24fd..09d7edf8c 100644 --- a/tc/core/cuda/cuda_mapping_options.cc +++ b/tc/core/cuda/cuda_mapping_options.cc @@ -294,6 +294,11 @@ CudaMappingOptions& CudaMappingOptions::privateDepth(uint32_t depth) { return *this; } +CudaMappingOptions& CudaMappingOptions::sharedDepth(uint32_t depth) { + ownedProto_.set_shared_depth(depth); + return *this; +} + CudaMappingOptions& CudaMappingOptions::mapToThreads( const std::string& commaSeparatedSizes) { auto sizes = parseCommaSeparatedIntegers(commaSeparatedSizes); diff --git a/tc/core/cuda/cuda_mapping_options.h b/tc/core/cuda/cuda_mapping_options.h index df53ffb43..aa8530307 100644 --- a/tc/core/cuda/cuda_mapping_options.h +++ b/tc/core/cuda/cuda_mapping_options.h @@ -196,6 +196,7 @@ class CudaMappingOptions { CudaMappingOptions& unrollCopyShared(bool b); CudaMappingOptions& useReadOnlyCache(bool b); CudaMappingOptions& privateDepth(uint32_t depth); + CudaMappingOptions& sharedDepth(uint32_t depth); ///@} /// Static constructors for predefined strategies. diff --git a/tc/core/cuda/cuda_mapping_options_cpp_printer.cc b/tc/core/cuda/cuda_mapping_options_cpp_printer.cc index a64900492..9ffa95bcc 100644 --- a/tc/core/cuda/cuda_mapping_options_cpp_printer.cc +++ b/tc/core/cuda/cuda_mapping_options_cpp_printer.cc @@ -39,6 +39,7 @@ CudaMappingOptionsCppPrinter& operator<<( "maxSharedMemory", cudaOptions.proto().max_shared_memory()); } prn.printValueOption("privateDepth", cudaOptions.proto().private_depth()); + prn.printValueOption("sharedDepth", cudaOptions.proto().shared_depth()); prn.endStmt(); return prn; } diff --git a/tc/core/polyhedral/cuda/mapped_scop.cc b/tc/core/polyhedral/cuda/mapped_scop.cc index 143b179f2..8ad3c141e 100644 --- a/tc/core/polyhedral/cuda/mapped_scop.cc +++ b/tc/core/polyhedral/cuda/mapped_scop.cc @@ -1049,8 +1049,9 @@ std::unique_ptr MappedScop::makeWithOuterBlockInnerThreadStrategy( LOG_IF(INFO, FLAGS_debug_tc_mapper) << "After mapping to blocks:" << std::endl << *mappedScop->schedule(); - // 8. Promote to shared memory below the loops mapped to blocks. - // This may split the outer band, so find the new outer band after promotion. + // 8. Promote to shared memory. + // If shared promotion depth is specified in the mapping options, use the + // specified value. Otherwise, promote below the loops mapped to blocks. if (cudaOptions.proto().use_shared_memory()) { size_t sharedMemorySize = cudaOptions.proto().has_max_shared_memory() ? cudaOptions.proto().max_shared_memory() @@ -1069,19 +1070,21 @@ std::unique_ptr MappedScop::makeWithOuterBlockInnerThreadStrategy( sharedMemorySize -= reductionMemoryRequirement; } - auto band = outerBand->as(); - LOG_IF(WARNING, FLAGS_debug_tc_mapper && band->nMember() == 0) - << "Aborting memory promotion because outer band has 0 members (NYI)"; - if (band->nMember() > 0 && sharedMemorySize > 0) { + if (sharedMemorySize > 0) { LOG_IF( WARNING, cudaOptions.proto().unroll_copy_shared() && !generic.proto.has_unroll()) << "requested to unroll copies to shared memory without providing the unroll size"; + auto depth = cudaOptions.proto().has_shared_depth() + ? cudaOptions.proto().shared_depth() + : std::min( + outerBand->as()->nOuterCoincident(), + mappedScop->numBlocks.view.size()); promoteToSharedAtDepth( *mappedScop, - std::min(band->nOuterCoincident(), mappedScop->numBlocks.view.size()), + depth, sharedMemorySize, cudaOptions.proto().unroll_copy_shared() && generic.proto.has_unroll()); diff --git a/tc/proto/mapping_options.proto b/tc/proto/mapping_options.proto index f99a91071..8beaf46dc 100644 --- a/tc/proto/mapping_options.proto +++ b/tc/proto/mapping_options.proto @@ -72,6 +72,8 @@ message CudaMappingOptionsProto { required bool use_readonly_cache = 8; // Depth of promotion to private memory, ignored if use_private_memory is false. optional uint32 private_depth = 9; + // Depth of promotion to shared memory, ignored if use_shared_memory is false. + optional uint32 shared_depth = 10; } message CpuMappingOptionsProto { From fe11d2ae222cee798db36f1f940c9445493cd513 Mon Sep 17 00:00:00 2001 From: Oleksandr Zinenko Date: Thu, 28 Jun 2018 14:42:33 +0200 Subject: [PATCH 028/152] do not look up the new outer band after shared memory promotion The code looking up the new outer band was added in the prehistory assuming that some steps following shared memory promotion in makeWithOuterBlockInnerThreadStrategy may need it. This is not and has never been the case. Given that shared memory promotion may now be performed at an arbitrary depth, one can no longer assume any relation between the shared memory promotion copies and the outer band. Remove the code looking up for the outer band. --- tc/core/polyhedral/cuda/mapped_scop.cc | 7 ------- 1 file changed, 7 deletions(-) diff --git a/tc/core/polyhedral/cuda/mapped_scop.cc b/tc/core/polyhedral/cuda/mapped_scop.cc index 8ad3c141e..f04420b7b 100644 --- a/tc/core/polyhedral/cuda/mapped_scop.cc +++ b/tc/core/polyhedral/cuda/mapped_scop.cc @@ -1088,13 +1088,6 @@ std::unique_ptr MappedScop::makeWithOuterBlockInnerThreadStrategy( sharedMemorySize, cudaOptions.proto().unroll_copy_shared() && generic.proto.has_unroll()); - - auto bands = ScheduleTree::collectDFSPreorder( - scop->scheduleRoot(), ScheduleTreeType::Band); - if (bands.size() == 0) { // Sanity check. - throw NoBandsException("no bands after promotion"); - } - outerBand = bands[0]; } } From c91026a7a304e1163a7068fb367d99968e41c50d Mon Sep 17 00:00:00 2001 From: Oleksandr Zinenko Date: Thu, 28 Jun 2018 14:49:39 +0200 Subject: [PATCH 029/152] make sharedDepth mapping option tunable Introduce a tunable parameter for sharedDepth added by a preceding commit. Select the initial range as [0,7] because the range of privateDepth goes until 10, and 3 innermost loops may be mapped to threads making it impossible to promote below them. --- tc/autotuner/autotuner-inl.h | 2 ++ tc/autotuner/parameters.cc | 4 ++++ tc/autotuner/parameters.h | 2 ++ 3 files changed, 8 insertions(+) diff --git a/tc/autotuner/autotuner-inl.h b/tc/autotuner/autotuner-inl.h index 875aafbdc..c64f7be06 100644 --- a/tc/autotuner/autotuner-inl.h +++ b/tc/autotuner/autotuner-inl.h @@ -374,6 +374,8 @@ void setupTuningParameters( RangeParameter(powers2(FLAGS_tuner_max_unroll_size), "unroll"); configuration.privateDepth = RangeParameter({0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, "pdepth"); + configuration.sharedDepth = + RangeParameter({0, 1, 2, 3, 4, 5, 6, 7}, "sdepth"); } } // namespace diff --git a/tc/autotuner/parameters.cc b/tc/autotuner/parameters.cc index b44dbf757..dca35cc50 100644 --- a/tc/autotuner/parameters.cc +++ b/tc/autotuner/parameters.cc @@ -240,6 +240,7 @@ void TuningConfiguration::applyToParameters( useReadOnlyCache.apply(f); matchLibraryCalls.apply(f); privateDepth.apply(f); + sharedDepth.apply(f); } bool TuningConfiguration::isValid() const { @@ -275,6 +276,7 @@ std::vector TuningConfiguration::collectParameters() { params.emplace_back(useReadOnlyCache); params.emplace_back(matchLibraryCalls); params.emplace_back(privateDepth); + params.emplace_back(sharedDepth); return params; } @@ -306,6 +308,7 @@ void TuningConfiguration::fromCudaMappingOptions( unrollCopyShared.selectValue(options.proto().unroll_copy_shared()); useReadOnlyCache.selectValue(options.proto().use_readonly_cache()); privateDepth.selectFromValue(options.proto().private_depth()); + sharedDepth.selectFromValue(options.proto().shared_depth()); } void TuningConfiguration::fromCpuMappingOptions( @@ -335,6 +338,7 @@ void TuningConfiguration::applyToCudaMappingOptions( options.unrollCopyShared(unrollCopyShared.value()); options.useReadOnlyCache(useReadOnlyCache.value()); options.privateDepth(privateDepth.value()); + options.sharedDepth(sharedDepth.value()); } void TuningConfiguration::applyToCpuMappingOptions( diff --git a/tc/autotuner/parameters.h b/tc/autotuner/parameters.h index e08133b44..ad080a3a1 100644 --- a/tc/autotuner/parameters.h +++ b/tc/autotuner/parameters.h @@ -191,6 +191,7 @@ class TuningConfiguration { BoolParameter useReadOnlyCache; BoolParameter matchLibraryCalls; RangeParameter privateDepth; + RangeParameter sharedDepth; private: std::vector> validators_; @@ -229,6 +230,7 @@ class TuningParameterFixer { llvm::Optional useReadOnlyCache; llvm::Optional matchLibraryCalls; llvm::Optional privateDepth; + llvm::Optional sharedDepth; friend class TuningConfiguration; }; From 289570cde3a1a5f805ca317e97a0e46ab5fc96f7 Mon Sep 17 00:00:00 2001 From: Theodoros Theodoridis Date: Wed, 11 Jul 2018 13:16:57 +0200 Subject: [PATCH 030/152] [autotuning] User defined tile,block, grid sizes Previously, if the user inlcuded a tile, block, or grid size that was not in the set of values generated by the autotuner's heuristic, it would result in an error. Include these sizes into the pool of valid tuning values. --- tc/autotuner/autotuner-inl.h | 49 ++++++++++++++++++++++++++++++------ 1 file changed, 42 insertions(+), 7 deletions(-) diff --git a/tc/autotuner/autotuner-inl.h b/tc/autotuner/autotuner-inl.h index c64f7be06..1babc47e2 100644 --- a/tc/autotuner/autotuner-inl.h +++ b/tc/autotuner/autotuner-inl.h @@ -356,10 +356,12 @@ size_t largestDim(const std::vector& inputs) { return (*maxElement)->ndim; } -// Creates well-chosen parameter sizes to match the input shapes. -void setupTuningParameters( +// Creates well-chosen generic parameter sizes to match the input shapes. +template +inline std::pair> +setupGenericTuningParametersAndGetRange( const std::vector& inputs, - TuningConfiguration& configuration) { + const std::vector& baseMappings) { TC_CHECK_GE(inputs.size(), 1u); auto range = inputDivisorsAndPowers2(inputs); // 0 is a valid tiling annotation and signals no tiling of that dimension @@ -367,15 +369,48 @@ void setupTuningParameters( auto nTilesDim = largestDim(inputs) + 1; auto tileRange = range; tileRange.push_back(0); + + TuningConfiguration configuration; configuration.tilingParams.setRange(nTilesDim, tileRange); - configuration.blockParams.setRange(range, "b"); - configuration.gridParams.setRange(range, "g"); configuration.unrollFactor = RangeParameter(powers2(FLAGS_tuner_max_unroll_size), "unroll"); + + return {configuration, range}; +} + +// Creates well-chosen parameter sizes to match the input shapes. +inline TuningConfiguration setupTuningParameters( + const std::vector& inputs, + const std::vector& baseMappings) { + std::vector range; + TuningConfiguration configuration; + std::tie(configuration, range) = + setupGenericTuningParametersAndGetRange(inputs, baseMappings); + auto blockRange = range; + auto gridRange = range; + + for (const auto& baseMapping : baseMappings) { + blockRange = + mergeVectors(std::move(blockRange), baseMapping.block.extractVector()); + gridRange = + mergeVectors(std::move(gridRange), baseMapping.grid.extractVector()); + } + + configuration.blockParams.setRange(blockRange, "b"); + configuration.gridParams.setRange(gridRange, "g"); configuration.privateDepth = RangeParameter({0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, "pdepth"); configuration.sharedDepth = RangeParameter({0, 1, 2, 3, 4, 5, 6, 7}, "sdepth"); + + return configuration; +} + +// Creates well-chosen parameter sizes to match the input shapes. +inline TuningConfiguration setupTuningParameters( + const std::vector& inputs, + const std::vector& baseMappings) { + return setupGenericTuningParametersAndGetRange(inputs, baseMappings).first; } } // namespace @@ -397,9 +432,9 @@ Autotuner::tune( << "Error looking up " << tcEntryPoint; // Initialize a model configuration - TuningConfiguration modelConfiguration; TC_CHECK_GE(inputs.size(), 1u); - setupTuningParameters(inputs.begin()->second, modelConfiguration); + auto modelConfiguration = + setupTuningParameters(inputs.begin()->second, baseMappings); modelConfiguration.fixParameters(fixedParams); // Create initial configs based on options + model configuration From 4d23ce06202ec5d8a4080eb8a827bef669bc983a Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Mon, 9 Jul 2018 16:56:07 +0200 Subject: [PATCH 031/152] move isl_interface/isl/stdint.h to isl_interface/include/isl/stdint.h This way, it can also be used as a substitute for the isl generated file while compiling isl or isl dependent files. This will be useful in the next commit. If the isl generated file does exist, then it does not matter which version gets picked up. --- isl_interface/CMakeLists.txt | 2 +- isl_interface/{ => include}/isl/stdint.h | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename isl_interface/{ => include}/isl/stdint.h (100%) diff --git a/isl_interface/CMakeLists.txt b/isl_interface/CMakeLists.txt index 426ba1c9d..e51621299 100644 --- a/isl_interface/CMakeLists.txt +++ b/isl_interface/CMakeLists.txt @@ -102,7 +102,7 @@ add_custom_command( COMMAND cat ${ISL_DIR}/cpp/cpp.h.pre >> ${ISL_CPP_H} || exit 1 COMMAND extract_isl_interface --language=cpp -I${ISL_DIR}/include ${ISL_DIR}/all.h - -I${CMAKE_CURRENT_LIST_DIR} >> ${ISL_CPP_H} || exit 1 + -I${CMAKE_CURRENT_LIST_DIR}/include >> ${ISL_CPP_H} || exit 1 COMMAND cat ${ISL_DIR}/cpp/cpp.h.bot >> ${ISL_CPP_H} || exit 1 DEPENDS extract_isl_interface ) diff --git a/isl_interface/isl/stdint.h b/isl_interface/include/isl/stdint.h similarity index 100% rename from isl_interface/isl/stdint.h rename to isl_interface/include/isl/stdint.h From 63aaab36792cfeef6b26ac07c565f137066d093a Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Mon, 9 Jul 2018 15:33:52 +0200 Subject: [PATCH 032/152] do not rely on CMakeLists.txt in isl submodule Mainline isl uses autoconf/automake as a build system. The isl submodule used by TC is a heavily modified version of isl and also supports cmake. Reducing the difference and keeping up with changes in mainline isl occasionally requires changes to the build system configuration files. Having to perform the changes for both systems at the same time while merging is a needless additional complication. Support for cmake will therefore be removed from the modified version and TC can no longer rely on this support. There are at least two ways of handling the removal of cmake support from the isl submodule. The isl submodule could be configured as a cmake "external project" or the isl files can simply be compiled in directly. This commits opts for the second option based on the assumption that an external project will be more difficult to handle on Windows systems. Note that this commit also hard-codes some options that will not work on Windows, but setting these options correctly should not be too difficult for someone familiar with cmake. Note that if any source files get added to isl, then the local CMakeLists.txt still needs to get updated, but this can be done while updating the submodule and after the merge has been completed. The build files are stored in "external/isl", even though the object files are part of tc_core, because the source files live in third-party/islpp. They are not stored in "tc/external" because they involve extra files that are private to the (locally built) isl library, while "tc/external" contains the public interface to isl (within TC). It may make sense to move the contents of "tc/external" somewhere else, but that is a different issue. --- CMakeLists.txt | 4 +- external/isl/CMakeLists.txt | 109 +++++++++++++++++++++++++++++++++++ external/isl/gitversion.h.in | 1 + external/isl/isl_config.h | 24 ++++++++ tc/core/CMakeLists.txt | 5 +- 5 files changed, 136 insertions(+), 7 deletions(-) create mode 100644 external/isl/CMakeLists.txt create mode 100644 external/isl/gitversion.h.in create mode 100644 external/isl/isl_config.h diff --git a/CMakeLists.txt b/CMakeLists.txt index ef1ac6fcc..baa2ddec2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -226,13 +226,11 @@ message(STATUS "Found ATen.so file: ${ATEN_LIBRARIES}") ################################################################################ # isl ################################################################################ -set(ISL_INT "gmp" CACHE STRING "Which package to use to represent multi-precision integers (gmp|imath)") # use locally generated C++ bindings include_directories(AFTER ${PROJECT_SOURCE_DIR}/isl_interface/include) include_directories(AFTER ${PROJECT_SOURCE_DIR}/third-party/islpp/include) include_directories(AFTER ${CMAKE_CURRENT_BINARY_DIR}/third-party/islpp/include) -add_subdirectory(third-party/islpp) -set(ISL_LIBRARIES isl-static) +add_subdirectory(external/isl) ################################################################################ # Halide diff --git a/external/isl/CMakeLists.txt b/external/isl/CMakeLists.txt new file mode 100644 index 000000000..587ea7ce6 --- /dev/null +++ b/external/isl/CMakeLists.txt @@ -0,0 +1,109 @@ +find_path(GMP_INCLUDE_DIR gmp.h) +find_library(GMP_LIBRARY NAMES gmp) + +set(ISL_SOURCE_DIR "${PROJECT_SOURCE_DIR}/third-party/islpp") + +set(ISL_SOURCES + ${ISL_SOURCE_DIR}/basis_reduction_tab.c + ${ISL_SOURCE_DIR}/isl_aff.c + ${ISL_SOURCE_DIR}/isl_aff_map.c + ${ISL_SOURCE_DIR}/isl_affine_hull.c + ${ISL_SOURCE_DIR}/isl_arg.c + ${ISL_SOURCE_DIR}/isl_ast_build.c + ${ISL_SOURCE_DIR}/isl_ast_build_expr.c + ${ISL_SOURCE_DIR}/isl_ast.c + ${ISL_SOURCE_DIR}/isl_ast_codegen.c + ${ISL_SOURCE_DIR}/isl_ast_graft.c + ${ISL_SOURCE_DIR}/isl_bernstein.c + ${ISL_SOURCE_DIR}/isl_blk.c + ${ISL_SOURCE_DIR}/isl_bound.c + ${ISL_SOURCE_DIR}/isl_box.c + ${ISL_SOURCE_DIR}/isl_coalesce.c + ${ISL_SOURCE_DIR}/isl_constraint.c + ${ISL_SOURCE_DIR}/isl_convex_hull.c + ${ISL_SOURCE_DIR}/isl_ctx.c + ${ISL_SOURCE_DIR}/isl_deprecated.c + ${ISL_SOURCE_DIR}/isl_dim_map.c + ${ISL_SOURCE_DIR}/isl_equalities.c + ${ISL_SOURCE_DIR}/isl_factorization.c + ${ISL_SOURCE_DIR}/isl_farkas.c + ${ISL_SOURCE_DIR}/isl_ffs.c + ${ISL_SOURCE_DIR}/isl_flow.c + ${ISL_SOURCE_DIR}/isl_fold.c + ${ISL_SOURCE_DIR}/isl_hash.c + ${ISL_SOURCE_DIR}/isl_id.c + ${ISL_SOURCE_DIR}/isl_id_to_ast_expr.c + ${ISL_SOURCE_DIR}/isl_id_to_id.c + ${ISL_SOURCE_DIR}/isl_id_to_pw_aff.c + ${ISL_SOURCE_DIR}/isl_ilp.c + ${ISL_SOURCE_DIR}/isl_input.c + ${ISL_SOURCE_DIR}/isl_local.c + ${ISL_SOURCE_DIR}/isl_local_space.c + ${ISL_SOURCE_DIR}/isl_lp.c + ${ISL_SOURCE_DIR}/isl_map.c + ${ISL_SOURCE_DIR}/isl_map_list.c + ${ISL_SOURCE_DIR}/isl_map_simplify.c + ${ISL_SOURCE_DIR}/isl_map_subtract.c + ${ISL_SOURCE_DIR}/isl_map_to_basic_set.c + ${ISL_SOURCE_DIR}/isl_mat.c + ${ISL_SOURCE_DIR}/isl_morph.c + ${ISL_SOURCE_DIR}/isl_obj.c + ${ISL_SOURCE_DIR}/isl_options.c + ${ISL_SOURCE_DIR}/isl_output.c + ${ISL_SOURCE_DIR}/isl_point.c + ${ISL_SOURCE_DIR}/isl_polynomial.c + ${ISL_SOURCE_DIR}/isl_printer.c + ${ISL_SOURCE_DIR}/isl_range.c + ${ISL_SOURCE_DIR}/isl_reordering.c + ${ISL_SOURCE_DIR}/isl_sample.c + ${ISL_SOURCE_DIR}/isl_scan.c + ${ISL_SOURCE_DIR}/isl_schedule.c + ${ISL_SOURCE_DIR}/isl_schedule_band.c + ${ISL_SOURCE_DIR}/isl_schedule_node.c + ${ISL_SOURCE_DIR}/isl_schedule_read.c + ${ISL_SOURCE_DIR}/isl_schedule_tree.c + ${ISL_SOURCE_DIR}/isl_scheduler.c + ${ISL_SOURCE_DIR}/isl_schedule_constraints.c + ${ISL_SOURCE_DIR}/isl_seq.c + ${ISL_SOURCE_DIR}/isl_set_list.c + ${ISL_SOURCE_DIR}/isl_sort.c + ${ISL_SOURCE_DIR}/isl_space.c + ${ISL_SOURCE_DIR}/isl_stream.c + ${ISL_SOURCE_DIR}/isl_stride.c + ${ISL_SOURCE_DIR}/isl_tab.c + ${ISL_SOURCE_DIR}/isl_tab_pip.c + ${ISL_SOURCE_DIR}/isl_tarjan.c + ${ISL_SOURCE_DIR}/isl_transitive_closure.c + ${ISL_SOURCE_DIR}/isl_union_map.c + ${ISL_SOURCE_DIR}/isl_val.c + ${ISL_SOURCE_DIR}/isl_vec.c + ${ISL_SOURCE_DIR}/isl_version.c + ${ISL_SOURCE_DIR}/isl_vertices.c + ${ISL_SOURCE_DIR}/print.c + ${ISL_SOURCE_DIR}/isl_gmp.c + ${ISL_SOURCE_DIR}/isl_val_gmp.c +) + +# The tc_isl library is included in the (shared) tc_core library. +add_library(tc_isl STATIC) +set_property(TARGET tc_isl PROPERTY POSITION_INDEPENDENT_CODE ON) +target_include_directories( + tc_isl + PRIVATE + ${PROJECT_SOURCE_DIR}/third-party/islpp + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${GMP_INCLUDE_DIR} +) +target_sources(tc_isl PRIVATE ${ISL_SOURCES}) +target_link_libraries(tc_isl ${GMP_LIBRARY}) + +# The following sets "gitversion.h" only at configure time. +# Since TC currently does not call isl_version(), +# it is not worth it to try and be more accurate. +execute_process( + COMMAND ${GIT_EXECUTABLE} describe + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/third-party/islpp + OUTPUT_VARIABLE ISL_GIT_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE) +configure_file("gitversion.h.in" "gitversion.h") diff --git a/external/isl/gitversion.h.in b/external/isl/gitversion.h.in new file mode 100644 index 000000000..29eace46a --- /dev/null +++ b/external/isl/gitversion.h.in @@ -0,0 +1 @@ +#define GIT_HEAD_ID "${ISL_GIT_VERSION}" diff --git a/external/isl/isl_config.h b/external/isl/isl_config.h new file mode 100644 index 000000000..8cfb4cbb7 --- /dev/null +++ b/external/isl/isl_config.h @@ -0,0 +1,24 @@ +/* Hard-coded configuration variables. */ + +/* define if your compiler has __attribute__ */ +#define HAVE___ATTRIBUTE__ /**/ + +/* Define to 1 if you have the declaration of `ffs', and to 0 if you don't. */ +#define HAVE_DECL_FFS 1 + +/* Define to 1 if you have the declaration of `strcasecmp', and to 0 if you + don't. */ +#define HAVE_DECL_STRCASECMP 1 + +/* Define to 1 if you have the declaration of `strncasecmp', and to 0 if you + don't. */ +#define HAVE_DECL_STRNCASECMP 1 + +/* Define to 1 if you have the declaration of `snprintf', and to 0 if you + don't. */ +#define HAVE_DECL_SNPRINTF 1 + +/* use gmp to implement isl_int */ +#define USE_GMP_FOR_MP + +#include diff --git a/tc/core/CMakeLists.txt b/tc/core/CMakeLists.txt index d4e47ddee..46f87a197 100644 --- a/tc/core/CMakeLists.txt +++ b/tc/core/CMakeLists.txt @@ -43,9 +43,9 @@ target_link_libraries( glog ${HALIDE_LIBRARIES} - ${ISL_LIBRARIES} -lLLVM + tc_isl tc_lang tc_version tc_proto @@ -82,7 +82,6 @@ target_link_libraries( tc_core_cpu ${HALIDE_LIBRARIES} - ${ISL_LIBRARIES} -lLLVM tc_lang @@ -129,7 +128,6 @@ target_link_libraries( tc_core_cuda_no_sdk ${HALIDE_LIBRARIES} - ${ISL_LIBRARIES} -lLLVM tc_lang @@ -174,7 +172,6 @@ if (WITH_CUDA) ${CUDA_curand_LIBRARY} ${CUDA_LIBRARIES} ${CUDA_NVRTC_LIBRARIES} - ${ISL_LIBRARIES} tc_lang tc_version From d15cb75ef99099270e5e61efc668924d752ea06d Mon Sep 17 00:00:00 2001 From: Nicolas Vasilache Date: Fri, 13 Jul 2018 10:47:46 -0400 Subject: [PATCH 033/152] Update writing_layers.rst Fix broken link --- docs/source/framework/pytorch_integration/writing_layers.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/framework/pytorch_integration/writing_layers.rst b/docs/source/framework/pytorch_integration/writing_layers.rst index 67a847b30..ea536a0ca 100644 --- a/docs/source/framework/pytorch_integration/writing_layers.rst +++ b/docs/source/framework/pytorch_integration/writing_layers.rst @@ -200,7 +200,7 @@ functions. For example, assume one wants to use :code:`fmax` CUDA function in TC O = T.relu(torch.randn(100, 128, device='cuda')) TC only supports a subset of built-in CUDA functions. -Built-in functions supported in TC are listed in `this file `_. +Built-in functions supported in TC are listed in `this file `_. Documentation for these functions is available as part of the official `CUDA documentation `_. From 7e56a947dbcd0abac94c17f73ca494e6e6301640 Mon Sep 17 00:00:00 2001 From: Laurens van der Maaten Date: Mon, 16 Jul 2018 16:49:12 -0400 Subject: [PATCH 034/152] Add ReLU + masked convolution At training time, CondenseNets use a convolution in which certain input-output connections (that is, the entire kernel) are masked out. This example implements a combination of that masked convolution with a ReLU activations. The goal is to further work out this example into increasingly large chunks of the CondenseNet. Tested this internally: tests pass. --- python/examples/masked_conv.py | 161 +++++++++++++++++++++++++++++++++ 1 file changed, 161 insertions(+) create mode 100644 python/examples/masked_conv.py diff --git a/python/examples/masked_conv.py b/python/examples/masked_conv.py new file mode 100644 index 000000000..a8f4faded --- /dev/null +++ b/python/examples/masked_conv.py @@ -0,0 +1,161 @@ +#!/usr/bin/env python3 + +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## +import tensor_comprehensions as tc + +import argparse +import torch +import torch.nn as nn +import torch.nn.functional as functional + +torch.backends.cudnn.benchmark = True + + +def GetArgumentParser(): + parser = argparse.ArgumentParser( + description='Lengths Cosine Coherence benchmark.' + ) + parser.add_argument( + '--tuner_threads', type=int, default=16, + help='Number of CPU tuning threads.', + ) + parser.add_argument( + '--tuner_generations', type=int, default=25, + help='Number of tuning generations.', + ) + parser.add_argument( + '--tuner_pop_size', type=int, default=100, + help='Number candidates per tuning generations.', + ) + parser.add_argument( + '--tuner_number_elites', type=int, default=5, + help='Number of best tuning candidates that survive each generation.', + ) + parser.add_argument( + '--tuner_devices', type=str, default='0', + help='Comma separated list of tuning devices.', + ) + parser.add_argument( + '--tuner_cache_file', + type=str, + default='/tmp/cache_condensenet', + help='File to store tuned mapping options', + ) + return parser + + +parser = GetArgumentParser() +args, extra_args = parser.parse_known_args() + + +############################################################################### +# TC equivalent converting control-flow to data dependencies +############################################################################### +MASKED_CONVOLVE = ''' +def masked_convolve(float(B, C, H, W) Input, + float(F, C, K, K) Weights, + uint8(F, C) Mask) -> (Output) { + Output(b, f, h, w) +=! (Mask(f, r_c) == 1) ? + fmax(0.0, Input(b, r_c, h + r_k1, w + r_k2)) * + Weights(f, r_c, r_k1, r_k2) : + 0.0 +} +''' + +############################################################################### +# Implicit compilation and tuning behavior +############################################################################### +tuner_config = ( + tc.TunerConfig() + .threads(args.tuner_threads) + .generations(args.tuner_generations) + .pop_size(args.tuner_pop_size) + .number_elites(args.tuner_number_elites) + .devices(args.tuner_devices)) +reinforce_list = [''] + + +def generate_options(tc_str: str, + entry_point: str, + *inputs: torch.Tensor) -> tc.MappingOptions: + global reinforce + + # TODO: comment the line below which serves the purpose of not blowing up + # CI time + return tc.make_naive_options_factory()(tc_str, entry_point, *inputs) + + if entry_point == 'make_idx': + return tc.make_naive_options_factory()(tc_str, entry_point, *inputs) + + loaded = tc.make_load_from_cache_options_factory(args.tuner_cache_file)( + tc_str, entry_point, *inputs) + + if loaded is None or entry_point in reinforce_list or '*' in reinforce_list: + start = loaded if loaded is not None else 'naive' + return tc.make_autotuned_options_factory( + starting_options=start, + tuner_config=tuner_config, + cache_filename=args.tuner_cache_file, + store_to_cache=True,)(tc_str, entry_point, *inputs) + + assert loaded is not None, 'None found' + + return loaded + + +############################################################################### +# Define the TC for MASKED_CONVOLVE +############################################################################### +TC = tc.define(MASKED_CONVOLVE, generate_options) + +############################################################################### +# Run with implicit compilation and tuning +############################################################################### + +# sizes: +H, W, C, B, F, K = 56, 56, 128, 32, 32, 1 + +# Pytorch: +conv = nn.Conv2d(C, F, K, 1, 0, 1, groups=1, bias=False).cuda() +relu = nn.ReLU(inplace=True).cuda() +input_data = torch.zeros(B, C, H, W).cuda(non_blocking=True) +mask = torch.randn(F, C, K, K).gt_(0.).cuda(non_blocking=True) +torch.cuda.synchronize() + +weight = conv.weight * mask +rectified_input = relu(input_data) +output = functional.conv2d(rectified_input, weight, None, conv.stride, + conv.padding, conv.dilation, 1) + +# TC: +InputData = input_data +Weights = conv.weight +Mask = mask.view(F, C).byte() +torch.cuda.synchronize() +Output = TC.masked_convolve(InputData, Weights, Mask) + + +############################################################################### +# Check +############################################################################### +tc.assert_almost_equal( + output.cpu(), + Output.cpu(), + input_data.cpu(), conv.weight.cpu(), mask.cpu(), + operations=C * K * K, + precision=1e-7) + +print('SUCCESS') From 99c0043f0cfadd484a4fbde1ead3a209765b03c1 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Mon, 2 Jul 2018 14:55:51 +0200 Subject: [PATCH 035/152] bump isl for schedule_nonneg_var_coefficient option --- external/isl/CMakeLists.txt | 1 + isl_interface/include/isl/cpp.h | 290 +++++++++++++++++++++++++------- third-party/islpp | 2 +- 3 files changed, 232 insertions(+), 61 deletions(-) diff --git a/external/isl/CMakeLists.txt b/external/isl/CMakeLists.txt index 587ea7ce6..cb3f151ad 100644 --- a/external/isl/CMakeLists.txt +++ b/external/isl/CMakeLists.txt @@ -70,6 +70,7 @@ set(ISL_SOURCES ${ISL_SOURCE_DIR}/isl_space.c ${ISL_SOURCE_DIR}/isl_stream.c ${ISL_SOURCE_DIR}/isl_stride.c + ${ISL_SOURCE_DIR}/isl_system.c ${ISL_SOURCE_DIR}/isl_tab.c ${ISL_SOURCE_DIR}/isl_tab_pip.c ${ISL_SOURCE_DIR}/isl_tarjan.c diff --git a/isl_interface/include/isl/cpp.h b/isl_interface/include/isl/cpp.h index 21911021d..8a9256634 100644 --- a/isl_interface/include/isl/cpp.h +++ b/isl_interface/include/isl/cpp.h @@ -1776,6 +1776,7 @@ class map { inline isl::basic_map_list get_basic_map_list() const; inline isl::fixed_box get_range_simple_fixed_box_hull() const; inline isl::stride_info get_range_stride_info(int pos) const; + inline isl::id get_range_tuple_id() const; inline isl::space get_space() const; inline isl::id get_tuple_id(enum isl::dim_type type) const; inline isl::map gist(isl::map context) const; @@ -1808,6 +1809,7 @@ class map { inline isl::map range_product(isl::map map2) const; inline isl::map reverse() const; inline isl::basic_map sample() const; + inline isl::map set_range_tuple_id(isl::id id) const; inline isl::map set_tuple_id(enum isl::dim_type type, isl::id id) const; inline isl::basic_map simple_hull() const; inline isl::map subtract(isl::map map2) const; @@ -1874,9 +1876,9 @@ class multi_aff { public: inline /* implicit */ multi_aff(); inline /* implicit */ multi_aff(const isl::multi_aff &obj); - inline explicit multi_aff(isl::space space, isl::aff_list list); inline /* implicit */ multi_aff(isl::aff aff); inline explicit multi_aff(isl::ctx ctx, const std::string &str); + inline explicit multi_aff(isl::space space, isl::aff_list list); inline isl::multi_aff &operator=(isl::multi_aff obj); inline ~multi_aff(); inline __isl_give isl_multi_aff *copy() const &; @@ -1900,6 +1902,7 @@ class multi_aff { inline isl::aff get_aff(int pos) const; inline isl::aff_list get_aff_list() const; inline isl::space get_domain_space() const; + inline isl::id get_range_tuple_id() const; inline isl::space get_space() const; inline isl::id get_tuple_id(enum isl::dim_type type) const; static inline isl::multi_aff identity(isl::space space); @@ -1913,15 +1916,17 @@ class multi_aff { inline isl::multi_aff range_product(isl::multi_aff multi2) const; inline isl::multi_aff range_splice(unsigned int pos, isl::multi_aff multi2) const; inline isl::multi_aff reset_user() const; - inline isl::multi_aff scale(isl::multi_val mv) const; inline isl::multi_aff scale(isl::val v) const; + inline isl::multi_aff scale(isl::multi_val mv) const; inline isl::multi_aff scale_down(isl::val v) const; inline isl::multi_aff scale_down(isl::multi_val mv) const; inline isl::multi_aff set_aff(int pos, isl::aff el) const; + inline isl::multi_aff set_range_tuple_id(isl::id id) const; inline isl::multi_aff set_tuple_id(enum isl::dim_type type, isl::id id) const; inline int size() const; inline isl::multi_aff splice(unsigned int in_pos, unsigned int out_pos, isl::multi_aff multi2) const; inline isl::multi_aff sub(isl::multi_aff multi2) const; + static inline isl::multi_aff wrapped_range_map(isl::space space); static inline isl::multi_aff zero(isl::space space); typedef isl_multi_aff* isl_ptr_t; }; @@ -2016,6 +2021,7 @@ class multi_pw_aff { inline isl::space get_domain_space() const; inline isl::pw_aff get_pw_aff(int pos) const; inline isl::pw_aff_list get_pw_aff_list() const; + inline isl::id get_range_tuple_id() const; inline isl::space get_space() const; inline isl::id get_tuple_id(enum isl::dim_type type) const; static inline isl::multi_pw_aff identity(isl::space space); @@ -2036,6 +2042,7 @@ class multi_pw_aff { inline isl::multi_pw_aff scale_down(isl::val v) const; inline isl::multi_pw_aff scale_down(isl::multi_val mv) const; inline isl::multi_pw_aff set_pw_aff(int pos, isl::pw_aff el) const; + inline isl::multi_pw_aff set_range_tuple_id(isl::id id) const; inline isl::multi_pw_aff set_tuple_id(enum isl::dim_type type, isl::id id) const; inline int size() const; inline isl::multi_pw_aff splice(unsigned int in_pos, unsigned int out_pos, isl::multi_pw_aff multi2) const; @@ -2060,11 +2067,11 @@ class multi_union_pw_aff { public: inline /* implicit */ multi_union_pw_aff(); inline /* implicit */ multi_union_pw_aff(const isl::multi_union_pw_aff &obj); + inline explicit multi_union_pw_aff(isl::union_set domain, isl::multi_val mv); + inline explicit multi_union_pw_aff(isl::union_set domain, isl::multi_aff ma); inline explicit multi_union_pw_aff(isl::space space, isl::union_pw_aff_list list); inline /* implicit */ multi_union_pw_aff(isl::union_pw_aff upa); inline /* implicit */ multi_union_pw_aff(isl::multi_pw_aff mpa); - inline explicit multi_union_pw_aff(isl::union_set domain, isl::multi_val mv); - inline explicit multi_union_pw_aff(isl::union_set domain, isl::multi_aff ma); inline explicit multi_union_pw_aff(isl::ctx ctx, const std::string &str); inline isl::multi_union_pw_aff &operator=(isl::multi_union_pw_aff obj); inline ~multi_union_pw_aff(); @@ -2091,6 +2098,7 @@ class multi_union_pw_aff { inline isl::multi_union_pw_aff from_range() const; static inline isl::multi_union_pw_aff from_union_map(isl::union_map umap); inline isl::space get_domain_space() const; + inline isl::id get_range_tuple_id() const; inline isl::space get_space() const; inline isl::id get_tuple_id(enum isl::dim_type type) const; inline isl::union_pw_aff get_union_pw_aff(int pos) const; @@ -2113,6 +2121,7 @@ class multi_union_pw_aff { inline isl::multi_union_pw_aff scale(isl::multi_val mv) const; inline isl::multi_union_pw_aff scale_down(isl::val v) const; inline isl::multi_union_pw_aff scale_down(isl::multi_val mv) const; + inline isl::multi_union_pw_aff set_range_tuple_id(isl::id id) const; inline isl::multi_union_pw_aff set_tuple_id(enum isl::dim_type type, isl::id id) const; inline isl::multi_union_pw_aff set_union_pw_aff(int pos, isl::union_pw_aff el) const; inline int size() const; @@ -2159,6 +2168,7 @@ class multi_val { inline isl::multi_val flatten_range() const; inline isl::multi_val from_range() const; inline isl::space get_domain_space() const; + inline isl::id get_range_tuple_id() const; inline isl::space get_space() const; inline isl::id get_tuple_id(enum isl::dim_type type) const; inline isl::val get_val(int pos) const; @@ -2175,6 +2185,7 @@ class multi_val { inline isl::multi_val scale(isl::multi_val mv) const; inline isl::multi_val scale_down(isl::val v) const; inline isl::multi_val scale_down(isl::multi_val mv) const; + inline isl::multi_val set_range_tuple_id(isl::id id) const; inline isl::multi_val set_tuple_id(enum isl::dim_type type, isl::id id) const; inline isl::multi_val set_val(int pos, isl::val el) const; inline int size() const; @@ -2366,6 +2377,7 @@ class pw_multi_aff { inline void foreach_piece(const std::function &fn) const; static inline isl::pw_multi_aff from(isl::multi_pw_aff mpa); inline isl::pw_aff get_pw_aff(int pos) const; + inline isl::id get_range_tuple_id() const; inline isl::space get_space() const; inline isl::id get_tuple_id(enum isl::dim_type type) const; static inline isl::pw_multi_aff identity(isl::space space); @@ -2880,7 +2892,6 @@ class set { inline isl::set reset_tuple_id() const; inline isl::basic_set sample() const; inline isl::point sample_point() const; - inline isl::set set_dim_id(enum isl::dim_type type, unsigned int pos, isl::id id) const; inline isl::set set_tuple_id(isl::id id) const; inline isl::set set_tuple_name(const std::string &s) const; inline isl::basic_set simple_hull() const; @@ -2975,6 +2986,7 @@ class space { inline isl::space domain_product(isl::space right) const; inline isl::space from_domain() const; inline isl::space from_range() const; + inline isl::id get_map_range_tuple_id() const; inline isl::id get_tuple_id(enum isl::dim_type type) const; inline bool has_equal_params(const isl::space &space2) const; inline bool has_equal_tuples(const isl::space &space2) const; @@ -2991,6 +3003,7 @@ class space { inline isl::space range_map() const; inline isl::space range_product(isl::space right) const; inline isl::space set_from_params() const; + inline isl::space set_set_tuple_id(isl::id id) const; inline isl::space uncurry() const; inline isl::space unwrap() const; inline isl::space wrap() const; @@ -3472,8 +3485,8 @@ class val { public: inline /* implicit */ val(); inline /* implicit */ val(const isl::val &obj); - inline explicit val(isl::ctx ctx, long i); inline explicit val(isl::ctx ctx, const std::string &str); + inline explicit val(isl::ctx ctx, long i); inline isl::val &operator=(isl::val obj); inline ~val(); inline __isl_give isl_val *copy() const &; @@ -9933,6 +9946,18 @@ isl::stride_info map::get_range_stride_info(int pos) const return manage(res); } +isl::id map::get_range_tuple_id() const +{ + if (!ptr) + throw isl::exception::create(isl_error_invalid, + "NULL input", __FILE__, __LINE__); + options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + auto res = isl_map_get_range_tuple_id(get()); + if (!res) + throw exception::create_from_last_error(get_ctx()); + return manage(res); +} + isl::space map::get_space() const { if (!ptr) @@ -10316,6 +10341,18 @@ isl::basic_map map::sample() const return manage(res); } +isl::map map::set_range_tuple_id(isl::id id) const +{ + if (!ptr || id.is_null()) + throw isl::exception::create(isl_error_invalid, + "NULL input", __FILE__, __LINE__); + options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + auto res = isl_map_set_range_tuple_id(copy(), id.release()); + if (!res) + throw exception::create_from_last_error(get_ctx()); + return manage(res); +} + isl::map map::set_tuple_id(enum isl::dim_type type, isl::id id) const { if (!ptr || id.is_null()) @@ -10644,18 +10681,6 @@ multi_aff::multi_aff(const isl::multi_aff &obj) multi_aff::multi_aff(__isl_take isl_multi_aff *ptr) : ptr(ptr) {} -multi_aff::multi_aff(isl::space space, isl::aff_list list) -{ - if (space.is_null() || list.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_aff_from_aff_list(space.release(), list.release()); - if (!res) - throw exception::create_from_last_error(ctx); - ptr = res; -} multi_aff::multi_aff(isl::aff aff) { if (aff.is_null()) @@ -10676,6 +10701,18 @@ multi_aff::multi_aff(isl::ctx ctx, const std::string &str) throw exception::create_from_last_error(ctx); ptr = res; } +multi_aff::multi_aff(isl::space space, isl::aff_list list) +{ + if (space.is_null() || list.is_null()) + throw isl::exception::create(isl_error_invalid, + "NULL input", __FILE__, __LINE__); + auto ctx = space.get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + auto res = isl_multi_aff_from_aff_list(space.release(), list.release()); + if (!res) + throw exception::create_from_last_error(ctx); + ptr = res; +} multi_aff &multi_aff::operator=(isl::multi_aff obj) { std::swap(this->ptr, obj.ptr); @@ -10874,6 +10911,18 @@ isl::space multi_aff::get_domain_space() const return manage(res); } +isl::id multi_aff::get_range_tuple_id() const +{ + if (!ptr) + throw isl::exception::create(isl_error_invalid, + "NULL input", __FILE__, __LINE__); + options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + auto res = isl_multi_aff_get_range_tuple_id(get()); + if (!res) + throw exception::create_from_last_error(get_ctx()); + return manage(res); +} + isl::space multi_aff::get_space() const { if (!ptr) @@ -11032,25 +11081,25 @@ isl::multi_aff multi_aff::reset_user() const return manage(res); } -isl::multi_aff multi_aff::scale(isl::multi_val mv) const +isl::multi_aff multi_aff::scale(isl::val v) const { - if (!ptr || mv.is_null()) + if (!ptr || v.is_null()) throw isl::exception::create(isl_error_invalid, "NULL input", __FILE__, __LINE__); options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_aff_scale_multi_val(copy(), mv.release()); + auto res = isl_multi_aff_scale_val(copy(), v.release()); if (!res) throw exception::create_from_last_error(get_ctx()); return manage(res); } -isl::multi_aff multi_aff::scale(isl::val v) const +isl::multi_aff multi_aff::scale(isl::multi_val mv) const { - if (!ptr || v.is_null()) + if (!ptr || mv.is_null()) throw isl::exception::create(isl_error_invalid, "NULL input", __FILE__, __LINE__); options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_aff_scale_val(copy(), v.release()); + auto res = isl_multi_aff_scale_multi_val(copy(), mv.release()); if (!res) throw exception::create_from_last_error(get_ctx()); return manage(res); @@ -11092,6 +11141,18 @@ isl::multi_aff multi_aff::set_aff(int pos, isl::aff el) const return manage(res); } +isl::multi_aff multi_aff::set_range_tuple_id(isl::id id) const +{ + if (!ptr || id.is_null()) + throw isl::exception::create(isl_error_invalid, + "NULL input", __FILE__, __LINE__); + options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + auto res = isl_multi_aff_set_range_tuple_id(copy(), id.release()); + if (!res) + throw exception::create_from_last_error(get_ctx()); + return manage(res); +} + isl::multi_aff multi_aff::set_tuple_id(enum isl::dim_type type, isl::id id) const { if (!ptr || id.is_null()) @@ -11138,6 +11199,19 @@ isl::multi_aff multi_aff::sub(isl::multi_aff multi2) const return manage(res); } +isl::multi_aff multi_aff::wrapped_range_map(isl::space space) +{ + if (space.is_null()) + throw isl::exception::create(isl_error_invalid, + "NULL input", __FILE__, __LINE__); + auto ctx = space.get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + auto res = isl_multi_aff_wrapped_range_map(space.release()); + if (!res) + throw exception::create_from_last_error(ctx); + return manage(res); +} + isl::multi_aff multi_aff::zero(isl::space space) { if (space.is_null()) @@ -11711,6 +11785,18 @@ isl::pw_aff_list multi_pw_aff::get_pw_aff_list() const return manage(res); } +isl::id multi_pw_aff::get_range_tuple_id() const +{ + if (!ptr) + throw isl::exception::create(isl_error_invalid, + "NULL input", __FILE__, __LINE__); + options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + auto res = isl_multi_pw_aff_get_range_tuple_id(get()); + if (!res) + throw exception::create_from_last_error(get_ctx()); + return manage(res); +} + isl::space multi_pw_aff::get_space() const { if (!ptr) @@ -11952,6 +12038,18 @@ isl::multi_pw_aff multi_pw_aff::set_pw_aff(int pos, isl::pw_aff el) const return manage(res); } +isl::multi_pw_aff multi_pw_aff::set_range_tuple_id(isl::id id) const +{ + if (!ptr || id.is_null()) + throw isl::exception::create(isl_error_invalid, + "NULL input", __FILE__, __LINE__); + options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + auto res = isl_multi_pw_aff_set_range_tuple_id(copy(), id.release()); + if (!res) + throw exception::create_from_last_error(get_ctx()); + return manage(res); +} + isl::multi_pw_aff multi_pw_aff::set_tuple_id(enum isl::dim_type type, isl::id id) const { if (!ptr || id.is_null()) @@ -12042,62 +12140,62 @@ multi_union_pw_aff::multi_union_pw_aff(const isl::multi_union_pw_aff &obj) multi_union_pw_aff::multi_union_pw_aff(__isl_take isl_multi_union_pw_aff *ptr) : ptr(ptr) {} -multi_union_pw_aff::multi_union_pw_aff(isl::space space, isl::union_pw_aff_list list) +multi_union_pw_aff::multi_union_pw_aff(isl::union_set domain, isl::multi_val mv) { - if (space.is_null() || list.is_null()) + if (domain.is_null() || mv.is_null()) throw isl::exception::create(isl_error_invalid, "NULL input", __FILE__, __LINE__); - auto ctx = space.get_ctx(); + auto ctx = domain.get_ctx(); options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_union_pw_aff_from_union_pw_aff_list(space.release(), list.release()); + auto res = isl_multi_union_pw_aff_multi_val_on_domain(domain.release(), mv.release()); if (!res) throw exception::create_from_last_error(ctx); ptr = res; } -multi_union_pw_aff::multi_union_pw_aff(isl::union_pw_aff upa) +multi_union_pw_aff::multi_union_pw_aff(isl::union_set domain, isl::multi_aff ma) { - if (upa.is_null()) + if (domain.is_null() || ma.is_null()) throw isl::exception::create(isl_error_invalid, "NULL input", __FILE__, __LINE__); - auto ctx = upa.get_ctx(); + auto ctx = domain.get_ctx(); options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_union_pw_aff_from_union_pw_aff(upa.release()); + auto res = isl_multi_union_pw_aff_multi_aff_on_domain(domain.release(), ma.release()); if (!res) throw exception::create_from_last_error(ctx); ptr = res; } -multi_union_pw_aff::multi_union_pw_aff(isl::multi_pw_aff mpa) +multi_union_pw_aff::multi_union_pw_aff(isl::space space, isl::union_pw_aff_list list) { - if (mpa.is_null()) + if (space.is_null() || list.is_null()) throw isl::exception::create(isl_error_invalid, "NULL input", __FILE__, __LINE__); - auto ctx = mpa.get_ctx(); + auto ctx = space.get_ctx(); options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_union_pw_aff_from_multi_pw_aff(mpa.release()); + auto res = isl_multi_union_pw_aff_from_union_pw_aff_list(space.release(), list.release()); if (!res) throw exception::create_from_last_error(ctx); ptr = res; } -multi_union_pw_aff::multi_union_pw_aff(isl::union_set domain, isl::multi_val mv) +multi_union_pw_aff::multi_union_pw_aff(isl::union_pw_aff upa) { - if (domain.is_null() || mv.is_null()) + if (upa.is_null()) throw isl::exception::create(isl_error_invalid, "NULL input", __FILE__, __LINE__); - auto ctx = domain.get_ctx(); + auto ctx = upa.get_ctx(); options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_union_pw_aff_multi_val_on_domain(domain.release(), mv.release()); + auto res = isl_multi_union_pw_aff_from_union_pw_aff(upa.release()); if (!res) throw exception::create_from_last_error(ctx); ptr = res; } -multi_union_pw_aff::multi_union_pw_aff(isl::union_set domain, isl::multi_aff ma) +multi_union_pw_aff::multi_union_pw_aff(isl::multi_pw_aff mpa) { - if (domain.is_null() || ma.is_null()) + if (mpa.is_null()) throw isl::exception::create(isl_error_invalid, "NULL input", __FILE__, __LINE__); - auto ctx = domain.get_ctx(); + auto ctx = mpa.get_ctx(); options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_union_pw_aff_multi_aff_on_domain(domain.release(), ma.release()); + auto res = isl_multi_union_pw_aff_from_multi_pw_aff(mpa.release()); if (!res) throw exception::create_from_last_error(ctx); ptr = res; @@ -12332,6 +12430,18 @@ isl::space multi_union_pw_aff::get_domain_space() const return manage(res); } +isl::id multi_union_pw_aff::get_range_tuple_id() const +{ + if (!ptr) + throw isl::exception::create(isl_error_invalid, + "NULL input", __FILE__, __LINE__); + options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + auto res = isl_multi_union_pw_aff_get_range_tuple_id(get()); + if (!res) + throw exception::create_from_last_error(get_ctx()); + return manage(res); +} + isl::space multi_union_pw_aff::get_space() const { if (!ptr) @@ -12596,6 +12706,18 @@ isl::multi_union_pw_aff multi_union_pw_aff::scale_down(isl::multi_val mv) const return manage(res); } +isl::multi_union_pw_aff multi_union_pw_aff::set_range_tuple_id(isl::id id) const +{ + if (!ptr || id.is_null()) + throw isl::exception::create(isl_error_invalid, + "NULL input", __FILE__, __LINE__); + options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + auto res = isl_multi_union_pw_aff_set_range_tuple_id(copy(), id.release()); + if (!res) + throw exception::create_from_last_error(get_ctx()); + return manage(res); +} + isl::multi_union_pw_aff multi_union_pw_aff::set_tuple_id(enum isl::dim_type type, isl::id id) const { if (!ptr || id.is_null()) @@ -12871,6 +12993,18 @@ isl::space multi_val::get_domain_space() const return manage(res); } +isl::id multi_val::get_range_tuple_id() const +{ + if (!ptr) + throw isl::exception::create(isl_error_invalid, + "NULL input", __FILE__, __LINE__); + options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + auto res = isl_multi_val_get_range_tuple_id(get()); + if (!res) + throw exception::create_from_last_error(get_ctx()); + return manage(res); +} + isl::space multi_val::get_space() const { if (!ptr) @@ -13063,6 +13197,18 @@ isl::multi_val multi_val::scale_down(isl::multi_val mv) const return manage(res); } +isl::multi_val multi_val::set_range_tuple_id(isl::id id) const +{ + if (!ptr || id.is_null()) + throw isl::exception::create(isl_error_invalid, + "NULL input", __FILE__, __LINE__); + options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + auto res = isl_multi_val_set_range_tuple_id(copy(), id.release()); + if (!res) + throw exception::create_from_last_error(get_ctx()); + return manage(res); +} + isl::multi_val multi_val::set_tuple_id(enum isl::dim_type type, isl::id id) const { if (!ptr || id.is_null()) @@ -14289,6 +14435,18 @@ isl::pw_aff pw_multi_aff::get_pw_aff(int pos) const return manage(res); } +isl::id pw_multi_aff::get_range_tuple_id() const +{ + if (!ptr) + throw isl::exception::create(isl_error_invalid, + "NULL input", __FILE__, __LINE__); + options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + auto res = isl_pw_multi_aff_get_range_tuple_id(get()); + if (!res) + throw exception::create_from_last_error(get_ctx()); + return manage(res); +} + isl::space pw_multi_aff::get_space() const { if (!ptr) @@ -17249,18 +17407,6 @@ isl::point set::sample_point() const return manage(res); } -isl::set set::set_dim_id(enum isl::dim_type type, unsigned int pos, isl::id id) const -{ - if (!ptr || id.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_set_set_dim_id(copy(), static_cast(type), pos, id.release()); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - isl::set set::set_tuple_id(isl::id id) const { if (!ptr || id.is_null()) @@ -17838,6 +17984,18 @@ isl::space space::from_range() const return manage(res); } +isl::id space::get_map_range_tuple_id() const +{ + if (!ptr) + throw isl::exception::create(isl_error_invalid, + "NULL input", __FILE__, __LINE__); + options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + auto res = isl_space_get_map_range_tuple_id(get()); + if (!res) + throw exception::create_from_last_error(get_ctx()); + return manage(res); +} + isl::id space::get_tuple_id(enum isl::dim_type type) const { if (!ptr) @@ -18030,6 +18188,18 @@ isl::space space::set_from_params() const return manage(res); } +isl::space space::set_set_tuple_id(isl::id id) const +{ + if (!ptr || id.is_null()) + throw isl::exception::create(isl_error_invalid, + "NULL input", __FILE__, __LINE__); + options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + auto res = isl_space_set_set_tuple_id(copy(), id.release()); + if (!res) + throw exception::create_from_last_error(get_ctx()); + return manage(res); +} + isl::space space::uncurry() const { if (!ptr) @@ -21226,18 +21396,18 @@ val::val(const isl::val &obj) val::val(__isl_take isl_val *ptr) : ptr(ptr) {} -val::val(isl::ctx ctx, long i) +val::val(isl::ctx ctx, const std::string &str) { options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); - auto res = isl_val_int_from_si(ctx.release(), i); + auto res = isl_val_read_from_str(ctx.release(), str.c_str()); if (!res) throw exception::create_from_last_error(ctx); ptr = res; } -val::val(isl::ctx ctx, const std::string &str) +val::val(isl::ctx ctx, long i) { options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); - auto res = isl_val_read_from_str(ctx.release(), str.c_str()); + auto res = isl_val_int_from_si(ctx.release(), i); if (!res) throw exception::create_from_last_error(ctx); ptr = res; diff --git a/third-party/islpp b/third-party/islpp index 8f8a21665..f8cf7cf1b 160000 --- a/third-party/islpp +++ b/third-party/islpp @@ -1 +1 @@ -Subproject commit 8f8a21665883c8aef657e61947829f47c1a43fc0 +Subproject commit f8cf7cf1b0ca606d8adb0b88d60200c4a858d36c From 7a92509f4f6beedba34ddde39fa2039475f2cc19 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Mon, 2 Jul 2018 15:11:49 +0200 Subject: [PATCH 036/152] use isl option to force non-negative coefficients This reduces the dependence on the internals of isl. --- tc/core/mapping_options.cc | 40 -------------------------------------- tc/core/mapping_options.h | 9 --------- tc/core/polyhedral/scop.cc | 11 +++++------ 3 files changed, 5 insertions(+), 55 deletions(-) diff --git a/tc/core/mapping_options.cc b/tc/core/mapping_options.cc index 01f776c7c..20d4456c4 100644 --- a/tc/core/mapping_options.cc +++ b/tc/core/mapping_options.cc @@ -70,46 +70,6 @@ MappingOptionsView& MappingOptionsView::tile( // namespace callbacks { -// The ILP in basic set has the following dimensions: -// - sum of positive and negative parts of the dependence distance bound -// - constant term of the dependence distance bound -// - sum of parameter coefficients -// - sum of positive and negative parts of schedule coefficients -// - for each statement (in the order of id_list) -// - pairs of values representing schedule coefficients, in the order -// opposite to their order in the respective domain -// - parameter coefficients -// - constant term of the schedule -// Schedule coefficients are represented as a pair of non-negative -// dimensions (c_1 = c_1^+ - c_1^-), where the negative part comes first. -// XXX: FRAGILE! the order depends on the internal operation of the isl -// scheduler, which may change. This description is based on git-708721f. - -__isl_give isl_basic_set* AddPositiveCoefficientConstraints( - __isl_take isl_basic_set* lp, - int n_param, - int, - __isl_keep isl_id_list* stmt_ids, - int* node_n_params, - int* node_n_dims, - void*) { - int offset = 4 + 2 * n_param; - int n_node = isl_id_list_n_id(stmt_ids); - auto ilp = isl::manage(lp); - auto space = ilp.get_local_space(); - auto c = isl::constraint::alloc_equality(space); - for (int i = 0; i < n_node; ++i) { - for (int j = 0; j < 2 * node_n_dims[i]; j += 2) { - c = c.set_coefficient_si(isl::dim_type::set, offset + j, -1); - } - offset += 2 * node_n_dims[i] + node_n_params[i] + 1; - } - c = c.set_constant_si(0); - ilp = ilp.add_constraint(c); - - return ilp.release(); -} - // Fusion decisions. // These callbacks are called from the cluster merging process inside isl // scheduler. Current version of this process is two-stage. First, it diff --git a/tc/core/mapping_options.h b/tc/core/mapping_options.h index 8e28cf39f..4c2eeb723 100644 --- a/tc/core/mapping_options.h +++ b/tc/core/mapping_options.h @@ -365,15 +365,6 @@ class MappingOptions { }; namespace callbacks { -__isl_give isl_basic_set* AddPositiveCoefficientConstraints( - __isl_take isl_basic_set* lp, - int n_param, - int dim, - __isl_keep isl_id_list* stmt_ids, - int* node_n_params, - int* node_n_dims, - void*); - isl_bool FuseAllPreserve3Coincident( __isl_take isl_union_map* original_schedule, __isl_take isl_union_map* updated_schedule, diff --git a/tc/core/polyhedral/scop.cc b/tc/core/polyhedral/scop.cc index dcca86fe8..1d2252c22 100644 --- a/tc/core/polyhedral/scop.cc +++ b/tc/core/polyhedral/scop.cc @@ -327,12 +327,6 @@ isl::schedule_constraints makeScheduleConstraints( // Set up "add_schedule_constraints" and "merge_callback" // depending on the scheduler options. isl_schedule_constraints* sc = constraints.release(); - { - if (schedulerOptions.proto.positive_orthant()) { - sc = isl_schedule_constraints_set_custom_constraint_callback( - sc, callbacks::AddPositiveCoefficientConstraints, nullptr); - } - } { auto fusionStrategy = schedulerOptions.proto.fusion_strategy(); if (fusionStrategy == FusionStrategy::Max) { @@ -385,6 +379,7 @@ std::unique_ptr Scop::computeSchedule( auto wasSerializingSccs = isl_options_get_schedule_serialize_sccs(ctx.get()); auto wasUnit = isl_options_get_schedule_unit_max_var_coefficient_sum(ctx.get()); + auto wasNonNeg = isl_options_get_schedule_nonneg_var_coefficient(ctx.get()); isl_options_set_schedule_whole_component(ctx.get(), 0); if (schedulerOptions.proto.fusion_strategy() == FusionStrategy::Min) { isl_options_set_schedule_serialize_sccs(ctx.get(), 1); @@ -392,10 +387,14 @@ std::unique_ptr Scop::computeSchedule( if (!schedulerOptions.proto.allow_skewing()) { isl_options_set_schedule_unit_max_var_coefficient_sum(ctx.get(), 1); } + if (schedulerOptions.proto.positive_orthant()) { + isl_options_set_schedule_nonneg_var_coefficient(ctx.get(), 1); + } tc::ScopeGuard islOptionsResetter([&]() { isl_options_set_schedule_whole_component(ctx.get(), usedWholeComponent); isl_options_set_schedule_serialize_sccs(ctx.get(), wasSerializingSccs); isl_options_set_schedule_unit_max_var_coefficient_sum(ctx.get(), wasUnit); + isl_options_set_schedule_nonneg_var_coefficient(ctx.get(), wasNonNeg); }); return detail::fromIslSchedule(constraints.compute_schedule()); From d7f96887e61647f8e007cd098be068e478e37e95 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Fri, 13 Jul 2018 12:51:46 +0200 Subject: [PATCH 037/152] insertCopiesUnder: simplify before specializing The removal of insignificant tensor dimensions from the copying schedule does not depend on the specialization to the promotion space and can therefore be performed first. Performing the removal first will make it easier to apply the next commit. --- tc/core/polyhedral/memory_promotion.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tc/core/polyhedral/memory_promotion.cc b/tc/core/polyhedral/memory_promotion.cc index f892396e0..637b088f9 100644 --- a/tc/core/polyhedral/memory_promotion.cc +++ b/tc/core/polyhedral/memory_promotion.cc @@ -480,11 +480,11 @@ ScheduleTree* insertCopiesUnder( auto identityCopySchedule = isl::multi_aff::identity(promotionSpace.range().map_from_set()); - identityCopySchedule = - identityCopySchedule.pullback(isl::multi_aff::range_map(promotionSpace)); // Only iterate over significant tensor dimensions. auto decl = scop.promotedDecl(groupId); identityCopySchedule = dropDummyTensorDimensions(identityCopySchedule, decl); + identityCopySchedule = + identityCopySchedule.pullback(isl::multi_aff::range_map(promotionSpace)); auto readSchedule = isl::multi_union_pw_aff( identityCopySchedule.set_tuple_id(isl::dim_type::in, readId)); auto writeSchedule = isl::multi_union_pw_aff( From ade2dbf081adb1f107726a9a724a7ba41535e37c Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Fri, 13 Jul 2018 20:11:38 +0200 Subject: [PATCH 038/152] insertCopiesUnder: use isl::space::set_set_tuple_id In particular, set the identifier of the promotion space before specializing to this space (and use the newly introduced isl::multi_aff::wrapped_range_map to preserve the identifier). This removes a couple of uses of isl::dim_type, which will not be exported in mainline isl. --- tc/core/polyhedral/memory_promotion.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tc/core/polyhedral/memory_promotion.cc b/tc/core/polyhedral/memory_promotion.cc index 637b088f9..92eecc8e3 100644 --- a/tc/core/polyhedral/memory_promotion.cc +++ b/tc/core/polyhedral/memory_promotion.cc @@ -483,12 +483,12 @@ ScheduleTree* insertCopiesUnder( // Only iterate over significant tensor dimensions. auto decl = scop.promotedDecl(groupId); identityCopySchedule = dropDummyTensorDimensions(identityCopySchedule, decl); - identityCopySchedule = - identityCopySchedule.pullback(isl::multi_aff::range_map(promotionSpace)); - auto readSchedule = isl::multi_union_pw_aff( - identityCopySchedule.set_tuple_id(isl::dim_type::in, readId)); - auto writeSchedule = isl::multi_union_pw_aff( - identityCopySchedule.set_tuple_id(isl::dim_type::in, writeId)); + auto readSpace = promotionSpace.wrap().set_set_tuple_id(readId); + auto writeSpace = promotionSpace.wrap().set_set_tuple_id(writeId); + auto readSchedule = isl::multi_union_pw_aff(identityCopySchedule.pullback( + isl::multi_aff::wrapped_range_map(readSpace))); + auto writeSchedule = isl::multi_union_pw_aff(identityCopySchedule.pullback( + isl::multi_aff::wrapped_range_map(writeSpace))); auto readBandNode = ScheduleTree::makeBand(readSchedule); auto writeBandNode = ScheduleTree::makeBand(writeSchedule); From c305abcabec7199baa0b2ec0bd70a28e04c68ada Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Fri, 13 Jul 2018 16:35:23 +0200 Subject: [PATCH 039/152] insertCopiesUnder: use isl::space::get_map_range_tuple_id This removes a use of isl::dim_type, which will not be exported in mainline isl. --- tc/core/polyhedral/memory_promotion.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tc/core/polyhedral/memory_promotion.cc b/tc/core/polyhedral/memory_promotion.cc index 92eecc8e3..d049faaa4 100644 --- a/tc/core/polyhedral/memory_promotion.cc +++ b/tc/core/polyhedral/memory_promotion.cc @@ -508,8 +508,7 @@ ScheduleTree* insertCopiesUnder( auto promotedFootprint = group.promotedFootprint().set_tuple_id(groupId); auto scheduleUniverse = isl::set::universe(promotionSpace.domain().unwrap().domain()); - auto arrayId = - promotionSpace.domain().unwrap().get_tuple_id(isl::dim_type::out); + auto arrayId = promotionSpace.domain().unwrap().get_map_range_tuple_id(); auto approximatedRead = group.approximateScopedAccesses().intersect_range(tensorElements).wrap(); approximatedRead = approximatedRead.product(promotedFootprint); From e4ced9c9aca8868b9d9a7295f1d54189415d8c43 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Fri, 13 Jul 2018 11:12:09 +0200 Subject: [PATCH 040/152] insertCopiesUnder: use isl::map::set_range_tuple_id This removes some uses of isl::dim_type, which will not be exported in mainline isl. --- tc/core/polyhedral/memory_promotion.cc | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tc/core/polyhedral/memory_promotion.cc b/tc/core/polyhedral/memory_promotion.cc index d049faaa4..0d51718de 100644 --- a/tc/core/polyhedral/memory_promotion.cc +++ b/tc/core/polyhedral/memory_promotion.cc @@ -474,8 +474,7 @@ ScheduleTree* insertCopiesUnder( // Take the set of all tensor elements. auto tensorElements = tensorElementsSet(scop, tensorId); - auto promotion = - isl::map(group.promotion()).set_tuple_id(isl::dim_type::out, groupId); + auto promotion = isl::map(group.promotion()).set_range_tuple_id(groupId); auto promotionSpace = promotion.get_space(); auto identityCopySchedule = @@ -512,13 +511,13 @@ ScheduleTree* insertCopiesUnder( auto approximatedRead = group.approximateScopedAccesses().intersect_range(tensorElements).wrap(); approximatedRead = approximatedRead.product(promotedFootprint); - auto readExtension = extension.intersect_range(approximatedRead) - .set_tuple_id(isl::dim_type::out, readId); + auto readExtension = + extension.intersect_range(approximatedRead).set_range_tuple_id(readId); auto writtenElements = group.scopedWrites().intersect_range(tensorElements).wrap(); writtenElements = writtenElements.product(promotedFootprint); - auto writeExtension = extension.intersect_range(writtenElements) - .set_tuple_id(isl::dim_type::out, writeId); + auto writeExtension = + extension.intersect_range(writtenElements).set_range_tuple_id(writeId); auto readFilterNode = ScheduleTree::makeFilter( isl::set::universe(readExtension.get_space().range()), From ede77d70d43ed70eeccf336b342364664d584468 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Fri, 13 Jul 2018 10:26:48 +0200 Subject: [PATCH 041/152] addSingletonReferenceGroups: use isl::map::get_range_tuple_id This removes a use of isl::dim_type, which will not be exported in mainline isl. --- tc/core/polyhedral/memory_promotion.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tc/core/polyhedral/memory_promotion.cc b/tc/core/polyhedral/memory_promotion.cc index 0d51718de..18826fd87 100644 --- a/tc/core/polyhedral/memory_promotion.cc +++ b/tc/core/polyhedral/memory_promotion.cc @@ -306,7 +306,7 @@ void addSingletonReferenceGroups( continue; } - auto tensorId = a.get_tuple_id(isl::dim_type::out); + auto tensorId = a.get_range_tuple_id(); if (unapproximatable.count(tensorId) != 0) { continue; } From 47c99dfce540e9d69dd8d5857e5823ef95787b38 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Fri, 13 Jul 2018 16:35:23 +0200 Subject: [PATCH 042/152] TensorReferenceGroup::makeSingleton: use isl::space::get_map_range_tuple_id This removes a use of isl::dim_type, which will not be exported in mainline isl. --- tc/core/polyhedral/memory_promotion.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tc/core/polyhedral/memory_promotion.cc b/tc/core/polyhedral/memory_promotion.cc index 18826fd87..bc6fae88b 100644 --- a/tc/core/polyhedral/memory_promotion.cc +++ b/tc/core/polyhedral/memory_promotion.cc @@ -87,8 +87,8 @@ std::unique_ptr TensorReferenceGroup::makeSingleton( isl::map scopedAccess, AccessType type) { auto ref = std::unique_ptr(new TensorReference); - auto refId = scopedAccess.get_space().domain().unwrap().get_tuple_id( - isl::dim_type::out); + auto refId = + scopedAccess.get_space().domain().unwrap().get_map_range_tuple_id(); scopedAccess = scopedAccess.domain_factor_domain(); ref->originalAccess = originalAccess.domain_factor_domain(); ref->scopedAccess = scopedAccess; From 0ec5785ca914182d5c78de4b3ca620d138d86ea9 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Fri, 13 Jul 2018 10:57:11 +0200 Subject: [PATCH 043/152] CodegenStatementContext: use isl::pw_multi_aff::get_range_tuple_id This removes a use of isl::dim_type, which will not be exported in mainline isl. --- tc/core/polyhedral/cuda/codegen.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tc/core/polyhedral/cuda/codegen.h b/tc/core/polyhedral/cuda/codegen.h index d2d0a8955..438fbf938 100644 --- a/tc/core/polyhedral/cuda/codegen.h +++ b/tc/core/polyhedral/cuda/codegen.h @@ -114,7 +114,7 @@ struct CodegenStatementContext : CodegenContext { return this->nodeInfoMap.at(astNodeId).build; } isl::id statementId() const { - return this->iteratorMap().get_tuple_id(isl::dim_type::out); + return this->iteratorMap().get_range_tuple_id(); } isl::set domain() const { return isl::map::from(this->iteratorMap()).range(); From a10ebf88df2d06bb7ece3abd56375d50b5501e72 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Fri, 13 Jul 2018 12:07:53 +0200 Subject: [PATCH 044/152] emitRegisterAccess: use isl::multi_pw_aff::get_range_tuple_id This removes a use of isl::dim_type, which will not be exported in mainline isl. --- tc/core/polyhedral/cuda/codegen.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tc/core/polyhedral/cuda/codegen.cc b/tc/core/polyhedral/cuda/codegen.cc index bcca9e852..8bbd9053d 100644 --- a/tc/core/polyhedral/cuda/codegen.cc +++ b/tc/core/polyhedral/cuda/codegen.cc @@ -438,7 +438,7 @@ void emitRegisterAccess( void emitGlobalAccess( isl::multi_pw_aff access, const CodegenStatementContext& context) { - LdgWrapper ldgWrapper(context, access.get_tuple_id(isl::dim_type::out)); + LdgWrapper ldgWrapper(context, access.get_range_tuple_id()); emitAccess(access, context); } } // namespace From 33f51a0719edfdba6b0fdd8b1827a1390eace322 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Mon, 16 Jul 2018 09:47:41 +0200 Subject: [PATCH 045/152] emitMappedTensorAccess: use isl::multi_aff::set_range_tuple_id This removes a use of isl::dim_type, which will not be exported in mainline isl. --- tc/core/polyhedral/cuda/codegen.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tc/core/polyhedral/cuda/codegen.cc b/tc/core/polyhedral/cuda/codegen.cc index 8bbd9053d..ab8d49b91 100644 --- a/tc/core/polyhedral/cuda/codegen.cc +++ b/tc/core/polyhedral/cuda/codegen.cc @@ -674,7 +674,7 @@ void emitMappedTensorAccess( auto access = makeMultiAffAccess(tensorId, subscripts, context); // MA :: D -> O auto promotion = promotionInfo.group->promotion(); // MA :: [S -> O] -> P - promotion = promotion.set_tuple_id(isl::dim_type::out, promotionInfo.groupId); + promotion = promotion.set_range_tuple_id(promotionInfo.groupId); auto iteratorMap = context.iteratorMap(); // PMA :: A -> D auto schedule = isl::map::from_union_map(promotionInfo.outerSchedule.intersect_domain( From 897352e444bc0579fdc7da9c1a1b9c2c2be534fa Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Wed, 18 Jul 2018 10:42:33 +0200 Subject: [PATCH 046/152] bump isl for dropping dim_type --- isl_interface/include/isl/cpp.h | 1048 +++---------------------------- third-party/islpp | 2 +- 2 files changed, 95 insertions(+), 955 deletions(-) diff --git a/isl_interface/include/isl/cpp.h b/isl_interface/include/isl/cpp.h index 8a9256634..c8648ad3b 100644 --- a/isl_interface/include/isl/cpp.h +++ b/isl_interface/include/isl/cpp.h @@ -21,7 +21,6 @@ #include #include #include -#include #include #include @@ -195,16 +194,6 @@ class options_scoped_set_on_error { } }; -enum class dim_type { - cst = isl_dim_cst, - param = isl_dim_param, - in = isl_dim_in, - out = isl_dim_out, - set = isl_dim_set, - div = isl_dim_div, - all = isl_dim_all -}; - enum class ast_loop_type { error = isl_ast_loop_error, _default = isl_ast_loop_default, @@ -262,8 +251,6 @@ class basic_map; class basic_map_list; class basic_set; class basic_set_list; -class constraint; -class constraint_list; class fixed_box; class id; class id_list; @@ -1305,7 +1292,6 @@ class basic_map { inline isl::ctx get_ctx() const; inline std::string to_str() const; - inline isl::basic_map add_constraint(isl::constraint constraint) const; inline isl::basic_map affine_hull() const; inline isl::basic_map apply_domain(isl::basic_map bmap2) const; inline isl::basic_map apply_range(isl::basic_map bmap2) const; @@ -1319,10 +1305,8 @@ class basic_map { inline isl::basic_map flatten() const; inline isl::basic_map flatten_domain() const; inline isl::basic_map flatten_range() const; - inline void foreach_constraint(const std::function &fn) const; static inline isl::basic_map from_domain(isl::basic_set bset); static inline isl::basic_map from_range(isl::basic_set bset); - inline isl::constraint_list get_constraint_list() const; inline isl::space get_space() const; inline isl::basic_map gist(isl::basic_map context) const; inline isl::basic_map intersect(isl::basic_map bmap2) const; @@ -1333,7 +1317,6 @@ class basic_map { inline bool is_subset(const isl::basic_map &bmap2) const; inline isl::map lexmax() const; inline isl::map lexmin() const; - inline int n_constraint() const; inline isl::basic_map reverse() const; inline isl::basic_map sample() const; inline isl::basic_map uncurry() const; @@ -1410,17 +1393,13 @@ class basic_set { inline isl::ctx get_ctx() const; inline std::string to_str() const; - inline isl::basic_set add_constraint(isl::constraint constraint) const; inline isl::basic_set affine_hull() const; inline isl::basic_set apply(isl::basic_map bmap) const; inline isl::set compute_divs() const; inline isl::basic_set detect_equalities() const; inline isl::val dim_max_val(int pos) const; inline isl::basic_set flatten() const; - inline void foreach_constraint(const std::function &fn) const; inline isl::basic_set from_params() const; - inline isl::constraint_list get_constraint_list() const; - inline isl::local_space get_local_space() const; inline isl::space get_space() const; inline isl::basic_set gist(isl::basic_set context) const; inline isl::basic_set intersect(isl::basic_set bset2) const; @@ -1433,7 +1412,6 @@ class basic_set { inline isl::set lexmax() const; inline isl::set lexmin() const; inline isl::val max_val(const isl::aff &obj) const; - inline int n_constraint() const; inline unsigned int n_dim() const; inline unsigned int n_param() const; static inline isl::basic_set nat_universe(isl::space dim); @@ -1486,88 +1464,6 @@ class basic_set_list { typedef isl_basic_set_list* isl_ptr_t; }; -// declarations for isl::constraint -inline isl::constraint manage(__isl_take isl_constraint *ptr); -inline isl::constraint manage_copy(__isl_keep isl_constraint *ptr); - -class constraint { - friend inline isl::constraint manage(__isl_take isl_constraint *ptr); - friend inline isl::constraint manage_copy(__isl_keep isl_constraint *ptr); - -protected: - isl_constraint *ptr = nullptr; - - inline explicit constraint(__isl_take isl_constraint *ptr); - -public: - inline /* implicit */ constraint(); - inline /* implicit */ constraint(const isl::constraint &obj); - inline isl::constraint &operator=(isl::constraint obj); - inline ~constraint(); - inline __isl_give isl_constraint *copy() const &; - inline __isl_give isl_constraint *copy() && = delete; - inline __isl_keep isl_constraint *get() const; - inline __isl_give isl_constraint *release(); - inline bool is_null() const; - inline explicit operator bool() const; - inline isl::ctx get_ctx() const; - - static inline isl::constraint alloc_equality(isl::local_space ls); - static inline isl::constraint alloc_inequality(isl::local_space ls); - inline int cmp_last_non_zero(const isl::constraint &c2) const; - inline isl::aff get_aff() const; - inline isl::val get_constant_val() const; - inline isl::aff get_div(int pos) const; - inline isl::local_space get_local_space() const; - inline isl::space get_space() const; - inline int is_div_constraint() const; - inline bool is_equal(const isl::constraint &constraint2) const; - inline bool is_equality() const; - inline int plain_cmp(const isl::constraint &c2) const; - inline isl::constraint set_coefficient_si(enum isl::dim_type type, int pos, int v) const; - inline isl::constraint set_constant_si(int v) const; - inline isl::constraint set_constant_val(isl::val v) const; - typedef isl_constraint* isl_ptr_t; -}; - -// declarations for isl::constraint_list -inline isl::constraint_list manage(__isl_take isl_constraint_list *ptr); -inline isl::constraint_list manage_copy(__isl_keep isl_constraint_list *ptr); - -class constraint_list { - friend inline isl::constraint_list manage(__isl_take isl_constraint_list *ptr); - friend inline isl::constraint_list manage_copy(__isl_keep isl_constraint_list *ptr); - -protected: - isl_constraint_list *ptr = nullptr; - - inline explicit constraint_list(__isl_take isl_constraint_list *ptr); - -public: - inline /* implicit */ constraint_list(); - inline /* implicit */ constraint_list(const isl::constraint_list &obj); - inline explicit constraint_list(isl::constraint el); - inline explicit constraint_list(isl::ctx ctx, int n); - inline isl::constraint_list &operator=(isl::constraint_list obj); - inline ~constraint_list(); - inline __isl_give isl_constraint_list *copy() const &; - inline __isl_give isl_constraint_list *copy() && = delete; - inline __isl_keep isl_constraint_list *get() const; - inline __isl_give isl_constraint_list *release(); - inline bool is_null() const; - inline explicit operator bool() const; - inline isl::ctx get_ctx() const; - - inline isl::constraint_list add(isl::constraint el) const; - inline isl::constraint_list concat(isl::constraint_list list2) const; - inline isl::constraint_list drop(unsigned int first, unsigned int n) const; - inline void foreach(const std::function &fn) const; - inline isl::constraint get_at(int index) const; - inline isl::constraint_list reverse() const; - inline int size() const; - typedef isl_constraint_list* isl_ptr_t; -}; - // declarations for isl::fixed_box inline isl::fixed_box manage(__isl_take isl_fixed_box *ptr); inline isl::fixed_box manage_copy(__isl_keep isl_fixed_box *ptr); @@ -1746,7 +1642,6 @@ class map { inline isl::ctx get_ctx() const; inline std::string to_str() const; - inline isl::map add_constraint(isl::constraint constraint) const; inline isl::basic_map affine_hull() const; inline isl::map apply_domain(isl::map map2) const; inline isl::map apply_range(isl::map map2) const; @@ -1778,7 +1673,6 @@ class map { inline isl::stride_info get_range_stride_info(int pos) const; inline isl::id get_range_tuple_id() const; inline isl::space get_space() const; - inline isl::id get_tuple_id(enum isl::dim_type type) const; inline isl::map gist(isl::map context) const; inline isl::map gist_domain(isl::set context) const; static inline isl::map identity(isl::space dim); @@ -1810,7 +1704,6 @@ class map { inline isl::map reverse() const; inline isl::basic_map sample() const; inline isl::map set_range_tuple_id(isl::id id) const; - inline isl::map set_tuple_id(enum isl::dim_type type, isl::id id) const; inline isl::basic_map simple_hull() const; inline isl::map subtract(isl::map map2) const; inline isl::map sum(isl::map map2) const; @@ -1904,7 +1797,6 @@ class multi_aff { inline isl::space get_domain_space() const; inline isl::id get_range_tuple_id() const; inline isl::space get_space() const; - inline isl::id get_tuple_id(enum isl::dim_type type) const; static inline isl::multi_aff identity(isl::space space); inline isl::multi_aff mod(isl::multi_val mv) const; inline isl::multi_aff neg() const; @@ -1922,7 +1814,6 @@ class multi_aff { inline isl::multi_aff scale_down(isl::multi_val mv) const; inline isl::multi_aff set_aff(int pos, isl::aff el) const; inline isl::multi_aff set_range_tuple_id(isl::id id) const; - inline isl::multi_aff set_tuple_id(enum isl::dim_type type, isl::id id) const; inline int size() const; inline isl::multi_aff splice(unsigned int in_pos, unsigned int out_pos, isl::multi_aff multi2) const; inline isl::multi_aff sub(isl::multi_aff multi2) const; @@ -2023,7 +1914,6 @@ class multi_pw_aff { inline isl::pw_aff_list get_pw_aff_list() const; inline isl::id get_range_tuple_id() const; inline isl::space get_space() const; - inline isl::id get_tuple_id(enum isl::dim_type type) const; static inline isl::multi_pw_aff identity(isl::space space); inline bool is_equal(const isl::multi_pw_aff &mpa2) const; inline isl::multi_pw_aff mod(isl::multi_val mv) const; @@ -2043,7 +1933,6 @@ class multi_pw_aff { inline isl::multi_pw_aff scale_down(isl::multi_val mv) const; inline isl::multi_pw_aff set_pw_aff(int pos, isl::pw_aff el) const; inline isl::multi_pw_aff set_range_tuple_id(isl::id id) const; - inline isl::multi_pw_aff set_tuple_id(enum isl::dim_type type, isl::id id) const; inline int size() const; inline isl::multi_pw_aff splice(unsigned int in_pos, unsigned int out_pos, isl::multi_pw_aff multi2) const; inline isl::multi_pw_aff sub(isl::multi_pw_aff multi2) const; @@ -2067,11 +1956,11 @@ class multi_union_pw_aff { public: inline /* implicit */ multi_union_pw_aff(); inline /* implicit */ multi_union_pw_aff(const isl::multi_union_pw_aff &obj); - inline explicit multi_union_pw_aff(isl::union_set domain, isl::multi_val mv); inline explicit multi_union_pw_aff(isl::union_set domain, isl::multi_aff ma); inline explicit multi_union_pw_aff(isl::space space, isl::union_pw_aff_list list); inline /* implicit */ multi_union_pw_aff(isl::union_pw_aff upa); inline /* implicit */ multi_union_pw_aff(isl::multi_pw_aff mpa); + inline explicit multi_union_pw_aff(isl::union_set domain, isl::multi_val mv); inline explicit multi_union_pw_aff(isl::ctx ctx, const std::string &str); inline isl::multi_union_pw_aff &operator=(isl::multi_union_pw_aff obj); inline ~multi_union_pw_aff(); @@ -2100,7 +1989,6 @@ class multi_union_pw_aff { inline isl::space get_domain_space() const; inline isl::id get_range_tuple_id() const; inline isl::space get_space() const; - inline isl::id get_tuple_id(enum isl::dim_type type) const; inline isl::union_pw_aff get_union_pw_aff(int pos) const; inline isl::union_pw_aff_list get_union_pw_aff_list() const; inline isl::multi_union_pw_aff gist(isl::union_set context) const; @@ -2122,7 +2010,6 @@ class multi_union_pw_aff { inline isl::multi_union_pw_aff scale_down(isl::val v) const; inline isl::multi_union_pw_aff scale_down(isl::multi_val mv) const; inline isl::multi_union_pw_aff set_range_tuple_id(isl::id id) const; - inline isl::multi_union_pw_aff set_tuple_id(enum isl::dim_type type, isl::id id) const; inline isl::multi_union_pw_aff set_union_pw_aff(int pos, isl::union_pw_aff el) const; inline int size() const; inline isl::multi_union_pw_aff sub(isl::multi_union_pw_aff multi2) const; @@ -2170,7 +2057,6 @@ class multi_val { inline isl::space get_domain_space() const; inline isl::id get_range_tuple_id() const; inline isl::space get_space() const; - inline isl::id get_tuple_id(enum isl::dim_type type) const; inline isl::val get_val(int pos) const; inline isl::val_list get_val_list() const; inline isl::multi_val mod(isl::multi_val mv) const; @@ -2186,7 +2072,6 @@ class multi_val { inline isl::multi_val scale_down(isl::val v) const; inline isl::multi_val scale_down(isl::multi_val mv) const; inline isl::multi_val set_range_tuple_id(isl::id id) const; - inline isl::multi_val set_tuple_id(enum isl::dim_type type, isl::id id) const; inline isl::multi_val set_val(int pos, isl::val el) const; inline int size() const; inline isl::multi_val splice(unsigned int in_pos, unsigned int out_pos, isl::multi_val multi2) const; @@ -2379,7 +2264,6 @@ class pw_multi_aff { inline isl::pw_aff get_pw_aff(int pos) const; inline isl::id get_range_tuple_id() const; inline isl::space get_space() const; - inline isl::id get_tuple_id(enum isl::dim_type type) const; static inline isl::pw_multi_aff identity(isl::space space); inline bool is_equal(const isl::pw_multi_aff &pma2) const; inline int n_piece() const; @@ -2840,7 +2724,6 @@ class set { inline isl::ctx get_ctx() const; inline std::string to_str() const; - inline isl::set add_constraint(isl::constraint constraint) const; inline isl::basic_set affine_hull() const; inline isl::set align_params(isl::space model) const; inline isl::set apply(isl::map map) const; @@ -2987,7 +2870,6 @@ class space { inline isl::space from_domain() const; inline isl::space from_range() const; inline isl::id get_map_range_tuple_id() const; - inline isl::id get_tuple_id(enum isl::dim_type type) const; inline bool has_equal_params(const isl::space &space2) const; inline bool has_equal_tuples(const isl::space &space2) const; inline bool has_param(const isl::id &id) const; @@ -6979,18 +6861,6 @@ isl::ctx basic_map::get_ctx() const { return isl::ctx(isl_basic_map_get_ctx(ptr)); } -isl::basic_map basic_map::add_constraint(isl::constraint constraint) const -{ - if (!ptr || constraint.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_basic_map_add_constraint(copy(), constraint.release()); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - isl::basic_map basic_map::affine_hull() const { if (!ptr) @@ -7148,34 +7018,6 @@ isl::basic_map basic_map::flatten_range() const return manage(res); } -void basic_map::foreach_constraint(const std::function &fn) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - struct fn_data { - std::function func; - std::exception_ptr eptr; - } fn_data = { fn }; - auto fn_lambda = [](isl_constraint *arg_0, void *arg_1) -> isl_stat { - auto *data = static_cast(arg_1); - try { - (data->func)(isl::manage(arg_0)); - return isl_stat_ok; - } catch (...) { - data->eptr = std::current_exception(); - return isl_stat_error; - } - }; - auto res = isl_basic_map_foreach_constraint(get(), fn_lambda, &fn_data); - if (fn_data.eptr) - std::rethrow_exception(fn_data.eptr); - if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return void(res); -} - isl::basic_map basic_map::from_domain(isl::basic_set bset) { if (bset.is_null()) @@ -7202,18 +7044,6 @@ isl::basic_map basic_map::from_range(isl::basic_set bset) return manage(res); } -isl::constraint_list basic_map::get_constraint_list() const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_basic_map_get_constraint_list(get()); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - isl::space basic_map::get_space() const { if (!ptr) @@ -7334,16 +7164,6 @@ isl::map basic_map::lexmin() const return manage(res); } -int basic_map::n_constraint() const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_basic_map_n_constraint(get()); - return res; -} - isl::basic_map basic_map::reverse() const { if (!ptr) @@ -7712,18 +7532,6 @@ isl::ctx basic_set::get_ctx() const { return isl::ctx(isl_basic_set_get_ctx(ptr)); } -isl::basic_set basic_set::add_constraint(isl::constraint constraint) const -{ - if (!ptr || constraint.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_basic_set_add_constraint(copy(), constraint.release()); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - isl::basic_set basic_set::affine_hull() const { if (!ptr) @@ -7796,34 +7604,6 @@ isl::basic_set basic_set::flatten() const return manage(res); } -void basic_set::foreach_constraint(const std::function &fn) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - struct fn_data { - std::function func; - std::exception_ptr eptr; - } fn_data = { fn }; - auto fn_lambda = [](isl_constraint *arg_0, void *arg_1) -> isl_stat { - auto *data = static_cast(arg_1); - try { - (data->func)(isl::manage(arg_0)); - return isl_stat_ok; - } catch (...) { - data->eptr = std::current_exception(); - return isl_stat_error; - } - }; - auto res = isl_basic_set_foreach_constraint(get(), fn_lambda, &fn_data); - if (fn_data.eptr) - std::rethrow_exception(fn_data.eptr); - if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return void(res); -} - isl::basic_set basic_set::from_params() const { if (!ptr) @@ -7836,30 +7616,6 @@ isl::basic_set basic_set::from_params() const return manage(res); } -isl::constraint_list basic_set::get_constraint_list() const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_basic_set_get_constraint_list(get()); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - -isl::local_space basic_set::get_local_space() const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_basic_set_get_local_space(get()); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - isl::space basic_set::get_space() const { if (!ptr) @@ -8004,16 +7760,6 @@ isl::val basic_set::max_val(const isl::aff &obj) const return manage(res); } -int basic_set::n_constraint() const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_basic_set_n_constraint(get()); - return res; -} - unsigned int basic_set::n_dim() const { if (!ptr) @@ -8036,689 +7782,251 @@ unsigned int basic_set::n_param() const isl::basic_set basic_set::nat_universe(isl::space dim) { - if (dim.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - auto ctx = dim.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); - auto res = isl_basic_set_nat_universe(dim.release()); - if (!res) - throw exception::create_from_last_error(ctx); - return manage(res); -} - -isl::basic_set basic_set::params() const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_basic_set_params(copy()); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - -bool basic_set::plain_is_universe() const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_basic_set_plain_is_universe(get()); - if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; -} - -isl::basic_set basic_set::sample() const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_basic_set_sample(copy()); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - -isl::point basic_set::sample_point() const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_basic_set_sample_point(copy()); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - -isl::basic_set basic_set::set_tuple_id(isl::id id) const -{ - if (!ptr || id.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_basic_set_set_tuple_id(copy(), id.release()); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - -isl::set basic_set::unite(isl::basic_set bset2) const -{ - if (!ptr || bset2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_basic_set_union(copy(), bset2.release()); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - -isl::basic_set basic_set::universe(isl::space space) -{ - if (space.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); - auto res = isl_basic_set_universe(space.release()); - if (!res) - throw exception::create_from_last_error(ctx); - return manage(res); -} - -isl::basic_map basic_set::unwrap() const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_basic_set_unwrap(copy()); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - -// implementations for isl::basic_set_list -isl::basic_set_list manage(__isl_take isl_basic_set_list *ptr) { - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - return basic_set_list(ptr); -} -isl::basic_set_list manage_copy(__isl_keep isl_basic_set_list *ptr) { - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - auto ctx = isl_basic_set_list_get_ctx(ptr); - ptr = isl_basic_set_list_copy(ptr); - if (!ptr) - throw exception::create_from_last_error(ctx); - return basic_set_list(ptr); -} - -basic_set_list::basic_set_list() - : ptr(nullptr) {} - -basic_set_list::basic_set_list(const isl::basic_set_list &obj) - : ptr(obj.copy()) -{ - if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_basic_set_list_get_ctx(obj.ptr)); -} - -basic_set_list::basic_set_list(__isl_take isl_basic_set_list *ptr) - : ptr(ptr) {} - -basic_set_list::basic_set_list(isl::basic_set el) -{ - if (el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - auto ctx = el.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); - auto res = isl_basic_set_list_from_basic_set(el.release()); - if (!res) - throw exception::create_from_last_error(ctx); - ptr = res; -} -basic_set_list::basic_set_list(isl::ctx ctx, int n) -{ - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); - auto res = isl_basic_set_list_alloc(ctx.release(), n); - if (!res) - throw exception::create_from_last_error(ctx); - ptr = res; -} - -basic_set_list &basic_set_list::operator=(isl::basic_set_list obj) { - std::swap(this->ptr, obj.ptr); - return *this; -} - -basic_set_list::~basic_set_list() { - if (ptr) - isl_basic_set_list_free(ptr); -} - -__isl_give isl_basic_set_list *basic_set_list::copy() const & { - return isl_basic_set_list_copy(ptr); -} - -__isl_keep isl_basic_set_list *basic_set_list::get() const { - return ptr; -} - -__isl_give isl_basic_set_list *basic_set_list::release() { - isl_basic_set_list *tmp = ptr; - ptr = nullptr; - return tmp; -} - -bool basic_set_list::is_null() const { - return ptr == nullptr; -} -basic_set_list::operator bool() const -{ - return !is_null(); -} - - - -isl::ctx basic_set_list::get_ctx() const { - return isl::ctx(isl_basic_set_list_get_ctx(ptr)); -} - -isl::basic_set_list basic_set_list::add(isl::basic_set el) const -{ - if (!ptr || el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_basic_set_list_add(copy(), el.release()); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - -isl::basic_set_list basic_set_list::concat(isl::basic_set_list list2) const -{ - if (!ptr || list2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_basic_set_list_concat(copy(), list2.release()); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - -isl::basic_set_list basic_set_list::drop(unsigned int first, unsigned int n) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_basic_set_list_drop(copy(), first, n); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - -void basic_set_list::foreach(const std::function &fn) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - struct fn_data { - std::function func; - std::exception_ptr eptr; - } fn_data = { fn }; - auto fn_lambda = [](isl_basic_set *arg_0, void *arg_1) -> isl_stat { - auto *data = static_cast(arg_1); - try { - (data->func)(isl::manage(arg_0)); - return isl_stat_ok; - } catch (...) { - data->eptr = std::current_exception(); - return isl_stat_error; - } - }; - auto res = isl_basic_set_list_foreach(get(), fn_lambda, &fn_data); - if (fn_data.eptr) - std::rethrow_exception(fn_data.eptr); - if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return void(res); -} - -isl::basic_set basic_set_list::get_at(int index) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_basic_set_list_get_at(get(), index); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - -isl::basic_set_list basic_set_list::reverse() const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_basic_set_list_reverse(copy()); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - -int basic_set_list::size() const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_basic_set_list_size(get()); - return res; -} - -// implementations for isl::constraint -isl::constraint manage(__isl_take isl_constraint *ptr) { - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - return constraint(ptr); -} -isl::constraint manage_copy(__isl_keep isl_constraint *ptr) { - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - auto ctx = isl_constraint_get_ctx(ptr); - ptr = isl_constraint_copy(ptr); - if (!ptr) - throw exception::create_from_last_error(ctx); - return constraint(ptr); -} - -constraint::constraint() - : ptr(nullptr) {} - -constraint::constraint(const isl::constraint &obj) - : ptr(obj.copy()) -{ - if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_constraint_get_ctx(obj.ptr)); -} - -constraint::constraint(__isl_take isl_constraint *ptr) - : ptr(ptr) {} - - -constraint &constraint::operator=(isl::constraint obj) { - std::swap(this->ptr, obj.ptr); - return *this; -} - -constraint::~constraint() { - if (ptr) - isl_constraint_free(ptr); -} - -__isl_give isl_constraint *constraint::copy() const & { - return isl_constraint_copy(ptr); -} - -__isl_keep isl_constraint *constraint::get() const { - return ptr; -} - -__isl_give isl_constraint *constraint::release() { - isl_constraint *tmp = ptr; - ptr = nullptr; - return tmp; -} - -bool constraint::is_null() const { - return ptr == nullptr; -} -constraint::operator bool() const -{ - return !is_null(); -} - -inline bool operator==(const constraint& C1, const constraint& C2) { - return C1.is_equal(C2); -} - - - -isl::ctx constraint::get_ctx() const { - return isl::ctx(isl_constraint_get_ctx(ptr)); -} - -isl::constraint constraint::alloc_equality(isl::local_space ls) -{ - if (ls.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - auto ctx = ls.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); - auto res = isl_constraint_alloc_equality(ls.release()); - if (!res) - throw exception::create_from_last_error(ctx); - return manage(res); -} - -isl::constraint constraint::alloc_inequality(isl::local_space ls) -{ - if (ls.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - auto ctx = ls.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); - auto res = isl_constraint_alloc_inequality(ls.release()); - if (!res) - throw exception::create_from_last_error(ctx); - return manage(res); -} - -int constraint::cmp_last_non_zero(const isl::constraint &c2) const -{ - if (!ptr || c2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_constraint_cmp_last_non_zero(get(), c2.get()); - return res; -} - -isl::aff constraint::get_aff() const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_constraint_get_aff(get()); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - -isl::val constraint::get_constant_val() const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_constraint_get_constant_val(get()); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - -isl::aff constraint::get_div(int pos) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_constraint_get_div(get(), pos); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - -isl::local_space constraint::get_local_space() const -{ - if (!ptr) + if (dim.is_null()) throw isl::exception::create(isl_error_invalid, "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_constraint_get_local_space(get()); + auto ctx = dim.get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + auto res = isl_basic_set_nat_universe(dim.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + throw exception::create_from_last_error(ctx); return manage(res); } -isl::space constraint::get_space() const +isl::basic_set basic_set::params() const { if (!ptr) throw isl::exception::create(isl_error_invalid, "NULL input", __FILE__, __LINE__); options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_constraint_get_space(get()); + auto res = isl_basic_set_params(copy()); if (!res) throw exception::create_from_last_error(get_ctx()); return manage(res); } -int constraint::is_div_constraint() const +bool basic_set::plain_is_universe() const { if (!ptr) throw isl::exception::create(isl_error_invalid, "NULL input", __FILE__, __LINE__); options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_constraint_is_div_constraint(get()); + auto res = isl_basic_set_plain_is_universe(get()); + if (res < 0) + throw exception::create_from_last_error(get_ctx()); return res; } -bool constraint::is_equal(const isl::constraint &constraint2) const +isl::basic_set basic_set::sample() const { - if (!ptr || constraint2.is_null()) + if (!ptr) throw isl::exception::create(isl_error_invalid, "NULL input", __FILE__, __LINE__); options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_constraint_is_equal(get(), constraint2.get()); - if (res < 0) + auto res = isl_basic_set_sample(copy()); + if (!res) throw exception::create_from_last_error(get_ctx()); - return res; + return manage(res); } -bool constraint::is_equality() const +isl::point basic_set::sample_point() const { if (!ptr) throw isl::exception::create(isl_error_invalid, "NULL input", __FILE__, __LINE__); options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_constraint_is_equality(get()); - if (res < 0) + auto res = isl_basic_set_sample_point(copy()); + if (!res) throw exception::create_from_last_error(get_ctx()); - return res; + return manage(res); } -int constraint::plain_cmp(const isl::constraint &c2) const +isl::basic_set basic_set::set_tuple_id(isl::id id) const { - if (!ptr || c2.is_null()) + if (!ptr || id.is_null()) throw isl::exception::create(isl_error_invalid, "NULL input", __FILE__, __LINE__); options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_constraint_plain_cmp(get(), c2.get()); - return res; + auto res = isl_basic_set_set_tuple_id(copy(), id.release()); + if (!res) + throw exception::create_from_last_error(get_ctx()); + return manage(res); } -isl::constraint constraint::set_coefficient_si(enum isl::dim_type type, int pos, int v) const +isl::set basic_set::unite(isl::basic_set bset2) const { - if (!ptr) + if (!ptr || bset2.is_null()) throw isl::exception::create(isl_error_invalid, "NULL input", __FILE__, __LINE__); options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_constraint_set_coefficient_si(copy(), static_cast(type), pos, v); + auto res = isl_basic_set_union(copy(), bset2.release()); if (!res) throw exception::create_from_last_error(get_ctx()); return manage(res); } -isl::constraint constraint::set_constant_si(int v) const +isl::basic_set basic_set::universe(isl::space space) { - if (!ptr) + if (space.is_null()) throw isl::exception::create(isl_error_invalid, "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_constraint_set_constant_si(copy(), v); + auto ctx = space.get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + auto res = isl_basic_set_universe(space.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + throw exception::create_from_last_error(ctx); return manage(res); } -isl::constraint constraint::set_constant_val(isl::val v) const +isl::basic_map basic_set::unwrap() const { - if (!ptr || v.is_null()) + if (!ptr) throw isl::exception::create(isl_error_invalid, "NULL input", __FILE__, __LINE__); options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_constraint_set_constant_val(copy(), v.release()); + auto res = isl_basic_set_unwrap(copy()); if (!res) throw exception::create_from_last_error(get_ctx()); return manage(res); } -// implementations for isl::constraint_list -isl::constraint_list manage(__isl_take isl_constraint_list *ptr) { +// implementations for isl::basic_set_list +isl::basic_set_list manage(__isl_take isl_basic_set_list *ptr) { if (!ptr) throw isl::exception::create(isl_error_invalid, "NULL input", __FILE__, __LINE__); - return constraint_list(ptr); + return basic_set_list(ptr); } -isl::constraint_list manage_copy(__isl_keep isl_constraint_list *ptr) { +isl::basic_set_list manage_copy(__isl_keep isl_basic_set_list *ptr) { if (!ptr) throw isl::exception::create(isl_error_invalid, "NULL input", __FILE__, __LINE__); - auto ctx = isl_constraint_list_get_ctx(ptr); - ptr = isl_constraint_list_copy(ptr); + auto ctx = isl_basic_set_list_get_ctx(ptr); + ptr = isl_basic_set_list_copy(ptr); if (!ptr) throw exception::create_from_last_error(ctx); - return constraint_list(ptr); + return basic_set_list(ptr); } -constraint_list::constraint_list() +basic_set_list::basic_set_list() : ptr(nullptr) {} -constraint_list::constraint_list(const isl::constraint_list &obj) +basic_set_list::basic_set_list(const isl::basic_set_list &obj) : ptr(obj.copy()) { if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_constraint_list_get_ctx(obj.ptr)); + throw exception::create_from_last_error(isl_basic_set_list_get_ctx(obj.ptr)); } -constraint_list::constraint_list(__isl_take isl_constraint_list *ptr) +basic_set_list::basic_set_list(__isl_take isl_basic_set_list *ptr) : ptr(ptr) {} -constraint_list::constraint_list(isl::constraint el) +basic_set_list::basic_set_list(isl::basic_set el) { if (el.is_null()) throw isl::exception::create(isl_error_invalid, "NULL input", __FILE__, __LINE__); auto ctx = el.get_ctx(); options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); - auto res = isl_constraint_list_from_constraint(el.release()); + auto res = isl_basic_set_list_from_basic_set(el.release()); if (!res) throw exception::create_from_last_error(ctx); ptr = res; } -constraint_list::constraint_list(isl::ctx ctx, int n) +basic_set_list::basic_set_list(isl::ctx ctx, int n) { options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); - auto res = isl_constraint_list_alloc(ctx.release(), n); + auto res = isl_basic_set_list_alloc(ctx.release(), n); if (!res) throw exception::create_from_last_error(ctx); ptr = res; } -constraint_list &constraint_list::operator=(isl::constraint_list obj) { +basic_set_list &basic_set_list::operator=(isl::basic_set_list obj) { std::swap(this->ptr, obj.ptr); return *this; } -constraint_list::~constraint_list() { +basic_set_list::~basic_set_list() { if (ptr) - isl_constraint_list_free(ptr); + isl_basic_set_list_free(ptr); } -__isl_give isl_constraint_list *constraint_list::copy() const & { - return isl_constraint_list_copy(ptr); +__isl_give isl_basic_set_list *basic_set_list::copy() const & { + return isl_basic_set_list_copy(ptr); } -__isl_keep isl_constraint_list *constraint_list::get() const { +__isl_keep isl_basic_set_list *basic_set_list::get() const { return ptr; } -__isl_give isl_constraint_list *constraint_list::release() { - isl_constraint_list *tmp = ptr; +__isl_give isl_basic_set_list *basic_set_list::release() { + isl_basic_set_list *tmp = ptr; ptr = nullptr; return tmp; } -bool constraint_list::is_null() const { +bool basic_set_list::is_null() const { return ptr == nullptr; } -constraint_list::operator bool() const +basic_set_list::operator bool() const { return !is_null(); } -isl::ctx constraint_list::get_ctx() const { - return isl::ctx(isl_constraint_list_get_ctx(ptr)); +isl::ctx basic_set_list::get_ctx() const { + return isl::ctx(isl_basic_set_list_get_ctx(ptr)); } -isl::constraint_list constraint_list::add(isl::constraint el) const +isl::basic_set_list basic_set_list::add(isl::basic_set el) const { if (!ptr || el.is_null()) throw isl::exception::create(isl_error_invalid, "NULL input", __FILE__, __LINE__); options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_constraint_list_add(copy(), el.release()); + auto res = isl_basic_set_list_add(copy(), el.release()); if (!res) throw exception::create_from_last_error(get_ctx()); return manage(res); } -isl::constraint_list constraint_list::concat(isl::constraint_list list2) const +isl::basic_set_list basic_set_list::concat(isl::basic_set_list list2) const { if (!ptr || list2.is_null()) throw isl::exception::create(isl_error_invalid, "NULL input", __FILE__, __LINE__); options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_constraint_list_concat(copy(), list2.release()); + auto res = isl_basic_set_list_concat(copy(), list2.release()); if (!res) throw exception::create_from_last_error(get_ctx()); return manage(res); } -isl::constraint_list constraint_list::drop(unsigned int first, unsigned int n) const +isl::basic_set_list basic_set_list::drop(unsigned int first, unsigned int n) const { if (!ptr) throw isl::exception::create(isl_error_invalid, "NULL input", __FILE__, __LINE__); options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_constraint_list_drop(copy(), first, n); + auto res = isl_basic_set_list_drop(copy(), first, n); if (!res) throw exception::create_from_last_error(get_ctx()); return manage(res); } -void constraint_list::foreach(const std::function &fn) const +void basic_set_list::foreach(const std::function &fn) const { if (!ptr) throw isl::exception::create(isl_error_invalid, "NULL input", __FILE__, __LINE__); options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); struct fn_data { - std::function func; + std::function func; std::exception_ptr eptr; } fn_data = { fn }; - auto fn_lambda = [](isl_constraint *arg_0, void *arg_1) -> isl_stat { + auto fn_lambda = [](isl_basic_set *arg_0, void *arg_1) -> isl_stat { auto *data = static_cast(arg_1); try { (data->func)(isl::manage(arg_0)); @@ -8728,7 +8036,7 @@ void constraint_list::foreach(const std::function &fn) co return isl_stat_error; } }; - auto res = isl_constraint_list_foreach(get(), fn_lambda, &fn_data); + auto res = isl_basic_set_list_foreach(get(), fn_lambda, &fn_data); if (fn_data.eptr) std::rethrow_exception(fn_data.eptr); if (res < 0) @@ -8736,37 +8044,37 @@ void constraint_list::foreach(const std::function &fn) co return void(res); } -isl::constraint constraint_list::get_at(int index) const +isl::basic_set basic_set_list::get_at(int index) const { if (!ptr) throw isl::exception::create(isl_error_invalid, "NULL input", __FILE__, __LINE__); options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_constraint_list_get_at(get(), index); + auto res = isl_basic_set_list_get_at(get(), index); if (!res) throw exception::create_from_last_error(get_ctx()); return manage(res); } -isl::constraint_list constraint_list::reverse() const +isl::basic_set_list basic_set_list::reverse() const { if (!ptr) throw isl::exception::create(isl_error_invalid, "NULL input", __FILE__, __LINE__); options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_constraint_list_reverse(copy()); + auto res = isl_basic_set_list_reverse(copy()); if (!res) throw exception::create_from_last_error(get_ctx()); return manage(res); } -int constraint_list::size() const +int basic_set_list::size() const { if (!ptr) throw isl::exception::create(isl_error_invalid, "NULL input", __FILE__, __LINE__); options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_constraint_list_size(get()); + auto res = isl_basic_set_list_size(get()); return res; } @@ -9565,18 +8873,6 @@ isl::ctx map::get_ctx() const { return isl::ctx(isl_map_get_ctx(ptr)); } -isl::map map::add_constraint(isl::constraint constraint) const -{ - if (!ptr || constraint.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_map_add_constraint(copy(), constraint.release()); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - isl::basic_map map::affine_hull() const { if (!ptr) @@ -9970,18 +9266,6 @@ isl::space map::get_space() const return manage(res); } -isl::id map::get_tuple_id(enum isl::dim_type type) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_map_get_tuple_id(get(), static_cast(type)); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - isl::map map::gist(isl::map context) const { if (!ptr || context.is_null()) @@ -10353,18 +9637,6 @@ isl::map map::set_range_tuple_id(isl::id id) const return manage(res); } -isl::map map::set_tuple_id(enum isl::dim_type type, isl::id id) const -{ - if (!ptr || id.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_map_set_tuple_id(copy(), static_cast(type), id.release()); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - isl::basic_map map::simple_hull() const { if (!ptr) @@ -10935,18 +10207,6 @@ isl::space multi_aff::get_space() const return manage(res); } -isl::id multi_aff::get_tuple_id(enum isl::dim_type type) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_aff_get_tuple_id(get(), static_cast(type)); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - isl::multi_aff multi_aff::identity(isl::space space) { if (space.is_null()) @@ -11153,18 +10413,6 @@ isl::multi_aff multi_aff::set_range_tuple_id(isl::id id) const return manage(res); } -isl::multi_aff multi_aff::set_tuple_id(enum isl::dim_type type, isl::id id) const -{ - if (!ptr || id.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_aff_set_tuple_id(copy(), static_cast(type), id.release()); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - int multi_aff::size() const { if (!ptr) @@ -11809,18 +11057,6 @@ isl::space multi_pw_aff::get_space() const return manage(res); } -isl::id multi_pw_aff::get_tuple_id(enum isl::dim_type type) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_pw_aff_get_tuple_id(get(), static_cast(type)); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - isl::multi_pw_aff multi_pw_aff::identity(isl::space space) { if (space.is_null()) @@ -12050,18 +11286,6 @@ isl::multi_pw_aff multi_pw_aff::set_range_tuple_id(isl::id id) const return manage(res); } -isl::multi_pw_aff multi_pw_aff::set_tuple_id(enum isl::dim_type type, isl::id id) const -{ - if (!ptr || id.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_pw_aff_set_tuple_id(copy(), static_cast(type), id.release()); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - int multi_pw_aff::size() const { if (!ptr) @@ -12140,18 +11364,6 @@ multi_union_pw_aff::multi_union_pw_aff(const isl::multi_union_pw_aff &obj) multi_union_pw_aff::multi_union_pw_aff(__isl_take isl_multi_union_pw_aff *ptr) : ptr(ptr) {} -multi_union_pw_aff::multi_union_pw_aff(isl::union_set domain, isl::multi_val mv) -{ - if (domain.is_null() || mv.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - auto ctx = domain.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_union_pw_aff_multi_val_on_domain(domain.release(), mv.release()); - if (!res) - throw exception::create_from_last_error(ctx); - ptr = res; -} multi_union_pw_aff::multi_union_pw_aff(isl::union_set domain, isl::multi_aff ma) { if (domain.is_null() || ma.is_null()) @@ -12200,6 +11412,18 @@ multi_union_pw_aff::multi_union_pw_aff(isl::multi_pw_aff mpa) throw exception::create_from_last_error(ctx); ptr = res; } +multi_union_pw_aff::multi_union_pw_aff(isl::union_set domain, isl::multi_val mv) +{ + if (domain.is_null() || mv.is_null()) + throw isl::exception::create(isl_error_invalid, + "NULL input", __FILE__, __LINE__); + auto ctx = domain.get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + auto res = isl_multi_union_pw_aff_multi_val_on_domain(domain.release(), mv.release()); + if (!res) + throw exception::create_from_last_error(ctx); + ptr = res; +} multi_union_pw_aff::multi_union_pw_aff(isl::ctx ctx, const std::string &str) { options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); @@ -12454,18 +11678,6 @@ isl::space multi_union_pw_aff::get_space() const return manage(res); } -isl::id multi_union_pw_aff::get_tuple_id(enum isl::dim_type type) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_union_pw_aff_get_tuple_id(get(), static_cast(type)); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - isl::union_pw_aff multi_union_pw_aff::get_union_pw_aff(int pos) const { if (!ptr) @@ -12718,18 +11930,6 @@ isl::multi_union_pw_aff multi_union_pw_aff::set_range_tuple_id(isl::id id) const return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::set_tuple_id(enum isl::dim_type type, isl::id id) const -{ - if (!ptr || id.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_union_pw_aff_set_tuple_id(copy(), static_cast(type), id.release()); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - isl::multi_union_pw_aff multi_union_pw_aff::set_union_pw_aff(int pos, isl::union_pw_aff el) const { if (!ptr || el.is_null()) @@ -13017,18 +12217,6 @@ isl::space multi_val::get_space() const return manage(res); } -isl::id multi_val::get_tuple_id(enum isl::dim_type type) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_val_get_tuple_id(get(), static_cast(type)); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - isl::val multi_val::get_val(int pos) const { if (!ptr) @@ -13209,18 +12397,6 @@ isl::multi_val multi_val::set_range_tuple_id(isl::id id) const return manage(res); } -isl::multi_val multi_val::set_tuple_id(enum isl::dim_type type, isl::id id) const -{ - if (!ptr || id.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_val_set_tuple_id(copy(), static_cast(type), id.release()); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - isl::multi_val multi_val::set_val(int pos, isl::val el) const { if (!ptr || el.is_null()) @@ -14459,18 +13635,6 @@ isl::space pw_multi_aff::get_space() const return manage(res); } -isl::id pw_multi_aff::get_tuple_id(enum isl::dim_type type) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_pw_multi_aff_get_tuple_id(get(), static_cast(type)); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - isl::pw_multi_aff pw_multi_aff::identity(isl::space space) { if (space.is_null()) @@ -16770,18 +15934,6 @@ isl::ctx set::get_ctx() const { return isl::ctx(isl_set_get_ctx(ptr)); } -isl::set set::add_constraint(isl::constraint constraint) const -{ - if (!ptr || constraint.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_set_add_constraint(copy(), constraint.release()); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - isl::basic_set set::affine_hull() const { if (!ptr) @@ -17996,18 +17148,6 @@ isl::id space::get_map_range_tuple_id() const return manage(res); } -isl::id space::get_tuple_id(enum isl::dim_type type) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_space_get_tuple_id(get(), static_cast(type)); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - bool space::has_equal_params(const isl::space &space2) const { if (!ptr || space2.is_null()) diff --git a/third-party/islpp b/third-party/islpp index f8cf7cf1b..b12d681d1 160000 --- a/third-party/islpp +++ b/third-party/islpp @@ -1 +1 @@ -Subproject commit f8cf7cf1b0ca606d8adb0b88d60200c4a858d36c +Subproject commit b12d681d17c1f41a893847fb711f48acc1efe3e1 From c0bd4d1c0e3c92df2d5adcd75f028813478864f3 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Fri, 20 Jul 2018 16:04:17 +0200 Subject: [PATCH 047/152] updateTopLevelContext: remove construction of universe set There is little point in constructed this universe set as it will be intersected with the input set anyway. --- tc/core/polyhedral/schedule_transforms.cc | 4 ++-- tc/core/polyhedral/schedule_transforms.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tc/core/polyhedral/schedule_transforms.cc b/tc/core/polyhedral/schedule_transforms.cc index bf37daf69..5ad91aec3 100644 --- a/tc/core/polyhedral/schedule_transforms.cc +++ b/tc/core/polyhedral/schedule_transforms.cc @@ -286,8 +286,8 @@ ScheduleTree* insertTopLevelEmptyBand(ScheduleTree* root) { void updateTopLevelContext(detail::ScheduleTree* root, isl::set context) { if (!matchOne(tc::polyhedral::domain(tc::polyhedral::context(any())), root)) { - root->appendChild(ScheduleTree::makeContext( - isl::set::universe(context.get_space()), root->detachChildren())); + root->appendChild( + ScheduleTree::makeContext(context, root->detachChildren())); } auto contextElem = const_cast( root->child({0})->as()); diff --git a/tc/core/polyhedral/schedule_transforms.h b/tc/core/polyhedral/schedule_transforms.h index 258d2736a..a70ac85bc 100644 --- a/tc/core/polyhedral/schedule_transforms.h +++ b/tc/core/polyhedral/schedule_transforms.h @@ -109,7 +109,7 @@ detail::ScheduleTree* insertTopLevelEmptyBand(detail::ScheduleTree* root); // Update the top-level context node by intersecting it with "context". The // top-level context node must be located directly under the root of the tree. -// If there is no such node, insert one with universe context first. +// If there is no such node, insert one first. void updateTopLevelContext(detail::ScheduleTree* root, isl::set context); // In a tree starting at "root", insert a sequence node with From a3bac397e375cda99cf33ac89eb58f9a8b203d3f Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Fri, 20 Jul 2018 16:13:10 +0200 Subject: [PATCH 048/152] updateTopLevelContext: drop redundant const_cast --- tc/core/polyhedral/schedule_transforms.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tc/core/polyhedral/schedule_transforms.cc b/tc/core/polyhedral/schedule_transforms.cc index 5ad91aec3..59d390369 100644 --- a/tc/core/polyhedral/schedule_transforms.cc +++ b/tc/core/polyhedral/schedule_transforms.cc @@ -289,8 +289,7 @@ void updateTopLevelContext(detail::ScheduleTree* root, isl::set context) { root->appendChild( ScheduleTree::makeContext(context, root->detachChildren())); } - auto contextElem = const_cast( - root->child({0})->as()); + auto contextElem = root->child({0})->as(); TC_CHECK(contextElem) << "Expected domain(context(any()))"; contextElem->context_ = contextElem->context_ & context; } From 96a5ba88aa00003841415101334406e127537174 Mon Sep 17 00:00:00 2001 From: Nicolas Vasilache Date: Fri, 20 Jul 2018 08:36:02 -0700 Subject: [PATCH 049/152] [Experimental] Debug apparent race condition on top1 --- python/benchmarks/python_overhead.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python/benchmarks/python_overhead.py b/python/benchmarks/python_overhead.py index cf354ca72..694f5fbd1 100644 --- a/python/benchmarks/python_overhead.py +++ b/python/benchmarks/python_overhead.py @@ -111,7 +111,9 @@ def matmul_bgrad(float(M,N) A, float(M,K) d_C) -> (d_B) { tuner_config) cache = MappingOptionsCache(cache_file.name) top10 = cache.load(mm, "matmul", (A, B), 10) - assert top1.__str__() == top10[0].__str__() + assert top1.__str__() == top10[0].__str__(), ( + "Expected {}\nGot {}\nTop10 are {}".format( + top1, top10[0], "\n".join(opt for opt in top10))) # Compile and run with the new options compilation_cache.compile("matmul", (A, B), top1) From b7dcfe6462decd787088e9f305c081502427915e Mon Sep 17 00:00:00 2001 From: Oleksandr Zinenko Date: Mon, 9 Jul 2018 11:39:30 +0200 Subject: [PATCH 050/152] reformat schedule_tree_elem.h This file comes from prehistory and mostly predates the current code guidelines. Make it more conforming to the guidelines. In particular, put data fields after methods in the classes; start an explicit public block for them; separate out constants, typedefs, groups of methods and data fields with empty lines to improve readability. --- tc/core/polyhedral/schedule_tree_elem.h | 44 ++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/tc/core/polyhedral/schedule_tree_elem.h b/tc/core/polyhedral/schedule_tree_elem.h index 069241938..121e1931d 100644 --- a/tc/core/polyhedral/schedule_tree_elem.h +++ b/tc/core/polyhedral/schedule_tree_elem.h @@ -33,69 +33,89 @@ namespace detail { struct ScheduleTreeContext : public ScheduleTree { static constexpr detail::ScheduleTreeType NodeType = detail::ScheduleTreeType::Context; - isl::set context_; + ScheduleTreeContext() = delete; ScheduleTreeContext(const ScheduleTreeContext& eb) : ScheduleTree(eb), context_(eb.context_) {} explicit ScheduleTreeContext(isl::set s) : ScheduleTree(s.get_ctx(), {}, NodeType), context_(s) {} virtual ~ScheduleTreeContext() override {} + bool operator==(const ScheduleTreeContext& other) const; bool operator!=(const ScheduleTreeContext& other) const { return !(*this == other); } + virtual std::ostream& write(std::ostream& os) const override; + + public: + isl::set context_; }; struct ScheduleTreeDomain : public ScheduleTree { static constexpr detail::ScheduleTreeType NodeType = detail::ScheduleTreeType::Domain; - isl::union_set domain_; + ScheduleTreeDomain() = delete; ScheduleTreeDomain(const ScheduleTreeDomain& eb) : ScheduleTree(eb), domain_(eb.domain_) {} explicit ScheduleTreeDomain(isl::union_set us) : ScheduleTree(us.get_ctx(), {}, NodeType), domain_(us) {} virtual ~ScheduleTreeDomain() override {} + bool operator==(const ScheduleTreeDomain& other) const; bool operator!=(const ScheduleTreeDomain& other) const { return !(*this == other); } + virtual std::ostream& write(std::ostream& os) const override; + + public: + isl::union_set domain_; }; struct ScheduleTreeExtension : public ScheduleTree { static constexpr detail::ScheduleTreeType NodeType = detail::ScheduleTreeType::Extension; - isl::union_map extension_; + ScheduleTreeExtension() = delete; ScheduleTreeExtension(const ScheduleTreeExtension& eb) : ScheduleTree(eb), extension_(eb.extension_) {} explicit ScheduleTreeExtension(isl::union_map m) : ScheduleTree(m.get_ctx(), {}, NodeType), extension_(m) {} virtual ~ScheduleTreeExtension() override {} + bool operator==(const ScheduleTreeExtension& other) const; bool operator!=(const ScheduleTreeExtension& other) const { return !(*this == other); } + virtual std::ostream& write(std::ostream& os) const override; + + public: + isl::union_map extension_; }; struct ScheduleTreeFilter : public ScheduleTree { static constexpr detail::ScheduleTreeType NodeType = detail::ScheduleTreeType::Filter; - isl::union_set filter_; + ScheduleTreeFilter() = delete; ScheduleTreeFilter(const ScheduleTreeFilter& eb) : ScheduleTree(eb), filter_(eb.filter_) {} explicit ScheduleTreeFilter(isl::union_set s) : ScheduleTree(s.get_ctx(), {}, NodeType), filter_(s) {} virtual ~ScheduleTreeFilter() override {} + bool operator==(const ScheduleTreeFilter& other) const; bool operator!=(const ScheduleTreeFilter& other) const { return !(*this == other); } + virtual std::ostream& write(std::ostream& os) const override; + + public: + isl::union_set filter_; }; struct ScheduleTreeMapping : public ScheduleTree { @@ -103,8 +123,10 @@ struct ScheduleTreeMapping : public ScheduleTree { mapping::MappingId, isl::union_pw_aff, typename mapping::MappingId::Hash>; + static constexpr detail::ScheduleTreeType NodeType = detail::ScheduleTreeType::Mapping; + ScheduleTreeMapping() = delete; ScheduleTreeMapping(const ScheduleTreeMapping& eb) : ScheduleTree(eb), mapping(eb.mapping), filter_(eb.filter_) {} @@ -129,12 +151,15 @@ struct ScheduleTreeMapping : public ScheduleTree { } } virtual ~ScheduleTreeMapping() override {} + bool operator==(const ScheduleTreeMapping& other) const; bool operator!=(const ScheduleTreeMapping& other) const { return !(*this == other); } + virtual std::ostream& write(std::ostream& os) const override; + public: // Mapping from identifiers to affine functions on domain elements. const Mapping mapping; // Assignment of the affine functions to the identifiers as parameters. @@ -144,27 +169,33 @@ struct ScheduleTreeMapping : public ScheduleTree { struct ScheduleTreeSequence : public ScheduleTree { static constexpr detail::ScheduleTreeType NodeType = detail::ScheduleTreeType::Sequence; + explicit ScheduleTreeSequence(isl::ctx ctx) : ScheduleTree(ctx, {}, NodeType) {} ScheduleTreeSequence(const ScheduleTreeSequence& eb) : ScheduleTree(eb) {} virtual ~ScheduleTreeSequence() override {} + bool operator==(const ScheduleTreeSequence& other) const; bool operator!=(const ScheduleTreeSequence& other) const { return !(*this == other); } + virtual std::ostream& write(std::ostream& os) const override; }; struct ScheduleTreeSet : public ScheduleTree { static constexpr detail::ScheduleTreeType NodeType = detail::ScheduleTreeType::Set; + explicit ScheduleTreeSet(isl::ctx ctx) : ScheduleTree(ctx, {}, NodeType) {} ScheduleTreeSet(const ScheduleTreeSet& eb) : ScheduleTree(eb) {} virtual ~ScheduleTreeSet() override {} + bool operator==(const ScheduleTreeSet& other) const; bool operator!=(const ScheduleTreeSet& other) const { return !(*this == other); } + virtual std::ostream& write(std::ostream& os) const override; }; @@ -183,10 +214,12 @@ struct ScheduleTreeBand : public ScheduleTree { coincident_(eb.coincident_), unroll_(eb.unroll_) {} virtual ~ScheduleTreeBand() override {} + bool operator==(const ScheduleTreeBand& other) const; bool operator!=(const ScheduleTreeBand& other) const { return !(*this == other); } + virtual std::ostream& write(std::ostream& os) const override; // First replace "mupa" by its greatest integer part to ensure that the @@ -229,15 +262,18 @@ struct ScheduleTreeBand : public ScheduleTree { struct ScheduleTreeThreadSpecificMarker : public ScheduleTree { static constexpr detail::ScheduleTreeType NodeType = detail::ScheduleTreeType::ThreadSpecificMarker; + explicit ScheduleTreeThreadSpecificMarker(isl::ctx ctx) : ScheduleTree(ctx, {}, NodeType) {} virtual ~ScheduleTreeThreadSpecificMarker() override {} + bool operator==(const ScheduleTreeThreadSpecificMarker& other) const { return true; } bool operator!=(const ScheduleTreeThreadSpecificMarker& other) const { return !(*this == other); } + virtual std::ostream& write(std::ostream& os) const override; }; From 16e506fa111f4316cba23afaa4ca98c73824e72b Mon Sep 17 00:00:00 2001 From: Oleksandr Zinenko Date: Mon, 9 Jul 2018 11:50:57 +0200 Subject: [PATCH 051/152] ScheduleTreeContext: hide constructor ScheduleTree nodes are not supposed to be kept by value, only via unique pointers. Make the main constructor private. External callers must use the newly introduced function ScheduleTreeContext::make that returns a unique pointer. --- tc/core/polyhedral/schedule_isl_conversion.cc | 2 +- tc/core/polyhedral/schedule_tree.cc | 4 +--- tc/core/polyhedral/schedule_tree_elem.cc | 9 +++++++++ tc/core/polyhedral/schedule_tree_elem.h | 12 ++++++++++-- 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/tc/core/polyhedral/schedule_isl_conversion.cc b/tc/core/polyhedral/schedule_isl_conversion.cc index 22e1532e1..0346f1c7c 100644 --- a/tc/core/polyhedral/schedule_isl_conversion.cc +++ b/tc/core/polyhedral/schedule_isl_conversion.cc @@ -251,7 +251,7 @@ std::unique_ptr elemFromIslScheduleNode(isl::schedule_node node) { return fromIslScheduleNodeBand(band); } else if (auto context = node.as()) { auto c = context.get_context(); - return std::unique_ptr(new ScheduleTreeContext(c)); + return ScheduleTreeContext::make(c); } else if (auto domain = node.as()) { auto c = domain.get_domain(); return std::unique_ptr(new ScheduleTreeDomain(c)); diff --git a/tc/core/polyhedral/schedule_tree.cc b/tc/core/polyhedral/schedule_tree.cc index d75b479cf..04b9e9a05 100644 --- a/tc/core/polyhedral/schedule_tree.cc +++ b/tc/core/polyhedral/schedule_tree.cc @@ -251,9 +251,7 @@ std::unique_ptr ScheduleTree::makeDomain( std::unique_ptr ScheduleTree::makeContext( isl::set context, std::vector&& children) { - auto res = std::unique_ptr(new ScheduleTreeContext(context)); - res->appendChildren(std::move(children)); - return res; + return ScheduleTreeContext::make(context, std::move(children)); } std::unique_ptr ScheduleTree::makeFilter( diff --git a/tc/core/polyhedral/schedule_tree_elem.cc b/tc/core/polyhedral/schedule_tree_elem.cc index 29b4f0521..f48239115 100644 --- a/tc/core/polyhedral/schedule_tree_elem.cc +++ b/tc/core/polyhedral/schedule_tree_elem.cc @@ -37,6 +37,15 @@ namespace tc { namespace polyhedral { namespace detail { +std::unique_ptr ScheduleTreeContext::make( + isl::set context, + std::vector&& children) { + auto res = + std::unique_ptr(new ScheduleTreeContext(context)); + res->appendChildren(std::move(children)); + return res; +} + std::unique_ptr ScheduleTreeBand::fromMultiUnionPwAff( isl::multi_union_pw_aff mupa) { isl::ctx ctx(mupa.get_ctx()); diff --git a/tc/core/polyhedral/schedule_tree_elem.h b/tc/core/polyhedral/schedule_tree_elem.h index 121e1931d..6a905d256 100644 --- a/tc/core/polyhedral/schedule_tree_elem.h +++ b/tc/core/polyhedral/schedule_tree_elem.h @@ -31,16 +31,24 @@ namespace polyhedral { namespace detail { struct ScheduleTreeContext : public ScheduleTree { + public: static constexpr detail::ScheduleTreeType NodeType = detail::ScheduleTreeType::Context; + private: ScheduleTreeContext() = delete; - ScheduleTreeContext(const ScheduleTreeContext& eb) - : ScheduleTree(eb), context_(eb.context_) {} explicit ScheduleTreeContext(isl::set s) : ScheduleTree(s.get_ctx(), {}, NodeType), context_(s) {} + + public: + ScheduleTreeContext(const ScheduleTreeContext& eb) + : ScheduleTree(eb), context_(eb.context_) {} virtual ~ScheduleTreeContext() override {} + static std::unique_ptr make( + isl::set context, + std::vector&& children = {}); + bool operator==(const ScheduleTreeContext& other) const; bool operator!=(const ScheduleTreeContext& other) const { return !(*this == other); From 58ff8f17bbb1edc3da5c181202fa749c7d9c1859 Mon Sep 17 00:00:00 2001 From: Oleksandr Zinenko Date: Mon, 9 Jul 2018 13:37:12 +0200 Subject: [PATCH 052/152] ScheduleTreeDomain: hide constructor ScheduleTree nodes are not supposed to be kept by value, only via unique pointers. Make the main constructor private. External callers must use the newly introduced function ScheduleTreeDomain::make that returns a unique pointer. --- tc/core/polyhedral/schedule_isl_conversion.cc | 2 +- tc/core/polyhedral/schedule_tree.cc | 4 +--- tc/core/polyhedral/schedule_tree_elem.cc | 9 +++++++++ tc/core/polyhedral/schedule_tree_elem.h | 12 ++++++++++-- 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/tc/core/polyhedral/schedule_isl_conversion.cc b/tc/core/polyhedral/schedule_isl_conversion.cc index 0346f1c7c..508ec102d 100644 --- a/tc/core/polyhedral/schedule_isl_conversion.cc +++ b/tc/core/polyhedral/schedule_isl_conversion.cc @@ -254,7 +254,7 @@ std::unique_ptr elemFromIslScheduleNode(isl::schedule_node node) { return ScheduleTreeContext::make(c); } else if (auto domain = node.as()) { auto c = domain.get_domain(); - return std::unique_ptr(new ScheduleTreeDomain(c)); + return ScheduleTreeDomain::make(c); } else if (auto expansion = node.as()) { LOG(FATAL) << "expansion nodes not supported"; return nullptr; diff --git a/tc/core/polyhedral/schedule_tree.cc b/tc/core/polyhedral/schedule_tree.cc index 04b9e9a05..9fe1cafff 100644 --- a/tc/core/polyhedral/schedule_tree.cc +++ b/tc/core/polyhedral/schedule_tree.cc @@ -243,9 +243,7 @@ ScheduleTreeUPtr ScheduleTree::makeEmptyBand(const ScheduleTree* root) { std::unique_ptr ScheduleTree::makeDomain( isl::union_set domain, std::vector&& children) { - auto res = std::unique_ptr(new ScheduleTreeDomain(domain)); - res->appendChildren(std::move(children)); - return res; + return ScheduleTreeDomain::make(domain, std::move(children)); } std::unique_ptr ScheduleTree::makeContext( diff --git a/tc/core/polyhedral/schedule_tree_elem.cc b/tc/core/polyhedral/schedule_tree_elem.cc index f48239115..50a98cb03 100644 --- a/tc/core/polyhedral/schedule_tree_elem.cc +++ b/tc/core/polyhedral/schedule_tree_elem.cc @@ -46,6 +46,15 @@ std::unique_ptr ScheduleTreeContext::make( return res; } +std::unique_ptr ScheduleTreeDomain::make( + isl::union_set domain, + std::vector&& children) { + auto res = + std::unique_ptr(new ScheduleTreeDomain(domain)); + res->appendChildren(std::move(children)); + return res; +} + std::unique_ptr ScheduleTreeBand::fromMultiUnionPwAff( isl::multi_union_pw_aff mupa) { isl::ctx ctx(mupa.get_ctx()); diff --git a/tc/core/polyhedral/schedule_tree_elem.h b/tc/core/polyhedral/schedule_tree_elem.h index 6a905d256..d0f33fa04 100644 --- a/tc/core/polyhedral/schedule_tree_elem.h +++ b/tc/core/polyhedral/schedule_tree_elem.h @@ -61,16 +61,24 @@ struct ScheduleTreeContext : public ScheduleTree { }; struct ScheduleTreeDomain : public ScheduleTree { + public: static constexpr detail::ScheduleTreeType NodeType = detail::ScheduleTreeType::Domain; + private: ScheduleTreeDomain() = delete; - ScheduleTreeDomain(const ScheduleTreeDomain& eb) - : ScheduleTree(eb), domain_(eb.domain_) {} explicit ScheduleTreeDomain(isl::union_set us) : ScheduleTree(us.get_ctx(), {}, NodeType), domain_(us) {} + + public: + ScheduleTreeDomain(const ScheduleTreeDomain& eb) + : ScheduleTree(eb), domain_(eb.domain_) {} virtual ~ScheduleTreeDomain() override {} + static std::unique_ptr make( + isl::union_set domain, + std::vector&& children = {}); + bool operator==(const ScheduleTreeDomain& other) const; bool operator!=(const ScheduleTreeDomain& other) const { return !(*this == other); From 0384a550b039fe4cce611fca990195e14d5f6765 Mon Sep 17 00:00:00 2001 From: Oleksandr Zinenko Date: Mon, 9 Jul 2018 13:44:30 +0200 Subject: [PATCH 053/152] ScheduleTreeExtension: hide constructor ScheduleTree nodes are not supposed to be kept by value, only via unique pointers. Make the main constructor private. External callers must use the newly introduced function ScheduleTreeExtension::make that returns a unique pointer. --- tc/core/polyhedral/schedule_isl_conversion.cc | 2 +- tc/core/polyhedral/schedule_tree.cc | 5 +---- tc/core/polyhedral/schedule_tree_elem.cc | 9 +++++++++ tc/core/polyhedral/schedule_tree_elem.h | 12 ++++++++++-- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/tc/core/polyhedral/schedule_isl_conversion.cc b/tc/core/polyhedral/schedule_isl_conversion.cc index 508ec102d..32f7c7b17 100644 --- a/tc/core/polyhedral/schedule_isl_conversion.cc +++ b/tc/core/polyhedral/schedule_isl_conversion.cc @@ -260,7 +260,7 @@ std::unique_ptr elemFromIslScheduleNode(isl::schedule_node node) { return nullptr; } else if (auto extension = node.as()) { auto e = extension.get_extension(); - return std::unique_ptr(new ScheduleTreeExtension(e)); + return ScheduleTreeExtension::make(e); } else if (auto filter = node.as()) { auto f = filter.get_filter(); return std::unique_ptr(new ScheduleTreeFilter(f)); diff --git a/tc/core/polyhedral/schedule_tree.cc b/tc/core/polyhedral/schedule_tree.cc index 9fe1cafff..beea9d987 100644 --- a/tc/core/polyhedral/schedule_tree.cc +++ b/tc/core/polyhedral/schedule_tree.cc @@ -283,10 +283,7 @@ std::unique_ptr ScheduleTree::makeMappingUnsafe( std::unique_ptr ScheduleTree::makeExtension( isl::union_map extension, std::vector&& children) { - auto res = - std::unique_ptr(new ScheduleTreeExtension(extension)); - res->appendChildren(std::move(children)); - return res; + return ScheduleTreeExtension::make(extension, std::move(children)); } std::unique_ptr ScheduleTree::makeThreadSpecificMarker( diff --git a/tc/core/polyhedral/schedule_tree_elem.cc b/tc/core/polyhedral/schedule_tree_elem.cc index 50a98cb03..e9000a41b 100644 --- a/tc/core/polyhedral/schedule_tree_elem.cc +++ b/tc/core/polyhedral/schedule_tree_elem.cc @@ -55,6 +55,15 @@ std::unique_ptr ScheduleTreeDomain::make( return res; } +std::unique_ptr ScheduleTreeExtension::make( + isl::union_map extension, + std::vector&& children) { + auto res = std::unique_ptr( + new ScheduleTreeExtension(extension)); + res->appendChildren(std::move(children)); + return res; +} + std::unique_ptr ScheduleTreeBand::fromMultiUnionPwAff( isl::multi_union_pw_aff mupa) { isl::ctx ctx(mupa.get_ctx()); diff --git a/tc/core/polyhedral/schedule_tree_elem.h b/tc/core/polyhedral/schedule_tree_elem.h index d0f33fa04..c16ae480c 100644 --- a/tc/core/polyhedral/schedule_tree_elem.h +++ b/tc/core/polyhedral/schedule_tree_elem.h @@ -91,16 +91,24 @@ struct ScheduleTreeDomain : public ScheduleTree { }; struct ScheduleTreeExtension : public ScheduleTree { + public: static constexpr detail::ScheduleTreeType NodeType = detail::ScheduleTreeType::Extension; + private: ScheduleTreeExtension() = delete; - ScheduleTreeExtension(const ScheduleTreeExtension& eb) - : ScheduleTree(eb), extension_(eb.extension_) {} explicit ScheduleTreeExtension(isl::union_map m) : ScheduleTree(m.get_ctx(), {}, NodeType), extension_(m) {} + + public: + ScheduleTreeExtension(const ScheduleTreeExtension& eb) + : ScheduleTree(eb), extension_(eb.extension_) {} virtual ~ScheduleTreeExtension() override {} + static std::unique_ptr make( + isl::union_map extension, + std::vector&& children = {}); + bool operator==(const ScheduleTreeExtension& other) const; bool operator!=(const ScheduleTreeExtension& other) const { return !(*this == other); From 5390b257be65b9e1d0e077f03aac02948615601c Mon Sep 17 00:00:00 2001 From: Oleksandr Zinenko Date: Mon, 9 Jul 2018 13:49:09 +0200 Subject: [PATCH 054/152] ScheduleTreeFilter: hide constructor ScheduleTree nodes are not supposed to be kept by value, only via unique pointers. Make the main constructor private. External callers must use the newly introduced function ScheduleTreeFilter::make that returns a unique pointer. --- tc/core/polyhedral/schedule_isl_conversion.cc | 2 +- tc/core/polyhedral/schedule_tree.cc | 4 +--- tc/core/polyhedral/schedule_tree_elem.cc | 9 +++++++++ tc/core/polyhedral/schedule_tree_elem.h | 12 ++++++++++-- 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/tc/core/polyhedral/schedule_isl_conversion.cc b/tc/core/polyhedral/schedule_isl_conversion.cc index 32f7c7b17..998c9744e 100644 --- a/tc/core/polyhedral/schedule_isl_conversion.cc +++ b/tc/core/polyhedral/schedule_isl_conversion.cc @@ -263,7 +263,7 @@ std::unique_ptr elemFromIslScheduleNode(isl::schedule_node node) { return ScheduleTreeExtension::make(e); } else if (auto filter = node.as()) { auto f = filter.get_filter(); - return std::unique_ptr(new ScheduleTreeFilter(f)); + return ScheduleTreeFilter::make(f); } else if (auto guard = node.as()) { LOG(FATAL) << "guard nodes not supported"; return nullptr; diff --git a/tc/core/polyhedral/schedule_tree.cc b/tc/core/polyhedral/schedule_tree.cc index beea9d987..5b3898772 100644 --- a/tc/core/polyhedral/schedule_tree.cc +++ b/tc/core/polyhedral/schedule_tree.cc @@ -255,9 +255,7 @@ std::unique_ptr ScheduleTree::makeContext( std::unique_ptr ScheduleTree::makeFilter( isl::union_set filter, std::vector&& children) { - auto res = std::unique_ptr(new ScheduleTreeFilter(filter)); - res->appendChildren(std::move(children)); - return res; + return ScheduleTreeFilter::make(filter, std::move(children)); } std::unique_ptr ScheduleTree::makeMappingUnsafe( diff --git a/tc/core/polyhedral/schedule_tree_elem.cc b/tc/core/polyhedral/schedule_tree_elem.cc index e9000a41b..ff056cd8a 100644 --- a/tc/core/polyhedral/schedule_tree_elem.cc +++ b/tc/core/polyhedral/schedule_tree_elem.cc @@ -64,6 +64,15 @@ std::unique_ptr ScheduleTreeExtension::make( return res; } +std::unique_ptr ScheduleTreeFilter::make( + isl::union_set filter, + std::vector&& children) { + auto res = + std::unique_ptr(new ScheduleTreeFilter(filter)); + res->appendChildren(std::move(children)); + return res; +} + std::unique_ptr ScheduleTreeBand::fromMultiUnionPwAff( isl::multi_union_pw_aff mupa) { isl::ctx ctx(mupa.get_ctx()); diff --git a/tc/core/polyhedral/schedule_tree_elem.h b/tc/core/polyhedral/schedule_tree_elem.h index c16ae480c..d7184230b 100644 --- a/tc/core/polyhedral/schedule_tree_elem.h +++ b/tc/core/polyhedral/schedule_tree_elem.h @@ -121,14 +121,18 @@ struct ScheduleTreeExtension : public ScheduleTree { }; struct ScheduleTreeFilter : public ScheduleTree { + public: static constexpr detail::ScheduleTreeType NodeType = detail::ScheduleTreeType::Filter; + private: ScheduleTreeFilter() = delete; - ScheduleTreeFilter(const ScheduleTreeFilter& eb) - : ScheduleTree(eb), filter_(eb.filter_) {} explicit ScheduleTreeFilter(isl::union_set s) : ScheduleTree(s.get_ctx(), {}, NodeType), filter_(s) {} + + public: + ScheduleTreeFilter(const ScheduleTreeFilter& eb) + : ScheduleTree(eb), filter_(eb.filter_) {} virtual ~ScheduleTreeFilter() override {} bool operator==(const ScheduleTreeFilter& other) const; @@ -136,6 +140,10 @@ struct ScheduleTreeFilter : public ScheduleTree { return !(*this == other); } + static std::unique_ptr make( + isl::union_set filter, + std::vector&& children = {}); + virtual std::ostream& write(std::ostream& os) const override; public: From bf3152894512c58dd15ad99f00707e641229ed34 Mon Sep 17 00:00:00 2001 From: Oleksandr Zinenko Date: Mon, 9 Jul 2018 13:58:32 +0200 Subject: [PATCH 055/152] ScheduleTreeMapping: uninline constructor The constructor is rather long, there is no point for it to be inline or appear in the body of the class. Uninline it and move its definition to schedule_tree_elem.cc. --- tc/core/polyhedral/schedule_tree_elem.cc | 23 +++++++++++++++++++++++ tc/core/polyhedral/schedule_tree_elem.h | 21 +-------------------- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/tc/core/polyhedral/schedule_tree_elem.cc b/tc/core/polyhedral/schedule_tree_elem.cc index ff056cd8a..b861f06b0 100644 --- a/tc/core/polyhedral/schedule_tree_elem.cc +++ b/tc/core/polyhedral/schedule_tree_elem.cc @@ -73,6 +73,29 @@ std::unique_ptr ScheduleTreeFilter::make( return res; } +ScheduleTreeMapping::ScheduleTreeMapping( + isl::ctx ctx, + const ScheduleTreeMapping::Mapping& mapping) + : ScheduleTree(ctx, {}, NodeType), + mapping(mapping), + filter_(isl::union_set()) { + TC_CHECK_GT(mapping.size(), 0u) << "empty mapping filter"; + + auto domain = mapping.cbegin()->second.domain(); + for (auto& kvp : mapping) { + TC_CHECK(domain.is_equal(kvp.second.domain())); + } + filter_ = domain.universe(); + for (auto& kvp : mapping) { + auto upa = kvp.second; + auto id = kvp.first; + // Create mapping filter by equating the + // parameter mappedIds[i] to the "i"-th affine function. + upa = upa.sub(isl::union_pw_aff::param_on_domain(domain.universe(), id)); + filter_ = filter_.intersect(upa.zero_union_set()); + } +} + std::unique_ptr ScheduleTreeBand::fromMultiUnionPwAff( isl::multi_union_pw_aff mupa) { isl::ctx ctx(mupa.get_ctx()); diff --git a/tc/core/polyhedral/schedule_tree_elem.h b/tc/core/polyhedral/schedule_tree_elem.h index d7184230b..771a5844b 100644 --- a/tc/core/polyhedral/schedule_tree_elem.h +++ b/tc/core/polyhedral/schedule_tree_elem.h @@ -162,26 +162,7 @@ struct ScheduleTreeMapping : public ScheduleTree { ScheduleTreeMapping() = delete; ScheduleTreeMapping(const ScheduleTreeMapping& eb) : ScheduleTree(eb), mapping(eb.mapping), filter_(eb.filter_) {} - ScheduleTreeMapping(isl::ctx ctx, const Mapping& mapping) - : ScheduleTree(ctx, {}, NodeType), - mapping(mapping), - filter_(isl::union_set()) { - TC_CHECK_GT(mapping.size(), 0u) << "empty mapping filter"; - - auto domain = mapping.cbegin()->second.domain(); - for (auto& kvp : mapping) { - TC_CHECK(domain.is_equal(kvp.second.domain())); - } - filter_ = domain.universe(); - for (auto& kvp : mapping) { - auto upa = kvp.second; - auto id = kvp.first; - // Create mapping filter by equating the - // parameter mappedIds[i] to the "i"-th affine function. - upa = upa.sub(isl::union_pw_aff::param_on_domain(domain.universe(), id)); - filter_ = filter_.intersect(upa.zero_union_set()); - } - } + ScheduleTreeMapping(isl::ctx ctx, const Mapping& mapping); virtual ~ScheduleTreeMapping() override {} bool operator==(const ScheduleTreeMapping& other) const; From 58b9cd47457ce97ebeae3f8bb6f26658e0652966 Mon Sep 17 00:00:00 2001 From: Oleksandr Zinenko Date: Mon, 9 Jul 2018 14:28:28 +0200 Subject: [PATCH 056/152] ScheduleTreeMapping: hide constructor ScheduleTree nodes are not supposed to be kept by value, only via unique pointers. Make the main constructor private. External callers must use the newly introduced function ScheduleTreeMapping::make that returns a unique pointer. --- tc/core/polyhedral/schedule_tree.cc | 5 +---- tc/core/polyhedral/schedule_tree_elem.cc | 10 ++++++++++ tc/core/polyhedral/schedule_tree_elem.h | 11 ++++++++++- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/tc/core/polyhedral/schedule_tree.cc b/tc/core/polyhedral/schedule_tree.cc index 5b3898772..777f77e05 100644 --- a/tc/core/polyhedral/schedule_tree.cc +++ b/tc/core/polyhedral/schedule_tree.cc @@ -272,10 +272,7 @@ std::unique_ptr ScheduleTree::makeMappingUnsafe( TC_CHECK_EQ(mappedIds.size(), mapping.size()) << "some id is used more than once in the mapping"; auto ctx = mappedIds[0].get_ctx(); - auto res = - std::unique_ptr(new ScheduleTreeMapping(ctx, mapping)); - res->appendChildren(std::move(children)); - return res; + return ScheduleTreeMapping::make(ctx, mapping, std::move(children)); } std::unique_ptr ScheduleTree::makeExtension( diff --git a/tc/core/polyhedral/schedule_tree_elem.cc b/tc/core/polyhedral/schedule_tree_elem.cc index b861f06b0..b21f316b7 100644 --- a/tc/core/polyhedral/schedule_tree_elem.cc +++ b/tc/core/polyhedral/schedule_tree_elem.cc @@ -73,6 +73,16 @@ std::unique_ptr ScheduleTreeFilter::make( return res; } +std::unique_ptr ScheduleTreeMapping::make( + isl::ctx ctx, + const ScheduleTreeMapping::Mapping& mapping, + std::vector&& children) { + auto res = std::unique_ptr( + new ScheduleTreeMapping(ctx, mapping)); + res->appendChildren(std::move(children)); + return res; +} + ScheduleTreeMapping::ScheduleTreeMapping( isl::ctx ctx, const ScheduleTreeMapping::Mapping& mapping) diff --git a/tc/core/polyhedral/schedule_tree_elem.h b/tc/core/polyhedral/schedule_tree_elem.h index 771a5844b..57f56dfd0 100644 --- a/tc/core/polyhedral/schedule_tree_elem.h +++ b/tc/core/polyhedral/schedule_tree_elem.h @@ -151,6 +151,7 @@ struct ScheduleTreeFilter : public ScheduleTree { }; struct ScheduleTreeMapping : public ScheduleTree { + public: using Mapping = std::unordered_map< mapping::MappingId, isl::union_pw_aff, @@ -159,10 +160,13 @@ struct ScheduleTreeMapping : public ScheduleTree { static constexpr detail::ScheduleTreeType NodeType = detail::ScheduleTreeType::Mapping; + private: ScheduleTreeMapping() = delete; + ScheduleTreeMapping(isl::ctx ctx, const Mapping& mapping); + + public: ScheduleTreeMapping(const ScheduleTreeMapping& eb) : ScheduleTree(eb), mapping(eb.mapping), filter_(eb.filter_) {} - ScheduleTreeMapping(isl::ctx ctx, const Mapping& mapping); virtual ~ScheduleTreeMapping() override {} bool operator==(const ScheduleTreeMapping& other) const; @@ -170,6 +174,11 @@ struct ScheduleTreeMapping : public ScheduleTree { return !(*this == other); } + static std::unique_ptr make( + isl::ctx ctx, + const Mapping& mapping, + std::vector&& children = {}); + virtual std::ostream& write(std::ostream& os) const override; public: From f3913c4ccbd1466594213b1bc710f0340775b9ef Mon Sep 17 00:00:00 2001 From: Oleksandr Zinenko Date: Mon, 9 Jul 2018 14:35:41 +0200 Subject: [PATCH 057/152] ScheduleTreeSequence: hide constructor ScheduleTree nodes are not supposed to be kept by value, only via unique pointers. Make the main constructor private. External callers must use the newly introduced function ScheduleTreeSequence::make that returns a unique pointer. --- tc/core/polyhedral/schedule_isl_conversion.cc | 2 +- tc/core/polyhedral/schedule_tree.h | 6 +++--- tc/core/polyhedral/schedule_tree_elem.cc | 9 +++++++++ tc/core/polyhedral/schedule_tree_elem.h | 8 ++++++++ 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/tc/core/polyhedral/schedule_isl_conversion.cc b/tc/core/polyhedral/schedule_isl_conversion.cc index 998c9744e..781e023dc 100644 --- a/tc/core/polyhedral/schedule_isl_conversion.cc +++ b/tc/core/polyhedral/schedule_isl_conversion.cc @@ -274,7 +274,7 @@ std::unique_ptr elemFromIslScheduleNode(isl::schedule_node node) { LOG(FATAL) << "ScheduleTree::make called on explicit leaf"; return nullptr; } else if (node.isa()) { - return std::unique_ptr(new ScheduleTreeSequence(ctx)); + return ScheduleTreeSequence::make(ctx); } else if (node.isa()) { return std::unique_ptr(new ScheduleTreeSet(ctx)); } diff --git a/tc/core/polyhedral/schedule_tree.h b/tc/core/polyhedral/schedule_tree.h index 0dad0723c..83bef81d2 100644 --- a/tc/core/polyhedral/schedule_tree.h +++ b/tc/core/polyhedral/schedule_tree.h @@ -401,11 +401,11 @@ struct ScheduleTree { "Arguments must be rvalue references to ScheduleTreeUPtr"); auto ctx = arg->ctx_; - auto res = new T(ctx); - flattenSequenceOrSet(res); + auto res = T::make(ctx); + flattenSequenceOrSet(res.get()); res->appendChildren( vectorFromArgs(std::forward(arg), std::forward(args)...)); - return ScheduleTreeUPtr(res); + return res; } // Make a (deep) copy of "tree". diff --git a/tc/core/polyhedral/schedule_tree_elem.cc b/tc/core/polyhedral/schedule_tree_elem.cc index b21f316b7..763bd8720 100644 --- a/tc/core/polyhedral/schedule_tree_elem.cc +++ b/tc/core/polyhedral/schedule_tree_elem.cc @@ -106,6 +106,15 @@ ScheduleTreeMapping::ScheduleTreeMapping( } } +std::unique_ptr ScheduleTreeSequence::make( + isl::ctx ctx, + std::vector&& children) { + auto res = + std::unique_ptr(new ScheduleTreeSequence(ctx)); + res->appendChildren(std::move(children)); + return res; +} + std::unique_ptr ScheduleTreeBand::fromMultiUnionPwAff( isl::multi_union_pw_aff mupa) { isl::ctx ctx(mupa.get_ctx()); diff --git a/tc/core/polyhedral/schedule_tree_elem.h b/tc/core/polyhedral/schedule_tree_elem.h index 57f56dfd0..05f8120ca 100644 --- a/tc/core/polyhedral/schedule_tree_elem.h +++ b/tc/core/polyhedral/schedule_tree_elem.h @@ -189,11 +189,15 @@ struct ScheduleTreeMapping : public ScheduleTree { }; struct ScheduleTreeSequence : public ScheduleTree { + public: static constexpr detail::ScheduleTreeType NodeType = detail::ScheduleTreeType::Sequence; + private: explicit ScheduleTreeSequence(isl::ctx ctx) : ScheduleTree(ctx, {}, NodeType) {} + + public: ScheduleTreeSequence(const ScheduleTreeSequence& eb) : ScheduleTree(eb) {} virtual ~ScheduleTreeSequence() override {} @@ -202,6 +206,10 @@ struct ScheduleTreeSequence : public ScheduleTree { return !(*this == other); } + static std::unique_ptr make( + isl::ctx ctx, + std::vector&& children = {}); + virtual std::ostream& write(std::ostream& os) const override; }; From 2b41d2b5670bce5095067b782e6253ce7cb5ac88 Mon Sep 17 00:00:00 2001 From: Oleksandr Zinenko Date: Mon, 9 Jul 2018 14:40:53 +0200 Subject: [PATCH 058/152] ScheduleTreeSet: hide constructor ScheduleTree nodes are not supposed to be kept by value, only via unique pointers. Make the main constructor private. External callers must use the newly introduced function ScheduleTreeSet::make that returns a unique pointer. --- tc/core/polyhedral/schedule_isl_conversion.cc | 2 +- tc/core/polyhedral/schedule_tree_elem.cc | 8 ++++++++ tc/core/polyhedral/schedule_tree_elem.h | 8 ++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/tc/core/polyhedral/schedule_isl_conversion.cc b/tc/core/polyhedral/schedule_isl_conversion.cc index 781e023dc..b8e95a446 100644 --- a/tc/core/polyhedral/schedule_isl_conversion.cc +++ b/tc/core/polyhedral/schedule_isl_conversion.cc @@ -276,7 +276,7 @@ std::unique_ptr elemFromIslScheduleNode(isl::schedule_node node) { } else if (node.isa()) { return ScheduleTreeSequence::make(ctx); } else if (node.isa()) { - return std::unique_ptr(new ScheduleTreeSet(ctx)); + return ScheduleTreeSet::make(ctx); } LOG(FATAL) << "NYI: ScheduleTree from type: " << isl_schedule_node_get_type(node.get()); diff --git a/tc/core/polyhedral/schedule_tree_elem.cc b/tc/core/polyhedral/schedule_tree_elem.cc index 763bd8720..0d2002da6 100644 --- a/tc/core/polyhedral/schedule_tree_elem.cc +++ b/tc/core/polyhedral/schedule_tree_elem.cc @@ -115,6 +115,14 @@ std::unique_ptr ScheduleTreeSequence::make( return res; } +std::unique_ptr ScheduleTreeSet::make( + isl::ctx ctx, + std::vector&& children) { + auto res = std::unique_ptr(new ScheduleTreeSet(ctx)); + res->appendChildren(std::move(children)); + return res; +} + std::unique_ptr ScheduleTreeBand::fromMultiUnionPwAff( isl::multi_union_pw_aff mupa) { isl::ctx ctx(mupa.get_ctx()); diff --git a/tc/core/polyhedral/schedule_tree_elem.h b/tc/core/polyhedral/schedule_tree_elem.h index 05f8120ca..14e42a4f4 100644 --- a/tc/core/polyhedral/schedule_tree_elem.h +++ b/tc/core/polyhedral/schedule_tree_elem.h @@ -214,10 +214,14 @@ struct ScheduleTreeSequence : public ScheduleTree { }; struct ScheduleTreeSet : public ScheduleTree { + public: static constexpr detail::ScheduleTreeType NodeType = detail::ScheduleTreeType::Set; + private: explicit ScheduleTreeSet(isl::ctx ctx) : ScheduleTree(ctx, {}, NodeType) {} + + public: ScheduleTreeSet(const ScheduleTreeSet& eb) : ScheduleTree(eb) {} virtual ~ScheduleTreeSet() override {} @@ -226,6 +230,10 @@ struct ScheduleTreeSet : public ScheduleTree { return !(*this == other); } + static std::unique_ptr make( + isl::ctx ctx, + std::vector&& children = {}); + virtual std::ostream& write(std::ostream& os) const override; }; From a03ad7d77eed4cc81b43606643f77d606e8f8df7 Mon Sep 17 00:00:00 2001 From: Oleksandr Zinenko Date: Mon, 9 Jul 2018 14:45:26 +0200 Subject: [PATCH 059/152] ScheduleTreeBand: rename fromMultiUnionPwAff to make This function was introduced in the prehistory to serve as a static constructor for ScheduleTreeBand. Make its name consistent with other nodes. --- tc/core/polyhedral/schedule_isl_conversion.cc | 2 +- tc/core/polyhedral/schedule_tree.cc | 2 +- tc/core/polyhedral/schedule_tree_elem.cc | 2 +- tc/core/polyhedral/schedule_tree_elem.h | 3 +-- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/tc/core/polyhedral/schedule_isl_conversion.cc b/tc/core/polyhedral/schedule_isl_conversion.cc index b8e95a446..2a9b4e940 100644 --- a/tc/core/polyhedral/schedule_isl_conversion.cc +++ b/tc/core/polyhedral/schedule_isl_conversion.cc @@ -237,7 +237,7 @@ namespace { std::unique_ptr fromIslScheduleNodeBand( isl::schedule_node_band b) { - auto res = ScheduleTreeBand::fromMultiUnionPwAff(b.get_partial_schedule()); + auto res = ScheduleTreeBand::make(b.get_partial_schedule()); res->permutable_ = b.get_permutable(); for (size_t i = 0; i < b.n_member(); ++i) { res->coincident_[i] = b.member_get_coincident(i); diff --git a/tc/core/polyhedral/schedule_tree.cc b/tc/core/polyhedral/schedule_tree.cc index 777f77e05..4b54e7361 100644 --- a/tc/core/polyhedral/schedule_tree.cc +++ b/tc/core/polyhedral/schedule_tree.cc @@ -226,7 +226,7 @@ size_t ScheduleTree::scheduleDepth(const ScheduleTree* relativeRoot) const { std::unique_ptr ScheduleTree::makeBand( isl::multi_union_pw_aff mupa, std::vector&& children) { - auto res = ScheduleTreeBand::fromMultiUnionPwAff(mupa); + auto res = ScheduleTreeBand::make(mupa); res->appendChildren(std::move(children)); return res; } diff --git a/tc/core/polyhedral/schedule_tree_elem.cc b/tc/core/polyhedral/schedule_tree_elem.cc index 0d2002da6..4522cb65a 100644 --- a/tc/core/polyhedral/schedule_tree_elem.cc +++ b/tc/core/polyhedral/schedule_tree_elem.cc @@ -123,7 +123,7 @@ std::unique_ptr ScheduleTreeSet::make( return res; } -std::unique_ptr ScheduleTreeBand::fromMultiUnionPwAff( +std::unique_ptr ScheduleTreeBand::make( isl::multi_union_pw_aff mupa) { isl::ctx ctx(mupa.get_ctx()); std::unique_ptr band(new ScheduleTreeBand(ctx)); diff --git a/tc/core/polyhedral/schedule_tree_elem.h b/tc/core/polyhedral/schedule_tree_elem.h index 14e42a4f4..9bf9e3ee0 100644 --- a/tc/core/polyhedral/schedule_tree_elem.h +++ b/tc/core/polyhedral/schedule_tree_elem.h @@ -264,8 +264,7 @@ struct ScheduleTreeBand : public ScheduleTree { // schedule is always integral. // The band is not marked permutable, the dimensions are not marked // coincident and are not marked for unrolling. - static std::unique_ptr fromMultiUnionPwAff( - isl::multi_union_pw_aff mupa); + static std::unique_ptr make(isl::multi_union_pw_aff mupa); // Return the number of scheduling dimensions in the band size_t nMember() const; From bc150dbbb5f0a31ee0a14dae90938b447ee59c4c Mon Sep 17 00:00:00 2001 From: Oleksandr Zinenko Date: Mon, 9 Jul 2018 15:12:53 +0200 Subject: [PATCH 060/152] ScheduleTreeThreadSpecificMarker: hide constructor ScheduleTree nodes are not supposed to be kept by value, only via unique pointers. Make the main constructor private. External callers must use the newly introduced function ScheduleTreeThreadSpecificMarker::make that returns a unique pointer. --- tc/core/polyhedral/schedule_tree.cc | 5 +---- tc/core/polyhedral/schedule_tree_elem.cc | 10 ++++++++++ tc/core/polyhedral/schedule_tree_elem.h | 8 ++++++++ 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/tc/core/polyhedral/schedule_tree.cc b/tc/core/polyhedral/schedule_tree.cc index 4b54e7361..b20b0f525 100644 --- a/tc/core/polyhedral/schedule_tree.cc +++ b/tc/core/polyhedral/schedule_tree.cc @@ -284,10 +284,7 @@ std::unique_ptr ScheduleTree::makeExtension( std::unique_ptr ScheduleTree::makeThreadSpecificMarker( isl::ctx ctx, std::vector&& children) { - auto res = - std::unique_ptr(new ScheduleTreeThreadSpecificMarker(ctx)); - res->appendChildren(std::move(children)); - return res; + return ScheduleTreeThreadSpecificMarker::make(ctx, std::move(children)); } //////////////////////////////////////////////////////////////////////////////// diff --git a/tc/core/polyhedral/schedule_tree_elem.cc b/tc/core/polyhedral/schedule_tree_elem.cc index 4522cb65a..04c6b9364 100644 --- a/tc/core/polyhedral/schedule_tree_elem.cc +++ b/tc/core/polyhedral/schedule_tree_elem.cc @@ -186,6 +186,16 @@ isl::multi_union_pw_aff ScheduleTreeBand::memberRange(size_t first, size_t n) return isl::multi_union_pw_aff(space, list); } +std::unique_ptr +ScheduleTreeThreadSpecificMarker::make( + isl::ctx ctx, + std::vector&& children) { + auto res = std::unique_ptr( + new ScheduleTreeThreadSpecificMarker(ctx)); + res->appendChildren(std::move(children)); + return res; +} + bool ScheduleTreeBand::operator==(const ScheduleTreeBand& other) const { if (permutable_ != other.permutable_) { return false; diff --git a/tc/core/polyhedral/schedule_tree_elem.h b/tc/core/polyhedral/schedule_tree_elem.h index 9bf9e3ee0..ad13c4488 100644 --- a/tc/core/polyhedral/schedule_tree_elem.h +++ b/tc/core/polyhedral/schedule_tree_elem.h @@ -297,11 +297,15 @@ struct ScheduleTreeBand : public ScheduleTree { * underneath the innermost band member mapped to threads. */ struct ScheduleTreeThreadSpecificMarker : public ScheduleTree { + public: static constexpr detail::ScheduleTreeType NodeType = detail::ScheduleTreeType::ThreadSpecificMarker; + private: explicit ScheduleTreeThreadSpecificMarker(isl::ctx ctx) : ScheduleTree(ctx, {}, NodeType) {} + + public: virtual ~ScheduleTreeThreadSpecificMarker() override {} bool operator==(const ScheduleTreeThreadSpecificMarker& other) const { @@ -311,6 +315,10 @@ struct ScheduleTreeThreadSpecificMarker : public ScheduleTree { return !(*this == other); } + static std::unique_ptr make( + isl::ctx ctx, + std::vector&& children = {}); + virtual std::ostream& write(std::ostream& os) const override; }; From ef1aeac9ff126f093267c7808e734574a2c806c9 Mon Sep 17 00:00:00 2001 From: Oleksandr Zinenko Date: Mon, 9 Jul 2018 14:55:20 +0200 Subject: [PATCH 061/152] ScheduleTreeBand::make take more arguments Original implementation dating back to the prehistory was setting all flags to false. Take their values as arguments instead to be more consistent with other ScheduleTree*::make functions. Also take a list of child nodes, defaulted to empty. --- tc/core/polyhedral/schedule_isl_conversion.cc | 12 +++++++----- tc/core/polyhedral/schedule_tree.cc | 6 ++++-- tc/core/polyhedral/schedule_tree_elem.cc | 15 +++++++++++---- tc/core/polyhedral/schedule_tree_elem.h | 12 ++++++++---- 4 files changed, 30 insertions(+), 15 deletions(-) diff --git a/tc/core/polyhedral/schedule_isl_conversion.cc b/tc/core/polyhedral/schedule_isl_conversion.cc index 2a9b4e940..67e51e969 100644 --- a/tc/core/polyhedral/schedule_isl_conversion.cc +++ b/tc/core/polyhedral/schedule_isl_conversion.cc @@ -237,12 +237,14 @@ namespace { std::unique_ptr fromIslScheduleNodeBand( isl::schedule_node_band b) { - auto res = ScheduleTreeBand::make(b.get_partial_schedule()); - res->permutable_ = b.get_permutable(); - for (size_t i = 0; i < b.n_member(); ++i) { - res->coincident_[i] = b.member_get_coincident(i); + auto n = b.n_member(); + std::vector coincident(n, false); + std::vector unroll(n, false); + for (size_t i = 0; i < n; ++i) { + coincident[i] = b.member_get_coincident(i); } - return res; + return ScheduleTreeBand::make( + b.get_partial_schedule(), b.get_permutable(), coincident, unroll); } std::unique_ptr elemFromIslScheduleNode(isl::schedule_node node) { diff --git a/tc/core/polyhedral/schedule_tree.cc b/tc/core/polyhedral/schedule_tree.cc index b20b0f525..19598750a 100644 --- a/tc/core/polyhedral/schedule_tree.cc +++ b/tc/core/polyhedral/schedule_tree.cc @@ -226,8 +226,10 @@ size_t ScheduleTree::scheduleDepth(const ScheduleTree* relativeRoot) const { std::unique_ptr ScheduleTree::makeBand( isl::multi_union_pw_aff mupa, std::vector&& children) { - auto res = ScheduleTreeBand::make(mupa); - res->appendChildren(std::move(children)); + std::vector coincident(mupa.size(), false); + std::vector unroll(mupa.size(), false); + auto res = ScheduleTreeBand::make( + mupa, false, coincident, unroll, std::move(children)); return res; } diff --git a/tc/core/polyhedral/schedule_tree_elem.cc b/tc/core/polyhedral/schedule_tree_elem.cc index 04c6b9364..4ba76f44e 100644 --- a/tc/core/polyhedral/schedule_tree_elem.cc +++ b/tc/core/polyhedral/schedule_tree_elem.cc @@ -124,13 +124,20 @@ std::unique_ptr ScheduleTreeSet::make( } std::unique_ptr ScheduleTreeBand::make( - isl::multi_union_pw_aff mupa) { + isl::multi_union_pw_aff mupa, + bool permutable, + std::vector coincident, + std::vector unroll, + std::vector&& children) { + TC_CHECK_EQ(static_cast(mupa.size()), coincident.size()); + TC_CHECK_EQ(static_cast(mupa.size()), unroll.size()); isl::ctx ctx(mupa.get_ctx()); std::unique_ptr band(new ScheduleTreeBand(ctx)); + band->permutable_ = permutable; band->mupa_ = mupa.floor(); - size_t n = band->mupa_.size(); - band->coincident_ = vector(n, false); - band->unroll_ = vector(n, false); + band->coincident_ = coincident; + band->unroll_ = unroll; + band->appendChildren(std::move(children)); return band; } diff --git a/tc/core/polyhedral/schedule_tree_elem.h b/tc/core/polyhedral/schedule_tree_elem.h index ad13c4488..5281d9f04 100644 --- a/tc/core/polyhedral/schedule_tree_elem.h +++ b/tc/core/polyhedral/schedule_tree_elem.h @@ -260,11 +260,15 @@ struct ScheduleTreeBand : public ScheduleTree { virtual std::ostream& write(std::ostream& os) const override; - // First replace "mupa" by its greatest integer part to ensure that the + // Make a schedule node band from partial schedule. + // Replace "mupa" by its greatest integer part to ensure that the // schedule is always integral. - // The band is not marked permutable, the dimensions are not marked - // coincident and are not marked for unrolling. - static std::unique_ptr make(isl::multi_union_pw_aff mupa); + static std::unique_ptr make( + isl::multi_union_pw_aff mupa, + bool permutable, + std::vector coincident, + std::vector unroll, + std::vector&& children = {}); // Return the number of scheduling dimensions in the band size_t nMember() const; From 066affad517d0cdb97a438289e3571bbc22a99c9 Mon Sep 17 00:00:00 2001 From: Oleksandr Zinenko Date: Wed, 11 Jul 2018 11:30:58 +0200 Subject: [PATCH 062/152] ScheduleTreeContext: hide copy constructor ScheduleTree nodes are not supposed to be manipulated by-value, only via unique pointers. Make the copy constructor of ScheduleTreeContext private, similarly to its main constructor, and provide a static member function to return copies wrapped in a unique pointer. Note that unlike the conventional copy constructor, this static function takes a pointer to the tree rather than a reference. This keeps the API consistent as all other functions manipulate with pointers to the tree nodes rather than references. --- tc/core/polyhedral/schedule_tree.cc | 8 +++++++- tc/core/polyhedral/schedule_tree_elem.cc | 9 +++++++++ tc/core/polyhedral/schedule_tree_elem.h | 7 +++++-- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/tc/core/polyhedral/schedule_tree.cc b/tc/core/polyhedral/schedule_tree.cc index 19598750a..1b7a7cfe9 100644 --- a/tc/core/polyhedral/schedule_tree.cc +++ b/tc/core/polyhedral/schedule_tree.cc @@ -129,11 +129,16 @@ static std::unique_ptr makeElem(const ScheduleTree& st) { return std::unique_ptr(new CLASS(static_cast(st))); \ } +#define ELEM_MAKE_CASE_CSTR(CLASS) \ + else if (st.type_ == CLASS::NodeType) { \ + return CLASS::make(static_cast(&st)); \ + } + if (st.type_ == detail::ScheduleTreeType::None) { LOG(FATAL) << "Hit Error node!"; } ELEM_MAKE_CASE(ScheduleTreeBand) - ELEM_MAKE_CASE(ScheduleTreeContext) + ELEM_MAKE_CASE_CSTR(ScheduleTreeContext) ELEM_MAKE_CASE(ScheduleTreeDomain) ELEM_MAKE_CASE(ScheduleTreeExtension) ELEM_MAKE_CASE(ScheduleTreeFilter) @@ -142,6 +147,7 @@ static std::unique_ptr makeElem(const ScheduleTree& st) { ELEM_MAKE_CASE(ScheduleTreeSet) ELEM_MAKE_CASE(ScheduleTreeThreadSpecificMarker) +#undef ELEM_MAKE_CASE_CSTR #undef ELEM_MAKE_CASE LOG(FATAL) << "NYI: ScheduleTree from type: " << static_cast(st.type_); diff --git a/tc/core/polyhedral/schedule_tree_elem.cc b/tc/core/polyhedral/schedule_tree_elem.cc index 4ba76f44e..ef9444b77 100644 --- a/tc/core/polyhedral/schedule_tree_elem.cc +++ b/tc/core/polyhedral/schedule_tree_elem.cc @@ -46,6 +46,15 @@ std::unique_ptr ScheduleTreeContext::make( return res; } +std::unique_ptr ScheduleTreeContext::make( + const ScheduleTreeContext* tree, + std::vector&& children) { + auto res = + std::unique_ptr(new ScheduleTreeContext(*tree)); + res->appendChildren(std::move(children)); + return res; +} + std::unique_ptr ScheduleTreeDomain::make( isl::union_set domain, std::vector&& children) { diff --git a/tc/core/polyhedral/schedule_tree_elem.h b/tc/core/polyhedral/schedule_tree_elem.h index 5281d9f04..71c922e39 100644 --- a/tc/core/polyhedral/schedule_tree_elem.h +++ b/tc/core/polyhedral/schedule_tree_elem.h @@ -39,15 +39,18 @@ struct ScheduleTreeContext : public ScheduleTree { ScheduleTreeContext() = delete; explicit ScheduleTreeContext(isl::set s) : ScheduleTree(s.get_ctx(), {}, NodeType), context_(s) {} - - public: ScheduleTreeContext(const ScheduleTreeContext& eb) : ScheduleTree(eb), context_(eb.context_) {} + + public: virtual ~ScheduleTreeContext() override {} static std::unique_ptr make( isl::set context, std::vector&& children = {}); + static std::unique_ptr make( + const ScheduleTreeContext* tree, + std::vector&& children = {}); bool operator==(const ScheduleTreeContext& other) const; bool operator!=(const ScheduleTreeContext& other) const { From ddef6bcb414be4459c5e569bb11f0e50c2b68a86 Mon Sep 17 00:00:00 2001 From: Oleksandr Zinenko Date: Wed, 11 Jul 2018 11:37:59 +0200 Subject: [PATCH 063/152] ScheduleTreeDomain: hide copy constructor ScheduleTree nodes are not supposed to be manipulated by-value, only via unique pointers. Make the copy constructor of ScheduleTreeDomain private, similarly to its main constructor, and provide a static member function to return copies wrapped in a unique pointer. Note that unlike the conventional copy constructor, this static function takes a pointer to the tree rather than a reference. This keeps the API consistent as all other functions manipulate with pointers to the tree nodes rather than references. --- tc/core/polyhedral/schedule_tree.cc | 2 +- tc/core/polyhedral/schedule_tree_elem.cc | 8 ++++++++ tc/core/polyhedral/schedule_tree_elem.h | 7 +++++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/tc/core/polyhedral/schedule_tree.cc b/tc/core/polyhedral/schedule_tree.cc index 1b7a7cfe9..1cf40f34a 100644 --- a/tc/core/polyhedral/schedule_tree.cc +++ b/tc/core/polyhedral/schedule_tree.cc @@ -139,7 +139,7 @@ static std::unique_ptr makeElem(const ScheduleTree& st) { } ELEM_MAKE_CASE(ScheduleTreeBand) ELEM_MAKE_CASE_CSTR(ScheduleTreeContext) - ELEM_MAKE_CASE(ScheduleTreeDomain) + ELEM_MAKE_CASE_CSTR(ScheduleTreeDomain) ELEM_MAKE_CASE(ScheduleTreeExtension) ELEM_MAKE_CASE(ScheduleTreeFilter) ELEM_MAKE_CASE(ScheduleTreeMapping) diff --git a/tc/core/polyhedral/schedule_tree_elem.cc b/tc/core/polyhedral/schedule_tree_elem.cc index ef9444b77..d65e6ac86 100644 --- a/tc/core/polyhedral/schedule_tree_elem.cc +++ b/tc/core/polyhedral/schedule_tree_elem.cc @@ -64,6 +64,14 @@ std::unique_ptr ScheduleTreeDomain::make( return res; } +std::unique_ptr ScheduleTreeDomain::make( + const ScheduleTreeDomain* tree, + std::vector&& children) { + auto res = std::unique_ptr(new ScheduleTreeDomain(*tree)); + res->appendChildren(std::move(children)); + return res; +} + std::unique_ptr ScheduleTreeExtension::make( isl::union_map extension, std::vector&& children) { diff --git a/tc/core/polyhedral/schedule_tree_elem.h b/tc/core/polyhedral/schedule_tree_elem.h index 71c922e39..76bf81513 100644 --- a/tc/core/polyhedral/schedule_tree_elem.h +++ b/tc/core/polyhedral/schedule_tree_elem.h @@ -72,15 +72,18 @@ struct ScheduleTreeDomain : public ScheduleTree { ScheduleTreeDomain() = delete; explicit ScheduleTreeDomain(isl::union_set us) : ScheduleTree(us.get_ctx(), {}, NodeType), domain_(us) {} - - public: ScheduleTreeDomain(const ScheduleTreeDomain& eb) : ScheduleTree(eb), domain_(eb.domain_) {} + + public: virtual ~ScheduleTreeDomain() override {} static std::unique_ptr make( isl::union_set domain, std::vector&& children = {}); + static std::unique_ptr make( + const ScheduleTreeDomain* tree, + std::vector&& children = {}); bool operator==(const ScheduleTreeDomain& other) const; bool operator!=(const ScheduleTreeDomain& other) const { From 55ecf11dc45298eb898f064997d80d815c2d3223 Mon Sep 17 00:00:00 2001 From: Oleksandr Zinenko Date: Wed, 11 Jul 2018 11:42:07 +0200 Subject: [PATCH 064/152] ScheduleTreeExtension: hide copy constructor ScheduleTree nodes are not supposed to be manipulated by-value, only via unique pointers. Make the copy constructor of ScheduleTreeExtension private, similarly to its main constructor, and provide a static member function to return copies wrapped in a unique pointer. Note that unlike the conventional copy constructor, this static function takes a pointer to the tree rather than a reference. This keeps the API consistent as all other functions manipulate with pointers to the tree nodes rather than references. --- tc/core/polyhedral/schedule_tree.cc | 2 +- tc/core/polyhedral/schedule_tree_elem.cc | 9 +++++++++ tc/core/polyhedral/schedule_tree_elem.h | 7 +++++-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/tc/core/polyhedral/schedule_tree.cc b/tc/core/polyhedral/schedule_tree.cc index 1cf40f34a..c82ac4aeb 100644 --- a/tc/core/polyhedral/schedule_tree.cc +++ b/tc/core/polyhedral/schedule_tree.cc @@ -140,7 +140,7 @@ static std::unique_ptr makeElem(const ScheduleTree& st) { ELEM_MAKE_CASE(ScheduleTreeBand) ELEM_MAKE_CASE_CSTR(ScheduleTreeContext) ELEM_MAKE_CASE_CSTR(ScheduleTreeDomain) - ELEM_MAKE_CASE(ScheduleTreeExtension) + ELEM_MAKE_CASE_CSTR(ScheduleTreeExtension) ELEM_MAKE_CASE(ScheduleTreeFilter) ELEM_MAKE_CASE(ScheduleTreeMapping) ELEM_MAKE_CASE(ScheduleTreeSequence) diff --git a/tc/core/polyhedral/schedule_tree_elem.cc b/tc/core/polyhedral/schedule_tree_elem.cc index d65e6ac86..e9e68fc85 100644 --- a/tc/core/polyhedral/schedule_tree_elem.cc +++ b/tc/core/polyhedral/schedule_tree_elem.cc @@ -81,6 +81,15 @@ std::unique_ptr ScheduleTreeExtension::make( return res; } +std::unique_ptr ScheduleTreeExtension::make( + const ScheduleTreeExtension* tree, + std::vector&& children) { + auto res = + std::unique_ptr(new ScheduleTreeExtension(*tree)); + res->appendChildren(std::move(children)); + return res; +} + std::unique_ptr ScheduleTreeFilter::make( isl::union_set filter, std::vector&& children) { diff --git a/tc/core/polyhedral/schedule_tree_elem.h b/tc/core/polyhedral/schedule_tree_elem.h index 76bf81513..98abaa576 100644 --- a/tc/core/polyhedral/schedule_tree_elem.h +++ b/tc/core/polyhedral/schedule_tree_elem.h @@ -105,15 +105,18 @@ struct ScheduleTreeExtension : public ScheduleTree { ScheduleTreeExtension() = delete; explicit ScheduleTreeExtension(isl::union_map m) : ScheduleTree(m.get_ctx(), {}, NodeType), extension_(m) {} - - public: ScheduleTreeExtension(const ScheduleTreeExtension& eb) : ScheduleTree(eb), extension_(eb.extension_) {} + + public: virtual ~ScheduleTreeExtension() override {} static std::unique_ptr make( isl::union_map extension, std::vector&& children = {}); + static std::unique_ptr make( + const ScheduleTreeExtension* tree, + std::vector&& children = {}); bool operator==(const ScheduleTreeExtension& other) const; bool operator!=(const ScheduleTreeExtension& other) const { From e326124c17c7defb4f260160adedb20402c97e52 Mon Sep 17 00:00:00 2001 From: Oleksandr Zinenko Date: Wed, 11 Jul 2018 11:46:41 +0200 Subject: [PATCH 065/152] ScheduleTreeFilter: hide copy constructor ScheduleTree nodes are not supposed to be manipulated by-value, only via unique pointers. Make the copy constructor of ScheduleTreeFilter private, similarly to its main constructor, and provide a static member function to return copies wrapped in a unique pointer. Note that unlike the conventional copy constructor, this static function takes a pointer to the tree rather than a reference. This keeps the API consistent as all other functions manipulate with pointers to the tree nodes rather than references. --- tc/core/polyhedral/schedule_tree.cc | 2 +- tc/core/polyhedral/schedule_tree_elem.cc | 8 ++++++++ tc/core/polyhedral/schedule_tree_elem.h | 7 +++++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/tc/core/polyhedral/schedule_tree.cc b/tc/core/polyhedral/schedule_tree.cc index c82ac4aeb..9067b5c89 100644 --- a/tc/core/polyhedral/schedule_tree.cc +++ b/tc/core/polyhedral/schedule_tree.cc @@ -141,7 +141,7 @@ static std::unique_ptr makeElem(const ScheduleTree& st) { ELEM_MAKE_CASE_CSTR(ScheduleTreeContext) ELEM_MAKE_CASE_CSTR(ScheduleTreeDomain) ELEM_MAKE_CASE_CSTR(ScheduleTreeExtension) - ELEM_MAKE_CASE(ScheduleTreeFilter) + ELEM_MAKE_CASE_CSTR(ScheduleTreeFilter) ELEM_MAKE_CASE(ScheduleTreeMapping) ELEM_MAKE_CASE(ScheduleTreeSequence) ELEM_MAKE_CASE(ScheduleTreeSet) diff --git a/tc/core/polyhedral/schedule_tree_elem.cc b/tc/core/polyhedral/schedule_tree_elem.cc index e9e68fc85..02c83f641 100644 --- a/tc/core/polyhedral/schedule_tree_elem.cc +++ b/tc/core/polyhedral/schedule_tree_elem.cc @@ -99,6 +99,14 @@ std::unique_ptr ScheduleTreeFilter::make( return res; } +std::unique_ptr ScheduleTreeFilter::make( + const ScheduleTreeFilter* tree, + std::vector&& children) { + auto res = std::unique_ptr(new ScheduleTreeFilter(*tree)); + res->appendChildren(std::move(children)); + return res; +} + std::unique_ptr ScheduleTreeMapping::make( isl::ctx ctx, const ScheduleTreeMapping::Mapping& mapping, diff --git a/tc/core/polyhedral/schedule_tree_elem.h b/tc/core/polyhedral/schedule_tree_elem.h index 98abaa576..3f6759b94 100644 --- a/tc/core/polyhedral/schedule_tree_elem.h +++ b/tc/core/polyhedral/schedule_tree_elem.h @@ -138,10 +138,10 @@ struct ScheduleTreeFilter : public ScheduleTree { ScheduleTreeFilter() = delete; explicit ScheduleTreeFilter(isl::union_set s) : ScheduleTree(s.get_ctx(), {}, NodeType), filter_(s) {} - - public: ScheduleTreeFilter(const ScheduleTreeFilter& eb) : ScheduleTree(eb), filter_(eb.filter_) {} + + public: virtual ~ScheduleTreeFilter() override {} bool operator==(const ScheduleTreeFilter& other) const; @@ -152,6 +152,9 @@ struct ScheduleTreeFilter : public ScheduleTree { static std::unique_ptr make( isl::union_set filter, std::vector&& children = {}); + static std::unique_ptr make( + const ScheduleTreeFilter* tree, + std::vector&& children = {}); virtual std::ostream& write(std::ostream& os) const override; From ac7fee48011909363536ee31ad49b1a19271c16c Mon Sep 17 00:00:00 2001 From: Oleksandr Zinenko Date: Wed, 11 Jul 2018 11:49:59 +0200 Subject: [PATCH 066/152] ScheduleTreeMapping: hide copy constructor ScheduleTree nodes are not supposed to be manipulated by-value, only via unique pointers. Make the copy constructor of ScheduleTreeMapping private, similarly to its main constructor, and provide a static member function to return copies wrapped in a unique pointer. Note that unlike the conventional copy constructor, this static function takes a pointer to the tree rather than a reference. This keeps the API consistent as all other functions manipulate with pointers to the tree nodes rather than references. --- tc/core/polyhedral/schedule_tree.cc | 2 +- tc/core/polyhedral/schedule_tree_elem.cc | 9 +++++++++ tc/core/polyhedral/schedule_tree_elem.h | 7 +++++-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/tc/core/polyhedral/schedule_tree.cc b/tc/core/polyhedral/schedule_tree.cc index 9067b5c89..b174e9005 100644 --- a/tc/core/polyhedral/schedule_tree.cc +++ b/tc/core/polyhedral/schedule_tree.cc @@ -142,7 +142,7 @@ static std::unique_ptr makeElem(const ScheduleTree& st) { ELEM_MAKE_CASE_CSTR(ScheduleTreeDomain) ELEM_MAKE_CASE_CSTR(ScheduleTreeExtension) ELEM_MAKE_CASE_CSTR(ScheduleTreeFilter) - ELEM_MAKE_CASE(ScheduleTreeMapping) + ELEM_MAKE_CASE_CSTR(ScheduleTreeMapping) ELEM_MAKE_CASE(ScheduleTreeSequence) ELEM_MAKE_CASE(ScheduleTreeSet) ELEM_MAKE_CASE(ScheduleTreeThreadSpecificMarker) diff --git a/tc/core/polyhedral/schedule_tree_elem.cc b/tc/core/polyhedral/schedule_tree_elem.cc index 02c83f641..e3928dd86 100644 --- a/tc/core/polyhedral/schedule_tree_elem.cc +++ b/tc/core/polyhedral/schedule_tree_elem.cc @@ -117,6 +117,15 @@ std::unique_ptr ScheduleTreeMapping::make( return res; } +std::unique_ptr ScheduleTreeMapping::make( + const ScheduleTreeMapping* tree, + std::vector&& children) { + auto res = + std::unique_ptr(new ScheduleTreeMapping(*tree)); + res->appendChildren(std::move(children)); + return res; +} + ScheduleTreeMapping::ScheduleTreeMapping( isl::ctx ctx, const ScheduleTreeMapping::Mapping& mapping) diff --git a/tc/core/polyhedral/schedule_tree_elem.h b/tc/core/polyhedral/schedule_tree_elem.h index 3f6759b94..e6a54154c 100644 --- a/tc/core/polyhedral/schedule_tree_elem.h +++ b/tc/core/polyhedral/schedule_tree_elem.h @@ -175,10 +175,10 @@ struct ScheduleTreeMapping : public ScheduleTree { private: ScheduleTreeMapping() = delete; ScheduleTreeMapping(isl::ctx ctx, const Mapping& mapping); - - public: ScheduleTreeMapping(const ScheduleTreeMapping& eb) : ScheduleTree(eb), mapping(eb.mapping), filter_(eb.filter_) {} + + public: virtual ~ScheduleTreeMapping() override {} bool operator==(const ScheduleTreeMapping& other) const; @@ -190,6 +190,9 @@ struct ScheduleTreeMapping : public ScheduleTree { isl::ctx ctx, const Mapping& mapping, std::vector&& children = {}); + static std::unique_ptr make( + const ScheduleTreeMapping* tree, + std::vector&& children = {}); virtual std::ostream& write(std::ostream& os) const override; From 6d09b28b9971db755a890bad00e4429e10c7e3a8 Mon Sep 17 00:00:00 2001 From: Oleksandr Zinenko Date: Wed, 11 Jul 2018 11:51:34 +0200 Subject: [PATCH 067/152] ScheduleTreeSequence: hide copy constructor ScheduleTree nodes are not supposed to be manipulated by-value, only via unique pointers. Make the copy constructor of ScheduleTreeSequence private, similarly to its main constructor, and provide a static member function to return copies wrapped in a unique pointer. Note that unlike the conventional copy constructor, this static function takes a pointer to the tree rather than a reference. This keeps the API consistent as all other functions manipulate with pointers to the tree nodes rather than references. --- tc/core/polyhedral/schedule_tree.cc | 2 +- tc/core/polyhedral/schedule_tree_elem.cc | 9 +++++++++ tc/core/polyhedral/schedule_tree_elem.h | 5 ++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/tc/core/polyhedral/schedule_tree.cc b/tc/core/polyhedral/schedule_tree.cc index b174e9005..e2df41c04 100644 --- a/tc/core/polyhedral/schedule_tree.cc +++ b/tc/core/polyhedral/schedule_tree.cc @@ -143,7 +143,7 @@ static std::unique_ptr makeElem(const ScheduleTree& st) { ELEM_MAKE_CASE_CSTR(ScheduleTreeExtension) ELEM_MAKE_CASE_CSTR(ScheduleTreeFilter) ELEM_MAKE_CASE_CSTR(ScheduleTreeMapping) - ELEM_MAKE_CASE(ScheduleTreeSequence) + ELEM_MAKE_CASE_CSTR(ScheduleTreeSequence) ELEM_MAKE_CASE(ScheduleTreeSet) ELEM_MAKE_CASE(ScheduleTreeThreadSpecificMarker) diff --git a/tc/core/polyhedral/schedule_tree_elem.cc b/tc/core/polyhedral/schedule_tree_elem.cc index e3928dd86..8e6f7622f 100644 --- a/tc/core/polyhedral/schedule_tree_elem.cc +++ b/tc/core/polyhedral/schedule_tree_elem.cc @@ -158,6 +158,15 @@ std::unique_ptr ScheduleTreeSequence::make( return res; } +std::unique_ptr ScheduleTreeSequence::make( + const ScheduleTreeSequence* tree, + std::vector&& children) { + auto res = + std::unique_ptr(new ScheduleTreeSequence(*tree)); + res->appendChildren(std::move(children)); + return res; +} + std::unique_ptr ScheduleTreeSet::make( isl::ctx ctx, std::vector&& children) { diff --git a/tc/core/polyhedral/schedule_tree_elem.h b/tc/core/polyhedral/schedule_tree_elem.h index e6a54154c..96048772e 100644 --- a/tc/core/polyhedral/schedule_tree_elem.h +++ b/tc/core/polyhedral/schedule_tree_elem.h @@ -211,9 +211,9 @@ struct ScheduleTreeSequence : public ScheduleTree { private: explicit ScheduleTreeSequence(isl::ctx ctx) : ScheduleTree(ctx, {}, NodeType) {} + ScheduleTreeSequence(const ScheduleTreeSequence& eb) : ScheduleTree(eb) {} public: - ScheduleTreeSequence(const ScheduleTreeSequence& eb) : ScheduleTree(eb) {} virtual ~ScheduleTreeSequence() override {} bool operator==(const ScheduleTreeSequence& other) const; @@ -224,6 +224,9 @@ struct ScheduleTreeSequence : public ScheduleTree { static std::unique_ptr make( isl::ctx ctx, std::vector&& children = {}); + static std::unique_ptr make( + const ScheduleTreeSequence* tree, + std::vector&& children = {}); virtual std::ostream& write(std::ostream& os) const override; }; From ff810a8a785f51ce8d884c33423598df1e3f173f Mon Sep 17 00:00:00 2001 From: Oleksandr Zinenko Date: Wed, 11 Jul 2018 11:53:40 +0200 Subject: [PATCH 068/152] ScheduleTreeSet: hide copy constructor ScheduleTree nodes are not supposed to be manipulated by-value, only via unique pointers. Make the copy constructor of ScheduleTreeSet private, similarly to its main constructor, and provide a static member function to return copies wrapped in a unique pointer. Note that unlike the conventional copy constructor, this static function takes a pointer to the tree rather than a reference. This keeps the API consistent as all other functions manipulate with pointers to the tree nodes rather than references. --- tc/core/polyhedral/schedule_tree.cc | 2 +- tc/core/polyhedral/schedule_tree_elem.cc | 8 ++++++++ tc/core/polyhedral/schedule_tree_elem.h | 5 ++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/tc/core/polyhedral/schedule_tree.cc b/tc/core/polyhedral/schedule_tree.cc index e2df41c04..6b9880942 100644 --- a/tc/core/polyhedral/schedule_tree.cc +++ b/tc/core/polyhedral/schedule_tree.cc @@ -144,7 +144,7 @@ static std::unique_ptr makeElem(const ScheduleTree& st) { ELEM_MAKE_CASE_CSTR(ScheduleTreeFilter) ELEM_MAKE_CASE_CSTR(ScheduleTreeMapping) ELEM_MAKE_CASE_CSTR(ScheduleTreeSequence) - ELEM_MAKE_CASE(ScheduleTreeSet) + ELEM_MAKE_CASE_CSTR(ScheduleTreeSet) ELEM_MAKE_CASE(ScheduleTreeThreadSpecificMarker) #undef ELEM_MAKE_CASE_CSTR diff --git a/tc/core/polyhedral/schedule_tree_elem.cc b/tc/core/polyhedral/schedule_tree_elem.cc index 8e6f7622f..38b923dec 100644 --- a/tc/core/polyhedral/schedule_tree_elem.cc +++ b/tc/core/polyhedral/schedule_tree_elem.cc @@ -175,6 +175,14 @@ std::unique_ptr ScheduleTreeSet::make( return res; } +std::unique_ptr ScheduleTreeSet::make( + const ScheduleTreeSet* tree, + std::vector&& children) { + auto res = std::unique_ptr(new ScheduleTreeSet(*tree)); + res->appendChildren(std::move(children)); + return res; +} + std::unique_ptr ScheduleTreeBand::make( isl::multi_union_pw_aff mupa, bool permutable, diff --git a/tc/core/polyhedral/schedule_tree_elem.h b/tc/core/polyhedral/schedule_tree_elem.h index 96048772e..3fedc83cc 100644 --- a/tc/core/polyhedral/schedule_tree_elem.h +++ b/tc/core/polyhedral/schedule_tree_elem.h @@ -238,9 +238,9 @@ struct ScheduleTreeSet : public ScheduleTree { private: explicit ScheduleTreeSet(isl::ctx ctx) : ScheduleTree(ctx, {}, NodeType) {} + ScheduleTreeSet(const ScheduleTreeSet& eb) : ScheduleTree(eb) {} public: - ScheduleTreeSet(const ScheduleTreeSet& eb) : ScheduleTree(eb) {} virtual ~ScheduleTreeSet() override {} bool operator==(const ScheduleTreeSet& other) const; @@ -251,6 +251,9 @@ struct ScheduleTreeSet : public ScheduleTree { static std::unique_ptr make( isl::ctx ctx, std::vector&& children = {}); + static std::unique_ptr make( + const ScheduleTreeSet* tree, + std::vector&& children = {}); virtual std::ostream& write(std::ostream& os) const override; }; From b66ba3e9760d6318d448d3a0097400882b4ddce5 Mon Sep 17 00:00:00 2001 From: Oleksandr Zinenko Date: Wed, 11 Jul 2018 11:55:30 +0200 Subject: [PATCH 069/152] ScheduleTreeBand: hide copy constructor ScheduleTree nodes are not supposed to be manipulated by-value, only via unique pointers. Make the copy constructor of ScheduleTreeBand private, similarly to its main constructor, and provide a static member function to return copies wrapped in a unique pointer. Note that unlike the conventional copy constructor, this static function takes a pointer to the tree rather than a reference. This keeps the API consistent as all other functions manipulate with pointers to the tree nodes rather than references. --- tc/core/polyhedral/schedule_tree.cc | 2 +- tc/core/polyhedral/schedule_tree_elem.cc | 8 ++++++++ tc/core/polyhedral/schedule_tree_elem.h | 13 ++++++++----- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/tc/core/polyhedral/schedule_tree.cc b/tc/core/polyhedral/schedule_tree.cc index 6b9880942..f44052680 100644 --- a/tc/core/polyhedral/schedule_tree.cc +++ b/tc/core/polyhedral/schedule_tree.cc @@ -137,7 +137,7 @@ static std::unique_ptr makeElem(const ScheduleTree& st) { if (st.type_ == detail::ScheduleTreeType::None) { LOG(FATAL) << "Hit Error node!"; } - ELEM_MAKE_CASE(ScheduleTreeBand) + ELEM_MAKE_CASE_CSTR(ScheduleTreeBand) ELEM_MAKE_CASE_CSTR(ScheduleTreeContext) ELEM_MAKE_CASE_CSTR(ScheduleTreeDomain) ELEM_MAKE_CASE_CSTR(ScheduleTreeExtension) diff --git a/tc/core/polyhedral/schedule_tree_elem.cc b/tc/core/polyhedral/schedule_tree_elem.cc index 38b923dec..a7c3063be 100644 --- a/tc/core/polyhedral/schedule_tree_elem.cc +++ b/tc/core/polyhedral/schedule_tree_elem.cc @@ -201,6 +201,14 @@ std::unique_ptr ScheduleTreeBand::make( return band; } +std::unique_ptr ScheduleTreeBand::make( + const ScheduleTreeBand* tree, + std::vector&& children) { + auto res = std::unique_ptr(new ScheduleTreeBand(*tree)); + res->appendChildren(std::move(children)); + return res; +} + // Return the number of scheduling dimensions in the band size_t ScheduleTreeBand::nMember() const { size_t res = mupa_.size(); diff --git a/tc/core/polyhedral/schedule_tree_elem.h b/tc/core/polyhedral/schedule_tree_elem.h index 3fedc83cc..adb1ee99b 100644 --- a/tc/core/polyhedral/schedule_tree_elem.h +++ b/tc/core/polyhedral/schedule_tree_elem.h @@ -261,17 +261,17 @@ struct ScheduleTreeSet : public ScheduleTree { struct ScheduleTreeBand : public ScheduleTree { private: explicit ScheduleTreeBand(isl::ctx ctx) : ScheduleTree(ctx, {}, NodeType) {} - - public: - static constexpr detail::ScheduleTreeType NodeType = - detail::ScheduleTreeType::Band; - ScheduleTreeBand(const ScheduleTreeBand& eb) : ScheduleTree(eb), permutable_(eb.permutable_), mupa_(eb.mupa_), coincident_(eb.coincident_), unroll_(eb.unroll_) {} + + public: + static constexpr detail::ScheduleTreeType NodeType = + detail::ScheduleTreeType::Band; + virtual ~ScheduleTreeBand() override {} bool operator==(const ScheduleTreeBand& other) const; @@ -290,6 +290,9 @@ struct ScheduleTreeBand : public ScheduleTree { std::vector coincident, std::vector unroll, std::vector&& children = {}); + static std::unique_ptr make( + const ScheduleTreeBand* tree, + std::vector&& children = {}); // Return the number of scheduling dimensions in the band size_t nMember() const; From c4e612c39bb95e0853e7a9308a56993ec992fe37 Mon Sep 17 00:00:00 2001 From: Oleksandr Zinenko Date: Wed, 11 Jul 2018 12:01:20 +0200 Subject: [PATCH 070/152] ScheduleTreeThreadSpecificMarker: introduce (static) copy constructor Unlike other schedule tree node types, ScheduleTreeThreadSpecificMarker did not have a custom copy constructor since it was added in e1db3a98f42d8f9b1bd5f80de0161985af5664aa (insert thread specific markers, Thu Apr 19 15:07:33 2018 +0200). Introduce a private copy constructor to ScheduleTreeThreadSpecificMarker, along with the static member function that returns a copy of the given ScheduleTreeThreadSpecificMarker wrapped in a unique pointer to force the caller only keep unique pointers to schedule node trees. This commit completes the removal of public constructors from schedule node types and removes the code that became unnecessary. --- tc/core/polyhedral/schedule_tree.cc | 8 +------- tc/core/polyhedral/schedule_tree_elem.cc | 10 ++++++++++ tc/core/polyhedral/schedule_tree_elem.h | 5 +++++ 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/tc/core/polyhedral/schedule_tree.cc b/tc/core/polyhedral/schedule_tree.cc index f44052680..8eaa78739 100644 --- a/tc/core/polyhedral/schedule_tree.cc +++ b/tc/core/polyhedral/schedule_tree.cc @@ -124,11 +124,6 @@ vector ancestorsInSubTree( } static std::unique_ptr makeElem(const ScheduleTree& st) { -#define ELEM_MAKE_CASE(CLASS) \ - else if (st.type_ == CLASS::NodeType) { \ - return std::unique_ptr(new CLASS(static_cast(st))); \ - } - #define ELEM_MAKE_CASE_CSTR(CLASS) \ else if (st.type_ == CLASS::NodeType) { \ return CLASS::make(static_cast(&st)); \ @@ -145,10 +140,9 @@ static std::unique_ptr makeElem(const ScheduleTree& st) { ELEM_MAKE_CASE_CSTR(ScheduleTreeMapping) ELEM_MAKE_CASE_CSTR(ScheduleTreeSequence) ELEM_MAKE_CASE_CSTR(ScheduleTreeSet) - ELEM_MAKE_CASE(ScheduleTreeThreadSpecificMarker) + ELEM_MAKE_CASE_CSTR(ScheduleTreeThreadSpecificMarker) #undef ELEM_MAKE_CASE_CSTR -#undef ELEM_MAKE_CASE LOG(FATAL) << "NYI: ScheduleTree from type: " << static_cast(st.type_); return nullptr; diff --git a/tc/core/polyhedral/schedule_tree_elem.cc b/tc/core/polyhedral/schedule_tree_elem.cc index a7c3063be..cc7ce86ff 100644 --- a/tc/core/polyhedral/schedule_tree_elem.cc +++ b/tc/core/polyhedral/schedule_tree_elem.cc @@ -271,6 +271,16 @@ ScheduleTreeThreadSpecificMarker::make( return res; } +std::unique_ptr +ScheduleTreeThreadSpecificMarker::make( + const ScheduleTreeThreadSpecificMarker* tree, + std::vector&& children) { + auto res = std::unique_ptr( + new ScheduleTreeThreadSpecificMarker(*tree)); + res->appendChildren(std::move(children)); + return res; +} + bool ScheduleTreeBand::operator==(const ScheduleTreeBand& other) const { if (permutable_ != other.permutable_) { return false; diff --git a/tc/core/polyhedral/schedule_tree_elem.h b/tc/core/polyhedral/schedule_tree_elem.h index adb1ee99b..6982abc3f 100644 --- a/tc/core/polyhedral/schedule_tree_elem.h +++ b/tc/core/polyhedral/schedule_tree_elem.h @@ -332,6 +332,8 @@ struct ScheduleTreeThreadSpecificMarker : public ScheduleTree { private: explicit ScheduleTreeThreadSpecificMarker(isl::ctx ctx) : ScheduleTree(ctx, {}, NodeType) {} + ScheduleTreeThreadSpecificMarker(const ScheduleTreeThreadSpecificMarker& tree) + : ScheduleTree(tree) {} public: virtual ~ScheduleTreeThreadSpecificMarker() override {} @@ -346,6 +348,9 @@ struct ScheduleTreeThreadSpecificMarker : public ScheduleTree { static std::unique_ptr make( isl::ctx ctx, std::vector&& children = {}); + static std::unique_ptr make( + const ScheduleTreeThreadSpecificMarker* tree, + std::vector&& children = {}); virtual std::ostream& write(std::ostream& os) const override; }; From c555112615d699548e6608c5a8ee4b7881442805 Mon Sep 17 00:00:00 2001 From: Oleksandr Zinenko Date: Wed, 11 Jul 2018 13:00:32 +0200 Subject: [PATCH 071/152] ScheduleTree: introduce virtual "clone" method The original implementation of schedule trees with "element" classes was relying on a manual macro-based dynamic dispatch to copy schedule tree nodes. Arguably, this is not desirable in the C++ code where the same behavior can be achieved through language mechanisms (virtual functions or CRTP). Since copy constructors cannot be overloaded, introduce an abstract "clone" method to ScheduleTree and override it in all subclasses to produce copies of the given node wrapped in a unique pointer to the base class. Note that children of the given node are not copied to remain consistent with the existing uses. Replace macro-based dispatch with a call to the virtual function. Using language featuers for dispatch is less error-prone and converts run-time errors (e.g., unhandled type in macro-based if/else sequence) into compile-time errors (e.g., attempting to instantiate an abstract class because the abstract function was not implemented). It also localizes the changes to be made to the ScheduleTree API when introducing or removing a new node type. --- tc/core/polyhedral/schedule_tree.cc | 27 +------------------------ tc/core/polyhedral/schedule_tree.h | 4 ++++ tc/core/polyhedral/schedule_tree_elem.h | 27 +++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 26 deletions(-) diff --git a/tc/core/polyhedral/schedule_tree.cc b/tc/core/polyhedral/schedule_tree.cc index 8eaa78739..32951917e 100644 --- a/tc/core/polyhedral/schedule_tree.cc +++ b/tc/core/polyhedral/schedule_tree.cc @@ -122,31 +122,6 @@ vector ancestorsInSubTree( } return res; } - -static std::unique_ptr makeElem(const ScheduleTree& st) { -#define ELEM_MAKE_CASE_CSTR(CLASS) \ - else if (st.type_ == CLASS::NodeType) { \ - return CLASS::make(static_cast(&st)); \ - } - - if (st.type_ == detail::ScheduleTreeType::None) { - LOG(FATAL) << "Hit Error node!"; - } - ELEM_MAKE_CASE_CSTR(ScheduleTreeBand) - ELEM_MAKE_CASE_CSTR(ScheduleTreeContext) - ELEM_MAKE_CASE_CSTR(ScheduleTreeDomain) - ELEM_MAKE_CASE_CSTR(ScheduleTreeExtension) - ELEM_MAKE_CASE_CSTR(ScheduleTreeFilter) - ELEM_MAKE_CASE_CSTR(ScheduleTreeMapping) - ELEM_MAKE_CASE_CSTR(ScheduleTreeSequence) - ELEM_MAKE_CASE_CSTR(ScheduleTreeSet) - ELEM_MAKE_CASE_CSTR(ScheduleTreeThreadSpecificMarker) - -#undef ELEM_MAKE_CASE_CSTR - - LOG(FATAL) << "NYI: ScheduleTree from type: " << static_cast(st.type_); - return nullptr; -} } // namespace //////////////////////////////////////////////////////////////////////////////// @@ -163,7 +138,7 @@ ScheduleTree::ScheduleTree(const ScheduleTree& st) } ScheduleTreeUPtr ScheduleTree::makeScheduleTree(const ScheduleTree& tree) { - return makeElem(tree); + return tree.clone(); } ScheduleTree* ScheduleTree::child(const vector& positions) { diff --git a/tc/core/polyhedral/schedule_tree.h b/tc/core/polyhedral/schedule_tree.h index 83bef81d2..403dd0210 100644 --- a/tc/core/polyhedral/schedule_tree.h +++ b/tc/core/polyhedral/schedule_tree.h @@ -465,6 +465,10 @@ struct ScheduleTree { // Note that this function does _not_ output the child trees. virtual std::ostream& write(std::ostream& os) const = 0; + // Clone the current node. + // Note that this function does _not_ clone the child trees. + virtual ScheduleTreeUPtr clone() const = 0; + // // Data members // diff --git a/tc/core/polyhedral/schedule_tree_elem.h b/tc/core/polyhedral/schedule_tree_elem.h index 6982abc3f..5d782049d 100644 --- a/tc/core/polyhedral/schedule_tree_elem.h +++ b/tc/core/polyhedral/schedule_tree_elem.h @@ -58,6 +58,9 @@ struct ScheduleTreeContext : public ScheduleTree { } virtual std::ostream& write(std::ostream& os) const override; + virtual ScheduleTreeUPtr clone() const override { + return make(this); + } public: isl::set context_; @@ -91,6 +94,9 @@ struct ScheduleTreeDomain : public ScheduleTree { } virtual std::ostream& write(std::ostream& os) const override; + virtual ScheduleTreeUPtr clone() const override { + return make(this); + } public: isl::union_set domain_; @@ -124,6 +130,9 @@ struct ScheduleTreeExtension : public ScheduleTree { } virtual std::ostream& write(std::ostream& os) const override; + virtual ScheduleTreeUPtr clone() const override { + return make(this); + } public: isl::union_map extension_; @@ -157,6 +166,9 @@ struct ScheduleTreeFilter : public ScheduleTree { std::vector&& children = {}); virtual std::ostream& write(std::ostream& os) const override; + virtual ScheduleTreeUPtr clone() const override { + return make(this); + } public: isl::union_set filter_; @@ -195,6 +207,9 @@ struct ScheduleTreeMapping : public ScheduleTree { std::vector&& children = {}); virtual std::ostream& write(std::ostream& os) const override; + virtual ScheduleTreeUPtr clone() const override { + return make(this); + } public: // Mapping from identifiers to affine functions on domain elements. @@ -229,6 +244,9 @@ struct ScheduleTreeSequence : public ScheduleTree { std::vector&& children = {}); virtual std::ostream& write(std::ostream& os) const override; + virtual ScheduleTreeUPtr clone() const override { + return make(this); + } }; struct ScheduleTreeSet : public ScheduleTree { @@ -256,6 +274,9 @@ struct ScheduleTreeSet : public ScheduleTree { std::vector&& children = {}); virtual std::ostream& write(std::ostream& os) const override; + virtual ScheduleTreeUPtr clone() const override { + return make(this); + } }; struct ScheduleTreeBand : public ScheduleTree { @@ -280,6 +301,9 @@ struct ScheduleTreeBand : public ScheduleTree { } virtual std::ostream& write(std::ostream& os) const override; + virtual ScheduleTreeUPtr clone() const override { + return make(this); + } // Make a schedule node band from partial schedule. // Replace "mupa" by its greatest integer part to ensure that the @@ -353,6 +377,9 @@ struct ScheduleTreeThreadSpecificMarker : public ScheduleTree { std::vector&& children = {}); virtual std::ostream& write(std::ostream& os) const override; + virtual ScheduleTreeUPtr clone() const override { + return make(this); + } }; bool elemEquals( From 827ed00e020742c9b754d3537370b25c44091c79 Mon Sep 17 00:00:00 2001 From: Nicolas Vasilache Date: Mon, 23 Jul 2018 03:21:35 -0700 Subject: [PATCH 072/152] Move tc/core/polyhedral/functional.h tc/core/functional.h The functional abstraction is more generally useful than just in polyhedral --- tc/core/{polyhedral => }/functional.h | 2 -- tc/core/polyhedral/cuda/mapped_scop.cc | 2 +- tc/core/polyhedral/schedule_transforms.cc | 2 +- tc/core/polyhedral/schedule_transforms.h | 2 +- tc/core/polyhedral/schedule_tree.cc | 2 +- tc/core/polyhedral/scop.cc | 2 +- test/test_cuda_mapper.cc | 2 +- 7 files changed, 6 insertions(+), 8 deletions(-) rename tc/core/{polyhedral => }/functional.h (99%) diff --git a/tc/core/polyhedral/functional.h b/tc/core/functional.h similarity index 99% rename from tc/core/polyhedral/functional.h rename to tc/core/functional.h index ed8117b1f..c92ddcef0 100644 --- a/tc/core/polyhedral/functional.h +++ b/tc/core/functional.h @@ -21,7 +21,6 @@ #include namespace tc { -namespace polyhedral { namespace functional { template @@ -178,5 +177,4 @@ R MapReduce(std::function fun, const std::vector& vec) { } } // namespace functional -} // namespace polyhedral } // namespace tc diff --git a/tc/core/polyhedral/cuda/mapped_scop.cc b/tc/core/polyhedral/cuda/mapped_scop.cc index f04420b7b..273a92fd8 100644 --- a/tc/core/polyhedral/cuda/mapped_scop.cc +++ b/tc/core/polyhedral/cuda/mapped_scop.cc @@ -26,13 +26,13 @@ #include "tc/core/check.h" #include "tc/core/cuda/cuda_libraries.h" #include "tc/core/flags.h" +#include "tc/core/functional.h" #include "tc/core/gpu.h" #include "tc/core/polyhedral/cuda/codegen.h" #include "tc/core/polyhedral/cuda/mapping_types.h" #include "tc/core/polyhedral/cuda/memory_promotion_heuristic.h" #include "tc/core/polyhedral/cuda/tighten_launch_bounds.h" #include "tc/core/polyhedral/exceptions.h" -#include "tc/core/polyhedral/functional.h" #include "tc/core/polyhedral/schedule_transforms.h" #include "tc/core/polyhedral/schedule_tree_matcher.h" #include "tc/core/polyhedral/schedule_utils.h" diff --git a/tc/core/polyhedral/schedule_transforms.cc b/tc/core/polyhedral/schedule_transforms.cc index bf37daf69..0f540506b 100644 --- a/tc/core/polyhedral/schedule_transforms.cc +++ b/tc/core/polyhedral/schedule_transforms.cc @@ -30,7 +30,7 @@ #include "tc/core/check.h" #include "tc/core/constants.h" -#include "tc/core/polyhedral/functional.h" +#include "tc/core/functional.h" #include "tc/core/polyhedral/mapping_types.h" #include "tc/core/polyhedral/schedule_tree_elem.h" #include "tc/core/polyhedral/schedule_tree_matcher.h" diff --git a/tc/core/polyhedral/schedule_transforms.h b/tc/core/polyhedral/schedule_transforms.h index 258d2736a..39cb2e942 100644 --- a/tc/core/polyhedral/schedule_transforms.h +++ b/tc/core/polyhedral/schedule_transforms.h @@ -21,7 +21,7 @@ #include #include -#include "tc/core/polyhedral/functional.h" +#include "tc/core/functional.h" #include "tc/core/polyhedral/mapping_types.h" #include "tc/core/polyhedral/options.h" #include "tc/core/polyhedral/schedule_tree.h" diff --git a/tc/core/polyhedral/schedule_tree.cc b/tc/core/polyhedral/schedule_tree.cc index d75b479cf..5d8ba7b4a 100644 --- a/tc/core/polyhedral/schedule_tree.cc +++ b/tc/core/polyhedral/schedule_tree.cc @@ -29,7 +29,7 @@ #include "tc/core/check.h" #include "tc/core/constants.h" -#include "tc/core/polyhedral/functional.h" +#include "tc/core/functional.h" #include "tc/core/polyhedral/schedule_tree_elem.h" #include "tc/core/scope_guard.h" #include "tc/external/isl.h" diff --git a/tc/core/polyhedral/scop.cc b/tc/core/polyhedral/scop.cc index dcca86fe8..fe44f49c2 100644 --- a/tc/core/polyhedral/scop.cc +++ b/tc/core/polyhedral/scop.cc @@ -24,9 +24,9 @@ #include #include "tc/core/check.h" +#include "tc/core/functional.h" #include "tc/core/halide2isl.h" #include "tc/core/polyhedral/body.h" -#include "tc/core/polyhedral/functional.h" #include "tc/core/polyhedral/memory_promotion.h" #include "tc/core/polyhedral/schedule_isl_conversion.h" #include "tc/core/polyhedral/schedule_transforms.h" diff --git a/test/test_cuda_mapper.cc b/test/test_cuda_mapper.cc index dbfc4f345..3122db10b 100644 --- a/test/test_cuda_mapper.cc +++ b/test/test_cuda_mapper.cc @@ -27,9 +27,9 @@ #include "tc/core/constants.h" #include "tc/core/cuda/cuda_libraries.h" #include "tc/core/cuda/cuda_mapping_options.h" +#include "tc/core/functional.h" #include "tc/core/polyhedral/cuda/codegen.h" #include "tc/core/polyhedral/cuda/mapped_scop.h" -#include "tc/core/polyhedral/functional.h" #include "tc/core/polyhedral/mapping_types.h" #include "tc/core/polyhedral/schedule_isl_conversion.h" #include "tc/core/polyhedral/schedule_transforms.h" From 71c013c47e4b952e3d0cdfefdc3d1db1e6060591 Mon Sep 17 00:00:00 2001 From: Nicolas Vasilache Date: Mon, 23 Jul 2018 05:09:48 -0700 Subject: [PATCH 073/152] Remove best options fro autotuner and always recover from cache This commit supposedly addresses issue #523 (only supposedly because there is no easy repro). The problem is conjectured to come from the tuner keeping the best time/option in a private field whereas the functions that interact with the cache files operate on the cache. When multiple entries have the same runtime, it is conjectured (by @ftynse) that the ordering of the cache entries do not match the private field. In hindsight this can easily happen with thread/block sizes because once the number of threads/blocks is one per loop element, one can increase the values passed to mapping options but the same code will be generated after tightening. It is not too much of a stretch to imagine that the same code will occasionally have the same runtime. This commit drops the private state and ensures we always fetch the requires values from the options cache (under its lock). --- tc/aten/aten_autotuner-inl.h | 2 ++ tc/aten/aten_autotuner.h | 1 + tc/autotuner/autotuner-inl.h | 49 +++++++++++++------------- tc/autotuner/autotuner.h | 9 +---- tc/autotuner/options_cache-inl.h | 28 ++++++++++++--- tc/autotuner/options_cache.h | 13 +++++++ tc/benchmarks/benchmark_fixture.h | 2 +- tensor_comprehensions/pybinds/tclib.cc | 1 + test/cuda/test_autotuner.cc | 3 +- 9 files changed, 68 insertions(+), 40 deletions(-) diff --git a/tc/aten/aten_autotuner-inl.h b/tc/aten/aten_autotuner-inl.h index 65dd55a8d..76e46097b 100644 --- a/tc/aten/aten_autotuner-inl.h +++ b/tc/aten/aten_autotuner-inl.h @@ -53,6 +53,7 @@ ATenAutotuner::tune( const std::string& tcName, const std::vector& inputs, const std::vector& baseMappings, + size_t topK, const tc::autotune::TuningParameterFixer& fixedParams) { // TODO: some checks that inputs memory lives on the proper Backend device @@ -91,6 +92,7 @@ ATenAutotuner::tune( rawInputsPerDevice, rawOutputsPerDevice, baseMappings, + topK, fixedParams); } } // namespace aten diff --git a/tc/aten/aten_autotuner.h b/tc/aten/aten_autotuner.h index d3c8e39f3..d586c3888 100644 --- a/tc/aten/aten_autotuner.h +++ b/tc/aten/aten_autotuner.h @@ -80,6 +80,7 @@ class ATenAutotuner : public tc::autotune::Autotuner { const std::string& tcEntryPoint, const std::vector& inputs, const std::vector& baseMappings, + size_t topK = 1, const tc::autotune::TuningParameterFixer& fixedParams = {}); protected: diff --git a/tc/autotuner/autotuner-inl.h b/tc/autotuner/autotuner-inl.h index 1babc47e2..5922855c8 100644 --- a/tc/autotuner/autotuner-inl.h +++ b/tc/autotuner/autotuner-inl.h @@ -15,6 +15,7 @@ */ #include #include +#include #include #include @@ -48,8 +49,6 @@ TuningHarness::TuningHarness( baseMapping_(baseMapping), inputs_(inputs), outputs_(outputs), - bestTime_(Duration::max()), - bestMappingOptions_(baseMapping), optionsCache_(optionsCache) {} template @@ -67,13 +66,6 @@ void TuningHarness::stopAfterCurrentIteration() { stopRequested_ = true; } -template -const typename Backend::MappingOptionsType& -TuningHarness::bestMappingOptions() const { - std::lock_guard lock(bestTimeMutex_); - return bestMappingOptions_; -} - #define LOG_LINE_BY_LINE(GSTREAM, ISTREAM) \ for (std::string line; std::getline(ISTREAM, line);) { \ LOG(GSTREAM) << line; \ @@ -180,11 +172,14 @@ void TuningHarness::doEvaluate( std::vector runtimes{Duration::max()}; try { - Duration bestTimeSoFar(Duration::max()); - { - std::lock_guard lock(bestTimeMutex_); - bestTimeSoFar = bestTime_; - } + auto vBest = optionsCache_->getTopKEntries( + lang::canonicalTc(tcTree_), + makeTensorInfoVector(inputs), + makeTensorInfoVector(outputs), + Backend::backendString(), + 1); + Duration bestTimeSoFar = + (vBest.size() > 0) ? vBest[0].second : Duration::max(); auto prune = detail::skipExecutionOrWarmup( *pExecutor, outputs, inputs, bestTimeSoFar); if (prune) { @@ -234,15 +229,6 @@ void TuningHarness::doEvaluate( Backend::backendString(), options, prof); - - // Save best time under lock - { - std::lock_guard lock(bestTimeMutex_); - if (prof < bestTime_) { - bestTime_ = prof; - bestMappingOptions_ = options; - } - } } // end while } @@ -310,7 +296,14 @@ void TuningHarness::runOneIteration( LOG(INFO) << "[TUNER][ITERATION LOG] best option so far:"; std::stringstream ssInfo; typename Backend::MappingOptionsCppPrinter infoPrinter(ssInfo); - infoPrinter << bestMappingOptions(); + auto vBest = optionsCache_->getTopKOptions( + lang::canonicalTc(tcTree_), + makeTensorInfoVector(inputs_.begin()->second), + makeTensorInfoVector(outputs_.begin()->second), + Backend::backendString(), + 1); + CHECK_GT(vBest.size(), 0); + infoPrinter << vBest[0]; LOG_LINE_BY_LINE(INFO, ssInfo); } searchStrategy.updateParameters(); @@ -426,6 +419,7 @@ Autotuner::tune( const std::unordered_map>& inputs, std::unordered_map>& outputs, const std::vector& baseMappings, + size_t topK, const TuningParameterFixer& fixedParams) { std::map tcEntryPointMap(tc::detail::parse(tc)); TC_CHECK_EQ(tcEntryPointMap.count(tcEntryPoint), 1u) @@ -511,7 +505,12 @@ Autotuner::tune( std::rethrow_exception(tuningHarnessThreadEx); } - return {tuningHarness.bestMappingOptions()}; + return optionsCache->getTopKOptions( + lang::canonicalTc(tcEntryPointMap.at(tcEntryPoint)), + makeTensorInfoVector(inputs.begin()->second), + makeTensorInfoVector(outputs.begin()->second), + Backend::backendString(), + topK); } } // namespace autotune } // namespace tc diff --git a/tc/autotuner/autotuner.h b/tc/autotuner/autotuner.h index 056bfb325..c7d610d75 100644 --- a/tc/autotuner/autotuner.h +++ b/tc/autotuner/autotuner.h @@ -67,9 +67,6 @@ class TuningHarness { /// TODO: we should detect when we come from python and exit properly in C++. void stopAfterCurrentIteration(); - /// Under lock, returns the best mapping options found so far - const MappingOptionsType& bestMappingOptions() const; - private: /// Traverse one iteration of candidates in parallel and evaluate their /// runtimes @@ -92,7 +89,6 @@ class TuningHarness { /// This way it is easy to implement multi-threaded termination by just /// taking an atomic counter and pushing/popping the queues under lock until /// we have evaluated searchStrategy->population.size() compilation results. - mutable std::mutex bestTimeMutex_; std::mutex executorsMutex_; std::atomic_bool stopRequested_; std::atomic_size_t currentCompilationJob_; @@ -112,10 +108,6 @@ class TuningHarness { const std::unordered_map> inputs_; std::unordered_map> outputs_; - // results - Duration bestTime_; - MappingOptionsType bestMappingOptions_; - // backing options cache std::shared_ptr> optionsCache_; }; @@ -165,6 +157,7 @@ class Autotuner { inputs, std::unordered_map>& outputs, const std::vector& baseMapping, + size_t topK = 1, const TuningParameterFixer& fixedParams = TuningParameterFixer()); public: diff --git a/tc/autotuner/options_cache-inl.h b/tc/autotuner/options_cache-inl.h index 7ef3ffee9..e1ee14d28 100644 --- a/tc/autotuner/options_cache-inl.h +++ b/tc/autotuner/options_cache-inl.h @@ -28,6 +28,7 @@ #include "tc/core/check.h" #include "tc/core/compiler.h" +#include "tc/core/functional.h" #include "tc/core/tensor.h" #include "tc/core/utils/math.h" #include "tc/core/utils/time.h" @@ -235,8 +236,8 @@ std::vector> sortedOptions( } // namespace detail template -std::vector -OptionsCache::getTopKOptions( +std::vector> +OptionsCache::getTopKEntries( const lang::CanonicalTcString& tc, const std::vector& inputs, const std::vector& outputs, @@ -249,15 +250,32 @@ OptionsCache::getTopKOptions( if (sorted.size() == 0u) { return {}; } - std::vector res; - res.reserve(K); + std::vector> res; + res.reserve(std::min(K, sorted.size())); for (size_t i = 0; i < std::min(K, sorted.size()); ++i) { - res.push_back(sorted[i].mappingOptions); + res.push_back(std::make_pair(sorted[i].mappingOptions, sorted[i].median)); } ++numberSuccessfulRetrievals; return res; } +template +std::vector +OptionsCache::getTopKOptions( + const lang::CanonicalTcString& tc, + const std::vector& inputs, + const std::vector& outputs, + const std::string& backendStr, + size_t K) const { + auto vBest = getTopKEntries(tc, inputs, outputs, backendStr, K); + using ReturnType = typename Backend::MappingOptionsType; + using ValueType = typename decltype(vBest)::value_type; + std::function map = [](ValueType in) { + return in.first; + }; + return tc::functional::Map(map, vBest); +} + template std::unordered_set OptionsCache::getKeys() const { diff --git a/tc/autotuner/options_cache.h b/tc/autotuner/options_cache.h index 7bf061d8d..e4f6eeaee 100644 --- a/tc/autotuner/options_cache.h +++ b/tc/autotuner/options_cache.h @@ -132,6 +132,19 @@ struct OptionsCache { /// particular TC/inputs/outputs/device. Note that the result may be empty /// (in particular if problem size is small and pruning threshold is too high /// for the problem size). + /// \returns a vector of pair + std::vector> + getTopKEntries( + const lang::CanonicalTcString& tc, + const std::vector& inputs, + const std::vector& outputs, + const std::string& backendStr, + size_t K) const; + + /// Returns the top-K mapping options that have the best median runtime for a + /// particular TC/inputs/outputs/device. Note that the result may be empty + /// (in particular if problem size is small and pruning threshold is too high + /// for the problem size). /// \returns a vector of mapping options std::vector getTopKOptions( const lang::CanonicalTcString& tc, diff --git a/tc/benchmarks/benchmark_fixture.h b/tc/benchmarks/benchmark_fixture.h index 3bf0997c1..36a4f19db 100644 --- a/tc/benchmarks/benchmark_fixture.h +++ b/tc/benchmarks/benchmark_fixture.h @@ -188,7 +188,7 @@ struct Benchmark : public ::testing::Test { geneticAutotuneATen(tc); auto bestOptions = [&]() { auto options = geneticAutotuneATen.tune( - kernelName, inputs, {baseMapping}, fixedParams); + kernelName, inputs, {baseMapping}, 1, fixedParams); TC_CHECK_GE(options.size(), 1u) << "Benchmark mode: at least one " << "options expected"; return options[0]; diff --git a/tensor_comprehensions/pybinds/tclib.cc b/tensor_comprehensions/pybinds/tclib.cc index c4b6e8ec6..3487e26ff 100644 --- a/tensor_comprehensions/pybinds/tclib.cc +++ b/tensor_comprehensions/pybinds/tclib.cc @@ -33,6 +33,7 @@ #include "tc/core/cuda/cuda_backend.h" #include "tc/core/cuda/cuda_tc_executor.h" #include "tc/core/flags.h" +#include "tc/core/functional.h" #include "tc/core/tensor.h" #include "tc/lang/canonicalize.h" diff --git a/test/cuda/test_autotuner.cc b/test/cuda/test_autotuner.cc index 71e36a30a..07f9e2c5b 100644 --- a/test/cuda/test_autotuner.cc +++ b/test/cuda/test_autotuner.cc @@ -72,7 +72,8 @@ struct ATenCompilationUnitTest : public ::testing::Test { if (FLAGS_no_memory_promotion) { fix.fixUseSharedMemory(false).fixUsePrivateMemory(false); } - auto options = geneticAutotuneATen.tune(name, inputs, {baseMapping}, fix); + auto options = geneticAutotuneATen.tune( + name, inputs, {baseMapping}, std::numeric_limits::max(), fix); if (options.size() > 0) { return options[0]; } From 33527b1f177033bc70a9294e4860542e08edd842 Mon Sep 17 00:00:00 2001 From: Nicolas Vasilache Date: Thu, 19 Jul 2018 04:37:38 -0700 Subject: [PATCH 074/152] Retire Tapir path for now We now use an LLVM version close to trunk and we expect to use trunk in the future. Tapir is not yet up to date. Additionally we are interested in a short term single threaded CPU mapper and Tapir is a distraction towards that goal. We can ressucitate it later. --- tc/core/polyhedral/codegen_llvm.cc | 45 +----------------------------- tc/core/polyhedral/llvm_jit.cc | 45 +----------------------------- 2 files changed, 2 insertions(+), 88 deletions(-) diff --git a/tc/core/polyhedral/codegen_llvm.cc b/tc/core/polyhedral/codegen_llvm.cc index d3ce32de3..8863a5c1f 100644 --- a/tc/core/polyhedral/codegen_llvm.cc +++ b/tc/core/polyhedral/codegen_llvm.cc @@ -47,10 +47,6 @@ #error LLVM_VERSION_MAJOR not set #endif -#ifdef TAPIR_VERSION_MAJOR -#include "llvm/Transforms/Tapir/CilkABI.h" -#endif - using namespace Halide; namespace tc { @@ -284,9 +280,6 @@ class CodeGen_TC : public Halide::Internal::CodeGen_X86 { llvm::PassManagerBuilder b; b.OptLevel = kOptLevel; -#ifdef TAPIR_VERSION_MAJOR - b.tapirTarget = new llvm::CilkABI(); -#endif b.Inliner = llvm::createFunctionInliningPass(b.OptLevel, 0, false); b.LoopVectorize = true; b.SLPVectorize = true; @@ -475,19 +468,6 @@ class LLVMCodegen { llvm::BasicBlock::Create(llvmCtx, "loop_latch", function); auto* loopExitBB = llvm::BasicBlock::Create(llvmCtx, "loop_exit", function); - bool parallel = node.is_coincident(); - llvm::Value* SyncRegion = nullptr; - -#ifdef TAPIR_VERSION_MAJOR - if (parallel) { - SyncRegion = halide_cg.get_builder().CreateCall( - llvm::Intrinsic::getDeclaration( - function->getParent(), llvm::Intrinsic::syncregion_start), - {}, - "syncreg"); - } -#endif - halide_cg.get_builder().CreateBr(headerBB); llvm::PHINode* phi = nullptr; @@ -530,25 +510,9 @@ class LLVMCodegen { { halide_cg.get_builder().SetInsertPoint(loopBodyBB); -#ifdef TAPIR_VERSION_MAJOR - if (parallel) { - auto* detachedBB = - llvm::BasicBlock::Create(llvmCtx, "det.achd", function); - halide_cg.get_builder().CreateDetach( - detachedBB, loopLatchBB, SyncRegion); - halide_cg.get_builder().SetInsertPoint(detachedBB); - } -#endif auto* currentBB = emitAst(node.get_body()); halide_cg.get_builder().SetInsertPoint(currentBB); - - if (parallel) { -#ifdef TAPIR_VERSION_MAJOR - halide_cg.get_builder().CreateReattach(loopLatchBB, SyncRegion); -#endif - } else { - halide_cg.get_builder().CreateBr(loopLatchBB); - } + halide_cg.get_builder().CreateBr(loopLatchBB); } // Create Latch @@ -564,13 +528,6 @@ class LLVMCodegen { halide_cg.get_builder().SetInsertPoint(loopExitBB); halide_cg.sym_pop(iterator.get_name()); -#ifdef TAPIR_VERSION_MAJOR - if (parallel) { - auto* syncBB = llvm::BasicBlock::Create(llvmCtx, "synced", function); - halide_cg.get_builder().CreateSync(syncBB, SyncRegion); - halide_cg.get_builder().SetInsertPoint(syncBB); - } -#endif return halide_cg.get_builder().GetInsertBlock(); } diff --git a/tc/core/polyhedral/llvm_jit.cc b/tc/core/polyhedral/llvm_jit.cc index 4f624ef88..81fd16e52 100644 --- a/tc/core/polyhedral/llvm_jit.cc +++ b/tc/core/polyhedral/llvm_jit.cc @@ -34,41 +34,6 @@ using namespace llvm; -// Parse through ldconfig to find the path of a particular -// shared library. This is an unfortunate way to have to -// find it, but I couldn't immediately find something in -// imported libraries that would resolve this for us. -std::string find_library_path(std::string library) { - std::string command = "ldconfig -p | grep " + library + " | grep x86-64"; - - FILE* fpipe = popen(command.c_str(), "r"); - - if (fpipe == nullptr) { - throw std::runtime_error("Failed to popen()"); - } - - std::string output; - char buffer[512]; - - while (1) { - int charactersRead = fread(buffer, 1, sizeof(buffer), fpipe); - if (charactersRead == 0) - break; - output += std::string(buffer, charactersRead); - } - pclose(fpipe); - - auto idx = output.rfind("=> "); - if (idx == std::string::npos) { - throw std::runtime_error("Failed locate library: " + library); - } - output = output.substr(idx + 3); - if (output.length() > 0 && output[output.length() - 1] == '\n') { - output = output.substr(0, output.length() - 1); - } - return output; -} - namespace tc { #if LLVM_VERSION_MAJOR <= 6 @@ -77,15 +42,7 @@ Jit::Jit() : TM_(EngineBuilder().selectTarget()), DL_(TM_->createDataLayout()), objectLayer_([]() { return std::make_shared(); }), - compileLayer_(objectLayer_, orc::SimpleCompiler(*TM_)) { - std::string err; - - auto path = find_library_path("libcilkrts.so"); - sys::DynamicLibrary::LoadLibraryPermanently(path.c_str(), &err); - if (err != "") { - throw std::runtime_error("Failed to find cilkrts: " + err); - } -} + compileLayer_(objectLayer_, orc::SimpleCompiler(*TM_)) {} void Jit::addModule(std::shared_ptr M) { M->setTargetTriple(TM_->getTargetTriple().str()); From 5f1bfc0bc453c408da58cfdaad1c188059a1e8fe Mon Sep 17 00:00:00 2001 From: Nicolas Vasilache Date: Thu, 19 Jul 2018 04:42:08 -0700 Subject: [PATCH 075/152] Kill dead code --- tc/core/polyhedral/codegen_llvm.cc | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tc/core/polyhedral/codegen_llvm.cc b/tc/core/polyhedral/codegen_llvm.cc index 8863a5c1f..26aed3c0f 100644 --- a/tc/core/polyhedral/codegen_llvm.cc +++ b/tc/core/polyhedral/codegen_llvm.cc @@ -57,9 +57,6 @@ using IteratorMapType = std::unordered_map; using IteratorMapsType = std::unordered_map; -using IteratorLLVMValueMapType = - std::unordered_map; - using StmtSubscriptExprMapType = std::unordered_map, isl::IslIdIslHash>; @@ -458,8 +455,6 @@ class LLVMCodegen { } llvm::BasicBlock* emitFor(isl::ast_node_for node) { - IteratorLLVMValueMapType iterPHIs; - auto* incoming = halide_cg.get_builder().GetInsertBlock(); auto* function = incoming->getParent(); auto* headerBB = llvm::BasicBlock::Create(llvmCtx, "loop_header", function); From 0443af16656c63c9dd42e3cd422b9dba601534b0 Mon Sep 17 00:00:00 2001 From: Nicolas Vasilache Date: Thu, 19 Jul 2018 07:23:59 -0700 Subject: [PATCH 076/152] Start using Halide to emit LLVM IR The current codegen_llvm.cc is very brittle and has a lot of special casing that just does not work when trying to create a simple CPU mapper. This commit introduces a makeHalideExpr function that piggy backs on Halide to emit LLVM-IR as much as possible. This function is used to to implement a simple `llvm::Value* codegen(isl::ast_expr expr)` function to replace the `getValuetValue` function. It will be used more places in followup commits. --- tc/core/polyhedral/codegen_llvm.cc | 78 ++++++++++++++++++++++++------ 1 file changed, 64 insertions(+), 14 deletions(-) diff --git a/tc/core/polyhedral/codegen_llvm.cc b/tc/core/polyhedral/codegen_llvm.cc index 26aed3c0f..8988b8f38 100644 --- a/tc/core/polyhedral/codegen_llvm.cc +++ b/tc/core/polyhedral/codegen_llvm.cc @@ -173,7 +173,7 @@ static constexpr int kOptLevel = 3; class CodeGen_TC : public Halide::Internal::CodeGen_X86 { public: const IteratorMapType* iteratorMap_; - CodeGen_TC(Target t) : CodeGen_X86(t) {} + CodeGen_TC(Target t) : CodeGen_X86(t), iteratorMap_(nullptr) {} using CodeGen_X86::codegen; using CodeGen_X86::llvm_type_of; @@ -210,10 +210,10 @@ class CodeGen_TC : public Halide::Internal::CodeGen_X86 { return std::move(module); } - // Convert an isl AST expression into an llvm::Value. - // Only expressions that consist of a pure identifier or - // a pure integer constant are currently supported. - llvm::Value* getValue(isl::ast_expr expr); + Halide::Expr makeHalideExpr(isl::ast_expr expr); + llvm::Value* codegen(isl::ast_expr expr) { + return codegen(makeHalideExpr(expr)); + } protected: using CodeGen_X86::visit; @@ -236,8 +236,17 @@ class CodeGen_TC : public Halide::Internal::CodeGen_X86 { } } + // The type of Variables in TC come in 2 flavors: + // 1. the ones for which we explicitly registered LLVMIR with sym_push + // (i.e. the Halide way). + // 2. the ones coming from an isl::ast_build which need to be translated + // through the iteratorMap_, void visit(const Halide::Internal::Variable* op) override { - value = getValue(iteratorMap_->at(op->name)); + if ((value = sym_get(op->name, false))) { + return; + } + TC_CHECK(iteratorMap_) << "IteratorMap must be set"; + value = codegen(iteratorMap_->at(op->name)); // Generate code for type casting if necessary. llvm::Type* ty = llvm_type_of(op->type); @@ -302,15 +311,56 @@ class CodeGen_TC : public Halide::Internal::CodeGen_X86 { } }; -llvm::Value* CodeGen_TC::getValue(isl::ast_expr expr) { +// For now we always generate int32 for induction variables and integer +// constants. Note that we may soon need to also support int64. +Halide::Expr CodeGen_TC::makeHalideExpr(isl::ast_expr expr) { if (auto idExpr = expr.as()) { - return sym_get(idExpr.get_id().get_name()); + return Halide::Internal::Variable::make( + Halide::Int(32), idExpr.get_id().get_name()); } else if (auto intExpr = expr.as()) { - return getLLVMConstantSignedInt64(toSInt(intExpr.get_val())); - } else { - LOG(FATAL) << "NYI"; - return nullptr; + return Halide::Internal::IntImm::make( + Halide::Int(32), toSInt(intExpr.get_val())); + } else if (auto op = expr.as()) { +#define MAKE_UN_OP(ISL_TYPE, HALIDE_TYPE) \ + if (auto ty = op.as()) { \ + return HALIDE_TYPE::make(makeHalideExpr(op.get_arg(0))); \ + } + +#define MAKE_BIN_OP(ISL_TYPE, HALIDE_TYPE) \ + if (auto ty = op.as()) { \ + return HALIDE_TYPE::make( \ + makeHalideExpr(op.get_arg(0)), makeHalideExpr(op.get_arg(1))); \ + } + + // Minus in Halide is done with a binary operator, this is a special case + // for us. + if (auto ty = op.as()) { + auto a = makeHalideExpr(op.get_arg(0)); + auto zero = Halide::Internal::make_zero(a.type()); + return Halide::Internal::Sub::make(zero, a); + } + + // clang-format off + MAKE_BIN_OP(isl::ast_op_eq, Halide::Internal::EQ); + MAKE_BIN_OP(isl::ast_op_le, Halide::Internal::LE); + MAKE_BIN_OP(isl::ast_op_lt, Halide::Internal::LT); + MAKE_BIN_OP(isl::ast_op_ge, Halide::Internal::GE); + MAKE_BIN_OP(isl::ast_op_gt, Halide::Internal::GT); + MAKE_BIN_OP(isl::ast_op_and, Halide::Internal::And); + MAKE_BIN_OP(isl::ast_op_or, Halide::Internal::Or); + MAKE_BIN_OP(isl::ast_op_min, Halide::Internal::Min); + MAKE_BIN_OP(isl::ast_op_max, Halide::Internal::Max); + MAKE_BIN_OP(isl::ast_op_add, Halide::Internal::Add); + MAKE_BIN_OP(isl::ast_op_sub, Halide::Internal::Sub); + MAKE_BIN_OP(isl::ast_op_mul, Halide::Internal::Mul); + // clang-format on + +#undef MAKE_UN_OP +#undef MAKE_BIN_OP } + + LOG(FATAL) << "NYI: " << expr; + return Halide::Internal::IntImm::make(Halide::Int(32), 0); } class LLVMCodegen { @@ -538,14 +588,14 @@ class LLVMCodegen { const auto& subscripts = stmtSubscripts_.at(id); llvm::SmallVector subscriptValues; + halide_cg.iteratorMap_ = &iteratorMaps_.at(id); for (const auto& subscript : subscripts) { - subscriptValues.push_back(halide_cg.getValue(subscript)); + subscriptValues.push_back(halide_cg.codegen(subscript)); } auto destAddr = halide_cg.get_builder().CreateInBoundsGEP( halide_cg.sym_get(arrayName), subscriptValues); - halide_cg.iteratorMap_ = &iteratorMaps_.at(id); llvm::Value* rhs = halide_cg.codegen(op->values[0]); halide_cg.get_builder().CreateStore(rhs, destAddr); return halide_cg.get_builder().GetInsertBlock(); From 4130be25c731ff37ee687005c5f5501998e99add Mon Sep 17 00:00:00 2001 From: Nicolas Vasilache Date: Fri, 20 Jul 2018 04:53:47 -0700 Subject: [PATCH 077/152] More general usage of makeHalideExpr This commit uses makeHalideExpr everywhere and removes special-casing. In particular, anything related to interpreting with ISL now disappears as we just emit Halide expressions. In the current form, this shines a light on the non-handling of parameters which this commit adds. Tests are updated accordingly. --- tc/core/polyhedral/codegen_llvm.cc | 134 ++++++----------------------- test/test_mapper_llvm.cc | 85 +++++++++++++++--- 2 files changed, 99 insertions(+), 120 deletions(-) diff --git a/tc/core/polyhedral/codegen_llvm.cc b/tc/core/polyhedral/codegen_llvm.cc index 8988b8f38..dd8799b4c 100644 --- a/tc/core/polyhedral/codegen_llvm.cc +++ b/tc/core/polyhedral/codegen_llvm.cc @@ -70,24 +70,6 @@ int64_t toSInt(isl::val v) { return v.get_num_si(); } -llvm::Value* getLLVMConstantSignedInt64(int64_t v) { - return llvm::ConstantInt::get(llvm::Type::getInt64Ty(llvmCtx), v, true); -} - -int64_t IslExprToSInt(isl::ast_expr e) { - auto intExpr = e.as(); - TC_CHECK(intExpr); - return toSInt(intExpr.get_val()); -} - -int64_t islIdToInt(isl::ast_expr_id e, isl::set context) { - auto space = context.get_space(); - isl::aff param(isl::aff::param_on_domain_space(space, e.get_id())); - auto p = context.sample_point(); - TC_CHECK(context.is_equal(p)); - return toSInt(param.eval(p)); -} - int64_t getTensorSize(isl::set context, const Halide::Expr& e) { // isl will take care of substituting parameter values if they are known and // simplifying the expression. @@ -112,62 +94,6 @@ std::vector getTensorSizesWithoutLeadingDim( return sizes; } -class IslAstExprInterpeter { - isl::set context_; - - public: - IslAstExprInterpeter(isl::set context) : context_(context){}; - - int64_t interpret(isl::ast_expr e) { - if (auto intExpr = e.as()) { - return IslExprToSInt(intExpr); - } else if (auto idExpr = e.as()) { - return islIdToInt(idExpr, context_); - } else if (auto opExpr = e.as()) { - return interpretOp(opExpr); - } else { - TC_CHECK(false) << "NYI"; - return 0; // avoid warning - } - }; - - private: - int64_t interpretOp(isl::ast_expr_op e) { - switch (e.get_n_arg()) { - case 1: - return interpretUnaryOp(e); - case 2: - return interpretBinaryOp(e); - default: - TC_CHECK(false) << "NYI: " << e; - return 0; // avoid warning - } - } - - int64_t interpretBinaryOp(isl::ast_expr_op e) { - auto left = interpret(e.get_arg(0)); - auto right = interpret(e.get_arg(1)); - if (e.as()) { - return left + right; - } else if (e.as()) { - return left - right; - } else { - TC_CHECK(false) << "NYI: " << e; - return 0; // avoid warning - } - } - - int64_t interpretUnaryOp(isl::ast_expr_op e) { - auto val = interpret(e.get_arg(0)); - if (e.as()) { - return -val; - } else { - TC_CHECK(false) << "NYI"; - return 0; // avoid warning - } - } -}; - static constexpr int kOptLevel = 3; class CodeGen_TC : public Halide::Internal::CodeGen_X86 { @@ -387,6 +313,13 @@ class LLVMCodegen { } } + void collectParams(const std::vector& params) { + for (const auto& p : params) { + args_.emplace_back(halide_cg.llvm_type_of(p.type())); + argNames_.emplace_back(p.name()); + } + } + public: LLVMCodegen( const Scop& scop, @@ -404,9 +337,12 @@ class LLVMCodegen { halide_cg.init_module(); } + // This creates a signature of the form: + // input_data_types, output_data_types, parameters void createSignature( const std::vector& inputs, const std::vector& outputs, + const std::vector& params, const std::string& fname) { auto size = inputs.size() + outputs.size(); args_.reserve(size); @@ -414,6 +350,7 @@ class LLVMCodegen { collectInputs(inputs); collectOutputs(outputs); + collectParams(params); auto* functionType = llvm::FunctionType::get(llvm::Type::getVoidTy(llvmCtx), args_, false); @@ -431,11 +368,15 @@ class LLVMCodegen { arg.setName(argNames_.at(idx++)); } - for (auto it = function->arg_begin(), end = function->arg_end(); it != end; + // Only pointer arguments can be NoAlias and NonNull + for (auto it = function->arg_begin(), + end = function->arg_begin() + inputs.size() + outputs.size(); + it != end; ++it) { it->addAttr(llvm::Attribute::NoAlias); it->addAttr(llvm::Attribute::NonNull); } + // Only input arguments are ReadOnly for (auto it = function->arg_begin(), end = it + inputs.size(); it != end; ++it) { it->addAttr(llvm::Attribute::ReadOnly); @@ -520,41 +461,20 @@ class LLVMCodegen { // Loop Header { - auto initVal = IslExprToSInt(node.get_init()); + auto initVal = halide_cg.codegen(node.get_init()); halide_cg.get_builder().SetInsertPoint(headerBB); phi = halide_cg.get_builder().CreatePHI( - llvm::Type::getInt64Ty(llvmCtx), 2, iterator.get_name()); + initVal->getType(), 2, iterator.get_name()); halide_cg.sym_push(iterator.get_name(), phi); - phi->addIncoming(getLLVMConstantSignedInt64(initVal), incoming); - - auto cond_expr = node.get_cond().as(); - TC_CHECK(cond_expr.as() or cond_expr.as()) - << "I only know how to codegen lt and le"; - auto condLHS = cond_expr.get_arg(0).as(); - TC_CHECK(condLHS); - TC_CHECK_EQ(condLHS.get_id(), iterator); - - IslAstExprInterpeter i(scop_.context()); - auto condRHSVal = i.interpret(cond_expr.get_arg(1)); - - auto cond = [&]() { - auto constant = getLLVMConstantSignedInt64(condRHSVal); - if (cond_expr.as()) { - return halide_cg.get_builder().CreateICmpSLT(phi, constant); - } else if (cond_expr.as()) { - return halide_cg.get_builder().CreateICmpSLE(phi, constant); - } else { - TC_CHECK(false) << "NYI"; - return static_cast(nullptr); // avoid warning - } - }(); + phi->addIncoming(initVal, incoming); + + auto cond = halide_cg.codegen(node.get_cond()); halide_cg.get_builder().CreateCondBr(cond, loopBodyBB, loopExitBB); } // Create Body { halide_cg.get_builder().SetInsertPoint(loopBodyBB); - auto* currentBB = emitAst(node.get_body()); halide_cg.get_builder().SetInsertPoint(currentBB); halide_cg.get_builder().CreateBr(loopLatchBB); @@ -563,11 +483,9 @@ class LLVMCodegen { // Create Latch { halide_cg.get_builder().SetInsertPoint(loopLatchBB); - auto incVal = IslExprToSInt(node.get_inc()); + auto incVal = halide_cg.codegen(node.get_inc()); phi->addIncoming( - halide_cg.get_builder().CreateAdd( - phi, getLLVMConstantSignedInt64(incVal)), - loopLatchBB); + halide_cg.get_builder().CreateAdd(phi, incVal), loopLatchBB); halide_cg.get_builder().CreateBr(headerBB); } @@ -688,7 +606,11 @@ std::unique_ptr emitLLVMKernel( cg.halide_cg.get_module()->setDataLayout(dataLayout); cg.halide_cg.get_module()->setTargetTriple( llvm::EngineBuilder().selectTarget()->getTargetTriple().str()); - cg.createSignature(scop.halide.inputs, scop.halide.outputs, specializedName); + cg.createSignature( + scop.halide.inputs, + scop.halide.outputs, + scop.halide.params, + specializedName); cg.CodeGen(islCg.astNode); cg.halide_cg.optimize_module(); return cg.halide_cg.move_module(); diff --git a/test/test_mapper_llvm.cc b/test/test_mapper_llvm.cc index 8a051b426..ead63c868 100644 --- a/test/test_mapper_llvm.cc +++ b/test/test_mapper_llvm.cc @@ -50,14 +50,20 @@ def fun(float(N, M) A, float(N, M) B) -> (C) { Jit jit; jit.codegenScop("kernel_anon", *scop); - auto fptr = - (void (*)(float*, float*, float*))jit.getSymbolAddress("kernel_anon"); + auto fptr = reinterpret_cast( + jit.getSymbolAddress("kernel_anon")); at::Tensor A = at::CPU(at::kFloat).rand({N, M}); at::Tensor B = at::CPU(at::kFloat).rand({N, M}); at::Tensor C = at::CPU(at::kFloat).rand({N, M}); at::Tensor Cc = A + B; - fptr(A.data(), B.data(), C.data()); + auto orderedParameters = scop->getParameterValues(); + fptr( + A.data(), + B.data(), + C.data(), + orderedParameters[0], + orderedParameters[1]); checkRtol(Cc - C, {A, B}, N * M); } @@ -96,8 +102,19 @@ TEST(LLVMCodegen, MultiStmt) { Jit jit; jit.codegenScop("kernel_anon", *scop); - auto fptr = (void (*)(float*, float*, float*, float*, float*, float*, float*)) - jit.getSymbolAddress("kernel_anon"); + auto fptr = reinterpret_cast(jit.getSymbolAddress("kernel_anon")); + auto orderedParameters = scop->getParameterValues(); fptr( A.data(), B.data(), @@ -105,7 +122,11 @@ TEST(LLVMCodegen, MultiStmt) { D.data(), O1.data(), O2.data(), - O3.data()); + O3.data(), + orderedParameters[0], + orderedParameters[1], + orderedParameters[2], + orderedParameters[3]); for (int c0 = 0; c0 < N; c0 += 1) { for (int c1 = 0; c1 < M; c1 += 1) { @@ -157,8 +178,17 @@ def batch_matmul(float(B, N, M) X, float(B, M, K) Y) -> (Z) { Jit jit; jit.codegenScop("batch_matmul", *scop); auto fptr = - (void (*)(float*, float*, float*))jit.getSymbolAddress("batch_matmul"); - fptr(X.data(), Y.data(), Oc.data()); + reinterpret_cast( + jit.getSymbolAddress("batch_matmul")); + auto orderedParameters = scop->getParameterValues(); + fptr( + X.data(), + Y.data(), + Oc.data(), + orderedParameters[0], + orderedParameters[1], + orderedParameters[2], + orderedParameters[3]); checkRtol(O - Oc, {Y, X}, M, 3e-7); } @@ -197,18 +227,37 @@ def convolution(float(N,C,H,W) I, float(O,C,KH,KW) W1, float(O) B) -> (tmp, O1) Jit jit; jit.codegenScop("convolution", *scop); - auto fptr = - (void (*)(float*, float*, float*, float*, float*))jit.getSymbolAddress( - "convolution"); + auto fptr = reinterpret_cast(jit.getSymbolAddress("convolution")); at::Tensor tmp = at::CPU(at::kFloat).zeros_like(expected); at::Tensor output = at::CPU(at::kFloat).zeros_like(expected); + auto orderedParameters = scop->getParameterValues(); fptr( I.data(), W1.data(), B.data(), tmp.data(), - output.data()); + output.data(), + orderedParameters[0], + orderedParameters[1], + orderedParameters[2], + orderedParameters[3], + orderedParameters[4], + orderedParameters[5], + orderedParameters[6]); + TC_CHECK_EQ(output.ndimension(), 4); checkRtol(output - expected, {I, W1, B}, C * KH * KW, 1e-6); } @@ -228,7 +277,8 @@ def concat(float(M, N) A, float(M, N) B) -> (O1) { Jit jit; jit.codegenScop("concat", *scop); - auto fptr = (void (*)(float*, float*, float*))jit.getSymbolAddress("concat"); + auto fptr = reinterpret_cast( + jit.getSymbolAddress("concat")); at::Tensor A = at::CPU(at::kFloat).rand({M, N}); at::Tensor B = at::CPU(at::kFloat).rand({M, N}); @@ -241,7 +291,14 @@ def concat(float(M, N) A, float(M, N) B) -> (O1) { O1c[n][1][m] = B[m][n]; } } - fptr(A.data(), B.data(), O1.data()); + + auto orderedParameters = scop->getParameterValues(); + fptr( + A.data(), + B.data(), + O1.data(), + orderedParameters[0], + orderedParameters[1]); checkRtol(O1c - O1, {A, B}, N * M); } From 2830c070b516b9e18f9c2405d8d4b75e6f692a81 Mon Sep 17 00:00:00 2001 From: Nicolas Vasilache Date: Fri, 20 Jul 2018 05:18:15 -0700 Subject: [PATCH 078/152] Stop pretending we support multiple LLVM versions --- tc/core/polyhedral/llvm_jit.cc | 38 +--------------------------------- 1 file changed, 1 insertion(+), 37 deletions(-) diff --git a/tc/core/polyhedral/llvm_jit.cc b/tc/core/polyhedral/llvm_jit.cc index 81fd16e52..ef80fb6dc 100644 --- a/tc/core/polyhedral/llvm_jit.cc +++ b/tc/core/polyhedral/llvm_jit.cc @@ -36,34 +36,6 @@ using namespace llvm; namespace tc { -#if LLVM_VERSION_MAJOR <= 6 - -Jit::Jit() - : TM_(EngineBuilder().selectTarget()), - DL_(TM_->createDataLayout()), - objectLayer_([]() { return std::make_shared(); }), - compileLayer_(objectLayer_, orc::SimpleCompiler(*TM_)) {} - -void Jit::addModule(std::shared_ptr M) { - M->setTargetTriple(TM_->getTargetTriple().str()); - auto Resolver = orc::createLambdaResolver( - [&](const std::string& Name) { - if (auto Sym = compileLayer_.findSymbol(Name, false)) - return Sym; - return JITSymbol(nullptr); - }, - [](const std::string& Name) { - if (auto SymAddr = RTDyldMemoryManager::getSymbolAddressInProcess(Name)) - return JITSymbol(SymAddr, JITSymbolFlags::Exported); - return JITSymbol(nullptr); - }); - - auto res = compileLayer_.addModule(M, std::move(Resolver)); - TC_CHECK(res) << "Failed to jit compile."; -} - -#else - Jit::Jit() : ES(), Resolver(llvm::orc::createLegacyLookupResolver( @@ -87,14 +59,7 @@ Jit::Jit() return llvm::orc::RTDyldObjectLinkingLayer::Resources{ std::make_shared(), Resolver}; }), - compileLayer_(objectLayer_, orc::SimpleCompiler(*TM_)) { - std::string err; - - sys::DynamicLibrary::LoadLibraryPermanently(nullptr, &err); - if (err != "") { - throw std::runtime_error("Failed to find cilkrts: " + err); - } -} + compileLayer_(objectLayer_, orc::SimpleCompiler(*TM_)) {} void Jit::addModule(std::shared_ptr M) { M->setTargetTriple(TM_->getTargetTriple().str()); @@ -102,7 +67,6 @@ void Jit::addModule(std::shared_ptr M) { llvm::Error res = compileLayer_.addModule(K, CloneModule(*M)); TC_CHECK(!res) << "Failed to jit compile."; } -#endif std::shared_ptr Jit::codegenScop( const std::string& specializedName, From e5c677833fd5c916907246e90e46704fedfba46a Mon Sep 17 00:00:00 2001 From: Nicolas Vasilache Date: Fri, 20 Jul 2018 07:08:48 -0700 Subject: [PATCH 079/152] Add primitive CPU mapper This commit adds a primitive CPU mapper and updates the tests. In the current form, the context is not being used to gist and conditionals on parameters of the form `if (M == 40) { ... } ` are needed. So this PR also adds the `emitIf` function to generate the proper LLVM IR and let the tests pass. --- tc/core/CMakeLists.txt | 1 + tc/core/polyhedral/codegen_llvm.cc | 36 +++++++++- tc/core/polyhedral/cpu/mapped_scop.cc | 93 ++++++++++++++++++++++++++ tc/core/polyhedral/cpu/mapped_scop.h | 74 +++++++++++++++++++++ test/test_mapper_llvm.cc | 95 +++++++++++++-------------- 5 files changed, 249 insertions(+), 50 deletions(-) create mode 100644 tc/core/polyhedral/cpu/mapped_scop.cc create mode 100644 tc/core/polyhedral/cpu/mapped_scop.h diff --git a/tc/core/CMakeLists.txt b/tc/core/CMakeLists.txt index 46f87a197..efa9c2c04 100644 --- a/tc/core/CMakeLists.txt +++ b/tc/core/CMakeLists.txt @@ -76,6 +76,7 @@ add_library( polyhedral/codegen_llvm.cc polyhedral/llvm_jit.cc + polyhedral/cpu/mapped_scop.cc ) target_include_directories(tc_core_cpu PUBLIC ${LLVM_INCLUDE_DIRS}) target_link_libraries( diff --git a/tc/core/polyhedral/codegen_llvm.cc b/tc/core/polyhedral/codegen_llvm.cc index dd8799b4c..a07509045 100644 --- a/tc/core/polyhedral/codegen_llvm.cc +++ b/tc/core/polyhedral/codegen_llvm.cc @@ -405,8 +405,8 @@ class LLVMCodegen { } else if (auto blockNode = node.as()) { return emitBlock(blockNode); } else { - if (node.as()) { - LOG(FATAL) << "NYI if node: " << node << std::endl; + if (auto cond = node.as()) { + return emitIf(cond); } else { LOG(FATAL) << "NYI " << node << std::endl; } @@ -445,6 +445,38 @@ class LLVMCodegen { return arrTy->getPointerTo(); } + llvm::BasicBlock* emitIf(isl::ast_node_if node) { + auto* incoming = halide_cg.get_builder().GetInsertBlock(); + auto* function = incoming->getParent(); + + llvm::Value* condVal = halide_cg.codegen(node.get_cond()); + auto* thenBB = llvm::BasicBlock::Create(llvmCtx, "then", function); + // Recursively emit "then" in a new thenBB + halide_cg.get_builder().SetInsertPoint(thenBB); + auto innerBB = emitAst(node.get_then()); + + // outer -> thenBB + halide_cg.get_builder().SetInsertPoint(incoming); + // outer ---------> if_exit + // TODO: When we support "else", go to elseBB instead of exit + auto* exit = llvm::BasicBlock::Create(llvmCtx, "if_exit", function); + halide_cg.get_builder().CreateCondBr(condVal, thenBB, exit); + + // then -> if_exit + halide_cg.get_builder().SetInsertPoint(innerBB); + halide_cg.get_builder().CreateBr(exit); + + // Else is often empty in the absence of full tile extraction + if (node.has_else()) { + LOG(FATAL) << "NYI: else conditional branch"; + return halide_cg.get_builder().GetInsertBlock(); + } + + // Set the insertion point to if_exit + halide_cg.get_builder().SetInsertPoint(exit); + return halide_cg.get_builder().GetInsertBlock(); + } + llvm::BasicBlock* emitFor(isl::ast_node_for node) { auto* incoming = halide_cg.get_builder().GetInsertBlock(); auto* function = incoming->getParent(); diff --git a/tc/core/polyhedral/cpu/mapped_scop.cc b/tc/core/polyhedral/cpu/mapped_scop.cc new file mode 100644 index 000000000..0cd677f10 --- /dev/null +++ b/tc/core/polyhedral/cpu/mapped_scop.cc @@ -0,0 +1,93 @@ +/** + * Copyright (c) 2017-present, Facebook, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "tc/core/polyhedral/cpu/mapped_scop.h" + +#include +#include +#include +#include +#include +#include +#include + +#include "tc/core/check.h" +#include "tc/core/flags.h" +#include "tc/core/functional.h" +#include "tc/core/polyhedral/codegen_llvm.h" +#include "tc/core/polyhedral/exceptions.h" +#include "tc/core/polyhedral/llvm_jit.h" +#include "tc/core/polyhedral/schedule_transforms.h" +#include "tc/core/polyhedral/schedule_utils.h" +#include "tc/core/polyhedral/scop.h" + +#include + +namespace tc { +namespace polyhedral { + +std::unique_ptr MappedScop::codegen( + const std::string& specializedName) const { + std::unique_ptr jit(new Jit()); + jit->codegenScop(specializedName, *scop_); + return jit; +} + +std::unique_ptr MappedScop::makeSequential( + std::unique_ptr&& scopUPtr, + const CpuMappingOptions& cpuOptions) { + using namespace polyhedral::detail; + + const auto& generic = cpuOptions.generic; + auto mappedScop = std::unique_ptr( + new MappedScop(std::move(scopUPtr), generic.proto.unroll())); + auto& scop = mappedScop->scop_; + + // 1a. Optionally specialize before scheduling... + if (generic.proto.fix_parameters_before_scheduling()) { + scop->specializeToContext(); + } + + // 2. Schedule + scop = Scop::makeScheduled(*scop, generic.outerScheduleOptions); + + // 3. Tile + TC_CHECK_LT(0u, generic.tiling.size()) + << "Must pass tile vector with >= 1 tile sizes"; + auto outerBand = scop->tileOuterBand(generic.tiling); + + // 4. Optionally reschedule if point loops need a different strategy than + // tile loops + if (generic.outerScheduleOptions != generic.intraTileScheduleOptions) { + scop->reschedule(outerBand->child({0}), generic.intraTileScheduleOptions); + LOG_IF(INFO, FLAGS_debug_tc_mapper) + << "After intra-tile rescheduling:" << std::endl + << *mappedScop->schedule(); + } + + // 1b. ...or after rescheduling + if (!generic.proto.fix_parameters_before_scheduling()) { + scop->specializeToContext(); + } + + LOG_IF(INFO, FLAGS_debug_tc_mapper) + << "After sequential strategy:" << std::endl + << *mappedScop->schedule(); + + return mappedScop; +} + +} // namespace polyhedral +} // namespace tc diff --git a/tc/core/polyhedral/cpu/mapped_scop.h b/tc/core/polyhedral/cpu/mapped_scop.h new file mode 100644 index 000000000..bf42770b2 --- /dev/null +++ b/tc/core/polyhedral/cpu/mapped_scop.h @@ -0,0 +1,74 @@ +/** + * Copyright (c) 2017-present, Facebook, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#pragma once + +#include +#include +#include +#include +#include + +#include "tc/core/cpu/cpu_mapping_options.h" +#include "tc/core/polyhedral/llvm_jit.h" +#include "tc/core/polyhedral/scop.h" +#include "tc/core/tensor.h" +#include "tc/external/isl.h" + +namespace tc { +namespace polyhedral { + +class MappedScop { + private: + MappedScop(std::unique_ptr&& scop, uint64_t unroll_) + : scop_(std::move(scop)), unroll(unroll_) {} + + public: + static std::unique_ptr makeSequential( + std::unique_ptr&& scopUPtr, + const CpuMappingOptions& mappingOptions); + + // Fix the values of the specified parameters in the context + // to the corresponding specified values. + template + void fixParameters(const std::unordered_map& sizes) { + scop_->fixParameters(sizes); + } + + // Generate code at the current state of transformation provided a + // name for the generated function. + std::unique_ptr codegen(const std::string& specializedName) const; + + // Accessors.. + // Const accessor to schedule of underlying Scop. + inline const detail::ScheduleTree* schedule() const { + return scop_->scheduleRoot(); + } + // Reference to underlying scop, no ownership transfer intended. + inline const Scop& scop() const { + return *scop_; + } + inline Scop& scop() { + return *scop_; + } + + private: + std::unique_ptr scop_; + + public: + const uint64_t unroll; +}; +} // namespace polyhedral +} // namespace tc diff --git a/test/test_mapper_llvm.cc b/test/test_mapper_llvm.cc index ead63c868..f50227260 100644 --- a/test/test_mapper_llvm.cc +++ b/test/test_mapper_llvm.cc @@ -23,6 +23,7 @@ #include "tc/core/cpu/cpu_mapping_options.h" #include "tc/core/cpu/cpu_tc_executor.h" #include "tc/core/polyhedral/codegen_llvm.h" +#include "tc/core/polyhedral/cpu/mapped_scop.h" #include "tc/core/polyhedral/llvm_jit.h" #include "tc/core/polyhedral/scop.h" #include "tc/core/scope_guard.h" @@ -47,17 +48,17 @@ def fun(float(N, M) A, float(N, M) B) -> (C) { auto ctx = isl::with_exceptions::globalIslCtx(); auto scop = polyhedral::Scop::makeScop(ctx, tc); scop = Scop::makeSpecializedScop(*scop, {{"N", N}, {"M", M}}); - - Jit jit; - jit.codegenScop("kernel_anon", *scop); + auto mscop = MappedScop::makeSequential( + std::move(scop), CpuMappingOptions::makeNaiveMappingOptions()); + auto pJit = mscop->codegen("kernel_anon"); auto fptr = reinterpret_cast( - jit.getSymbolAddress("kernel_anon")); + pJit->getSymbolAddress("kernel_anon")); at::Tensor A = at::CPU(at::kFloat).rand({N, M}); at::Tensor B = at::CPU(at::kFloat).rand({N, M}); at::Tensor C = at::CPU(at::kFloat).rand({N, M}); at::Tensor Cc = A + B; - auto orderedParameters = scop->getParameterValues(); + auto orderedParameters = mscop->scop().getParameterValues(); fptr( A.data(), B.data(), @@ -88,20 +89,9 @@ TEST(LLVMCodegen, MultiStmt) { auto scop = polyhedral::Scop::makeScop(ctx, tc); scop = Scop::makeSpecializedScop( *scop, {{"N", N}, {"M", M}, {"K", K}, {"L", L}}); - - at::Tensor A = at::CPU(at::kFloat).rand({N, M, K, L}); - at::Tensor B = at::CPU(at::kFloat).rand({N, M}); - at::Tensor C = at::CPU(at::kFloat).rand({N, M}); - at::Tensor D = at::CPU(at::kFloat).rand({N, M}); - at::Tensor O1 = at::CPU(at::kFloat).rand({N, M}); - at::Tensor O2 = at::CPU(at::kFloat).rand({N, M}); - at::Tensor O3 = at::CPU(at::kFloat).rand({N, M}); - at::Tensor O1c = at::CPU(at::kFloat).rand({N, M}); - at::Tensor O2c = at::CPU(at::kFloat).rand({N, M}); - at::Tensor O3c = at::CPU(at::kFloat).rand({N, M}); - - Jit jit; - jit.codegenScop("kernel_anon", *scop); + auto mscop = MappedScop::makeSequential( + std::move(scop), CpuMappingOptions::makeNaiveMappingOptions()); + auto pJit = mscop->codegen("kernel_anon"); auto fptr = reinterpret_cast(jit.getSymbolAddress("kernel_anon")); - auto orderedParameters = scop->getParameterValues(); + int)>(pJit->getSymbolAddress("kernel_anon")); + + at::Tensor A = at::CPU(at::kFloat).rand({N, M, K, L}); + at::Tensor B = at::CPU(at::kFloat).rand({N, M}); + at::Tensor C = at::CPU(at::kFloat).rand({N, M}); + at::Tensor D = at::CPU(at::kFloat).rand({N, M}); + at::Tensor O1 = at::CPU(at::kFloat).rand({N, M}); + at::Tensor O2 = at::CPU(at::kFloat).rand({N, M}); + at::Tensor O3 = at::CPU(at::kFloat).rand({N, M}); + at::Tensor O1c = at::CPU(at::kFloat).rand({N, M}); + at::Tensor O2c = at::CPU(at::kFloat).rand({N, M}); + at::Tensor O3c = at::CPU(at::kFloat).rand({N, M}); + auto orderedParameters = mscop->scop().getParameterValues(); fptr( A.data(), B.data(), @@ -165,22 +166,22 @@ def batch_matmul(float(B, N, M) X, float(B, M, K) Y) -> (Z) { Z(b, n, k) +=! X(b, n, r_m) * Y(b, r_m, k) } )"; - at::Tensor X = at::CPU(at::kFloat).rand({B, N, M}); - at::Tensor Y = at::CPU(at::kFloat).rand({B, M, K}); - at::Tensor O = X.bmm(Y); - at::Tensor Oc = at::CPU(at::kFloat).zeros_like(O); - auto ctx = isl::with_exceptions::globalIslCtx(); auto scop = polyhedral::Scop::makeScop(ctx, tc); scop = Scop::makeSpecializedScop( *scop, {{"N", N}, {"M", M}, {"K", K}, {"B", B}}); - - Jit jit; - jit.codegenScop("batch_matmul", *scop); + auto mscop = MappedScop::makeSequential( + std::move(scop), CpuMappingOptions::makeNaiveMappingOptions()); + auto pJit = mscop->codegen("batch_matmul"); auto fptr = reinterpret_cast( - jit.getSymbolAddress("batch_matmul")); - auto orderedParameters = scop->getParameterValues(); + pJit->getSymbolAddress("batch_matmul")); + + at::Tensor X = at::CPU(at::kFloat).rand({B, N, M}); + at::Tensor Y = at::CPU(at::kFloat).rand({B, M, K}); + at::Tensor O = X.bmm(Y); + at::Tensor Oc = at::CPU(at::kFloat).zeros_like(O); + auto orderedParameters = mscop->scop().getParameterValues(); fptr( X.data(), Y.data(), @@ -208,11 +209,6 @@ def convolution(float(N,C,H,W) I, float(O,C,KH,KW) W1, float(O) B) -> (tmp, O1) } )"; - at::Tensor I = at::CPU(at::kFloat).rand({NN, C, H, W}); - at::Tensor W1 = at::CPU(at::kFloat).rand({O, C, KH, KW}); - at::Tensor B = at::CPU(at::kFloat).rand({O}); - at::Tensor expected = at::conv2d(I, W1, B); - auto ctx = isl::with_exceptions::globalIslCtx(); auto scop = polyhedral::Scop::makeScop(ctx, tc); scop = Scop::makeSpecializedScop( @@ -224,9 +220,9 @@ def convolution(float(N,C,H,W) I, float(O,C,KH,KW) W1, float(O) B) -> (tmp, O1) {"W", W}, {"KW", KW}, {"C", C}}); - - Jit jit; - jit.codegenScop("convolution", *scop); + auto mscop = MappedScop::makeSequential( + std::move(scop), CpuMappingOptions::makeNaiveMappingOptions()); + auto pJit = mscop->codegen("convolution"); auto fptr = reinterpret_cast (tmp, O1) int, int, int, - int)>(jit.getSymbolAddress("convolution")); + int)>(pJit->getSymbolAddress("convolution")); + + auto orderedParameters = mscop->scop().getParameterValues(); + at::Tensor I = at::CPU(at::kFloat).rand({NN, C, H, W}); + at::Tensor W1 = at::CPU(at::kFloat).rand({O, C, KH, KW}); + at::Tensor B = at::CPU(at::kFloat).rand({O}); + at::Tensor expected = at::conv2d(I, W1, B); at::Tensor tmp = at::CPU(at::kFloat).zeros_like(expected); at::Tensor output = at::CPU(at::kFloat).zeros_like(expected); - auto orderedParameters = scop->getParameterValues(); fptr( I.data(), W1.data(), @@ -257,7 +258,6 @@ def convolution(float(N,C,H,W) I, float(O,C,KH,KW) W1, float(O) B) -> (tmp, O1) orderedParameters[4], orderedParameters[5], orderedParameters[6]); - TC_CHECK_EQ(output.ndimension(), 4); checkRtol(output - expected, {I, W1, B}, C * KH * KW, 1e-6); } @@ -274,12 +274,13 @@ def concat(float(M, N) A, float(M, N) B) -> (O1) { auto ctx = isl::with_exceptions::globalIslCtx(); auto scop = polyhedral::Scop::makeScop(ctx, tc); scop = Scop::makeSpecializedScop(*scop, {{"N", N}, {"M", M}}); - - Jit jit; - jit.codegenScop("concat", *scop); + auto mscop = MappedScop::makeSequential( + std::move(scop), CpuMappingOptions::makeNaiveMappingOptions()); + auto pJit = mscop->codegen("concat"); auto fptr = reinterpret_cast( - jit.getSymbolAddress("concat")); + pJit->getSymbolAddress("concat")); + auto orderedParameters = mscop->scop().getParameterValues(); at::Tensor A = at::CPU(at::kFloat).rand({M, N}); at::Tensor B = at::CPU(at::kFloat).rand({M, N}); at::Tensor O1 = at::CPU(at::kFloat).rand({N, 2, M}); @@ -291,8 +292,6 @@ def concat(float(M, N) A, float(M, N) B) -> (O1) { O1c[n][1][m] = B[m][n]; } } - - auto orderedParameters = scop->getParameterValues(); fptr( A.data(), B.data(), From 8f3659ffda8daa45a33f6874b26b6fd7a9717ee6 Mon Sep 17 00:00:00 2001 From: Nicolas Vasilache Date: Fri, 20 Jul 2018 07:14:37 -0700 Subject: [PATCH 080/152] Drop emitBasicBlock This extra function is unneeded and unnecessarily complexifies the emitted LLVM IR. Instead just emit each member of the block in sequence and return the last BB. --- tc/core/polyhedral/codegen_llvm.cc | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/tc/core/polyhedral/codegen_llvm.cc b/tc/core/polyhedral/codegen_llvm.cc index a07509045..ddfde597a 100644 --- a/tc/core/polyhedral/codegen_llvm.cc +++ b/tc/core/polyhedral/codegen_llvm.cc @@ -403,7 +403,11 @@ class LLVMCodegen { } else if (auto userNode = node.as()) { return emitStmt(userNode); } else if (auto blockNode = node.as()) { - return emitBlock(blockNode); + llvm::BasicBlock* curBB; + for (auto child : blockNode.get_children()) { + curBB = emitAst(child); + } + return curBB; } else { if (auto cond = node.as()) { return emitIf(cond); @@ -415,24 +419,6 @@ class LLVMCodegen { } private: - llvm::BasicBlock* emitBlock(isl::ast_node_block node) { - auto* function = halide_cg.get_builder().GetInsertBlock()->getParent(); - auto* currBB = llvm::BasicBlock::Create(llvmCtx, "block_exit", function); - halide_cg.get_builder().CreateBr(currBB); - halide_cg.get_builder().SetInsertPoint(currBB); - - for (auto child : node.get_children()) { - currBB = emitAst(child); - halide_cg.get_builder().SetInsertPoint(currBB); - } - - auto* exit = llvm::BasicBlock::Create(llvmCtx, "block_exit", function); - halide_cg.get_builder().SetInsertPoint(currBB); - halide_cg.get_builder().CreateBr(exit); - halide_cg.get_builder().SetInsertPoint(exit); - return exit; - } - llvm::Type* makePtrToArrayType( llvm::Type* baseTy, const std::vector& sizes) { From 6eb026f0dbc4eccaa86c98d79539050e02919218 Mon Sep 17 00:00:00 2001 From: Nicolas Vasilache Date: Fri, 20 Jul 2018 07:20:11 -0700 Subject: [PATCH 081/152] Split string --- tc/core/polyhedral/codegen_llvm.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tc/core/polyhedral/codegen_llvm.cc b/tc/core/polyhedral/codegen_llvm.cc index ddfde597a..775831200 100644 --- a/tc/core/polyhedral/codegen_llvm.cc +++ b/tc/core/polyhedral/codegen_llvm.cc @@ -88,7 +88,8 @@ std::vector getTensorSizesWithoutLeadingDim( for (int d = 1; d < dims; ++d) { Halide::Expr extent = t.parameter().extent_constraint(d); TC_CHECK(extent.defined()) - << "Undefined extent on input/output tensor. Forward bounds inference should have set these\n"; + << "Undefined extent on input/output tensor. " + << "Forward bounds inference should have set these\n"; sizes.push_back(getTensorSize(context, extent)); } return sizes; From ace0aac829389ed92a095b459b06c5eb72124c53 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Wed, 18 Jul 2018 11:49:52 +0200 Subject: [PATCH 082/152] bump isl for change in export of isl_schedule_node_band_member_set_ast_loop_type --- isl_interface/include/isl/cpp.h | 344 +++++++++++------- tc/core/polyhedral/schedule_isl_conversion.cc | 3 +- third-party/islpp | 2 +- 3 files changed, 209 insertions(+), 140 deletions(-) diff --git a/isl_interface/include/isl/cpp.h b/isl_interface/include/isl/cpp.h index c8648ad3b..537b6f738 100644 --- a/isl_interface/include/isl/cpp.h +++ b/isl_interface/include/isl/cpp.h @@ -194,14 +194,6 @@ class options_scoped_set_on_error { } }; -enum class ast_loop_type { - error = isl_ast_loop_error, - _default = isl_ast_loop_default, - atomic = isl_ast_loop_atomic, - unroll = isl_ast_loop_unroll, - separate = isl_ast_loop_separate -}; - } // namespace isl namespace isl { @@ -2471,9 +2463,7 @@ class schedule_node_band : public schedule_node { inline bool get_permutable() const; inline isl::space get_space() const; inline bool member_get_coincident(int pos) const; - inline isl::schedule_node_band member_set_ast_loop_type(int pos, enum isl::ast_loop_type type) const; inline isl::schedule_node_band member_set_coincident(int pos, int coincident) const; - inline isl::schedule_node_band member_set_isolate_ast_loop_type(int pos, enum isl::ast_loop_type type) const; inline isl::schedule_node_band mod(isl::multi_val mv) const; inline unsigned int n_member() const; inline isl::schedule_node_band scale(isl::multi_val mv) const; @@ -2483,6 +2473,14 @@ class schedule_node_band : public schedule_node { inline isl::schedule_node_band shift(isl::multi_union_pw_aff shift) const; inline isl::schedule_node_band split(int pos) const; inline isl::schedule_node_band tile(isl::multi_val sizes) const; + inline isl::schedule_node_band member_set_ast_loop_default(int pos) const; + inline isl::schedule_node_band member_set_ast_loop_atomic(int pos) const; + inline isl::schedule_node_band member_set_ast_loop_unroll(int pos) const; + inline isl::schedule_node_band member_set_ast_loop_separate(int pos) const; + inline isl::schedule_node_band member_set_isolate_ast_loop_default(int pos) const; + inline isl::schedule_node_band member_set_isolate_ast_loop_atomic(int pos) const; + inline isl::schedule_node_band member_set_isolate_ast_loop_unroll(int pos) const; + inline isl::schedule_node_band member_set_isolate_ast_loop_separate(int pos) const; typedef isl_schedule_node* isl_ptr_t; }; @@ -3843,7 +3841,7 @@ bool aff::plain_is_equal(const isl::aff &aff2) const auto res = isl_aff_plain_is_equal(get(), aff2.get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } isl::aff aff::project_domain_on_params() const @@ -4604,7 +4602,7 @@ bool ast_expr::is_equal(const isl::ast_expr &expr2) const auto res = isl_ast_expr_is_equal(get(), expr2.get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } isl::ast_expr ast_expr::set_op_arg(int pos, isl::ast_expr arg) const @@ -5123,7 +5121,7 @@ bool ast_node_for::is_coincident() const auto res = isl_ast_node_for_is_coincident(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool ast_node_for::is_degenerate() const @@ -5135,7 +5133,7 @@ bool ast_node_for::is_degenerate() const auto res = isl_ast_node_for_is_degenerate(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } // implementations for isl::ast_node_if @@ -5224,7 +5222,7 @@ bool ast_node_if::has_else() const auto res = isl_ast_node_if_has_else(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } // implementations for isl::ast_node_list @@ -6906,7 +6904,7 @@ bool basic_map::can_curry() const auto res = isl_basic_map_can_curry(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool basic_map::can_uncurry() const @@ -6918,7 +6916,7 @@ bool basic_map::can_uncurry() const auto res = isl_basic_map_can_uncurry(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } isl::basic_map basic_map::curry() const @@ -7113,7 +7111,7 @@ bool basic_map::is_empty() const auto res = isl_basic_map_is_empty(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool basic_map::is_equal(const isl::basic_map &bmap2) const @@ -7125,7 +7123,7 @@ bool basic_map::is_equal(const isl::basic_map &bmap2) const auto res = isl_basic_map_is_equal(get(), bmap2.get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool basic_map::is_subset(const isl::basic_map &bmap2) const @@ -7137,7 +7135,7 @@ bool basic_map::is_subset(const isl::basic_map &bmap2) const auto res = isl_basic_map_is_subset(get(), bmap2.get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } isl::map basic_map::lexmax() const @@ -7673,7 +7671,7 @@ bool basic_set::is_empty() const auto res = isl_basic_set_is_empty(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool basic_set::is_equal(const isl::basic_set &bset2) const @@ -7685,7 +7683,7 @@ bool basic_set::is_equal(const isl::basic_set &bset2) const auto res = isl_basic_set_is_equal(get(), bset2.get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool basic_set::is_subset(const isl::basic_set &bset2) const @@ -7697,7 +7695,7 @@ bool basic_set::is_subset(const isl::basic_set &bset2) const auto res = isl_basic_set_is_subset(get(), bset2.get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool basic_set::is_universe() const @@ -7709,7 +7707,7 @@ bool basic_set::is_universe() const auto res = isl_basic_set_is_universe(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool basic_set::is_wrapping() const @@ -7721,7 +7719,7 @@ bool basic_set::is_wrapping() const auto res = isl_basic_set_is_wrapping(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } isl::set basic_set::lexmax() const @@ -7814,7 +7812,7 @@ bool basic_set::plain_is_universe() const auto res = isl_basic_set_plain_is_universe(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } isl::basic_set basic_set::sample() const @@ -8193,7 +8191,7 @@ bool fixed_box::is_valid() const auto res = isl_fixed_box_is_valid(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } // implementations for isl::id @@ -8666,7 +8664,7 @@ bool local_space::is_equal(const isl::local_space &ls2) const auto res = isl_local_space_is_equal(get(), ls2.get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool local_space::is_params() const @@ -8678,7 +8676,7 @@ bool local_space::is_params() const auto res = isl_local_space_is_params(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool local_space::is_set() const @@ -8690,7 +8688,7 @@ bool local_space::is_set() const auto res = isl_local_space_is_set(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } isl::basic_map local_space::lifting() const @@ -8918,7 +8916,7 @@ bool map::can_curry() const auto res = isl_map_can_curry(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool map::can_range_curry() const @@ -8930,7 +8928,7 @@ bool map::can_range_curry() const auto res = isl_map_can_range_curry(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool map::can_uncurry() const @@ -8942,7 +8940,7 @@ bool map::can_uncurry() const auto res = isl_map_can_uncurry(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } isl::map map::coalesce() const @@ -9360,7 +9358,7 @@ bool map::is_bijective() const auto res = isl_map_is_bijective(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool map::is_disjoint(const isl::map &map2) const @@ -9372,7 +9370,7 @@ bool map::is_disjoint(const isl::map &map2) const auto res = isl_map_is_disjoint(get(), map2.get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool map::is_empty() const @@ -9384,7 +9382,7 @@ bool map::is_empty() const auto res = isl_map_is_empty(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool map::is_equal(const isl::map &map2) const @@ -9396,7 +9394,7 @@ bool map::is_equal(const isl::map &map2) const auto res = isl_map_is_equal(get(), map2.get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool map::is_injective() const @@ -9408,7 +9406,7 @@ bool map::is_injective() const auto res = isl_map_is_injective(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool map::is_single_valued() const @@ -9420,7 +9418,7 @@ bool map::is_single_valued() const auto res = isl_map_is_single_valued(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool map::is_strict_subset(const isl::map &map2) const @@ -9432,7 +9430,7 @@ bool map::is_strict_subset(const isl::map &map2) const auto res = isl_map_is_strict_subset(get(), map2.get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool map::is_subset(const isl::map &map2) const @@ -9444,7 +9442,7 @@ bool map::is_subset(const isl::map &map2) const auto res = isl_map_is_subset(get(), map2.get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } isl::map map::lexmax() const @@ -11079,7 +11077,7 @@ bool multi_pw_aff::is_equal(const isl::multi_pw_aff &mpa2) const auto res = isl_multi_pw_aff_is_equal(get(), mpa2.get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } isl::multi_pw_aff multi_pw_aff::mod(isl::multi_val mv) const @@ -11747,7 +11745,7 @@ bool multi_union_pw_aff::involves_param(const isl::id &id) const auto res = isl_multi_union_pw_aff_involves_param_id(get(), id.get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } isl::multi_val multi_union_pw_aff::max_multi_val() const @@ -12573,7 +12571,7 @@ bool point::is_void() const auto res = isl_point_is_void(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } // implementations for isl::pw_aff @@ -12913,7 +12911,7 @@ bool pw_aff::involves_nan() const auto res = isl_pw_aff_involves_nan(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool pw_aff::is_cst() const @@ -12925,7 +12923,7 @@ bool pw_aff::is_cst() const auto res = isl_pw_aff_is_cst(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool pw_aff::is_equal(const isl::pw_aff &pa2) const @@ -12937,7 +12935,7 @@ bool pw_aff::is_equal(const isl::pw_aff &pa2) const auto res = isl_pw_aff_is_equal(get(), pa2.get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } isl::set pw_aff::le_set(isl::pw_aff pwaff2) const @@ -13657,7 +13655,7 @@ bool pw_multi_aff::is_equal(const isl::pw_multi_aff &pma2) const auto res = isl_pw_multi_aff_is_equal(get(), pma2.get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } int pw_multi_aff::n_piece() const @@ -13964,7 +13962,7 @@ bool schedule::plain_is_equal(const isl::schedule &schedule2) const auto res = isl_schedule_plain_is_equal(get(), schedule2.get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } isl::schedule schedule::pullback(isl::union_pw_multi_aff upma) const @@ -14737,7 +14735,7 @@ bool schedule_node::has_children() const auto res = isl_schedule_node_has_children(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool schedule_node::has_next_sibling() const @@ -14749,7 +14747,7 @@ bool schedule_node::has_next_sibling() const auto res = isl_schedule_node_has_next_sibling(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool schedule_node::has_parent() const @@ -14761,7 +14759,7 @@ bool schedule_node::has_parent() const auto res = isl_schedule_node_has_parent(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool schedule_node::has_previous_sibling() const @@ -14773,7 +14771,7 @@ bool schedule_node::has_previous_sibling() const auto res = isl_schedule_node_has_previous_sibling(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } isl::schedule_node schedule_node::insert_context(isl::set context) const @@ -14869,7 +14867,7 @@ bool schedule_node::is_equal(const isl::schedule_node &node2) const auto res = isl_schedule_node_is_equal(get(), node2.get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool schedule_node::is_subtree_anchored() const @@ -14881,7 +14879,7 @@ bool schedule_node::is_subtree_anchored() const auto res = isl_schedule_node_is_subtree_anchored(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } isl::schedule_node schedule_node::map_descendant_bottom_up(const std::function &fn) const @@ -15096,7 +15094,7 @@ bool schedule_node_band::get_permutable() const auto res = isl_schedule_node_band_get_permutable(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } isl::space schedule_node_band::get_space() const @@ -15120,19 +15118,7 @@ bool schedule_node_band::member_get_coincident(int pos) const auto res = isl_schedule_node_band_member_get_coincident(get(), pos); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; -} - -isl::schedule_node_band schedule_node_band::member_set_ast_loop_type(int pos, enum isl::ast_loop_type type) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_schedule_node_band_member_set_ast_loop_type(copy(), pos, static_cast(type)); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res).as(); + return bool(res); } isl::schedule_node_band schedule_node_band::member_set_coincident(int pos, int coincident) const @@ -15147,18 +15133,6 @@ isl::schedule_node_band schedule_node_band::member_set_coincident(int pos, int c return manage(res).as(); } -isl::schedule_node_band schedule_node_band::member_set_isolate_ast_loop_type(int pos, enum isl::ast_loop_type type) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_schedule_node_band_member_set_isolate_ast_loop_type(copy(), pos, static_cast(type)); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res).as(); -} - isl::schedule_node_band schedule_node_band::mod(isl::multi_val mv) const { if (!ptr || mv.is_null()) @@ -15265,6 +15239,102 @@ isl::schedule_node_band schedule_node_band::tile(isl::multi_val sizes) const return manage(res).as(); } +isl::schedule_node_band schedule_node_band::member_set_ast_loop_default(int pos) const +{ + if (!ptr) + throw isl::exception::create(isl_error_invalid, + "NULL input", __FILE__, __LINE__); + options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + auto res = isl_schedule_node_band_member_set_ast_loop_type(copy(), pos, isl_ast_loop_default); + if (!res) + throw exception::create_from_last_error(get_ctx()); + return manage(res).as(); +} + +isl::schedule_node_band schedule_node_band::member_set_ast_loop_atomic(int pos) const +{ + if (!ptr) + throw isl::exception::create(isl_error_invalid, + "NULL input", __FILE__, __LINE__); + options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + auto res = isl_schedule_node_band_member_set_ast_loop_type(copy(), pos, isl_ast_loop_atomic); + if (!res) + throw exception::create_from_last_error(get_ctx()); + return manage(res).as(); +} + +isl::schedule_node_band schedule_node_band::member_set_ast_loop_unroll(int pos) const +{ + if (!ptr) + throw isl::exception::create(isl_error_invalid, + "NULL input", __FILE__, __LINE__); + options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + auto res = isl_schedule_node_band_member_set_ast_loop_type(copy(), pos, isl_ast_loop_unroll); + if (!res) + throw exception::create_from_last_error(get_ctx()); + return manage(res).as(); +} + +isl::schedule_node_band schedule_node_band::member_set_ast_loop_separate(int pos) const +{ + if (!ptr) + throw isl::exception::create(isl_error_invalid, + "NULL input", __FILE__, __LINE__); + options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + auto res = isl_schedule_node_band_member_set_ast_loop_type(copy(), pos, isl_ast_loop_separate); + if (!res) + throw exception::create_from_last_error(get_ctx()); + return manage(res).as(); +} + +isl::schedule_node_band schedule_node_band::member_set_isolate_ast_loop_default(int pos) const +{ + if (!ptr) + throw isl::exception::create(isl_error_invalid, + "NULL input", __FILE__, __LINE__); + options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + auto res = isl_schedule_node_band_member_set_isolate_ast_loop_type(copy(), pos, isl_ast_loop_default); + if (!res) + throw exception::create_from_last_error(get_ctx()); + return manage(res).as(); +} + +isl::schedule_node_band schedule_node_band::member_set_isolate_ast_loop_atomic(int pos) const +{ + if (!ptr) + throw isl::exception::create(isl_error_invalid, + "NULL input", __FILE__, __LINE__); + options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + auto res = isl_schedule_node_band_member_set_isolate_ast_loop_type(copy(), pos, isl_ast_loop_atomic); + if (!res) + throw exception::create_from_last_error(get_ctx()); + return manage(res).as(); +} + +isl::schedule_node_band schedule_node_band::member_set_isolate_ast_loop_unroll(int pos) const +{ + if (!ptr) + throw isl::exception::create(isl_error_invalid, + "NULL input", __FILE__, __LINE__); + options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + auto res = isl_schedule_node_band_member_set_isolate_ast_loop_type(copy(), pos, isl_ast_loop_unroll); + if (!res) + throw exception::create_from_last_error(get_ctx()); + return manage(res).as(); +} + +isl::schedule_node_band schedule_node_band::member_set_isolate_ast_loop_separate(int pos) const +{ + if (!ptr) + throw isl::exception::create(isl_error_invalid, + "NULL input", __FILE__, __LINE__); + options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + auto res = isl_schedule_node_band_member_set_isolate_ast_loop_type(copy(), pos, isl_ast_loop_separate); + if (!res) + throw exception::create_from_last_error(get_ctx()); + return manage(res).as(); +} + // implementations for isl::schedule_node_context schedule_node_context::schedule_node_context() @@ -16225,7 +16295,7 @@ bool set::has_tuple_id() const auto res = isl_set_has_tuple_id(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool set::has_tuple_name() const @@ -16237,7 +16307,7 @@ bool set::has_tuple_name() const auto res = isl_set_has_tuple_name(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } isl::map set::identity() const @@ -16285,7 +16355,7 @@ bool set::involves_param(const isl::id &id) const auto res = isl_set_involves_param_id(get(), id.get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool set::is_disjoint(const isl::set &set2) const @@ -16297,7 +16367,7 @@ bool set::is_disjoint(const isl::set &set2) const auto res = isl_set_is_disjoint(get(), set2.get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool set::is_empty() const @@ -16309,7 +16379,7 @@ bool set::is_empty() const auto res = isl_set_is_empty(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool set::is_equal(const isl::set &set2) const @@ -16321,7 +16391,7 @@ bool set::is_equal(const isl::set &set2) const auto res = isl_set_is_equal(get(), set2.get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool set::is_singleton() const @@ -16333,7 +16403,7 @@ bool set::is_singleton() const auto res = isl_set_is_singleton(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool set::is_strict_subset(const isl::set &set2) const @@ -16345,7 +16415,7 @@ bool set::is_strict_subset(const isl::set &set2) const auto res = isl_set_is_strict_subset(get(), set2.get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool set::is_subset(const isl::set &set2) const @@ -16357,7 +16427,7 @@ bool set::is_subset(const isl::set &set2) const auto res = isl_set_is_subset(get(), set2.get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool set::is_wrapping() const @@ -16369,7 +16439,7 @@ bool set::is_wrapping() const auto res = isl_set_is_wrapping(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } isl::set set::lexmax() const @@ -16484,7 +16554,7 @@ bool set::plain_is_universe() const auto res = isl_set_plain_is_universe(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } isl::basic_set set::polyhedral_hull() const @@ -17049,7 +17119,7 @@ bool space::can_curry() const auto res = isl_space_can_curry(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool space::can_uncurry() const @@ -17061,7 +17131,7 @@ bool space::can_uncurry() const auto res = isl_space_can_uncurry(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } isl::space space::curry() const @@ -17157,7 +17227,7 @@ bool space::has_equal_params(const isl::space &space2) const auto res = isl_space_has_equal_params(get(), space2.get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool space::has_equal_tuples(const isl::space &space2) const @@ -17169,7 +17239,7 @@ bool space::has_equal_tuples(const isl::space &space2) const auto res = isl_space_has_equal_tuples(get(), space2.get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool space::has_param(const isl::id &id) const @@ -17181,7 +17251,7 @@ bool space::has_param(const isl::id &id) const auto res = isl_space_has_param_id(get(), id.get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool space::is_equal(const isl::space &space2) const @@ -17193,7 +17263,7 @@ bool space::is_equal(const isl::space &space2) const auto res = isl_space_is_equal(get(), space2.get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool space::is_params() const @@ -17205,7 +17275,7 @@ bool space::is_params() const auto res = isl_space_is_params(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool space::is_set() const @@ -17217,7 +17287,7 @@ bool space::is_set() const auto res = isl_space_is_set(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool space::is_wrapping() const @@ -17229,7 +17299,7 @@ bool space::is_wrapping() const auto res = isl_space_is_wrapping(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } isl::space space::map_from_domain_and_range(isl::space range) const @@ -18401,7 +18471,7 @@ bool union_map::is_bijective() const auto res = isl_union_map_is_bijective(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool union_map::is_empty() const @@ -18413,7 +18483,7 @@ bool union_map::is_empty() const auto res = isl_union_map_is_empty(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool union_map::is_equal(const isl::union_map &umap2) const @@ -18425,7 +18495,7 @@ bool union_map::is_equal(const isl::union_map &umap2) const auto res = isl_union_map_is_equal(get(), umap2.get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool union_map::is_injective() const @@ -18437,7 +18507,7 @@ bool union_map::is_injective() const auto res = isl_union_map_is_injective(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool union_map::is_single_valued() const @@ -18449,7 +18519,7 @@ bool union_map::is_single_valued() const auto res = isl_union_map_is_single_valued(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool union_map::is_strict_subset(const isl::union_map &umap2) const @@ -18461,7 +18531,7 @@ bool union_map::is_strict_subset(const isl::union_map &umap2) const auto res = isl_union_map_is_strict_subset(get(), umap2.get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool union_map::is_subset(const isl::union_map &umap2) const @@ -18473,7 +18543,7 @@ bool union_map::is_subset(const isl::union_map &umap2) const auto res = isl_union_map_is_subset(get(), umap2.get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } isl::union_map union_map::lex_gt_at(isl::multi_union_pw_aff mupa) const @@ -19024,7 +19094,7 @@ bool union_pw_aff::involves_param(const isl::id &id) const auto res = isl_union_pw_aff_involves_param_id(get(), id.get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } isl::val union_pw_aff::max_val() const @@ -19095,7 +19165,7 @@ bool union_pw_aff::plain_is_equal(const isl::union_pw_aff &upa2) const auto res = isl_union_pw_aff_plain_is_equal(get(), upa2.get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } isl::union_pw_aff union_pw_aff::pullback(isl::union_pw_multi_aff upma) const @@ -20076,7 +20146,7 @@ bool union_set::involves_param(const isl::id &id) const auto res = isl_union_set_involves_param_id(get(), id.get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool union_set::is_disjoint(const isl::union_set &uset2) const @@ -20088,7 +20158,7 @@ bool union_set::is_disjoint(const isl::union_set &uset2) const auto res = isl_union_set_is_disjoint(get(), uset2.get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool union_set::is_empty() const @@ -20100,7 +20170,7 @@ bool union_set::is_empty() const auto res = isl_union_set_is_empty(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool union_set::is_equal(const isl::union_set &uset2) const @@ -20112,7 +20182,7 @@ bool union_set::is_equal(const isl::union_set &uset2) const auto res = isl_union_set_is_equal(get(), uset2.get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool union_set::is_params() const @@ -20124,7 +20194,7 @@ bool union_set::is_params() const auto res = isl_union_set_is_params(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool union_set::is_strict_subset(const isl::union_set &uset2) const @@ -20136,7 +20206,7 @@ bool union_set::is_strict_subset(const isl::union_set &uset2) const auto res = isl_union_set_is_strict_subset(get(), uset2.get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool union_set::is_subset(const isl::union_set &uset2) const @@ -20148,7 +20218,7 @@ bool union_set::is_subset(const isl::union_set &uset2) const auto res = isl_union_set_is_subset(get(), uset2.get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } isl::union_set union_set::lexmax() const @@ -20626,7 +20696,7 @@ bool val::abs_eq(const isl::val &v2) const auto res = isl_val_abs_eq(get(), v2.get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } isl::val val::add(isl::val v2) const @@ -20684,7 +20754,7 @@ bool val::eq(const isl::val &v2) const auto res = isl_val_eq(get(), v2.get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } isl::val val::floor() const @@ -20720,7 +20790,7 @@ bool val::ge(const isl::val &v2) const auto res = isl_val_ge(get(), v2.get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } long val::get_den_si() const @@ -20752,7 +20822,7 @@ bool val::gt(const isl::val &v2) const auto res = isl_val_gt(get(), v2.get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } isl::val val::infty(isl::ctx ctx) @@ -20785,7 +20855,7 @@ bool val::is_divisible_by(const isl::val &v2) const auto res = isl_val_is_divisible_by(get(), v2.get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool val::is_infty() const @@ -20797,7 +20867,7 @@ bool val::is_infty() const auto res = isl_val_is_infty(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool val::is_int() const @@ -20809,7 +20879,7 @@ bool val::is_int() const auto res = isl_val_is_int(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool val::is_nan() const @@ -20821,7 +20891,7 @@ bool val::is_nan() const auto res = isl_val_is_nan(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool val::is_neg() const @@ -20833,7 +20903,7 @@ bool val::is_neg() const auto res = isl_val_is_neg(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool val::is_neginfty() const @@ -20845,7 +20915,7 @@ bool val::is_neginfty() const auto res = isl_val_is_neginfty(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool val::is_negone() const @@ -20857,7 +20927,7 @@ bool val::is_negone() const auto res = isl_val_is_negone(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool val::is_nonneg() const @@ -20869,7 +20939,7 @@ bool val::is_nonneg() const auto res = isl_val_is_nonneg(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool val::is_nonpos() const @@ -20881,7 +20951,7 @@ bool val::is_nonpos() const auto res = isl_val_is_nonpos(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool val::is_one() const @@ -20893,7 +20963,7 @@ bool val::is_one() const auto res = isl_val_is_one(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool val::is_pos() const @@ -20905,7 +20975,7 @@ bool val::is_pos() const auto res = isl_val_is_pos(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool val::is_rat() const @@ -20917,7 +20987,7 @@ bool val::is_rat() const auto res = isl_val_is_rat(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool val::is_zero() const @@ -20929,7 +20999,7 @@ bool val::is_zero() const auto res = isl_val_is_zero(get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool val::le(const isl::val &v2) const @@ -20941,7 +21011,7 @@ bool val::le(const isl::val &v2) const auto res = isl_val_le(get(), v2.get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } bool val::lt(const isl::val &v2) const @@ -20953,7 +21023,7 @@ bool val::lt(const isl::val &v2) const auto res = isl_val_lt(get(), v2.get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } isl::val val::max(isl::val v2) const @@ -21022,7 +21092,7 @@ bool val::ne(const isl::val &v2) const auto res = isl_val_ne(get(), v2.get()); if (res < 0) throw exception::create_from_last_error(get_ctx()); - return res; + return bool(res); } isl::val val::neg() const diff --git a/tc/core/polyhedral/schedule_isl_conversion.cc b/tc/core/polyhedral/schedule_isl_conversion.cc index 22e1532e1..7fea8f67f 100644 --- a/tc/core/polyhedral/schedule_isl_conversion.cc +++ b/tc/core/polyhedral/schedule_isl_conversion.cc @@ -171,8 +171,7 @@ isl::schedule_node insert(isl::schedule_node node, const ScheduleTree* st) { } for (size_t i = 0; i < band->unroll_.size(); ++i) { if (band->unroll_[i]) { - bandNode = - bandNode.member_set_ast_loop_type(i, isl::ast_loop_type::unroll); + bandNode = bandNode.member_set_ast_loop_unroll(i); } } node = bandNode; diff --git a/third-party/islpp b/third-party/islpp index b12d681d1..adefea12a 160000 --- a/third-party/islpp +++ b/third-party/islpp @@ -1 +1 @@ -Subproject commit b12d681d17c1f41a893847fb711f48acc1efe3e1 +Subproject commit adefea12a80d7c1846342227d85133a10b20261e From 3a064d0949ed1ae27f3d7384781e6cb0b3080636 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Tue, 24 Jul 2018 10:03:24 +0200 Subject: [PATCH 083/152] TuningHarness::runOneIteration: use TC_CHECK_GT instead of CHECK_GT Commit 71c013c47 (Remove best options fro autotuner and always recover from cache, Mon Jul 23 05:09:48 2018 -0700) introduced a call to CHECK_GT instead of the more usual TC_CHECK_GT, without a motivation for deviating from this norm. Use TC_CHECK_GT instead and make sure no warnings get generated (needed for both TC_CHECK_GT and CHECK_GT). --- tc/autotuner/autotuner-inl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tc/autotuner/autotuner-inl.h b/tc/autotuner/autotuner-inl.h index 5922855c8..ab613068f 100644 --- a/tc/autotuner/autotuner-inl.h +++ b/tc/autotuner/autotuner-inl.h @@ -302,7 +302,7 @@ void TuningHarness::runOneIteration( makeTensorInfoVector(outputs_.begin()->second), Backend::backendString(), 1); - CHECK_GT(vBest.size(), 0); + TC_CHECK_GT(vBest.size(), 0u); infoPrinter << vBest[0]; LOG_LINE_BY_LINE(INFO, ssInfo); } From 5b6157a9bac966a78057c09878ecfef2a82a25be Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Fri, 20 Jul 2018 17:30:44 +0200 Subject: [PATCH 084/152] MappedScop::findBestSync: add missing params() call The current version of isl is fairly tolerant about the argument to intersect_params, but, in principle, it should be a parameter set. Moving to templated isl types will make this issue more evident. --- tc/core/polyhedral/cuda/mapped_scop.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tc/core/polyhedral/cuda/mapped_scop.cc b/tc/core/polyhedral/cuda/mapped_scop.cc index 273a92fd8..7a47d4b25 100644 --- a/tc/core/polyhedral/cuda/mapped_scop.cc +++ b/tc/core/polyhedral/cuda/mapped_scop.cc @@ -573,7 +573,7 @@ Scop::SyncLevel MappedScop::findBestSync( auto contextSt = scop_->scheduleRoot()->children()[0]; auto contextElem = contextSt->as(); TC_CHECK(nullptr != contextElem); - dependences = dependences.intersect_params(contextElem->context_); + dependences = dependences.intersect_params(contextElem->context_.params()); if (dependences.is_subset(dependences.eq_at(domainToThread))) { return Scop::SyncLevel::None; From 87ab5fb1cdd74a6076b6f50229016d3ec803e9f0 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Tue, 24 Jul 2018 10:40:26 +0200 Subject: [PATCH 085/152] tensorElementsSet: drop spurious range() call This method was getting called on a set space. The current version of isl tolerates such calls and simply returns the input, but it makes little sense. Moving to templated isl types will make this issue more evident. --- tc/core/polyhedral/memory_promotion.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tc/core/polyhedral/memory_promotion.cc b/tc/core/polyhedral/memory_promotion.cc index bc6fae88b..773771002 100644 --- a/tc/core/polyhedral/memory_promotion.cc +++ b/tc/core/polyhedral/memory_promotion.cc @@ -414,7 +414,7 @@ isl::set tensorElementsSet(const Scop& scop, isl::id tensorId) { space = space.add_named_tuple_id_ui(tensorId, nDim); auto tensorElements = isl::set::universe(space); - auto identity = isl::multi_aff::identity(space.range().map_from_set()); + auto identity = isl::multi_aff::identity(space.map_from_set()); for (int i = 0; i < nDim; ++i) { auto minAff = halide2isl::makeIslAffFromExpr( space, halideParameter.min_constraint(i)); From 2e0ba4368a452853289beec6e86850fd06f7f186 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Sat, 21 Jul 2018 23:24:44 +0200 Subject: [PATCH 086/152] tensorElementsSet: drop spurious params() call The space of an isl::union_set is a parameter space, so it makes little sense to obtain its parameter space, even though the current version of isl tolerates such calls. Moving to templated isl types will make this issue more evident. --- tc/core/polyhedral/memory_promotion.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tc/core/polyhedral/memory_promotion.cc b/tc/core/polyhedral/memory_promotion.cc index 773771002..c71b94018 100644 --- a/tc/core/polyhedral/memory_promotion.cc +++ b/tc/core/polyhedral/memory_promotion.cc @@ -409,7 +409,7 @@ namespace { // context of the scop. isl::set tensorElementsSet(const Scop& scop, isl::id tensorId) { auto halideParameter = scop.findArgument(tensorId).parameter(); - auto space = scop.domain().get_space().params(); + auto space = scop.domain().get_space(); auto nDim = halideParameter.dimensions(); space = space.add_named_tuple_id_ui(tensorId, nDim); From c52b574f891df878163804fb6cb087ec55a3eff4 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Tue, 24 Jul 2018 15:32:58 +0200 Subject: [PATCH 087/152] Scop::makeContext: drop spurious params() call The space of an isl::union_set is a parameter space, so it makes little sense to obtain its parameter space, even though the current version of isl tolerates such calls. Moving to templated isl types will make this issue more evident. --- tc/core/polyhedral/scop.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tc/core/polyhedral/scop.h b/tc/core/polyhedral/scop.h index d9822f895..789b70130 100644 --- a/tc/core/polyhedral/scop.h +++ b/tc/core/polyhedral/scop.h @@ -131,7 +131,7 @@ struct Scop { isl::set makeContext( const std::unordered_map& sizes = std::unordered_map()) const { - auto s = domain().get_space().params(); + auto s = domain().get_space(); return makeSpecializationSet(s, sizes); } From 1e7572d996829c23bf19e90fe358109ecf057e61 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Sat, 21 Jul 2018 22:48:37 +0200 Subject: [PATCH 088/152] halide2isl.cc: extractAccess: drop redundant cast The cast was apparently introduced because isl::aff does not currently have an "eq_map" method. However, the "eq_map" call was replaced by an "eq_set" call 8a4d9f1ed (halide2isl::extractAccesses: construct accesses in parameter space, Mon Mar 26 14:50:33 2018 +0200), which does appear as a method in isl:aff. The cast is therefore no longer needed. Explicit casts make it more difficult to switch to templated isl types. --- tc/core/halide2isl.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tc/core/halide2isl.cc b/tc/core/halide2isl.cc index a77057812..b0f6390cd 100644 --- a/tc/core/halide2isl.cc +++ b/tc/core/halide2isl.cc @@ -277,7 +277,7 @@ isl::map extractAccess( // ... equals the coordinate accessed as a function of the parameters. auto domainPoint = halide2isl::makeIslAffFromExpr(tensorSpace, args[i]); if (!domainPoint.is_null()) { - access = access.intersect(isl::pw_aff(domainPoint).eq_set(rangePoint)); + access = access.intersect(domainPoint.eq_set(rangePoint)); } } From 9ee4c338f7b98c252924a187f39deffe571662ee Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Sat, 21 Jul 2018 23:10:11 +0200 Subject: [PATCH 089/152] halide2isl.cc: extractAccess: construct expressions on parameter space Since 2ab86bb2e (makeIslAffFromExpr: only accept parametric expressions, Mon Mar 26 14:50:33 2018 +0200), makeIslAffFromExpr only constructs parametric expressions. However, it would still accept a set space as input and extractAccess continued to do so. Call it on a parameter space instead for consistency. This will make it easier to provide proper typing of makeIslAffFromExpr when switching to templated isl types. --- tc/core/CMakeLists.txt | 1 + tc/core/halide2isl.cc | 7 +++++-- tc/core/polyhedral/utils.cc | 39 +++++++++++++++++++++++++++++++++++++ tc/core/polyhedral/utils.h | 31 +++++++++++++++++++++++++++++ 4 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 tc/core/polyhedral/utils.cc create mode 100644 tc/core/polyhedral/utils.h diff --git a/tc/core/CMakeLists.txt b/tc/core/CMakeLists.txt index 46f87a197..1b77eaead 100644 --- a/tc/core/CMakeLists.txt +++ b/tc/core/CMakeLists.txt @@ -34,6 +34,7 @@ add_library( polyhedral/scop.cc polyhedral/separation.cc polyhedral/unroll.cc + polyhedral/utils.cc ) target_include_directories(tc_core PUBLIC ${LLVM_INCLUDE_DIRS}) target_link_libraries( diff --git a/tc/core/halide2isl.cc b/tc/core/halide2isl.cc index b0f6390cd..dbc7e60f2 100644 --- a/tc/core/halide2isl.cc +++ b/tc/core/halide2isl.cc @@ -24,6 +24,7 @@ #include "tc/core/polyhedral/schedule_isl_conversion.h" #include "tc/core/polyhedral/schedule_transforms.h" #include "tc/core/polyhedral/schedule_tree.h" +#include "tc/core/polyhedral/utils.h" #include "tc/core/tc2halide.h" namespace tc { @@ -259,7 +260,8 @@ isl::map extractAccess( isl::space paramSpace = domain.paramSpace; isl::id tensorID(paramSpace.get_ctx(), tensor); - auto tensorSpace = paramSpace.add_named_tuple_id_ui(tensorID, args.size()); + auto tensorTuple = constructTensorTuple(paramSpace, tensorID, args.size()); + auto tensorSpace = tensorTuple.get_space(); // Start with a totally unconstrained set - every point in // the allocation could be accessed. @@ -275,8 +277,9 @@ isl::map extractAccess( // The coordinate written to in the range ... auto rangePoint = identity.get_aff(i); // ... equals the coordinate accessed as a function of the parameters. - auto domainPoint = halide2isl::makeIslAffFromExpr(tensorSpace, args[i]); + auto domainPoint = halide2isl::makeIslAffFromExpr(paramSpace, args[i]); if (!domainPoint.is_null()) { + domainPoint = domainPoint.unbind_params_insert_domain(tensorTuple); access = access.intersect(domainPoint.eq_set(rangePoint)); } } diff --git a/tc/core/polyhedral/utils.cc b/tc/core/polyhedral/utils.cc new file mode 100644 index 000000000..80cf11f78 --- /dev/null +++ b/tc/core/polyhedral/utils.cc @@ -0,0 +1,39 @@ +/** + * Copyright (c) 2018, Facebook, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "tc/core/polyhedral/utils.h" + +namespace tc { +namespace polyhedral { + +/* Construct a tuple representing the tensor with identifier "tensorId" and + * dimension "dim" from the parameter space "paramSpace", + * without any specific names for the indices, from the perspective + * of the user. + * Since some names are required, use names of the form "__tc_tensor_arg*". + */ +isl::multi_id +constructTensorTuple(isl::space paramSpace, isl::id tensorId, size_t dim) { + auto tensorSpace = paramSpace.add_named_tuple_id_ui(tensorId, dim); + isl::id_list tensorArgs(paramSpace.get_ctx(), 0); + for (size_t i = 0; i < dim; ++i) { + auto name = std::string("__tc_tensor_arg") + std::to_string(i); + tensorArgs = tensorArgs.add(isl::id(paramSpace.get_ctx(), name)); + } + return isl::multi_id(tensorSpace, tensorArgs); +} + +} // namespace polyhedral +} // namespace tc diff --git a/tc/core/polyhedral/utils.h b/tc/core/polyhedral/utils.h new file mode 100644 index 000000000..459bca648 --- /dev/null +++ b/tc/core/polyhedral/utils.h @@ -0,0 +1,31 @@ +/** + * Copyright (c) 2018, Facebook, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#pragma once + +#include "tc/external/isl.h" + +namespace tc { +namespace polyhedral { + +/* Construct a tuple representing the tensor with identifier "tensorId" and + * dimension "dim" from the parameter space "paramSpace", + * without any specific names for the indices. + */ +isl::multi_id +constructTensorTuple(isl::space paramSpace, isl::id tensorId, size_t dim); + +} // namespace polyhedral +} // namespace tc From 84ec837702b38f6c8e86d8481eb86ba7c1f7adb2 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Tue, 24 Jul 2018 10:50:27 +0200 Subject: [PATCH 090/152] tensorElementsSet: construct expressions on parameter space Since 2ab86bb2e (makeIslAffFromExpr: only accept parametric expressions, Mon Mar 26 14:50:33 2018 +0200), makeIslAffFromExpr only constructs parametric expressions. However, it would still accept a set space as input and tensorElementsSet continued to do so. Call it on a parameter space instead for consistency. This will make it easier to provide proper typing of makeIslAffFromExpr when switching to templated isl types. --- tc/core/polyhedral/memory_promotion.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tc/core/polyhedral/memory_promotion.cc b/tc/core/polyhedral/memory_promotion.cc index c71b94018..d7d1801c4 100644 --- a/tc/core/polyhedral/memory_promotion.cc +++ b/tc/core/polyhedral/memory_promotion.cc @@ -25,6 +25,7 @@ #include "tc/core/polyhedral/exceptions.h" #include "tc/core/polyhedral/schedule_tree.h" #include "tc/core/polyhedral/scop.h" +#include "tc/core/polyhedral/utils.h" #include "tc/external/isl.h" namespace tc { @@ -411,15 +412,18 @@ isl::set tensorElementsSet(const Scop& scop, isl::id tensorId) { auto halideParameter = scop.findArgument(tensorId).parameter(); auto space = scop.domain().get_space(); auto nDim = halideParameter.dimensions(); - space = space.add_named_tuple_id_ui(tensorId, nDim); + auto tensorTuple = constructTensorTuple(space, tensorId, nDim); + auto tensorSpace = tensorTuple.get_space(); - auto tensorElements = isl::set::universe(space); - auto identity = isl::multi_aff::identity(space.map_from_set()); + auto tensorElements = isl::set::universe(tensorSpace); + auto identity = isl::multi_aff::identity(tensorSpace.map_from_set()); for (int i = 0; i < nDim; ++i) { auto minAff = halide2isl::makeIslAffFromExpr( space, halideParameter.min_constraint(i)); auto extentAff = halide2isl::makeIslAffFromExpr( space, halideParameter.extent_constraint(i)); + minAff = minAff.unbind_params_insert_domain(tensorTuple); + extentAff = extentAff.unbind_params_insert_domain(tensorTuple); auto aff = identity.get_aff(i); tensorElements = tensorElements & (minAff <= isl::aff_set(aff)) & (isl::aff_set(aff) < (minAff + extentAff)); From fc8f5fb1212a7db72481c07a3e78036fa1174789 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Fri, 20 Jul 2018 15:40:57 +0200 Subject: [PATCH 091/152] generalize operator&(isl::*, isl::*) to template form This will ensure that it also applies to templated isl types. --- tc/external/detail/islpp-inl.h | 8 -------- tc/external/detail/islpp.h | 7 +++++-- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/tc/external/detail/islpp-inl.h b/tc/external/detail/islpp-inl.h index a6c621945..6f7de5003 100644 --- a/tc/external/detail/islpp-inl.h +++ b/tc/external/detail/islpp-inl.h @@ -195,10 +195,6 @@ inline isl::multi_aff operator/(isl::multi_aff left, isl::multi_val right) { /////////////////////////////////////////////////////////////////////////////// // Operations on isl::set and isl::union_set /////////////////////////////////////////////////////////////////////////////// -inline isl::set operator&(isl::set S1, isl::set S2) { - return S1.intersect(S2); -} - inline isl::union_set operator&(isl::union_set S1, isl::set S2) { return S1.intersect(isl::union_set(S2)); } @@ -207,10 +203,6 @@ inline isl::union_set operator&(isl::set S1, isl::union_set S2) { return S2 & S1; } -inline isl::union_set operator&(isl::union_set S1, isl::union_set S2) { - return S1.intersect(S2); -} - /////////////////////////////////////////////////////////////////////////////// // Operations on isl::set and isl::point /////////////////////////////////////////////////////////////////////////////// diff --git a/tc/external/detail/islpp.h b/tc/external/detail/islpp.h index 71dd2c793..c4228f979 100644 --- a/tc/external/detail/islpp.h +++ b/tc/external/detail/islpp.h @@ -40,6 +40,11 @@ inline T operator-(T a, T b) { return a.sub(b); } +template +inline T operator&(T S1, T S2) { + return S1.intersect(S2); +} + inline isl::val operator*(isl::val l, isl::val r) { return l.mul(r); } @@ -184,10 +189,8 @@ isl::multi_aff operator/(isl::multi_aff left, isl::multi_val right); /////////////////////////////////////////////////////////////////////////////// // Operations on isl::set and isl::union_set /////////////////////////////////////////////////////////////////////////////// -isl::set operator&(isl::set S1, isl::set S2); isl::union_set operator&(isl::union_set S1, isl::set S2); isl::union_set operator&(isl::set S1, isl::union_set S2); -isl::union_set operator&(isl::union_set S1, isl::union_set S2); /////////////////////////////////////////////////////////////////////////////// // Operations on isl::set and isl::point From 7e848598868b8e45cdbaf1aa53417df0c8898471 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Tue, 24 Jul 2018 12:51:08 +0200 Subject: [PATCH 092/152] generalize operator+(isl::*, isl::*) to template form This will ensure that it also applies to templated isl types. --- tc/external/detail/islpp-inl.h | 4 ---- tc/external/detail/islpp.h | 10 +++++----- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/tc/external/detail/islpp-inl.h b/tc/external/detail/islpp-inl.h index 6f7de5003..595514ca1 100644 --- a/tc/external/detail/islpp-inl.h +++ b/tc/external/detail/islpp-inl.h @@ -55,10 +55,6 @@ inline isl::aff operator+(isl::val v, isl::aff A) { return A + v; } -inline isl::aff operator+(isl::aff A, isl::aff B) { - return A.add(B); -} - inline isl::aff operator+(isl::aff A, int i) { return i + A; } diff --git a/tc/external/detail/islpp.h b/tc/external/detail/islpp.h index c4228f979..2d7dc1f34 100644 --- a/tc/external/detail/islpp.h +++ b/tc/external/detail/islpp.h @@ -35,6 +35,11 @@ namespace isl { // the official ISL C++ bindings. // +template +inline T operator+(T a, T b) { + return a.add(b); +} + template inline T operator-(T a, T b) { return a.sub(b); @@ -57,10 +62,6 @@ inline isl::val operator*(long i, isl::val v) { return v * i; } -inline isl::val operator+(isl::val l, isl::val r) { - return l.add(r); -} - inline isl::val operator+(isl::val v, long i) { return v.add(isl::val(v.get_ctx(), i)); } @@ -128,7 +129,6 @@ isl::aff operator*(isl::val V, isl::aff A); isl::aff operator/(isl::aff A, int i); isl::aff operator+(int i, isl::aff A); -isl::aff operator+(isl::aff A, isl::aff B); isl::aff operator+(isl::aff A, int i); isl::aff operator+(isl::aff A, isl::val v); isl::aff operator+(isl::val v, isl::aff A); From 255e2518cdbfa5bf78c6d0e58e345152a597cb11 Mon Sep 17 00:00:00 2001 From: Nicolas Vasilache Date: Mon, 23 Jul 2018 06:53:54 -0700 Subject: [PATCH 093/152] Make insertion points explicit in LLVM IR The usage of GetInsertBlock / SetInsertBlock creates a lot of implicit state that is hard to track. For simple structured control flow like we have it is very easy to do with significantly less surprising behavior. This commit kills implicit behavior with fire and forces the passing of insertion points. Insertion points are enforced at the beginning of each private API emit* method. --- tc/core/polyhedral/codegen_llvm.cc | 92 ++++++++++++++++-------------- 1 file changed, 50 insertions(+), 42 deletions(-) diff --git a/tc/core/polyhedral/codegen_llvm.cc b/tc/core/polyhedral/codegen_llvm.cc index 775831200..4e9e264e1 100644 --- a/tc/core/polyhedral/codegen_llvm.cc +++ b/tc/core/polyhedral/codegen_llvm.cc @@ -340,7 +340,7 @@ class LLVMCodegen { // This creates a signature of the form: // input_data_types, output_data_types, parameters - void createSignature( + llvm::BasicBlock* createSignature( const std::vector& inputs, const std::vector& outputs, const std::vector& params, @@ -383,40 +383,37 @@ class LLVMCodegen { it->addAttr(llvm::Attribute::ReadOnly); } - auto entryBB_ = llvm::BasicBlock::Create(llvmCtx, "entry", function); - halide_cg.get_builder().SetInsertPoint(entryBB_); + return llvm::BasicBlock::Create(llvmCtx, "entry", function); } - void CodeGen(isl::ast_node node) { - emitAst(node); - halide_cg.get_builder().CreateRetVoid(); - - if (llvm::verifyModule(*halide_cg.get_module())) { - LOG(ERROR) << str(); - llvm::verifyModule(*halide_cg.get_module(), &llvm::outs()); - throw std::runtime_error("LLVM generated module is invalid."); - } - } - - llvm::BasicBlock* emitAst(isl::ast_node node) { + // This is the main entry point to emit pieces of LLVM IR + // LLVM IR insertion is stateful, configured by SetInsertPoint + // We make this an explicit parameter to avoid implicit conventions + // All TC IR builder methods take an explicit insertionPoint. + // The invariant in all emit* (except for emitAst) is that: + // TC_CHECK_EQ(halide_cg.get_builder().GetInsertBlock(), insertionPoint); + llvm::BasicBlock* emitAst( + isl::ast_node node, + llvm::BasicBlock* insertionPoint) { + halide_cg.get_builder().SetInsertPoint(insertionPoint); if (auto forNode = node.as()) { - return emitFor(forNode); + return emitFor(forNode, insertionPoint); } else if (auto userNode = node.as()) { - return emitStmt(userNode); + return emitStmt(userNode, insertionPoint); } else if (auto blockNode = node.as()) { - llvm::BasicBlock* curBB; + llvm::BasicBlock* curBB = insertionPoint; for (auto child : blockNode.get_children()) { - curBB = emitAst(child); + curBB = emitAst(child, curBB); } return curBB; } else { if (auto cond = node.as()) { - return emitIf(cond); + return emitIf(cond, insertionPoint); } else { LOG(FATAL) << "NYI " << node << std::endl; } - return static_cast(nullptr); // avoid warning } + return nullptr; } private: @@ -432,18 +429,19 @@ class LLVMCodegen { return arrTy->getPointerTo(); } - llvm::BasicBlock* emitIf(isl::ast_node_if node) { - auto* incoming = halide_cg.get_builder().GetInsertBlock(); - auto* function = incoming->getParent(); + llvm::BasicBlock* emitIf( + isl::ast_node_if node, + llvm::BasicBlock* insertionPoint) { + TC_CHECK_EQ(halide_cg.get_builder().GetInsertBlock(), insertionPoint); + auto* function = insertionPoint->getParent(); llvm::Value* condVal = halide_cg.codegen(node.get_cond()); auto* thenBB = llvm::BasicBlock::Create(llvmCtx, "then", function); // Recursively emit "then" in a new thenBB - halide_cg.get_builder().SetInsertPoint(thenBB); - auto innerBB = emitAst(node.get_then()); + auto innerBB = emitAst(node.get_then(), thenBB); // outer -> thenBB - halide_cg.get_builder().SetInsertPoint(incoming); + halide_cg.get_builder().SetInsertPoint(insertionPoint); // outer ---------> if_exit // TODO: When we support "else", go to elseBB instead of exit auto* exit = llvm::BasicBlock::Create(llvmCtx, "if_exit", function); @@ -456,17 +454,17 @@ class LLVMCodegen { // Else is often empty in the absence of full tile extraction if (node.has_else()) { LOG(FATAL) << "NYI: else conditional branch"; - return halide_cg.get_builder().GetInsertBlock(); + return exit; } - // Set the insertion point to if_exit - halide_cg.get_builder().SetInsertPoint(exit); - return halide_cg.get_builder().GetInsertBlock(); + return exit; } - llvm::BasicBlock* emitFor(isl::ast_node_for node) { - auto* incoming = halide_cg.get_builder().GetInsertBlock(); - auto* function = incoming->getParent(); + llvm::BasicBlock* emitFor( + isl::ast_node_for node, + llvm::BasicBlock* insertionPoint) { + TC_CHECK_EQ(halide_cg.get_builder().GetInsertBlock(), insertionPoint); + auto* function = insertionPoint->getParent(); auto* headerBB = llvm::BasicBlock::Create(llvmCtx, "loop_header", function); auto* loopBodyBB = llvm::BasicBlock::Create(llvmCtx, "loop_body", function); auto* loopLatchBB = @@ -485,7 +483,7 @@ class LLVMCodegen { phi = halide_cg.get_builder().CreatePHI( initVal->getType(), 2, iterator.get_name()); halide_cg.sym_push(iterator.get_name(), phi); - phi->addIncoming(initVal, incoming); + phi->addIncoming(initVal, insertionPoint); auto cond = halide_cg.codegen(node.get_cond()); halide_cg.get_builder().CreateCondBr(cond, loopBodyBB, loopExitBB); @@ -493,8 +491,7 @@ class LLVMCodegen { // Create Body { - halide_cg.get_builder().SetInsertPoint(loopBodyBB); - auto* currentBB = emitAst(node.get_body()); + auto* currentBB = emitAst(node.get_body(), loopBodyBB); halide_cg.get_builder().SetInsertPoint(currentBB); halide_cg.get_builder().CreateBr(loopLatchBB); } @@ -508,12 +505,14 @@ class LLVMCodegen { halide_cg.get_builder().CreateBr(headerBB); } - halide_cg.get_builder().SetInsertPoint(loopExitBB); halide_cg.sym_pop(iterator.get_name()); - return halide_cg.get_builder().GetInsertBlock(); + return loopExitBB; } - llvm::BasicBlock* emitStmt(isl::ast_node_user node) { + llvm::BasicBlock* emitStmt( + isl::ast_node_user node, + llvm::BasicBlock* insertionPoint) { + TC_CHECK_EQ(halide_cg.get_builder().GetInsertBlock(), insertionPoint); isl::ast_expr_op usrExp = node.get_expr().as(); auto id = usrExp.get_arg(0).as().get_id(); auto provide = scop_.halide.statements.at(id); @@ -535,6 +534,9 @@ class LLVMCodegen { llvm::Value* rhs = halide_cg.codegen(op->values[0]); halide_cg.get_builder().CreateStore(rhs, destAddr); + // We must return halide_cg.get_builder().GetInsertBlock() because + // Halide does not adhere to our conventions and when it emits multiple + // blocks things may go haywire. return halide_cg.get_builder().GetInsertBlock(); } @@ -625,12 +627,18 @@ std::unique_ptr emitLLVMKernel( cg.halide_cg.get_module()->setDataLayout(dataLayout); cg.halide_cg.get_module()->setTargetTriple( llvm::EngineBuilder().selectTarget()->getTargetTriple().str()); - cg.createSignature( + auto entry = cg.createSignature( scop.halide.inputs, scop.halide.outputs, scop.halide.params, specializedName); - cg.CodeGen(islCg.astNode); + auto exit = cg.emitAst(islCg.astNode, entry); + cg.halide_cg.get_builder().SetInsertPoint(exit); + cg.halide_cg.get_builder().CreateRetVoid(); + + TC_CHECK(!llvm::verifyModule(*cg.halide_cg.get_module())) + << "LLVM generated module is invalid." << cg.str().c_str(); + cg.halide_cg.optimize_module(); return cg.halide_cg.move_module(); } From 5e425accd730a1abe502b8c9bb8c8ef21d697080 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Tue, 24 Jul 2018 17:51:55 +0200 Subject: [PATCH 094/152] operator+(int i, isl::aff A): call isl::aff:add_constant_si There is no need to create an extra isl::val object here. --- tc/external/detail/islpp-inl.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tc/external/detail/islpp-inl.h b/tc/external/detail/islpp-inl.h index 595514ca1..937e1a8fd 100644 --- a/tc/external/detail/islpp-inl.h +++ b/tc/external/detail/islpp-inl.h @@ -42,8 +42,7 @@ inline isl::aff operator/(isl::aff A, int i) { } inline isl::aff operator+(int i, isl::aff A) { - isl::ctx ctx = A.get_ctx(); - return A + isl::val(ctx, i); + return A.add_constant_si(i); } inline isl::aff operator+(isl::aff A, isl::val v) { From 9904d301768560c569a98237ea22a2c47b489ded Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Tue, 24 Jul 2018 17:45:43 +0200 Subject: [PATCH 095/152] generalize operator+(int i, T A) to template form This will ensure that it also applies to templated isl types derived from isl::aff. --- tc/external/detail/islpp-inl.h | 3 ++- tc/external/detail/islpp.h | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tc/external/detail/islpp-inl.h b/tc/external/detail/islpp-inl.h index 937e1a8fd..6991d257a 100644 --- a/tc/external/detail/islpp-inl.h +++ b/tc/external/detail/islpp-inl.h @@ -41,7 +41,8 @@ inline isl::aff operator/(isl::aff A, int i) { return A.scale_down(isl::val(A.get_ctx(), i)); } -inline isl::aff operator+(int i, isl::aff A) { +template +inline isl::aff operator+(int i, T A) { return A.add_constant_si(i); } diff --git a/tc/external/detail/islpp.h b/tc/external/detail/islpp.h index 2d7dc1f34..96fa168ff 100644 --- a/tc/external/detail/islpp.h +++ b/tc/external/detail/islpp.h @@ -128,7 +128,6 @@ isl::aff operator*(isl::val V, isl::aff A); isl::aff operator/(isl::aff A, int i); -isl::aff operator+(int i, isl::aff A); isl::aff operator+(isl::aff A, int i); isl::aff operator+(isl::aff A, isl::val v); isl::aff operator+(isl::val v, isl::aff A); From 288fcdcffe87b82008813c061204b51f6dc2bf0a Mon Sep 17 00:00:00 2001 From: Oleksandr Zinenko Date: Tue, 24 Jul 2018 11:10:34 +0200 Subject: [PATCH 096/152] Introduce CompilerOptions This class intends to collect TC flow options in a single object that can be passed around, instead of (re)setting flags. The latter are essentially global variables that may or may not be initialized from command-line arguments. Start populating the CompilerOptions class with the new "emitWarnings" option that would otherwise become a flag. In future, the use of flags must be restricted to files that produce binaries, e.g., those containing the main() function and having explicit access to command-line arguments. CompilerOptions is located in the new "tc/utils" directory as it needs to be accessed by both tc_lang and tc_core libraries. Because it's header-only, there is not need to build it into a separate library and link. In future, other TC-generic headers, for example tc/core/check.h, should move to tc/utils as well. --- tc/utils/compiler_options.h | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 tc/utils/compiler_options.h diff --git a/tc/utils/compiler_options.h b/tc/utils/compiler_options.h new file mode 100644 index 000000000..f0a61d759 --- /dev/null +++ b/tc/utils/compiler_options.h @@ -0,0 +1,37 @@ +/** + * Copyright (c) 2018-present, Facebook, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#pragma once + +namespace tc { + +/// Container class for TC compiler options. +/// Unlike MappingOptions, these do not affect the behavior of the polyhedral +/// mapper but the general flow of the TC compilation, for example whether +/// syntax warnings should be generated when parsing TC definitions. +/// +/// This class intends to replace the uses of flags (aka global variables) +/// scattered around the codebae. +class CompilerOptions { + public: + /// Explicitly-default constructor. All member variables must have a default + /// assigned value. + CompilerOptions() = default; + + /// Print syntactic warnings. + bool emitWarnings = true; +}; + +} // namespace tc From 54ed7a6d3e7bd4e60981ec3e5cbe3fe81c8b5f30 Mon Sep 17 00:00:00 2001 From: Oleksandr Zinenko Date: Tue, 24 Jul 2018 11:20:52 +0200 Subject: [PATCH 097/152] lang/error_report: use CompilerOptions to control the warning emission Add an extra argument to the "warn" function to accept CompilerOptions that specify if the warnings should be emitted. Use default-constructed CompilerOptions (with emitWarnings==true) as the default value of that argument for compatibility. --- tc/lang/error_report.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tc/lang/error_report.h b/tc/lang/error_report.h index c710eb965..d7864fa60 100644 --- a/tc/lang/error_report.h +++ b/tc/lang/error_report.h @@ -16,6 +16,7 @@ #pragma once #include "tc/lang/tree.h" +#include "tc/utils/compiler_options.h" namespace lang { @@ -42,8 +43,12 @@ struct ErrorReport : public std::exception { mutable std::string the_message; }; -inline void warn(const ErrorReport& err) { - std::cerr << "WARNING: " << err.what(); +inline void warn( + const ErrorReport& err, + const tc::CompilerOptions& compilerOptions = tc::CompilerOptions()) { + if (compilerOptions.emitWarnings) { + std::cerr << "WARNING: " << err.what(); + } } template From b13de92facc34c5958822c8c35941cdbf132cd34 Mon Sep 17 00:00:00 2001 From: Oleksandr Zinenko Date: Tue, 24 Jul 2018 13:34:34 +0200 Subject: [PATCH 098/152] Compiler API: properly put TreeRef-based compile into detail namespace The original implementation of the compiler API in 226797f25 ([C++ API] Step 2: add the new compiler files, Thu Apr 26 09:03:17 2018 -0600) created two versions of "compile" call. One of them takes a TC parse tree (as TreeRef) as an argument and was supposed to reserved for internal use via the "tc::detail" namespace. However, only the forward declaration of this function in compiler.h was put into "tc::detail" namespace while it's definition in compiler-inl.h was not in the namespace, making the declaration essentially useless. In particular, default values for arguments in that declaration would have been ignored. Put the definition of the function into "tc::detail" namespace. Update the call sites to explicitly refer to the "detail" namespace. --- tc/autotuner/autotuner-inl.h | 4 ++-- tc/core/compiler-inl.h | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tc/autotuner/autotuner-inl.h b/tc/autotuner/autotuner-inl.h index ab613068f..37fe26e2c 100644 --- a/tc/autotuner/autotuner-inl.h +++ b/tc/autotuner/autotuner-inl.h @@ -92,8 +92,8 @@ void TuningHarness::doCompile(SearchStrategy& searchStrategy) { LOG(INFO) << "[COMPILE] Start compilation @:" << current; LOG_LINE_BY_LINE(INFO, ssInfo); } - pExecutor = - tc::compile(tcTree_, inputs_.begin()->second, options); + pExecutor = tc::detail::compile( + tcTree_, inputs_.begin()->second, options); LOG_IF(INFO, FLAGS_debug_tuner) << "[COMPILE] Done compilation"; } catch (const std::exception& e) { LOG(WARNING) << "[TUNER][COMPILE] failed compilation: " << e.what(); diff --git a/tc/core/compiler-inl.h b/tc/core/compiler-inl.h index 40dd53e2f..0031e2555 100644 --- a/tc/core/compiler-inl.h +++ b/tc/core/compiler-inl.h @@ -41,9 +41,10 @@ std::unique_ptr compile( auto parsedTcs = detail::parse(tc); TC_CHECK_EQ(parsedTcs.count(entryPoint), 1u) << "attempting to access undefined function " << entryPoint; - return compile(parsedTcs[entryPoint], inputs, options); + return detail::compile(parsedTcs[entryPoint], inputs, options); } +namespace detail { template std::unique_ptr compile( lang::TreeRef tcDefinition, @@ -69,4 +70,5 @@ std::unique_ptr compile( new typename Backend::ExecutorType( inputsInfo, outputsInfo, halideComponents, compilationResult)); } +} // namespace detail } // namespace tc From 207ea4bc2bba32d0a056cb6ab00404f3717a3988 Mon Sep 17 00:00:00 2001 From: Oleksandr Zinenko Date: Tue, 24 Jul 2018 13:43:33 +0200 Subject: [PATCH 099/152] tc2halide: put throwWarnings in CompilerOptions and use the latter Most functions in the tc2halide namespace take a boolean argument that controls whether the conversion warnings should be treated as exceptions. Move this flag to CompilerOptions and pass these options instead. Propagate the options to Scop::makeScop calls used only in tests. --- tc/aten/aten_compiler.h | 1 + tc/core/compiler-inl.h | 4 +-- tc/core/compiler.cc | 5 +++- tc/core/polyhedral/scop.cc | 15 ++++++++--- tc/core/polyhedral/scop.h | 9 +++++-- tc/core/tc2halide.cc | 33 ++++++++++++++--------- tc/core/tc2halide.h | 15 +++++++---- tc/utils/compiler_options.h | 2 ++ test/test_core.cc | 9 ++++--- test/test_cuda_mapper.cc | 2 +- test/test_cuda_mapper_memory_promotion.cc | 2 +- test/test_inference.cc | 7 +++-- test/test_tc2halide.cc | 4 +-- 13 files changed, 71 insertions(+), 37 deletions(-) diff --git a/tc/aten/aten_compiler.h b/tc/aten/aten_compiler.h index 724fb8b28..d999f7a1c 100644 --- a/tc/aten/aten_compiler.h +++ b/tc/aten/aten_compiler.h @@ -22,6 +22,7 @@ #include "tc/aten/aten.h" #include "tc/core/tensor.h" #include "tc/core/utils/time.h" +#include "tc/utils/compiler_options.h" namespace tc { namespace aten { diff --git a/tc/core/compiler-inl.h b/tc/core/compiler-inl.h index 0031e2555..be88b662a 100644 --- a/tc/core/compiler-inl.h +++ b/tc/core/compiler-inl.h @@ -55,8 +55,8 @@ std::unique_ptr compile( auto inputsInfo = makeTensorInfoVector(inputs); auto outputsInfo = detail::inferOutputTensorInfo(tcDefinition, inputs); - auto halideComponents = - tc2halide::translate(isl::with_exceptions::globalIslCtx(), tcDefinition); + auto halideComponents = tc2halide::translate( + isl::with_exceptions::globalIslCtx(), tcDefinition, CompilerOptions()); detail::checkInputsCompliant(halideComponents, inputs); auto tcName = lang::Def(tcDefinition).name().name(); diff --git a/tc/core/compiler.cc b/tc/core/compiler.cc index 2e9a3e868..a4ef1b27b 100644 --- a/tc/core/compiler.cc +++ b/tc/core/compiler.cc @@ -103,7 +103,10 @@ std::vector inferOutputTensorInfo( lang::TreeRef tcDefinition, const std::vector inputs) { return tc::inferOutputTensorInfo( - tc2halide::translate(isl::with_exceptions::globalIslCtx(), tcDefinition), + tc2halide::translate( + isl::with_exceptions::globalIslCtx(), + tcDefinition, + CompilerOptions()), inputs); } diff --git a/tc/core/polyhedral/scop.cc b/tc/core/polyhedral/scop.cc index 72be9bd4e..71d3bc176 100644 --- a/tc/core/polyhedral/scop.cc +++ b/tc/core/polyhedral/scop.cc @@ -34,6 +34,7 @@ #include "tc/core/polyhedral/schedule_utils.h" #include "tc/core/scope_guard.h" #include "tc/core/tc2halide.h" +#include "tc/utils/compiler_options.h" using namespace std; @@ -69,12 +70,18 @@ ScopUPtr Scop::makeScop( return scop; } -ScopUPtr Scop::makeScop(isl::ctx ctx, const string& tc) { - return makeScop(ctx, tc2halide::translate(ctx, tc)); +ScopUPtr Scop::makeScop( + isl::ctx ctx, + const string& tc, + const CompilerOptions& compilerOptions) { + return makeScop(ctx, tc2halide::translate(ctx, tc, compilerOptions)); } -ScopUPtr Scop::makeScop(isl::ctx ctx, const lang::TreeRef& treeRef) { - return makeScop(ctx, tc2halide::translate(ctx, treeRef)); +ScopUPtr Scop::makeScop( + isl::ctx ctx, + const lang::TreeRef& treeRef, + const CompilerOptions& compilerOptions) { + return makeScop(ctx, tc2halide::translate(ctx, treeRef, compilerOptions)); } isl::union_set& Scop::domainRef() { diff --git a/tc/core/polyhedral/scop.h b/tc/core/polyhedral/scop.h index d9822f895..1f9664171 100644 --- a/tc/core/polyhedral/scop.h +++ b/tc/core/polyhedral/scop.h @@ -32,6 +32,7 @@ #include "tc/core/tc2halide.h" #include "tc/core/tensor.h" #include "tc/external/isl.h" +#include "tc/utils/compiler_options.h" namespace tc { namespace polyhedral { @@ -56,11 +57,15 @@ struct Scop { // Halide IR is constructed and made a member by setting halideComponents. // These operations are grouped and scheduled in a halide::Stmt which becomes // the unit from which the scop is constructed. - static std::unique_ptr makeScop(isl::ctx ctx, const std::string& tc); + static std::unique_ptr makeScop( + isl::ctx ctx, + const std::string& tc, + const CompilerOptions& compilerOptions = CompilerOptions()); static std::unique_ptr makeScop( isl::ctx ctx, - const lang::TreeRef& treeRef); + const lang::TreeRef& treeRef, + const CompilerOptions& compilerOptions = CompilerOptions()); // Clone a Scop static std::unique_ptr makeScop(const Scop& scop) { diff --git a/tc/core/tc2halide.cc b/tc/core/tc2halide.cc index 379add821..dc25926f9 100644 --- a/tc/core/tc2halide.cc +++ b/tc/core/tc2halide.cc @@ -20,6 +20,7 @@ #include "tc/core/tc2halide.h" #include "tc/lang/parser.h" #include "tc/lang/sema.h" +#include "tc/utils/compiler_options.h" namespace tc2halide { @@ -270,7 +271,7 @@ void forwardBoundsInference( const std::vector& exprs, const FunctionBounds& bounds, const lang::TreeRef& comprehension, - bool throwWarnings, + const tc::CompilerOptions& compilerOptions, Scope* solution) { class CreateConstraints : public IRVisitor { using IRVisitor::visit; @@ -488,10 +489,10 @@ void forwardBoundsInference( lang::ErrorReport err(comprehension); err << "Required precondition will not be checked at runtime: " << remaining; - if (throwWarnings) { + if (compilerOptions.throwWarnings) { throw err; } else { - warn(err); + warn(err, compilerOptions); } } } @@ -509,7 +510,7 @@ Expr reductionUpdate(Expr e) { void translateComprehension( const lang::Comprehension& comprehension, const map& params, - bool throwWarnings, + const tc::CompilerOptions& compilerOptions, map* funcs, FunctionBounds* bounds) { Function f; @@ -670,7 +671,7 @@ void translateComprehension( // Infer the rest all_exprs.push_back(rhs); forwardBoundsInference( - all_exprs, *bounds, comprehension, throwWarnings, &solution); + all_exprs, *bounds, comprehension, compilerOptions, &solution); // TODO: What if subsequent updates have incompatible bounds // (e.g. an in-place stencil)?. The .bound directive will use the @@ -754,7 +755,9 @@ void translateComprehension( } // Translate a semantically checked TC def to HalideComponents struct. -HalideComponents translateDef(const lang::Def& def, bool throwWarnings) { +HalideComponents translateDef( + const lang::Def& def, + const tc::CompilerOptions& compilerOptions) { map funcs; HalideComponents components; components.def = def; @@ -765,7 +768,7 @@ HalideComponents translateDef(const lang::Def& def, bool throwWarnings) { } for (auto c : def.statements()) { translateComprehension( - c, components.params, throwWarnings, &funcs, &bounds); + c, components.params, compilerOptions, &funcs, &bounds); } vector outputs; for (auto p : def.returns()) { @@ -906,19 +909,23 @@ HalideComponents translateDef(const lang::Def& def, bool throwWarnings) { } } // namespace -HalideComponents -translate(isl::ctx ctx, const lang::TreeRef& treeRef, bool throwWarnings) { +HalideComponents translate( + isl::ctx ctx, + const lang::TreeRef& treeRef, + const tc::CompilerOptions& compilerOptions = tc::CompilerOptions()) { LOG_IF(INFO, tc::FLAGS_debug_halide) << treeRef; return translateDef( - lang::Def(lang::Sema().checkFunction(treeRef)), throwWarnings); + lang::Def(lang::Sema().checkFunction(treeRef)), compilerOptions); } // NOTE: there is no guarantee here that the tc string has only one def. It // could have many defs. Only first def will be converted in that case. -HalideComponents -translate(isl::ctx ctx, const std::string& tc, bool throwWarnings) { +HalideComponents translate( + isl::ctx ctx, + const std::string& tc, + const tc::CompilerOptions& compilerOptions = tc::CompilerOptions()) { LOG_IF(INFO, tc::FLAGS_debug_halide) << tc; - return translate(ctx, lang::Parser(tc).parseFunction(), throwWarnings); + return translate(ctx, lang::Parser(tc).parseFunction(), compilerOptions); } } // namespace tc2halide diff --git a/tc/core/tc2halide.h b/tc/core/tc2halide.h index aab822072..02eb24442 100644 --- a/tc/core/tc2halide.h +++ b/tc/core/tc2halide.h @@ -20,6 +20,7 @@ #include "tc/external/isl.h" #include "tc/lang/tree.h" #include "tc/lang/tree_views.h" +#include "tc/utils/compiler_options.h" namespace tc2halide { @@ -44,15 +45,19 @@ struct HalideComponents { Halide::Internal::Call::ConstString kReductionUpdate = "ReductionUpdate"; // Translate a TC parse tree into equivalent Halide imperative IR with -// a naive schedule. +// a naive schedule. Additional options, such as how to treat warnings, are +// passed in as "compilerOptions". HalideComponents translate( isl::ctx ctx, const lang::TreeRef& treeRef, - bool throwWarnings = false); + const tc::CompilerOptions& compilerOptions); // Translate TC source into equivalent Halide imperative IR with a -// naive schedule. -HalideComponents -translate(isl::ctx ctx, const std::string& tc, bool throwWarnings = false); +// naive schedule. Additional options, such as how to treat warnings, are +// passed in as "compilerOptions". +HalideComponents translate( + isl::ctx ctx, + const std::string& tc, + const tc::CompilerOptions& compilerOptions); } // namespace tc2halide diff --git a/tc/utils/compiler_options.h b/tc/utils/compiler_options.h index f0a61d759..7519bf51e 100644 --- a/tc/utils/compiler_options.h +++ b/tc/utils/compiler_options.h @@ -32,6 +32,8 @@ class CompilerOptions { /// Print syntactic warnings. bool emitWarnings = true; + /// Treat warnings in TC to Halide conversion as exceptions. + bool throwWarnings = false; }; } // namespace tc diff --git a/test/test_core.cc b/test/test_core.cc index f2686e4e7..88a2ff8bc 100644 --- a/test/test_core.cc +++ b/test/test_core.cc @@ -32,6 +32,7 @@ #include "tc/lang/error_report.h" #include "tc/library/copy.h" #include "tc/library/matmul.h" +#include "tc/utils/compiler_options.h" using namespace std; @@ -60,8 +61,8 @@ dtype { struct GenericHalideCoreTest : public ::testing::Test { void CheckC(const std::string& tc, const std::vector& expected) { auto curPos = std::string::npos; - auto halide = - tc2halide::translate(isl::with_exceptions::globalIslCtx(), tc); + auto halide = tc2halide::translate( + isl::with_exceptions::globalIslCtx(), tc, CompilerOptions()); auto res = tc::halideCodegenC(halide.stmt); for (const auto& e : expected) { auto newPos = res.find(e); @@ -243,8 +244,8 @@ struct TC2Isl : public ::testing::Test { DLConstTensorUPtr in = makeDLConstTensor(ti); // Must reuse the same ctx or memleaks ensue! - tc2halide::HalideComponents comps = - tc2halide::translate(isl::with_exceptions::globalIslCtx(), tc); + tc2halide::HalideComponents comps = tc2halide::translate( + isl::with_exceptions::globalIslCtx(), tc, CompilerOptions()); auto scop = polyhedral::Scop::makeScop(isl::with_exceptions::globalIslCtx(), comps); polyhedral::detail::validateSchedule(scop->scheduleRoot()); diff --git a/test/test_cuda_mapper.cc b/test/test_cuda_mapper.cc index 3122db10b..25d929983 100644 --- a/test/test_cuda_mapper.cc +++ b/test/test_cuda_mapper.cc @@ -50,7 +50,7 @@ struct PolyhedralMapperTest : public ::testing::Test { std::unique_ptr Prepare(std::string tc) { auto ctx = isl::with_exceptions::globalIslCtx(); // Build the SCoP corresponding to the Tc - return Scop::makeScop(ctx, tc); + return Scop::makeScop(ctx, tc, CompilerOptions()); } std::unique_ptr PrepareAndJoinBands(std::string tc) { diff --git a/test/test_cuda_mapper_memory_promotion.cc b/test/test_cuda_mapper_memory_promotion.cc index f17e52ea7..a2861d6a4 100644 --- a/test/test_cuda_mapper_memory_promotion.cc +++ b/test/test_cuda_mapper_memory_promotion.cc @@ -46,7 +46,7 @@ class TestMapper : public ::testing::Test { const CudaMappingOptions& mappingOptions, std::unordered_map problemSizes) { auto ctx = isl::with_exceptions::globalIslCtx(); - auto scop = Scop::makeScop(ctx, tc); + auto scop = Scop::makeScop(ctx, tc, CompilerOptions()); scop = Scop::makeSpecializedScop(*scop, problemSizes); scop->specializeToContext(); return MappedScop::makeWithOuterBlockInnerThreadStrategy( diff --git a/test/test_inference.cc b/test/test_inference.cc index 004df7143..0d596c6ca 100644 --- a/test/test_inference.cc +++ b/test/test_inference.cc @@ -22,11 +22,14 @@ using namespace std; using namespace lang; +using tc::CompilerOptions; struct InferenceTest : public ::testing::Test { void Check(const string& tc, const string& expected) { - auto halideComponents = - tc2halide::translate(isl::with_exceptions::globalIslCtx(), tc, true); + CompilerOptions compilerOptions; + compilerOptions.throwWarnings = true; + auto halideComponents = tc2halide::translate( + isl::with_exceptions::globalIslCtx(), tc, compilerOptions); stringstream ss; // Ordered map for repro diff --git a/test/test_tc2halide.cc b/test/test_tc2halide.cc index 12dfdf7b8..1a326c060 100644 --- a/test/test_tc2halide.cc +++ b/test/test_tc2halide.cc @@ -32,8 +32,8 @@ using namespace std; struct TC2Isl : public ::testing::Test { void SetUp() {} void Check(const string& tc) { - auto halide = - tc2halide::translate(isl::with_exceptions::globalIslCtx(), tc); + auto halide = tc2halide::translate( + isl::with_exceptions::globalIslCtx(), tc, CompilerOptions()); auto scop = polyhedral::Scop::makeScop( isl::with_exceptions::globalIslCtx(), halide); auto scheduleHalide = scop->scheduleRoot(); From fb45cf6fd8ccdc3782a80a53378343f3932f581a Mon Sep 17 00:00:00 2001 From: Oleksandr Zinenko Date: Tue, 24 Jul 2018 14:27:13 +0200 Subject: [PATCH 100/152] compiler API: take CompilerOptions as an optional argument Make all tc::compile and related functions take an instance of CompilerOptions. The options are defaulted to a default-constructed instance of CompilerOptions that preserves the original behavior of the compilaton flow. Making the argument optional preserves the old way of calling tc::compile since it is a user-facing function. --- tc/aten/aten_compiler-inl.h | 5 +++-- tc/aten/aten_compiler.h | 3 ++- tc/core/compiler-inl.h | 14 +++++++++----- tc/core/compiler.cc | 14 ++++++++------ tc/core/compiler.h | 18 ++++++++++++------ 5 files changed, 34 insertions(+), 20 deletions(-) diff --git a/tc/aten/aten_compiler-inl.h b/tc/aten/aten_compiler-inl.h index 8f64dec12..5817dc1e2 100644 --- a/tc/aten/aten_compiler-inl.h +++ b/tc/aten/aten_compiler-inl.h @@ -32,10 +32,11 @@ std::unique_ptr compile( const std::string& tc, const std::string& entryPoint, const std::vector& inputs, - const typename Backend::MappingOptionsType& options) { + const typename Backend::MappingOptionsType& options, + const CompilerOptions& compilerOptions) { auto inputDLTensors = makeDLConstTensors(inputs); return tc::compile( - tc, entryPoint, extractRawPtrs(inputDLTensors), options); + tc, entryPoint, extractRawPtrs(inputDLTensors), options, compilerOptions); } template diff --git a/tc/aten/aten_compiler.h b/tc/aten/aten_compiler.h index d999f7a1c..626384eda 100644 --- a/tc/aten/aten_compiler.h +++ b/tc/aten/aten_compiler.h @@ -58,7 +58,8 @@ std::unique_ptr compile( const std::string& tc, const std::string& entryPoint, const std::vector& inputs, - const typename Backend::MappingOptionsType& options); + const typename Backend::MappingOptionsType& options, + const CompilerOptions& compilerOptions = CompilerOptions()); /// Given an executor resulting from compiling a TC, run the TC and fill the /// outputs vector with the results. The output vector must have as many diff --git a/tc/core/compiler-inl.h b/tc/core/compiler-inl.h index be88b662a..1ffbafc2b 100644 --- a/tc/core/compiler-inl.h +++ b/tc/core/compiler-inl.h @@ -37,11 +37,13 @@ std::unique_ptr compile( const std::string& entryPoint, const std::vector& inputs, /* TODO: in the future also pass outputs for stride and alignment info */ - const typename Backend::MappingOptionsType& options) { + const typename Backend::MappingOptionsType& options, + const CompilerOptions& compilerOptions) { auto parsedTcs = detail::parse(tc); TC_CHECK_EQ(parsedTcs.count(entryPoint), 1u) << "attempting to access undefined function " << entryPoint; - return detail::compile(parsedTcs[entryPoint], inputs, options); + return detail::compile( + parsedTcs[entryPoint], inputs, options, compilerOptions); } namespace detail { @@ -50,13 +52,15 @@ std::unique_ptr compile( lang::TreeRef tcDefinition, const std::vector& inputs, /* TODO: in the future also pass outputs for stride and alignment info */ - const typename Backend::MappingOptionsType& options) { + const typename Backend::MappingOptionsType& options, + const CompilerOptions& compilerOptions) { using CompilationResultType = typename Backend::CompilationResultType; auto inputsInfo = makeTensorInfoVector(inputs); - auto outputsInfo = detail::inferOutputTensorInfo(tcDefinition, inputs); + auto outputsInfo = + detail::inferOutputTensorInfo(tcDefinition, inputs, compilerOptions); auto halideComponents = tc2halide::translate( - isl::with_exceptions::globalIslCtx(), tcDefinition, CompilerOptions()); + isl::with_exceptions::globalIslCtx(), tcDefinition, compilerOptions); detail::checkInputsCompliant(halideComponents, inputs); auto tcName = lang::Def(tcDefinition).name().name(); diff --git a/tc/core/compiler.cc b/tc/core/compiler.cc index a4ef1b27b..bade3a1e3 100644 --- a/tc/core/compiler.cc +++ b/tc/core/compiler.cc @@ -24,16 +24,19 @@ #include "tc/core/halide_utils.h" #include "tc/core/tensor.h" #include "tc/lang/canonicalize.h" +#include "tc/utils/compiler_options.h" namespace tc { std::vector inferOutputTensorInfo( const std::string& tc, const std::string& entryPoint, - const std::vector inputs) { + const std::vector inputs, + const CompilerOptions& compilerOptions) { auto parsedTcs = detail::parse(tc); TC_CHECK_EQ(parsedTcs.count(entryPoint), 1u) << "attempting to access undefined function " << entryPoint; - return tc::detail::inferOutputTensorInfo(parsedTcs[entryPoint], inputs); + return tc::detail::inferOutputTensorInfo( + parsedTcs[entryPoint], inputs, compilerOptions); } namespace detail { @@ -101,12 +104,11 @@ void checkInputsCompliant( std::vector inferOutputTensorInfo( lang::TreeRef tcDefinition, - const std::vector inputs) { + const std::vector inputs, + const CompilerOptions& compilerOptions) { return tc::inferOutputTensorInfo( tc2halide::translate( - isl::with_exceptions::globalIslCtx(), - tcDefinition, - CompilerOptions()), + isl::with_exceptions::globalIslCtx(), tcDefinition, compilerOptions), inputs); } diff --git a/tc/core/compiler.h b/tc/core/compiler.h index 8b9619b07..2696f7d31 100644 --- a/tc/core/compiler.h +++ b/tc/core/compiler.h @@ -22,6 +22,7 @@ #include "tc/core/mapping_options.h" #include "tc/core/tensor.h" #include "tc/lang/tree.h" +#include "tc/utils/compiler_options.h" /** * This provides a simple functional-style C++ API with multi-backend @@ -62,8 +63,9 @@ namespace tc { /// "entryPoint", this function compiles a new TcExecutor for the specified /// Backend. For now, contiguous output sizes are inferred given input sizes. /// If you need another kernel for another entryPoint or other inputs or -// other options then just compile another TcExecutor; because atm we fully -/// JIT specialize on all sizes. +/// other options then just compile another TcExecutor; because atm we fully +/// JIT specialize on all sizes. General compilation options (warnings, debug +/// info) are provided in "compilerOptions". /// \returns a new TcExecutor on which the run method can be called to run /// entryPoint template @@ -72,7 +74,8 @@ std::unique_ptr compile( const std::string& entryPoint, const std::vector& inputs, /* TODO: in the future also pass outputs for stride and alignment info */ - const typename Backend::MappingOptionsType& options); + const typename Backend::MappingOptionsType& options, + const CompilerOptions& compilerOptions = CompilerOptions()); /// Given a TC representation as a TC + TC function name entryPoint and a list /// of input tensors that match the definition in the TC function definition @@ -85,7 +88,8 @@ std::unique_ptr compile( std::vector inferOutputTensorInfo( const std::string& tc, const std::string& entryPoint, - const std::vector inputs); + const std::vector inputs, + const CompilerOptions& compilerOptions = CompilerOptions()); namespace detail { /// Given a TC representation, this parses the TC functions into a map of @@ -105,7 +109,8 @@ std::unique_ptr compile( lang::TreeRef tcDefinition, const std::vector& inputs, /* TODO: in the future also pass outputs for stride and alignment info */ - const typename Backend::MappingOptionsType& options); + const typename Backend::MappingOptionsType& options, + const CompilerOptions& compilerOptions = CompilerOptions()); /// Given a TC representation as a TreeRef and a list of input tensors that /// match the definition in the TC function definition (in positional order), @@ -116,7 +121,8 @@ std::unique_ptr compile( /// performing output shape validation. std::vector inferOutputTensorInfo( lang::TreeRef tcDefinition, - const std::vector inputs); + const std::vector inputs, + const CompilerOptions& compilerOptions = CompilerOptions()); } // namespace detail } // namespace tc From d4a569e83167ba5cbe1fc15665be58fa695711d5 Mon Sep 17 00:00:00 2001 From: Oleksandr Zinenko Date: Tue, 24 Jul 2018 14:45:12 +0200 Subject: [PATCH 101/152] Sema: put a member variable after functions Our coding guidelines stipulate that member variables must come after the member functions in a class definition. --- tc/lang/sema.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tc/lang/sema.h b/tc/lang/sema.h index 3426c0208..073341348 100644 --- a/tc/lang/sema.h +++ b/tc/lang/sema.h @@ -170,8 +170,6 @@ static inline TreeRef match_types(TreeRef a, TreeRef b) { /// variable objects. /// - checks that input variables are readonly. struct Sema { - std::unordered_map expr_to_type; - TreeRef typeOfExpr(TreeRef ref) { if (expr_to_type.count(ref) == 0) { throw ErrorReport(ref) @@ -707,6 +705,8 @@ struct Sema { // allowed std::unordered_set live_input_names; + std::unordered_map expr_to_type; + std::unordered_set inputParameters; std::unordered_set nonTemporaries; }; From 3bbf8d83dd6492aaf55248c9e4f14441562168c6 Mon Sep 17 00:00:00 2001 From: Oleksandr Zinenko Date: Tue, 24 Jul 2018 15:27:10 +0200 Subject: [PATCH 102/152] Sema: respect CompilerOptions Semantic analyzer may output warnings. Take an instance of CompilerOptions when constructing a Sema and pass use it to decide how to treat warnings. --- tc/core/tc2halide.cc | 3 ++- tc/lang/sema.h | 10 +++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/tc/core/tc2halide.cc b/tc/core/tc2halide.cc index dc25926f9..3e95233ef 100644 --- a/tc/core/tc2halide.cc +++ b/tc/core/tc2halide.cc @@ -915,7 +915,8 @@ HalideComponents translate( const tc::CompilerOptions& compilerOptions = tc::CompilerOptions()) { LOG_IF(INFO, tc::FLAGS_debug_halide) << treeRef; return translateDef( - lang::Def(lang::Sema().checkFunction(treeRef)), compilerOptions); + lang::Def(lang::Sema(compilerOptions).checkFunction(treeRef)), + compilerOptions); } // NOTE: there is no guarantee here that the tc string has only one def. It diff --git a/tc/lang/sema.h b/tc/lang/sema.h index 073341348..8f8305679 100644 --- a/tc/lang/sema.h +++ b/tc/lang/sema.h @@ -21,6 +21,7 @@ #include "tc/lang/error_report.h" #include "tc/lang/tree.h" #include "tc/lang/tree_views.h" +#include "tc/utils/compiler_options.h" namespace lang { @@ -170,6 +171,10 @@ static inline TreeRef match_types(TreeRef a, TreeRef b) { /// variable objects. /// - checks that input variables are readonly. struct Sema { + explicit Sema( + const tc::CompilerOptions& compilerOptions = tc::CompilerOptions()) + : compilerOptions(compilerOptions) {} + TreeRef typeOfExpr(TreeRef ref) { if (expr_to_type.count(ref) == 0) { throw ErrorReport(ref) @@ -556,7 +561,7 @@ struct Sema { << " is not pre-initialized before calling the TC function," << " consider using the !-suffixed reduction operator " << tk << "! instead of " << tk; - warn(err); + warn(err, compilerOptions); } auto type = TensorType::create( @@ -709,5 +714,8 @@ struct Sema { std::unordered_set inputParameters; std::unordered_set nonTemporaries; + + // TC compilation flow options. + tc::CompilerOptions compilerOptions; }; } // namespace lang From 7a909c389c4d4968b7558701efd72177976c335e Mon Sep 17 00:00:00 2001 From: Oleksandr Zinenko Date: Tue, 24 Jul 2018 15:28:44 +0200 Subject: [PATCH 103/152] Supress warnings during the autotuner run Warnings can be emitted during range inference or compilation which are called for each candidate in the autotuning run. The source TC remaining the same, this crease an unnecessary stream of duplicate warnings while the autotuning runs. Use the newly introduced CompilerOptions mechanism to disable warnings during the autotuning process. Note that this process returns the mapping options rather than a compiled object, forcing the caller to explicitly compile with these options and get the warnings if necessary. --- tc/autotuner/autotuner-inl.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tc/autotuner/autotuner-inl.h b/tc/autotuner/autotuner-inl.h index 37fe26e2c..816cfee5f 100644 --- a/tc/autotuner/autotuner-inl.h +++ b/tc/autotuner/autotuner-inl.h @@ -29,6 +29,7 @@ #include "tc/core/tensor.h" #include "tc/core/utils/math.h" #include "tc/lang/canonicalize.h" +#include "tc/utils/compiler_options.h" namespace tc { namespace autotune { @@ -74,6 +75,9 @@ void TuningHarness::stopAfterCurrentIteration() { template template void TuningHarness::doCompile(SearchStrategy& searchStrategy) { + CompilerOptions supressWarningsOptions; + supressWarningsOptions.emitWarnings = false; + // Atomically fetch and add the next job until there are no jobs left while (true) { auto current = currentCompilationJob_.fetch_add(1); @@ -93,7 +97,7 @@ void TuningHarness::doCompile(SearchStrategy& searchStrategy) { LOG_LINE_BY_LINE(INFO, ssInfo); } pExecutor = tc::detail::compile( - tcTree_, inputs_.begin()->second, options); + tcTree_, inputs_.begin()->second, options, supressWarningsOptions); LOG_IF(INFO, FLAGS_debug_tuner) << "[COMPILE] Done compilation"; } catch (const std::exception& e) { LOG(WARNING) << "[TUNER][COMPILE] failed compilation: " << e.what(); From 012e970875928f7e336d9aa1a88c27eb2f461cae Mon Sep 17 00:00:00 2001 From: Nicolas Vasilache Date: Tue, 10 Jul 2018 10:18:01 -0700 Subject: [PATCH 104/152] Expose dump_ptx flag to Python --- tensor_comprehensions/__init__.py | 2 ++ tensor_comprehensions/pybinds/tclib.cc | 1 + 2 files changed, 3 insertions(+) diff --git a/tensor_comprehensions/__init__.py b/tensor_comprehensions/__init__.py index fb097ac28..7103b7153 100644 --- a/tensor_comprehensions/__init__.py +++ b/tensor_comprehensions/__init__.py @@ -28,6 +28,7 @@ from tensor_comprehensions.tclib import debug_tc_mapper from tensor_comprehensions.tclib import debug_tuner from tensor_comprehensions.tclib import dump_cuda +from tensor_comprehensions.tclib import dump_ptx from tensor_comprehensions.tclib import CompilationCache from tensor_comprehensions.tclib import MappingOptions @@ -604,6 +605,7 @@ def make_autograd(forward_fun: Callable[[Iterable[torch.Tensor]], Iterable[torch 'debug_tc_mapper', 'debug_tuner', 'dump_cuda', + 'dump_ptx', # Functions exposed by the tclib 'compile', 'autotune', diff --git a/tensor_comprehensions/pybinds/tclib.cc b/tensor_comprehensions/pybinds/tclib.cc index 3487e26ff..82e759903 100644 --- a/tensor_comprehensions/pybinds/tclib.cc +++ b/tensor_comprehensions/pybinds/tclib.cc @@ -438,6 +438,7 @@ PYBIND11_MODULE(tclib, m) { tc::FLAGS_debug_tuner = debug_tuner; }); m.def("dump_cuda", [](bool dump_cuda) { tc::FLAGS_dump_cuda = dump_cuda; }); + m.def("dump_ptx", [](bool dump_ptx) { tc::FLAGS_dump_ptx = dump_ptx; }); // Access the names of the defs in a TC string m.def("parse_defs", [](const std::string& tc) { From 6a38863d7aed441a595e9992b975be646842d424 Mon Sep 17 00:00:00 2001 From: Nicolas Vasilache Date: Tue, 10 Jul 2018 11:48:23 -0700 Subject: [PATCH 105/152] Make Halide output standard types Halide has its own way of pretty-printing types. In the case of `bool` (i.e. `uint1`), this conflicts with the default cuda types. It will also conflict for `(u)int2` and `(u)int4`. This commit make our `Halide::IRPrinter` print `bool` and other types properly for CUDA. As a consequence the typedefs in `cuda_libraries.h` can be removed. --- tc/core/cuda/cuda_libraries.h | 13 ----- tc/core/polyhedral/cuda/codegen.cc | 62 ++++++++++++++++++++--- test/cuda/test_basic_gpu.cc | 16 +++--- test/cuda/test_tc_mapper.cc | 4 +- test/test_cuda_mapper.cc | 48 +++++++++--------- test/test_cuda_mapper_memory_promotion.cc | 32 ++++++------ 6 files changed, 103 insertions(+), 72 deletions(-) diff --git a/tc/core/cuda/cuda_libraries.h b/tc/core/cuda/cuda_libraries.h index c2fdb1de8..d757fa6da 100644 --- a/tc/core/cuda/cuda_libraries.h +++ b/tc/core/cuda/cuda_libraries.h @@ -34,19 +34,6 @@ constexpr auto types = R"C( // Can't include system dependencies with NVRTC // Can't include cuda_fp16.h with NVRTC due to transitive system dependencies // #include - -// Halide type handling -typedef char int8; -typedef short int16; -typedef int int32; -typedef long int64; -typedef unsigned char uint8; -typedef unsigned short uint16; -typedef unsigned int uint32; -typedef unsigned long uint64; -// typedef half float16; -typedef float float32; -typedef double float64; )C"; constexpr auto defines = R"C( diff --git a/tc/core/polyhedral/cuda/codegen.cc b/tc/core/polyhedral/cuda/codegen.cc index ab8d49b91..d6ce62aa2 100644 --- a/tc/core/polyhedral/cuda/codegen.cc +++ b/tc/core/polyhedral/cuda/codegen.cc @@ -39,6 +39,37 @@ namespace polyhedral { namespace { +static std::string halideTypeString(const Halide::Type& t) { + if (t.is_bool()) { + return "bool"; + } else if (t.is_int() && t.bits() == 8) { + return "char"; + } else if (t.is_int() && t.bits() == 16) { + return "short"; + } else if (t.is_int() && t.bits() == 32) { + return "int"; + } else if (t.is_int() && t.bits() == 64) { + return "long"; + } else if (t.is_uint() && t.bits() == 8) { + return "unsigned char"; + } else if (t.is_uint() && t.bits() == 16) { + return "unsigned short"; + } else if (t.is_uint() && t.bits() == 32) { + return "unsigned int"; + } else if (t.is_uint() && t.bits() == 64) { + return "unsigned long"; + } else if (t.is_float() && t.bits() == 16) { + return "half"; + } else if (t.is_float() && t.bits() == 32) { + return "float"; + } else if (t.is_float() && t.bits() == 64) { + return "double"; + } + std::stringstream ss; + ss << t; + return ss.str(); +} + struct WS { static thread_local int n; WS() { @@ -102,7 +133,7 @@ vector emitParams(const Scop& scop) { // Halide params. One of these two vectors will be empty. for (auto p : scop.halide.params) { stringstream ss; - ss << p.type() << " " << p.name(); + ss << halideTypeString(p.type()) << " " << p.name(); res.push_back(ss.str()); } return res; @@ -113,7 +144,7 @@ string emitTypedTensorName( Halide::OutputImageParam t, bool constInput = false) { stringstream ss; - ss << (constInput ? "const " : "") << t.type() << "* " + ss << (constInput ? "const " : "") << halideTypeString(t.type()) << "* " << makePointerName(t.name()); return ss.str(); } @@ -195,11 +226,11 @@ void emitTensorView( ssViewType << "[" << extent << "]"; } ss << ws.tab(); - ss << (constInput ? "const " : "") << p.type() << " (*" << p.name() << ")" - << ssViewType.str(); + ss << (constInput ? "const " : "") << halideTypeString(p.type()) << " (*" + << p.name() << ")" << ssViewType.str(); ss << " = "; - ss << "reinterpret_cast<" << (constInput ? "const " : "") << p.type() - << " (*)" << ssViewType.str() << ">"; + ss << "reinterpret_cast<" << (constInput ? "const " : "") + << halideTypeString(p.type()) << " (*)" << ssViewType.str() << ">"; ss << "(" << makePointerName(p.name()) << ")"; ss << ";"; ss << endl; @@ -604,6 +635,21 @@ void emitHalideExpr( IRPrinter::visit(op); } } + void visit(const Halide::Internal::IntImm* op) { + context.ss << "(" << halideTypeString(op->type) << ")" << op->value; + } + void visit(const Halide::Internal::UIntImm* op) { + context.ss << "(" << halideTypeString(op->type) << ")" << op->value; + } + void visit(const Halide::Internal::FloatImm* op) { + context.ss << "(" << halideTypeString(op->type) << ")" << op->value; + } + void visit(const Halide::Internal::Cast* op) { + context.ss << "(" << halideTypeString(op->type) << ")"; + context.ss << "("; + op->value.accept(this); + context.ss << ")"; + } // TODO: handle casts const CodegenStatementContext& context; const map& substitutions; @@ -720,7 +766,7 @@ void emitTmpDecl(stringstream& ss, const Scop& scop) { auto updateId = kvp.second; auto provide = scop.halide.statements.at(updateId).as(); - ss << provide->values[0].type() << " " + ss << halideTypeString(provide->values[0].type()) << " " << makeReductionTmpName(updateId, scop) << ";" << endl; } } @@ -745,7 +791,7 @@ void emitPromotedArrayViewsHalide(stringstream& ss, const Scop& scop) { if (p.second.kind == Scop::PromotedDecl::Kind::SharedMem) { ss << "__shared__ "; } - ss << t << " " << viewName; + ss << halideTypeString(t) << " " << viewName; for (auto s : p.second.sizes) { ss << "[" << s << "]"; } diff --git a/test/cuda/test_basic_gpu.cc b/test/cuda/test_basic_gpu.cc index 4b856820e..2be4e9b88 100644 --- a/test/cuda/test_basic_gpu.cc +++ b/test/cuda/test_basic_gpu.cc @@ -99,13 +99,15 @@ void loadUnload(const std::string& ptx) { TEST(BasicGpuTest, Nvrtc) { TC_CUDA_RUNTIMEAPI_ENFORCE(cudaFree(0)); - auto PTX = jitCompile(R"CUDA( + auto PTX = jitCompile( + R"CUDA( extern "C" { __global__ void foo(int N) { assert(N == 1); } -})CUDA", {"-G"}); +})CUDA", + {"-G"}); std::string ptx(PTX.data()); loadUnload(ptx); @@ -153,15 +155,12 @@ namespace { // Mark the function argument as __restrict__ depending on the flag. std::string makeFuncWithOptionalRestrict(bool useRestrict) { std::stringstream ss; - ss << R"CUDA(typedef float float32; -extern "C" { -)CUDA"; ss - << (useRestrict ? "__global__ void func(float32* __restrict__ pO2) {" - : "__global__ void func(float32* pO2) {"); + << (useRestrict ? "__global__ void func(float* __restrict__ pO2) {" + : "__global__ void func(float* pO2) {"); ss << R"CUDA(int b0 = blockIdx.x; int t0 = threadIdx.x; - float32 (*O2)[2] = reinterpret_cast(pO2); + float (*O2)[2] = reinterpret_cast(pO2); O2[b0][t0] = 0.000000f; // S1 __syncthreads(); if (t0 == 0) { @@ -171,7 +170,6 @@ extern "C" { } __syncthreads(); O2[b0][t0] = fmax(O2[b0][t0], 0); // S3 -} })CUDA"; return ss.str(); } diff --git a/test/cuda/test_tc_mapper.cc b/test/cuda/test_tc_mapper.cc index a1f303bd7..feab7685d 100644 --- a/test/cuda/test_tc_mapper.cc +++ b/test/cuda/test_tc_mapper.cc @@ -327,8 +327,8 @@ def tensoraddstrided(float(N, M) I0_view, float(N, M) I1_view) -> (O) { auto res = Check(TC, name, options, inputs, checkFun); // This test should be modified when strided tensors are handled std::string expected = - "const float32 (*I0_view)[64] = " - "reinterpret_cast(pI0_view)"; + "const float (*I0_view)[64] = " + "reinterpret_cast(pI0_view)"; ASSERT_NE(std::string::npos, res.second.find(expected)) << "In resulting code:\n" << res.second << "\nfound unexpected: " << expected; diff --git a/test/test_cuda_mapper.cc b/test/test_cuda_mapper.cc index 3122db10b..f29879331 100644 --- a/test/test_cuda_mapper.cc +++ b/test/test_cuda_mapper.cc @@ -365,9 +365,9 @@ def fun(float(N, M) A, float(N, M) B) -> (C) { std::string expected( R"RES(int b0 = blockIdx.x; int b1 = blockIdx.y; int b2 = blockIdx.z; int t0 = threadIdx.x; int t1 = threadIdx.y; int t2 = threadIdx.z; - float32 (*C)[M] = reinterpret_cast(pC); - const float32 (*A)[M] = reinterpret_cast(pA); - const float32 (*B)[M] = reinterpret_cast(pB); + float (*C)[M] = reinterpret_cast(pC); + const float (*A)[M] = reinterpret_cast(pA); + const float (*B)[M] = reinterpret_cast(pB); for (int c1 = 16 * b1; c1 < M; c1 += 4096) { if (M >= t0 + c1 + 1) { C[(t1 + 16 * b0)][(t0 + c1)] = (A[(t1 + 16 * b0)][(t0 + c1)] + B[(t1 + 16 * b0)][(t0 + c1)]); @@ -400,16 +400,16 @@ def fun(float(N, N, N, N) A, float(N, N) B, float(N, N) C, float(N, N) D) std::string expected( R"RES(int b0 = blockIdx.x; int b1 = blockIdx.y; int b2 = blockIdx.z; int t0 = threadIdx.x; int t1 = threadIdx.y; int t2 = threadIdx.z; - float32 (*O1)[N] = reinterpret_cast(pO1); - float32 (*O2)[N] = reinterpret_cast(pO2); - float32 (*O3)[N] = reinterpret_cast(pO3); - const float32 (*A)[N][N][N] = reinterpret_cast(pA); - const float32 (*B)[N] = reinterpret_cast(pB); - const float32 (*C)[N] = reinterpret_cast(pC); - const float32 (*D)[N] = reinterpret_cast(pD); + float (*O1)[N] = reinterpret_cast(pO1); + float (*O2)[N] = reinterpret_cast(pO2); + float (*O3)[N] = reinterpret_cast(pO3); + const float (*A)[N][N][N] = reinterpret_cast(pA); + const float (*B)[N] = reinterpret_cast(pB); + const float (*C)[N] = reinterpret_cast(pC); + const float (*D)[N] = reinterpret_cast(pD); for (int c0 = 0; c0 < N; c0 += 1) { for (int c1 = 0; c1 < N; c1 += 1) { - O1[c0][c1] = 0.000000f; + O1[c0][c1] = (float)0.000000; } } for (int c0 = 0; c0 < N; c0 += 1) { @@ -449,14 +449,14 @@ def fun(float(N, N) A) -> (O) auto res = std::get<0>(mscop->codegen(specializedName)); string expected( - R"RES(__global__ void kernel_anon(int32 N, float32* pO, const float32* pA) { + R"RES(__global__ void kernel_anon(int N, float* pO, const float* pA) { int b0 = blockIdx.x; int b1 = blockIdx.y; int b2 = blockIdx.z; int t0 = threadIdx.x; int t1 = threadIdx.y; int t2 = threadIdx.z; - float32 (*O)[N] = reinterpret_cast(pO); - const float32 (*A)[N] = reinterpret_cast(pA); + float (*O)[N] = reinterpret_cast(pO); + const float (*A)[N] = reinterpret_cast(pA); for (int c0 = 0; c0 < N; c0 += 1) { for (int c1 = 0; c1 < N; c1 += 1) { - O[c0][c1] = (((A[c0][c1] + float32(c0)) + float32(c1)) + float32(N)); + O[c0][c1] = (((A[c0][c1] + (float)(c0)) + (float)(c1)) + (float)(N)); } } } @@ -478,13 +478,13 @@ def fun(float(N, N) A, float(N, N) B, float(N) C) -> (O) auto res = std::get<0>(mscop->codegen(specializedName)); string expected = - R"RES(__global__ void kernel_anon(int32 N, float32* pO, const float32* pA, const float32* pB, const float32* pC) { + R"RES(__global__ void kernel_anon(int N, float* pO, const float* pA, const float* pB, const float* pC) { int b0 = blockIdx.x; int b1 = blockIdx.y; int b2 = blockIdx.z; int t0 = threadIdx.x; int t1 = threadIdx.y; int t2 = threadIdx.z; - float32 (*O)[512] = reinterpret_cast(pO); - const float32 (*A)[512] = reinterpret_cast(pA); - const float32 (*B)[512] = reinterpret_cast(pB); - const float32 (*C) = reinterpret_cast(pC); + float (*O)[512] = reinterpret_cast(pO); + const float (*A)[512] = reinterpret_cast(pA); + const float (*B)[512] = reinterpret_cast(pB); + const float (*C) = reinterpret_cast(pC); for (int c0 = 0; c0 <= 511; c0 += 1) { for (int c1 = 0; c1 <= 511; c1 += 1) { O[c0][c1] = (nextafter(C[c0], exp(A[c0][c1])) + log(B[c1][c0])); @@ -499,13 +499,13 @@ def fun(float(N, N) A, float(N, N) B, float(N) C) -> (O) constexpr auto kExpectedMatmul_64_64_64 = R"CUDA(int b0 = blockIdx.x; int b1 = blockIdx.y; int b2 = blockIdx.z; int t0 = threadIdx.x; int t1 = threadIdx.y; int t2 = threadIdx.z; - float32 (*O)[64] = reinterpret_cast(pO); - const float32 (*A)[64] = reinterpret_cast(pA); - const float32 (*B)[64] = reinterpret_cast(pB); + float (*O)[64] = reinterpret_cast(pO); + const float (*A)[64] = reinterpret_cast(pA); + const float (*B)[64] = reinterpret_cast(pB); for (int c0 = 0; c0 <= 63; c0 += 16) { for (int c1 = 0; c1 <= 63; c1 += 16) { for (int c2 = t1; c2 <= 15; c2 += 8) { - O[(c0 + c2)][(t0 + c1)] = 0.000000f; + O[(c0 + c2)][(t0 + c1)] = (float)0.000000; for (int c4 = 0; c4 <= 63; c4 += 1) { O[(c0 + c2)][(t0 + c1)] = (O[(c0 + c2)][(t0 + c1)] + (A[(c0 + c2)][c4]*B[c4][(t0 + c1)])); } diff --git a/test/test_cuda_mapper_memory_promotion.cc b/test/test_cuda_mapper_memory_promotion.cc index f17e52ea7..ce0cdc3ca 100644 --- a/test/test_cuda_mapper_memory_promotion.cc +++ b/test/test_cuda_mapper_memory_promotion.cc @@ -113,9 +113,9 @@ def fun(float(N,M,K,L) A, float(N,M,K,L) B) -> (C) { }; TEST_F(Sum4D, CodeOuterBand) { - auto declarations = {"__shared__ float32 _A_0[16][16][16][16];", - "__shared__ float32 _B_0[16][16][16][16];", - "__shared__ float32 _C_0[16][16][16][16];"}; + auto declarations = {"__shared__ float _A_0[16][16][16][16];", + "__shared__ float _B_0[16][16][16][16];", + "__shared__ float _C_0[16][16][16][16];"}; auto copyA = "_A_0[c4][c5][c6][c7] = A[16 * b0 + c4][16 * b1 + c5][c2 + c6][c3 + c7];"; @@ -161,9 +161,9 @@ TEST_F(Sum4D, CodeOuterBand) { * promoteEverythingAt does not call mapCopiesToThreads. */ TEST_F(Sum4D, CodeAboveThreadMapping) { - auto declarations = {"__shared__ float32 _A_0[16][16][16][16];", - "__shared__ float32 _B_0[16][16][16][16];", - "__shared__ float32 _C_0[16][16][16][16];"}; + auto declarations = {"__shared__ float _A_0[16][16][16][16];", + "__shared__ float _B_0[16][16][16][16];", + "__shared__ float _C_0[16][16][16][16];"}; auto copyA = "_A_0[c4][c5][c6][c7] = A[16 * b0 + c4][16 * b1 + c5][c2 + c6][c3 + c7]"; auto copyB = @@ -204,9 +204,9 @@ TEST_F(Sum4D, CodeAboveThreadMapping) { } TEST_F(Sum4D, CodeInnerBand) { - auto declarations = {"__shared__ float32 _C_0[1][1][1][1];", - "__shared__ float32 _A_0[1][1][1][1];", - "__shared__ float32 _B_0[1][1][1][1];"}; + auto declarations = {"__shared__ float _C_0[1][1][1][1];", + "__shared__ float _A_0[1][1][1][1];", + "__shared__ float _B_0[1][1][1][1];"}; auto copyA = "_A_0[0][0][0][0] = A[16 * b0 + c4][16 * b1 + c5][c2 + c6][t0 + c3];"; auto copyB = @@ -473,9 +473,9 @@ def fun(float(N,K) A, float(K,M) B, float(N,M) C) -> (O) { } void expectNoABCPromotion(const std::string& code) { - auto aDeclPos = code.find(" float32 _A_0"); - auto bDeclPos = code.find(" float32 _B_0"); - auto cDeclPos = code.find(" float32 _C_0"); + auto aDeclPos = code.find(" float _A_0"); + auto bDeclPos = code.find(" float _B_0"); + auto cDeclPos = code.find(" float _C_0"); EXPECT_TRUE(aDeclPos == std::string::npos) << "tensor A promoted to register but has elements accessed " << "by multiple threads"; @@ -487,7 +487,7 @@ def fun(float(N,K) A, float(K,M) B, float(N,M) C) -> (O) { } void expectFourOElementsPromoted(const std::string& code) { - auto oDeclPos = code.find("float32 _O_0[4][1];"); + auto oDeclPos = code.find("float _O_0[4][1];"); EXPECT_TRUE(oDeclPos != std::string::npos) << "expected O to be promoted to registers"; @@ -541,7 +541,7 @@ TEST_F(MatMulBias, RegisterPromotion) { .usePrivateMemory(true); auto code = emitCode({{"N", 42}, {"M", 56}, {"K", 37}}, mappingOptions); - auto declPos = code.find("float32 _O_0"); + auto declPos = code.find("float _O_0"); auto copyToPos = code.find("_O_0[0][0] = O[32 * b0 + c3][t0 + 32 * b1]", declPos + 1); auto copyFromPos = @@ -570,7 +570,7 @@ TEST_F(MatMulBias, RegisterPromotionSharedPreference) { auto code = emitCode({{"N", 42}, {"M", 56}, {"K", 37}}, mappingOptions); - auto declPos = code.find("float32 _O_0[1][1]"); + auto declPos = code.find("float _O_0[1][1]"); EXPECT_TRUE(declPos == std::string::npos) << "not expected promotion to register because promoted to shared"; @@ -606,7 +606,7 @@ TEST_F(MatMulBias, RegistersAtRootNotEnoughUnroll) { auto mscop = prepare({{"N", 42}, {"M", 56}, {"K", 37}}, mappingOptions); promoteToRegistersBelow(*mscop, mscop->scop().scheduleRoot()); auto code = emitCode(mscop); - auto oDeclPos = code.find("float32 _O_0;"); + auto oDeclPos = code.find("float _O_0;"); EXPECT_TRUE(oDeclPos == std::string::npos) << "not expected O to be promoted to registers"; From d2caf9db295a6bccb226eb0a4a2a265b111d12d8 Mon Sep 17 00:00:00 2001 From: Nicolas Vasilache Date: Tue, 10 Jul 2018 13:39:41 -0700 Subject: [PATCH 106/152] Reconcile builtins and cuda `tc/lang/builtins.h` and `tc/core/cuda/cuda_libraries.h` do not have the same functions listed. The minimal change is to include the cuda header `math_functions.hpp` which contains all the proper overloads. --- tc/core/cuda/cuda_libraries.h | 92 +---------------------------------- 1 file changed, 1 insertion(+), 91 deletions(-) diff --git a/tc/core/cuda/cuda_libraries.h b/tc/core/cuda/cuda_libraries.h index d757fa6da..d3d54661e 100644 --- a/tc/core/cuda/cuda_libraries.h +++ b/tc/core/cuda/cuda_libraries.h @@ -49,97 +49,7 @@ __device__ void __syncwarp(unsigned mask = 0xFFFFFFFF) {} )C"; constexpr auto mathFunctionDecl = R"C( - -// BEGIN MATH FUNCTIONS FROM CUDA -float acosf ( float x ); -float acoshf ( float x ); -float asinf ( float x ); -float asinhf ( float x ); -float atan2f ( float y, float x ); -float atanf ( float x ); -float atanhf ( float x ); -float cbrtf ( float x ); -float ceilf ( float x ); -float copysignf ( float x, float y ); -float cosf ( float x ); -float coshf ( float x ); -float cospif ( float x ); -float cyl_bessel_i0f ( float x ); -float cyl_bessel_i1f ( float x ); -float erfcf ( float x ); -float erfcinvf ( float y ); -float erfcxf ( float x ); -float erff ( float x ); -float erfinvf ( float y ); -float exp10f ( float x ); -float exp2f ( float x ); -float expf ( float x ); -float expm1f ( float x ); -float fabsf ( float x ); -float fdimf ( float x, float y ); -float fdividef ( float x, float y ); -float floorf ( float x ); -float fmaf ( float x, float y, float z ); -float fmaxf ( float x, float y ); -float fminf ( float x, float y ); -float fmodf ( float x, float y ); -//float frexpf ( float x, int* nptr ); -float hypotf ( float x, float y ); -//int ilogbf ( float x ); -//__RETURN_TYPE isfinite ( float a ); -//__RETURN_TYPE isinf ( float a ); -//__RETURN_TYPE isnan ( float a ); -float j0f ( float x ); -float j1f ( float x ); -//float jnf ( int n, float x ); -//float ldexpf ( float x, int exp ); -float lgammaf ( float x ); -//long long int llrintf ( float x ); -//long long int llroundf ( float x ); -float log10f ( float x ); -float log1pf ( float x ); -float log2f ( float x ); -float logbf ( float x ); -float logf ( float x ); -//long int lrintf ( float x ); -//long int lroundf ( float x ); -//float modff ( float x, float* iptr ); -//float nanf ( const char* tagp ); -//float nearbyintf ( float x ); -float nextafterf ( float x, float y ); -float norm3df ( float a, float b, float c ); -float norm4df ( float a, float b, float c, float d ); -float normcdff ( float y ); -float normcdfinvf ( float y ); -//float normf ( int dim, const float* a ); -float powf ( float x, float y ); -float rcbrtf ( float x ); -float remainderf ( float x, float y ); -//float remquof ( float x, float y, int* quo ); -float rhypotf ( float x, float y ); -//float rintf ( float x ); -float rnorm3df ( float a, float b, float c ); -float rnorm4df ( float a, float b, float c, float d ); -//float rnormf ( int dim, const float* a ); -float roundf ( float x ); -float rsqrtf ( float x ); -//float scalblnf ( float x, long int n ); -//float scalbnf ( float x, int n ); -//__RETURN_TYPE signbit ( float a ); -//void sincosf ( float x, float* sptr, float* cptr ); -//void sincospif ( float x, float* sptr, float* cptr ); -float sinf ( float x ); -float sinhf ( float x ); -float sinpif ( float x ); -float sqrtf ( float x ); -float tanf ( float x ); -float tanhf ( float x ); -float tgammaf ( float x ); -float truncf ( float x ); -float y0f ( float x ); -float y1f ( float x ); -//float ynf ( int n, float x ); -// END MATH FUNCTIONS FROM CUDA +#include \"math_functions.hpp\" )C"; } // namespace c From 71b01c28cfa270e9ebb747fa4f3246ae91f798ce Mon Sep 17 00:00:00 2001 From: Nicolas Vasilache Date: Tue, 10 Jul 2018 10:25:42 -0700 Subject: [PATCH 107/152] Add tum.py example based on LengthsCosineCoherence --- python/examples/tum.py | 300 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 300 insertions(+) create mode 100644 python/examples/tum.py diff --git a/python/examples/tum.py b/python/examples/tum.py new file mode 100644 index 000000000..e7a807bdc --- /dev/null +++ b/python/examples/tum.py @@ -0,0 +1,300 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## +import tensor_comprehensions as tc + +import argparse +import numpy as np +import torch + +def GetArgumentParser(): + parser = argparse.ArgumentParser( + description='Lengths Cosine Coherence benchmark.' + ) + parser.add_argument( + '--num_segs', type=int, default=4, help='The number of segments.' + ) + parser.add_argument( + '--seg_length', type=int, default=100, help='The length of each segment.' + ) + parser.add_argument( + '--num_of_channels', type=int, default=128, help='The dimension of embeddings.' + ) + parser.add_argument( + '--pos_dist', type=int, default=0, help='The positive window size.' + ) + parser.add_argument( + '--neg_dist', type=int, default=0, help='The negative window size.' + ) + + parser.add_argument( + '--tuner_threads', type=int, default=16, help='Number of CPU tuning threads.' + ) + parser.add_argument( + '--tuner_generations', type=int, default=25, help='Number of tuning generations.' + ) + parser.add_argument( + '--tuner_pop_size', type=int, default=100, help='Number candidates per tuning generations.' + ) + parser.add_argument( + '--tuner_number_elites', type=int, default=5, help='Number of best tuning candidates that survive each generation.' + ) + parser.add_argument( + '--tuner_devices', type=str, default='0', help='Comma separated list of tuning devices.' + ) + parser.add_argument( + '--tuner_cache_file', + type=str, + default='/tmp/cache_tum', + help='File to store tuned mapping options', + ) + return parser + + +parser = GetArgumentParser() +args, extra_args = parser.parse_known_args() + +############################################################################### +# Reference python impl +############################################################################### +def reference(D, L): + R = np.zeros(shape=(L.size,), dtype=D.dtype) + Normed_DATA = D * 0 + Norm_of_Vector = np.zeros(shape=(D.shape[0],), dtype=D.dtype) + POS_C = np.zeros(shape=(L.size,), dtype=np.long) + NEG_C = np.zeros(shape=(L.size,), dtype=np.long) + line = 0 + kEps = 1e-12 + + def dot(a, b): + return np.sum(a * b) + + for i in range(D.shape[0]): + Norm_of_Vector[i] = dot(D[i], D[i]) + Normed_DATA[i] = D[i] / np.sqrt(max(Norm_of_Vector[i], kEps)) + + for g in range(L.size): + if L[g] <= 1: + line += L[g] + continue + pos_res = 0 + neg_res = 0 + for i in range(L[g] - 1): + for j in range(i + 1, L[g]): + sqrt_norm = np.sqrt( + max(Norm_of_Vector[line + i], kEps) + * max(Norm_of_Vector[line + j], kEps) + ) + if args.pos_dist == 0 or j - i <= args.pos_dist: + pos_res += dot(D[line + i], D[line + j]) / sqrt_norm + POS_C[g] += 1 + if args.neg_dist > 0 and j - i >= args.neg_dist: + neg_res += dot(D[line + i], D[line + j]) / sqrt_norm + NEG_C[g] += 1 + pos_res = 0 if POS_C[g] < 1 else pos_res / POS_C[g] + neg_res = 0 if NEG_C[g] < 1 else neg_res / NEG_C[g] + R[g] = pos_res - neg_res + line += L[g] + return [R, Normed_DATA, Norm_of_Vector, POS_C, NEG_C] + +############################################################################### +# TC equivalent converting control-flow to data dependencies +############################################################################### +LENGTHS_COSINE_COHERENCE = ''' +# TODO: this is just a scan but currently implemented as K reductions +def make_idx(int32(K) Segments) -> (Idx) { + Idx(k) +=! (r_k < k) ? Segments(r_k) : 0 where k in 0:K+1 +} +def make_alpha(int32(KP1) Idx, int32(MAX_L) SegmentsMetaData) -> (Alpha) { + # Triangular compute + Alpha(k, max_l_1, max_l_2) = (max_l_1 >= max_l_2) ? 0.0 : + # This computes an approximation using the maximal segment length + (( == 0 || fabs(float(max_l_1 - max_l_2)) <= float()) ? 1.0 : + ( == 0 && fabs(float(max_l_1 - max_l_2)) >= float()) ? -1.0 : 0.0) + * + # Filter against the true value of Idx + ((Idx(k) + max_l_1 < Idx(k + 1) && Idx(k) + max_l_2 < Idx(k + 1)) + ? 1.0 : 0.0) + where k in 0:KP1-1, max_l_1 in 0:MAX_L, max_l_2 in 0:MAX_L +} +def make_counts(float(K, MAX_L, MAX_L) Alpha, int32(MAX_L) SegmentsMetaData) + -> (PosCount, NegCount, tmpPos, tmpNeg) +{ + # Triangular compute + # tmp is necessary for reasonable performance with the current mapper + # because we don't yet support 2-D reductions + # Note that in practice, tmp also gives strictly more parallelism and + # allows exploiting 2 levels or thread parallelism (doall and reduction) or + # (in the future when block syncrhonization is supported) 1 level of block + # parallelism without cross-block reductions. + tmpPos(k, max_l_1) +=! (max_l_1 >= r_max_l_2) ? 0.0 : + (Alpha(k, max_l_1, r_max_l_2) > 0.0) ? 1.0 : 0.0 + # TODO: annotation should not be needed + where k in 0:K, max_l_1 in 0:MAX_L, r_max_l_2 in 0:MAX_L + PosCount(k) +=! tmpPos(k, max_l_1) + # TODO: annotation should not be needed + where k in 0:K, max_l_1 in 0:MAX_L + + # Triangular compute + # tmp is necessary because we don't yet support 2-D reductions + # But in practice, tmp also gives strictly more parallelism and allows + # exploiting blocks without cross-block reductions + tmpNeg(k, max_l_1) +=! (max_l_1 >= r_max_l_2) ? 0.0 : + (Alpha(k, max_l_1, r_max_l_2) < 0.0) ? 1.0 : 0.0 + # TODO: annotation should not be needed + where k in 0:K, max_l_1 in 0:MAX_L, r_max_l_2 in 0:MAX_L + NegCount(k) +=! tmpNeg(k, max_l_1) + # TODO: annotation should not be needed + where k in 0:K, max_l_1 in 0:MAX_L +} +def make_beta(float(K, MAX_L, MAX_L) Alpha, + float(K) PosCount, + float(K) NegCount, + int32(MAX_L) SegmentsMetaData) -> (Beta) +{ + Beta(k, max_l_1, max_l_2) = (max_l_1 >= max_l_2) ? 0.0 : + (Alpha(k, max_l_1, max_l_2) == 1.0) ? 1.0 / float(PosCount(k)) : + (Alpha(k, max_l_1, max_l_2) == -1.0) ? -1.0 / float(NegCount(k)) : + 0.0 + # TODO: annotation should not be needed + where k in 0:K, max_l_1 in 0:MAX_L, max_l_2 in 0:MAX_L +} + +def normalize(float(N, C) Input) -> (NormData, Square) { + Square(n) +=! Input(n, r_c) * Input(n, r_c) + NormData(n, c) = Input(n, c) / sqrt(Square(n) + 1e-12) +} +def dots(float(N, C) NormData, int32(KP1) Idx, float(K, MAX_L, MAX_L) Beta) -> (Dots) { + # Triangular compute + Dots(k, max_l_1, max_l_2) +=! (max_l_1 >= max_l_2) ? 0.0 : + # Avoid out of bounds Idx computations + ((Idx(k) + max_l_1 >= Idx(k + 1) || Idx(k) + max_l_2 >= Idx(k + 1)) ? + 0.0 : + NormData(Idx(k) + max_l_1, r_c) * NormData(Idx(k) + max_l_2, r_c)) + # TODO: annotation should not be needed + where k in 0:K, max_l_1 in 0:MAX_L, max_l_2 in 0:MAX_L +} +def result(float(K, MAX_L, MAX_L) Beta, float(K, MAX_L, MAX_L) Dots) -> (O, tmpO) { + # Triangular compute + # tmp is necessary because we don't yet support 2-D reductions + # But in practice, tmp also gives strictly more parallelism and allows + # exploiting blocks without cross-block reductions + tmpO(k, max_l_1) +=! (max_l_1 >= r_max_l_2) ? 0.0 : + Dots(k, max_l_1, r_max_l_2) * Beta(k, max_l_1, r_max_l_2) + O(k) +=! tmpO(k, max_l_1) +} +''' + +############################################################################### +# Implicit compilation and tuning behavior +############################################################################### +tuner_config = ( + tc.TunerConfig() + .threads(args.tuner_threads) + .generations(args.tuner_generations) + .pop_size(args.tuner_pop_size) + .number_elites(args.tuner_number_elites) + .devices(args.tuner_devices)) + +# This function is used for reinforcing tuning +# 1. make_idx is small and does not get tuned or saved, just using naive +# options on it is fine; +# 2. if we find an option in the cache, use it either as is or as starting +# point for reinforcement, depending on whether the entry_point is in the +# reinforcement list; +# 3. dots will benefit from being reinforced a few times (reaching 90us on P100) +reinforce_list = [''] +def generate_options(tc_str: str, + entry_point: str, + *inputs: torch.Tensor) -> tc.MappingOptions: + global reinforce + + # TODO: comment the line below which serves the purpose of not blowing up + # CI time + return tc.make_naive_options_factory()(tc_str, entry_point, *inputs) + + if entry_point == 'make_idx': + return tc.make_naive_options_factory()(tc_str, entry_point, *inputs) + + loaded = tc.make_load_from_cache_options_factory(args.tuner_cache_file)( + tc_str, entry_point, *inputs) + + if loaded is None or entry_point in reinforce_list or '*' in reinforce_list: + start = loaded if loaded is not None else 'naive' + return tc.make_autotuned_options_factory( + starting_options=start, + tuner_config=tuner_config, + cache_filename=args.tuner_cache_file, + store_to_cache=True,)(tc_str, entry_point, *inputs) + + assert loaded is not None, 'None found' + + return loaded + + +############################################################################### +# Define the TC for LENGTHS_COSINE_COHERENCE, use +############################################################################### +TC = tc.define( + (LENGTHS_COSINE_COHERENCE + .replace('', str(args.pos_dist)) + .replace('', str(args.neg_dist))), + generate_options, +) + +############################################################################### +# Run with implicit compilation and tuning +############################################################################### +# Input(N x C) random floats is partitioned into K buckets each of length L(K) +# We then sum within each bucket (with a positive-pair / negative-pair twist) +# This first impl uses the max bucket length and makes the computation dense +InputData = torch.randn( + args.num_segs * args.seg_length, args.num_of_channels, device='cuda') +# Assume all segments of same length for now +Segments = torch.ones(args.num_segs, dtype=torch.int, device='cuda').fill_(args.seg_length) + +Idx = TC.make_idx(Segments) +SegmentsMetaData = torch.ones((torch.max(Segments)[0],), dtype=torch.int, device='cuda') +Alpha = TC.make_alpha(Idx, SegmentsMetaData) +PosCount, NegCount, _1, _2 = TC.make_counts(Alpha, SegmentsMetaData) +Beta = TC.make_beta(Alpha, PosCount, NegCount, SegmentsMetaData) +NormData, Square = TC.normalize(InputData) +Dots = TC.dots(NormData, Idx, Beta) +Output, _ = TC.result(Beta, Dots) + +R, Normed_DATA, Norm_of_Vector, POS_C, NEG_C = ( + reference(InputData.cpu().numpy(), Segments.cpu().numpy())) + +############################################################################### +# Check +############################################################################### +tc.assert_almost_equal( + PosCount.cpu(), + torch.from_numpy(POS_C).float(), + torch.from_numpy(POS_C).float(), + precision=0) +tc.assert_almost_equal( + NegCount.cpu(), + torch.from_numpy(NEG_C).float(), + torch.from_numpy(NEG_C).float(), + precision=0) +tc.assert_almost_equal( + Output.cpu(), + torch.from_numpy(R), + Dots.cpu(), + Beta.cpu(), + operations=SegmentsMetaData.size(0) * (SegmentsMetaData.size(0) + 1) // 2, +) + +print('SUCCESS, maxdiff={}'.format((Output.cpu() - torch.from_numpy(R)).abs().max())) From dcf4d83054ef9526f691877b27634df6b83f2e45 Mon Sep 17 00:00:00 2001 From: Nicolas Vasilache Date: Thu, 12 Jul 2018 14:55:39 -0700 Subject: [PATCH 108/152] Use NO_CUDA_SDK rather than undefine CUDA_HOME This commit starts a series of small cmake and configuration cleanups that will improve things when calling non-NVRTC compilers. The particular cicular change introduced by thi is to allow including `gpu.h` in NO_SDK mode more cleanly. Previously we would unset the variable CUDA_HOME but this is hacky and non intuitive in the light of the `.h.in` configuration file that will be inserted in a subsequent commit. This commit replaces the unsetting by setting a new variable NO_CUDA_SDK. --- tc/core/CMakeLists.txt | 4 ++-- tc/core/gpu.h | 4 ++-- third-party/islpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tc/core/CMakeLists.txt b/tc/core/CMakeLists.txt index efa9c2c04..17919be67 100644 --- a/tc/core/CMakeLists.txt +++ b/tc/core/CMakeLists.txt @@ -120,10 +120,10 @@ add_library( ${TC_CUDA_CROSS_COMPILE_FILES} ) -# Unsets CUDA_HOME to compile without SDK +# Sets NO_CUDA_SDK to compile without SDK set_target_properties(tc_core_cuda_no_sdk PROPERTIES COMPILE_FLAGS - "${CMAKE_CXX_FLAGS} -UCUDA_HOME -Wl,--no-undefined") + "${CMAKE_CXX_FLAGS} -DNO_CUDA_SDK") target_include_directories(tc_core_cuda_no_sdk PUBLIC ${LLVM_INCLUDE_DIRS}) target_link_libraries( tc_core_cuda_no_sdk diff --git a/tc/core/gpu.h b/tc/core/gpu.h index cdacc05a3..a345d3d56 100644 --- a/tc/core/gpu.h +++ b/tc/core/gpu.h @@ -17,7 +17,7 @@ // Conditionally include CUDA-specific headers. This file should compile even // without them. -#ifdef CUDA_HOME +#if defined(CUDA_HOME) #include "tc/core/cuda/cuda.h" #endif @@ -27,7 +27,7 @@ namespace tc { /// The call is forwarded to the appropriate GPU driver (CUDA in particular). /// If a thread has no associated GPU device, return 0. inline size_t querySharedMemorySize() { -#ifdef CUDA_HOME +#if defined(CUDA_HOME) && !defined(NO_CUDA_SDK) return CudaGPUInfo::GPUInfo().SharedMemorySize(); #else return 0; diff --git a/third-party/islpp b/third-party/islpp index adefea12a..f8cf7cf1b 160000 --- a/third-party/islpp +++ b/third-party/islpp @@ -1 +1 @@ -Subproject commit adefea12a80d7c1846342227d85133a10b20261e +Subproject commit f8cf7cf1b0ca606d8adb0b88d60200c4a858d36c From 2d728cc11a01110d274540fadd4af18b2868310a Mon Sep 17 00:00:00 2001 From: Nicolas Vasilache Date: Thu, 12 Jul 2018 14:59:52 -0700 Subject: [PATCH 109/152] Add tc_config.h.in --- CMakeLists.txt | 20 ++++++++++++++------ tc/core/cuda/cuda.h | 14 ++++++++------ tc/core/cuda/cuda_rtc.cc | 6 ++++-- tc/core/gpu.h | 6 ++++-- tc/tc_config.h.in | 27 +++++++++++++++++++++++++++ test/cuda/test_basic_gpu.cc | 5 +++-- test/test_lang.cc | 3 ++- 7 files changed, 62 insertions(+), 19 deletions(-) create mode 100644 tc/tc_config.h.in diff --git a/CMakeLists.txt b/CMakeLists.txt index baa2ddec2..4be3e38f9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -139,9 +139,6 @@ if(WITH_CUDA) find_package(CUDA REQUIRED) include_directories(BEFORE ${CUDA_TOOLKIT_ROOT_DIR}/include) - # modified CUB - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWITH_CUDA -DCUDA_HOME=\"\\\"${CUDA_INCLUDE_DIRS}\\\"\" -DCUB_HOME=\"\\\"${CUB_INSTALL_DIR}\\\"\" ") - # Inherited from Torch, see # https://github.com/torch/cutorch/blob/master/lib/THC/cmake/select_compute_arch.cmake INCLUDE(cmake/select_compute_arch.cmake) @@ -259,6 +256,18 @@ include(cmake/GetGitRevisionDescription.cmake) ################################################################################ # Finally, build ################################################################################ +# Variables for tc_config.h.in +set(TC_DIR ${TC_DIR}) +if (WITH_CUDA) + # CUDA-specific variables for tc_config.h.in + set(TC_WITH_CUDA 1) + set(TC_CUB_INCLUDE_DIR ${CUB_INSTALL_DIR}) + set(TC_CUDA_TOOLKIT_ROOT_DIR ${CUDA_TOOLKIT_ROOT_DIR}) + set(TC_CUDA_INCLUDE_DIR ${CUDA_INCLUDE_DIRS}) +else() + set(TC_WITH_CUDA 0) +endif() +configure_file("tc/tc_config.h.in" "${CMAKE_CURRENT_BINARY_DIR}/tc/tc_config.h") ################################################################################ # Compile flags @@ -281,13 +290,12 @@ elseif(${CMAKE_BUILD_TYPE} MATCHES "Release") endif() message(STATUS "CMAKE_INSTALL_PREFIX is ${CMAKE_INSTALL_PREFIX}") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTC_DIR=\"\\\"${TC_DIR}\\\"\" ") - include_directories(BEFORE ${PROJECT_SOURCE_DIR}) +include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) add_subdirectory(tc) # At the moment pybind is only supported in CUDA mode and compilation fails -# for non-CUDA mode (CUDA_HOME and CUB_HOME undefined error). +# for non-CUDA mode (CUDA_INCLUDE_DIR and CUB_INCLUDE_DIR undefined error). # Once the core CPU mapper is stabilized we can worry about pybind, deactivate # conditionally for now if (WITH_CUDA) diff --git a/tc/core/cuda/cuda.h b/tc/core/cuda/cuda.h index 70406f6a4..a9fe1383a 100644 --- a/tc/core/cuda/cuda.h +++ b/tc/core/cuda/cuda.h @@ -15,13 +15,15 @@ */ #pragma once -#ifndef CUDA_HOME -#error "CUDA_HOME must be defined" -#endif // CUDA_HOME +#include "tc/tc_config.h" -#ifndef CUB_HOME -#error "CUB_HOME must be defined" -#endif // CUB_HOME +#ifndef TC_CUDA_INCLUDE_DIR +#error "TC_CUDA_INCLUDE_DIR must be defined" +#endif // TC_CUDA_INCLUDE_DIR + +#ifndef TC_CUB_INCLUDE_DIR +#error "TC_CUB_INCLUDE_DIR must be defined" +#endif // TC_CUB_INCLUDE_DIR #include #include diff --git a/tc/core/cuda/cuda_rtc.cc b/tc/core/cuda/cuda_rtc.cc index 9ed0ffd1e..80509dcb6 100644 --- a/tc/core/cuda/cuda_rtc.cc +++ b/tc/core/cuda/cuda_rtc.cc @@ -91,8 +91,10 @@ std::unique_ptr CudaRTCFunction::Compile( // Compile the program. const char* nvrtc_debug_opts[] = {"-G", "-lineinfo"}; - std::string cudaHome = std::string("-I ") + std::string(CUDA_HOME); - std::string cubHome = std::string("-I ") + std::string(CUB_HOME); + std::string cudaHome = + std::string("-I ") + std::string(TC_STRINGIFY(TC_CUDA_INCLUDE_DIR)); + std::string cubHome = + std::string("-I ") + std::string(TC_STRINGIFY(TC_CUB_INCLUDE_DIR)); std::vector nvrtcts = {arch.c_str(), "--use_fast_math", "-std=c++11", diff --git a/tc/core/gpu.h b/tc/core/gpu.h index a345d3d56..6846304fd 100644 --- a/tc/core/gpu.h +++ b/tc/core/gpu.h @@ -15,9 +15,11 @@ */ #pragma once +#include "tc/tc_config.h" + // Conditionally include CUDA-specific headers. This file should compile even // without them. -#if defined(CUDA_HOME) +#if TC_WITH_CUDA #include "tc/core/cuda/cuda.h" #endif @@ -27,7 +29,7 @@ namespace tc { /// The call is forwarded to the appropriate GPU driver (CUDA in particular). /// If a thread has no associated GPU device, return 0. inline size_t querySharedMemorySize() { -#if defined(CUDA_HOME) && !defined(NO_CUDA_SDK) +#if TC_WITH_CUDA && !defined(NO_CUDA_SDK) return CudaGPUInfo::GPUInfo().SharedMemorySize(); #else return 0; diff --git a/tc/tc_config.h.in b/tc/tc_config.h.in new file mode 100644 index 000000000..d6125d324 --- /dev/null +++ b/tc/tc_config.h.in @@ -0,0 +1,27 @@ +/** + * Copyright (c) 2017-present, Facebook, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#pragma once + +#define TC_STRINGIFY_INNER(s) #s +#define TC_STRINGIFY(s) TC_STRINGIFY_INNER(s) + +// clang-format off +#define TC_DIR @TC_DIR@ +#define TC_WITH_CUDA @TC_WITH_CUDA@ +#define TC_CUDA_TOOLKIT_ROOT_DIR @TC_CUDA_TOOLKIT_ROOT_DIR@ +#define TC_CUDA_INCLUDE_DIR @TC_CUDA_INCLUDE_DIR@ +#define TC_CUB_INCLUDE_DIR @TC_CUB_INCLUDE_DIR@ +// clang-format on diff --git a/test/cuda/test_basic_gpu.cc b/test/cuda/test_basic_gpu.cc index 2be4e9b88..d2545ff3f 100644 --- a/test/cuda/test_basic_gpu.cc +++ b/test/cuda/test_basic_gpu.cc @@ -51,7 +51,8 @@ std::vector jitCompile( std::string arch = arch_param.str(); // Compile the program. - std::string cudaHome = std::string("-I ") + std::string(CUDA_HOME); + std::string cudaHome = + std::string("-I ") + std::string(TC_STRINGIFY(TC_CUDA_INCLUDE_DIR)); std::vector nvrtcts = {arch.c_str(), "--use_fast_math", "-std=c++11", @@ -116,7 +117,7 @@ __global__ void foo(int N) } TEST(BasicGpuTest, CubReduce) { - std::string path(CUB_HOME); + std::string path(TC_STRINGIFY(TC_CUB_INCLUDE_DIR)); std::string include = std::string("-I ") + path; auto PTX = jitCompile( R"CUDA( diff --git a/test/test_lang.cc b/test/test_lang.cc index c1c2b1902..0dfcfb841 100644 --- a/test/test_lang.cc +++ b/test/test_lang.cc @@ -26,6 +26,7 @@ #include "tc/lang/parser.h" #include "tc/lang/sema.h" #include "tc/lang/tc_format.h" +#include "tc/tc_config.h" using namespace lang; @@ -34,7 +35,7 @@ using namespace lang; #endif const std::string expected_file_path = - std::string(TC_DIR) + "/tc/lang/test_expected/"; + std::string(TC_STRINGIFY(TC_DIR)) + "/tc/lang/test_expected/"; static inline void barf(const char* fmt, ...) { char msg[2048]; From c83c36d0d0a3dbd4a644ace74b514233b84d26b3 Mon Sep 17 00:00:00 2001 From: Nicolas Vasilache Date: Thu, 12 Jul 2018 15:00:58 -0700 Subject: [PATCH 110/152] Stop putting generated protos in source tree The python proto files are useless, they should not be generated. The proto files don't need to be exported to python. The legitimately generated .cc and .h files have no business living in the source tree, put them in the build tree. --- .gitignore | 5 ----- tc/proto/CMakeLists.txt | 8 +------- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index c57028a04..7ce0b55ab 100644 --- a/.gitignore +++ b/.gitignore @@ -3,9 +3,6 @@ __pycache__/ *~ build/* docs/build/* -tc/proto/*.py -tc/proto/*.cc -tc/proto/*.h third-party/*_cache third-party/llvm_sources* third-party-install/* @@ -17,8 +14,6 @@ conda */.nfs* tensor_comprehensions.egg-info/ tensor_comprehensions/version.py -tensor_comprehensions/*.proto -tensor_comprehensions/*_pb2.py slurm-* examples/results* *.pyc diff --git a/tc/proto/CMakeLists.txt b/tc/proto/CMakeLists.txt index 71e37e468..ba3980b93 100644 --- a/tc/proto/CMakeLists.txt +++ b/tc/proto/CMakeLists.txt @@ -58,16 +58,10 @@ function(tc_protobuf_generate_cpp_py output_dir srcs_var hdrs_var python_var) set(${python_var} ${${python_var}} PARENT_SCOPE) endfunction() -tc_protobuf_generate_cpp_py(${PROJECT_SOURCE_DIR}/tc/proto PROTO_SRCS PROTO_HDRS PROTO_PY mapping_options.proto compcache.proto) +tc_protobuf_generate_cpp_py(${CMAKE_CURRENT_BINARY_DIR} PROTO_SRCS PROTO_HDRS PROTO_PY mapping_options.proto compcache.proto) add_library(tc_proto SHARED ${PROTO_SRCS} ${PROTO_HDRS}) target_link_libraries(tc_proto ${PROTOBUF_LIBRARIES}) target_include_directories(tc_proto PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${PROTOBUF_HDRS}) install(TARGETS tc_proto DESTINATION lib) -# "Install" to source_dir/tensor_comprehensions for easy inclusion in python -# package with setuptools. Without this, setuptools is hell. -install(PROGRAMS ${PROTO_PY} - DESTINATION ${PROJECT_SOURCE_DIR}/tensor_comprehensions) -install(PROGRAMS mapping_options.proto compcache.proto - DESTINATION ${PROJECT_SOURCE_DIR}/tensor_comprehensions) From 052a3efb7b81e7709c87f5b685945fca96bd083e Mon Sep 17 00:00:00 2001 From: Nicolas Vasilache Date: Wed, 11 Jul 2018 11:59:58 -0700 Subject: [PATCH 111/152] Generate PTX with LLVM trunk This commit uses trunk clang, llvm-link, opt and llc to emit PTX. --- CMakeLists.txt | 2 + python/tests/test_tc.py | 18 +++- tc/core/cuda/cuda_libraries.h | 5 +- tc/core/cuda/cuda_rtc.cc | 134 +++++++++++++++++++++---- tc/core/cuda/cuda_rtc.h | 2 +- tc/core/flags.cc | 10 ++ tc/core/flags.h | 4 + tc/tc_config.h.in | 1 + tensor_comprehensions/__init__.py | 4 + tensor_comprehensions/pybinds/tclib.cc | 13 +++ 10 files changed, 167 insertions(+), 26 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4be3e38f9..2dd1d46e0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -258,6 +258,8 @@ include(cmake/GetGitRevisionDescription.cmake) ################################################################################ # Variables for tc_config.h.in set(TC_DIR ${TC_DIR}) +execute_process(COMMAND ${CLANG_PREFIX}/bin/llvm-config --bindir OUTPUT_VARIABLE LLVM_BIN_DIR OUTPUT_STRIP_TRAILING_WHITESPACE) +set(TC_LLVM_BIN_DIR ${LLVM_BIN_DIR}) if (WITH_CUDA) # CUDA-specific variables for tc_config.h.in set(TC_WITH_CUDA 1) diff --git a/python/tests/test_tc.py b/python/tests/test_tc.py index 3633f60d6..aecbfc54c 100644 --- a/python/tests/test_tc.py +++ b/python/tests/test_tc.py @@ -59,7 +59,7 @@ def test_mapping_options(self): .outerScheduleFusionStrategy("Preserve3Coincident")) # - # Simple TC example with explicit 'naive' compilation + # Simple TC example with explicit 'naive' compilation with nvrtc (default) # def test_tc(self): A, B = torch.randn(100, device='cuda'), torch.randn(100, device='cuda') @@ -72,6 +72,22 @@ def test_tc(self): C = add(A, B) tc.assert_almost_equal(C, torch.add(A, B), A, B) + # + # Simple TC example with explicit 'naive' compilation with llvm + # + def test_tc_llvm(self): + A, B = torch.randn(100, device='cuda'), torch.randn(100, device='cuda') + tc.cuda_compiler('llvm') + add = tc.compile( + "def add(float(N) A, float(N) B) -> (C) { C(i) = A(i) + B(i) }", + "add", + 'naive', + A, B, + ) + tc.cuda_compiler('nvrtc') + C = add(A, B) + tc.assert_almost_equal(C, torch.add(A, B), A, B) + # # Simple TC example without fallback but with tuning starting from # MappingOptions('naive') diff --git a/tc/core/cuda/cuda_libraries.h b/tc/core/cuda/cuda_libraries.h index d3d54661e..24dad07da 100644 --- a/tc/core/cuda/cuda_libraries.h +++ b/tc/core/cuda/cuda_libraries.h @@ -43,8 +43,9 @@ constexpr auto defines = R"C( constexpr auto warpSyncFunctions = R"C( // Before CUDA 9, syncwarp is a noop since warps are always synchronized. -#if __CUDACC_VER_MAJOR__ < 9 -__device__ void __syncwarp(unsigned mask = 0xFFFFFFFF) {} +#if (!defined(__clang__) && __CUDACC_VER_MAJOR__ < 9) || \ + ( defined(__clang__) && CUDA_VERSION < 9000) +inline __device__ void __syncwarp(unsigned mask = 0xFFFFFFFF) {} #endif )C"; diff --git a/tc/core/cuda/cuda_rtc.cc b/tc/core/cuda/cuda_rtc.cc index 80509dcb6..a43735108 100644 --- a/tc/core/cuda/cuda_rtc.cc +++ b/tc/core/cuda/cuda_rtc.cc @@ -13,6 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#include +#include +#include +#include #include #include #include @@ -60,23 +64,9 @@ void checkOrCreateContext() { } } -std::unique_ptr CudaRTCFunction::Compile( - const std::string& name, - const std::string& source) { - std::unique_ptr res(new CudaRTCFunction()); - res->specializedName = name; - res->cleared_ = false; - - if (FLAGS_debug_tc_mapper) { - LOG(INFO) << "NVRTC function source:\n" << source; - } - // Actually do the compiling. - nvrtcProgram prog; - TC_NVRTC_CHECK( - nvrtcCreateProgram(&prog, source.c_str(), nullptr, 0, nullptr, nullptr)); - - // Get the architecture of the current device. - int device, minor, major; +namespace { +static std::tuple getCudaArchitecture() { + int device, major, minor; CUdevice deviceHandle; TC_CUDA_RUNTIMEAPI_ENFORCE(cudaGetDevice(&device)); TC_CUDA_DRIVERAPI_ENFORCE(cuDeviceGet(&deviceHandle, device)); @@ -84,6 +74,79 @@ std::unique_ptr CudaRTCFunction::Compile( &major, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, deviceHandle)); TC_CUDA_DRIVERAPI_ENFORCE(cuDeviceGetAttribute( &minor, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR, deviceHandle)); + return std::tuple(device, major, minor); +} + +static std::string llvmCompile( + const std::string& name, + const std::string& source) { + int device, major, minor; + std::tie(device, major, minor) = getCudaArchitecture(); + + std::string pat("/tmp/cudaXXXXXX"); + std::vector ifn(pat.begin(), pat.end()); + TC_CHECK_GE(mkstemp(ifn.data()), 0); // string.c_str is const char* + std::string inputFileName(ifn.begin(), ifn.end()); + // cstdio's std::remove to delete files + tc::ScopeGuard sgi([&]() { std::remove(inputFileName.c_str()); }); + { + std::ofstream ostream(inputFileName, std::ios::binary); + ostream << source; + } + + std::string arch = "sm_" + std::to_string(major) + std::to_string(minor); + std::string outputClangFile = inputFileName + "-clang.ll"; + std::string outputLinkFile = inputFileName + "-link.ll"; + std::string outputOptFile = inputFileName + "-opt.ll"; + std::string outputPtxFile = inputFileName + ".s"; + tc::ScopeGuard sgo([&]() { + // cstdio's std::remove to delete files + std::remove(outputClangFile.c_str()); + std::remove(outputLinkFile.c_str()); + std::remove(outputOptFile.c_str()); + std::remove(outputPtxFile.c_str()); + }); + + std::string cmdLlvmIr = std::string(TC_STRINGIFY(TC_LLVM_BIN_DIR)) + + "/clang++ -x cuda " + inputFileName + " " + "--cuda-device-only " + + "--cuda-gpu-arch=" + arch + " " + + "--cuda-path=" + TC_STRINGIFY(TC_CUDA_TOOLKIT_ROOT_DIR) + " " + "-I" + + TC_STRINGIFY(TC_CUDA_INCLUDE_DIR) + " " + "-I" + + TC_STRINGIFY(TC_CUB_INCLUDE_DIR) + " " + tc::FLAGS_llvm_flags + + " -DNVRTC_CUB=1 " + "-nocudalib -S -emit-llvm " + "-o " + + outputClangFile; + TC_CHECK_EQ(std::system(cmdLlvmIr.c_str()), 0) << cmdLlvmIr; + + std::string cmdLlvmLink = std::string(TC_STRINGIFY(TC_LLVM_BIN_DIR)) + + "/llvm-link " + outputClangFile + " " + + TC_STRINGIFY(TC_CUDA_TOOLKIT_ROOT_DIR) + + "/nvvm/libdevice/libdevice.*.bc " + "-S -o " + outputLinkFile; + TC_CHECK_EQ(std::system(cmdLlvmLink.c_str()), 0) << cmdLlvmLink; + + std::string cmdOpt = std::string(TC_STRINGIFY(TC_LLVM_BIN_DIR)) + "/opt " + + "-internalize -internalize-public-api-list=" + name + " " + + "-nvvm-reflect -O3 " + outputLinkFile + " -S -o " + outputOptFile; + TC_CHECK_EQ(std::system(cmdOpt.c_str()), 0) << cmdOpt; + + std::string cmdPtx = std::string(TC_STRINGIFY(TC_LLVM_BIN_DIR)) + + "/llc -mcpu=" + arch + " " + outputOptFile + " -o " + outputPtxFile; + TC_CHECK_EQ(std::system(cmdPtx.c_str()), 0) << cmdPtx; + + std::ifstream stream(outputPtxFile); + return std::string( + (std::istreambuf_iterator(stream)), + std::istreambuf_iterator()); +} + +static std::string nvrtcCompile( + const std::string& name, + const std::string& source) { + int device, major, minor; + std::tie(device, major, minor) = getCudaArchitecture(); + + nvrtcProgram prog; + TC_NVRTC_CHECK( + nvrtcCreateProgram(&prog, source.c_str(), nullptr, 0, nullptr, nullptr)); std::stringstream arch_param; arch_param << "--gpu-architecture=compute_" << major << minor; @@ -125,14 +188,38 @@ std::unique_ptr CudaRTCFunction::Compile( } size_t ptx_size; TC_NVRTC_CHECK(nvrtcGetPTXSize(prog, &ptx_size)); - res->nvrtc_ptx = std::vector(ptx_size); - TC_NVRTC_CHECK(nvrtcGetPTX(prog, res->nvrtc_ptx.data())); + std::vector res(ptx_size); + TC_NVRTC_CHECK(nvrtcGetPTX(prog, res.data())); TC_NVRTC_CHECK(nvrtcDestroyProgram(&prog)); + return std::string(res.begin(), res.end()); +} +} // namespace + +std::unique_ptr CudaRTCFunction::Compile( + const std::string& name, + const std::string& source) { + std::unique_ptr res(new CudaRTCFunction()); + res->specializedName = name; + res->cleared_ = false; + if (FLAGS_debug_tc_mapper) { + LOG(INFO) << "NVRTC function source:\n" << source; + } + if (FLAGS_cuda_compiler == "nvrtc") { + res->ptx = nvrtcCompile(name, source); + } else if (FLAGS_cuda_compiler == "llvm") { + res->ptx = llvmCompile(name, source); + } else if (FLAGS_cuda_compiler == "nvcc") { + CHECK(false) << "NYI"; + // res->ptx = llvmCompile(name, source); + } else { + CHECK(false) << "Unknown CUDA compiler: " << FLAGS_cuda_compiler; + } if (FLAGS_dump_ptx) { - LOG(INFO) << "PTX:\n" << std::string(res->nvrtc_ptx.data()); + LOG(INFO) << "PTX:\n" << res->ptx; } return res; } + namespace { template @@ -164,8 +251,11 @@ Duration CudaRTCFunction::Launch( // This call to cudaDeviceSynchronize implicitly creates a new context if // one is not bound to the current CPU. checkOrCreateContext(); - TC_CUDA_DRIVERAPI_ENFORCE( - cuModuleLoadDataEx(&module, nvrtc_ptx.data(), 0, 0, 0)); + auto res = cuModuleLoadData(&module, ptx.c_str()); + if (res != CUDA_SUCCESS) { + LOG(ERROR) << "Invalid PTX: " << ptx; + } + TC_CUDA_DRIVERAPI_ENFORCE(res); perGpuModule_.emplace(dev, module); TC_CUDA_DRIVERAPI_ENFORCE( cuModuleGetFunction(&function, module, specializedName.c_str())); diff --git a/tc/core/cuda/cuda_rtc.h b/tc/core/cuda/cuda_rtc.h index 4aa5e831f..9363f8a86 100644 --- a/tc/core/cuda/cuda_rtc.h +++ b/tc/core/cuda/cuda_rtc.h @@ -65,7 +65,7 @@ class CudaRTCFunction { mutable std::unordered_map perGpuModule_; mutable std::unordered_map perGpuKernel_; std::string specializedName; - std::vector nvrtc_ptx; + std::string ptx; bool cleared_; }; diff --git a/tc/core/flags.cc b/tc/core/flags.cc index 9942a3732..7ef10fa5c 100644 --- a/tc/core/flags.cc +++ b/tc/core/flags.cc @@ -38,6 +38,16 @@ DEFINE_bool( DEFINE_bool(dump_cuda, false, "Print the generated source"); DEFINE_bool(dump_ptx, false, "Dump the generated PTX"); +// PTX generation +DEFINE_string( + cuda_compiler, + "nvrtc", + "which compiler to use to emit ptx: nvrtc, llvm, nvcc (default [nvrtc])"); +DEFINE_string( + llvm_flags, + "-std=c++11 -O3 -ffast-math", + "compiler flags to set when llvm is used"); + // CPU codegen options DEFINE_bool(llvm_dump_before_opt, false, "Print IR before optimization"); DEFINE_bool(llvm_dump_after_opt, false, "Print IR after optimization"); diff --git a/tc/core/flags.h b/tc/core/flags.h index c748759a4..786059fe2 100644 --- a/tc/core/flags.h +++ b/tc/core/flags.h @@ -31,6 +31,10 @@ DECLARE_bool(debug_tuner); DECLARE_bool(dump_cuda); DECLARE_bool(dump_ptx); +// ptx generation +DECLARE_string(cuda_compiler); +DECLARE_string(llvm_flags); + // llvm codegen DECLARE_bool(llvm_dump_before_opt); DECLARE_bool(llvm_dump_after_opt); diff --git a/tc/tc_config.h.in b/tc/tc_config.h.in index d6125d324..4eba10fe3 100644 --- a/tc/tc_config.h.in +++ b/tc/tc_config.h.in @@ -24,4 +24,5 @@ #define TC_CUDA_TOOLKIT_ROOT_DIR @TC_CUDA_TOOLKIT_ROOT_DIR@ #define TC_CUDA_INCLUDE_DIR @TC_CUDA_INCLUDE_DIR@ #define TC_CUB_INCLUDE_DIR @TC_CUB_INCLUDE_DIR@ +#define TC_LLVM_BIN_DIR @TC_LLVM_BIN_DIR@ // clang-format on diff --git a/tensor_comprehensions/__init__.py b/tensor_comprehensions/__init__.py index 7103b7153..6d65e4ce2 100644 --- a/tensor_comprehensions/__init__.py +++ b/tensor_comprehensions/__init__.py @@ -29,6 +29,8 @@ from tensor_comprehensions.tclib import debug_tuner from tensor_comprehensions.tclib import dump_cuda from tensor_comprehensions.tclib import dump_ptx +from tensor_comprehensions.tclib import cuda_compiler +from tensor_comprehensions.tclib import llvm_flags from tensor_comprehensions.tclib import CompilationCache from tensor_comprehensions.tclib import MappingOptions @@ -606,6 +608,8 @@ def make_autograd(forward_fun: Callable[[Iterable[torch.Tensor]], Iterable[torch 'debug_tuner', 'dump_cuda', 'dump_ptx', + 'cuda_compiler', + 'llvm_flags', # Functions exposed by the tclib 'compile', 'autotune', diff --git a/tensor_comprehensions/pybinds/tclib.cc b/tensor_comprehensions/pybinds/tclib.cc index 82e759903..31172a9bf 100644 --- a/tensor_comprehensions/pybinds/tclib.cc +++ b/tensor_comprehensions/pybinds/tclib.cc @@ -439,6 +439,19 @@ PYBIND11_MODULE(tclib, m) { }); m.def("dump_cuda", [](bool dump_cuda) { tc::FLAGS_dump_cuda = dump_cuda; }); m.def("dump_ptx", [](bool dump_ptx) { tc::FLAGS_dump_ptx = dump_ptx; }); + m.def( + "cuda_compiler", + [](const std::string& cuda_compiler) { + tc::FLAGS_cuda_compiler = cuda_compiler; + }, + gflags::DescribeOneFlag( + gflags::GetCommandLineFlagInfoOrDie("cuda_compiler")) + .c_str()); + m.def( + "llvm_flags", + [](const std::string& llvm_flags) { tc::FLAGS_llvm_flags = llvm_flags; }, + gflags::DescribeOneFlag(gflags::GetCommandLineFlagInfoOrDie("llvm_flags")) + .c_str()); // Access the names of the defs in a TC string m.def("parse_defs", [](const std::string& tc) { From ecd85a193b10541ed1761dae8f6320d9a1899891 Mon Sep 17 00:00:00 2001 From: Nicolas Vasilache Date: Wed, 11 Jul 2018 20:12:07 -0700 Subject: [PATCH 112/152] Generate PTX with NVCC This commit allows using NVCC to emit PTX. --- python/tests/test_tc.py | 18 ++++++++++++ tc/core/cuda/cuda_rtc.cc | 38 ++++++++++++++++++++++++-- tc/core/flags.cc | 4 +++ tc/core/flags.h | 1 + tensor_comprehensions/__init__.py | 2 ++ tensor_comprehensions/pybinds/tclib.cc | 5 ++++ 6 files changed, 66 insertions(+), 2 deletions(-) diff --git a/python/tests/test_tc.py b/python/tests/test_tc.py index aecbfc54c..0fd546f00 100644 --- a/python/tests/test_tc.py +++ b/python/tests/test_tc.py @@ -84,6 +84,24 @@ def test_tc_llvm(self): 'naive', A, B, ) + # Reset the cuda compiler back to nvrtc + tc.cuda_compiler('nvrtc') + C = add(A, B) + tc.assert_almost_equal(C, torch.add(A, B), A, B) + + # + # Simple TC example with explicit 'naive' compilation with nvcc + # + def test_tc_nvcc(self): + A, B = torch.randn(100, device='cuda'), torch.randn(100, device='cuda') + tc.cuda_compiler('nvcc') + add = tc.compile( + "def add(float(N) A, float(N) B) -> (C) { C(i) = A(i) + B(i) }", + "add", + 'naive', + A, B, + ) + # Reset the cuda compiler back to nvrtc tc.cuda_compiler('nvrtc') C = add(A, B) tc.assert_almost_equal(C, torch.add(A, B), A, B) diff --git a/tc/core/cuda/cuda_rtc.cc b/tc/core/cuda/cuda_rtc.cc index a43735108..99b3025d6 100644 --- a/tc/core/cuda/cuda_rtc.cc +++ b/tc/core/cuda/cuda_rtc.cc @@ -138,6 +138,41 @@ static std::string llvmCompile( std::istreambuf_iterator()); } +static std::string nvccCompile( + const std::string& name, + const std::string& source) { + int device, major, minor; + std::tie(device, major, minor) = getCudaArchitecture(); + + std::string pat("/tmp/cudaXXXXXX"); + std::vector ifn(pat.begin(), pat.end()); + TC_CHECK_GE(mkstemp(ifn.data()), 0); // string.c_str is const char* + std::string inputFileName(ifn.begin(), ifn.end()); + // cstdio's std::remove to delete files + tc::ScopeGuard sgi([&]() { std::remove(inputFileName.c_str()); }); + { + std::ofstream ostream(inputFileName, std::ios::binary); + ostream << source; + } + + std::string arch = "sm_" + std::to_string(major) + std::to_string(minor); + std::string outputPtxFile = inputFileName + ".ptx"; + // cstdio's std::remove to delete files + tc::ScopeGuard sgo([&]() { std::remove(outputPtxFile.c_str()); }); + + std::string cmdPtx = std::string(TC_STRINGIFY(TC_CUDA_TOOLKIT_ROOT_DIR)) + + "/bin/nvcc -x cu " + inputFileName + " --gpu-architecture=" + arch + " " + + "--ptx " + "-I" + TC_STRINGIFY(TC_CUDA_INCLUDE_DIR) + " " + "-I" + + TC_STRINGIFY(TC_CUB_INCLUDE_DIR) + " " + tc::FLAGS_nvcc_flags + " -o " + + outputPtxFile; + TC_CHECK_EQ(std::system(cmdPtx.c_str()), 0) << cmdPtx; + + std::ifstream stream(outputPtxFile); + return std::string( + (std::istreambuf_iterator(stream)), + std::istreambuf_iterator()); +} + static std::string nvrtcCompile( const std::string& name, const std::string& source) { @@ -209,8 +244,7 @@ std::unique_ptr CudaRTCFunction::Compile( } else if (FLAGS_cuda_compiler == "llvm") { res->ptx = llvmCompile(name, source); } else if (FLAGS_cuda_compiler == "nvcc") { - CHECK(false) << "NYI"; - // res->ptx = llvmCompile(name, source); + res->ptx = nvccCompile(name, source); } else { CHECK(false) << "Unknown CUDA compiler: " << FLAGS_cuda_compiler; } diff --git a/tc/core/flags.cc b/tc/core/flags.cc index 7ef10fa5c..ea26d2ab0 100644 --- a/tc/core/flags.cc +++ b/tc/core/flags.cc @@ -47,6 +47,10 @@ DEFINE_string( llvm_flags, "-std=c++11 -O3 -ffast-math", "compiler flags to set when llvm is used"); +DEFINE_string( + nvcc_flags, + "-std=c++11 -ptx -DNVRTC_CUB=1 --use_fast_math", + "compiler flags to set when nvcc is used"); // CPU codegen options DEFINE_bool(llvm_dump_before_opt, false, "Print IR before optimization"); diff --git a/tc/core/flags.h b/tc/core/flags.h index 786059fe2..38739a2da 100644 --- a/tc/core/flags.h +++ b/tc/core/flags.h @@ -34,6 +34,7 @@ DECLARE_bool(dump_ptx); // ptx generation DECLARE_string(cuda_compiler); DECLARE_string(llvm_flags); +DECLARE_string(nvcc_flags); // llvm codegen DECLARE_bool(llvm_dump_before_opt); diff --git a/tensor_comprehensions/__init__.py b/tensor_comprehensions/__init__.py index 6d65e4ce2..ddd755876 100644 --- a/tensor_comprehensions/__init__.py +++ b/tensor_comprehensions/__init__.py @@ -31,6 +31,7 @@ from tensor_comprehensions.tclib import dump_ptx from tensor_comprehensions.tclib import cuda_compiler from tensor_comprehensions.tclib import llvm_flags +from tensor_comprehensions.tclib import nvcc_flags from tensor_comprehensions.tclib import CompilationCache from tensor_comprehensions.tclib import MappingOptions @@ -610,6 +611,7 @@ def make_autograd(forward_fun: Callable[[Iterable[torch.Tensor]], Iterable[torch 'dump_ptx', 'cuda_compiler', 'llvm_flags', + 'nvcc_flags', # Functions exposed by the tclib 'compile', 'autotune', diff --git a/tensor_comprehensions/pybinds/tclib.cc b/tensor_comprehensions/pybinds/tclib.cc index 31172a9bf..a18fb4ca7 100644 --- a/tensor_comprehensions/pybinds/tclib.cc +++ b/tensor_comprehensions/pybinds/tclib.cc @@ -452,6 +452,11 @@ PYBIND11_MODULE(tclib, m) { [](const std::string& llvm_flags) { tc::FLAGS_llvm_flags = llvm_flags; }, gflags::DescribeOneFlag(gflags::GetCommandLineFlagInfoOrDie("llvm_flags")) .c_str()); + m.def( + "nvcc_flags", + [](const std::string& nvcc_flags) { tc::FLAGS_nvcc_flags = nvcc_flags; }, + gflags::DescribeOneFlag(gflags::GetCommandLineFlagInfoOrDie("nvcc_flags")) + .c_str()); // Access the names of the defs in a TC string m.def("parse_defs", [](const std::string& tc) { From 4e37c4d5d1e643e40ed805d167ae9fe89bd444ae Mon Sep 17 00:00:00 2001 From: Nicolas Vasilache Date: Tue, 24 Jul 2018 01:37:11 -0700 Subject: [PATCH 113/152] Factor out system calls Introduce checkedSystem function that builds a string argument for an std::system call and checks if the call was successfull. --- tc/core/cuda/cuda_rtc.cc | 93 +++++++++++++++++++++++++++------------- 1 file changed, 63 insertions(+), 30 deletions(-) diff --git a/tc/core/cuda/cuda_rtc.cc b/tc/core/cuda/cuda_rtc.cc index 99b3025d6..1b76c2823 100644 --- a/tc/core/cuda/cuda_rtc.cc +++ b/tc/core/cuda/cuda_rtc.cc @@ -65,6 +65,17 @@ void checkOrCreateContext() { } namespace { +static void checkedSystemCall( + const std::string& cmd, + const std::vector& args) { + std::stringstream command; + command << cmd << " "; + for (const auto& s : args) { + command << s << " "; + } + TC_CHECK_EQ(std::system(command.str().c_str()), 0) << command.str(); +} + static std::tuple getCudaArchitecture() { int device, major, minor; CUdevice deviceHandle; @@ -107,30 +118,48 @@ static std::string llvmCompile( std::remove(outputPtxFile.c_str()); }); - std::string cmdLlvmIr = std::string(TC_STRINGIFY(TC_LLVM_BIN_DIR)) + - "/clang++ -x cuda " + inputFileName + " " + "--cuda-device-only " + - "--cuda-gpu-arch=" + arch + " " + - "--cuda-path=" + TC_STRINGIFY(TC_CUDA_TOOLKIT_ROOT_DIR) + " " + "-I" + - TC_STRINGIFY(TC_CUDA_INCLUDE_DIR) + " " + "-I" + - TC_STRINGIFY(TC_CUB_INCLUDE_DIR) + " " + tc::FLAGS_llvm_flags + - " -DNVRTC_CUB=1 " + "-nocudalib -S -emit-llvm " + "-o " + - outputClangFile; - TC_CHECK_EQ(std::system(cmdLlvmIr.c_str()), 0) << cmdLlvmIr; - - std::string cmdLlvmLink = std::string(TC_STRINGIFY(TC_LLVM_BIN_DIR)) + - "/llvm-link " + outputClangFile + " " + - TC_STRINGIFY(TC_CUDA_TOOLKIT_ROOT_DIR) + - "/nvvm/libdevice/libdevice.*.bc " + "-S -o " + outputLinkFile; - TC_CHECK_EQ(std::system(cmdLlvmLink.c_str()), 0) << cmdLlvmLink; - - std::string cmdOpt = std::string(TC_STRINGIFY(TC_LLVM_BIN_DIR)) + "/opt " + - "-internalize -internalize-public-api-list=" + name + " " + - "-nvvm-reflect -O3 " + outputLinkFile + " -S -o " + outputOptFile; - TC_CHECK_EQ(std::system(cmdOpt.c_str()), 0) << cmdOpt; - - std::string cmdPtx = std::string(TC_STRINGIFY(TC_LLVM_BIN_DIR)) + - "/llc -mcpu=" + arch + " " + outputOptFile + " -o " + outputPtxFile; - TC_CHECK_EQ(std::system(cmdPtx.c_str()), 0) << cmdPtx; + // Compile + checkedSystemCall( + std::string(TC_STRINGIFY(TC_LLVM_BIN_DIR)) + "/clang++", + {"-x cuda " + inputFileName, + "--cuda-device-only", + std::string("--cuda-gpu-arch=") + arch, + std::string("--cuda-path=") + TC_STRINGIFY(TC_CUDA_TOOLKIT_ROOT_DIR), + std::string("-I") + TC_STRINGIFY(TC_CUDA_INCLUDE_DIR), + std::string("-I") + TC_STRINGIFY(TC_CUB_INCLUDE_DIR), + tc::FLAGS_llvm_flags, + "-DNVRTC_CUB=1", + "-nocudalib", + "-S", + "-emit-llvm", + "-o " + outputClangFile}); + + // Link libdevice before opt + checkedSystemCall( + std::string(TC_STRINGIFY(TC_LLVM_BIN_DIR)) + "/llvm-link ", + {outputClangFile, + std::string(TC_STRINGIFY(TC_CUDA_TOOLKIT_ROOT_DIR)) + + "/nvvm/libdevice/libdevice.*.bc", + "-S", + "-o " + outputLinkFile}); + + // Opt + checkedSystemCall( + std::string(TC_STRINGIFY(TC_LLVM_BIN_DIR)) + "/opt", + {"-internalize", + std::string("-internalize-public-api-list=") + name, + "-nvvm-reflect", + "-O3", + outputLinkFile, + "-S", + std::string("-o ") + outputOptFile}); + + // Ptx + checkedSystemCall( + std::string(TC_STRINGIFY(TC_LLVM_BIN_DIR)) + "/llc", + {std::string("-mcpu=") + arch, + outputOptFile, + std::string("-o ") + outputPtxFile}); std::ifstream stream(outputPtxFile); return std::string( @@ -160,12 +189,16 @@ static std::string nvccCompile( // cstdio's std::remove to delete files tc::ScopeGuard sgo([&]() { std::remove(outputPtxFile.c_str()); }); - std::string cmdPtx = std::string(TC_STRINGIFY(TC_CUDA_TOOLKIT_ROOT_DIR)) + - "/bin/nvcc -x cu " + inputFileName + " --gpu-architecture=" + arch + " " + - "--ptx " + "-I" + TC_STRINGIFY(TC_CUDA_INCLUDE_DIR) + " " + "-I" + - TC_STRINGIFY(TC_CUB_INCLUDE_DIR) + " " + tc::FLAGS_nvcc_flags + " -o " + - outputPtxFile; - TC_CHECK_EQ(std::system(cmdPtx.c_str()), 0) << cmdPtx; + checkedSystemCall( + std::string(TC_STRINGIFY(TC_CUDA_TOOLKIT_ROOT_DIR)) + "/bin/nvcc", + {"-x cu", + inputFileName, + std::string("--gpu-architecture=") + arch, + "--ptx", + std::string("-I") + TC_STRINGIFY(TC_CUDA_INCLUDE_DIR), + std::string("-I") + TC_STRINGIFY(TC_CUB_INCLUDE_DIR), + tc::FLAGS_nvcc_flags, + std::string("-o ") + outputPtxFile}); std::ifstream stream(outputPtxFile); return std::string( From a1b6cc662ab69f2163f0db02044953366ac44ca5 Mon Sep 17 00:00:00 2001 From: Nicolas Vasilache Date: Tue, 24 Jul 2018 02:42:03 -0700 Subject: [PATCH 114/152] Drop NVRTC_CUB in non-RTC paths There is no need to use modified CUB in nvcc or LLVM paths because, unlike NVRTC, they can include system headers that the regular CUB depends upon. --- tc/core/cuda/cuda_libraries.h | 9 ++++++++- tc/core/cuda/cuda_rtc.cc | 1 - tc/core/flags.cc | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/tc/core/cuda/cuda_libraries.h b/tc/core/cuda/cuda_libraries.h index 24dad07da..fe35ff15a 100644 --- a/tc/core/cuda/cuda_libraries.h +++ b/tc/core/cuda/cuda_libraries.h @@ -31,9 +31,11 @@ namespace code { namespace c { constexpr auto types = R"C( +#ifndef __CUDACC_RTC__ // Can't include system dependencies with NVRTC // Can't include cuda_fp16.h with NVRTC due to transitive system dependencies -// #include +#include +#endif )C"; constexpr auto defines = R"C( @@ -211,7 +213,12 @@ struct SegmentedReducer { constexpr auto cubBlockReduce = R"CUDA( +#if __CUDACC_RTC__ #include "cub/nvrtc_cub.cuh" +#else +#include +#include "cub/cub.cuh" +#endif namespace __tc { diff --git a/tc/core/cuda/cuda_rtc.cc b/tc/core/cuda/cuda_rtc.cc index 1b76c2823..9121704da 100644 --- a/tc/core/cuda/cuda_rtc.cc +++ b/tc/core/cuda/cuda_rtc.cc @@ -128,7 +128,6 @@ static std::string llvmCompile( std::string("-I") + TC_STRINGIFY(TC_CUDA_INCLUDE_DIR), std::string("-I") + TC_STRINGIFY(TC_CUB_INCLUDE_DIR), tc::FLAGS_llvm_flags, - "-DNVRTC_CUB=1", "-nocudalib", "-S", "-emit-llvm", diff --git a/tc/core/flags.cc b/tc/core/flags.cc index ea26d2ab0..a5dc9e438 100644 --- a/tc/core/flags.cc +++ b/tc/core/flags.cc @@ -49,7 +49,7 @@ DEFINE_string( "compiler flags to set when llvm is used"); DEFINE_string( nvcc_flags, - "-std=c++11 -ptx -DNVRTC_CUB=1 --use_fast_math", + "-std=c++11 -ptx --use_fast_math", "compiler flags to set when nvcc is used"); // CPU codegen options From 5c00a16a93302fa181fddbea7d22025eee1c3e42 Mon Sep 17 00:00:00 2001 From: Nicolas Vasilache Date: Tue, 24 Jul 2018 02:43:04 -0700 Subject: [PATCH 115/152] cuda libraries: fix operator precedence issue in macro --- tc/core/cuda/cuda_libraries.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tc/core/cuda/cuda_libraries.h b/tc/core/cuda/cuda_libraries.h index fe35ff15a..217d275f9 100644 --- a/tc/core/cuda/cuda_libraries.h +++ b/tc/core/cuda/cuda_libraries.h @@ -240,7 +240,7 @@ inline __device__ void CubReduceAlongXPowerOf2(T* dest, T val) { } #define POWEROF2(X) \ - ((X) & ((X) - 1) == 0) + (((X) & ((X) - 1)) == 0) template inline __device__ void CubReduceAlongX(T* dest, T val) { From 7fafcc13e0eaa409c82d56e591f25e6d06940bbd Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Wed, 25 Jul 2018 10:50:37 +0200 Subject: [PATCH 116/152] revert rewind of isl submodule For some reason, dcf4d8305 (Use NO_CUDA_SDK rather than undefine CUDA_HOME, Thu Jul 12 14:55:39 2018 -0700) rewinds the isl submodule, breaking compilation (when building with WITH_BINDINGS). Revert to the original state. --- third-party/islpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third-party/islpp b/third-party/islpp index f8cf7cf1b..adefea12a 160000 --- a/third-party/islpp +++ b/third-party/islpp @@ -1 +1 @@ -Subproject commit f8cf7cf1b0ca606d8adb0b88d60200c4a858d36c +Subproject commit adefea12a80d7c1846342227d85133a10b20261e From 0169dd7e8825b62a7aaf130a67c49bc8e66aff5a Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Wed, 25 Jul 2018 10:58:24 +0200 Subject: [PATCH 117/152] accessSubscriptsAreUnrolledLoops: use isl::space::add_unnamed_tuple_ui Using isl::space::add_unnamed_tuple_ui is a more natural way of achieving the effect of the original code (which was written before isl::space::add_unnamed_tuple_ui was made available). --- tc/core/polyhedral/cuda/memory_promotion_heuristic.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc b/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc index 4888f9e03..600b67d6a 100644 --- a/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc +++ b/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc @@ -329,8 +329,8 @@ bool accessSubscriptsAreUnrolledLoops( } } - auto space = isl::space(leaf->ctx_, 0, unrolledDims.size()) - .align_params(subdomain.get_space()); + auto space = + subdomain.get_space().add_unnamed_tuple_ui(unrolledDims.size()); auto unrolledDimsMupa = isl::multi_union_pw_aff(space, unrolledDims); // It is possible that no loops are unrolled, in which case From 7ecfcc2e4a95feb7c664b2d3a7fa74e7d568e5c9 Mon Sep 17 00:00:00 2001 From: Nicolas Vasilache Date: Wed, 25 Jul 2018 04:29:11 -0700 Subject: [PATCH 118/152] Namespace cpu::MappedScop to avoid collisions @ftynse reported segfaults due to improper namespacing. Isolate the cpu MappedScop in its own namespace. --- tc/core/polyhedral/cpu/mapped_scop.cc | 2 ++ tc/core/polyhedral/cpu/mapped_scop.h | 3 +++ test/test_mapper_llvm.cc | 10 +++++----- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/tc/core/polyhedral/cpu/mapped_scop.cc b/tc/core/polyhedral/cpu/mapped_scop.cc index 0cd677f10..a44d89923 100644 --- a/tc/core/polyhedral/cpu/mapped_scop.cc +++ b/tc/core/polyhedral/cpu/mapped_scop.cc @@ -37,6 +37,7 @@ namespace tc { namespace polyhedral { +namespace cpu { std::unique_ptr MappedScop::codegen( const std::string& specializedName) const { @@ -89,5 +90,6 @@ std::unique_ptr MappedScop::makeSequential( return mappedScop; } +} // namespace cpu } // namespace polyhedral } // namespace tc diff --git a/tc/core/polyhedral/cpu/mapped_scop.h b/tc/core/polyhedral/cpu/mapped_scop.h index bf42770b2..9a41e0765 100644 --- a/tc/core/polyhedral/cpu/mapped_scop.h +++ b/tc/core/polyhedral/cpu/mapped_scop.h @@ -29,6 +29,7 @@ namespace tc { namespace polyhedral { +namespace cpu { class MappedScop { private: @@ -70,5 +71,7 @@ class MappedScop { public: const uint64_t unroll; }; + +} // namespace cpu } // namespace polyhedral } // namespace tc diff --git a/test/test_mapper_llvm.cc b/test/test_mapper_llvm.cc index f50227260..4e14ab45e 100644 --- a/test/test_mapper_llvm.cc +++ b/test/test_mapper_llvm.cc @@ -48,7 +48,7 @@ def fun(float(N, M) A, float(N, M) B) -> (C) { auto ctx = isl::with_exceptions::globalIslCtx(); auto scop = polyhedral::Scop::makeScop(ctx, tc); scop = Scop::makeSpecializedScop(*scop, {{"N", N}, {"M", M}}); - auto mscop = MappedScop::makeSequential( + auto mscop = cpu::MappedScop::makeSequential( std::move(scop), CpuMappingOptions::makeNaiveMappingOptions()); auto pJit = mscop->codegen("kernel_anon"); auto fptr = reinterpret_cast( @@ -89,7 +89,7 @@ TEST(LLVMCodegen, MultiStmt) { auto scop = polyhedral::Scop::makeScop(ctx, tc); scop = Scop::makeSpecializedScop( *scop, {{"N", N}, {"M", M}, {"K", K}, {"L", L}}); - auto mscop = MappedScop::makeSequential( + auto mscop = cpu::MappedScop::makeSequential( std::move(scop), CpuMappingOptions::makeNaiveMappingOptions()); auto pJit = mscop->codegen("kernel_anon"); auto fptr = reinterpret_cast (Z) { auto scop = polyhedral::Scop::makeScop(ctx, tc); scop = Scop::makeSpecializedScop( *scop, {{"N", N}, {"M", M}, {"K", K}, {"B", B}}); - auto mscop = MappedScop::makeSequential( + auto mscop = cpu::MappedScop::makeSequential( std::move(scop), CpuMappingOptions::makeNaiveMappingOptions()); auto pJit = mscop->codegen("batch_matmul"); auto fptr = @@ -220,7 +220,7 @@ def convolution(float(N,C,H,W) I, float(O,C,KH,KW) W1, float(O) B) -> (tmp, O1) {"W", W}, {"KW", KW}, {"C", C}}); - auto mscop = MappedScop::makeSequential( + auto mscop = cpu::MappedScop::makeSequential( std::move(scop), CpuMappingOptions::makeNaiveMappingOptions()); auto pJit = mscop->codegen("convolution"); auto fptr = reinterpret_cast (O1) { auto ctx = isl::with_exceptions::globalIslCtx(); auto scop = polyhedral::Scop::makeScop(ctx, tc); scop = Scop::makeSpecializedScop(*scop, {{"N", N}, {"M", M}}); - auto mscop = MappedScop::makeSequential( + auto mscop = cpu::MappedScop::makeSequential( std::move(scop), CpuMappingOptions::makeNaiveMappingOptions()); auto pJit = mscop->codegen("concat"); auto fptr = reinterpret_cast( From b596539faa2159c28f4ee1874191f51c49ecf194 Mon Sep 17 00:00:00 2001 From: Nicolas Vasilache Date: Wed, 25 Jul 2018 05:46:35 -0700 Subject: [PATCH 119/152] Scope relevant polyhedral/cuda classes under cuda namespace Similarly to the previous commit which scoped MappedScop under the cpu namespace, we do the same for relevant cuda classes. --- tc/core/cuda/cuda_tc_executor.cc | 2 +- tc/core/polyhedral/cuda/codegen.cc | 19 ++-- tc/core/polyhedral/cuda/codegen.h | 2 + tc/core/polyhedral/cuda/mapped_scop.cc | 92 +++++++++---------- tc/core/polyhedral/cuda/mapped_scop.h | 7 ++ .../cuda/memory_promotion_heuristic.cc | 2 + .../cuda/memory_promotion_heuristic.h | 5 +- .../polyhedral/cuda/tighten_launch_bounds.cc | 2 + .../polyhedral/cuda/tighten_launch_bounds.h | 2 + tc/core/polyhedral/scop.h | 2 - test/test_cuda_mapper.cc | 1 + test/test_cuda_mapper_memory_promotion.cc | 1 + 12 files changed, 77 insertions(+), 60 deletions(-) diff --git a/tc/core/cuda/cuda_tc_executor.cc b/tc/core/cuda/cuda_tc_executor.cc index cf27d5f29..d18723921 100644 --- a/tc/core/cuda/cuda_tc_executor.cc +++ b/tc/core/cuda/cuda_tc_executor.cc @@ -86,7 +86,7 @@ CudaCompilationResult CudaBackend::compileWithTcMapper( // Now we can build stuff auto mappedScop = - polyhedral::MappedScop::makeWithOuterBlockInnerThreadStrategy( + polyhedral::cuda::MappedScop::makeWithOuterBlockInnerThreadStrategy( std::move(scop), options); LOG_IF(INFO, FLAGS_debug_tc_mapper) << "Mapped schedule:" << std::endl << *(mappedScop->schedule()); diff --git a/tc/core/polyhedral/cuda/codegen.cc b/tc/core/polyhedral/cuda/codegen.cc index d6ce62aa2..28503170d 100644 --- a/tc/core/polyhedral/cuda/codegen.cc +++ b/tc/core/polyhedral/cuda/codegen.cc @@ -31,11 +31,17 @@ #include "tc/core/polyhedral/memory_promotion.h" #include "tc/core/polyhedral/schedule_isl_conversion.h" #include "tc/core/polyhedral/schedule_transforms.h" +#include "tc/core/polyhedral/scop.h" using namespace std; +using tc::polyhedral::detail::ScheduleTreeContext; +using tc::polyhedral::detail::ScheduleTreeDomain; +using tc::polyhedral::detail::toIslSchedule; + namespace tc { namespace polyhedral { +namespace cuda { namespace { @@ -612,8 +618,7 @@ void emitHalideExpr( class EmitHalide : public Halide::Internal::IRPrinter { using Halide::Internal::IRPrinter::visit; void visit(const Halide::Internal::Variable* op) { - auto pwAff = tc::polyhedral::detail::makeAffFromMappedExpr( - Halide::Expr(op), context); + auto pwAff = detail::makeAffFromMappedExpr(Halide::Expr(op), context); auto expr = context.build().expr_from(pwAff); auto s = expr.to_C_str(); if (!is_identifier_or_nonnegative_integer(expr)) { @@ -627,8 +632,7 @@ void emitHalideExpr( } else if ( op->call_type == Halide::Internal::Call::CallType::Halide || op->call_type == Halide::Internal::Call::CallType::Image) { - tc::polyhedral::detail::emitMappedTensorAccess( - op->name, op, op->args, context); + detail::emitMappedTensorAccess(op->name, op, op->args, context); } else if (op->is_intrinsic(tc2halide::kReductionUpdate)) { op->args[0].accept(this); } else { @@ -831,8 +835,8 @@ string emitCudaKernel( const std::string& specializedName, const MappedScop& mscop) { // Expecting a schedule with domain root and context first child. - TC_CHECK(mscop.schedule()->as()); - TC_CHECK(mscop.schedule()->child({0})->as()); + TC_CHECK(mscop.schedule()->as()); + TC_CHECK(mscop.schedule()->child({0})->as()); const auto& scop = mscop.scop(); // Make a map of the specialized scalar parameter values @@ -876,7 +880,7 @@ string emitCudaKernel( return collectIteratorMaps(n, b, &nodeInfoMap); }; - auto schedule = detail::toIslSchedule(mscop.schedule()); + auto schedule = toIslSchedule(mscop.schedule()); auto astBuild = isl::ast_build(schedule.get_ctx()); astBuild = astBuild.set_at_each_domain(collect); auto root = mscop.schedule(); @@ -890,5 +894,6 @@ string emitCudaKernel( return ss.str(); } +} // namespace cuda } // namespace polyhedral } // namespace tc diff --git a/tc/core/polyhedral/cuda/codegen.h b/tc/core/polyhedral/cuda/codegen.h index 438fbf938..7ae34b4dc 100644 --- a/tc/core/polyhedral/cuda/codegen.h +++ b/tc/core/polyhedral/cuda/codegen.h @@ -26,6 +26,7 @@ namespace tc { namespace polyhedral { +namespace cuda { struct CodegenContext; struct CodegenStatementContext; @@ -146,5 +147,6 @@ std::string emitCudaKernel( const std::string& specializedName, const MappedScop& scop); +} // namespace cuda } // namespace polyhedral } // namespace tc diff --git a/tc/core/polyhedral/cuda/mapped_scop.cc b/tc/core/polyhedral/cuda/mapped_scop.cc index 273a92fd8..29e167373 100644 --- a/tc/core/polyhedral/cuda/mapped_scop.cc +++ b/tc/core/polyhedral/cuda/mapped_scop.cc @@ -43,8 +43,14 @@ #include +using tc::polyhedral::detail::ScheduleTree; +using tc::polyhedral::detail::ScheduleTreeBand; +using tc::polyhedral::detail::ScheduleTreeContext; +using tc::polyhedral::detail::ScheduleTreeSequence; + namespace tc { namespace polyhedral { +namespace cuda { namespace { @@ -77,7 +83,7 @@ static void checkMinimum(isl::union_set domain, isl::union_pw_aff_list list) { template inline void throwIfHasPattern( ScheduleTreeMatcher matcher, - const detail::ScheduleTree* root) { + const ScheduleTree* root) { auto candidates = match(matcher, root); if (candidates.size() > 0) { std::stringstream ss; @@ -87,7 +93,7 @@ inline void throwIfHasPattern( } } -void validate(const detail::ScheduleTree* root) { +void validate(const ScheduleTree* root) { throwIfHasPattern( filter( [](isl::union_set uset) { return !uset || uset.is_empty(); }, any()), @@ -98,7 +104,7 @@ void validate(const detail::ScheduleTree* root) { root); } -bool anyNonCoincidentMember(const detail::ScheduleTreeBand* band) { +bool anyNonCoincidentMember(const ScheduleTreeBand* band) { return band->nOuterCoincident() < band->nMember(); } @@ -129,9 +135,7 @@ const CudaDim& mappingSize(const MappedScop* mscop) { // Return a pointer to the updated node (below the inserted filter) // for call chaining purposes. template -detail::ScheduleTree* MappedScop::map( - detail::ScheduleTree* tree, - isl::union_pw_aff_list list) { +ScheduleTree* MappedScop::map(ScheduleTree* tree, isl::union_pw_aff_list list) { size_t nToMap = list.size(); const auto& extent = mappingSize(this).view; TC_CHECK_LE(nToMap, extent.size()) << "dimension overflow"; @@ -160,16 +164,14 @@ detail::ScheduleTree* MappedScop::map( checkMinimum(domain, affList); - auto mapping = detail::ScheduleTree::makeMapping(idList, affList); + auto mapping = ScheduleTree::makeMapping(idList, affList); tree = insertNodeAbove(root, tree, std::move(mapping))->child({0}); return tree; } -detail::ScheduleTree* MappedScop::mapBlocksForward( - detail::ScheduleTree* band, - size_t nToMap) { - auto bandNode = band->as(); +ScheduleTree* MappedScop::mapBlocksForward(ScheduleTree* band, size_t nToMap) { + auto bandNode = band->as(); TC_CHECK(bandNode) << "expected a band, got " << *band; auto list = bandNode->mupa_.get_union_pw_aff_list(); @@ -180,7 +182,7 @@ detail::ScheduleTree* MappedScop::mapBlocksForward( // Uses as many blockSizes elements as outer coincident dimensions in the // outermost band void MappedScop::mapToBlocksAndScaleBand( - detail::ScheduleTree* band, + ScheduleTree* band, std::vector tileSizes) { using namespace tc::polyhedral::detail; @@ -205,16 +207,13 @@ namespace { * the remaining thread identifiers starting at "begin" to zero. * Add a marker underneath that marks the subtree that is thread specific. */ -void fixThreadsBelow( - MappedScop& mscop, - detail::ScheduleTree* tree, - size_t begin) { +void fixThreadsBelow(MappedScop& mscop, ScheduleTree* tree, size_t begin) { size_t end = mscop.numThreads.view.size(); if (begin == end) { return; } - auto band = detail::ScheduleTree::makeEmptyBand(mscop.scop().scheduleRoot()); + auto band = ScheduleTree::makeEmptyBand(mscop.scop().scheduleRoot()); auto bandTree = insertNodeBelow(tree, std::move(band)); mscop.mapThreadsBackward(bandTree); } @@ -226,10 +225,7 @@ void fixThreadsBelow( * Anything that depends on an update statement is ordered after * the update statements. Anything else is ordered before. */ -bool separatedOut( - Scop& scop, - detail::ScheduleTree* tree, - isl::union_set updates) { +bool separatedOut(Scop& scop, ScheduleTree* tree, isl::union_set updates) { auto domain = activeDomainPoints(scop.scheduleRoot(), tree); auto other = domain.subtract(updates); if (other.is_empty()) { @@ -254,7 +250,7 @@ bool separatedOut( } // namespace -bool MappedScop::detectReductions(detail::ScheduleTree* tree) { +bool MappedScop::detectReductions(ScheduleTree* tree) { // Do not bother with reductions if block is of size 1 in the x direction. if (numThreads.view.size() == 0 || numThreads.view[0] == 1) { return false; @@ -264,7 +260,7 @@ bool MappedScop::detectReductions(detail::ScheduleTree* tree) { for (auto c : tree->children()) { found |= detectReductions(c); } - auto band = tree->as(); + auto band = tree->as(); // Nested reductions are not currently supported. if (!band || found) { return found; @@ -314,7 +310,7 @@ bool MappedScop::detectReductions(detail::ScheduleTree* tree) { return true; } -bool MappedScop::needReductionSeparation(const detail::ScheduleTree* st) { +bool MappedScop::needReductionSeparation(const ScheduleTree* st) { if (reductionBandUpdates_.count(st) != 1) { return false; } @@ -323,9 +319,9 @@ bool MappedScop::needReductionSeparation(const detail::ScheduleTree* st) { } isl::multi_union_pw_aff MappedScop::reductionMapSchedule( - const detail::ScheduleTree* st) { + const ScheduleTree* st) { TC_CHECK(reductionBandUpdates_.count(st) == 1); - auto reductionBand = st->as(); + auto reductionBand = st->as(); TC_CHECK(reductionBand); auto nMember = reductionBand->nMember(); @@ -337,7 +333,7 @@ isl::multi_union_pw_aff MappedScop::reductionMapSchedule( return reductionBand->memberRange(first, nMappedThreads); } -detail::ScheduleTree* MappedScop::separateReduction(detail::ScheduleTree* st) { +ScheduleTree* MappedScop::separateReduction(ScheduleTree* st) { auto reduction = st; // This function either separates full blocks (if needed) or // disables the reduction handling. @@ -386,23 +382,22 @@ detail::ScheduleTree* MappedScop::separateReduction(detail::ScheduleTree* st) { return st->ancestor(root, 2); } -detail::ScheduleTree* MappedScop::mapThreadsBackward( - detail::ScheduleTree* band) { - auto bandNode = band->as(); +ScheduleTree* MappedScop::mapThreadsBackward(ScheduleTree* band) { + auto bandNode = band->as(); TC_CHECK(bandNode); auto nMember = bandNode->nMember(); auto nToMap = std::min(nMember, numThreads.view.size()); TC_CHECK_LE(nToMap, 3u) << "mapping to too many threads"; auto ctx = band->ctx_; - insertNodeBelow(band, detail::ScheduleTree::makeThreadSpecificMarker(ctx)); + insertNodeBelow(band, ScheduleTree::makeThreadSpecificMarker(ctx)); auto list = bandNode->mupa_.get_union_pw_aff_list().reverse(); list = list.drop(nToMap, list.size() - nToMap); return map(band, list); } -size_t MappedScop::mapToThreads(detail::ScheduleTree* band) { +size_t MappedScop::mapToThreads(ScheduleTree* band) { using namespace tc::polyhedral::detail; auto bandNode = band->as(); @@ -473,17 +468,15 @@ namespace { * That is, assuming "st" is a sequence node, does the last child * need to be protected from the next iteration of the first child? */ -bool hasOuterSequentialMember( - const detail::ScheduleTree* root, - detail::ScheduleTree* st) { +bool hasOuterSequentialMember(const ScheduleTree* root, ScheduleTree* st) { auto ancestors = st->ancestors(root); std::reverse(ancestors.begin(), ancestors.end()); for (auto a : ancestors) { - auto band = a->as(); + auto band = a->as(); if (band && band->nMember() > band->nOuterCoincident()) { return true; } - if (a->as()) { + if (a->as()) { return false; } } @@ -532,7 +525,7 @@ isl::multi_aff constructThreadToWarp( } // namespace isl::multi_union_pw_aff MappedScop::threadMappingSchedule( - const detail::ScheduleTree* tree) const { + const ScheduleTree* tree) const { std::vector ids; for (size_t i = 0; i < numThreads.view.size(); ++i) { ids.emplace_back(mapping::ThreadId::makeId(i)); @@ -542,7 +535,7 @@ isl::multi_union_pw_aff MappedScop::threadMappingSchedule( } isl::multi_union_pw_aff MappedScop::blockMappingSchedule( - const detail::ScheduleTree* tree) const { + const ScheduleTree* tree) const { std::vector ids; for (size_t i = 0; i < numBlocks.view.size(); ++i) { ids.emplace_back(mapping::BlockId::makeId(i)); @@ -552,8 +545,8 @@ isl::multi_union_pw_aff MappedScop::blockMappingSchedule( } Scop::SyncLevel MappedScop::findBestSync( - detail::ScheduleTree* st1, - detail::ScheduleTree* st2, + ScheduleTree* st1, + ScheduleTree* st2, isl::multi_union_pw_aff domainToThread, isl::multi_union_pw_aff domainToWarp) { // Active points in the two schedule trees @@ -571,7 +564,7 @@ Scop::SyncLevel MappedScop::findBestSync( TC_CHECK_LE(1u, scop_->scheduleRoot()->children().size()); auto contextSt = scop_->scheduleRoot()->children()[0]; - auto contextElem = contextSt->as(); + auto contextElem = contextSt->as(); TC_CHECK(nullptr != contextElem); dependences = dependences.intersect_params(contextElem->context_); @@ -733,8 +726,8 @@ std::vector> MappedScop::findBestSyncConfigInSeq( return solutionWithBestBegining; } -void MappedScop::insertBestSyncInSeq(detail::ScheduleTree* seq) { - TC_CHECK(seq->as()); +void MappedScop::insertBestSyncInSeq(ScheduleTree* seq) { + TC_CHECK(seq->as()); auto children = seq->children(); auto nChildren = children.size(); @@ -796,7 +789,7 @@ void MappedScop::insertBestSyncInSeq(detail::ScheduleTree* seq) { // the next iteration of the first child if there may be such // a next iteration that is not already covered by synchronization // on an outer node. -size_t MappedScop::mapInnermostBandsToThreads(detail::ScheduleTree* st) { +size_t MappedScop::mapInnermostBandsToThreads(ScheduleTree* st) { if (needReductionSeparation(st)) { st = separateReduction(st); } @@ -808,7 +801,7 @@ size_t MappedScop::mapInnermostBandsToThreads(detail::ScheduleTree* st) { } auto n = nChildren > 0 ? *std::max_element(nInner.begin(), nInner.end()) : 0; if (nChildren > 1) { - auto needSync = st->as() && n > 0; + auto needSync = st->as() && n > 0; if (n > 0) { for (size_t i = 0; i < nChildren; ++i) { fixThreadsBelow(*this, children[i], nInner[i]); @@ -819,7 +812,7 @@ size_t MappedScop::mapInnermostBandsToThreads(detail::ScheduleTree* st) { } } - if (auto band = st->as()) { + if (auto band = st->as()) { if (n == 0) { // If children were not mapped to threads, the current band can be mapped. // First, map the coincidence and reduction dimension to threads. @@ -957,8 +950,8 @@ std::tuple MappedScop::codegen( // Split out a single reduction tile (in the directions other than // the reduction) and insert reduction synchronizations outside this tile. // Return a pointer to the split off tile. -detail::ScheduleTree* MappedScop::splitOutReductionTileAndInsertSyncs( - detail::ScheduleTree* band) { +ScheduleTree* MappedScop::splitOutReductionTileAndInsertSyncs( + ScheduleTree* band) { using namespace polyhedral::detail; size_t n = numThreads.view.size(); @@ -1103,5 +1096,6 @@ std::unique_ptr MappedScop::makeWithOuterBlockInnerThreadStrategy( return mappedScop; } +} // namespace cuda } // namespace polyhedral } // namespace tc diff --git a/tc/core/polyhedral/cuda/mapped_scop.h b/tc/core/polyhedral/cuda/mapped_scop.h index 79399ae35..47aef39c6 100644 --- a/tc/core/polyhedral/cuda/mapped_scop.h +++ b/tc/core/polyhedral/cuda/mapped_scop.h @@ -30,6 +30,11 @@ namespace tc { namespace polyhedral { +namespace detail { +class ScheduleTree; +} // namespace detail + +namespace cuda { // Scop associated with fixed block and grid dimensions. // @@ -256,5 +261,7 @@ class MappedScop { // about the detected reduction. std::map reductionBandUpdates_; }; + +} // namespace cuda } // namespace polyhedral } // namespace tc diff --git a/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc b/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc index 4888f9e03..ce2fbb0f4 100644 --- a/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc +++ b/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc @@ -33,6 +33,7 @@ namespace tc { namespace polyhedral { +namespace cuda { namespace { // Map global<->shared copy bands to threads, starting from the innermost @@ -760,5 +761,6 @@ void promoteToRegistersAtDepth(MappedScop& mscop, size_t depth) { } } +} // namespace cuda } // namespace polyhedral } // namespace tc diff --git a/tc/core/polyhedral/cuda/memory_promotion_heuristic.h b/tc/core/polyhedral/cuda/memory_promotion_heuristic.h index a16480002..2dc264949 100644 --- a/tc/core/polyhedral/cuda/memory_promotion_heuristic.h +++ b/tc/core/polyhedral/cuda/memory_promotion_heuristic.h @@ -22,13 +22,15 @@ namespace tc { namespace polyhedral { -class MappedScop; class Scop; namespace detail { class ScheduleTree; } +namespace cuda { +class MappedScop; + // In the given mapped scop "mscop", // promote to shared memory at "depth" until "sharedMemorySize" is used. // Map copies between global and shared memory to threads and unroll those @@ -43,5 +45,6 @@ void promoteToRegistersBelow(MappedScop& mscop, detail::ScheduleTree* scope); void promoteToRegistersAtDepth(MappedScop& scop, std::size_t depth); +} // namespace cuda } // namespace polyhedral } // namespace tc diff --git a/tc/core/polyhedral/cuda/tighten_launch_bounds.cc b/tc/core/polyhedral/cuda/tighten_launch_bounds.cc index 137aa5e78..c398d4161 100644 --- a/tc/core/polyhedral/cuda/tighten_launch_bounds.cc +++ b/tc/core/polyhedral/cuda/tighten_launch_bounds.cc @@ -23,6 +23,7 @@ namespace tc { namespace polyhedral { +namespace cuda { namespace { /* * Return the mapping to MappingTypeId, i.e, either the mapping to blocks or @@ -78,5 +79,6 @@ std::pair tightenLaunchBounds( launchBounds(mscop, grid), launchBounds(mscop, block)); } +} // namespace cuda } // namespace polyhedral } // namespace tc diff --git a/tc/core/polyhedral/cuda/tighten_launch_bounds.h b/tc/core/polyhedral/cuda/tighten_launch_bounds.h index 251d11bb8..e32f92db7 100644 --- a/tc/core/polyhedral/cuda/tighten_launch_bounds.h +++ b/tc/core/polyhedral/cuda/tighten_launch_bounds.h @@ -20,9 +20,11 @@ namespace tc { namespace polyhedral { +namespace cuda { std::pair tightenLaunchBounds( const MappedScop& mscop, const tc::Grid& grid, const tc::Block& block); +} // namespace cuda } // namespace polyhedral } // namespace tc diff --git a/tc/core/polyhedral/scop.h b/tc/core/polyhedral/scop.h index 1f9664171..0d63fdbc6 100644 --- a/tc/core/polyhedral/scop.h +++ b/tc/core/polyhedral/scop.h @@ -41,8 +41,6 @@ namespace polyhedral { using ReductionDimSet = std::set; class TensorReferenceGroup; -class MappedScop; - struct Scop { private: Scop() {} diff --git a/test/test_cuda_mapper.cc b/test/test_cuda_mapper.cc index 545610a6e..c019b403e 100644 --- a/test/test_cuda_mapper.cc +++ b/test/test_cuda_mapper.cc @@ -44,6 +44,7 @@ using namespace std; using namespace tc; using namespace tc::polyhedral; +using namespace tc::polyhedral::cuda; using namespace tc::polyhedral::detail; struct PolyhedralMapperTest : public ::testing::Test { diff --git a/test/test_cuda_mapper_memory_promotion.cc b/test/test_cuda_mapper_memory_promotion.cc index bdabb2b7d..0fb7405b8 100644 --- a/test/test_cuda_mapper_memory_promotion.cc +++ b/test/test_cuda_mapper_memory_promotion.cc @@ -30,6 +30,7 @@ using namespace std; using namespace tc; using namespace tc::polyhedral; +using namespace tc::polyhedral::cuda; namespace { int npoints(isl::set s) { From 46c9cd75107dfedcaa2954892c4105f3083036c6 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Wed, 25 Jul 2018 15:02:41 +0200 Subject: [PATCH 120/152] bump isl for fix of isl_*_aff_*_val exports --- isl_interface/include/isl/cpp.h | 86 +++++++++++++++-------- tc/core/polyhedral/schedule_transforms.cc | 4 +- third-party/islpp | 2 +- 3 files changed, 59 insertions(+), 33 deletions(-) diff --git a/isl_interface/include/isl/cpp.h b/isl_interface/include/isl/cpp.h index 537b6f738..79251306d 100644 --- a/isl_interface/include/isl/cpp.h +++ b/isl_interface/include/isl/cpp.h @@ -1948,11 +1948,11 @@ class multi_union_pw_aff { public: inline /* implicit */ multi_union_pw_aff(); inline /* implicit */ multi_union_pw_aff(const isl::multi_union_pw_aff &obj); - inline explicit multi_union_pw_aff(isl::union_set domain, isl::multi_aff ma); inline explicit multi_union_pw_aff(isl::space space, isl::union_pw_aff_list list); inline /* implicit */ multi_union_pw_aff(isl::union_pw_aff upa); inline /* implicit */ multi_union_pw_aff(isl::multi_pw_aff mpa); inline explicit multi_union_pw_aff(isl::union_set domain, isl::multi_val mv); + inline explicit multi_union_pw_aff(isl::union_set domain, isl::multi_aff ma); inline explicit multi_union_pw_aff(isl::ctx ctx, const std::string &str); inline isl::multi_union_pw_aff &operator=(isl::multi_union_pw_aff obj); inline ~multi_union_pw_aff(); @@ -2164,6 +2164,7 @@ class pw_aff { inline int n_piece() const; inline isl::set ne_set(isl::pw_aff pwaff2) const; inline isl::pw_aff neg() const; + inline isl::set nonneg_set() const; inline isl::set params() const; inline isl::pw_aff project_domain_on_params() const; inline isl::pw_aff pullback(isl::multi_aff ma) const; @@ -2175,6 +2176,7 @@ class pw_aff { inline isl::pw_aff tdiv_q(isl::pw_aff pa2) const; inline isl::pw_aff tdiv_r(isl::pw_aff pa2) const; inline isl::pw_aff union_add(isl::pw_aff pwaff2) const; + inline isl::set zero_set() const; typedef isl_pw_aff* isl_ptr_t; }; @@ -2266,8 +2268,8 @@ class pw_multi_aff { inline isl::pw_multi_aff range_factor_domain() const; inline isl::pw_multi_aff range_factor_range() const; inline isl::pw_multi_aff range_product(isl::pw_multi_aff pma2) const; - inline isl::pw_multi_aff scale_down_val(isl::val v) const; - inline isl::pw_multi_aff scale_val(isl::val v) const; + inline isl::pw_multi_aff scale(isl::val v) const; + inline isl::pw_multi_aff scale_down(isl::val v) const; inline isl::pw_multi_aff set_pw_aff(unsigned int pos, isl::pw_aff pa) const; inline isl::pw_multi_aff union_add(isl::pw_multi_aff pma2) const; typedef isl_pw_multi_aff* isl_ptr_t; @@ -3144,8 +3146,8 @@ class union_pw_aff { static inline isl::union_pw_aff param_on_domain(isl::union_set domain, isl::id id); inline bool plain_is_equal(const isl::union_pw_aff &upa2) const; inline isl::union_pw_aff pullback(isl::union_pw_multi_aff upma) const; + inline isl::union_pw_aff scale(isl::val v) const; inline isl::union_pw_aff scale_down(isl::val v) const; - inline isl::union_pw_aff scale_val(isl::val v) const; inline isl::union_pw_aff sub(isl::union_pw_aff upa2) const; inline isl::union_pw_aff union_add(isl::union_pw_aff upa2) const; inline isl::union_set zero_union_set() const; @@ -3232,8 +3234,8 @@ class union_pw_multi_aff { inline isl::union_pw_aff get_union_pw_aff(int pos) const; inline int n_pw_multi_aff() const; inline isl::union_pw_multi_aff pullback(isl::union_pw_multi_aff upma2) const; - inline isl::union_pw_multi_aff scale_down_val(isl::val val) const; - inline isl::union_pw_multi_aff scale_val(isl::val val) const; + inline isl::union_pw_multi_aff scale(isl::val val) const; + inline isl::union_pw_multi_aff scale_down(isl::val val) const; inline isl::union_pw_multi_aff union_add(isl::union_pw_multi_aff upma2) const; typedef isl_union_pw_multi_aff* isl_ptr_t; }; @@ -11362,18 +11364,6 @@ multi_union_pw_aff::multi_union_pw_aff(const isl::multi_union_pw_aff &obj) multi_union_pw_aff::multi_union_pw_aff(__isl_take isl_multi_union_pw_aff *ptr) : ptr(ptr) {} -multi_union_pw_aff::multi_union_pw_aff(isl::union_set domain, isl::multi_aff ma) -{ - if (domain.is_null() || ma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - auto ctx = domain.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_union_pw_aff_multi_aff_on_domain(domain.release(), ma.release()); - if (!res) - throw exception::create_from_last_error(ctx); - ptr = res; -} multi_union_pw_aff::multi_union_pw_aff(isl::space space, isl::union_pw_aff_list list) { if (space.is_null() || list.is_null()) @@ -11422,6 +11412,18 @@ multi_union_pw_aff::multi_union_pw_aff(isl::union_set domain, isl::multi_val mv) throw exception::create_from_last_error(ctx); ptr = res; } +multi_union_pw_aff::multi_union_pw_aff(isl::union_set domain, isl::multi_aff ma) +{ + if (domain.is_null() || ma.is_null()) + throw isl::exception::create(isl_error_invalid, + "NULL input", __FILE__, __LINE__); + auto ctx = domain.get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + auto res = isl_multi_union_pw_aff_multi_aff_on_domain(domain.release(), ma.release()); + if (!res) + throw exception::create_from_last_error(ctx); + ptr = res; +} multi_union_pw_aff::multi_union_pw_aff(isl::ctx ctx, const std::string &str) { options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); @@ -13056,6 +13058,18 @@ isl::pw_aff pw_aff::neg() const return manage(res); } +isl::set pw_aff::nonneg_set() const +{ + if (!ptr) + throw isl::exception::create(isl_error_invalid, + "NULL input", __FILE__, __LINE__); + options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + auto res = isl_pw_aff_nonneg_set(copy()); + if (!res) + throw exception::create_from_last_error(get_ctx()); + return manage(res); +} + isl::set pw_aff::params() const { if (!ptr) @@ -13188,6 +13202,18 @@ isl::pw_aff pw_aff::union_add(isl::pw_aff pwaff2) const return manage(res); } +isl::set pw_aff::zero_set() const +{ + if (!ptr) + throw isl::exception::create(isl_error_invalid, + "NULL input", __FILE__, __LINE__); + options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + auto res = isl_pw_aff_zero_set(copy()); + if (!res) + throw exception::create_from_last_error(get_ctx()); + return manage(res); +} + // implementations for isl::pw_aff_list isl::pw_aff_list manage(__isl_take isl_pw_aff_list *ptr) { if (!ptr) @@ -13752,25 +13778,25 @@ isl::pw_multi_aff pw_multi_aff::range_product(isl::pw_multi_aff pma2) const return manage(res); } -isl::pw_multi_aff pw_multi_aff::scale_down_val(isl::val v) const +isl::pw_multi_aff pw_multi_aff::scale(isl::val v) const { if (!ptr || v.is_null()) throw isl::exception::create(isl_error_invalid, "NULL input", __FILE__, __LINE__); options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_pw_multi_aff_scale_down_val(copy(), v.release()); + auto res = isl_pw_multi_aff_scale_val(copy(), v.release()); if (!res) throw exception::create_from_last_error(get_ctx()); return manage(res); } -isl::pw_multi_aff pw_multi_aff::scale_val(isl::val v) const +isl::pw_multi_aff pw_multi_aff::scale_down(isl::val v) const { if (!ptr || v.is_null()) throw isl::exception::create(isl_error_invalid, "NULL input", __FILE__, __LINE__); options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_pw_multi_aff_scale_val(copy(), v.release()); + auto res = isl_pw_multi_aff_scale_down_val(copy(), v.release()); if (!res) throw exception::create_from_last_error(get_ctx()); return manage(res); @@ -19180,25 +19206,25 @@ isl::union_pw_aff union_pw_aff::pullback(isl::union_pw_multi_aff upma) const return manage(res); } -isl::union_pw_aff union_pw_aff::scale_down(isl::val v) const +isl::union_pw_aff union_pw_aff::scale(isl::val v) const { if (!ptr || v.is_null()) throw isl::exception::create(isl_error_invalid, "NULL input", __FILE__, __LINE__); options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_union_pw_aff_scale_down_val(copy(), v.release()); + auto res = isl_union_pw_aff_scale_val(copy(), v.release()); if (!res) throw exception::create_from_last_error(get_ctx()); return manage(res); } -isl::union_pw_aff union_pw_aff::scale_val(isl::val v) const +isl::union_pw_aff union_pw_aff::scale_down(isl::val v) const { if (!ptr || v.is_null()) throw isl::exception::create(isl_error_invalid, "NULL input", __FILE__, __LINE__); options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_union_pw_aff_scale_val(copy(), v.release()); + auto res = isl_union_pw_aff_scale_down_val(copy(), v.release()); if (!res) throw exception::create_from_last_error(get_ctx()); return manage(res); @@ -19704,25 +19730,25 @@ isl::union_pw_multi_aff union_pw_multi_aff::pullback(isl::union_pw_multi_aff upm return manage(res); } -isl::union_pw_multi_aff union_pw_multi_aff::scale_down_val(isl::val val) const +isl::union_pw_multi_aff union_pw_multi_aff::scale(isl::val val) const { if (!ptr || val.is_null()) throw isl::exception::create(isl_error_invalid, "NULL input", __FILE__, __LINE__); options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_union_pw_multi_aff_scale_down_val(copy(), val.release()); + auto res = isl_union_pw_multi_aff_scale_val(copy(), val.release()); if (!res) throw exception::create_from_last_error(get_ctx()); return manage(res); } -isl::union_pw_multi_aff union_pw_multi_aff::scale_val(isl::val val) const +isl::union_pw_multi_aff union_pw_multi_aff::scale_down(isl::val val) const { if (!ptr || val.is_null()) throw isl::exception::create(isl_error_invalid, "NULL input", __FILE__, __LINE__); options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_union_pw_multi_aff_scale_val(copy(), val.release()); + auto res = isl_union_pw_multi_aff_scale_down_val(copy(), val.release()); if (!res) throw exception::create_from_last_error(get_ctx()); return manage(res); diff --git a/tc/core/polyhedral/schedule_transforms.cc b/tc/core/polyhedral/schedule_transforms.cc index c3442dd03..2aee2e095 100644 --- a/tc/core/polyhedral/schedule_transforms.cc +++ b/tc/core/polyhedral/schedule_transforms.cc @@ -229,10 +229,10 @@ ScheduleTree* bandTile( if (ts[i]) { upa = upa.scale_down(isl::val(st->ctx_, ts[i])).floor(); if (tileOptions & TileOptions::ScaleTileLoops) { - upa = upa.scale_val(isl::val(st->ctx_, ts[i])); + upa = upa.scale(isl::val(st->ctx_, ts[i])); } } else { - upa = upa.scale_val(isl::val(st->ctx_, ts[i])); + upa = upa.scale(isl::val(st->ctx_, ts[i])); } band.mupa_ = band.mupa_.set_union_pw_aff(i, upa); } diff --git a/third-party/islpp b/third-party/islpp index adefea12a..3da9dd058 160000 --- a/third-party/islpp +++ b/third-party/islpp @@ -1 +1 @@ -Subproject commit adefea12a80d7c1846342227d85133a10b20261e +Subproject commit 3da9dd058333ef349cc19fe66504dcf1a9cbd568 From c4588e98cf811f8e14a73b9abd81b2693b714f3a Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Wed, 25 Jul 2018 17:34:55 +0200 Subject: [PATCH 121/152] boundInstancesAndMarkUnroll: do not call domain() on a set space The space of an isl_multi_union_pw_aff is the common range space, i.e., a set space. The current version of isl tolerates calling domain() on a set space, but it is technically incorrect. Call params() instead. Moving to templated isl types will make this issue more evident. --- tc/core/polyhedral/unroll.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tc/core/polyhedral/unroll.cc b/tc/core/polyhedral/unroll.cc index a68264c0a..83b850bce 100644 --- a/tc/core/polyhedral/unroll.cc +++ b/tc/core/polyhedral/unroll.cc @@ -94,7 +94,7 @@ isl::val boundInstancesAndMarkUnroll( auto n = band->nMember(); auto list = partial.get_union_pw_aff_list(); - auto space = partial.get_space().domain(); + auto space = partial.get_space().params(); for (int i = n - 1; i >= 0; --i) { auto member = partial.get_union_pw_aff(i); auto outerMap = prefix; From 71fb1170e544fe6162bdd0c6f0e8f82869954def Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Wed, 25 Jul 2018 17:34:55 +0200 Subject: [PATCH 122/152] ScheduleTreeBand::memberRange: do not call domain() on a set space The space of an isl_multi_union_pw_aff is the common range space, i.e., a set space. The current version of isl tolerates calling domain() on a set space, but it is technically incorrect. Call params() instead. Moving to templated isl types will make this issue more evident. --- tc/core/polyhedral/schedule_tree_elem.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tc/core/polyhedral/schedule_tree_elem.cc b/tc/core/polyhedral/schedule_tree_elem.cc index cc7ce86ff..77db24859 100644 --- a/tc/core/polyhedral/schedule_tree_elem.cc +++ b/tc/core/polyhedral/schedule_tree_elem.cc @@ -253,7 +253,7 @@ void ScheduleTreeBand::drop(size_t pos, size_t n) { isl::multi_union_pw_aff ScheduleTreeBand::memberRange(size_t first, size_t n) const { auto list = mupa_.get_union_pw_aff_list(); - auto space = mupa_.get_space().domain().add_unnamed_tuple_ui(n); + auto space = mupa_.get_space().params().add_unnamed_tuple_ui(n); auto end = first + n; TC_CHECK_LE(end, nMember()); list = list.drop(end, nMember() - end); From 8cf2f43cdb8a21a21cb8a22ac720df95345fac3a Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Mon, 30 Jul 2018 15:09:27 +0200 Subject: [PATCH 123/152] bump isl for fix of isl_map_from_union_map export --- isl_interface/include/isl/cpp.h | 22 +++++++++++----------- tc/core/polyhedral/codegen_llvm.cc | 2 +- tc/core/polyhedral/cuda/codegen.cc | 7 +++---- tc/core/polyhedral/memory_promotion.cc | 2 +- tc/core/polyhedral/unroll.cc | 2 +- third-party/islpp | 2 +- 6 files changed, 18 insertions(+), 19 deletions(-) diff --git a/isl_interface/include/isl/cpp.h b/isl_interface/include/isl/cpp.h index 79251306d..1177ff436 100644 --- a/isl_interface/include/isl/cpp.h +++ b/isl_interface/include/isl/cpp.h @@ -1657,9 +1657,9 @@ class map { inline isl::map flatten_range() const; inline void foreach_basic_map(const std::function &fn) const; static inline isl::map from(isl::pw_multi_aff pma); + static inline isl::map from(isl::union_map umap); static inline isl::map from_domain(isl::set set); static inline isl::map from_range(isl::set set); - static inline isl::map from_union_map(isl::union_map umap); inline isl::basic_map_list get_basic_map_list() const; inline isl::fixed_box get_range_simple_fixed_box_hull() const; inline isl::stride_info get_range_stride_info(int pos) const; @@ -9167,40 +9167,40 @@ isl::map map::from(isl::pw_multi_aff pma) return manage(res); } -isl::map map::from_domain(isl::set set) +isl::map map::from(isl::union_map umap) { - if (set.is_null()) + if (umap.is_null()) throw isl::exception::create(isl_error_invalid, "NULL input", __FILE__, __LINE__); - auto ctx = set.get_ctx(); + auto ctx = umap.get_ctx(); options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); - auto res = isl_map_from_domain(set.release()); + auto res = isl_map_from_union_map(umap.release()); if (!res) throw exception::create_from_last_error(ctx); return manage(res); } -isl::map map::from_range(isl::set set) +isl::map map::from_domain(isl::set set) { if (set.is_null()) throw isl::exception::create(isl_error_invalid, "NULL input", __FILE__, __LINE__); auto ctx = set.get_ctx(); options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); - auto res = isl_map_from_range(set.release()); + auto res = isl_map_from_domain(set.release()); if (!res) throw exception::create_from_last_error(ctx); return manage(res); } -isl::map map::from_union_map(isl::union_map umap) +isl::map map::from_range(isl::set set) { - if (umap.is_null()) + if (set.is_null()) throw isl::exception::create(isl_error_invalid, "NULL input", __FILE__, __LINE__); - auto ctx = umap.get_ctx(); + auto ctx = set.get_ctx(); options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); - auto res = isl_map_from_union_map(umap.release()); + auto res = isl_map_from_range(set.release()); if (!res) throw exception::create_from_last_error(ctx); return manage(res); diff --git a/tc/core/polyhedral/codegen_llvm.cc b/tc/core/polyhedral/codegen_llvm.cc index 4e9e264e1..c87289d1f 100644 --- a/tc/core/polyhedral/codegen_llvm.cc +++ b/tc/core/polyhedral/codegen_llvm.cc @@ -573,7 +573,7 @@ isl::ast_node collectIteratorMaps( TC_CHECK(user); auto expr = user.get_expr().as(); auto schedule = build.get_schedule(); - auto scheduleMap = isl::map::from_union_map(schedule); + auto scheduleMap = isl::map::from(schedule); auto stmtId = expr.get_arg(0).as().get_id(); TC_CHECK_EQ(0u, iteratorMaps.count(stmtId)) << "entry exists: " << stmtId; diff --git a/tc/core/polyhedral/cuda/codegen.cc b/tc/core/polyhedral/cuda/codegen.cc index 28503170d..606cd235c 100644 --- a/tc/core/polyhedral/cuda/codegen.cc +++ b/tc/core/polyhedral/cuda/codegen.cc @@ -726,9 +726,8 @@ void emitMappedTensorAccess( auto promotion = promotionInfo.group->promotion(); // MA :: [S -> O] -> P promotion = promotion.set_range_tuple_id(promotionInfo.groupId); auto iteratorMap = context.iteratorMap(); // PMA :: A -> D - auto schedule = - isl::map::from_union_map(promotionInfo.outerSchedule.intersect_domain( - context.domain())); // map :: D -> S + auto schedule = isl::map::from(promotionInfo.outerSchedule.intersect_domain( + context.domain())); // map :: D -> S TC_CHECK(schedule.is_single_valued()) << "expected single-valued schedule, got " << schedule; @@ -864,7 +863,7 @@ string emitCudaKernel( auto expr = user.get_expr().as(); auto stmtId = expr.get_arg(0).as().get_id(); auto schedule = build.get_schedule(); - auto scheduleMap = isl::map::from_union_map(schedule); + auto scheduleMap = isl::map::from(schedule); auto nodeId = isl::id( node.get_ctx(), diff --git a/tc/core/polyhedral/memory_promotion.cc b/tc/core/polyhedral/memory_promotion.cc index d7d1801c4..b1b947c00 100644 --- a/tc/core/polyhedral/memory_promotion.cc +++ b/tc/core/polyhedral/memory_promotion.cc @@ -286,7 +286,7 @@ void addSingletonReferenceGroup( AccessType type) { auto scopedUnionAccess = isl::union_map(access.curry()); scopedUnionAccess = scopedUnionAccess.apply_domain(schedule); - auto scopedAccess = isl::map::from_union_map(scopedUnionAccess); + auto scopedAccess = isl::map::from(scopedUnionAccess); scopedAccess = scopedAccess.uncurry(); tensorGroups[targetTensor].push_back( TensorReferenceGroup::makeSingleton(access, scopedAccess, type)); diff --git a/tc/core/polyhedral/unroll.cc b/tc/core/polyhedral/unroll.cc index 83b850bce..e90e78f16 100644 --- a/tc/core/polyhedral/unroll.cc +++ b/tc/core/polyhedral/unroll.cc @@ -55,7 +55,7 @@ isl::val relativeRange(isl::union_map fixed, isl::union_pw_aff f) { umap = umap.range_product(umap); umap = umap.range().unwrap(); umap = umap.project_out_all_params(); - auto delta = isl::map::from_union_map(umap).deltas(); + auto delta = isl::map::from(umap).deltas(); auto hull = delta.simple_hull(); auto stride = isl::set(hull).get_stride(0); hull = isl::set(hull).polyhedral_hull(); diff --git a/third-party/islpp b/third-party/islpp index 3da9dd058..f34c8331a 160000 --- a/third-party/islpp +++ b/third-party/islpp @@ -1 +1 @@ -Subproject commit 3da9dd058333ef349cc19fe66504dcf1a9cbd568 +Subproject commit f34c8331af07164fa4be76a4c930ab0cd4e22eae From de70264f6aedd4f967bf10c8d234b8a972b2a9ef Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Tue, 31 Jul 2018 17:30:42 +0200 Subject: [PATCH 124/152] schedule_utils.cc: drop dead code The reversed() function was used by foldr in prehistory, but the latter got removed because it was itself not being used. --- tc/core/polyhedral/schedule_utils.cc | 8 -------- 1 file changed, 8 deletions(-) diff --git a/tc/core/polyhedral/schedule_utils.cc b/tc/core/polyhedral/schedule_utils.cc index 9e3dffcdc..979fc8a34 100644 --- a/tc/core/polyhedral/schedule_utils.cc +++ b/tc/core/polyhedral/schedule_utils.cc @@ -188,14 +188,6 @@ vector collectScheduleTreesPath( namespace { -template -vector reversed(const vector& vec) { - vector result; - result.reserve(vec.size()); - result.insert(result.begin(), vec.rbegin(), vec.rend()); - return result; -} - template vector filterType(const vector& vec) { vector result; From e181cf83f16ad124e814910e0d41d98ef0423619 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Tue, 31 Jul 2018 17:35:01 +0200 Subject: [PATCH 125/152] schedule_utils.cc: drop dead code The operator was used in prehistory to print "extents" in error messages, but that code has been removed a long time ago. --- tc/core/polyhedral/schedule_utils.cc | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/tc/core/polyhedral/schedule_utils.cc b/tc/core/polyhedral/schedule_utils.cc index 979fc8a34..37a1a7d96 100644 --- a/tc/core/polyhedral/schedule_utils.cc +++ b/tc/core/polyhedral/schedule_utils.cc @@ -208,20 +208,6 @@ T foldl(const vector vec, Func op, T init = T()) { return value; } -template -ostream& operator<<(ostream& os, const vector& v) { - os << "["; - bool first = true; - for (auto const& ve : v) { - if (!first) { - os << ", "; - } - os << ve; - first = true; - } - os << "]"; - return os; -} } // namespace isl::multi_union_pw_aff infixScheduleMupa( From 33caff2e4c1ce9247252c74f9989df6902986422 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Thu, 2 Aug 2018 09:46:33 +0200 Subject: [PATCH 126/152] bump isl for fix of isl_union_pw_aff_mod_val export --- isl_interface/include/isl/cpp.h | 4 ++-- tc/core/polyhedral/cuda/mapped_scop.cc | 2 +- third-party/islpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/isl_interface/include/isl/cpp.h b/isl_interface/include/isl/cpp.h index 1177ff436..aa9ce0a00 100644 --- a/isl_interface/include/isl/cpp.h +++ b/isl_interface/include/isl/cpp.h @@ -3141,7 +3141,7 @@ class union_pw_aff { inline bool involves_param(const isl::id &id) const; inline isl::val max_val() const; inline isl::val min_val() const; - inline isl::union_pw_aff mod_val(isl::val f) const; + inline isl::union_pw_aff mod(isl::val f) const; inline int n_pw_aff() const; static inline isl::union_pw_aff param_on_domain(isl::union_set domain, isl::id id); inline bool plain_is_equal(const isl::union_pw_aff &upa2) const; @@ -19147,7 +19147,7 @@ isl::val union_pw_aff::min_val() const return manage(res); } -isl::union_pw_aff union_pw_aff::mod_val(isl::val f) const +isl::union_pw_aff union_pw_aff::mod(isl::val f) const { if (!ptr || f.is_null()) throw isl::exception::create(isl_error_invalid, diff --git a/tc/core/polyhedral/cuda/mapped_scop.cc b/tc/core/polyhedral/cuda/mapped_scop.cc index b0b129cbc..02e603b2a 100644 --- a/tc/core/polyhedral/cuda/mapped_scop.cc +++ b/tc/core/polyhedral/cuda/mapped_scop.cc @@ -150,7 +150,7 @@ ScheduleTree* MappedScop::map(ScheduleTree* tree, isl::union_pw_aff_list list) { auto id = MappingTypeId::makeId(i); auto upa = list.get_at(i); TC_CHECK_NE(extent[i], 0u) << "NYI: mapping to 0"; - upa = upa.mod_val(isl::val(tree->ctx_, extent[i])); + upa = upa.mod(isl::val(tree->ctx_, extent[i])); affList = affList.add(upa); idList.emplace_back(id); } diff --git a/third-party/islpp b/third-party/islpp index f34c8331a..35748a0c1 160000 --- a/third-party/islpp +++ b/third-party/islpp @@ -1 +1 @@ -Subproject commit f34c8331af07164fa4be76a4c930ab0cd4e22eae +Subproject commit 35748a0c1fc63ea3ba7296f8b4e40346426f53b3 From e0e7f5ff1e2393311a7caea1f08fef48adacffb6 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Fri, 27 Jul 2018 10:52:42 +0200 Subject: [PATCH 127/152] fix return type of operator+(int i, T A) This was missing from 9904d3017 (generalize operator+(int i, T A) to template form, Tue Jul 24 17:45:43 2018 +0200). --- tc/external/detail/islpp-inl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tc/external/detail/islpp-inl.h b/tc/external/detail/islpp-inl.h index 6991d257a..d6bb2eb9e 100644 --- a/tc/external/detail/islpp-inl.h +++ b/tc/external/detail/islpp-inl.h @@ -42,7 +42,7 @@ inline isl::aff operator/(isl::aff A, int i) { } template -inline isl::aff operator+(int i, T A) { +inline T operator+(int i, T A) { return A.add_constant_si(i); } From b4ee22e125c45e9b07f5708e6a82a22bb6e35be2 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Fri, 27 Jul 2018 10:54:37 +0200 Subject: [PATCH 128/152] generalize operator+(T A, int i) to template form This will ensure that it also applies to templated isl types derived from isl::aff. Make sure the template type T has an add_constant_si method to avoid the template operator getting triggered on vector types. --- tc/external/detail/islpp-inl.h | 3 ++- tc/external/detail/islpp.h | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tc/external/detail/islpp-inl.h b/tc/external/detail/islpp-inl.h index d6bb2eb9e..f2f778efe 100644 --- a/tc/external/detail/islpp-inl.h +++ b/tc/external/detail/islpp-inl.h @@ -55,7 +55,8 @@ inline isl::aff operator+(isl::val v, isl::aff A) { return A + v; } -inline isl::aff operator+(isl::aff A, int i) { +template +inline auto operator+(T A, int i) -> decltype(A.add_constant_si(i)) { return i + A; } diff --git a/tc/external/detail/islpp.h b/tc/external/detail/islpp.h index 96fa168ff..8e64bac0c 100644 --- a/tc/external/detail/islpp.h +++ b/tc/external/detail/islpp.h @@ -128,7 +128,6 @@ isl::aff operator*(isl::val V, isl::aff A); isl::aff operator/(isl::aff A, int i); -isl::aff operator+(isl::aff A, int i); isl::aff operator+(isl::aff A, isl::val v); isl::aff operator+(isl::val v, isl::aff A); From 017f6b218783e49a59b60f9292b223966e87d9ac Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Tue, 31 Jul 2018 12:36:08 +0200 Subject: [PATCH 129/152] generalize operator-(T A, int i) to template form This will ensure that it also applies to templated isl types derived from isl::aff. Make sure the template type T has an add_constant_si method to avoid the template operator getting triggered on vector types. --- tc/external/detail/islpp-inl.h | 3 ++- tc/external/detail/islpp.h | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tc/external/detail/islpp-inl.h b/tc/external/detail/islpp-inl.h index f2f778efe..5342998e9 100644 --- a/tc/external/detail/islpp-inl.h +++ b/tc/external/detail/islpp-inl.h @@ -60,7 +60,8 @@ inline auto operator+(T A, int i) -> decltype(A.add_constant_si(i)) { return i + A; } -inline isl::aff operator-(isl::aff A, int i) { +template +inline auto operator-(T A, int i) -> decltype(A.add_constant_si(i)) { return A + (-i); } diff --git a/tc/external/detail/islpp.h b/tc/external/detail/islpp.h index 8e64bac0c..d902cfc5d 100644 --- a/tc/external/detail/islpp.h +++ b/tc/external/detail/islpp.h @@ -131,7 +131,6 @@ isl::aff operator/(isl::aff A, int i); isl::aff operator+(isl::aff A, isl::val v); isl::aff operator+(isl::val v, isl::aff A); -isl::aff operator-(isl::aff A, int i); isl::aff operator-(int i, isl::aff A); // Thin wrapper around aff to disambiguate types for operators and avoid case From c6edb23263083aaef9b5a822806c5452e8f42514 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Tue, 31 Jul 2018 15:38:17 +0200 Subject: [PATCH 130/152] generalize operator-(int i, T A) to template form This will ensure that it also applies to templated isl types derived from isl::aff. Make sure the template type T has an add_constant_si method to avoid the template operator getting triggered on vector types. --- tc/external/detail/islpp-inl.h | 5 +++-- tc/external/detail/islpp.h | 2 -- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/tc/external/detail/islpp-inl.h b/tc/external/detail/islpp-inl.h index 5342998e9..005358acc 100644 --- a/tc/external/detail/islpp-inl.h +++ b/tc/external/detail/islpp-inl.h @@ -65,8 +65,9 @@ inline auto operator-(T A, int i) -> decltype(A.add_constant_si(i)) { return A + (-i); } -inline isl::aff operator-(int i, isl::aff A) { - return (A + (-i)).neg(); +template +inline auto operator-(int i, T A) -> decltype(A.add_constant_si(i)) { + return i + A.neg(); } inline isl::set operator>=(isl::aff_set A, isl::val v) { diff --git a/tc/external/detail/islpp.h b/tc/external/detail/islpp.h index d902cfc5d..406fd49d7 100644 --- a/tc/external/detail/islpp.h +++ b/tc/external/detail/islpp.h @@ -131,8 +131,6 @@ isl::aff operator/(isl::aff A, int i); isl::aff operator+(isl::aff A, isl::val v); isl::aff operator+(isl::val v, isl::aff A); -isl::aff operator-(int i, isl::aff A); - // Thin wrapper around aff to disambiguate types for operators and avoid case // where return type overloading occurs struct aff_set { From 4cd6b798338960bdbcfa27a4147c8c97044d38a2 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Mon, 30 Jul 2018 17:55:52 +0200 Subject: [PATCH 131/152] generalize operator/(S left, T right) to template form This will ensure that it also applies to templated isl types derived from isl::multi_aff and isl::multi_val. Make sure the template type T has a scale_down method to avoid the template operator getting triggered on other types. --- tc/external/detail/islpp-inl.h | 3 ++- tc/external/detail/islpp.h | 5 ----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/tc/external/detail/islpp-inl.h b/tc/external/detail/islpp-inl.h index 005358acc..999eaff29 100644 --- a/tc/external/detail/islpp-inl.h +++ b/tc/external/detail/islpp-inl.h @@ -187,7 +187,8 @@ inline isl::map operator<=(isl::aff_map A, isl::aff B) { /////////////////////////////////////////////////////////////////////////////// // Operations on isl::multi_aff /////////////////////////////////////////////////////////////////////////////// -inline isl::multi_aff operator/(isl::multi_aff left, isl::multi_val right) { +template +inline auto operator/(S left, T right) -> decltype(left.scale_down(right)) { return left.scale_down(right); } diff --git a/tc/external/detail/islpp.h b/tc/external/detail/islpp.h index 406fd49d7..59afd5c1f 100644 --- a/tc/external/detail/islpp.h +++ b/tc/external/detail/islpp.h @@ -176,11 +176,6 @@ isl::map operator<=(isl::aff_map A, isl::aff B); isl::map operator>(isl::aff_map A, isl::aff B); isl::map operator<(isl::aff_map A, isl::aff B); -/////////////////////////////////////////////////////////////////////////////// -// Operations on isl::multi_aff -/////////////////////////////////////////////////////////////////////////////// -isl::multi_aff operator/(isl::multi_aff left, isl::multi_val right); - /////////////////////////////////////////////////////////////////////////////// // Operations on isl::set and isl::union_set /////////////////////////////////////////////////////////////////////////////// From 940516d0baa8783213b92461e3c13d232afe4044 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Thu, 26 Jul 2018 09:18:39 +0200 Subject: [PATCH 132/152] bump isl for export of isl_aff_add_constant_val --- isl_interface/include/isl/cpp.h | 26 ++++++++++++++++++++++++++ third-party/islpp | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/isl_interface/include/isl/cpp.h b/isl_interface/include/isl/cpp.h index aa9ce0a00..0a77dcf19 100644 --- a/isl_interface/include/isl/cpp.h +++ b/isl_interface/include/isl/cpp.h @@ -318,6 +318,7 @@ class aff { inline std::string to_str() const; inline isl::aff add(isl::aff aff2) const; + inline isl::aff add_constant(isl::val v) const; inline isl::aff add_constant_si(int v) const; inline isl::aff ceil() const; inline isl::aff div(isl::aff aff2) const; @@ -2166,6 +2167,7 @@ class pw_aff { inline isl::pw_aff neg() const; inline isl::set nonneg_set() const; inline isl::set params() const; + inline isl::set pos_set() const; inline isl::pw_aff project_domain_on_params() const; inline isl::pw_aff pullback(isl::multi_aff ma) const; inline isl::pw_aff pullback(isl::pw_multi_aff pma) const; @@ -3593,6 +3595,18 @@ isl::aff aff::add(isl::aff aff2) const return manage(res); } +isl::aff aff::add_constant(isl::val v) const +{ + if (!ptr || v.is_null()) + throw isl::exception::create(isl_error_invalid, + "NULL input", __FILE__, __LINE__); + options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + auto res = isl_aff_add_constant_val(copy(), v.release()); + if (!res) + throw exception::create_from_last_error(get_ctx()); + return manage(res); +} + isl::aff aff::add_constant_si(int v) const { if (!ptr) @@ -13082,6 +13096,18 @@ isl::set pw_aff::params() const return manage(res); } +isl::set pw_aff::pos_set() const +{ + if (!ptr) + throw isl::exception::create(isl_error_invalid, + "NULL input", __FILE__, __LINE__); + options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + auto res = isl_pw_aff_pos_set(copy()); + if (!res) + throw exception::create_from_last_error(get_ctx()); + return manage(res); +} + isl::pw_aff pw_aff::project_domain_on_params() const { if (!ptr) diff --git a/third-party/islpp b/third-party/islpp index 35748a0c1..6771372d7 160000 --- a/third-party/islpp +++ b/third-party/islpp @@ -1 +1 @@ -Subproject commit 35748a0c1fc63ea3ba7296f8b4e40346426f53b3 +Subproject commit 6771372d7b0f792f05609b2da9a84a71af3aac05 From dd5952aa5803bd7d87acd290bb6c7e15d15bf756 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Fri, 3 Aug 2018 11:26:12 +0200 Subject: [PATCH 133/152] operator+(isl::aff A, isl::val v): call isl::aff::add_constant There is no need to create an extra isl::aff object here. --- tc/external/detail/islpp-inl.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tc/external/detail/islpp-inl.h b/tc/external/detail/islpp-inl.h index 999eaff29..e9cc4a4ec 100644 --- a/tc/external/detail/islpp-inl.h +++ b/tc/external/detail/islpp-inl.h @@ -47,8 +47,7 @@ inline T operator+(int i, T A) { } inline isl::aff operator+(isl::aff A, isl::val v) { - isl::aff T(isl::local_space(A.get_space().domain()), v); - return A.add(T); + return A.add_constant(v); } inline isl::aff operator+(isl::val v, isl::aff A) { From 877508220413837b1a61a7d0e6dec295d9d67871 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Fri, 3 Aug 2018 11:33:14 +0200 Subject: [PATCH 134/152] generalize operator+(T A, isl::val v) to template form This will ensure that it also applies to templated isl types derived from isl::aff. Make sure the template type T has an add_constant method to avoid the template operator getting triggered on other types. --- tc/external/detail/islpp-inl.h | 3 ++- tc/external/detail/islpp.h | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tc/external/detail/islpp-inl.h b/tc/external/detail/islpp-inl.h index e9cc4a4ec..2e57812c3 100644 --- a/tc/external/detail/islpp-inl.h +++ b/tc/external/detail/islpp-inl.h @@ -46,7 +46,8 @@ inline T operator+(int i, T A) { return A.add_constant_si(i); } -inline isl::aff operator+(isl::aff A, isl::val v) { +template +inline auto operator+(T A, isl::val v) -> decltype(A.add_constant(v)) { return A.add_constant(v); } diff --git a/tc/external/detail/islpp.h b/tc/external/detail/islpp.h index 59afd5c1f..df19643a5 100644 --- a/tc/external/detail/islpp.h +++ b/tc/external/detail/islpp.h @@ -128,7 +128,6 @@ isl::aff operator*(isl::val V, isl::aff A); isl::aff operator/(isl::aff A, int i); -isl::aff operator+(isl::aff A, isl::val v); isl::aff operator+(isl::val v, isl::aff A); // Thin wrapper around aff to disambiguate types for operators and avoid case From 7789b79a2328029e7044f0ff18be976f6eaecaf0 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Fri, 3 Aug 2018 10:57:55 +0200 Subject: [PATCH 135/152] generalize operator*(T A, isl::val v) to template form This will ensure that it also applies to templated isl types derived from isl::aff. Make sure the template type T has a scale method to avoid the template operator getting triggered on other types. --- tc/external/detail/islpp-inl.h | 18 ++++++++++-------- tc/external/detail/islpp.h | 2 -- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tc/external/detail/islpp-inl.h b/tc/external/detail/islpp-inl.h index 2e57812c3..8ce3579f9 100644 --- a/tc/external/detail/islpp-inl.h +++ b/tc/external/detail/islpp-inl.h @@ -20,6 +20,16 @@ namespace isl { /////////////////////////////////////////////////////////////////////////////// // Operations on isl::aff to perform arithmetic and create/combine with sets /////////////////////////////////////////////////////////////////////////////// +template +inline auto operator*(isl::val V, T A) -> decltype(A.scale(V)) { + return A.scale(V); +} + +template +inline auto operator*(T A, isl::val V) -> decltype(A.scale(V)) { + return V * A; +} + inline isl::aff operator*(int i, isl::aff A) { isl::val V(isl::val(A.get_ctx(), i)); return A * V; @@ -29,14 +39,6 @@ inline isl::aff operator*(isl::aff A, int i) { return i * A; } -inline isl::aff operator*(isl::val V, isl::aff A) { - return A.scale(V); -} - -inline isl::aff operator*(isl::aff A, isl::val V) { - return V * A; -} - inline isl::aff operator/(isl::aff A, int i) { return A.scale_down(isl::val(A.get_ctx(), i)); } diff --git a/tc/external/detail/islpp.h b/tc/external/detail/islpp.h index df19643a5..612957080 100644 --- a/tc/external/detail/islpp.h +++ b/tc/external/detail/islpp.h @@ -123,8 +123,6 @@ inline bool operator!=(isl::val v1, isl::val v2) { /////////////////////////////////////////////////////////////////////////////// isl::aff operator*(int i, isl::aff A); isl::aff operator*(isl::aff A, int i); -isl::aff operator*(isl::aff A, isl::val V); -isl::aff operator*(isl::val V, isl::aff A); isl::aff operator/(isl::aff A, int i); From 3be2511e3751d366324d1fc3fc0e71aa5c93a168 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Thu, 26 Jul 2018 09:39:09 +0200 Subject: [PATCH 136/152] MappedScop::insertMappingContext: drop redundant universe() call --- tc/core/polyhedral/cuda/mapped_scop.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tc/core/polyhedral/cuda/mapped_scop.cc b/tc/core/polyhedral/cuda/mapped_scop.cc index 02e603b2a..930c92aa3 100644 --- a/tc/core/polyhedral/cuda/mapped_scop.cc +++ b/tc/core/polyhedral/cuda/mapped_scop.cc @@ -862,7 +862,7 @@ void MappedScop::insertMappingContext() { {TX, TX.mappingSize(block)}, {TY, TY.mappingSize(block)}, {TZ, TZ.mappingSize(block)}}; - auto space = scop.domain().universe().get_space(); + auto space = scop.domain().get_space(); auto mappingContext = makeParameterContext( space, mappingIdsWithSizes.begin(), mappingIdsWithSizes.end()); updateTopLevelContext(scop.scheduleRoot(), mappingContext.from_params()); From ed82d3e0afd82619a52a38357622330099df044b Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Fri, 27 Jul 2018 16:06:14 +0200 Subject: [PATCH 137/152] ScheduleTreeBand::drop: do not call domain() on a set space The space of an isl_multi_union_pw_aff is the common range space, i.e., a set space. The current version of isl tolerates calling domain() on a set space, but it is technically incorrect. Call params() instead. Moving to templated isl types will make this issue more evident. --- tc/core/polyhedral/schedule_tree_elem.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tc/core/polyhedral/schedule_tree_elem.cc b/tc/core/polyhedral/schedule_tree_elem.cc index 77db24859..442d805ab 100644 --- a/tc/core/polyhedral/schedule_tree_elem.cc +++ b/tc/core/polyhedral/schedule_tree_elem.cc @@ -235,7 +235,7 @@ void ScheduleTreeBand::drop(size_t pos, size_t n) { auto nBegin = nMember(); auto list = mupa_.get_union_pw_aff_list(); - auto space = mupa_.get_space().domain(); + auto space = mupa_.get_space().params(); list = list.drop(pos, n); space = space.add_unnamed_tuple_ui(list.size()); mupa_ = isl::multi_union_pw_aff(space, list); From a6adf84cecc58fac0de64e66588eaff91d102f9e Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Thu, 2 Aug 2018 12:01:26 +0200 Subject: [PATCH 138/152] memory_promotion.cc: referenceOriginalAccessesImpl: add missing params() call In theory, the isl::union_map::empty factory method expects a parameter space. In practice, isl acceps any kind of space (from which it extracts a parameter space). For switching to templated isl types, it is better to use a consistent type of space. --- tc/core/polyhedral/memory_promotion.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tc/core/polyhedral/memory_promotion.cc b/tc/core/polyhedral/memory_promotion.cc index b1b947c00..ebc7e421f 100644 --- a/tc/core/polyhedral/memory_promotion.cc +++ b/tc/core/polyhedral/memory_promotion.cc @@ -218,7 +218,7 @@ isl::union_map referenceOriginalAccessesImpl( throw promotion::GroupingError("no references in the group"); } auto accesses = isl::union_map::empty( - group.references.front()->originalAccess.get_space()); + group.references.front()->originalAccess.get_space().params()); for (const auto& ref : group.references) { if (ref->type != type) { From 5900b0665fa4c4fee95ac290549180302d0bcd23 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Tue, 31 Jul 2018 11:16:31 +0200 Subject: [PATCH 139/152] Scop::makeScop: automatically deduce type of space variable This will make it easier to switch to templated isl types. --- tc/core/polyhedral/scop.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tc/core/polyhedral/scop.cc b/tc/core/polyhedral/scop.cc index 71d3bc176..41cc17448 100644 --- a/tc/core/polyhedral/scop.cc +++ b/tc/core/polyhedral/scop.cc @@ -51,7 +51,7 @@ ScopUPtr Scop::makeScop( halide2isl::SymbolTable sym = halide2isl::makeSymbolTable(components); - isl::space paramSpace = halide2isl::makeParamSpace(ctx, sym.params); + auto paramSpace = halide2isl::makeParamSpace(ctx, sym.params); ScopUPtr scop(new Scop()); scop->halide.params = sym.params; From 340abcfd0c7b671a14c40f6ee06abcee0d8bec34 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Thu, 21 Jun 2018 12:05:24 +0200 Subject: [PATCH 140/152] halide2isl.cc: extractAccess: automatically deduce type of space variables This will make it easier to switch to templated isl types. --- tc/core/halide2isl.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tc/core/halide2isl.cc b/tc/core/halide2isl.cc index dbc7e60f2..cb46434ba 100644 --- a/tc/core/halide2isl.cc +++ b/tc/core/halide2isl.cc @@ -292,8 +292,8 @@ isl::map extractAccess( std::string tag = "__tc_ref_" + std::to_string(accesses->size()); isl::id tagID(domain.paramSpace.get_ctx(), tag); accesses->emplace(op, tagID); - isl::space domainSpace = map.get_space().domain(); - isl::space tagSpace = domainSpace.params().add_named_tuple_id_ui(tagID, 0); + auto domainSpace = map.get_space().domain(); + auto tagSpace = domainSpace.params().add_named_tuple_id_ui(tagID, 0); domainSpace = domainSpace.product(tagSpace).unwrap(); map = map.preimage_domain(isl::multi_aff::domain_map(domainSpace)); From 3a8e6223541fdeeed7e6624f69b95b3ec59dc866 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Fri, 27 Jul 2018 10:57:56 +0200 Subject: [PATCH 141/152] promotionImprovesCoalescing: use get_map_list This will make it easier to switch to templated types. --- tc/core/polyhedral/cuda/memory_promotion_heuristic.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc b/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc index b1bca6923..928ee904a 100644 --- a/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc +++ b/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc @@ -227,7 +227,7 @@ bool promotionImprovesCoalescing( auto localAccesses = originalAccesses.intersect_domain(activePoints); auto schedule = prefixSchedule(root, marker); auto scheduledAccesses = localAccesses.apply_domain(schedule); - for (auto access : isl::UnionAsVector(scheduledAccesses)) { + for (auto access : scheduledAccesses.get_map_list()) { auto scheduleSpace = access.get_space().domain(); auto tensorSpace = access.get_space().range(); auto elementToNext = makeNextElementMap(tensorSpace, tensorDim - 1); From 5651b42704dd0714431ddb53a79ad87c3020fcbc Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Fri, 27 Jul 2018 21:48:13 +0200 Subject: [PATCH 142/152] addSingletonReferenceGroups: use get_map_list This will make it easier to switch to templated types. --- tc/core/polyhedral/memory_promotion.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tc/core/polyhedral/memory_promotion.cc b/tc/core/polyhedral/memory_promotion.cc index ebc7e421f..37656f09a 100644 --- a/tc/core/polyhedral/memory_promotion.cc +++ b/tc/core/polyhedral/memory_promotion.cc @@ -302,7 +302,7 @@ void addSingletonReferenceGroups( // use currying to isolate the D part before intersecting with the domain // Compute initial groups with single reference per group. std::unordered_set unapproximatable; - for (auto a : isl::UnionAsVector(accesses)) { + for (auto a : accesses.get_map_list()) { if (isl::union_map(a.curry()).intersect_domain(domain).is_empty()) { continue; } From 0036cd2dcd9842ad1e4f8a6ad5dbb21dcf118776 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Fri, 3 Aug 2018 18:43:50 +0200 Subject: [PATCH 143/152] launchBounds: avoid use of to_str() isl methods This is the only instance of a call to to_str(), so there is no immediate need to add it to mainline. Simply use the output operator, which will get added to mainline isl. --- tc/core/polyhedral/cuda/tighten_launch_bounds.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tc/core/polyhedral/cuda/tighten_launch_bounds.cc b/tc/core/polyhedral/cuda/tighten_launch_bounds.cc index c398d4161..5c8581120 100644 --- a/tc/core/polyhedral/cuda/tighten_launch_bounds.cc +++ b/tc/core/polyhedral/cuda/tighten_launch_bounds.cc @@ -57,8 +57,8 @@ Size launchBounds(const MappedScop& mscop, Size size) { for (size_t i = 0; i < size.view.size(); ++i) { auto maxVal = max.get_val(i); - TC_CHECK(maxVal.is_int()) << maxVal.to_str(); - TC_CHECK(maxVal.is_nonneg()) << maxVal.to_str(); + TC_CHECK(maxVal.is_int()) << maxVal; + TC_CHECK(maxVal.is_nonneg()) << maxVal; // Inclusive range needs + 1 to translate to sizes tightened.view[i] = maxVal.get_num_si() + 1; } From 7c172e598017056e962777aaa35af88f0dea6edf Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Wed, 8 Aug 2018 13:56:49 +0200 Subject: [PATCH 144/152] test_core: drop construction of schedule The schedule was used in prehistory to compare against a schedule computed in another way. Since the comparison has been removed, there is no point in constructing the schedule. --- test/test_core.cc | 3 --- 1 file changed, 3 deletions(-) diff --git a/test/test_core.cc b/test/test_core.cc index 88a2ff8bc..b0bc8e5b2 100644 --- a/test/test_core.cc +++ b/test/test_core.cc @@ -251,9 +251,6 @@ struct TC2Isl : public ::testing::Test { polyhedral::detail::validateSchedule(scop->scheduleRoot()); // Just check no crashes auto outputs = inferOutputTensorInfo(comps, {in.get()}); - // Check schedule construction equality - auto scheduleHalide = polyhedral::detail::fromIslSchedule( - polyhedral::detail::toIslSchedule(scop->scheduleRoot()).reset_user()); } }; From 5eef9d7b1f4fa8b6f290f5dc1590541b82749ce7 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Wed, 8 Aug 2018 14:02:45 +0200 Subject: [PATCH 145/152] test_cuda_mapper.cc: drop removal of user pointers from isl_id objects In prehistory, user pointers were being stored in isl_id objects and then it was in some cases necessary to remove them. Since no such user pointers are being used in the current code base there is no point in trying to remove them. --- test/test_cuda_mapper.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test_cuda_mapper.cc b/test/test_cuda_mapper.cc index c019b403e..bd9f304a7 100644 --- a/test/test_cuda_mapper.cc +++ b/test/test_cuda_mapper.cc @@ -133,7 +133,7 @@ struct PolyhedralMapperTest : public ::testing::Test { auto schedule = scop.scheduleRoot(); auto schedule2 = ScheduleTree::makeScheduleTree(*schedule); // make a copy bandTile(schedule->child({0}), tileSizes, tileOptions); - auto scheduleISLPP = fromIslSchedule(toIslSchedule(schedule).reset_user()); + auto scheduleISLPP = fromIslSchedule(toIslSchedule(schedule)); { auto ctx = isl::with_exceptions::globalIslCtx(); @@ -143,7 +143,7 @@ struct PolyhedralMapperTest : public ::testing::Test { schedule2->child({0})->as()->mupa_.get_space(), tileSizes); islNode = islNode.as().tile(mv); - auto scheduleISL = fromIslSchedule(islNode.get_schedule().reset_user()); + auto scheduleISL = fromIslSchedule(islNode.get_schedule()); ASSERT_TRUE(*scheduleISL == *scheduleISLPP) << *scheduleISL << "\nVS\n" << *scheduleISLPP; From 6865ad897d27db931d4f3f76160bccee6c80dee6 Mon Sep 17 00:00:00 2001 From: Nicolas Vasilache Date: Thu, 9 Aug 2018 09:24:17 +0200 Subject: [PATCH 146/152] Update installation.rst Update documentation to explain why `pytorch=0.4.0` is now mandatory. --- docs/source/installation.rst | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/source/installation.rst b/docs/source/installation.rst index 8233f2d76..0da17a4ba 100644 --- a/docs/source/installation.rst +++ b/docs/source/installation.rst @@ -68,12 +68,12 @@ Create a new environment in which TC will be built and install core dependencies conda install -y pyyaml mkl-include pytest conda install -y -c nicolasvasilache llvm-trunk halide -Then install the PyTorch version that corresponds to your system binaries +Then install the PyTorch 0.4.0 version that corresponds to your system binaries (e.g. cuda 9.0): .. code-block:: bash - conda install -y -c pytorch pytorch torchvision cuda90 + conda install -y -c pytorch pytorch=0.4.0 torchvision cuda90 conda remove -y cudatoolkit --force .. note:: @@ -84,6 +84,12 @@ Then install the PyTorch version that corresponds to your system binaries libraries and we remove it explicitly. In a near future, the unified PyTorch + Caffe2 build system will link everything statically and stop pulling the cudatoolkit dependency. + + .. note:: + As of PyTorch 0.4.1, the ATen library is no shipped in libATen.so anymore. It is + now instead part of libcaffe2.so. In shipping binaries, the PyTorch team opted + to use the older GCC 4.9.2 C++ ABI. TC only supports the newer ABI. As a consequence + TC must link with the libraries provided by the `pytorch=0.4.0` package. Activate conda in your current terminal """""""""""""""""""""""""""""""""""""""""""""""""""" From 6668481d55353e0ad856e01c45bc189256526a73 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Mon, 6 Aug 2018 15:19:08 +0200 Subject: [PATCH 147/152] Scop::makeScop: only copy dependences if they have been computed The C++ bindings from mainline isl do not allow an object to be explicitly assigned a NULL value. --- tc/core/polyhedral/scop.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tc/core/polyhedral/scop.h b/tc/core/polyhedral/scop.h index 796974d9f..b8d9c7982 100644 --- a/tc/core/polyhedral/scop.h +++ b/tc/core/polyhedral/scop.h @@ -71,7 +71,9 @@ struct Scop { res->parameterValues = scop.parameterValues; res->halide = scop.halide; res->body = scop.body; - res->dependences = scop.dependences; + if (scop.dependences) { + res->dependences = scop.dependences; + } res->scheduleTreeUPtr = detail::ScheduleTree::makeScheduleTree(*scop.scheduleTreeUPtr); res->treeSyncUpdateMap = scop.treeSyncUpdateMap; From 5281e66e321255eb3161187eefd1809be139dabd Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Mon, 6 Aug 2018 14:33:00 +0200 Subject: [PATCH 148/152] bump isl for merge of C++ bindings --- isl_interface/CMakeLists.txt | 1 + isl_interface/include/isl/cpp.h | 14348 +++++++++++++++--------------- third-party/islpp | 2 +- 3 files changed, 7251 insertions(+), 7100 deletions(-) diff --git a/isl_interface/CMakeLists.txt b/isl_interface/CMakeLists.txt index e51621299..6ddb04b75 100644 --- a/isl_interface/CMakeLists.txt +++ b/isl_interface/CMakeLists.txt @@ -76,6 +76,7 @@ execute_process(COMMAND include_directories(.) add_executable(extract_isl_interface ${ISL_INTERFACE_DIR}/cpp.cc + ${ISL_INTERFACE_DIR}/cpp_conversion.cc ${ISL_INTERFACE_DIR}/extract_interface.cc ${ISL_INTERFACE_DIR}/generator.cc ${ISL_INTERFACE_DIR}/python.cc diff --git a/isl_interface/include/isl/cpp.h b/isl_interface/include/isl/cpp.h index 0a77dcf19..a08305047 100644 --- a/isl_interface/include/isl/cpp.h +++ b/isl_interface/include/isl/cpp.h @@ -32,6 +32,20 @@ #include #include +/* ISL_USE_EXCEPTIONS should be defined to 1 if exceptions are available. + * gcc and clang define __cpp_exceptions; MSVC and xlC define _CPPUNWIND. + * Older versions of gcc (e.g., 4.9) only define __EXCEPTIONS. + * If exceptions are not available, any error condition will result + * in an abort. + */ +#ifndef ISL_USE_EXCEPTIONS +#if defined(__cpp_exceptions) || defined(_CPPUNWIND) || defined(__EXCEPTIONS) +#define ISL_USE_EXCEPTIONS 1 +#else +#define ISL_USE_EXCEPTIONS 0 +#endif +#endif + namespace isl { class ctx { @@ -48,6 +62,20 @@ class ctx { } }; +/* Macros hiding try/catch. + * If exceptions are not available, then no exceptions will be thrown and + * there is nothing to catch. + */ +#if ISL_USE_EXCEPTIONS +#define ISL_CPP_TRY try +#define ISL_CPP_CATCH_ALL catch (...) +#else +#define ISL_CPP_TRY if (1) +#define ISL_CPP_CATCH_ALL if (0) +#endif + +#if ISL_USE_EXCEPTIONS + /* Class capturing isl errors. * * The what() return value is stored in a reference counted string @@ -67,10 +95,29 @@ class exception : public std::exception { } static inline exception create(enum isl_error error, const char *msg, const char *file, int line); - static inline exception create_from_last_error(isl::ctx ctx); + static inline exception create_from_last_error(ctx ctx); virtual const char *what() const noexcept { return what_str->c_str(); } + + /* Default behavior on error conditions that occur inside isl calls + * performed from inside the bindings. + * In the case exceptions are available, isl should continue + * without printing a warning since the warning message + * will be included in the exception thrown from inside the bindings. + */ + static constexpr auto on_error = ISL_ON_ERROR_CONTINUE; + /* Wrapper for throwing an exception with the given message. + */ + static void throw_invalid(const char *msg, const char *file, int line) { + throw create(isl_error_invalid, msg, file, line); + } + /* Wrapper for throwing an exception corresponding to the last + * error on "ctx". + */ + static void throw_last_error(ctx ctx) { + throw create_from_last_error(ctx); + } }; /* Create an exception of a type described by "what_arg", with @@ -153,7 +200,7 @@ exception exception::create(enum isl_error error, const char *msg, return exception_unsupported(msg, file, line); } - throw exception_invalid("invalid error type", __FILE__, __LINE__); + throw exception_invalid("invalid error type", file, line); } /* Create an exception from the last error that occurred on "ctx" and @@ -162,7 +209,7 @@ exception exception::create(enum isl_error error, const char *msg, * If "ctx" is NULL or if it is not in an error state at the start, * then an invalid argument exception is thrown. */ -exception exception::create_from_last_error(isl::ctx ctx) +exception exception::create_from_last_error(ctx ctx) { enum isl_error error; const char *msg, *file; @@ -177,6 +224,37 @@ exception exception::create_from_last_error(isl::ctx ctx) return create(error, msg, file, line); } +#else + +#include +#include + +class exception { +public: + /* Default behavior on error conditions that occur inside isl calls + * performed from inside the bindings. + * In the case exceptions are not available, isl should abort. + */ + static constexpr auto on_error = ISL_ON_ERROR_ABORT; + /* Wrapper for throwing an exception with the given message. + * In the case exceptions are not available, print an error and abort. + */ + static void throw_invalid(const char *msg, const char *file, int line) { + fprintf(stderr, "%s:%d: %s\n", file, line, msg); + abort(); + } + /* Wrapper for throwing an exception corresponding to the last + * error on "ctx". + * isl should already abort when an error condition occurs, + * so this function should never be called. + */ + static void throw_last_error(ctx ctx) { + abort(); + } +}; + +#endif + /* Helper class for setting the on_error and resetting the option * to the original value when leaving the scope. */ @@ -184,7 +262,7 @@ class options_scoped_set_on_error { isl_ctx *ctx; int saved_on_error; public: - options_scoped_set_on_error(isl::ctx ctx, int on_error) { + options_scoped_set_on_error(class ctx ctx, int on_error) { this->ctx = ctx.get(); saved_on_error = isl_options_get_on_error(this->ctx); isl_options_set_on_error(this->ctx, on_error); @@ -288,12 +366,12 @@ class val; class val_list; // declarations for isl::aff -inline isl::aff manage(__isl_take isl_aff *ptr); -inline isl::aff manage_copy(__isl_keep isl_aff *ptr); +inline aff manage(__isl_take isl_aff *ptr); +inline aff manage_copy(__isl_keep isl_aff *ptr); class aff { - friend inline isl::aff manage(__isl_take isl_aff *ptr); - friend inline isl::aff manage_copy(__isl_keep isl_aff *ptr); + friend inline aff manage(__isl_take isl_aff *ptr); + friend inline aff manage_copy(__isl_keep isl_aff *ptr); protected: isl_aff *ptr = nullptr; @@ -302,11 +380,11 @@ class aff { public: inline /* implicit */ aff(); - inline /* implicit */ aff(const isl::aff &obj); - inline explicit aff(isl::local_space ls); - inline explicit aff(isl::local_space ls, isl::val val); - inline explicit aff(isl::ctx ctx, const std::string &str); - inline isl::aff &operator=(isl::aff obj); + inline /* implicit */ aff(const aff &obj); + inline explicit aff(local_space ls); + inline explicit aff(local_space ls, val val); + inline explicit aff(ctx ctx, const std::string &str); + inline aff &operator=(aff obj); inline ~aff(); inline __isl_give isl_aff *copy() const &; inline __isl_give isl_aff *copy() && = delete; @@ -314,52 +392,52 @@ class aff { inline __isl_give isl_aff *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::aff add(isl::aff aff2) const; - inline isl::aff add_constant(isl::val v) const; - inline isl::aff add_constant_si(int v) const; - inline isl::aff ceil() const; - inline isl::aff div(isl::aff aff2) const; - inline isl::set eq_set(isl::aff aff2) const; - inline isl::val eval(isl::point pnt) const; - inline isl::aff floor() const; - inline isl::set ge_set(isl::aff aff2) const; - inline isl::val get_constant_val() const; - inline isl::val get_denominator_val() const; - inline isl::aff get_div(int pos) const; - inline isl::local_space get_local_space() const; - inline isl::space get_space() const; - inline isl::set gt_set(isl::aff aff2) const; - inline isl::set le_set(isl::aff aff2) const; - inline isl::set lt_set(isl::aff aff2) const; - inline isl::aff mod(isl::val mod) const; - inline isl::aff mul(isl::aff aff2) const; - inline isl::set ne_set(isl::aff aff2) const; - inline isl::aff neg() const; - static inline isl::aff param_on_domain_space(isl::space space, isl::id id); - inline bool plain_is_equal(const isl::aff &aff2) const; - inline isl::aff project_domain_on_params() const; - inline isl::aff pullback(isl::multi_aff ma) const; - inline isl::aff scale(isl::val v) const; - inline isl::aff scale_down(isl::val v) const; - inline isl::aff scale_down_ui(unsigned int f) const; - inline isl::aff set_constant_si(int v) const; - inline isl::aff set_constant_val(isl::val v) const; - inline isl::aff sub(isl::aff aff2) const; - inline isl::aff unbind_params_insert_domain(isl::multi_id domain) const; - static inline isl::aff zero_on_domain(isl::space space); + inline aff add(aff aff2) const; + inline aff add_constant(val v) const; + inline aff add_constant_si(int v) const; + inline aff ceil() const; + inline aff div(aff aff2) const; + inline set eq_set(aff aff2) const; + inline val eval(point pnt) const; + inline aff floor() const; + inline set ge_set(aff aff2) const; + inline val get_constant_val() const; + inline val get_denominator_val() const; + inline aff get_div(int pos) const; + inline local_space get_local_space() const; + inline space get_space() const; + inline set gt_set(aff aff2) const; + inline set le_set(aff aff2) const; + inline set lt_set(aff aff2) const; + inline aff mod(val mod) const; + inline aff mul(aff aff2) const; + inline set ne_set(aff aff2) const; + inline aff neg() const; + static inline aff param_on_domain_space(space space, id id); + inline bool plain_is_equal(const aff &aff2) const; + inline aff project_domain_on_params() const; + inline aff pullback(multi_aff ma) const; + inline aff scale(val v) const; + inline aff scale_down(val v) const; + inline aff scale_down_ui(unsigned int f) const; + inline aff set_constant_si(int v) const; + inline aff set_constant_val(val v) const; + inline aff sub(aff aff2) const; + inline aff unbind_params_insert_domain(multi_id domain) const; + static inline aff zero_on_domain(space space); typedef isl_aff* isl_ptr_t; }; // declarations for isl::aff_list -inline isl::aff_list manage(__isl_take isl_aff_list *ptr); -inline isl::aff_list manage_copy(__isl_keep isl_aff_list *ptr); +inline aff_list manage(__isl_take isl_aff_list *ptr); +inline aff_list manage_copy(__isl_keep isl_aff_list *ptr); class aff_list { - friend inline isl::aff_list manage(__isl_take isl_aff_list *ptr); - friend inline isl::aff_list manage_copy(__isl_keep isl_aff_list *ptr); + friend inline aff_list manage(__isl_take isl_aff_list *ptr); + friend inline aff_list manage_copy(__isl_keep isl_aff_list *ptr); protected: isl_aff_list *ptr = nullptr; @@ -368,10 +446,10 @@ class aff_list { public: inline /* implicit */ aff_list(); - inline /* implicit */ aff_list(const isl::aff_list &obj); - inline explicit aff_list(isl::aff el); - inline explicit aff_list(isl::ctx ctx, int n); - inline isl::aff_list &operator=(isl::aff_list obj); + inline /* implicit */ aff_list(const aff_list &obj); + inline explicit aff_list(aff el); + inline explicit aff_list(ctx ctx, int n); + inline aff_list &operator=(aff_list obj); inline ~aff_list(); inline __isl_give isl_aff_list *copy() const &; inline __isl_give isl_aff_list *copy() && = delete; @@ -379,25 +457,25 @@ class aff_list { inline __isl_give isl_aff_list *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; - - inline isl::aff_list add(isl::aff el) const; - inline isl::aff_list concat(isl::aff_list list2) const; - inline isl::aff_list drop(unsigned int first, unsigned int n) const; - inline void foreach(const std::function &fn) const; - inline isl::aff get_at(int index) const; - inline isl::aff_list reverse() const; + inline ctx get_ctx() const; + + inline aff_list add(aff el) const; + inline aff_list concat(aff_list list2) const; + inline aff_list drop(unsigned int first, unsigned int n) const; + inline void foreach(const std::function &fn) const; + inline aff get_at(int index) const; + inline aff_list reverse() const; inline int size() const; typedef isl_aff_list* isl_ptr_t; }; // declarations for isl::ast_build -inline isl::ast_build manage(__isl_take isl_ast_build *ptr); -inline isl::ast_build manage_copy(__isl_keep isl_ast_build *ptr); +inline ast_build manage(__isl_take isl_ast_build *ptr); +inline ast_build manage_copy(__isl_keep isl_ast_build *ptr); class ast_build { - friend inline isl::ast_build manage(__isl_take isl_ast_build *ptr); - friend inline isl::ast_build manage_copy(__isl_keep isl_ast_build *ptr); + friend inline ast_build manage(__isl_take isl_ast_build *ptr); + friend inline ast_build manage_copy(__isl_keep isl_ast_build *ptr); protected: isl_ast_build *ptr = nullptr; @@ -406,9 +484,9 @@ class ast_build { public: inline /* implicit */ ast_build(); - inline /* implicit */ ast_build(const isl::ast_build &obj); - inline explicit ast_build(isl::ctx ctx); - inline isl::ast_build &operator=(isl::ast_build obj); + inline /* implicit */ ast_build(const ast_build &obj); + inline explicit ast_build(ctx ctx); + inline ast_build &operator=(ast_build obj); inline ~ast_build(); inline __isl_give isl_ast_build *copy() const &; inline __isl_give isl_ast_build *copy() && = delete; @@ -416,42 +494,42 @@ class ast_build { inline __isl_give isl_ast_build *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; private: - inline isl::ast_build ©_callbacks(const isl::ast_build &obj); + inline ast_build ©_callbacks(const ast_build &obj); struct at_each_domain_data { - std::function func; + std::function func; std::exception_ptr eptr; }; std::shared_ptr at_each_domain_data; static inline isl_ast_node *at_each_domain(isl_ast_node *arg_0, isl_ast_build *arg_1, void *arg_2); - inline void set_at_each_domain_data(const std::function &fn); + inline void set_at_each_domain_data(const std::function &fn); public: - inline isl::ast_build set_at_each_domain(const std::function &fn) const; - inline isl::ast_expr access_from(isl::pw_multi_aff pma) const; - inline isl::ast_expr access_from(isl::multi_pw_aff mpa) const; - inline isl::ast_node ast_from_schedule(isl::union_map schedule) const; - inline isl::ast_expr call_from(isl::pw_multi_aff pma) const; - inline isl::ast_expr call_from(isl::multi_pw_aff mpa) const; - inline isl::ast_expr expr_from(isl::set set) const; - inline isl::ast_expr expr_from(isl::pw_aff pa) const; - static inline isl::ast_build from_context(isl::set set); - inline isl::union_map get_schedule() const; - inline isl::space get_schedule_space() const; - inline isl::ast_node node_from(isl::schedule schedule) const; - inline isl::ast_node node_from_schedule_map(isl::union_map schedule) const; - inline isl::ast_build set_iterators(isl::id_list iterators) const; + inline ast_build set_at_each_domain(const std::function &fn) const; + inline ast_expr access_from(pw_multi_aff pma) const; + inline ast_expr access_from(multi_pw_aff mpa) const; + inline ast_node ast_from_schedule(union_map schedule) const; + inline ast_expr call_from(pw_multi_aff pma) const; + inline ast_expr call_from(multi_pw_aff mpa) const; + inline ast_expr expr_from(set set) const; + inline ast_expr expr_from(pw_aff pa) const; + static inline ast_build from_context(set set); + inline union_map get_schedule() const; + inline space get_schedule_space() const; + inline ast_node node_from(schedule schedule) const; + inline ast_node node_from_schedule_map(union_map schedule) const; + inline ast_build set_iterators(id_list iterators) const; typedef isl_ast_build* isl_ptr_t; }; // declarations for isl::ast_expr -inline isl::ast_expr manage(__isl_take isl_ast_expr *ptr); -inline isl::ast_expr manage_copy(__isl_keep isl_ast_expr *ptr); +inline ast_expr manage(__isl_take isl_ast_expr *ptr); +inline ast_expr manage_copy(__isl_keep isl_ast_expr *ptr); class ast_expr { - friend inline isl::ast_expr manage(__isl_take isl_ast_expr *ptr); - friend inline isl::ast_expr manage_copy(__isl_keep isl_ast_expr *ptr); + friend inline ast_expr manage(__isl_take isl_ast_expr *ptr); + friend inline ast_expr manage_copy(__isl_keep isl_ast_expr *ptr); protected: isl_ast_expr *ptr = nullptr; @@ -460,8 +538,8 @@ class ast_expr { public: inline /* implicit */ ast_expr(); - inline /* implicit */ ast_expr(const isl::ast_expr &obj); - inline isl::ast_expr &operator=(isl::ast_expr obj); + inline /* implicit */ ast_expr(const ast_expr &obj); + inline ast_expr &operator=(ast_expr obj); inline ~ast_expr(); inline __isl_give isl_ast_expr *copy() const &; inline __isl_give isl_ast_expr *copy() && = delete; @@ -471,11 +549,11 @@ class ast_expr { inline explicit operator bool() const; template inline bool isa(); template inline T as(); - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - inline bool is_equal(const isl::ast_expr &expr2) const; - inline isl::ast_expr set_op_arg(int pos, isl::ast_expr arg) const; + inline bool is_equal(const ast_expr &expr2) const; + inline ast_expr set_op_arg(int pos, ast_expr arg) const; inline std::string to_C_str() const; typedef isl_ast_expr* isl_ptr_t; }; @@ -492,12 +570,12 @@ class ast_expr_id : public ast_expr { public: inline /* implicit */ ast_expr_id(); - inline /* implicit */ ast_expr_id(const isl::ast_expr_id &obj); - inline isl::ast_expr_id &operator=(isl::ast_expr_id obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_expr_id(const ast_expr_id &obj); + inline ast_expr_id &operator=(ast_expr_id obj); + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::id get_id() const; + inline id get_id() const; typedef isl_ast_expr* isl_ptr_t; }; @@ -513,12 +591,12 @@ class ast_expr_int : public ast_expr { public: inline /* implicit */ ast_expr_int(); - inline /* implicit */ ast_expr_int(const isl::ast_expr_int &obj); - inline isl::ast_expr_int &operator=(isl::ast_expr_int obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_expr_int(const ast_expr_int &obj); + inline ast_expr_int &operator=(ast_expr_int obj); + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::val get_val() const; + inline val get_val() const; typedef isl_ast_expr* isl_ptr_t; }; @@ -534,25 +612,25 @@ class ast_expr_op : public ast_expr { public: inline /* implicit */ ast_expr_op(); - inline /* implicit */ ast_expr_op(const isl::ast_expr_op &obj); - inline isl::ast_expr_op &operator=(isl::ast_expr_op obj); + inline /* implicit */ ast_expr_op(const ast_expr_op &obj); + inline ast_expr_op &operator=(ast_expr_op obj); template inline bool isa(); template inline T as(); - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::ast_expr get_arg(int pos) const; + inline ast_expr get_arg(int pos) const; inline int get_n_arg() const; typedef isl_ast_expr* isl_ptr_t; }; // declarations for isl::ast_node -inline isl::ast_node manage(__isl_take isl_ast_node *ptr); -inline isl::ast_node manage_copy(__isl_keep isl_ast_node *ptr); +inline ast_node manage(__isl_take isl_ast_node *ptr); +inline ast_node manage_copy(__isl_keep isl_ast_node *ptr); class ast_node { - friend inline isl::ast_node manage(__isl_take isl_ast_node *ptr); - friend inline isl::ast_node manage_copy(__isl_keep isl_ast_node *ptr); + friend inline ast_node manage(__isl_take isl_ast_node *ptr); + friend inline ast_node manage_copy(__isl_keep isl_ast_node *ptr); protected: isl_ast_node *ptr = nullptr; @@ -561,8 +639,8 @@ class ast_node { public: inline /* implicit */ ast_node(); - inline /* implicit */ ast_node(const isl::ast_node &obj); - inline isl::ast_node &operator=(isl::ast_node obj); + inline /* implicit */ ast_node(const ast_node &obj); + inline ast_node &operator=(ast_node obj); inline ~ast_node(); inline __isl_give isl_ast_node *copy() const &; inline __isl_give isl_ast_node *copy() && = delete; @@ -572,11 +650,11 @@ class ast_node { inline explicit operator bool() const; template inline bool isa(); template inline T as(); - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::id get_annotation() const; - inline isl::ast_node set_annotation(isl::id annotation) const; + inline id get_annotation() const; + inline ast_node set_annotation(id annotation) const; inline std::string to_C_str() const; typedef isl_ast_node* isl_ptr_t; }; @@ -593,12 +671,12 @@ class ast_node_block : public ast_node { public: inline /* implicit */ ast_node_block(); - inline /* implicit */ ast_node_block(const isl::ast_node_block &obj); - inline isl::ast_node_block &operator=(isl::ast_node_block obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_node_block(const ast_node_block &obj); + inline ast_node_block &operator=(ast_node_block obj); + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::ast_node_list get_children() const; + inline ast_node_list get_children() const; typedef isl_ast_node* isl_ptr_t; }; @@ -614,16 +692,16 @@ class ast_node_for : public ast_node { public: inline /* implicit */ ast_node_for(); - inline /* implicit */ ast_node_for(const isl::ast_node_for &obj); - inline isl::ast_node_for &operator=(isl::ast_node_for obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_node_for(const ast_node_for &obj); + inline ast_node_for &operator=(ast_node_for obj); + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::ast_node get_body() const; - inline isl::ast_expr get_cond() const; - inline isl::ast_expr get_inc() const; - inline isl::ast_expr get_init() const; - inline isl::ast_expr get_iterator() const; + inline ast_node get_body() const; + inline ast_expr get_cond() const; + inline ast_expr get_inc() const; + inline ast_expr get_init() const; + inline ast_expr get_iterator() const; inline bool is_coincident() const; inline bool is_degenerate() const; typedef isl_ast_node* isl_ptr_t; @@ -641,25 +719,25 @@ class ast_node_if : public ast_node { public: inline /* implicit */ ast_node_if(); - inline /* implicit */ ast_node_if(const isl::ast_node_if &obj); - inline isl::ast_node_if &operator=(isl::ast_node_if obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_node_if(const ast_node_if &obj); + inline ast_node_if &operator=(ast_node_if obj); + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::ast_expr get_cond() const; - inline isl::ast_node get_else() const; - inline isl::ast_node get_then() const; + inline ast_expr get_cond() const; + inline ast_node get_else() const; + inline ast_node get_then() const; inline bool has_else() const; typedef isl_ast_node* isl_ptr_t; }; // declarations for isl::ast_node_list -inline isl::ast_node_list manage(__isl_take isl_ast_node_list *ptr); -inline isl::ast_node_list manage_copy(__isl_keep isl_ast_node_list *ptr); +inline ast_node_list manage(__isl_take isl_ast_node_list *ptr); +inline ast_node_list manage_copy(__isl_keep isl_ast_node_list *ptr); class ast_node_list { - friend inline isl::ast_node_list manage(__isl_take isl_ast_node_list *ptr); - friend inline isl::ast_node_list manage_copy(__isl_keep isl_ast_node_list *ptr); + friend inline ast_node_list manage(__isl_take isl_ast_node_list *ptr); + friend inline ast_node_list manage_copy(__isl_keep isl_ast_node_list *ptr); protected: isl_ast_node_list *ptr = nullptr; @@ -668,10 +746,10 @@ class ast_node_list { public: inline /* implicit */ ast_node_list(); - inline /* implicit */ ast_node_list(const isl::ast_node_list &obj); - inline explicit ast_node_list(isl::ast_node el); - inline explicit ast_node_list(isl::ctx ctx, int n); - inline isl::ast_node_list &operator=(isl::ast_node_list obj); + inline /* implicit */ ast_node_list(const ast_node_list &obj); + inline explicit ast_node_list(ast_node el); + inline explicit ast_node_list(ctx ctx, int n); + inline ast_node_list &operator=(ast_node_list obj); inline ~ast_node_list(); inline __isl_give isl_ast_node_list *copy() const &; inline __isl_give isl_ast_node_list *copy() && = delete; @@ -679,14 +757,14 @@ class ast_node_list { inline __isl_give isl_ast_node_list *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; - - inline isl::ast_node_list add(isl::ast_node el) const; - inline isl::ast_node_list concat(isl::ast_node_list list2) const; - inline isl::ast_node_list drop(unsigned int first, unsigned int n) const; - inline void foreach(const std::function &fn) const; - inline isl::ast_node get_at(int index) const; - inline isl::ast_node_list reverse() const; + inline ctx get_ctx() const; + + inline ast_node_list add(ast_node el) const; + inline ast_node_list concat(ast_node_list list2) const; + inline ast_node_list drop(unsigned int first, unsigned int n) const; + inline void foreach(const std::function &fn) const; + inline ast_node get_at(int index) const; + inline ast_node_list reverse() const; inline int size() const; typedef isl_ast_node_list* isl_ptr_t; }; @@ -703,13 +781,13 @@ class ast_node_mark : public ast_node { public: inline /* implicit */ ast_node_mark(); - inline /* implicit */ ast_node_mark(const isl::ast_node_mark &obj); - inline isl::ast_node_mark &operator=(isl::ast_node_mark obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_node_mark(const ast_node_mark &obj); + inline ast_node_mark &operator=(ast_node_mark obj); + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::id get_id() const; - inline isl::ast_node get_node() const; + inline id get_id() const; + inline ast_node get_node() const; typedef isl_ast_node* isl_ptr_t; }; @@ -725,12 +803,12 @@ class ast_node_user : public ast_node { public: inline /* implicit */ ast_node_user(); - inline /* implicit */ ast_node_user(const isl::ast_node_user &obj); - inline isl::ast_node_user &operator=(isl::ast_node_user obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_node_user(const ast_node_user &obj); + inline ast_node_user &operator=(ast_node_user obj); + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::ast_expr get_expr() const; + inline ast_expr get_expr() const; typedef isl_ast_node* isl_ptr_t; }; @@ -746,9 +824,9 @@ class ast_op_access : public ast_expr_op { public: inline /* implicit */ ast_op_access(); - inline /* implicit */ ast_op_access(const isl::ast_op_access &obj); - inline isl::ast_op_access &operator=(isl::ast_op_access obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_access(const ast_op_access &obj); + inline ast_op_access &operator=(ast_op_access obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; @@ -766,9 +844,9 @@ class ast_op_add : public ast_expr_op { public: inline /* implicit */ ast_op_add(); - inline /* implicit */ ast_op_add(const isl::ast_op_add &obj); - inline isl::ast_op_add &operator=(isl::ast_op_add obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_add(const ast_op_add &obj); + inline ast_op_add &operator=(ast_op_add obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; @@ -786,9 +864,9 @@ class ast_op_address_of : public ast_expr_op { public: inline /* implicit */ ast_op_address_of(); - inline /* implicit */ ast_op_address_of(const isl::ast_op_address_of &obj); - inline isl::ast_op_address_of &operator=(isl::ast_op_address_of obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_address_of(const ast_op_address_of &obj); + inline ast_op_address_of &operator=(ast_op_address_of obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; @@ -806,9 +884,9 @@ class ast_op_and : public ast_expr_op { public: inline /* implicit */ ast_op_and(); - inline /* implicit */ ast_op_and(const isl::ast_op_and &obj); - inline isl::ast_op_and &operator=(isl::ast_op_and obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_and(const ast_op_and &obj); + inline ast_op_and &operator=(ast_op_and obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; @@ -826,9 +904,9 @@ class ast_op_and_then : public ast_expr_op { public: inline /* implicit */ ast_op_and_then(); - inline /* implicit */ ast_op_and_then(const isl::ast_op_and_then &obj); - inline isl::ast_op_and_then &operator=(isl::ast_op_and_then obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_and_then(const ast_op_and_then &obj); + inline ast_op_and_then &operator=(ast_op_and_then obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; @@ -846,9 +924,9 @@ class ast_op_call : public ast_expr_op { public: inline /* implicit */ ast_op_call(); - inline /* implicit */ ast_op_call(const isl::ast_op_call &obj); - inline isl::ast_op_call &operator=(isl::ast_op_call obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_call(const ast_op_call &obj); + inline ast_op_call &operator=(ast_op_call obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; @@ -866,9 +944,9 @@ class ast_op_cond : public ast_expr_op { public: inline /* implicit */ ast_op_cond(); - inline /* implicit */ ast_op_cond(const isl::ast_op_cond &obj); - inline isl::ast_op_cond &operator=(isl::ast_op_cond obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_cond(const ast_op_cond &obj); + inline ast_op_cond &operator=(ast_op_cond obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; @@ -886,9 +964,9 @@ class ast_op_div : public ast_expr_op { public: inline /* implicit */ ast_op_div(); - inline /* implicit */ ast_op_div(const isl::ast_op_div &obj); - inline isl::ast_op_div &operator=(isl::ast_op_div obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_div(const ast_op_div &obj); + inline ast_op_div &operator=(ast_op_div obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; @@ -906,9 +984,9 @@ class ast_op_eq : public ast_expr_op { public: inline /* implicit */ ast_op_eq(); - inline /* implicit */ ast_op_eq(const isl::ast_op_eq &obj); - inline isl::ast_op_eq &operator=(isl::ast_op_eq obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_eq(const ast_op_eq &obj); + inline ast_op_eq &operator=(ast_op_eq obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; @@ -926,9 +1004,9 @@ class ast_op_fdiv_q : public ast_expr_op { public: inline /* implicit */ ast_op_fdiv_q(); - inline /* implicit */ ast_op_fdiv_q(const isl::ast_op_fdiv_q &obj); - inline isl::ast_op_fdiv_q &operator=(isl::ast_op_fdiv_q obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_fdiv_q(const ast_op_fdiv_q &obj); + inline ast_op_fdiv_q &operator=(ast_op_fdiv_q obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; @@ -946,9 +1024,9 @@ class ast_op_ge : public ast_expr_op { public: inline /* implicit */ ast_op_ge(); - inline /* implicit */ ast_op_ge(const isl::ast_op_ge &obj); - inline isl::ast_op_ge &operator=(isl::ast_op_ge obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_ge(const ast_op_ge &obj); + inline ast_op_ge &operator=(ast_op_ge obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; @@ -966,9 +1044,9 @@ class ast_op_gt : public ast_expr_op { public: inline /* implicit */ ast_op_gt(); - inline /* implicit */ ast_op_gt(const isl::ast_op_gt &obj); - inline isl::ast_op_gt &operator=(isl::ast_op_gt obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_gt(const ast_op_gt &obj); + inline ast_op_gt &operator=(ast_op_gt obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; @@ -986,9 +1064,9 @@ class ast_op_le : public ast_expr_op { public: inline /* implicit */ ast_op_le(); - inline /* implicit */ ast_op_le(const isl::ast_op_le &obj); - inline isl::ast_op_le &operator=(isl::ast_op_le obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_le(const ast_op_le &obj); + inline ast_op_le &operator=(ast_op_le obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; @@ -1006,9 +1084,9 @@ class ast_op_lt : public ast_expr_op { public: inline /* implicit */ ast_op_lt(); - inline /* implicit */ ast_op_lt(const isl::ast_op_lt &obj); - inline isl::ast_op_lt &operator=(isl::ast_op_lt obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_lt(const ast_op_lt &obj); + inline ast_op_lt &operator=(ast_op_lt obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; @@ -1026,9 +1104,9 @@ class ast_op_max : public ast_expr_op { public: inline /* implicit */ ast_op_max(); - inline /* implicit */ ast_op_max(const isl::ast_op_max &obj); - inline isl::ast_op_max &operator=(isl::ast_op_max obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_max(const ast_op_max &obj); + inline ast_op_max &operator=(ast_op_max obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; @@ -1046,9 +1124,9 @@ class ast_op_member : public ast_expr_op { public: inline /* implicit */ ast_op_member(); - inline /* implicit */ ast_op_member(const isl::ast_op_member &obj); - inline isl::ast_op_member &operator=(isl::ast_op_member obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_member(const ast_op_member &obj); + inline ast_op_member &operator=(ast_op_member obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; @@ -1066,9 +1144,9 @@ class ast_op_min : public ast_expr_op { public: inline /* implicit */ ast_op_min(); - inline /* implicit */ ast_op_min(const isl::ast_op_min &obj); - inline isl::ast_op_min &operator=(isl::ast_op_min obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_min(const ast_op_min &obj); + inline ast_op_min &operator=(ast_op_min obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; @@ -1086,9 +1164,9 @@ class ast_op_minus : public ast_expr_op { public: inline /* implicit */ ast_op_minus(); - inline /* implicit */ ast_op_minus(const isl::ast_op_minus &obj); - inline isl::ast_op_minus &operator=(isl::ast_op_minus obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_minus(const ast_op_minus &obj); + inline ast_op_minus &operator=(ast_op_minus obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; @@ -1106,9 +1184,9 @@ class ast_op_mul : public ast_expr_op { public: inline /* implicit */ ast_op_mul(); - inline /* implicit */ ast_op_mul(const isl::ast_op_mul &obj); - inline isl::ast_op_mul &operator=(isl::ast_op_mul obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_mul(const ast_op_mul &obj); + inline ast_op_mul &operator=(ast_op_mul obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; @@ -1126,9 +1204,9 @@ class ast_op_or : public ast_expr_op { public: inline /* implicit */ ast_op_or(); - inline /* implicit */ ast_op_or(const isl::ast_op_or &obj); - inline isl::ast_op_or &operator=(isl::ast_op_or obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_or(const ast_op_or &obj); + inline ast_op_or &operator=(ast_op_or obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; @@ -1146,9 +1224,9 @@ class ast_op_or_else : public ast_expr_op { public: inline /* implicit */ ast_op_or_else(); - inline /* implicit */ ast_op_or_else(const isl::ast_op_or_else &obj); - inline isl::ast_op_or_else &operator=(isl::ast_op_or_else obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_or_else(const ast_op_or_else &obj); + inline ast_op_or_else &operator=(ast_op_or_else obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; @@ -1166,9 +1244,9 @@ class ast_op_pdiv_q : public ast_expr_op { public: inline /* implicit */ ast_op_pdiv_q(); - inline /* implicit */ ast_op_pdiv_q(const isl::ast_op_pdiv_q &obj); - inline isl::ast_op_pdiv_q &operator=(isl::ast_op_pdiv_q obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_pdiv_q(const ast_op_pdiv_q &obj); + inline ast_op_pdiv_q &operator=(ast_op_pdiv_q obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; @@ -1186,9 +1264,9 @@ class ast_op_pdiv_r : public ast_expr_op { public: inline /* implicit */ ast_op_pdiv_r(); - inline /* implicit */ ast_op_pdiv_r(const isl::ast_op_pdiv_r &obj); - inline isl::ast_op_pdiv_r &operator=(isl::ast_op_pdiv_r obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_pdiv_r(const ast_op_pdiv_r &obj); + inline ast_op_pdiv_r &operator=(ast_op_pdiv_r obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; @@ -1206,9 +1284,9 @@ class ast_op_select : public ast_expr_op { public: inline /* implicit */ ast_op_select(); - inline /* implicit */ ast_op_select(const isl::ast_op_select &obj); - inline isl::ast_op_select &operator=(isl::ast_op_select obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_select(const ast_op_select &obj); + inline ast_op_select &operator=(ast_op_select obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; @@ -1226,9 +1304,9 @@ class ast_op_sub : public ast_expr_op { public: inline /* implicit */ ast_op_sub(); - inline /* implicit */ ast_op_sub(const isl::ast_op_sub &obj); - inline isl::ast_op_sub &operator=(isl::ast_op_sub obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_sub(const ast_op_sub &obj); + inline ast_op_sub &operator=(ast_op_sub obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; @@ -1246,21 +1324,21 @@ class ast_op_zdiv_r : public ast_expr_op { public: inline /* implicit */ ast_op_zdiv_r(); - inline /* implicit */ ast_op_zdiv_r(const isl::ast_op_zdiv_r &obj); - inline isl::ast_op_zdiv_r &operator=(isl::ast_op_zdiv_r obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_zdiv_r(const ast_op_zdiv_r &obj); + inline ast_op_zdiv_r &operator=(ast_op_zdiv_r obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; }; // declarations for isl::basic_map -inline isl::basic_map manage(__isl_take isl_basic_map *ptr); -inline isl::basic_map manage_copy(__isl_keep isl_basic_map *ptr); +inline basic_map manage(__isl_take isl_basic_map *ptr); +inline basic_map manage_copy(__isl_keep isl_basic_map *ptr); class basic_map { - friend inline isl::basic_map manage(__isl_take isl_basic_map *ptr); - friend inline isl::basic_map manage_copy(__isl_keep isl_basic_map *ptr); + friend inline basic_map manage(__isl_take isl_basic_map *ptr); + friend inline basic_map manage_copy(__isl_keep isl_basic_map *ptr); protected: isl_basic_map *ptr = nullptr; @@ -1269,12 +1347,12 @@ class basic_map { public: inline /* implicit */ basic_map(); - inline /* implicit */ basic_map(const isl::basic_map &obj); - inline explicit basic_map(isl::ctx ctx, const std::string &str); - inline explicit basic_map(isl::basic_set domain, isl::basic_set range); - inline explicit basic_map(isl::aff aff); - inline explicit basic_map(isl::multi_aff maff); - inline isl::basic_map &operator=(isl::basic_map obj); + inline /* implicit */ basic_map(const basic_map &obj); + inline explicit basic_map(ctx ctx, const std::string &str); + inline explicit basic_map(basic_set domain, basic_set range); + inline explicit basic_map(aff aff); + inline explicit basic_map(multi_aff maff); + inline basic_map &operator=(basic_map obj); inline ~basic_map(); inline __isl_give isl_basic_map *copy() const &; inline __isl_give isl_basic_map *copy() && = delete; @@ -1282,49 +1360,49 @@ class basic_map { inline __isl_give isl_basic_map *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::basic_map affine_hull() const; - inline isl::basic_map apply_domain(isl::basic_map bmap2) const; - inline isl::basic_map apply_range(isl::basic_map bmap2) const; + inline basic_map affine_hull() const; + inline basic_map apply_domain(basic_map bmap2) const; + inline basic_map apply_range(basic_map bmap2) const; inline bool can_curry() const; inline bool can_uncurry() const; - inline isl::basic_map curry() const; - inline isl::basic_set deltas() const; - inline isl::basic_map detect_equalities() const; - inline isl::basic_set domain() const; - static inline isl::basic_map empty(isl::space space); - inline isl::basic_map flatten() const; - inline isl::basic_map flatten_domain() const; - inline isl::basic_map flatten_range() const; - static inline isl::basic_map from_domain(isl::basic_set bset); - static inline isl::basic_map from_range(isl::basic_set bset); - inline isl::space get_space() const; - inline isl::basic_map gist(isl::basic_map context) const; - inline isl::basic_map intersect(isl::basic_map bmap2) const; - inline isl::basic_map intersect_domain(isl::basic_set bset) const; - inline isl::basic_map intersect_range(isl::basic_set bset) const; + inline basic_map curry() const; + inline basic_set deltas() const; + inline basic_map detect_equalities() const; + inline basic_set domain() const; + static inline basic_map empty(space space); + inline basic_map flatten() const; + inline basic_map flatten_domain() const; + inline basic_map flatten_range() const; + static inline basic_map from_domain(basic_set bset); + static inline basic_map from_range(basic_set bset); + inline space get_space() const; + inline basic_map gist(basic_map context) const; + inline basic_map intersect(basic_map bmap2) const; + inline basic_map intersect_domain(basic_set bset) const; + inline basic_map intersect_range(basic_set bset) const; inline bool is_empty() const; - inline bool is_equal(const isl::basic_map &bmap2) const; - inline bool is_subset(const isl::basic_map &bmap2) const; - inline isl::map lexmax() const; - inline isl::map lexmin() const; - inline isl::basic_map reverse() const; - inline isl::basic_map sample() const; - inline isl::basic_map uncurry() const; - inline isl::map unite(isl::basic_map bmap2) const; - inline isl::basic_set wrap() const; + inline bool is_equal(const basic_map &bmap2) const; + inline bool is_subset(const basic_map &bmap2) const; + inline map lexmax() const; + inline map lexmin() const; + inline basic_map reverse() const; + inline basic_map sample() const; + inline basic_map uncurry() const; + inline map unite(basic_map bmap2) const; + inline basic_set wrap() const; typedef isl_basic_map* isl_ptr_t; }; // declarations for isl::basic_map_list -inline isl::basic_map_list manage(__isl_take isl_basic_map_list *ptr); -inline isl::basic_map_list manage_copy(__isl_keep isl_basic_map_list *ptr); +inline basic_map_list manage(__isl_take isl_basic_map_list *ptr); +inline basic_map_list manage_copy(__isl_keep isl_basic_map_list *ptr); class basic_map_list { - friend inline isl::basic_map_list manage(__isl_take isl_basic_map_list *ptr); - friend inline isl::basic_map_list manage_copy(__isl_keep isl_basic_map_list *ptr); + friend inline basic_map_list manage(__isl_take isl_basic_map_list *ptr); + friend inline basic_map_list manage_copy(__isl_keep isl_basic_map_list *ptr); protected: isl_basic_map_list *ptr = nullptr; @@ -1333,10 +1411,10 @@ class basic_map_list { public: inline /* implicit */ basic_map_list(); - inline /* implicit */ basic_map_list(const isl::basic_map_list &obj); - inline explicit basic_map_list(isl::basic_map el); - inline explicit basic_map_list(isl::ctx ctx, int n); - inline isl::basic_map_list &operator=(isl::basic_map_list obj); + inline /* implicit */ basic_map_list(const basic_map_list &obj); + inline explicit basic_map_list(basic_map el); + inline explicit basic_map_list(ctx ctx, int n); + inline basic_map_list &operator=(basic_map_list obj); inline ~basic_map_list(); inline __isl_give isl_basic_map_list *copy() const &; inline __isl_give isl_basic_map_list *copy() && = delete; @@ -1344,26 +1422,26 @@ class basic_map_list { inline __isl_give isl_basic_map_list *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; - - inline isl::basic_map_list add(isl::basic_map el) const; - inline isl::basic_map_list concat(isl::basic_map_list list2) const; - inline isl::basic_map_list drop(unsigned int first, unsigned int n) const; - inline void foreach(const std::function &fn) const; - inline isl::basic_map get_at(int index) const; - inline isl::basic_map intersect() const; - inline isl::basic_map_list reverse() const; + inline ctx get_ctx() const; + + inline basic_map_list add(basic_map el) const; + inline basic_map_list concat(basic_map_list list2) const; + inline basic_map_list drop(unsigned int first, unsigned int n) const; + inline void foreach(const std::function &fn) const; + inline basic_map get_at(int index) const; + inline basic_map intersect() const; + inline basic_map_list reverse() const; inline int size() const; typedef isl_basic_map_list* isl_ptr_t; }; // declarations for isl::basic_set -inline isl::basic_set manage(__isl_take isl_basic_set *ptr); -inline isl::basic_set manage_copy(__isl_keep isl_basic_set *ptr); +inline basic_set manage(__isl_take isl_basic_set *ptr); +inline basic_set manage_copy(__isl_keep isl_basic_set *ptr); class basic_set { - friend inline isl::basic_set manage(__isl_take isl_basic_set *ptr); - friend inline isl::basic_set manage_copy(__isl_keep isl_basic_set *ptr); + friend inline basic_set manage(__isl_take isl_basic_set *ptr); + friend inline basic_set manage_copy(__isl_keep isl_basic_set *ptr); protected: isl_basic_set *ptr = nullptr; @@ -1372,10 +1450,10 @@ class basic_set { public: inline /* implicit */ basic_set(); - inline /* implicit */ basic_set(const isl::basic_set &obj); - inline /* implicit */ basic_set(isl::point pnt); - inline explicit basic_set(isl::ctx ctx, const std::string &str); - inline isl::basic_set &operator=(isl::basic_set obj); + inline /* implicit */ basic_set(const basic_set &obj); + inline /* implicit */ basic_set(point pnt); + inline explicit basic_set(ctx ctx, const std::string &str); + inline basic_set &operator=(basic_set obj); inline ~basic_set(); inline __isl_give isl_basic_set *copy() const &; inline __isl_give isl_basic_set *copy() && = delete; @@ -1383,49 +1461,49 @@ class basic_set { inline __isl_give isl_basic_set *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::basic_set affine_hull() const; - inline isl::basic_set apply(isl::basic_map bmap) const; - inline isl::set compute_divs() const; - inline isl::basic_set detect_equalities() const; - inline isl::val dim_max_val(int pos) const; - inline isl::basic_set flatten() const; - inline isl::basic_set from_params() const; - inline isl::space get_space() const; - inline isl::basic_set gist(isl::basic_set context) const; - inline isl::basic_set intersect(isl::basic_set bset2) const; - inline isl::basic_set intersect_params(isl::basic_set bset2) const; + inline basic_set affine_hull() const; + inline basic_set apply(basic_map bmap) const; + inline set compute_divs() const; + inline basic_set detect_equalities() const; + inline val dim_max_val(int pos) const; + inline basic_set flatten() const; + inline basic_set from_params() const; + inline space get_space() const; + inline basic_set gist(basic_set context) const; + inline basic_set intersect(basic_set bset2) const; + inline basic_set intersect_params(basic_set bset2) const; inline bool is_empty() const; - inline bool is_equal(const isl::basic_set &bset2) const; - inline bool is_subset(const isl::basic_set &bset2) const; + inline bool is_equal(const basic_set &bset2) const; + inline bool is_subset(const basic_set &bset2) const; inline bool is_universe() const; inline bool is_wrapping() const; - inline isl::set lexmax() const; - inline isl::set lexmin() const; - inline isl::val max_val(const isl::aff &obj) const; + inline set lexmax() const; + inline set lexmin() const; + inline val max_val(const aff &obj) const; inline unsigned int n_dim() const; inline unsigned int n_param() const; - static inline isl::basic_set nat_universe(isl::space dim); - inline isl::basic_set params() const; + static inline basic_set nat_universe(space dim); + inline basic_set params() const; inline bool plain_is_universe() const; - inline isl::basic_set sample() const; - inline isl::point sample_point() const; - inline isl::basic_set set_tuple_id(isl::id id) const; - inline isl::set unite(isl::basic_set bset2) const; - static inline isl::basic_set universe(isl::space space); - inline isl::basic_map unwrap() const; + inline basic_set sample() const; + inline point sample_point() const; + inline basic_set set_tuple_id(id id) const; + inline set unite(basic_set bset2) const; + static inline basic_set universe(space space); + inline basic_map unwrap() const; typedef isl_basic_set* isl_ptr_t; }; // declarations for isl::basic_set_list -inline isl::basic_set_list manage(__isl_take isl_basic_set_list *ptr); -inline isl::basic_set_list manage_copy(__isl_keep isl_basic_set_list *ptr); +inline basic_set_list manage(__isl_take isl_basic_set_list *ptr); +inline basic_set_list manage_copy(__isl_keep isl_basic_set_list *ptr); class basic_set_list { - friend inline isl::basic_set_list manage(__isl_take isl_basic_set_list *ptr); - friend inline isl::basic_set_list manage_copy(__isl_keep isl_basic_set_list *ptr); + friend inline basic_set_list manage(__isl_take isl_basic_set_list *ptr); + friend inline basic_set_list manage_copy(__isl_keep isl_basic_set_list *ptr); protected: isl_basic_set_list *ptr = nullptr; @@ -1434,10 +1512,10 @@ class basic_set_list { public: inline /* implicit */ basic_set_list(); - inline /* implicit */ basic_set_list(const isl::basic_set_list &obj); - inline explicit basic_set_list(isl::basic_set el); - inline explicit basic_set_list(isl::ctx ctx, int n); - inline isl::basic_set_list &operator=(isl::basic_set_list obj); + inline /* implicit */ basic_set_list(const basic_set_list &obj); + inline explicit basic_set_list(basic_set el); + inline explicit basic_set_list(ctx ctx, int n); + inline basic_set_list &operator=(basic_set_list obj); inline ~basic_set_list(); inline __isl_give isl_basic_set_list *copy() const &; inline __isl_give isl_basic_set_list *copy() && = delete; @@ -1445,25 +1523,25 @@ class basic_set_list { inline __isl_give isl_basic_set_list *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; - - inline isl::basic_set_list add(isl::basic_set el) const; - inline isl::basic_set_list concat(isl::basic_set_list list2) const; - inline isl::basic_set_list drop(unsigned int first, unsigned int n) const; - inline void foreach(const std::function &fn) const; - inline isl::basic_set get_at(int index) const; - inline isl::basic_set_list reverse() const; + inline ctx get_ctx() const; + + inline basic_set_list add(basic_set el) const; + inline basic_set_list concat(basic_set_list list2) const; + inline basic_set_list drop(unsigned int first, unsigned int n) const; + inline void foreach(const std::function &fn) const; + inline basic_set get_at(int index) const; + inline basic_set_list reverse() const; inline int size() const; typedef isl_basic_set_list* isl_ptr_t; }; // declarations for isl::fixed_box -inline isl::fixed_box manage(__isl_take isl_fixed_box *ptr); -inline isl::fixed_box manage_copy(__isl_keep isl_fixed_box *ptr); +inline fixed_box manage(__isl_take isl_fixed_box *ptr); +inline fixed_box manage_copy(__isl_keep isl_fixed_box *ptr); class fixed_box { - friend inline isl::fixed_box manage(__isl_take isl_fixed_box *ptr); - friend inline isl::fixed_box manage_copy(__isl_keep isl_fixed_box *ptr); + friend inline fixed_box manage(__isl_take isl_fixed_box *ptr); + friend inline fixed_box manage_copy(__isl_keep isl_fixed_box *ptr); protected: isl_fixed_box *ptr = nullptr; @@ -1472,8 +1550,8 @@ class fixed_box { public: inline /* implicit */ fixed_box(); - inline /* implicit */ fixed_box(const isl::fixed_box &obj); - inline isl::fixed_box &operator=(isl::fixed_box obj); + inline /* implicit */ fixed_box(const fixed_box &obj); + inline fixed_box &operator=(fixed_box obj); inline ~fixed_box(); inline __isl_give isl_fixed_box *copy() const &; inline __isl_give isl_fixed_box *copy() && = delete; @@ -1481,22 +1559,22 @@ class fixed_box { inline __isl_give isl_fixed_box *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; - inline isl::multi_aff get_offset() const; - inline isl::multi_val get_size() const; - inline isl::space get_space() const; + inline multi_aff get_offset() const; + inline multi_val get_size() const; + inline space get_space() const; inline bool is_valid() const; typedef isl_fixed_box* isl_ptr_t; }; // declarations for isl::id -inline isl::id manage(__isl_take isl_id *ptr); -inline isl::id manage_copy(__isl_keep isl_id *ptr); +inline id manage(__isl_take isl_id *ptr); +inline id manage_copy(__isl_keep isl_id *ptr); class id { - friend inline isl::id manage(__isl_take isl_id *ptr); - friend inline isl::id manage_copy(__isl_keep isl_id *ptr); + friend inline id manage(__isl_take isl_id *ptr); + friend inline id manage_copy(__isl_keep isl_id *ptr); protected: isl_id *ptr = nullptr; @@ -1505,9 +1583,9 @@ class id { public: inline /* implicit */ id(); - inline /* implicit */ id(const isl::id &obj); - inline explicit id(isl::ctx ctx, const std::string &str); - inline isl::id &operator=(isl::id obj); + inline /* implicit */ id(const id &obj); + inline explicit id(ctx ctx, const std::string &str); + inline id &operator=(id obj); inline ~id(); inline __isl_give isl_id *copy() const &; inline __isl_give isl_id *copy() && = delete; @@ -1515,7 +1593,7 @@ class id { inline __isl_give isl_id *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; inline std::string get_name() const; @@ -1523,12 +1601,12 @@ class id { }; // declarations for isl::id_list -inline isl::id_list manage(__isl_take isl_id_list *ptr); -inline isl::id_list manage_copy(__isl_keep isl_id_list *ptr); +inline id_list manage(__isl_take isl_id_list *ptr); +inline id_list manage_copy(__isl_keep isl_id_list *ptr); class id_list { - friend inline isl::id_list manage(__isl_take isl_id_list *ptr); - friend inline isl::id_list manage_copy(__isl_keep isl_id_list *ptr); + friend inline id_list manage(__isl_take isl_id_list *ptr); + friend inline id_list manage_copy(__isl_keep isl_id_list *ptr); protected: isl_id_list *ptr = nullptr; @@ -1537,10 +1615,10 @@ class id_list { public: inline /* implicit */ id_list(); - inline /* implicit */ id_list(const isl::id_list &obj); - inline explicit id_list(isl::id el); - inline explicit id_list(isl::ctx ctx, int n); - inline isl::id_list &operator=(isl::id_list obj); + inline /* implicit */ id_list(const id_list &obj); + inline explicit id_list(id el); + inline explicit id_list(ctx ctx, int n); + inline id_list &operator=(id_list obj); inline ~id_list(); inline __isl_give isl_id_list *copy() const &; inline __isl_give isl_id_list *copy() && = delete; @@ -1548,25 +1626,25 @@ class id_list { inline __isl_give isl_id_list *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; - - inline isl::id_list add(isl::id el) const; - inline isl::id_list concat(isl::id_list list2) const; - inline isl::id_list drop(unsigned int first, unsigned int n) const; - inline void foreach(const std::function &fn) const; - inline isl::id get_at(int index) const; - inline isl::id_list reverse() const; + inline ctx get_ctx() const; + + inline id_list add(id el) const; + inline id_list concat(id_list list2) const; + inline id_list drop(unsigned int first, unsigned int n) const; + inline void foreach(const std::function &fn) const; + inline id get_at(int index) const; + inline id_list reverse() const; inline int size() const; typedef isl_id_list* isl_ptr_t; }; // declarations for isl::local_space -inline isl::local_space manage(__isl_take isl_local_space *ptr); -inline isl::local_space manage_copy(__isl_keep isl_local_space *ptr); +inline local_space manage(__isl_take isl_local_space *ptr); +inline local_space manage_copy(__isl_keep isl_local_space *ptr); class local_space { - friend inline isl::local_space manage(__isl_take isl_local_space *ptr); - friend inline isl::local_space manage_copy(__isl_keep isl_local_space *ptr); + friend inline local_space manage(__isl_take isl_local_space *ptr); + friend inline local_space manage_copy(__isl_keep isl_local_space *ptr); protected: isl_local_space *ptr = nullptr; @@ -1575,9 +1653,9 @@ class local_space { public: inline /* implicit */ local_space(); - inline /* implicit */ local_space(const isl::local_space &obj); - inline explicit local_space(isl::space dim); - inline isl::local_space &operator=(isl::local_space obj); + inline /* implicit */ local_space(const local_space &obj); + inline explicit local_space(space dim); + inline local_space &operator=(local_space obj); inline ~local_space(); inline __isl_give isl_local_space *copy() const &; inline __isl_give isl_local_space *copy() && = delete; @@ -1585,31 +1663,31 @@ class local_space { inline __isl_give isl_local_space *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; - - inline isl::local_space domain() const; - inline isl::local_space flatten_domain() const; - inline isl::local_space flatten_range() const; - inline isl::local_space from_domain() const; - inline isl::aff get_div(int pos) const; - inline isl::space get_space() const; - inline isl::local_space intersect(isl::local_space ls2) const; - inline bool is_equal(const isl::local_space &ls2) const; + inline ctx get_ctx() const; + + inline local_space domain() const; + inline local_space flatten_domain() const; + inline local_space flatten_range() const; + inline local_space from_domain() const; + inline aff get_div(int pos) const; + inline space get_space() const; + inline local_space intersect(local_space ls2) const; + inline bool is_equal(const local_space &ls2) const; inline bool is_params() const; inline bool is_set() const; - inline isl::basic_map lifting() const; - inline isl::local_space range() const; - inline isl::local_space wrap() const; + inline basic_map lifting() const; + inline local_space range() const; + inline local_space wrap() const; typedef isl_local_space* isl_ptr_t; }; // declarations for isl::map -inline isl::map manage(__isl_take isl_map *ptr); -inline isl::map manage_copy(__isl_keep isl_map *ptr); +inline map manage(__isl_take isl_map *ptr); +inline map manage_copy(__isl_keep isl_map *ptr); class map { - friend inline isl::map manage(__isl_take isl_map *ptr); - friend inline isl::map manage_copy(__isl_keep isl_map *ptr); + friend inline map manage(__isl_take isl_map *ptr); + friend inline map manage_copy(__isl_keep isl_map *ptr); protected: isl_map *ptr = nullptr; @@ -1618,13 +1696,13 @@ class map { public: inline /* implicit */ map(); - inline /* implicit */ map(const isl::map &obj); - inline explicit map(isl::ctx ctx, const std::string &str); - inline /* implicit */ map(isl::basic_map bmap); - inline explicit map(isl::set domain, isl::set range); - inline explicit map(isl::aff aff); - inline explicit map(isl::multi_aff maff); - inline isl::map &operator=(isl::map obj); + inline /* implicit */ map(const map &obj); + inline explicit map(ctx ctx, const std::string &str); + inline /* implicit */ map(basic_map bmap); + inline explicit map(set domain, set range); + inline explicit map(aff aff); + inline explicit map(multi_aff maff); + inline map &operator=(map obj); inline ~map(); inline __isl_give isl_map *copy() const &; inline __isl_give isl_map *copy() && = delete; @@ -1632,89 +1710,90 @@ class map { inline __isl_give isl_map *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::basic_map affine_hull() const; - inline isl::map apply_domain(isl::map map2) const; - inline isl::map apply_range(isl::map map2) const; + inline basic_map affine_hull() const; + inline map apply_domain(map map2) const; + inline map apply_range(map map2) const; inline bool can_curry() const; inline bool can_range_curry() const; inline bool can_uncurry() const; - inline isl::map coalesce() const; - inline isl::map complement() const; - inline isl::map compute_divs() const; - inline isl::map curry() const; - inline isl::set deltas() const; - inline isl::map detect_equalities() const; - inline isl::set domain() const; - inline isl::map domain_factor_domain() const; - inline isl::map domain_factor_range() const; - inline isl::map domain_map() const; - inline isl::map domain_product(isl::map map2) const; - static inline isl::map empty(isl::space space); - inline isl::map flatten() const; - inline isl::map flatten_domain() const; - inline isl::map flatten_range() const; - inline void foreach_basic_map(const std::function &fn) const; - static inline isl::map from(isl::pw_multi_aff pma); - static inline isl::map from(isl::union_map umap); - static inline isl::map from_domain(isl::set set); - static inline isl::map from_range(isl::set set); - inline isl::basic_map_list get_basic_map_list() const; - inline isl::fixed_box get_range_simple_fixed_box_hull() const; - inline isl::stride_info get_range_stride_info(int pos) const; - inline isl::id get_range_tuple_id() const; - inline isl::space get_space() const; - inline isl::map gist(isl::map context) const; - inline isl::map gist_domain(isl::set context) const; - static inline isl::map identity(isl::space dim); - inline isl::map intersect(isl::map map2) const; - inline isl::map intersect_domain(isl::set set) const; - inline isl::map intersect_params(isl::set params) const; - inline isl::map intersect_range(isl::set set) const; + inline map coalesce() const; + inline map complement() const; + inline map compute_divs() const; + inline map curry() const; + inline set deltas() const; + inline map detect_equalities() const; + inline set domain() const; + inline map domain_factor_domain() const; + inline map domain_factor_range() const; + inline map domain_map() const; + inline map domain_product(map map2) const; + static inline map empty(space space); + inline map flatten() const; + inline map flatten_domain() const; + inline map flatten_range() const; + inline void foreach_basic_map(const std::function &fn) const; + static inline map from(pw_multi_aff pma); + static inline map from(union_map umap); + static inline map from_domain(set set); + static inline map from_range(set set); + inline basic_map_list get_basic_map_list() const; + inline fixed_box get_range_simple_fixed_box_hull() const; + inline stride_info get_range_stride_info(int pos) const; + inline id get_range_tuple_id() const; + inline space get_space() const; + inline map gist(map context) const; + inline map gist_domain(set context) const; + static inline map identity(space dim); + inline map intersect(map map2) const; + inline map intersect_domain(set set) const; + inline map intersect_params(set params) const; + inline map intersect_range(set set) const; inline bool is_bijective() const; - inline bool is_disjoint(const isl::map &map2) const; + inline bool is_disjoint(const map &map2) const; inline bool is_empty() const; - inline bool is_equal(const isl::map &map2) const; + inline bool is_equal(const map &map2) const; inline bool is_injective() const; inline bool is_single_valued() const; - inline bool is_strict_subset(const isl::map &map2) const; - inline bool is_subset(const isl::map &map2) const; - inline isl::map lexmax() const; - inline isl::map lexmin() const; + inline bool is_strict_subset(const map &map2) const; + inline bool is_subset(const map &map2) const; + inline map lexmax() const; + inline map lexmin() const; inline int n_basic_map() const; - inline isl::set params() const; - inline isl::basic_map polyhedral_hull() const; - inline isl::map preimage_domain(isl::multi_aff ma) const; - inline isl::map preimage_range(isl::multi_aff ma) const; - inline isl::set range() const; - inline isl::map range_curry() const; - inline isl::map range_factor_domain() const; - inline isl::map range_factor_range() const; - inline isl::map range_map() const; - inline isl::map range_product(isl::map map2) const; - inline isl::map reverse() const; - inline isl::basic_map sample() const; - inline isl::map set_range_tuple_id(isl::id id) const; - inline isl::basic_map simple_hull() const; - inline isl::map subtract(isl::map map2) const; - inline isl::map sum(isl::map map2) const; - inline isl::map uncurry() const; - inline isl::map unite(isl::map map2) const; - static inline isl::map universe(isl::space space); - inline isl::basic_map unshifted_simple_hull() const; - inline isl::set wrap() const; + inline set params() const; + inline basic_map polyhedral_hull() const; + inline map preimage_domain(multi_aff ma) const; + inline map preimage_range(multi_aff ma) const; + inline set range() const; + inline map range_curry() const; + inline map range_factor_domain() const; + inline map range_factor_range() const; + inline map range_map() const; + inline map range_product(map map2) const; + inline map reverse() const; + inline basic_map sample() const; + inline map set_range_tuple_id(id id) const; + inline basic_map simple_hull() const; + inline map subtract(map map2) const; + inline map sum(map map2) const; + inline map uncurry() const; + inline map unite(map map2) const; + static inline map universe(space space); + inline basic_map unshifted_simple_hull() const; + inline set wrap() const; + inline map zip() const; typedef isl_map* isl_ptr_t; }; // declarations for isl::map_list -inline isl::map_list manage(__isl_take isl_map_list *ptr); -inline isl::map_list manage_copy(__isl_keep isl_map_list *ptr); +inline map_list manage(__isl_take isl_map_list *ptr); +inline map_list manage_copy(__isl_keep isl_map_list *ptr); class map_list { - friend inline isl::map_list manage(__isl_take isl_map_list *ptr); - friend inline isl::map_list manage_copy(__isl_keep isl_map_list *ptr); + friend inline map_list manage(__isl_take isl_map_list *ptr); + friend inline map_list manage_copy(__isl_keep isl_map_list *ptr); protected: isl_map_list *ptr = nullptr; @@ -1723,10 +1802,10 @@ class map_list { public: inline /* implicit */ map_list(); - inline /* implicit */ map_list(const isl::map_list &obj); - inline explicit map_list(isl::map el); - inline explicit map_list(isl::ctx ctx, int n); - inline isl::map_list &operator=(isl::map_list obj); + inline /* implicit */ map_list(const map_list &obj); + inline explicit map_list(map el); + inline explicit map_list(ctx ctx, int n); + inline map_list &operator=(map_list obj); inline ~map_list(); inline __isl_give isl_map_list *copy() const &; inline __isl_give isl_map_list *copy() && = delete; @@ -1734,25 +1813,25 @@ class map_list { inline __isl_give isl_map_list *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; - - inline isl::map_list add(isl::map el) const; - inline isl::map_list concat(isl::map_list list2) const; - inline isl::map_list drop(unsigned int first, unsigned int n) const; - inline void foreach(const std::function &fn) const; - inline isl::map get_at(int index) const; - inline isl::map_list reverse() const; + inline ctx get_ctx() const; + + inline map_list add(map el) const; + inline map_list concat(map_list list2) const; + inline map_list drop(unsigned int first, unsigned int n) const; + inline void foreach(const std::function &fn) const; + inline map get_at(int index) const; + inline map_list reverse() const; inline int size() const; typedef isl_map_list* isl_ptr_t; }; // declarations for isl::multi_aff -inline isl::multi_aff manage(__isl_take isl_multi_aff *ptr); -inline isl::multi_aff manage_copy(__isl_keep isl_multi_aff *ptr); +inline multi_aff manage(__isl_take isl_multi_aff *ptr); +inline multi_aff manage_copy(__isl_keep isl_multi_aff *ptr); class multi_aff { - friend inline isl::multi_aff manage(__isl_take isl_multi_aff *ptr); - friend inline isl::multi_aff manage_copy(__isl_keep isl_multi_aff *ptr); + friend inline multi_aff manage(__isl_take isl_multi_aff *ptr); + friend inline multi_aff manage_copy(__isl_keep isl_multi_aff *ptr); protected: isl_multi_aff *ptr = nullptr; @@ -1761,11 +1840,11 @@ class multi_aff { public: inline /* implicit */ multi_aff(); - inline /* implicit */ multi_aff(const isl::multi_aff &obj); - inline /* implicit */ multi_aff(isl::aff aff); - inline explicit multi_aff(isl::ctx ctx, const std::string &str); - inline explicit multi_aff(isl::space space, isl::aff_list list); - inline isl::multi_aff &operator=(isl::multi_aff obj); + inline /* implicit */ multi_aff(const multi_aff &obj); + inline explicit multi_aff(ctx ctx, const std::string &str); + inline explicit multi_aff(space space, aff_list list); + inline /* implicit */ multi_aff(aff aff); + inline multi_aff &operator=(multi_aff obj); inline ~multi_aff(); inline __isl_give isl_multi_aff *copy() const &; inline __isl_give isl_multi_aff *copy() && = delete; @@ -1773,55 +1852,55 @@ class multi_aff { inline __isl_give isl_multi_aff *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::multi_aff add(isl::multi_aff multi2) const; - inline isl::multi_aff align_params(isl::space model) const; - static inline isl::multi_aff domain_map(isl::space space); - inline isl::multi_aff factor_domain() const; - inline isl::multi_aff factor_range() const; - inline isl::multi_aff flat_range_product(isl::multi_aff multi2) const; - inline isl::multi_aff flatten_range() const; - inline isl::multi_aff floor() const; - inline isl::multi_aff from_range() const; - inline isl::aff get_aff(int pos) const; - inline isl::aff_list get_aff_list() const; - inline isl::space get_domain_space() const; - inline isl::id get_range_tuple_id() const; - inline isl::space get_space() const; - static inline isl::multi_aff identity(isl::space space); - inline isl::multi_aff mod(isl::multi_val mv) const; - inline isl::multi_aff neg() const; - inline isl::multi_aff product(isl::multi_aff multi2) const; - inline isl::multi_aff pullback(isl::multi_aff ma2) const; - inline isl::multi_aff range_factor_domain() const; - inline isl::multi_aff range_factor_range() const; - static inline isl::multi_aff range_map(isl::space space); - inline isl::multi_aff range_product(isl::multi_aff multi2) const; - inline isl::multi_aff range_splice(unsigned int pos, isl::multi_aff multi2) const; - inline isl::multi_aff reset_user() const; - inline isl::multi_aff scale(isl::val v) const; - inline isl::multi_aff scale(isl::multi_val mv) const; - inline isl::multi_aff scale_down(isl::val v) const; - inline isl::multi_aff scale_down(isl::multi_val mv) const; - inline isl::multi_aff set_aff(int pos, isl::aff el) const; - inline isl::multi_aff set_range_tuple_id(isl::id id) const; + inline multi_aff add(multi_aff multi2) const; + inline multi_aff align_params(space model) const; + static inline multi_aff domain_map(space space); + inline multi_aff factor_domain() const; + inline multi_aff factor_range() const; + inline multi_aff flat_range_product(multi_aff multi2) const; + inline multi_aff flatten_range() const; + inline multi_aff floor() const; + inline multi_aff from_range() const; + inline aff get_aff(int pos) const; + inline aff_list get_aff_list() const; + inline space get_domain_space() const; + inline id get_range_tuple_id() const; + inline space get_space() const; + static inline multi_aff identity(space space); + inline multi_aff mod(multi_val mv) const; + inline multi_aff neg() const; + inline multi_aff product(multi_aff multi2) const; + inline multi_aff pullback(multi_aff ma2) const; + inline multi_aff range_factor_domain() const; + inline multi_aff range_factor_range() const; + static inline multi_aff range_map(space space); + inline multi_aff range_product(multi_aff multi2) const; + inline multi_aff range_splice(unsigned int pos, multi_aff multi2) const; + inline multi_aff reset_user() const; + inline multi_aff scale(val v) const; + inline multi_aff scale(multi_val mv) const; + inline multi_aff scale_down(val v) const; + inline multi_aff scale_down(multi_val mv) const; + inline multi_aff set_aff(int pos, aff el) const; + inline multi_aff set_range_tuple_id(id id) const; inline int size() const; - inline isl::multi_aff splice(unsigned int in_pos, unsigned int out_pos, isl::multi_aff multi2) const; - inline isl::multi_aff sub(isl::multi_aff multi2) const; - static inline isl::multi_aff wrapped_range_map(isl::space space); - static inline isl::multi_aff zero(isl::space space); + inline multi_aff splice(unsigned int in_pos, unsigned int out_pos, multi_aff multi2) const; + inline multi_aff sub(multi_aff multi2) const; + static inline multi_aff wrapped_range_map(space space); + static inline multi_aff zero(space space); typedef isl_multi_aff* isl_ptr_t; }; // declarations for isl::multi_id -inline isl::multi_id manage(__isl_take isl_multi_id *ptr); -inline isl::multi_id manage_copy(__isl_keep isl_multi_id *ptr); +inline multi_id manage(__isl_take isl_multi_id *ptr); +inline multi_id manage_copy(__isl_keep isl_multi_id *ptr); class multi_id { - friend inline isl::multi_id manage(__isl_take isl_multi_id *ptr); - friend inline isl::multi_id manage_copy(__isl_keep isl_multi_id *ptr); + friend inline multi_id manage(__isl_take isl_multi_id *ptr); + friend inline multi_id manage_copy(__isl_keep isl_multi_id *ptr); protected: isl_multi_id *ptr = nullptr; @@ -1830,9 +1909,9 @@ class multi_id { public: inline /* implicit */ multi_id(); - inline /* implicit */ multi_id(const isl::multi_id &obj); - inline explicit multi_id(isl::space space, isl::id_list list); - inline isl::multi_id &operator=(isl::multi_id obj); + inline /* implicit */ multi_id(const multi_id &obj); + inline explicit multi_id(space space, id_list list); + inline multi_id &operator=(multi_id obj); inline ~multi_id(); inline __isl_give isl_multi_id *copy() const &; inline __isl_give isl_multi_id *copy() && = delete; @@ -1840,35 +1919,35 @@ class multi_id { inline __isl_give isl_multi_id *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; - - inline isl::multi_id align_params(isl::space model) const; - inline isl::multi_id factor_domain() const; - inline isl::multi_id factor_range() const; - inline isl::multi_id flat_range_product(isl::multi_id multi2) const; - inline isl::multi_id flatten_range() const; - inline isl::multi_id from_range() const; - inline isl::space get_domain_space() const; - inline isl::id get_id(int pos) const; - inline isl::id_list get_id_list() const; - inline isl::space get_space() const; - inline isl::multi_id range_factor_domain() const; - inline isl::multi_id range_factor_range() const; - inline isl::multi_id range_product(isl::multi_id multi2) const; - inline isl::multi_id range_splice(unsigned int pos, isl::multi_id multi2) const; - inline isl::multi_id reset_user() const; - inline isl::multi_id set_id(int pos, isl::id el) const; + inline ctx get_ctx() const; + + inline multi_id align_params(space model) const; + inline multi_id factor_domain() const; + inline multi_id factor_range() const; + inline multi_id flat_range_product(multi_id multi2) const; + inline multi_id flatten_range() const; + inline multi_id from_range() const; + inline space get_domain_space() const; + inline id get_id(int pos) const; + inline id_list get_id_list() const; + inline space get_space() const; + inline multi_id range_factor_domain() const; + inline multi_id range_factor_range() const; + inline multi_id range_product(multi_id multi2) const; + inline multi_id range_splice(unsigned int pos, multi_id multi2) const; + inline multi_id reset_user() const; + inline multi_id set_id(int pos, id el) const; inline int size() const; typedef isl_multi_id* isl_ptr_t; }; // declarations for isl::multi_pw_aff -inline isl::multi_pw_aff manage(__isl_take isl_multi_pw_aff *ptr); -inline isl::multi_pw_aff manage_copy(__isl_keep isl_multi_pw_aff *ptr); +inline multi_pw_aff manage(__isl_take isl_multi_pw_aff *ptr); +inline multi_pw_aff manage_copy(__isl_keep isl_multi_pw_aff *ptr); class multi_pw_aff { - friend inline isl::multi_pw_aff manage(__isl_take isl_multi_pw_aff *ptr); - friend inline isl::multi_pw_aff manage_copy(__isl_keep isl_multi_pw_aff *ptr); + friend inline multi_pw_aff manage(__isl_take isl_multi_pw_aff *ptr); + friend inline multi_pw_aff manage_copy(__isl_keep isl_multi_pw_aff *ptr); protected: isl_multi_pw_aff *ptr = nullptr; @@ -1877,13 +1956,13 @@ class multi_pw_aff { public: inline /* implicit */ multi_pw_aff(); - inline /* implicit */ multi_pw_aff(const isl::multi_pw_aff &obj); - inline explicit multi_pw_aff(isl::space space, isl::pw_aff_list list); - inline /* implicit */ multi_pw_aff(isl::multi_aff ma); - inline /* implicit */ multi_pw_aff(isl::pw_aff pa); - inline /* implicit */ multi_pw_aff(isl::pw_multi_aff pma); - inline explicit multi_pw_aff(isl::ctx ctx, const std::string &str); - inline isl::multi_pw_aff &operator=(isl::multi_pw_aff obj); + inline /* implicit */ multi_pw_aff(const multi_pw_aff &obj); + inline explicit multi_pw_aff(space space, pw_aff_list list); + inline /* implicit */ multi_pw_aff(multi_aff ma); + inline /* implicit */ multi_pw_aff(pw_aff pa); + inline /* implicit */ multi_pw_aff(pw_multi_aff pma); + inline explicit multi_pw_aff(ctx ctx, const std::string &str); + inline multi_pw_aff &operator=(multi_pw_aff obj); inline ~multi_pw_aff(); inline __isl_give isl_multi_pw_aff *copy() const &; inline __isl_give isl_multi_pw_aff *copy() && = delete; @@ -1891,55 +1970,55 @@ class multi_pw_aff { inline __isl_give isl_multi_pw_aff *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::multi_pw_aff add(isl::multi_pw_aff multi2) const; - inline isl::multi_pw_aff align_params(isl::space model) const; - inline isl::set domain() const; - inline isl::multi_pw_aff factor_domain() const; - inline isl::multi_pw_aff factor_range() const; - inline isl::multi_pw_aff flat_range_product(isl::multi_pw_aff multi2) const; - inline isl::multi_pw_aff flatten_range() const; - inline isl::multi_pw_aff from_range() const; - inline isl::space get_domain_space() const; - inline isl::pw_aff get_pw_aff(int pos) const; - inline isl::pw_aff_list get_pw_aff_list() const; - inline isl::id get_range_tuple_id() const; - inline isl::space get_space() const; - static inline isl::multi_pw_aff identity(isl::space space); - inline bool is_equal(const isl::multi_pw_aff &mpa2) const; - inline isl::multi_pw_aff mod(isl::multi_val mv) const; - inline isl::multi_pw_aff neg() const; - inline isl::multi_pw_aff product(isl::multi_pw_aff multi2) const; - inline isl::multi_pw_aff pullback(isl::multi_aff ma) const; - inline isl::multi_pw_aff pullback(isl::pw_multi_aff pma) const; - inline isl::multi_pw_aff pullback(isl::multi_pw_aff mpa2) const; - inline isl::multi_pw_aff range_factor_domain() const; - inline isl::multi_pw_aff range_factor_range() const; - inline isl::multi_pw_aff range_product(isl::multi_pw_aff multi2) const; - inline isl::multi_pw_aff range_splice(unsigned int pos, isl::multi_pw_aff multi2) const; - inline isl::multi_pw_aff reset_user() const; - inline isl::multi_pw_aff scale(isl::val v) const; - inline isl::multi_pw_aff scale(isl::multi_val mv) const; - inline isl::multi_pw_aff scale_down(isl::val v) const; - inline isl::multi_pw_aff scale_down(isl::multi_val mv) const; - inline isl::multi_pw_aff set_pw_aff(int pos, isl::pw_aff el) const; - inline isl::multi_pw_aff set_range_tuple_id(isl::id id) const; + inline multi_pw_aff add(multi_pw_aff multi2) const; + inline multi_pw_aff align_params(space model) const; + inline set domain() const; + inline multi_pw_aff factor_domain() const; + inline multi_pw_aff factor_range() const; + inline multi_pw_aff flat_range_product(multi_pw_aff multi2) const; + inline multi_pw_aff flatten_range() const; + inline multi_pw_aff from_range() const; + inline space get_domain_space() const; + inline pw_aff get_pw_aff(int pos) const; + inline pw_aff_list get_pw_aff_list() const; + inline id get_range_tuple_id() const; + inline space get_space() const; + static inline multi_pw_aff identity(space space); + inline bool is_equal(const multi_pw_aff &mpa2) const; + inline multi_pw_aff mod(multi_val mv) const; + inline multi_pw_aff neg() const; + inline multi_pw_aff product(multi_pw_aff multi2) const; + inline multi_pw_aff pullback(multi_aff ma) const; + inline multi_pw_aff pullback(pw_multi_aff pma) const; + inline multi_pw_aff pullback(multi_pw_aff mpa2) const; + inline multi_pw_aff range_factor_domain() const; + inline multi_pw_aff range_factor_range() const; + inline multi_pw_aff range_product(multi_pw_aff multi2) const; + inline multi_pw_aff range_splice(unsigned int pos, multi_pw_aff multi2) const; + inline multi_pw_aff reset_user() const; + inline multi_pw_aff scale(val v) const; + inline multi_pw_aff scale(multi_val mv) const; + inline multi_pw_aff scale_down(val v) const; + inline multi_pw_aff scale_down(multi_val mv) const; + inline multi_pw_aff set_pw_aff(int pos, pw_aff el) const; + inline multi_pw_aff set_range_tuple_id(id id) const; inline int size() const; - inline isl::multi_pw_aff splice(unsigned int in_pos, unsigned int out_pos, isl::multi_pw_aff multi2) const; - inline isl::multi_pw_aff sub(isl::multi_pw_aff multi2) const; - static inline isl::multi_pw_aff zero(isl::space space); + inline multi_pw_aff splice(unsigned int in_pos, unsigned int out_pos, multi_pw_aff multi2) const; + inline multi_pw_aff sub(multi_pw_aff multi2) const; + static inline multi_pw_aff zero(space space); typedef isl_multi_pw_aff* isl_ptr_t; }; // declarations for isl::multi_union_pw_aff -inline isl::multi_union_pw_aff manage(__isl_take isl_multi_union_pw_aff *ptr); -inline isl::multi_union_pw_aff manage_copy(__isl_keep isl_multi_union_pw_aff *ptr); +inline multi_union_pw_aff manage(__isl_take isl_multi_union_pw_aff *ptr); +inline multi_union_pw_aff manage_copy(__isl_keep isl_multi_union_pw_aff *ptr); class multi_union_pw_aff { - friend inline isl::multi_union_pw_aff manage(__isl_take isl_multi_union_pw_aff *ptr); - friend inline isl::multi_union_pw_aff manage_copy(__isl_keep isl_multi_union_pw_aff *ptr); + friend inline multi_union_pw_aff manage(__isl_take isl_multi_union_pw_aff *ptr); + friend inline multi_union_pw_aff manage_copy(__isl_keep isl_multi_union_pw_aff *ptr); protected: isl_multi_union_pw_aff *ptr = nullptr; @@ -1948,14 +2027,14 @@ class multi_union_pw_aff { public: inline /* implicit */ multi_union_pw_aff(); - inline /* implicit */ multi_union_pw_aff(const isl::multi_union_pw_aff &obj); - inline explicit multi_union_pw_aff(isl::space space, isl::union_pw_aff_list list); - inline /* implicit */ multi_union_pw_aff(isl::union_pw_aff upa); - inline /* implicit */ multi_union_pw_aff(isl::multi_pw_aff mpa); - inline explicit multi_union_pw_aff(isl::union_set domain, isl::multi_val mv); - inline explicit multi_union_pw_aff(isl::union_set domain, isl::multi_aff ma); - inline explicit multi_union_pw_aff(isl::ctx ctx, const std::string &str); - inline isl::multi_union_pw_aff &operator=(isl::multi_union_pw_aff obj); + inline /* implicit */ multi_union_pw_aff(const multi_union_pw_aff &obj); + inline /* implicit */ multi_union_pw_aff(union_pw_aff upa); + inline /* implicit */ multi_union_pw_aff(multi_pw_aff mpa); + inline explicit multi_union_pw_aff(union_set domain, multi_val mv); + inline explicit multi_union_pw_aff(union_set domain, multi_aff ma); + inline explicit multi_union_pw_aff(space space, union_pw_aff_list list); + inline explicit multi_union_pw_aff(ctx ctx, const std::string &str); + inline multi_union_pw_aff &operator=(multi_union_pw_aff obj); inline ~multi_union_pw_aff(); inline __isl_give isl_multi_union_pw_aff *copy() const &; inline __isl_give isl_multi_union_pw_aff *copy() && = delete; @@ -1963,62 +2042,62 @@ class multi_union_pw_aff { inline __isl_give isl_multi_union_pw_aff *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::multi_union_pw_aff add(isl::multi_union_pw_aff multi2) const; - inline isl::multi_union_pw_aff align_params(isl::space model) const; - inline isl::multi_union_pw_aff apply(isl::multi_aff ma) const; - inline isl::multi_union_pw_aff apply(isl::pw_multi_aff pma) const; - inline isl::union_set domain() const; - inline isl::multi_pw_aff extract_multi_pw_aff(isl::space space) const; - inline isl::multi_union_pw_aff factor_domain() const; - inline isl::multi_union_pw_aff factor_range() const; - inline isl::multi_union_pw_aff flat_range_product(isl::multi_union_pw_aff multi2) const; - inline isl::multi_union_pw_aff flatten_range() const; - inline isl::multi_union_pw_aff floor() const; - inline isl::multi_union_pw_aff from_range() const; - static inline isl::multi_union_pw_aff from_union_map(isl::union_map umap); - inline isl::space get_domain_space() const; - inline isl::id get_range_tuple_id() const; - inline isl::space get_space() const; - inline isl::union_pw_aff get_union_pw_aff(int pos) const; - inline isl::union_pw_aff_list get_union_pw_aff_list() const; - inline isl::multi_union_pw_aff gist(isl::union_set context) const; - inline isl::multi_union_pw_aff intersect_domain(isl::union_set uset) const; - inline isl::multi_union_pw_aff intersect_params(isl::set params) const; - inline bool involves_param(const isl::id &id) const; - inline isl::multi_val max_multi_val() const; - inline isl::multi_val min_multi_val() const; - inline isl::multi_union_pw_aff mod(isl::multi_val mv) const; - inline isl::multi_union_pw_aff neg() const; - inline isl::multi_union_pw_aff pullback(isl::union_pw_multi_aff upma) const; - inline isl::multi_union_pw_aff range_factor_domain() const; - inline isl::multi_union_pw_aff range_factor_range() const; - inline isl::multi_union_pw_aff range_product(isl::multi_union_pw_aff multi2) const; - inline isl::multi_union_pw_aff range_splice(unsigned int pos, isl::multi_union_pw_aff multi2) const; - inline isl::multi_union_pw_aff reset_user() const; - inline isl::multi_union_pw_aff scale(isl::val v) const; - inline isl::multi_union_pw_aff scale(isl::multi_val mv) const; - inline isl::multi_union_pw_aff scale_down(isl::val v) const; - inline isl::multi_union_pw_aff scale_down(isl::multi_val mv) const; - inline isl::multi_union_pw_aff set_range_tuple_id(isl::id id) const; - inline isl::multi_union_pw_aff set_union_pw_aff(int pos, isl::union_pw_aff el) const; + inline multi_union_pw_aff add(multi_union_pw_aff multi2) const; + inline multi_union_pw_aff align_params(space model) const; + inline multi_union_pw_aff apply(multi_aff ma) const; + inline multi_union_pw_aff apply(pw_multi_aff pma) const; + inline union_set domain() const; + inline multi_pw_aff extract_multi_pw_aff(space space) const; + inline multi_union_pw_aff factor_domain() const; + inline multi_union_pw_aff factor_range() const; + inline multi_union_pw_aff flat_range_product(multi_union_pw_aff multi2) const; + inline multi_union_pw_aff flatten_range() const; + inline multi_union_pw_aff floor() const; + inline multi_union_pw_aff from_range() const; + static inline multi_union_pw_aff from_union_map(union_map umap); + inline space get_domain_space() const; + inline id get_range_tuple_id() const; + inline space get_space() const; + inline union_pw_aff get_union_pw_aff(int pos) const; + inline union_pw_aff_list get_union_pw_aff_list() const; + inline multi_union_pw_aff gist(union_set context) const; + inline multi_union_pw_aff intersect_domain(union_set uset) const; + inline multi_union_pw_aff intersect_params(set params) const; + inline bool involves_param(const id &id) const; + inline multi_val max_multi_val() const; + inline multi_val min_multi_val() const; + inline multi_union_pw_aff mod(multi_val mv) const; + inline multi_union_pw_aff neg() const; + inline multi_union_pw_aff pullback(union_pw_multi_aff upma) const; + inline multi_union_pw_aff range_factor_domain() const; + inline multi_union_pw_aff range_factor_range() const; + inline multi_union_pw_aff range_product(multi_union_pw_aff multi2) const; + inline multi_union_pw_aff range_splice(unsigned int pos, multi_union_pw_aff multi2) const; + inline multi_union_pw_aff reset_user() const; + inline multi_union_pw_aff scale(val v) const; + inline multi_union_pw_aff scale(multi_val mv) const; + inline multi_union_pw_aff scale_down(val v) const; + inline multi_union_pw_aff scale_down(multi_val mv) const; + inline multi_union_pw_aff set_range_tuple_id(id id) const; + inline multi_union_pw_aff set_union_pw_aff(int pos, union_pw_aff el) const; inline int size() const; - inline isl::multi_union_pw_aff sub(isl::multi_union_pw_aff multi2) const; - inline isl::multi_union_pw_aff union_add(isl::multi_union_pw_aff mupa2) const; - static inline isl::multi_union_pw_aff zero(isl::space space); - inline isl::union_set zero_union_set() const; + inline multi_union_pw_aff sub(multi_union_pw_aff multi2) const; + inline multi_union_pw_aff union_add(multi_union_pw_aff mupa2) const; + static inline multi_union_pw_aff zero(space space); + inline union_set zero_union_set() const; typedef isl_multi_union_pw_aff* isl_ptr_t; }; // declarations for isl::multi_val -inline isl::multi_val manage(__isl_take isl_multi_val *ptr); -inline isl::multi_val manage_copy(__isl_keep isl_multi_val *ptr); +inline multi_val manage(__isl_take isl_multi_val *ptr); +inline multi_val manage_copy(__isl_keep isl_multi_val *ptr); class multi_val { - friend inline isl::multi_val manage(__isl_take isl_multi_val *ptr); - friend inline isl::multi_val manage_copy(__isl_keep isl_multi_val *ptr); + friend inline multi_val manage(__isl_take isl_multi_val *ptr); + friend inline multi_val manage_copy(__isl_keep isl_multi_val *ptr); protected: isl_multi_val *ptr = nullptr; @@ -2027,9 +2106,9 @@ class multi_val { public: inline /* implicit */ multi_val(); - inline /* implicit */ multi_val(const isl::multi_val &obj); - inline explicit multi_val(isl::space space, isl::val_list list); - inline isl::multi_val &operator=(isl::multi_val obj); + inline /* implicit */ multi_val(const multi_val &obj); + inline explicit multi_val(space space, val_list list); + inline multi_val &operator=(multi_val obj); inline ~multi_val(); inline __isl_give isl_multi_val *copy() const &; inline __isl_give isl_multi_val *copy() && = delete; @@ -2037,49 +2116,49 @@ class multi_val { inline __isl_give isl_multi_val *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::multi_val add(isl::multi_val multi2) const; - inline isl::multi_val align_params(isl::space model) const; - inline isl::multi_val factor_domain() const; - inline isl::multi_val factor_range() const; - inline isl::multi_val flat_range_product(isl::multi_val multi2) const; - inline isl::multi_val flatten_range() const; - inline isl::multi_val from_range() const; - inline isl::space get_domain_space() const; - inline isl::id get_range_tuple_id() const; - inline isl::space get_space() const; - inline isl::val get_val(int pos) const; - inline isl::val_list get_val_list() const; - inline isl::multi_val mod(isl::multi_val mv) const; - inline isl::multi_val neg() const; - inline isl::multi_val product(isl::multi_val multi2) const; - inline isl::multi_val range_factor_domain() const; - inline isl::multi_val range_factor_range() const; - inline isl::multi_val range_product(isl::multi_val multi2) const; - inline isl::multi_val range_splice(unsigned int pos, isl::multi_val multi2) const; - inline isl::multi_val reset_user() const; - inline isl::multi_val scale(isl::val v) const; - inline isl::multi_val scale(isl::multi_val mv) const; - inline isl::multi_val scale_down(isl::val v) const; - inline isl::multi_val scale_down(isl::multi_val mv) const; - inline isl::multi_val set_range_tuple_id(isl::id id) const; - inline isl::multi_val set_val(int pos, isl::val el) const; + inline multi_val add(multi_val multi2) const; + inline multi_val align_params(space model) const; + inline multi_val factor_domain() const; + inline multi_val factor_range() const; + inline multi_val flat_range_product(multi_val multi2) const; + inline multi_val flatten_range() const; + inline multi_val from_range() const; + inline space get_domain_space() const; + inline id get_range_tuple_id() const; + inline space get_space() const; + inline val get_val(int pos) const; + inline val_list get_val_list() const; + inline multi_val mod(multi_val mv) const; + inline multi_val neg() const; + inline multi_val product(multi_val multi2) const; + inline multi_val range_factor_domain() const; + inline multi_val range_factor_range() const; + inline multi_val range_product(multi_val multi2) const; + inline multi_val range_splice(unsigned int pos, multi_val multi2) const; + inline multi_val reset_user() const; + inline multi_val scale(val v) const; + inline multi_val scale(multi_val mv) const; + inline multi_val scale_down(val v) const; + inline multi_val scale_down(multi_val mv) const; + inline multi_val set_range_tuple_id(id id) const; + inline multi_val set_val(int pos, val el) const; inline int size() const; - inline isl::multi_val splice(unsigned int in_pos, unsigned int out_pos, isl::multi_val multi2) const; - inline isl::multi_val sub(isl::multi_val multi2) const; - static inline isl::multi_val zero(isl::space space); + inline multi_val splice(unsigned int in_pos, unsigned int out_pos, multi_val multi2) const; + inline multi_val sub(multi_val multi2) const; + static inline multi_val zero(space space); typedef isl_multi_val* isl_ptr_t; }; // declarations for isl::point -inline isl::point manage(__isl_take isl_point *ptr); -inline isl::point manage_copy(__isl_keep isl_point *ptr); +inline point manage(__isl_take isl_point *ptr); +inline point manage_copy(__isl_keep isl_point *ptr); class point { - friend inline isl::point manage(__isl_take isl_point *ptr); - friend inline isl::point manage_copy(__isl_keep isl_point *ptr); + friend inline point manage(__isl_take isl_point *ptr); + friend inline point manage_copy(__isl_keep isl_point *ptr); protected: isl_point *ptr = nullptr; @@ -2088,9 +2167,9 @@ class point { public: inline /* implicit */ point(); - inline /* implicit */ point(const isl::point &obj); - inline explicit point(isl::space dim); - inline isl::point &operator=(isl::point obj); + inline /* implicit */ point(const point &obj); + inline explicit point(space dim); + inline point &operator=(point obj); inline ~point(); inline __isl_give isl_point *copy() const &; inline __isl_give isl_point *copy() && = delete; @@ -2098,21 +2177,21 @@ class point { inline __isl_give isl_point *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::space get_space() const; + inline space get_space() const; inline bool is_void() const; typedef isl_point* isl_ptr_t; }; // declarations for isl::pw_aff -inline isl::pw_aff manage(__isl_take isl_pw_aff *ptr); -inline isl::pw_aff manage_copy(__isl_keep isl_pw_aff *ptr); +inline pw_aff manage(__isl_take isl_pw_aff *ptr); +inline pw_aff manage_copy(__isl_keep isl_pw_aff *ptr); class pw_aff { - friend inline isl::pw_aff manage(__isl_take isl_pw_aff *ptr); - friend inline isl::pw_aff manage_copy(__isl_keep isl_pw_aff *ptr); + friend inline pw_aff manage(__isl_take isl_pw_aff *ptr); + friend inline pw_aff manage_copy(__isl_keep isl_pw_aff *ptr); protected: isl_pw_aff *ptr = nullptr; @@ -2121,12 +2200,12 @@ class pw_aff { public: inline /* implicit */ pw_aff(); - inline /* implicit */ pw_aff(const isl::pw_aff &obj); - inline /* implicit */ pw_aff(isl::aff aff); - inline explicit pw_aff(isl::local_space ls); - inline explicit pw_aff(isl::set domain, isl::val v); - inline explicit pw_aff(isl::ctx ctx, const std::string &str); - inline isl::pw_aff &operator=(isl::pw_aff obj); + inline /* implicit */ pw_aff(const pw_aff &obj); + inline /* implicit */ pw_aff(aff aff); + inline explicit pw_aff(local_space ls); + inline explicit pw_aff(set domain, val v); + inline explicit pw_aff(ctx ctx, const std::string &str); + inline pw_aff &operator=(pw_aff obj); inline ~pw_aff(); inline __isl_give isl_pw_aff *copy() const &; inline __isl_give isl_pw_aff *copy() && = delete; @@ -2134,61 +2213,61 @@ class pw_aff { inline __isl_give isl_pw_aff *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::pw_aff add(isl::pw_aff pwaff2) const; - inline isl::pw_aff ceil() const; - inline isl::pw_aff cond(isl::pw_aff pwaff_true, isl::pw_aff pwaff_false) const; - inline isl::pw_aff div(isl::pw_aff pa2) const; - inline isl::set domain() const; - inline isl::map eq_map(isl::pw_aff pa2) const; - inline isl::set eq_set(isl::pw_aff pwaff2) const; - inline isl::pw_aff floor() const; - inline void foreach_piece(const std::function &fn) const; - inline isl::set ge_set(isl::pw_aff pwaff2) const; - inline isl::space get_space() const; - inline isl::map gt_map(isl::pw_aff pa2) const; - inline isl::set gt_set(isl::pw_aff pwaff2) const; - inline isl::pw_aff intersect_domain(isl::set set) const; - inline isl::pw_aff intersect_params(isl::set set) const; + inline pw_aff add(pw_aff pwaff2) const; + inline pw_aff ceil() const; + inline pw_aff cond(pw_aff pwaff_true, pw_aff pwaff_false) const; + inline pw_aff div(pw_aff pa2) const; + inline set domain() const; + inline map eq_map(pw_aff pa2) const; + inline set eq_set(pw_aff pwaff2) const; + inline pw_aff floor() const; + inline void foreach_piece(const std::function &fn) const; + inline set ge_set(pw_aff pwaff2) const; + inline space get_space() const; + inline map gt_map(pw_aff pa2) const; + inline set gt_set(pw_aff pwaff2) const; + inline pw_aff intersect_domain(set set) const; + inline pw_aff intersect_params(set set) const; inline bool involves_nan() const; inline bool is_cst() const; - inline bool is_equal(const isl::pw_aff &pa2) const; - inline isl::set le_set(isl::pw_aff pwaff2) const; - inline isl::map lt_map(isl::pw_aff pa2) const; - inline isl::set lt_set(isl::pw_aff pwaff2) const; - inline isl::pw_aff max(isl::pw_aff pwaff2) const; - inline isl::pw_aff min(isl::pw_aff pwaff2) const; - inline isl::pw_aff mod(isl::val mod) const; - inline isl::pw_aff mul(isl::pw_aff pwaff2) const; + inline bool is_equal(const pw_aff &pa2) const; + inline set le_set(pw_aff pwaff2) const; + inline map lt_map(pw_aff pa2) const; + inline set lt_set(pw_aff pwaff2) const; + inline pw_aff max(pw_aff pwaff2) const; + inline pw_aff min(pw_aff pwaff2) const; + inline pw_aff mod(val mod) const; + inline pw_aff mul(pw_aff pwaff2) const; inline int n_piece() const; - inline isl::set ne_set(isl::pw_aff pwaff2) const; - inline isl::pw_aff neg() const; - inline isl::set nonneg_set() const; - inline isl::set params() const; - inline isl::set pos_set() const; - inline isl::pw_aff project_domain_on_params() const; - inline isl::pw_aff pullback(isl::multi_aff ma) const; - inline isl::pw_aff pullback(isl::pw_multi_aff pma) const; - inline isl::pw_aff pullback(isl::multi_pw_aff mpa) const; - inline isl::pw_aff scale(isl::val v) const; - inline isl::pw_aff scale_down(isl::val f) const; - inline isl::pw_aff sub(isl::pw_aff pwaff2) const; - inline isl::pw_aff tdiv_q(isl::pw_aff pa2) const; - inline isl::pw_aff tdiv_r(isl::pw_aff pa2) const; - inline isl::pw_aff union_add(isl::pw_aff pwaff2) const; - inline isl::set zero_set() const; + inline set ne_set(pw_aff pwaff2) const; + inline pw_aff neg() const; + inline set nonneg_set() const; + inline set params() const; + inline set pos_set() const; + inline pw_aff project_domain_on_params() const; + inline pw_aff pullback(multi_aff ma) const; + inline pw_aff pullback(pw_multi_aff pma) const; + inline pw_aff pullback(multi_pw_aff mpa) const; + inline pw_aff scale(val v) const; + inline pw_aff scale_down(val f) const; + inline pw_aff sub(pw_aff pwaff2) const; + inline pw_aff tdiv_q(pw_aff pa2) const; + inline pw_aff tdiv_r(pw_aff pa2) const; + inline pw_aff union_add(pw_aff pwaff2) const; + inline set zero_set() const; typedef isl_pw_aff* isl_ptr_t; }; // declarations for isl::pw_aff_list -inline isl::pw_aff_list manage(__isl_take isl_pw_aff_list *ptr); -inline isl::pw_aff_list manage_copy(__isl_keep isl_pw_aff_list *ptr); +inline pw_aff_list manage(__isl_take isl_pw_aff_list *ptr); +inline pw_aff_list manage_copy(__isl_keep isl_pw_aff_list *ptr); class pw_aff_list { - friend inline isl::pw_aff_list manage(__isl_take isl_pw_aff_list *ptr); - friend inline isl::pw_aff_list manage_copy(__isl_keep isl_pw_aff_list *ptr); + friend inline pw_aff_list manage(__isl_take isl_pw_aff_list *ptr); + friend inline pw_aff_list manage_copy(__isl_keep isl_pw_aff_list *ptr); protected: isl_pw_aff_list *ptr = nullptr; @@ -2197,10 +2276,10 @@ class pw_aff_list { public: inline /* implicit */ pw_aff_list(); - inline /* implicit */ pw_aff_list(const isl::pw_aff_list &obj); - inline explicit pw_aff_list(isl::pw_aff el); - inline explicit pw_aff_list(isl::ctx ctx, int n); - inline isl::pw_aff_list &operator=(isl::pw_aff_list obj); + inline /* implicit */ pw_aff_list(const pw_aff_list &obj); + inline explicit pw_aff_list(pw_aff el); + inline explicit pw_aff_list(ctx ctx, int n); + inline pw_aff_list &operator=(pw_aff_list obj); inline ~pw_aff_list(); inline __isl_give isl_pw_aff_list *copy() const &; inline __isl_give isl_pw_aff_list *copy() && = delete; @@ -2208,25 +2287,25 @@ class pw_aff_list { inline __isl_give isl_pw_aff_list *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; - - inline isl::pw_aff_list add(isl::pw_aff el) const; - inline isl::pw_aff_list concat(isl::pw_aff_list list2) const; - inline isl::pw_aff_list drop(unsigned int first, unsigned int n) const; - inline void foreach(const std::function &fn) const; - inline isl::pw_aff get_at(int index) const; - inline isl::pw_aff_list reverse() const; + inline ctx get_ctx() const; + + inline pw_aff_list add(pw_aff el) const; + inline pw_aff_list concat(pw_aff_list list2) const; + inline pw_aff_list drop(unsigned int first, unsigned int n) const; + inline void foreach(const std::function &fn) const; + inline pw_aff get_at(int index) const; + inline pw_aff_list reverse() const; inline int size() const; typedef isl_pw_aff_list* isl_ptr_t; }; // declarations for isl::pw_multi_aff -inline isl::pw_multi_aff manage(__isl_take isl_pw_multi_aff *ptr); -inline isl::pw_multi_aff manage_copy(__isl_keep isl_pw_multi_aff *ptr); +inline pw_multi_aff manage(__isl_take isl_pw_multi_aff *ptr); +inline pw_multi_aff manage_copy(__isl_keep isl_pw_multi_aff *ptr); class pw_multi_aff { - friend inline isl::pw_multi_aff manage(__isl_take isl_pw_multi_aff *ptr); - friend inline isl::pw_multi_aff manage_copy(__isl_keep isl_pw_multi_aff *ptr); + friend inline pw_multi_aff manage(__isl_take isl_pw_multi_aff *ptr); + friend inline pw_multi_aff manage_copy(__isl_keep isl_pw_multi_aff *ptr); protected: isl_pw_multi_aff *ptr = nullptr; @@ -2235,13 +2314,13 @@ class pw_multi_aff { public: inline /* implicit */ pw_multi_aff(); - inline /* implicit */ pw_multi_aff(const isl::pw_multi_aff &obj); - inline /* implicit */ pw_multi_aff(isl::multi_aff ma); - inline /* implicit */ pw_multi_aff(isl::pw_aff pa); - inline explicit pw_multi_aff(isl::set domain, isl::multi_val mv); - inline explicit pw_multi_aff(isl::map map); - inline explicit pw_multi_aff(isl::ctx ctx, const std::string &str); - inline isl::pw_multi_aff &operator=(isl::pw_multi_aff obj); + inline /* implicit */ pw_multi_aff(const pw_multi_aff &obj); + inline /* implicit */ pw_multi_aff(multi_aff ma); + inline /* implicit */ pw_multi_aff(pw_aff pa); + inline explicit pw_multi_aff(set domain, multi_val mv); + inline explicit pw_multi_aff(map map); + inline explicit pw_multi_aff(ctx ctx, const std::string &str); + inline pw_multi_aff &operator=(pw_multi_aff obj); inline ~pw_multi_aff(); inline __isl_give isl_pw_multi_aff *copy() const &; inline __isl_give isl_pw_multi_aff *copy() && = delete; @@ -2249,41 +2328,41 @@ class pw_multi_aff { inline __isl_give isl_pw_multi_aff *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::pw_multi_aff add(isl::pw_multi_aff pma2) const; - inline isl::set domain() const; - inline isl::pw_multi_aff flat_range_product(isl::pw_multi_aff pma2) const; - inline void foreach_piece(const std::function &fn) const; - static inline isl::pw_multi_aff from(isl::multi_pw_aff mpa); - inline isl::pw_aff get_pw_aff(int pos) const; - inline isl::id get_range_tuple_id() const; - inline isl::space get_space() const; - static inline isl::pw_multi_aff identity(isl::space space); - inline bool is_equal(const isl::pw_multi_aff &pma2) const; + inline pw_multi_aff add(pw_multi_aff pma2) const; + inline set domain() const; + inline pw_multi_aff flat_range_product(pw_multi_aff pma2) const; + inline void foreach_piece(const std::function &fn) const; + static inline pw_multi_aff from(multi_pw_aff mpa); + inline pw_aff get_pw_aff(int pos) const; + inline id get_range_tuple_id() const; + inline space get_space() const; + static inline pw_multi_aff identity(space space); + inline bool is_equal(const pw_multi_aff &pma2) const; inline int n_piece() const; - inline isl::pw_multi_aff product(isl::pw_multi_aff pma2) const; - inline isl::pw_multi_aff project_domain_on_params() const; - inline isl::pw_multi_aff pullback(isl::multi_aff ma) const; - inline isl::pw_multi_aff pullback(isl::pw_multi_aff pma2) const; - inline isl::pw_multi_aff range_factor_domain() const; - inline isl::pw_multi_aff range_factor_range() const; - inline isl::pw_multi_aff range_product(isl::pw_multi_aff pma2) const; - inline isl::pw_multi_aff scale(isl::val v) const; - inline isl::pw_multi_aff scale_down(isl::val v) const; - inline isl::pw_multi_aff set_pw_aff(unsigned int pos, isl::pw_aff pa) const; - inline isl::pw_multi_aff union_add(isl::pw_multi_aff pma2) const; + inline pw_multi_aff product(pw_multi_aff pma2) const; + inline pw_multi_aff project_domain_on_params() const; + inline pw_multi_aff pullback(multi_aff ma) const; + inline pw_multi_aff pullback(pw_multi_aff pma2) const; + inline pw_multi_aff range_factor_domain() const; + inline pw_multi_aff range_factor_range() const; + inline pw_multi_aff range_product(pw_multi_aff pma2) const; + inline pw_multi_aff scale(val v) const; + inline pw_multi_aff scale_down(val v) const; + inline pw_multi_aff set_pw_aff(unsigned int pos, pw_aff pa) const; + inline pw_multi_aff union_add(pw_multi_aff pma2) const; typedef isl_pw_multi_aff* isl_ptr_t; }; // declarations for isl::schedule -inline isl::schedule manage(__isl_take isl_schedule *ptr); -inline isl::schedule manage_copy(__isl_keep isl_schedule *ptr); +inline schedule manage(__isl_take isl_schedule *ptr); +inline schedule manage_copy(__isl_keep isl_schedule *ptr); class schedule { - friend inline isl::schedule manage(__isl_take isl_schedule *ptr); - friend inline isl::schedule manage_copy(__isl_keep isl_schedule *ptr); + friend inline schedule manage(__isl_take isl_schedule *ptr); + friend inline schedule manage_copy(__isl_keep isl_schedule *ptr); protected: isl_schedule *ptr = nullptr; @@ -2292,9 +2371,9 @@ class schedule { public: inline /* implicit */ schedule(); - inline /* implicit */ schedule(const isl::schedule &obj); - inline explicit schedule(isl::ctx ctx, const std::string &str); - inline isl::schedule &operator=(isl::schedule obj); + inline /* implicit */ schedule(const schedule &obj); + inline explicit schedule(ctx ctx, const std::string &str); + inline schedule &operator=(schedule obj); inline ~schedule(); inline __isl_give isl_schedule *copy() const &; inline __isl_give isl_schedule *copy() && = delete; @@ -2302,29 +2381,29 @@ class schedule { inline __isl_give isl_schedule *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - static inline isl::schedule from_domain(isl::union_set domain); - inline isl::union_set get_domain() const; - inline isl::union_map get_map() const; - inline isl::schedule_node get_root() const; - inline isl::schedule insert_partial_schedule(isl::multi_union_pw_aff partial) const; - inline bool plain_is_equal(const isl::schedule &schedule2) const; - inline isl::schedule pullback(isl::union_pw_multi_aff upma) const; - inline isl::schedule reset_user() const; - inline isl::schedule sequence(isl::schedule schedule2) const; - inline isl::schedule set(isl::schedule schedule2) const; + static inline schedule from_domain(union_set domain); + inline union_set get_domain() const; + inline union_map get_map() const; + inline schedule_node get_root() const; + inline schedule insert_partial_schedule(multi_union_pw_aff partial) const; + inline bool plain_is_equal(const schedule &schedule2) const; + inline schedule pullback(union_pw_multi_aff upma) const; + inline schedule reset_user() const; + inline schedule sequence(schedule schedule2) const; + inline schedule set(schedule schedule2) const; typedef isl_schedule* isl_ptr_t; }; // declarations for isl::schedule_constraints -inline isl::schedule_constraints manage(__isl_take isl_schedule_constraints *ptr); -inline isl::schedule_constraints manage_copy(__isl_keep isl_schedule_constraints *ptr); +inline schedule_constraints manage(__isl_take isl_schedule_constraints *ptr); +inline schedule_constraints manage_copy(__isl_keep isl_schedule_constraints *ptr); class schedule_constraints { - friend inline isl::schedule_constraints manage(__isl_take isl_schedule_constraints *ptr); - friend inline isl::schedule_constraints manage_copy(__isl_keep isl_schedule_constraints *ptr); + friend inline schedule_constraints manage(__isl_take isl_schedule_constraints *ptr); + friend inline schedule_constraints manage_copy(__isl_keep isl_schedule_constraints *ptr); protected: isl_schedule_constraints *ptr = nullptr; @@ -2333,9 +2412,9 @@ class schedule_constraints { public: inline /* implicit */ schedule_constraints(); - inline /* implicit */ schedule_constraints(const isl::schedule_constraints &obj); - inline explicit schedule_constraints(isl::ctx ctx, const std::string &str); - inline isl::schedule_constraints &operator=(isl::schedule_constraints obj); + inline /* implicit */ schedule_constraints(const schedule_constraints &obj); + inline explicit schedule_constraints(ctx ctx, const std::string &str); + inline schedule_constraints &operator=(schedule_constraints obj); inline ~schedule_constraints(); inline __isl_give isl_schedule_constraints *copy() const &; inline __isl_give isl_schedule_constraints *copy() && = delete; @@ -2343,36 +2422,36 @@ class schedule_constraints { inline __isl_give isl_schedule_constraints *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::schedule compute_schedule() const; - inline isl::union_map get_coincidence() const; - inline isl::union_map get_conditional_validity() const; - inline isl::union_map get_conditional_validity_condition() const; - inline isl::set get_context() const; - inline isl::union_set get_domain() const; - inline isl::multi_union_pw_aff get_prefix() const; - inline isl::union_map get_proximity() const; - inline isl::union_map get_validity() const; - inline isl::schedule_constraints intersect_domain(isl::union_set domain) const; - static inline isl::schedule_constraints on_domain(isl::union_set domain); - inline isl::schedule_constraints set_coincidence(isl::union_map coincidence) const; - inline isl::schedule_constraints set_conditional_validity(isl::union_map condition, isl::union_map validity) const; - inline isl::schedule_constraints set_context(isl::set context) const; - inline isl::schedule_constraints set_prefix(isl::multi_union_pw_aff prefix) const; - inline isl::schedule_constraints set_proximity(isl::union_map proximity) const; - inline isl::schedule_constraints set_validity(isl::union_map validity) const; + inline schedule compute_schedule() const; + inline union_map get_coincidence() const; + inline union_map get_conditional_validity() const; + inline union_map get_conditional_validity_condition() const; + inline set get_context() const; + inline union_set get_domain() const; + inline multi_union_pw_aff get_prefix() const; + inline union_map get_proximity() const; + inline union_map get_validity() const; + inline schedule_constraints intersect_domain(union_set domain) const; + static inline schedule_constraints on_domain(union_set domain); + inline schedule_constraints set_coincidence(union_map coincidence) const; + inline schedule_constraints set_conditional_validity(union_map condition, union_map validity) const; + inline schedule_constraints set_context(set context) const; + inline schedule_constraints set_prefix(multi_union_pw_aff prefix) const; + inline schedule_constraints set_proximity(union_map proximity) const; + inline schedule_constraints set_validity(union_map validity) const; typedef isl_schedule_constraints* isl_ptr_t; }; // declarations for isl::schedule_node -inline isl::schedule_node manage(__isl_take isl_schedule_node *ptr); -inline isl::schedule_node manage_copy(__isl_keep isl_schedule_node *ptr); +inline schedule_node manage(__isl_take isl_schedule_node *ptr); +inline schedule_node manage_copy(__isl_keep isl_schedule_node *ptr); class schedule_node { - friend inline isl::schedule_node manage(__isl_take isl_schedule_node *ptr); - friend inline isl::schedule_node manage_copy(__isl_keep isl_schedule_node *ptr); + friend inline schedule_node manage(__isl_take isl_schedule_node *ptr); + friend inline schedule_node manage_copy(__isl_keep isl_schedule_node *ptr); protected: isl_schedule_node *ptr = nullptr; @@ -2381,8 +2460,8 @@ class schedule_node { public: inline /* implicit */ schedule_node(); - inline /* implicit */ schedule_node(const isl::schedule_node &obj); - inline isl::schedule_node &operator=(isl::schedule_node obj); + inline /* implicit */ schedule_node(const schedule_node &obj); + inline schedule_node &operator=(schedule_node obj); inline ~schedule_node(); inline __isl_give isl_schedule_node *copy() const &; inline __isl_give isl_schedule_node *copy() && = delete; @@ -2392,54 +2471,54 @@ class schedule_node { inline explicit operator bool() const; template inline bool isa(); template inline T as(); - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::schedule_node ancestor(int generation) const; - inline isl::schedule_node child(int pos) const; - inline isl::schedule_node cut() const; - inline isl::schedule_node del() const; - inline bool every_descendant(const std::function &test) const; - inline isl::schedule_node first_child() const; - inline void foreach_descendant_top_down(const std::function &fn) const; - static inline isl::schedule_node from_domain(isl::union_set domain); - static inline isl::schedule_node from_extension(isl::union_map extension); - inline int get_ancestor_child_position(const isl::schedule_node &ancestor) const; - inline isl::schedule_node get_child(int pos) const; + inline schedule_node ancestor(int generation) const; + inline schedule_node child(int pos) const; + inline schedule_node cut() const; + inline schedule_node del() const; + inline bool every_descendant(const std::function &test) const; + inline schedule_node first_child() const; + inline void foreach_descendant_top_down(const std::function &fn) const; + static inline schedule_node from_domain(union_set domain); + static inline schedule_node from_extension(union_map extension); + inline int get_ancestor_child_position(const schedule_node &ancestor) const; + inline schedule_node get_child(int pos) const; inline int get_child_position() const; - inline isl::union_set get_domain() const; - inline isl::multi_union_pw_aff get_prefix_schedule_multi_union_pw_aff() const; - inline isl::union_map get_prefix_schedule_relation() const; - inline isl::union_map get_prefix_schedule_union_map() const; - inline isl::union_pw_multi_aff get_prefix_schedule_union_pw_multi_aff() const; - inline isl::schedule get_schedule() const; + inline union_set get_domain() const; + inline multi_union_pw_aff get_prefix_schedule_multi_union_pw_aff() const; + inline union_map get_prefix_schedule_relation() const; + inline union_map get_prefix_schedule_union_map() const; + inline union_pw_multi_aff get_prefix_schedule_union_pw_multi_aff() const; + inline schedule get_schedule() const; inline int get_schedule_depth() const; - inline isl::schedule_node get_shared_ancestor(const isl::schedule_node &node2) const; + inline schedule_node get_shared_ancestor(const schedule_node &node2) const; inline int get_tree_depth() const; - inline isl::union_set get_universe_domain() const; - inline isl::schedule_node graft_after(isl::schedule_node graft) const; - inline isl::schedule_node graft_before(isl::schedule_node graft) const; + inline union_set get_universe_domain() const; + inline schedule_node graft_after(schedule_node graft) const; + inline schedule_node graft_before(schedule_node graft) const; inline bool has_children() const; inline bool has_next_sibling() const; inline bool has_parent() const; inline bool has_previous_sibling() const; - inline isl::schedule_node insert_context(isl::set context) const; - inline isl::schedule_node insert_filter(isl::union_set filter) const; - inline isl::schedule_node insert_guard(isl::set context) const; - inline isl::schedule_node insert_mark(isl::id mark) const; - inline isl::schedule_node insert_partial_schedule(isl::multi_union_pw_aff schedule) const; - inline isl::schedule_node insert_sequence(isl::union_set_list filters) const; - inline isl::schedule_node insert_set(isl::union_set_list filters) const; - inline bool is_equal(const isl::schedule_node &node2) const; + inline schedule_node insert_context(set context) const; + inline schedule_node insert_filter(union_set filter) const; + inline schedule_node insert_guard(set context) const; + inline schedule_node insert_mark(id mark) const; + inline schedule_node insert_partial_schedule(multi_union_pw_aff schedule) const; + inline schedule_node insert_sequence(union_set_list filters) const; + inline schedule_node insert_set(union_set_list filters) const; + inline bool is_equal(const schedule_node &node2) const; inline bool is_subtree_anchored() const; - inline isl::schedule_node map_descendant_bottom_up(const std::function &fn) const; + inline schedule_node map_descendant_bottom_up(const std::function &fn) const; inline int n_children() const; - inline isl::schedule_node next_sibling() const; - inline isl::schedule_node order_after(isl::union_set filter) const; - inline isl::schedule_node order_before(isl::union_set filter) const; - inline isl::schedule_node parent() const; - inline isl::schedule_node previous_sibling() const; - inline isl::schedule_node root() const; + inline schedule_node next_sibling() const; + inline schedule_node order_after(union_set filter) const; + inline schedule_node order_before(union_set filter) const; + inline schedule_node parent() const; + inline schedule_node previous_sibling() const; + inline schedule_node root() const; typedef isl_schedule_node* isl_ptr_t; }; @@ -2455,36 +2534,36 @@ class schedule_node_band : public schedule_node { public: inline /* implicit */ schedule_node_band(); - inline /* implicit */ schedule_node_band(const isl::schedule_node_band &obj); - inline isl::schedule_node_band &operator=(isl::schedule_node_band obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ schedule_node_band(const schedule_node_band &obj); + inline schedule_node_band &operator=(schedule_node_band obj); + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::union_set get_ast_build_options() const; - inline isl::set get_ast_isolate_option() const; - inline isl::multi_union_pw_aff get_partial_schedule() const; - inline isl::union_map get_partial_schedule_union_map() const; + inline union_set get_ast_build_options() const; + inline set get_ast_isolate_option() const; + inline multi_union_pw_aff get_partial_schedule() const; + inline union_map get_partial_schedule_union_map() const; inline bool get_permutable() const; - inline isl::space get_space() const; + inline space get_space() const; inline bool member_get_coincident(int pos) const; - inline isl::schedule_node_band member_set_coincident(int pos, int coincident) const; - inline isl::schedule_node_band mod(isl::multi_val mv) const; + inline schedule_node_band member_set_coincident(int pos, int coincident) const; + inline schedule_node_band mod(multi_val mv) const; inline unsigned int n_member() const; - inline isl::schedule_node_band scale(isl::multi_val mv) const; - inline isl::schedule_node_band scale_down(isl::multi_val mv) const; - inline isl::schedule_node_band set_ast_build_options(isl::union_set options) const; - inline isl::schedule_node_band set_permutable(int permutable) const; - inline isl::schedule_node_band shift(isl::multi_union_pw_aff shift) const; - inline isl::schedule_node_band split(int pos) const; - inline isl::schedule_node_band tile(isl::multi_val sizes) const; - inline isl::schedule_node_band member_set_ast_loop_default(int pos) const; - inline isl::schedule_node_band member_set_ast_loop_atomic(int pos) const; - inline isl::schedule_node_band member_set_ast_loop_unroll(int pos) const; - inline isl::schedule_node_band member_set_ast_loop_separate(int pos) const; - inline isl::schedule_node_band member_set_isolate_ast_loop_default(int pos) const; - inline isl::schedule_node_band member_set_isolate_ast_loop_atomic(int pos) const; - inline isl::schedule_node_band member_set_isolate_ast_loop_unroll(int pos) const; - inline isl::schedule_node_band member_set_isolate_ast_loop_separate(int pos) const; + inline schedule_node_band scale(multi_val mv) const; + inline schedule_node_band scale_down(multi_val mv) const; + inline schedule_node_band set_ast_build_options(union_set options) const; + inline schedule_node_band set_permutable(int permutable) const; + inline schedule_node_band shift(multi_union_pw_aff shift) const; + inline schedule_node_band split(int pos) const; + inline schedule_node_band tile(multi_val sizes) const; + inline schedule_node_band member_set_ast_loop_default(int pos) const; + inline schedule_node_band member_set_ast_loop_atomic(int pos) const; + inline schedule_node_band member_set_ast_loop_unroll(int pos) const; + inline schedule_node_band member_set_ast_loop_separate(int pos) const; + inline schedule_node_band member_set_isolate_ast_loop_default(int pos) const; + inline schedule_node_band member_set_isolate_ast_loop_atomic(int pos) const; + inline schedule_node_band member_set_isolate_ast_loop_unroll(int pos) const; + inline schedule_node_band member_set_isolate_ast_loop_separate(int pos) const; typedef isl_schedule_node* isl_ptr_t; }; @@ -2500,12 +2579,12 @@ class schedule_node_context : public schedule_node { public: inline /* implicit */ schedule_node_context(); - inline /* implicit */ schedule_node_context(const isl::schedule_node_context &obj); - inline isl::schedule_node_context &operator=(isl::schedule_node_context obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ schedule_node_context(const schedule_node_context &obj); + inline schedule_node_context &operator=(schedule_node_context obj); + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::set get_context() const; + inline set get_context() const; typedef isl_schedule_node* isl_ptr_t; }; @@ -2521,12 +2600,12 @@ class schedule_node_domain : public schedule_node { public: inline /* implicit */ schedule_node_domain(); - inline /* implicit */ schedule_node_domain(const isl::schedule_node_domain &obj); - inline isl::schedule_node_domain &operator=(isl::schedule_node_domain obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ schedule_node_domain(const schedule_node_domain &obj); + inline schedule_node_domain &operator=(schedule_node_domain obj); + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::union_set get_domain() const; + inline union_set get_domain() const; typedef isl_schedule_node* isl_ptr_t; }; @@ -2542,13 +2621,13 @@ class schedule_node_expansion : public schedule_node { public: inline /* implicit */ schedule_node_expansion(); - inline /* implicit */ schedule_node_expansion(const isl::schedule_node_expansion &obj); - inline isl::schedule_node_expansion &operator=(isl::schedule_node_expansion obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ schedule_node_expansion(const schedule_node_expansion &obj); + inline schedule_node_expansion &operator=(schedule_node_expansion obj); + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::union_pw_multi_aff get_contraction() const; - inline isl::union_map get_expansion() const; + inline union_pw_multi_aff get_contraction() const; + inline union_map get_expansion() const; typedef isl_schedule_node* isl_ptr_t; }; @@ -2564,12 +2643,12 @@ class schedule_node_extension : public schedule_node { public: inline /* implicit */ schedule_node_extension(); - inline /* implicit */ schedule_node_extension(const isl::schedule_node_extension &obj); - inline isl::schedule_node_extension &operator=(isl::schedule_node_extension obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ schedule_node_extension(const schedule_node_extension &obj); + inline schedule_node_extension &operator=(schedule_node_extension obj); + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::union_map get_extension() const; + inline union_map get_extension() const; typedef isl_schedule_node* isl_ptr_t; }; @@ -2585,12 +2664,12 @@ class schedule_node_filter : public schedule_node { public: inline /* implicit */ schedule_node_filter(); - inline /* implicit */ schedule_node_filter(const isl::schedule_node_filter &obj); - inline isl::schedule_node_filter &operator=(isl::schedule_node_filter obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ schedule_node_filter(const schedule_node_filter &obj); + inline schedule_node_filter &operator=(schedule_node_filter obj); + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::union_set get_filter() const; + inline union_set get_filter() const; typedef isl_schedule_node* isl_ptr_t; }; @@ -2606,12 +2685,12 @@ class schedule_node_guard : public schedule_node { public: inline /* implicit */ schedule_node_guard(); - inline /* implicit */ schedule_node_guard(const isl::schedule_node_guard &obj); - inline isl::schedule_node_guard &operator=(isl::schedule_node_guard obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ schedule_node_guard(const schedule_node_guard &obj); + inline schedule_node_guard &operator=(schedule_node_guard obj); + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::set get_guard() const; + inline set get_guard() const; typedef isl_schedule_node* isl_ptr_t; }; @@ -2627,9 +2706,9 @@ class schedule_node_leaf : public schedule_node { public: inline /* implicit */ schedule_node_leaf(); - inline /* implicit */ schedule_node_leaf(const isl::schedule_node_leaf &obj); - inline isl::schedule_node_leaf &operator=(isl::schedule_node_leaf obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ schedule_node_leaf(const schedule_node_leaf &obj); + inline schedule_node_leaf &operator=(schedule_node_leaf obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_schedule_node* isl_ptr_t; @@ -2647,12 +2726,12 @@ class schedule_node_mark : public schedule_node { public: inline /* implicit */ schedule_node_mark(); - inline /* implicit */ schedule_node_mark(const isl::schedule_node_mark &obj); - inline isl::schedule_node_mark &operator=(isl::schedule_node_mark obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ schedule_node_mark(const schedule_node_mark &obj); + inline schedule_node_mark &operator=(schedule_node_mark obj); + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::id get_id() const; + inline id get_id() const; typedef isl_schedule_node* isl_ptr_t; }; @@ -2668,9 +2747,9 @@ class schedule_node_sequence : public schedule_node { public: inline /* implicit */ schedule_node_sequence(); - inline /* implicit */ schedule_node_sequence(const isl::schedule_node_sequence &obj); - inline isl::schedule_node_sequence &operator=(isl::schedule_node_sequence obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ schedule_node_sequence(const schedule_node_sequence &obj); + inline schedule_node_sequence &operator=(schedule_node_sequence obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_schedule_node* isl_ptr_t; @@ -2688,21 +2767,21 @@ class schedule_node_set : public schedule_node { public: inline /* implicit */ schedule_node_set(); - inline /* implicit */ schedule_node_set(const isl::schedule_node_set &obj); - inline isl::schedule_node_set &operator=(isl::schedule_node_set obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ schedule_node_set(const schedule_node_set &obj); + inline schedule_node_set &operator=(schedule_node_set obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_schedule_node* isl_ptr_t; }; // declarations for isl::set -inline isl::set manage(__isl_take isl_set *ptr); -inline isl::set manage_copy(__isl_keep isl_set *ptr); +inline set manage(__isl_take isl_set *ptr); +inline set manage_copy(__isl_keep isl_set *ptr); class set { - friend inline isl::set manage(__isl_take isl_set *ptr); - friend inline isl::set manage_copy(__isl_keep isl_set *ptr); + friend inline set manage(__isl_take isl_set *ptr); + friend inline set manage_copy(__isl_keep isl_set *ptr); protected: isl_set *ptr = nullptr; @@ -2711,11 +2790,11 @@ class set { public: inline /* implicit */ set(); - inline /* implicit */ set(const isl::set &obj); - inline /* implicit */ set(isl::point pnt); - inline explicit set(isl::ctx ctx, const std::string &str); - inline /* implicit */ set(isl::basic_set bset); - inline isl::set &operator=(isl::set obj); + inline /* implicit */ set(const set &obj); + inline /* implicit */ set(point pnt); + inline explicit set(ctx ctx, const std::string &str); + inline /* implicit */ set(basic_set bset); + inline set &operator=(set obj); inline ~set(); inline __isl_give isl_set *copy() const &; inline __isl_give isl_set *copy() && = delete; @@ -2723,81 +2802,81 @@ class set { inline __isl_give isl_set *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::basic_set affine_hull() const; - inline isl::set align_params(isl::space model) const; - inline isl::set apply(isl::map map) const; - inline isl::set coalesce() const; - inline isl::set complement() const; - inline isl::set compute_divs() const; - inline isl::set detect_equalities() const; - inline isl::pw_aff dim_max(int pos) const; - inline isl::pw_aff dim_min(int pos) const; - static inline isl::set empty(isl::space space); - inline isl::set flatten() const; - inline isl::map flatten_map() const; - inline void foreach_basic_set(const std::function &fn) const; - static inline isl::set from(isl::multi_aff ma); - inline isl::set from_params() const; - static inline isl::set from_union_set(isl::union_set uset); - inline isl::basic_set_list get_basic_set_list() const; - inline isl::space get_space() const; - inline isl::val get_stride(int pos) const; - inline isl::id get_tuple_id() const; + inline basic_set affine_hull() const; + inline set align_params(space model) const; + inline set apply(map map) const; + inline set coalesce() const; + inline set complement() const; + inline set compute_divs() const; + inline set detect_equalities() const; + inline pw_aff dim_max(int pos) const; + inline pw_aff dim_min(int pos) const; + static inline set empty(space space); + inline set flatten() const; + inline map flatten_map() const; + inline void foreach_basic_set(const std::function &fn) const; + static inline set from(multi_aff ma); + inline set from_params() const; + static inline set from_union_set(union_set uset); + inline basic_set_list get_basic_set_list() const; + inline space get_space() const; + inline val get_stride(int pos) const; + inline id get_tuple_id() const; inline std::string get_tuple_name() const; - inline isl::set gist(isl::set context) const; + inline set gist(set context) const; inline bool has_tuple_id() const; inline bool has_tuple_name() const; - inline isl::map identity() const; - inline isl::set intersect(isl::set set2) const; - inline isl::set intersect_params(isl::set params) const; - inline bool involves_param(const isl::id &id) const; - inline bool is_disjoint(const isl::set &set2) const; + inline map identity() const; + inline set intersect(set set2) const; + inline set intersect_params(set params) const; + inline bool involves_param(const id &id) const; + inline bool is_disjoint(const set &set2) const; inline bool is_empty() const; - inline bool is_equal(const isl::set &set2) const; + inline bool is_equal(const set &set2) const; inline bool is_singleton() const; - inline bool is_strict_subset(const isl::set &set2) const; - inline bool is_subset(const isl::set &set2) const; + inline bool is_strict_subset(const set &set2) const; + inline bool is_subset(const set &set2) const; inline bool is_wrapping() const; - inline isl::set lexmax() const; - inline isl::set lexmin() const; - inline isl::val max_val(const isl::aff &obj) const; - inline isl::val min_val(const isl::aff &obj) const; + inline set lexmax() const; + inline set lexmin() const; + inline val max_val(const aff &obj) const; + inline val min_val(const aff &obj) const; inline int n_basic_set() const; inline unsigned int n_dim() const; inline unsigned int n_param() const; - static inline isl::set nat_universe(isl::space dim); - inline isl::set params() const; + static inline set nat_universe(space dim); + inline set params() const; inline bool plain_is_universe() const; - inline isl::basic_set polyhedral_hull() const; - inline isl::set preimage_multi_aff(isl::multi_aff ma) const; - inline isl::set product(isl::set set2) const; - inline isl::set reset_tuple_id() const; - inline isl::basic_set sample() const; - inline isl::point sample_point() const; - inline isl::set set_tuple_id(isl::id id) const; - inline isl::set set_tuple_name(const std::string &s) const; - inline isl::basic_set simple_hull() const; - inline isl::set subtract(isl::set set2) const; - inline isl::set unbind_params(isl::multi_id tuple) const; - inline isl::map unbind_params_insert_domain(isl::multi_id domain) const; - inline isl::set unite(isl::set set2) const; - static inline isl::set universe(isl::space space); - inline isl::basic_set unshifted_simple_hull() const; - inline isl::map unwrap() const; - inline isl::map wrapped_domain_map() const; + inline basic_set polyhedral_hull() const; + inline set preimage_multi_aff(multi_aff ma) const; + inline set product(set set2) const; + inline set reset_tuple_id() const; + inline basic_set sample() const; + inline point sample_point() const; + inline set set_tuple_id(id id) const; + inline set set_tuple_name(const std::string &s) const; + inline basic_set simple_hull() const; + inline set subtract(set set2) const; + inline set unbind_params(multi_id tuple) const; + inline map unbind_params_insert_domain(multi_id domain) const; + inline set unite(set set2) const; + static inline set universe(space space); + inline basic_set unshifted_simple_hull() const; + inline map unwrap() const; + inline map wrapped_domain_map() const; typedef isl_set* isl_ptr_t; }; // declarations for isl::set_list -inline isl::set_list manage(__isl_take isl_set_list *ptr); -inline isl::set_list manage_copy(__isl_keep isl_set_list *ptr); +inline set_list manage(__isl_take isl_set_list *ptr); +inline set_list manage_copy(__isl_keep isl_set_list *ptr); class set_list { - friend inline isl::set_list manage(__isl_take isl_set_list *ptr); - friend inline isl::set_list manage_copy(__isl_keep isl_set_list *ptr); + friend inline set_list manage(__isl_take isl_set_list *ptr); + friend inline set_list manage_copy(__isl_keep isl_set_list *ptr); protected: isl_set_list *ptr = nullptr; @@ -2806,10 +2885,10 @@ class set_list { public: inline /* implicit */ set_list(); - inline /* implicit */ set_list(const isl::set_list &obj); - inline explicit set_list(isl::set el); - inline explicit set_list(isl::ctx ctx, int n); - inline isl::set_list &operator=(isl::set_list obj); + inline /* implicit */ set_list(const set_list &obj); + inline explicit set_list(set el); + inline explicit set_list(ctx ctx, int n); + inline set_list &operator=(set_list obj); inline ~set_list(); inline __isl_give isl_set_list *copy() const &; inline __isl_give isl_set_list *copy() && = delete; @@ -2817,25 +2896,25 @@ class set_list { inline __isl_give isl_set_list *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; - - inline isl::set_list add(isl::set el) const; - inline isl::set_list concat(isl::set_list list2) const; - inline isl::set_list drop(unsigned int first, unsigned int n) const; - inline void foreach(const std::function &fn) const; - inline isl::set get_at(int index) const; - inline isl::set_list reverse() const; + inline ctx get_ctx() const; + + inline set_list add(set el) const; + inline set_list concat(set_list list2) const; + inline set_list drop(unsigned int first, unsigned int n) const; + inline void foreach(const std::function &fn) const; + inline set get_at(int index) const; + inline set_list reverse() const; inline int size() const; typedef isl_set_list* isl_ptr_t; }; // declarations for isl::space -inline isl::space manage(__isl_take isl_space *ptr); -inline isl::space manage_copy(__isl_keep isl_space *ptr); +inline space manage(__isl_take isl_space *ptr); +inline space manage_copy(__isl_keep isl_space *ptr); class space { - friend inline isl::space manage(__isl_take isl_space *ptr); - friend inline isl::space manage_copy(__isl_keep isl_space *ptr); + friend inline space manage(__isl_take isl_space *ptr); + friend inline space manage_copy(__isl_keep isl_space *ptr); protected: isl_space *ptr = nullptr; @@ -2844,11 +2923,11 @@ class space { public: inline /* implicit */ space(); - inline /* implicit */ space(const isl::space &obj); - inline explicit space(isl::ctx ctx, unsigned int nparam, unsigned int n_in, unsigned int n_out); - inline explicit space(isl::ctx ctx, unsigned int nparam, unsigned int dim); - inline explicit space(isl::ctx ctx, unsigned int nparam); - inline isl::space &operator=(isl::space obj); + inline /* implicit */ space(const space &obj); + inline explicit space(ctx ctx, unsigned int nparam, unsigned int n_in, unsigned int n_out); + inline explicit space(ctx ctx, unsigned int nparam, unsigned int dim); + inline explicit space(ctx ctx, unsigned int nparam); + inline space &operator=(space obj); inline ~space(); inline __isl_give isl_space *copy() const &; inline __isl_give isl_space *copy() && = delete; @@ -2856,51 +2935,51 @@ class space { inline __isl_give isl_space *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::space add_named_tuple_id_ui(isl::id tuple_id, unsigned int dim) const; - inline isl::space add_param(isl::id id) const; - inline isl::space add_unnamed_tuple_ui(unsigned int dim) const; - inline isl::space align_params(isl::space dim2) const; + inline space add_named_tuple_id_ui(id tuple_id, unsigned int dim) const; + inline space add_param(id id) const; + inline space add_unnamed_tuple_ui(unsigned int dim) const; + inline space align_params(space dim2) const; inline bool can_curry() const; inline bool can_uncurry() const; - inline isl::space curry() const; - inline isl::space domain() const; - inline isl::space domain_map() const; - inline isl::space domain_product(isl::space right) const; - inline isl::space from_domain() const; - inline isl::space from_range() const; - inline isl::id get_map_range_tuple_id() const; - inline bool has_equal_params(const isl::space &space2) const; - inline bool has_equal_tuples(const isl::space &space2) const; - inline bool has_param(const isl::id &id) const; - inline bool is_equal(const isl::space &space2) const; + inline space curry() const; + inline space domain() const; + inline space domain_map() const; + inline space domain_product(space right) const; + inline space from_domain() const; + inline space from_range() const; + inline id get_map_range_tuple_id() const; + inline bool has_equal_params(const space &space2) const; + inline bool has_equal_tuples(const space &space2) const; + inline bool has_param(const id &id) const; + inline bool is_equal(const space &space2) const; inline bool is_params() const; inline bool is_set() const; inline bool is_wrapping() const; - inline isl::space map_from_domain_and_range(isl::space range) const; - inline isl::space map_from_set() const; - inline isl::space params() const; - inline isl::space product(isl::space right) const; - inline isl::space range() const; - inline isl::space range_map() const; - inline isl::space range_product(isl::space right) const; - inline isl::space set_from_params() const; - inline isl::space set_set_tuple_id(isl::id id) const; - inline isl::space uncurry() const; - inline isl::space unwrap() const; - inline isl::space wrap() const; + inline space map_from_domain_and_range(space range) const; + inline space map_from_set() const; + inline space params() const; + inline space product(space right) const; + inline space range() const; + inline space range_map() const; + inline space range_product(space right) const; + inline space set_from_params() const; + inline space set_set_tuple_id(id id) const; + inline space uncurry() const; + inline space unwrap() const; + inline space wrap() const; typedef isl_space* isl_ptr_t; }; // declarations for isl::stride_info -inline isl::stride_info manage(__isl_take isl_stride_info *ptr); -inline isl::stride_info manage_copy(__isl_keep isl_stride_info *ptr); +inline stride_info manage(__isl_take isl_stride_info *ptr); +inline stride_info manage_copy(__isl_keep isl_stride_info *ptr); class stride_info { - friend inline isl::stride_info manage(__isl_take isl_stride_info *ptr); - friend inline isl::stride_info manage_copy(__isl_keep isl_stride_info *ptr); + friend inline stride_info manage(__isl_take isl_stride_info *ptr); + friend inline stride_info manage_copy(__isl_keep isl_stride_info *ptr); protected: isl_stride_info *ptr = nullptr; @@ -2909,8 +2988,8 @@ class stride_info { public: inline /* implicit */ stride_info(); - inline /* implicit */ stride_info(const isl::stride_info &obj); - inline isl::stride_info &operator=(isl::stride_info obj); + inline /* implicit */ stride_info(const stride_info &obj); + inline stride_info &operator=(stride_info obj); inline ~stride_info(); inline __isl_give isl_stride_info *copy() const &; inline __isl_give isl_stride_info *copy() && = delete; @@ -2918,20 +2997,20 @@ class stride_info { inline __isl_give isl_stride_info *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; - inline isl::aff get_offset() const; - inline isl::val get_stride() const; + inline aff get_offset() const; + inline val get_stride() const; typedef isl_stride_info* isl_ptr_t; }; // declarations for isl::union_access_info -inline isl::union_access_info manage(__isl_take isl_union_access_info *ptr); -inline isl::union_access_info manage_copy(__isl_keep isl_union_access_info *ptr); +inline union_access_info manage(__isl_take isl_union_access_info *ptr); +inline union_access_info manage_copy(__isl_keep isl_union_access_info *ptr); class union_access_info { - friend inline isl::union_access_info manage(__isl_take isl_union_access_info *ptr); - friend inline isl::union_access_info manage_copy(__isl_keep isl_union_access_info *ptr); + friend inline union_access_info manage(__isl_take isl_union_access_info *ptr); + friend inline union_access_info manage_copy(__isl_keep isl_union_access_info *ptr); protected: isl_union_access_info *ptr = nullptr; @@ -2940,9 +3019,9 @@ class union_access_info { public: inline /* implicit */ union_access_info(); - inline /* implicit */ union_access_info(const isl::union_access_info &obj); - inline explicit union_access_info(isl::union_map sink); - inline isl::union_access_info &operator=(isl::union_access_info obj); + inline /* implicit */ union_access_info(const union_access_info &obj); + inline explicit union_access_info(union_map sink); + inline union_access_info &operator=(union_access_info obj); inline ~union_access_info(); inline __isl_give isl_union_access_info *copy() const &; inline __isl_give isl_union_access_info *copy() && = delete; @@ -2950,25 +3029,25 @@ class union_access_info { inline __isl_give isl_union_access_info *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::union_flow compute_flow() const; - inline isl::union_access_info set_kill(isl::union_map kill) const; - inline isl::union_access_info set_may_source(isl::union_map may_source) const; - inline isl::union_access_info set_must_source(isl::union_map must_source) const; - inline isl::union_access_info set_schedule(isl::schedule schedule) const; - inline isl::union_access_info set_schedule_map(isl::union_map schedule_map) const; + inline union_flow compute_flow() const; + inline union_access_info set_kill(union_map kill) const; + inline union_access_info set_may_source(union_map may_source) const; + inline union_access_info set_must_source(union_map must_source) const; + inline union_access_info set_schedule(schedule schedule) const; + inline union_access_info set_schedule_map(union_map schedule_map) const; typedef isl_union_access_info* isl_ptr_t; }; // declarations for isl::union_flow -inline isl::union_flow manage(__isl_take isl_union_flow *ptr); -inline isl::union_flow manage_copy(__isl_keep isl_union_flow *ptr); +inline union_flow manage(__isl_take isl_union_flow *ptr); +inline union_flow manage_copy(__isl_keep isl_union_flow *ptr); class union_flow { - friend inline isl::union_flow manage(__isl_take isl_union_flow *ptr); - friend inline isl::union_flow manage_copy(__isl_keep isl_union_flow *ptr); + friend inline union_flow manage(__isl_take isl_union_flow *ptr); + friend inline union_flow manage_copy(__isl_keep isl_union_flow *ptr); protected: isl_union_flow *ptr = nullptr; @@ -2977,8 +3056,8 @@ class union_flow { public: inline /* implicit */ union_flow(); - inline /* implicit */ union_flow(const isl::union_flow &obj); - inline isl::union_flow &operator=(isl::union_flow obj); + inline /* implicit */ union_flow(const union_flow &obj); + inline union_flow &operator=(union_flow obj); inline ~union_flow(); inline __isl_give isl_union_flow *copy() const &; inline __isl_give isl_union_flow *copy() && = delete; @@ -2986,25 +3065,25 @@ class union_flow { inline __isl_give isl_union_flow *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::union_map get_full_may_dependence() const; - inline isl::union_map get_full_must_dependence() const; - inline isl::union_map get_may_dependence() const; - inline isl::union_map get_may_no_source() const; - inline isl::union_map get_must_dependence() const; - inline isl::union_map get_must_no_source() const; + inline union_map get_full_may_dependence() const; + inline union_map get_full_must_dependence() const; + inline union_map get_may_dependence() const; + inline union_map get_may_no_source() const; + inline union_map get_must_dependence() const; + inline union_map get_must_no_source() const; typedef isl_union_flow* isl_ptr_t; }; // declarations for isl::union_map -inline isl::union_map manage(__isl_take isl_union_map *ptr); -inline isl::union_map manage_copy(__isl_keep isl_union_map *ptr); +inline union_map manage(__isl_take isl_union_map *ptr); +inline union_map manage_copy(__isl_keep isl_union_map *ptr); class union_map { - friend inline isl::union_map manage(__isl_take isl_union_map *ptr); - friend inline isl::union_map manage_copy(__isl_keep isl_union_map *ptr); + friend inline union_map manage(__isl_take isl_union_map *ptr); + friend inline union_map manage_copy(__isl_keep isl_union_map *ptr); protected: isl_union_map *ptr = nullptr; @@ -3013,11 +3092,11 @@ class union_map { public: inline /* implicit */ union_map(); - inline /* implicit */ union_map(const isl::union_map &obj); - inline /* implicit */ union_map(isl::basic_map bmap); - inline /* implicit */ union_map(isl::map map); - inline explicit union_map(isl::ctx ctx, const std::string &str); - inline isl::union_map &operator=(isl::union_map obj); + inline /* implicit */ union_map(const union_map &obj); + inline /* implicit */ union_map(basic_map bmap); + inline /* implicit */ union_map(map map); + inline explicit union_map(ctx ctx, const std::string &str); + inline union_map &operator=(union_map obj); inline ~union_map(); inline __isl_give isl_union_map *copy() const &; inline __isl_give isl_union_map *copy() && = delete; @@ -3025,87 +3104,87 @@ class union_map { inline __isl_give isl_union_map *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::union_map add_map(isl::map map) const; - inline isl::union_map affine_hull() const; - inline isl::union_map apply_domain(isl::union_map umap2) const; - inline isl::union_map apply_range(isl::union_map umap2) const; - inline isl::union_map coalesce() const; - inline isl::union_map compute_divs() const; - inline isl::union_map curry() const; - inline isl::union_set deltas() const; - inline isl::union_map detect_equalities() const; - inline isl::union_set domain() const; - inline isl::union_map domain_factor_domain() const; - inline isl::union_map domain_factor_range() const; - inline isl::union_map domain_map() const; - inline isl::union_pw_multi_aff domain_map_union_pw_multi_aff() const; - inline isl::union_map domain_product(isl::union_map umap2) const; - static inline isl::union_map empty(isl::space space); - inline isl::union_map eq_at(isl::multi_union_pw_aff mupa) const; - inline isl::map extract_map(isl::space dim) const; - inline isl::union_map factor_domain() const; - inline isl::union_map factor_range() const; - inline isl::union_map fixed_power(isl::val exp) const; - inline isl::union_map flat_range_product(isl::union_map umap2) const; - inline void foreach_map(const std::function &fn) const; - static inline isl::union_map from(isl::union_pw_multi_aff upma); - static inline isl::union_map from(isl::multi_union_pw_aff mupa); - static inline isl::union_map from_domain(isl::union_set uset); - static inline isl::union_map from_domain_and_range(isl::union_set domain, isl::union_set range); - static inline isl::union_map from_range(isl::union_set uset); - inline isl::map_list get_map_list() const; - inline isl::space get_space() const; - inline isl::union_map gist(isl::union_map context) const; - inline isl::union_map gist_domain(isl::union_set uset) const; - inline isl::union_map gist_params(isl::set set) const; - inline isl::union_map gist_range(isl::union_set uset) const; - inline isl::union_map intersect(isl::union_map umap2) const; - inline isl::union_map intersect_domain(isl::union_set uset) const; - inline isl::union_map intersect_params(isl::set set) const; - inline isl::union_map intersect_range(isl::union_set uset) const; + inline union_map add_map(map map) const; + inline union_map affine_hull() const; + inline union_map apply_domain(union_map umap2) const; + inline union_map apply_range(union_map umap2) const; + inline union_map coalesce() const; + inline union_map compute_divs() const; + inline union_map curry() const; + inline union_set deltas() const; + inline union_map detect_equalities() const; + inline union_set domain() const; + inline union_map domain_factor_domain() const; + inline union_map domain_factor_range() const; + inline union_map domain_map() const; + inline union_pw_multi_aff domain_map_union_pw_multi_aff() const; + inline union_map domain_product(union_map umap2) const; + static inline union_map empty(space space); + inline union_map eq_at(multi_union_pw_aff mupa) const; + inline map extract_map(space dim) const; + inline union_map factor_domain() const; + inline union_map factor_range() const; + inline union_map fixed_power(val exp) const; + inline union_map flat_range_product(union_map umap2) const; + inline void foreach_map(const std::function &fn) const; + static inline union_map from(union_pw_multi_aff upma); + static inline union_map from(multi_union_pw_aff mupa); + static inline union_map from_domain(union_set uset); + static inline union_map from_domain_and_range(union_set domain, union_set range); + static inline union_map from_range(union_set uset); + inline map_list get_map_list() const; + inline space get_space() const; + inline union_map gist(union_map context) const; + inline union_map gist_domain(union_set uset) const; + inline union_map gist_params(set set) const; + inline union_map gist_range(union_set uset) const; + inline union_map intersect(union_map umap2) const; + inline union_map intersect_domain(union_set uset) const; + inline union_map intersect_params(set set) const; + inline union_map intersect_range(union_set uset) const; inline bool is_bijective() const; inline bool is_empty() const; - inline bool is_equal(const isl::union_map &umap2) const; + inline bool is_equal(const union_map &umap2) const; inline bool is_injective() const; inline bool is_single_valued() const; - inline bool is_strict_subset(const isl::union_map &umap2) const; - inline bool is_subset(const isl::union_map &umap2) const; - inline isl::union_map lex_gt_at(isl::multi_union_pw_aff mupa) const; - inline isl::union_map lex_lt_at(isl::multi_union_pw_aff mupa) const; - inline isl::union_map lexmax() const; - inline isl::union_map lexmin() const; + inline bool is_strict_subset(const union_map &umap2) const; + inline bool is_subset(const union_map &umap2) const; + inline union_map lex_gt_at(multi_union_pw_aff mupa) const; + inline union_map lex_lt_at(multi_union_pw_aff mupa) const; + inline union_map lexmax() const; + inline union_map lexmin() const; inline int n_map() const; - inline isl::union_map polyhedral_hull() const; - inline isl::union_map preimage_range_multi_aff(isl::multi_aff ma) const; - inline isl::union_map product(isl::union_map umap2) const; - inline isl::union_map project_out_all_params() const; - inline isl::union_set range() const; - inline isl::union_map range_factor_domain() const; - inline isl::union_map range_factor_range() const; - inline isl::union_map range_map() const; - inline isl::union_map range_product(isl::union_map umap2) const; - inline isl::union_map reverse() const; - inline isl::union_map subtract(isl::union_map umap2) const; - inline isl::union_map subtract_domain(isl::union_set dom) const; - inline isl::union_map subtract_range(isl::union_set dom) const; - inline isl::union_map uncurry() const; - inline isl::union_map unite(isl::union_map umap2) const; - inline isl::union_map universe() const; - inline isl::union_set wrap() const; - inline isl::union_map zip() const; + inline union_map polyhedral_hull() const; + inline union_map preimage_range_multi_aff(multi_aff ma) const; + inline union_map product(union_map umap2) const; + inline union_map project_out_all_params() const; + inline union_set range() const; + inline union_map range_factor_domain() const; + inline union_map range_factor_range() const; + inline union_map range_map() const; + inline union_map range_product(union_map umap2) const; + inline union_map reverse() const; + inline union_map subtract(union_map umap2) const; + inline union_map subtract_domain(union_set dom) const; + inline union_map subtract_range(union_set dom) const; + inline union_map uncurry() const; + inline union_map unite(union_map umap2) const; + inline union_map universe() const; + inline union_set wrap() const; + inline union_map zip() const; typedef isl_union_map* isl_ptr_t; }; // declarations for isl::union_pw_aff -inline isl::union_pw_aff manage(__isl_take isl_union_pw_aff *ptr); -inline isl::union_pw_aff manage_copy(__isl_keep isl_union_pw_aff *ptr); +inline union_pw_aff manage(__isl_take isl_union_pw_aff *ptr); +inline union_pw_aff manage_copy(__isl_keep isl_union_pw_aff *ptr); class union_pw_aff { - friend inline isl::union_pw_aff manage(__isl_take isl_union_pw_aff *ptr); - friend inline isl::union_pw_aff manage_copy(__isl_keep isl_union_pw_aff *ptr); + friend inline union_pw_aff manage(__isl_take isl_union_pw_aff *ptr); + friend inline union_pw_aff manage_copy(__isl_keep isl_union_pw_aff *ptr); protected: isl_union_pw_aff *ptr = nullptr; @@ -3114,12 +3193,12 @@ class union_pw_aff { public: inline /* implicit */ union_pw_aff(); - inline /* implicit */ union_pw_aff(const isl::union_pw_aff &obj); - inline /* implicit */ union_pw_aff(isl::pw_aff pa); - inline explicit union_pw_aff(isl::union_set domain, isl::val v); - inline explicit union_pw_aff(isl::union_set domain, isl::aff aff); - inline explicit union_pw_aff(isl::ctx ctx, const std::string &str); - inline isl::union_pw_aff &operator=(isl::union_pw_aff obj); + inline /* implicit */ union_pw_aff(const union_pw_aff &obj); + inline /* implicit */ union_pw_aff(pw_aff pa); + inline explicit union_pw_aff(union_set domain, val v); + inline explicit union_pw_aff(union_set domain, aff aff); + inline explicit union_pw_aff(ctx ctx, const std::string &str); + inline union_pw_aff &operator=(union_pw_aff obj); inline ~union_pw_aff(); inline __isl_give isl_union_pw_aff *copy() const &; inline __isl_give isl_union_pw_aff *copy() && = delete; @@ -3127,42 +3206,42 @@ class union_pw_aff { inline __isl_give isl_union_pw_aff *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::union_pw_aff add(isl::union_pw_aff upa2) const; - inline isl::union_set domain() const; - static inline isl::union_pw_aff empty(isl::space space); - inline isl::pw_aff extract_on_domain(isl::space space) const; - inline isl::pw_aff extract_pw_aff(isl::space space) const; - inline isl::union_pw_aff floor() const; - inline void foreach_pw_aff(const std::function &fn) const; - inline isl::pw_aff_list get_pw_aff_list() const; - inline isl::space get_space() const; - inline isl::union_pw_aff intersect_domain(isl::union_set uset) const; - inline bool involves_param(const isl::id &id) const; - inline isl::val max_val() const; - inline isl::val min_val() const; - inline isl::union_pw_aff mod(isl::val f) const; + inline union_pw_aff add(union_pw_aff upa2) const; + inline union_set domain() const; + static inline union_pw_aff empty(space space); + inline pw_aff extract_on_domain(space space) const; + inline pw_aff extract_pw_aff(space space) const; + inline union_pw_aff floor() const; + inline void foreach_pw_aff(const std::function &fn) const; + inline pw_aff_list get_pw_aff_list() const; + inline space get_space() const; + inline union_pw_aff intersect_domain(union_set uset) const; + inline bool involves_param(const id &id) const; + inline val max_val() const; + inline val min_val() const; + inline union_pw_aff mod(val f) const; inline int n_pw_aff() const; - static inline isl::union_pw_aff param_on_domain(isl::union_set domain, isl::id id); - inline bool plain_is_equal(const isl::union_pw_aff &upa2) const; - inline isl::union_pw_aff pullback(isl::union_pw_multi_aff upma) const; - inline isl::union_pw_aff scale(isl::val v) const; - inline isl::union_pw_aff scale_down(isl::val v) const; - inline isl::union_pw_aff sub(isl::union_pw_aff upa2) const; - inline isl::union_pw_aff union_add(isl::union_pw_aff upa2) const; - inline isl::union_set zero_union_set() const; + static inline union_pw_aff param_on_domain(union_set domain, id id); + inline bool plain_is_equal(const union_pw_aff &upa2) const; + inline union_pw_aff pullback(union_pw_multi_aff upma) const; + inline union_pw_aff scale(val v) const; + inline union_pw_aff scale_down(val v) const; + inline union_pw_aff sub(union_pw_aff upa2) const; + inline union_pw_aff union_add(union_pw_aff upa2) const; + inline union_set zero_union_set() const; typedef isl_union_pw_aff* isl_ptr_t; }; // declarations for isl::union_pw_aff_list -inline isl::union_pw_aff_list manage(__isl_take isl_union_pw_aff_list *ptr); -inline isl::union_pw_aff_list manage_copy(__isl_keep isl_union_pw_aff_list *ptr); +inline union_pw_aff_list manage(__isl_take isl_union_pw_aff_list *ptr); +inline union_pw_aff_list manage_copy(__isl_keep isl_union_pw_aff_list *ptr); class union_pw_aff_list { - friend inline isl::union_pw_aff_list manage(__isl_take isl_union_pw_aff_list *ptr); - friend inline isl::union_pw_aff_list manage_copy(__isl_keep isl_union_pw_aff_list *ptr); + friend inline union_pw_aff_list manage(__isl_take isl_union_pw_aff_list *ptr); + friend inline union_pw_aff_list manage_copy(__isl_keep isl_union_pw_aff_list *ptr); protected: isl_union_pw_aff_list *ptr = nullptr; @@ -3171,10 +3250,10 @@ class union_pw_aff_list { public: inline /* implicit */ union_pw_aff_list(); - inline /* implicit */ union_pw_aff_list(const isl::union_pw_aff_list &obj); - inline explicit union_pw_aff_list(isl::union_pw_aff el); - inline explicit union_pw_aff_list(isl::ctx ctx, int n); - inline isl::union_pw_aff_list &operator=(isl::union_pw_aff_list obj); + inline /* implicit */ union_pw_aff_list(const union_pw_aff_list &obj); + inline explicit union_pw_aff_list(union_pw_aff el); + inline explicit union_pw_aff_list(ctx ctx, int n); + inline union_pw_aff_list &operator=(union_pw_aff_list obj); inline ~union_pw_aff_list(); inline __isl_give isl_union_pw_aff_list *copy() const &; inline __isl_give isl_union_pw_aff_list *copy() && = delete; @@ -3182,25 +3261,25 @@ class union_pw_aff_list { inline __isl_give isl_union_pw_aff_list *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; - - inline isl::union_pw_aff_list add(isl::union_pw_aff el) const; - inline isl::union_pw_aff_list concat(isl::union_pw_aff_list list2) const; - inline isl::union_pw_aff_list drop(unsigned int first, unsigned int n) const; - inline void foreach(const std::function &fn) const; - inline isl::union_pw_aff get_at(int index) const; - inline isl::union_pw_aff_list reverse() const; + inline ctx get_ctx() const; + + inline union_pw_aff_list add(union_pw_aff el) const; + inline union_pw_aff_list concat(union_pw_aff_list list2) const; + inline union_pw_aff_list drop(unsigned int first, unsigned int n) const; + inline void foreach(const std::function &fn) const; + inline union_pw_aff get_at(int index) const; + inline union_pw_aff_list reverse() const; inline int size() const; typedef isl_union_pw_aff_list* isl_ptr_t; }; // declarations for isl::union_pw_multi_aff -inline isl::union_pw_multi_aff manage(__isl_take isl_union_pw_multi_aff *ptr); -inline isl::union_pw_multi_aff manage_copy(__isl_keep isl_union_pw_multi_aff *ptr); +inline union_pw_multi_aff manage(__isl_take isl_union_pw_multi_aff *ptr); +inline union_pw_multi_aff manage_copy(__isl_keep isl_union_pw_multi_aff *ptr); class union_pw_multi_aff { - friend inline isl::union_pw_multi_aff manage(__isl_take isl_union_pw_multi_aff *ptr); - friend inline isl::union_pw_multi_aff manage_copy(__isl_keep isl_union_pw_multi_aff *ptr); + friend inline union_pw_multi_aff manage(__isl_take isl_union_pw_multi_aff *ptr); + friend inline union_pw_multi_aff manage_copy(__isl_keep isl_union_pw_multi_aff *ptr); protected: isl_union_pw_multi_aff *ptr = nullptr; @@ -3209,12 +3288,12 @@ class union_pw_multi_aff { public: inline /* implicit */ union_pw_multi_aff(); - inline /* implicit */ union_pw_multi_aff(const isl::union_pw_multi_aff &obj); - inline /* implicit */ union_pw_multi_aff(isl::pw_multi_aff pma); - inline explicit union_pw_multi_aff(isl::union_set domain, isl::multi_val mv); - inline explicit union_pw_multi_aff(isl::ctx ctx, const std::string &str); - inline /* implicit */ union_pw_multi_aff(isl::union_pw_aff upa); - inline isl::union_pw_multi_aff &operator=(isl::union_pw_multi_aff obj); + inline /* implicit */ union_pw_multi_aff(const union_pw_multi_aff &obj); + inline /* implicit */ union_pw_multi_aff(pw_multi_aff pma); + inline explicit union_pw_multi_aff(union_set domain, multi_val mv); + inline explicit union_pw_multi_aff(ctx ctx, const std::string &str); + inline /* implicit */ union_pw_multi_aff(union_pw_aff upa); + inline union_pw_multi_aff &operator=(union_pw_multi_aff obj); inline ~union_pw_multi_aff(); inline __isl_give isl_union_pw_multi_aff *copy() const &; inline __isl_give isl_union_pw_multi_aff *copy() && = delete; @@ -3222,33 +3301,33 @@ class union_pw_multi_aff { inline __isl_give isl_union_pw_multi_aff *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::union_pw_multi_aff add(isl::union_pw_multi_aff upma2) const; - inline isl::union_set domain() const; - inline isl::pw_multi_aff extract_pw_multi_aff(isl::space space) const; - inline isl::union_pw_multi_aff flat_range_product(isl::union_pw_multi_aff upma2) const; - inline void foreach_pw_multi_aff(const std::function &fn) const; - static inline isl::union_pw_multi_aff from(isl::union_map umap); - static inline isl::union_pw_multi_aff from_multi_union_pw_aff(isl::multi_union_pw_aff mupa); - inline isl::space get_space() const; - inline isl::union_pw_aff get_union_pw_aff(int pos) const; + inline union_pw_multi_aff add(union_pw_multi_aff upma2) const; + inline union_set domain() const; + inline pw_multi_aff extract_pw_multi_aff(space space) const; + inline union_pw_multi_aff flat_range_product(union_pw_multi_aff upma2) const; + inline void foreach_pw_multi_aff(const std::function &fn) const; + static inline union_pw_multi_aff from(union_map umap); + static inline union_pw_multi_aff from_multi_union_pw_aff(multi_union_pw_aff mupa); + inline space get_space() const; + inline union_pw_aff get_union_pw_aff(int pos) const; inline int n_pw_multi_aff() const; - inline isl::union_pw_multi_aff pullback(isl::union_pw_multi_aff upma2) const; - inline isl::union_pw_multi_aff scale(isl::val val) const; - inline isl::union_pw_multi_aff scale_down(isl::val val) const; - inline isl::union_pw_multi_aff union_add(isl::union_pw_multi_aff upma2) const; + inline union_pw_multi_aff pullback(union_pw_multi_aff upma2) const; + inline union_pw_multi_aff scale(val val) const; + inline union_pw_multi_aff scale_down(val val) const; + inline union_pw_multi_aff union_add(union_pw_multi_aff upma2) const; typedef isl_union_pw_multi_aff* isl_ptr_t; }; // declarations for isl::union_set -inline isl::union_set manage(__isl_take isl_union_set *ptr); -inline isl::union_set manage_copy(__isl_keep isl_union_set *ptr); +inline union_set manage(__isl_take isl_union_set *ptr); +inline union_set manage_copy(__isl_keep isl_union_set *ptr); class union_set { - friend inline isl::union_set manage(__isl_take isl_union_set *ptr); - friend inline isl::union_set manage_copy(__isl_keep isl_union_set *ptr); + friend inline union_set manage(__isl_take isl_union_set *ptr); + friend inline union_set manage_copy(__isl_keep isl_union_set *ptr); protected: isl_union_set *ptr = nullptr; @@ -3257,12 +3336,12 @@ class union_set { public: inline /* implicit */ union_set(); - inline /* implicit */ union_set(const isl::union_set &obj); - inline /* implicit */ union_set(isl::basic_set bset); - inline /* implicit */ union_set(isl::set set); - inline /* implicit */ union_set(isl::point pnt); - inline explicit union_set(isl::ctx ctx, const std::string &str); - inline isl::union_set &operator=(isl::union_set obj); + inline /* implicit */ union_set(const union_set &obj); + inline /* implicit */ union_set(basic_set bset); + inline /* implicit */ union_set(set set); + inline /* implicit */ union_set(point pnt); + inline explicit union_set(ctx ctx, const std::string &str); + inline union_set &operator=(union_set obj); inline ~union_set(); inline __isl_give isl_union_set *copy() const &; inline __isl_give isl_union_set *copy() && = delete; @@ -3270,58 +3349,58 @@ class union_set { inline __isl_give isl_union_set *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::union_set add_set(isl::set set) const; - inline isl::union_set affine_hull() const; - inline isl::union_set apply(isl::union_map umap) const; - inline isl::union_set coalesce() const; - inline isl::union_set compute_divs() const; - inline isl::union_set detect_equalities() const; - static inline isl::union_set empty(isl::space space); - inline bool every_set(const std::function &test) const; - inline isl::set extract_set(isl::space dim) const; - inline void foreach_point(const std::function &fn) const; - inline void foreach_set(const std::function &fn) const; - inline isl::set_list get_set_list() const; - inline isl::space get_space() const; - inline isl::union_set gist(isl::union_set context) const; - inline isl::union_set gist_params(isl::set set) const; - inline isl::union_map identity() const; - inline isl::union_set intersect(isl::union_set uset2) const; - inline isl::union_set intersect_params(isl::set set) const; - inline bool involves_param(const isl::id &id) const; - inline bool is_disjoint(const isl::union_set &uset2) const; + inline union_set add_set(set set) const; + inline union_set affine_hull() const; + inline union_set apply(union_map umap) const; + inline union_set coalesce() const; + inline union_set compute_divs() const; + inline union_set detect_equalities() const; + static inline union_set empty(space space); + inline bool every_set(const std::function &test) const; + inline set extract_set(space dim) const; + inline void foreach_point(const std::function &fn) const; + inline void foreach_set(const std::function &fn) const; + inline set_list get_set_list() const; + inline space get_space() const; + inline union_set gist(union_set context) const; + inline union_set gist_params(set set) const; + inline union_map identity() const; + inline union_set intersect(union_set uset2) const; + inline union_set intersect_params(set set) const; + inline bool involves_param(const id &id) const; + inline bool is_disjoint(const union_set &uset2) const; inline bool is_empty() const; - inline bool is_equal(const isl::union_set &uset2) const; + inline bool is_equal(const union_set &uset2) const; inline bool is_params() const; - inline bool is_strict_subset(const isl::union_set &uset2) const; - inline bool is_subset(const isl::union_set &uset2) const; - inline isl::union_set lexmax() const; - inline isl::union_set lexmin() const; + inline bool is_strict_subset(const union_set &uset2) const; + inline bool is_subset(const union_set &uset2) const; + inline union_set lexmax() const; + inline union_set lexmin() const; inline int n_set() const; - inline isl::set params() const; - inline isl::union_set polyhedral_hull() const; - inline isl::union_set preimage(isl::multi_aff ma) const; - inline isl::union_set preimage(isl::pw_multi_aff pma) const; - inline isl::union_set preimage(isl::union_pw_multi_aff upma) const; - inline isl::point sample_point() const; - inline isl::union_set subtract(isl::union_set uset2) const; - inline isl::union_set unite(isl::union_set uset2) const; - inline isl::union_set universe() const; - inline isl::union_map unwrap() const; - inline isl::union_map wrapped_domain_map() const; + inline set params() const; + inline union_set polyhedral_hull() const; + inline union_set preimage(multi_aff ma) const; + inline union_set preimage(pw_multi_aff pma) const; + inline union_set preimage(union_pw_multi_aff upma) const; + inline point sample_point() const; + inline union_set subtract(union_set uset2) const; + inline union_set unite(union_set uset2) const; + inline union_set universe() const; + inline union_map unwrap() const; + inline union_map wrapped_domain_map() const; typedef isl_union_set* isl_ptr_t; }; // declarations for isl::union_set_list -inline isl::union_set_list manage(__isl_take isl_union_set_list *ptr); -inline isl::union_set_list manage_copy(__isl_keep isl_union_set_list *ptr); +inline union_set_list manage(__isl_take isl_union_set_list *ptr); +inline union_set_list manage_copy(__isl_keep isl_union_set_list *ptr); class union_set_list { - friend inline isl::union_set_list manage(__isl_take isl_union_set_list *ptr); - friend inline isl::union_set_list manage_copy(__isl_keep isl_union_set_list *ptr); + friend inline union_set_list manage(__isl_take isl_union_set_list *ptr); + friend inline union_set_list manage_copy(__isl_keep isl_union_set_list *ptr); protected: isl_union_set_list *ptr = nullptr; @@ -3330,10 +3409,10 @@ class union_set_list { public: inline /* implicit */ union_set_list(); - inline /* implicit */ union_set_list(const isl::union_set_list &obj); - inline explicit union_set_list(isl::union_set el); - inline explicit union_set_list(isl::ctx ctx, int n); - inline isl::union_set_list &operator=(isl::union_set_list obj); + inline /* implicit */ union_set_list(const union_set_list &obj); + inline explicit union_set_list(union_set el); + inline explicit union_set_list(ctx ctx, int n); + inline union_set_list &operator=(union_set_list obj); inline ~union_set_list(); inline __isl_give isl_union_set_list *copy() const &; inline __isl_give isl_union_set_list *copy() && = delete; @@ -3341,25 +3420,25 @@ class union_set_list { inline __isl_give isl_union_set_list *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; - - inline isl::union_set_list add(isl::union_set el) const; - inline isl::union_set_list concat(isl::union_set_list list2) const; - inline isl::union_set_list drop(unsigned int first, unsigned int n) const; - inline void foreach(const std::function &fn) const; - inline isl::union_set get_at(int index) const; - inline isl::union_set_list reverse() const; + inline ctx get_ctx() const; + + inline union_set_list add(union_set el) const; + inline union_set_list concat(union_set_list list2) const; + inline union_set_list drop(unsigned int first, unsigned int n) const; + inline void foreach(const std::function &fn) const; + inline union_set get_at(int index) const; + inline union_set_list reverse() const; inline int size() const; typedef isl_union_set_list* isl_ptr_t; }; // declarations for isl::val -inline isl::val manage(__isl_take isl_val *ptr); -inline isl::val manage_copy(__isl_keep isl_val *ptr); +inline val manage(__isl_take isl_val *ptr); +inline val manage_copy(__isl_keep isl_val *ptr); class val { - friend inline isl::val manage(__isl_take isl_val *ptr); - friend inline isl::val manage_copy(__isl_keep isl_val *ptr); + friend inline val manage(__isl_take isl_val *ptr); + friend inline val manage_copy(__isl_keep isl_val *ptr); protected: isl_val *ptr = nullptr; @@ -3368,10 +3447,10 @@ class val { public: inline /* implicit */ val(); - inline /* implicit */ val(const isl::val &obj); - inline explicit val(isl::ctx ctx, const std::string &str); - inline explicit val(isl::ctx ctx, long i); - inline isl::val &operator=(isl::val obj); + inline /* implicit */ val(const val &obj); + inline explicit val(ctx ctx, const std::string &str); + inline explicit val(ctx ctx, long i); + inline val &operator=(val obj); inline ~val(); inline __isl_give isl_val *copy() const &; inline __isl_give isl_val *copy() && = delete; @@ -3379,25 +3458,25 @@ class val { inline __isl_give isl_val *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::val abs() const; - inline bool abs_eq(const isl::val &v2) const; - inline isl::val add(isl::val v2) const; - inline isl::val ceil() const; + inline val abs() const; + inline bool abs_eq(const val &v2) const; + inline val add(val v2) const; + inline val ceil() const; inline int cmp_si(long i) const; - inline isl::val div(isl::val v2) const; - inline bool eq(const isl::val &v2) const; - inline isl::val floor() const; - inline isl::val gcd(isl::val v2) const; - inline bool ge(const isl::val &v2) const; + inline val div(val v2) const; + inline bool eq(const val &v2) const; + inline val floor() const; + inline val gcd(val v2) const; + inline bool ge(const val &v2) const; inline long get_den_si() const; inline long get_num_si() const; - inline bool gt(const isl::val &v2) const; - static inline isl::val infty(isl::ctx ctx); - inline isl::val inv() const; - inline bool is_divisible_by(const isl::val &v2) const; + inline bool gt(const val &v2) const; + static inline val infty(ctx ctx); + inline val inv() const; + inline bool is_divisible_by(const val &v2) const; inline bool is_infty() const; inline bool is_int() const; inline bool is_nan() const; @@ -3410,32 +3489,32 @@ class val { inline bool is_pos() const; inline bool is_rat() const; inline bool is_zero() const; - inline bool le(const isl::val &v2) const; - inline bool lt(const isl::val &v2) const; - inline isl::val max(isl::val v2) const; - inline isl::val min(isl::val v2) const; - inline isl::val mod(isl::val v2) const; - inline isl::val mul(isl::val v2) const; - static inline isl::val nan(isl::ctx ctx); - inline bool ne(const isl::val &v2) const; - inline isl::val neg() const; - static inline isl::val neginfty(isl::ctx ctx); - static inline isl::val negone(isl::ctx ctx); - static inline isl::val one(isl::ctx ctx); + inline bool le(const val &v2) const; + inline bool lt(const val &v2) const; + inline val max(val v2) const; + inline val min(val v2) const; + inline val mod(val v2) const; + inline val mul(val v2) const; + static inline val nan(ctx ctx); + inline bool ne(const val &v2) const; + inline val neg() const; + static inline val neginfty(ctx ctx); + static inline val negone(ctx ctx); + static inline val one(ctx ctx); inline int sgn() const; - inline isl::val sub(isl::val v2) const; - inline isl::val trunc() const; - static inline isl::val zero(isl::ctx ctx); + inline val sub(val v2) const; + inline val trunc() const; + static inline val zero(ctx ctx); typedef isl_val* isl_ptr_t; }; // declarations for isl::val_list -inline isl::val_list manage(__isl_take isl_val_list *ptr); -inline isl::val_list manage_copy(__isl_keep isl_val_list *ptr); +inline val_list manage(__isl_take isl_val_list *ptr); +inline val_list manage_copy(__isl_keep isl_val_list *ptr); class val_list { - friend inline isl::val_list manage(__isl_take isl_val_list *ptr); - friend inline isl::val_list manage_copy(__isl_keep isl_val_list *ptr); + friend inline val_list manage(__isl_take isl_val_list *ptr); + friend inline val_list manage_copy(__isl_keep isl_val_list *ptr); protected: isl_val_list *ptr = nullptr; @@ -3444,10 +3523,10 @@ class val_list { public: inline /* implicit */ val_list(); - inline /* implicit */ val_list(const isl::val_list &obj); - inline explicit val_list(isl::val el); - inline explicit val_list(isl::ctx ctx, int n); - inline isl::val_list &operator=(isl::val_list obj); + inline /* implicit */ val_list(const val_list &obj); + inline explicit val_list(val el); + inline explicit val_list(ctx ctx, int n); + inline val_list &operator=(val_list obj); inline ~val_list(); inline __isl_give isl_val_list *copy() const &; inline __isl_give isl_val_list *copy() && = delete; @@ -3455,83 +3534,85 @@ class val_list { inline __isl_give isl_val_list *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; - - inline isl::val_list add(isl::val el) const; - inline isl::val_list concat(isl::val_list list2) const; - inline isl::val_list drop(unsigned int first, unsigned int n) const; - inline void foreach(const std::function &fn) const; - inline isl::val get_at(int index) const; - inline isl::val_list reverse() const; + inline ctx get_ctx() const; + + inline val_list add(val el) const; + inline val_list concat(val_list list2) const; + inline val_list drop(unsigned int first, unsigned int n) const; + inline void foreach(const std::function &fn) const; + inline val get_at(int index) const; + inline val_list reverse() const; inline int size() const; typedef isl_val_list* isl_ptr_t; }; // implementations for isl::aff -isl::aff manage(__isl_take isl_aff *ptr) { +aff manage(__isl_take isl_aff *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return aff(ptr); } -isl::aff manage_copy(__isl_keep isl_aff *ptr) { +aff manage_copy(__isl_keep isl_aff *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_aff_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_aff_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return aff(ptr); } aff::aff() : ptr(nullptr) {} -aff::aff(const isl::aff &obj) - : ptr(obj.copy()) +aff::aff(const aff &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_aff_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_aff_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } aff::aff(__isl_take isl_aff *ptr) : ptr(ptr) {} -aff::aff(isl::local_space ls) +aff::aff(local_space ls) { if (ls.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = ls.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_zero_on_domain(ls.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -aff::aff(isl::local_space ls, isl::val val) +aff::aff(local_space ls, val val) { if (ls.is_null() || val.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = ls.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_val_on_domain(ls.release(), val.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -aff::aff(isl::ctx ctx, const std::string &str) +aff::aff(ctx ctx, const std::string &str) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_read_from_str(ctx.release(), str.c_str()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -aff &aff::operator=(isl::aff obj) { +aff &aff::operator=(aff obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -3579,461 +3660,462 @@ std::string aff::to_str() const { } -isl::ctx aff::get_ctx() const { - return isl::ctx(isl_aff_get_ctx(ptr)); +ctx aff::get_ctx() const { + return ctx(isl_aff_get_ctx(ptr)); } -isl::aff aff::add(isl::aff aff2) const +aff aff::add(aff aff2) const { if (!ptr || aff2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_add(copy(), aff2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::aff aff::add_constant(isl::val v) const +aff aff::add_constant(val v) const { if (!ptr || v.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_add_constant_val(copy(), v.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::aff aff::add_constant_si(int v) const +aff aff::add_constant_si(int v) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_add_constant_si(copy(), v); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::aff aff::ceil() const +aff aff::ceil() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_ceil(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::aff aff::div(isl::aff aff2) const +aff aff::div(aff aff2) const { if (!ptr || aff2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_div(copy(), aff2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set aff::eq_set(isl::aff aff2) const +set aff::eq_set(aff aff2) const { if (!ptr || aff2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_eq_set(copy(), aff2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::val aff::eval(isl::point pnt) const +val aff::eval(point pnt) const { if (!ptr || pnt.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_eval(copy(), pnt.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::aff aff::floor() const +aff aff::floor() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_floor(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set aff::ge_set(isl::aff aff2) const +set aff::ge_set(aff aff2) const { if (!ptr || aff2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_ge_set(copy(), aff2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::val aff::get_constant_val() const +val aff::get_constant_val() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_get_constant_val(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::val aff::get_denominator_val() const +val aff::get_denominator_val() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_get_denominator_val(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::aff aff::get_div(int pos) const +aff aff::get_div(int pos) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_get_div(get(), pos); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::local_space aff::get_local_space() const +local_space aff::get_local_space() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_get_local_space(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space aff::get_space() const +space aff::get_space() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_get_space(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set aff::gt_set(isl::aff aff2) const +set aff::gt_set(aff aff2) const { if (!ptr || aff2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_gt_set(copy(), aff2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set aff::le_set(isl::aff aff2) const +set aff::le_set(aff aff2) const { if (!ptr || aff2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_le_set(copy(), aff2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set aff::lt_set(isl::aff aff2) const +set aff::lt_set(aff aff2) const { if (!ptr || aff2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_lt_set(copy(), aff2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::aff aff::mod(isl::val mod) const +aff aff::mod(val mod) const { if (!ptr || mod.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_mod_val(copy(), mod.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::aff aff::mul(isl::aff aff2) const +aff aff::mul(aff aff2) const { if (!ptr || aff2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_mul(copy(), aff2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set aff::ne_set(isl::aff aff2) const +set aff::ne_set(aff aff2) const { if (!ptr || aff2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_ne_set(copy(), aff2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::aff aff::neg() const +aff aff::neg() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_neg(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::aff aff::param_on_domain_space(isl::space space, isl::id id) +aff aff::param_on_domain_space(space space, id id) { if (space.is_null() || id.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_param_on_domain_space_id(space.release(), id.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -bool aff::plain_is_equal(const isl::aff &aff2) const +bool aff::plain_is_equal(const aff &aff2) const { if (!ptr || aff2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_plain_is_equal(get(), aff2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -isl::aff aff::project_domain_on_params() const +aff aff::project_domain_on_params() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_project_domain_on_params(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::aff aff::pullback(isl::multi_aff ma) const +aff aff::pullback(multi_aff ma) const { if (!ptr || ma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_pullback_multi_aff(copy(), ma.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::aff aff::scale(isl::val v) const +aff aff::scale(val v) const { if (!ptr || v.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_scale_val(copy(), v.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::aff aff::scale_down(isl::val v) const +aff aff::scale_down(val v) const { if (!ptr || v.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_scale_down_val(copy(), v.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::aff aff::scale_down_ui(unsigned int f) const +aff aff::scale_down_ui(unsigned int f) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_scale_down_ui(copy(), f); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::aff aff::set_constant_si(int v) const +aff aff::set_constant_si(int v) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_set_constant_si(copy(), v); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::aff aff::set_constant_val(isl::val v) const +aff aff::set_constant_val(val v) const { if (!ptr || v.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_set_constant_val(copy(), v.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::aff aff::sub(isl::aff aff2) const +aff aff::sub(aff aff2) const { if (!ptr || aff2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_sub(copy(), aff2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::aff aff::unbind_params_insert_domain(isl::multi_id domain) const +aff aff::unbind_params_insert_domain(multi_id domain) const { if (!ptr || domain.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_unbind_params_insert_domain(copy(), domain.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::aff aff::zero_on_domain(isl::space space) +aff aff::zero_on_domain(space space) { if (space.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_zero_on_domain_space(space.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } // implementations for isl::aff_list -isl::aff_list manage(__isl_take isl_aff_list *ptr) { +aff_list manage(__isl_take isl_aff_list *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return aff_list(ptr); } -isl::aff_list manage_copy(__isl_keep isl_aff_list *ptr) { +aff_list manage_copy(__isl_keep isl_aff_list *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_aff_list_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_aff_list_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return aff_list(ptr); } aff_list::aff_list() : ptr(nullptr) {} -aff_list::aff_list(const isl::aff_list &obj) - : ptr(obj.copy()) +aff_list::aff_list(const aff_list &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_aff_list_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_aff_list_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } aff_list::aff_list(__isl_take isl_aff_list *ptr) : ptr(ptr) {} -aff_list::aff_list(isl::aff el) +aff_list::aff_list(aff el) { if (el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = el.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_list_from_aff(el.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -aff_list::aff_list(isl::ctx ctx, int n) +aff_list::aff_list(ctx ctx, int n) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_list_alloc(ctx.release(), n); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -aff_list &aff_list::operator=(isl::aff_list obj) { +aff_list &aff_list::operator=(aff_list obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -4067,62 +4149,62 @@ aff_list::operator bool() const -isl::ctx aff_list::get_ctx() const { - return isl::ctx(isl_aff_list_get_ctx(ptr)); +ctx aff_list::get_ctx() const { + return ctx(isl_aff_list_get_ctx(ptr)); } -isl::aff_list aff_list::add(isl::aff el) const +aff_list aff_list::add(aff el) const { if (!ptr || el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_list_add(copy(), el.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::aff_list aff_list::concat(isl::aff_list list2) const +aff_list aff_list::concat(aff_list list2) const { if (!ptr || list2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_list_concat(copy(), list2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::aff_list aff_list::drop(unsigned int first, unsigned int n) const +aff_list aff_list::drop(unsigned int first, unsigned int n) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_list_drop(copy(), first, n); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -void aff_list::foreach(const std::function &fn) const +void aff_list::foreach(const std::function &fn) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); struct fn_data { - std::function func; + std::function func; std::exception_ptr eptr; } fn_data = { fn }; auto fn_lambda = [](isl_aff *arg_0, void *arg_1) -> isl_stat { auto *data = static_cast(arg_1); - try { - (data->func)(isl::manage(arg_0)); + ISL_CPP_TRY { + (data->func)(manage(arg_0)); return isl_stat_ok; - } catch (...) { + } ISL_CPP_CATCH_ALL { data->eptr = std::current_exception(); return isl_stat_error; } @@ -4131,86 +4213,90 @@ void aff_list::foreach(const std::function &fn) const if (fn_data.eptr) std::rethrow_exception(fn_data.eptr); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return void(res); } -isl::aff aff_list::get_at(int index) const +aff aff_list::get_at(int index) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_list_get_at(get(), index); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::aff_list aff_list::reverse() const +aff_list aff_list::reverse() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_list_reverse(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } int aff_list::size() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_list_size(get()); return res; } // implementations for isl::ast_build -isl::ast_build manage(__isl_take isl_ast_build *ptr) { +ast_build manage(__isl_take isl_ast_build *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return ast_build(ptr); } -isl::ast_build manage_copy(__isl_keep isl_ast_build *ptr) { +ast_build manage_copy(__isl_keep isl_ast_build *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_ast_build_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_ast_build_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return ast_build(ptr); } ast_build::ast_build() : ptr(nullptr) {} -ast_build::ast_build(const isl::ast_build &obj) - : ptr(obj.copy()) +ast_build::ast_build(const ast_build &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_ast_build_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); copy_callbacks(obj); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_ast_build_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } ast_build::ast_build(__isl_take isl_ast_build *ptr) : ptr(ptr) {} -ast_build::ast_build(isl::ctx ctx) +ast_build::ast_build(ctx ctx) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_build_alloc(ctx.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -ast_build &ast_build::operator=(isl::ast_build obj) { +ast_build &ast_build::operator=(ast_build obj) { std::swap(this->ptr, obj.ptr); copy_callbacks(obj); return *this; @@ -4231,8 +4317,7 @@ __isl_keep isl_ast_build *ast_build::get() const { __isl_give isl_ast_build *ast_build::release() { if (at_each_domain_data) - throw isl::exception::create(isl_error_invalid, - "cannot release object with persistent callbacks", __FILE__, __LINE__); + exception::throw_invalid("cannot release object with persistent callbacks", __FILE__, __LINE__); isl_ast_build *tmp = ptr; ptr = nullptr; return tmp; @@ -4248,11 +4333,11 @@ ast_build::operator bool() const -isl::ctx ast_build::get_ctx() const { - return isl::ctx(isl_ast_build_get_ctx(ptr)); +ctx ast_build::get_ctx() const { + return ctx(isl_ast_build_get_ctx(ptr)); } -ast_build &ast_build::copy_callbacks(const isl::ast_build &obj) +ast_build &ast_build::copy_callbacks(const ast_build &obj) { at_each_domain_data = obj.at_each_domain_data; return *this; @@ -4261,41 +4346,41 @@ ast_build &ast_build::copy_callbacks(const isl::ast_build &obj) isl_ast_node *ast_build::at_each_domain(isl_ast_node *arg_0, isl_ast_build *arg_1, void *arg_2) { auto *data = static_cast(arg_2); - try { - auto ret = (data->func)(isl::manage(arg_0), isl::manage_copy(arg_1)); + ISL_CPP_TRY { + auto ret = (data->func)(manage(arg_0), manage_copy(arg_1)); return ret.release(); - } catch (...) { + } ISL_CPP_CATCH_ALL { data->eptr = std::current_exception(); return NULL; } } -void ast_build::set_at_each_domain_data(const std::function &fn) +void ast_build::set_at_each_domain_data(const std::function &fn) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_ast_build_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); at_each_domain_data = std::make_shared(); at_each_domain_data->func = fn; ptr = isl_ast_build_set_at_each_domain(ptr, &at_each_domain, at_each_domain_data.get()); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); } -isl::ast_build ast_build::set_at_each_domain(const std::function &fn) const +ast_build ast_build::set_at_each_domain(const std::function &fn) const { auto copy = *this; copy.set_at_each_domain_data(fn); return copy; } -isl::ast_expr ast_build::access_from(isl::pw_multi_aff pma) const +ast_expr ast_build::access_from(pw_multi_aff pma) const { if (!ptr || pma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_build_access_from_pw_multi_aff(get(), pma.release()); if (at_each_domain_data && at_each_domain_data->eptr) { std::exception_ptr eptr = at_each_domain_data->eptr; @@ -4303,16 +4388,16 @@ isl::ast_expr ast_build::access_from(isl::pw_multi_aff pma) const std::rethrow_exception(eptr); } if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::ast_expr ast_build::access_from(isl::multi_pw_aff mpa) const +ast_expr ast_build::access_from(multi_pw_aff mpa) const { if (!ptr || mpa.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_build_access_from_multi_pw_aff(get(), mpa.release()); if (at_each_domain_data && at_each_domain_data->eptr) { std::exception_ptr eptr = at_each_domain_data->eptr; @@ -4320,16 +4405,16 @@ isl::ast_expr ast_build::access_from(isl::multi_pw_aff mpa) const std::rethrow_exception(eptr); } if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::ast_node ast_build::ast_from_schedule(isl::union_map schedule) const +ast_node ast_build::ast_from_schedule(union_map schedule) const { if (!ptr || schedule.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_build_ast_from_schedule(get(), schedule.release()); if (at_each_domain_data && at_each_domain_data->eptr) { std::exception_ptr eptr = at_each_domain_data->eptr; @@ -4337,16 +4422,16 @@ isl::ast_node ast_build::ast_from_schedule(isl::union_map schedule) const std::rethrow_exception(eptr); } if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::ast_expr ast_build::call_from(isl::pw_multi_aff pma) const +ast_expr ast_build::call_from(pw_multi_aff pma) const { if (!ptr || pma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_build_call_from_pw_multi_aff(get(), pma.release()); if (at_each_domain_data && at_each_domain_data->eptr) { std::exception_ptr eptr = at_each_domain_data->eptr; @@ -4354,16 +4439,16 @@ isl::ast_expr ast_build::call_from(isl::pw_multi_aff pma) const std::rethrow_exception(eptr); } if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::ast_expr ast_build::call_from(isl::multi_pw_aff mpa) const +ast_expr ast_build::call_from(multi_pw_aff mpa) const { if (!ptr || mpa.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_build_call_from_multi_pw_aff(get(), mpa.release()); if (at_each_domain_data && at_each_domain_data->eptr) { std::exception_ptr eptr = at_each_domain_data->eptr; @@ -4371,16 +4456,16 @@ isl::ast_expr ast_build::call_from(isl::multi_pw_aff mpa) const std::rethrow_exception(eptr); } if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::ast_expr ast_build::expr_from(isl::set set) const +ast_expr ast_build::expr_from(set set) const { if (!ptr || set.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_build_expr_from_set(get(), set.release()); if (at_each_domain_data && at_each_domain_data->eptr) { std::exception_ptr eptr = at_each_domain_data->eptr; @@ -4388,16 +4473,16 @@ isl::ast_expr ast_build::expr_from(isl::set set) const std::rethrow_exception(eptr); } if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::ast_expr ast_build::expr_from(isl::pw_aff pa) const +ast_expr ast_build::expr_from(pw_aff pa) const { if (!ptr || pa.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_build_expr_from_pw_aff(get(), pa.release()); if (at_each_domain_data && at_each_domain_data->eptr) { std::exception_ptr eptr = at_each_domain_data->eptr; @@ -4405,29 +4490,28 @@ isl::ast_expr ast_build::expr_from(isl::pw_aff pa) const std::rethrow_exception(eptr); } if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::ast_build ast_build::from_context(isl::set set) +ast_build ast_build::from_context(set set) { if (set.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = set.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_build_from_context(set.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map ast_build::get_schedule() const +union_map ast_build::get_schedule() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_build_get_schedule(get()); if (at_each_domain_data && at_each_domain_data->eptr) { std::exception_ptr eptr = at_each_domain_data->eptr; @@ -4435,16 +4519,16 @@ isl::union_map ast_build::get_schedule() const std::rethrow_exception(eptr); } if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space ast_build::get_schedule_space() const +space ast_build::get_schedule_space() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_build_get_schedule_space(get()); if (at_each_domain_data && at_each_domain_data->eptr) { std::exception_ptr eptr = at_each_domain_data->eptr; @@ -4452,16 +4536,16 @@ isl::space ast_build::get_schedule_space() const std::rethrow_exception(eptr); } if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::ast_node ast_build::node_from(isl::schedule schedule) const +ast_node ast_build::node_from(schedule schedule) const { if (!ptr || schedule.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_build_node_from_schedule(get(), schedule.release()); if (at_each_domain_data && at_each_domain_data->eptr) { std::exception_ptr eptr = at_each_domain_data->eptr; @@ -4469,16 +4553,16 @@ isl::ast_node ast_build::node_from(isl::schedule schedule) const std::rethrow_exception(eptr); } if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::ast_node ast_build::node_from_schedule_map(isl::union_map schedule) const +ast_node ast_build::node_from_schedule_map(union_map schedule) const { if (!ptr || schedule.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_build_node_from_schedule_map(get(), schedule.release()); if (at_each_domain_data && at_each_domain_data->eptr) { std::exception_ptr eptr = at_each_domain_data->eptr; @@ -4486,16 +4570,16 @@ isl::ast_node ast_build::node_from_schedule_map(isl::union_map schedule) const std::rethrow_exception(eptr); } if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::ast_build ast_build::set_iterators(isl::id_list iterators) const +ast_build ast_build::set_iterators(id_list iterators) const { if (!ptr || iterators.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_build_set_iterators(copy(), iterators.release()); if (at_each_domain_data && at_each_domain_data->eptr) { std::exception_ptr eptr = at_each_domain_data->eptr; @@ -4503,43 +4587,47 @@ isl::ast_build ast_build::set_iterators(isl::id_list iterators) const std::rethrow_exception(eptr); } if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res).copy_callbacks(*this); } // implementations for isl::ast_expr -isl::ast_expr manage(__isl_take isl_ast_expr *ptr) { +ast_expr manage(__isl_take isl_ast_expr *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return ast_expr(ptr); } -isl::ast_expr manage_copy(__isl_keep isl_ast_expr *ptr) { +ast_expr manage_copy(__isl_keep isl_ast_expr *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_ast_expr_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_ast_expr_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return ast_expr(ptr); } ast_expr::ast_expr() : ptr(nullptr) {} -ast_expr::ast_expr(const isl::ast_expr &obj) - : ptr(obj.copy()) +ast_expr::ast_expr(const ast_expr &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_ast_expr_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_ast_expr_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } ast_expr::ast_expr(__isl_take isl_ast_expr *ptr) : ptr(ptr) {} -ast_expr &ast_expr::operator=(isl::ast_expr obj) { +ast_expr &ast_expr::operator=(ast_expr obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -4595,8 +4683,7 @@ template bool ast_expr::isa() { if (is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return isl_ast_expr_get_type(get()) == T::type; } template @@ -4605,40 +4692,40 @@ T ast_expr::as() return isa() ? T(copy()) : T(); } -isl::ctx ast_expr::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_expr::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } -bool ast_expr::is_equal(const isl::ast_expr &expr2) const +bool ast_expr::is_equal(const ast_expr &expr2) const { if (!ptr || expr2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_expr_is_equal(get(), expr2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -isl::ast_expr ast_expr::set_op_arg(int pos, isl::ast_expr arg) const +ast_expr ast_expr::set_op_arg(int pos, ast_expr arg) const { if (!ptr || arg.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_expr_set_op_arg(copy(), pos, arg.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } std::string ast_expr::to_C_str() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_expr_to_C_str(get()); std::string tmp(res); free(res); @@ -4650,7 +4737,7 @@ std::string ast_expr::to_C_str() const ast_expr_id::ast_expr_id() : ast_expr() {} -ast_expr_id::ast_expr_id(const isl::ast_expr_id &obj) +ast_expr_id::ast_expr_id(const ast_expr_id &obj) : ast_expr(obj) { } @@ -4659,7 +4746,7 @@ ast_expr_id::ast_expr_id(__isl_take isl_ast_expr *ptr) : ast_expr(ptr) {} -ast_expr_id &ast_expr_id::operator=(isl::ast_expr_id obj) { +ast_expr_id &ast_expr_id::operator=(ast_expr_id obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -4686,19 +4773,19 @@ std::string ast_expr_id::to_str() const { } -isl::ctx ast_expr_id::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_expr_id::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } -isl::id ast_expr_id::get_id() const +id ast_expr_id::get_id() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_expr_id_get_id(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } @@ -4707,7 +4794,7 @@ isl::id ast_expr_id::get_id() const ast_expr_int::ast_expr_int() : ast_expr() {} -ast_expr_int::ast_expr_int(const isl::ast_expr_int &obj) +ast_expr_int::ast_expr_int(const ast_expr_int &obj) : ast_expr(obj) { } @@ -4716,7 +4803,7 @@ ast_expr_int::ast_expr_int(__isl_take isl_ast_expr *ptr) : ast_expr(ptr) {} -ast_expr_int &ast_expr_int::operator=(isl::ast_expr_int obj) { +ast_expr_int &ast_expr_int::operator=(ast_expr_int obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -4743,19 +4830,19 @@ std::string ast_expr_int::to_str() const { } -isl::ctx ast_expr_int::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_expr_int::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } -isl::val ast_expr_int::get_val() const +val ast_expr_int::get_val() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_expr_int_get_val(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } @@ -4764,7 +4851,7 @@ isl::val ast_expr_int::get_val() const ast_expr_op::ast_expr_op() : ast_expr() {} -ast_expr_op::ast_expr_op(const isl::ast_expr_op &obj) +ast_expr_op::ast_expr_op(const ast_expr_op &obj) : ast_expr(obj) { } @@ -4773,7 +4860,7 @@ ast_expr_op::ast_expr_op(__isl_take isl_ast_expr *ptr) : ast_expr(ptr) {} -ast_expr_op &ast_expr_op::operator=(isl::ast_expr_op obj) { +ast_expr_op &ast_expr_op::operator=(ast_expr_op obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -4804,8 +4891,7 @@ template bool ast_expr_op::isa() { if (is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return isl_ast_expr_op_get_type(get()) == T::type; } template @@ -4814,65 +4900,69 @@ T ast_expr_op::as() return isa() ? T(copy()) : T(); } -isl::ctx ast_expr_op::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_expr_op::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } -isl::ast_expr ast_expr_op::get_arg(int pos) const +ast_expr ast_expr_op::get_arg(int pos) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_expr_op_get_arg(get(), pos); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } int ast_expr_op::get_n_arg() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_expr_op_get_n_arg(get()); return res; } // implementations for isl::ast_node -isl::ast_node manage(__isl_take isl_ast_node *ptr) { +ast_node manage(__isl_take isl_ast_node *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return ast_node(ptr); } -isl::ast_node manage_copy(__isl_keep isl_ast_node *ptr) { +ast_node manage_copy(__isl_keep isl_ast_node *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_ast_node_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_ast_node_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return ast_node(ptr); } ast_node::ast_node() : ptr(nullptr) {} -ast_node::ast_node(const isl::ast_node &obj) - : ptr(obj.copy()) +ast_node::ast_node(const ast_node &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_ast_node_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_ast_node_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } ast_node::ast_node(__isl_take isl_ast_node *ptr) : ptr(ptr) {} -ast_node &ast_node::operator=(isl::ast_node obj) { +ast_node &ast_node::operator=(ast_node obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -4924,8 +5014,7 @@ template bool ast_node::isa() { if (is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return isl_ast_node_get_type(get()) == T::type; } template @@ -4934,40 +5023,40 @@ T ast_node::as() return isa() ? T(copy()) : T(); } -isl::ctx ast_node::get_ctx() const { - return isl::ctx(isl_ast_node_get_ctx(ptr)); +ctx ast_node::get_ctx() const { + return ctx(isl_ast_node_get_ctx(ptr)); } -isl::id ast_node::get_annotation() const +id ast_node::get_annotation() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_get_annotation(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::ast_node ast_node::set_annotation(isl::id annotation) const +ast_node ast_node::set_annotation(id annotation) const { if (!ptr || annotation.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_set_annotation(copy(), annotation.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } std::string ast_node::to_C_str() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_to_C_str(get()); std::string tmp(res); free(res); @@ -4979,7 +5068,7 @@ std::string ast_node::to_C_str() const ast_node_block::ast_node_block() : ast_node() {} -ast_node_block::ast_node_block(const isl::ast_node_block &obj) +ast_node_block::ast_node_block(const ast_node_block &obj) : ast_node(obj) { } @@ -4988,7 +5077,7 @@ ast_node_block::ast_node_block(__isl_take isl_ast_node *ptr) : ast_node(ptr) {} -ast_node_block &ast_node_block::operator=(isl::ast_node_block obj) { +ast_node_block &ast_node_block::operator=(ast_node_block obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -5011,19 +5100,19 @@ std::string ast_node_block::to_str() const { } -isl::ctx ast_node_block::get_ctx() const { - return isl::ctx(isl_ast_node_get_ctx(ptr)); +ctx ast_node_block::get_ctx() const { + return ctx(isl_ast_node_get_ctx(ptr)); } -isl::ast_node_list ast_node_block::get_children() const +ast_node_list ast_node_block::get_children() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_block_get_children(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } @@ -5032,7 +5121,7 @@ isl::ast_node_list ast_node_block::get_children() const ast_node_for::ast_node_for() : ast_node() {} -ast_node_for::ast_node_for(const isl::ast_node_for &obj) +ast_node_for::ast_node_for(const ast_node_for &obj) : ast_node(obj) { } @@ -5041,7 +5130,7 @@ ast_node_for::ast_node_for(__isl_take isl_ast_node *ptr) : ast_node(ptr) {} -ast_node_for &ast_node_for::operator=(isl::ast_node_for obj) { +ast_node_for &ast_node_for::operator=(ast_node_for obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -5064,91 +5153,91 @@ std::string ast_node_for::to_str() const { } -isl::ctx ast_node_for::get_ctx() const { - return isl::ctx(isl_ast_node_get_ctx(ptr)); +ctx ast_node_for::get_ctx() const { + return ctx(isl_ast_node_get_ctx(ptr)); } -isl::ast_node ast_node_for::get_body() const +ast_node ast_node_for::get_body() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_for_get_body(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::ast_expr ast_node_for::get_cond() const +ast_expr ast_node_for::get_cond() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_for_get_cond(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::ast_expr ast_node_for::get_inc() const +ast_expr ast_node_for::get_inc() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_for_get_inc(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::ast_expr ast_node_for::get_init() const +ast_expr ast_node_for::get_init() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_for_get_init(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::ast_expr ast_node_for::get_iterator() const +ast_expr ast_node_for::get_iterator() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_for_get_iterator(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } bool ast_node_for::is_coincident() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_for_is_coincident(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } bool ast_node_for::is_degenerate() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_for_is_degenerate(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } @@ -5157,7 +5246,7 @@ bool ast_node_for::is_degenerate() const ast_node_if::ast_node_if() : ast_node() {} -ast_node_if::ast_node_if(const isl::ast_node_if &obj) +ast_node_if::ast_node_if(const ast_node_if &obj) : ast_node(obj) { } @@ -5166,7 +5255,7 @@ ast_node_if::ast_node_if(__isl_take isl_ast_node *ptr) : ast_node(ptr) {} -ast_node_if &ast_node_if::operator=(isl::ast_node_if obj) { +ast_node_if &ast_node_if::operator=(ast_node_if obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -5189,111 +5278,114 @@ std::string ast_node_if::to_str() const { } -isl::ctx ast_node_if::get_ctx() const { - return isl::ctx(isl_ast_node_get_ctx(ptr)); +ctx ast_node_if::get_ctx() const { + return ctx(isl_ast_node_get_ctx(ptr)); } -isl::ast_expr ast_node_if::get_cond() const +ast_expr ast_node_if::get_cond() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_if_get_cond(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::ast_node ast_node_if::get_else() const +ast_node ast_node_if::get_else() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_if_get_else(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::ast_node ast_node_if::get_then() const +ast_node ast_node_if::get_then() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_if_get_then(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } bool ast_node_if::has_else() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_if_has_else(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } // implementations for isl::ast_node_list -isl::ast_node_list manage(__isl_take isl_ast_node_list *ptr) { +ast_node_list manage(__isl_take isl_ast_node_list *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return ast_node_list(ptr); } -isl::ast_node_list manage_copy(__isl_keep isl_ast_node_list *ptr) { +ast_node_list manage_copy(__isl_keep isl_ast_node_list *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_ast_node_list_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_ast_node_list_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return ast_node_list(ptr); } ast_node_list::ast_node_list() : ptr(nullptr) {} -ast_node_list::ast_node_list(const isl::ast_node_list &obj) - : ptr(obj.copy()) +ast_node_list::ast_node_list(const ast_node_list &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_ast_node_list_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_ast_node_list_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } ast_node_list::ast_node_list(__isl_take isl_ast_node_list *ptr) : ptr(ptr) {} -ast_node_list::ast_node_list(isl::ast_node el) +ast_node_list::ast_node_list(ast_node el) { if (el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = el.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_list_from_ast_node(el.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -ast_node_list::ast_node_list(isl::ctx ctx, int n) +ast_node_list::ast_node_list(ctx ctx, int n) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_list_alloc(ctx.release(), n); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -ast_node_list &ast_node_list::operator=(isl::ast_node_list obj) { +ast_node_list &ast_node_list::operator=(ast_node_list obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -5327,62 +5419,62 @@ ast_node_list::operator bool() const -isl::ctx ast_node_list::get_ctx() const { - return isl::ctx(isl_ast_node_list_get_ctx(ptr)); +ctx ast_node_list::get_ctx() const { + return ctx(isl_ast_node_list_get_ctx(ptr)); } -isl::ast_node_list ast_node_list::add(isl::ast_node el) const +ast_node_list ast_node_list::add(ast_node el) const { if (!ptr || el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_list_add(copy(), el.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::ast_node_list ast_node_list::concat(isl::ast_node_list list2) const +ast_node_list ast_node_list::concat(ast_node_list list2) const { if (!ptr || list2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_list_concat(copy(), list2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::ast_node_list ast_node_list::drop(unsigned int first, unsigned int n) const +ast_node_list ast_node_list::drop(unsigned int first, unsigned int n) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_list_drop(copy(), first, n); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -void ast_node_list::foreach(const std::function &fn) const +void ast_node_list::foreach(const std::function &fn) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); struct fn_data { - std::function func; + std::function func; std::exception_ptr eptr; } fn_data = { fn }; auto fn_lambda = [](isl_ast_node *arg_0, void *arg_1) -> isl_stat { auto *data = static_cast(arg_1); - try { - (data->func)(isl::manage(arg_0)); + ISL_CPP_TRY { + (data->func)(manage(arg_0)); return isl_stat_ok; - } catch (...) { + } ISL_CPP_CATCH_ALL { data->eptr = std::current_exception(); return isl_stat_error; } @@ -5391,40 +5483,40 @@ void ast_node_list::foreach(const std::function &fn) const if (fn_data.eptr) std::rethrow_exception(fn_data.eptr); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return void(res); } -isl::ast_node ast_node_list::get_at(int index) const +ast_node ast_node_list::get_at(int index) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_list_get_at(get(), index); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::ast_node_list ast_node_list::reverse() const +ast_node_list ast_node_list::reverse() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_list_reverse(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } int ast_node_list::size() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_list_size(get()); return res; } @@ -5434,7 +5526,7 @@ int ast_node_list::size() const ast_node_mark::ast_node_mark() : ast_node() {} -ast_node_mark::ast_node_mark(const isl::ast_node_mark &obj) +ast_node_mark::ast_node_mark(const ast_node_mark &obj) : ast_node(obj) { } @@ -5443,7 +5535,7 @@ ast_node_mark::ast_node_mark(__isl_take isl_ast_node *ptr) : ast_node(ptr) {} -ast_node_mark &ast_node_mark::operator=(isl::ast_node_mark obj) { +ast_node_mark &ast_node_mark::operator=(ast_node_mark obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -5466,31 +5558,31 @@ std::string ast_node_mark::to_str() const { } -isl::ctx ast_node_mark::get_ctx() const { - return isl::ctx(isl_ast_node_get_ctx(ptr)); +ctx ast_node_mark::get_ctx() const { + return ctx(isl_ast_node_get_ctx(ptr)); } -isl::id ast_node_mark::get_id() const +id ast_node_mark::get_id() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_mark_get_id(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::ast_node ast_node_mark::get_node() const +ast_node ast_node_mark::get_node() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_mark_get_node(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } @@ -5499,7 +5591,7 @@ isl::ast_node ast_node_mark::get_node() const ast_node_user::ast_node_user() : ast_node() {} -ast_node_user::ast_node_user(const isl::ast_node_user &obj) +ast_node_user::ast_node_user(const ast_node_user &obj) : ast_node(obj) { } @@ -5508,7 +5600,7 @@ ast_node_user::ast_node_user(__isl_take isl_ast_node *ptr) : ast_node(ptr) {} -ast_node_user &ast_node_user::operator=(isl::ast_node_user obj) { +ast_node_user &ast_node_user::operator=(ast_node_user obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -5531,19 +5623,19 @@ std::string ast_node_user::to_str() const { } -isl::ctx ast_node_user::get_ctx() const { - return isl::ctx(isl_ast_node_get_ctx(ptr)); +ctx ast_node_user::get_ctx() const { + return ctx(isl_ast_node_get_ctx(ptr)); } -isl::ast_expr ast_node_user::get_expr() const +ast_expr ast_node_user::get_expr() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_user_get_expr(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } @@ -5552,7 +5644,7 @@ isl::ast_expr ast_node_user::get_expr() const ast_op_access::ast_op_access() : ast_expr_op() {} -ast_op_access::ast_op_access(const isl::ast_op_access &obj) +ast_op_access::ast_op_access(const ast_op_access &obj) : ast_expr_op(obj) { } @@ -5561,7 +5653,7 @@ ast_op_access::ast_op_access(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_access &ast_op_access::operator=(isl::ast_op_access obj) { +ast_op_access &ast_op_access::operator=(ast_op_access obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -5588,8 +5680,8 @@ std::string ast_op_access::to_str() const { } -isl::ctx ast_op_access::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_access::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } @@ -5598,7 +5690,7 @@ isl::ctx ast_op_access::get_ctx() const { ast_op_add::ast_op_add() : ast_expr_op() {} -ast_op_add::ast_op_add(const isl::ast_op_add &obj) +ast_op_add::ast_op_add(const ast_op_add &obj) : ast_expr_op(obj) { } @@ -5607,7 +5699,7 @@ ast_op_add::ast_op_add(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_add &ast_op_add::operator=(isl::ast_op_add obj) { +ast_op_add &ast_op_add::operator=(ast_op_add obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -5634,8 +5726,8 @@ std::string ast_op_add::to_str() const { } -isl::ctx ast_op_add::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_add::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } @@ -5644,7 +5736,7 @@ isl::ctx ast_op_add::get_ctx() const { ast_op_address_of::ast_op_address_of() : ast_expr_op() {} -ast_op_address_of::ast_op_address_of(const isl::ast_op_address_of &obj) +ast_op_address_of::ast_op_address_of(const ast_op_address_of &obj) : ast_expr_op(obj) { } @@ -5653,7 +5745,7 @@ ast_op_address_of::ast_op_address_of(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_address_of &ast_op_address_of::operator=(isl::ast_op_address_of obj) { +ast_op_address_of &ast_op_address_of::operator=(ast_op_address_of obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -5680,8 +5772,8 @@ std::string ast_op_address_of::to_str() const { } -isl::ctx ast_op_address_of::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_address_of::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } @@ -5690,7 +5782,7 @@ isl::ctx ast_op_address_of::get_ctx() const { ast_op_and::ast_op_and() : ast_expr_op() {} -ast_op_and::ast_op_and(const isl::ast_op_and &obj) +ast_op_and::ast_op_and(const ast_op_and &obj) : ast_expr_op(obj) { } @@ -5699,7 +5791,7 @@ ast_op_and::ast_op_and(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_and &ast_op_and::operator=(isl::ast_op_and obj) { +ast_op_and &ast_op_and::operator=(ast_op_and obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -5726,8 +5818,8 @@ std::string ast_op_and::to_str() const { } -isl::ctx ast_op_and::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_and::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } @@ -5736,7 +5828,7 @@ isl::ctx ast_op_and::get_ctx() const { ast_op_and_then::ast_op_and_then() : ast_expr_op() {} -ast_op_and_then::ast_op_and_then(const isl::ast_op_and_then &obj) +ast_op_and_then::ast_op_and_then(const ast_op_and_then &obj) : ast_expr_op(obj) { } @@ -5745,7 +5837,7 @@ ast_op_and_then::ast_op_and_then(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_and_then &ast_op_and_then::operator=(isl::ast_op_and_then obj) { +ast_op_and_then &ast_op_and_then::operator=(ast_op_and_then obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -5772,8 +5864,8 @@ std::string ast_op_and_then::to_str() const { } -isl::ctx ast_op_and_then::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_and_then::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } @@ -5782,7 +5874,7 @@ isl::ctx ast_op_and_then::get_ctx() const { ast_op_call::ast_op_call() : ast_expr_op() {} -ast_op_call::ast_op_call(const isl::ast_op_call &obj) +ast_op_call::ast_op_call(const ast_op_call &obj) : ast_expr_op(obj) { } @@ -5791,7 +5883,7 @@ ast_op_call::ast_op_call(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_call &ast_op_call::operator=(isl::ast_op_call obj) { +ast_op_call &ast_op_call::operator=(ast_op_call obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -5818,8 +5910,8 @@ std::string ast_op_call::to_str() const { } -isl::ctx ast_op_call::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_call::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } @@ -5828,7 +5920,7 @@ isl::ctx ast_op_call::get_ctx() const { ast_op_cond::ast_op_cond() : ast_expr_op() {} -ast_op_cond::ast_op_cond(const isl::ast_op_cond &obj) +ast_op_cond::ast_op_cond(const ast_op_cond &obj) : ast_expr_op(obj) { } @@ -5837,7 +5929,7 @@ ast_op_cond::ast_op_cond(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_cond &ast_op_cond::operator=(isl::ast_op_cond obj) { +ast_op_cond &ast_op_cond::operator=(ast_op_cond obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -5864,8 +5956,8 @@ std::string ast_op_cond::to_str() const { } -isl::ctx ast_op_cond::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_cond::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } @@ -5874,7 +5966,7 @@ isl::ctx ast_op_cond::get_ctx() const { ast_op_div::ast_op_div() : ast_expr_op() {} -ast_op_div::ast_op_div(const isl::ast_op_div &obj) +ast_op_div::ast_op_div(const ast_op_div &obj) : ast_expr_op(obj) { } @@ -5883,7 +5975,7 @@ ast_op_div::ast_op_div(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_div &ast_op_div::operator=(isl::ast_op_div obj) { +ast_op_div &ast_op_div::operator=(ast_op_div obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -5910,8 +6002,8 @@ std::string ast_op_div::to_str() const { } -isl::ctx ast_op_div::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_div::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } @@ -5920,7 +6012,7 @@ isl::ctx ast_op_div::get_ctx() const { ast_op_eq::ast_op_eq() : ast_expr_op() {} -ast_op_eq::ast_op_eq(const isl::ast_op_eq &obj) +ast_op_eq::ast_op_eq(const ast_op_eq &obj) : ast_expr_op(obj) { } @@ -5929,7 +6021,7 @@ ast_op_eq::ast_op_eq(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_eq &ast_op_eq::operator=(isl::ast_op_eq obj) { +ast_op_eq &ast_op_eq::operator=(ast_op_eq obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -5956,8 +6048,8 @@ std::string ast_op_eq::to_str() const { } -isl::ctx ast_op_eq::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_eq::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } @@ -5966,7 +6058,7 @@ isl::ctx ast_op_eq::get_ctx() const { ast_op_fdiv_q::ast_op_fdiv_q() : ast_expr_op() {} -ast_op_fdiv_q::ast_op_fdiv_q(const isl::ast_op_fdiv_q &obj) +ast_op_fdiv_q::ast_op_fdiv_q(const ast_op_fdiv_q &obj) : ast_expr_op(obj) { } @@ -5975,7 +6067,7 @@ ast_op_fdiv_q::ast_op_fdiv_q(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_fdiv_q &ast_op_fdiv_q::operator=(isl::ast_op_fdiv_q obj) { +ast_op_fdiv_q &ast_op_fdiv_q::operator=(ast_op_fdiv_q obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -6002,8 +6094,8 @@ std::string ast_op_fdiv_q::to_str() const { } -isl::ctx ast_op_fdiv_q::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_fdiv_q::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } @@ -6012,7 +6104,7 @@ isl::ctx ast_op_fdiv_q::get_ctx() const { ast_op_ge::ast_op_ge() : ast_expr_op() {} -ast_op_ge::ast_op_ge(const isl::ast_op_ge &obj) +ast_op_ge::ast_op_ge(const ast_op_ge &obj) : ast_expr_op(obj) { } @@ -6021,7 +6113,7 @@ ast_op_ge::ast_op_ge(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_ge &ast_op_ge::operator=(isl::ast_op_ge obj) { +ast_op_ge &ast_op_ge::operator=(ast_op_ge obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -6048,8 +6140,8 @@ std::string ast_op_ge::to_str() const { } -isl::ctx ast_op_ge::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_ge::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } @@ -6058,7 +6150,7 @@ isl::ctx ast_op_ge::get_ctx() const { ast_op_gt::ast_op_gt() : ast_expr_op() {} -ast_op_gt::ast_op_gt(const isl::ast_op_gt &obj) +ast_op_gt::ast_op_gt(const ast_op_gt &obj) : ast_expr_op(obj) { } @@ -6067,7 +6159,7 @@ ast_op_gt::ast_op_gt(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_gt &ast_op_gt::operator=(isl::ast_op_gt obj) { +ast_op_gt &ast_op_gt::operator=(ast_op_gt obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -6094,8 +6186,8 @@ std::string ast_op_gt::to_str() const { } -isl::ctx ast_op_gt::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_gt::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } @@ -6104,7 +6196,7 @@ isl::ctx ast_op_gt::get_ctx() const { ast_op_le::ast_op_le() : ast_expr_op() {} -ast_op_le::ast_op_le(const isl::ast_op_le &obj) +ast_op_le::ast_op_le(const ast_op_le &obj) : ast_expr_op(obj) { } @@ -6113,7 +6205,7 @@ ast_op_le::ast_op_le(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_le &ast_op_le::operator=(isl::ast_op_le obj) { +ast_op_le &ast_op_le::operator=(ast_op_le obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -6140,8 +6232,8 @@ std::string ast_op_le::to_str() const { } -isl::ctx ast_op_le::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_le::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } @@ -6150,7 +6242,7 @@ isl::ctx ast_op_le::get_ctx() const { ast_op_lt::ast_op_lt() : ast_expr_op() {} -ast_op_lt::ast_op_lt(const isl::ast_op_lt &obj) +ast_op_lt::ast_op_lt(const ast_op_lt &obj) : ast_expr_op(obj) { } @@ -6159,7 +6251,7 @@ ast_op_lt::ast_op_lt(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_lt &ast_op_lt::operator=(isl::ast_op_lt obj) { +ast_op_lt &ast_op_lt::operator=(ast_op_lt obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -6186,8 +6278,8 @@ std::string ast_op_lt::to_str() const { } -isl::ctx ast_op_lt::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_lt::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } @@ -6196,7 +6288,7 @@ isl::ctx ast_op_lt::get_ctx() const { ast_op_max::ast_op_max() : ast_expr_op() {} -ast_op_max::ast_op_max(const isl::ast_op_max &obj) +ast_op_max::ast_op_max(const ast_op_max &obj) : ast_expr_op(obj) { } @@ -6205,7 +6297,7 @@ ast_op_max::ast_op_max(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_max &ast_op_max::operator=(isl::ast_op_max obj) { +ast_op_max &ast_op_max::operator=(ast_op_max obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -6232,8 +6324,8 @@ std::string ast_op_max::to_str() const { } -isl::ctx ast_op_max::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_max::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } @@ -6242,7 +6334,7 @@ isl::ctx ast_op_max::get_ctx() const { ast_op_member::ast_op_member() : ast_expr_op() {} -ast_op_member::ast_op_member(const isl::ast_op_member &obj) +ast_op_member::ast_op_member(const ast_op_member &obj) : ast_expr_op(obj) { } @@ -6251,7 +6343,7 @@ ast_op_member::ast_op_member(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_member &ast_op_member::operator=(isl::ast_op_member obj) { +ast_op_member &ast_op_member::operator=(ast_op_member obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -6278,8 +6370,8 @@ std::string ast_op_member::to_str() const { } -isl::ctx ast_op_member::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_member::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } @@ -6288,7 +6380,7 @@ isl::ctx ast_op_member::get_ctx() const { ast_op_min::ast_op_min() : ast_expr_op() {} -ast_op_min::ast_op_min(const isl::ast_op_min &obj) +ast_op_min::ast_op_min(const ast_op_min &obj) : ast_expr_op(obj) { } @@ -6297,7 +6389,7 @@ ast_op_min::ast_op_min(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_min &ast_op_min::operator=(isl::ast_op_min obj) { +ast_op_min &ast_op_min::operator=(ast_op_min obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -6324,8 +6416,8 @@ std::string ast_op_min::to_str() const { } -isl::ctx ast_op_min::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_min::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } @@ -6334,7 +6426,7 @@ isl::ctx ast_op_min::get_ctx() const { ast_op_minus::ast_op_minus() : ast_expr_op() {} -ast_op_minus::ast_op_minus(const isl::ast_op_minus &obj) +ast_op_minus::ast_op_minus(const ast_op_minus &obj) : ast_expr_op(obj) { } @@ -6343,7 +6435,7 @@ ast_op_minus::ast_op_minus(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_minus &ast_op_minus::operator=(isl::ast_op_minus obj) { +ast_op_minus &ast_op_minus::operator=(ast_op_minus obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -6370,8 +6462,8 @@ std::string ast_op_minus::to_str() const { } -isl::ctx ast_op_minus::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_minus::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } @@ -6380,7 +6472,7 @@ isl::ctx ast_op_minus::get_ctx() const { ast_op_mul::ast_op_mul() : ast_expr_op() {} -ast_op_mul::ast_op_mul(const isl::ast_op_mul &obj) +ast_op_mul::ast_op_mul(const ast_op_mul &obj) : ast_expr_op(obj) { } @@ -6389,7 +6481,7 @@ ast_op_mul::ast_op_mul(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_mul &ast_op_mul::operator=(isl::ast_op_mul obj) { +ast_op_mul &ast_op_mul::operator=(ast_op_mul obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -6416,8 +6508,8 @@ std::string ast_op_mul::to_str() const { } -isl::ctx ast_op_mul::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_mul::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } @@ -6426,7 +6518,7 @@ isl::ctx ast_op_mul::get_ctx() const { ast_op_or::ast_op_or() : ast_expr_op() {} -ast_op_or::ast_op_or(const isl::ast_op_or &obj) +ast_op_or::ast_op_or(const ast_op_or &obj) : ast_expr_op(obj) { } @@ -6435,7 +6527,7 @@ ast_op_or::ast_op_or(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_or &ast_op_or::operator=(isl::ast_op_or obj) { +ast_op_or &ast_op_or::operator=(ast_op_or obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -6462,8 +6554,8 @@ std::string ast_op_or::to_str() const { } -isl::ctx ast_op_or::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_or::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } @@ -6472,7 +6564,7 @@ isl::ctx ast_op_or::get_ctx() const { ast_op_or_else::ast_op_or_else() : ast_expr_op() {} -ast_op_or_else::ast_op_or_else(const isl::ast_op_or_else &obj) +ast_op_or_else::ast_op_or_else(const ast_op_or_else &obj) : ast_expr_op(obj) { } @@ -6481,7 +6573,7 @@ ast_op_or_else::ast_op_or_else(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_or_else &ast_op_or_else::operator=(isl::ast_op_or_else obj) { +ast_op_or_else &ast_op_or_else::operator=(ast_op_or_else obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -6508,8 +6600,8 @@ std::string ast_op_or_else::to_str() const { } -isl::ctx ast_op_or_else::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_or_else::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } @@ -6518,7 +6610,7 @@ isl::ctx ast_op_or_else::get_ctx() const { ast_op_pdiv_q::ast_op_pdiv_q() : ast_expr_op() {} -ast_op_pdiv_q::ast_op_pdiv_q(const isl::ast_op_pdiv_q &obj) +ast_op_pdiv_q::ast_op_pdiv_q(const ast_op_pdiv_q &obj) : ast_expr_op(obj) { } @@ -6527,7 +6619,7 @@ ast_op_pdiv_q::ast_op_pdiv_q(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_pdiv_q &ast_op_pdiv_q::operator=(isl::ast_op_pdiv_q obj) { +ast_op_pdiv_q &ast_op_pdiv_q::operator=(ast_op_pdiv_q obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -6554,8 +6646,8 @@ std::string ast_op_pdiv_q::to_str() const { } -isl::ctx ast_op_pdiv_q::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_pdiv_q::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } @@ -6564,7 +6656,7 @@ isl::ctx ast_op_pdiv_q::get_ctx() const { ast_op_pdiv_r::ast_op_pdiv_r() : ast_expr_op() {} -ast_op_pdiv_r::ast_op_pdiv_r(const isl::ast_op_pdiv_r &obj) +ast_op_pdiv_r::ast_op_pdiv_r(const ast_op_pdiv_r &obj) : ast_expr_op(obj) { } @@ -6573,7 +6665,7 @@ ast_op_pdiv_r::ast_op_pdiv_r(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_pdiv_r &ast_op_pdiv_r::operator=(isl::ast_op_pdiv_r obj) { +ast_op_pdiv_r &ast_op_pdiv_r::operator=(ast_op_pdiv_r obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -6600,8 +6692,8 @@ std::string ast_op_pdiv_r::to_str() const { } -isl::ctx ast_op_pdiv_r::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_pdiv_r::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } @@ -6610,7 +6702,7 @@ isl::ctx ast_op_pdiv_r::get_ctx() const { ast_op_select::ast_op_select() : ast_expr_op() {} -ast_op_select::ast_op_select(const isl::ast_op_select &obj) +ast_op_select::ast_op_select(const ast_op_select &obj) : ast_expr_op(obj) { } @@ -6619,7 +6711,7 @@ ast_op_select::ast_op_select(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_select &ast_op_select::operator=(isl::ast_op_select obj) { +ast_op_select &ast_op_select::operator=(ast_op_select obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -6646,8 +6738,8 @@ std::string ast_op_select::to_str() const { } -isl::ctx ast_op_select::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_select::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } @@ -6656,7 +6748,7 @@ isl::ctx ast_op_select::get_ctx() const { ast_op_sub::ast_op_sub() : ast_expr_op() {} -ast_op_sub::ast_op_sub(const isl::ast_op_sub &obj) +ast_op_sub::ast_op_sub(const ast_op_sub &obj) : ast_expr_op(obj) { } @@ -6665,7 +6757,7 @@ ast_op_sub::ast_op_sub(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_sub &ast_op_sub::operator=(isl::ast_op_sub obj) { +ast_op_sub &ast_op_sub::operator=(ast_op_sub obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -6692,8 +6784,8 @@ std::string ast_op_sub::to_str() const { } -isl::ctx ast_op_sub::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_sub::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } @@ -6702,7 +6794,7 @@ isl::ctx ast_op_sub::get_ctx() const { ast_op_zdiv_r::ast_op_zdiv_r() : ast_expr_op() {} -ast_op_zdiv_r::ast_op_zdiv_r(const isl::ast_op_zdiv_r &obj) +ast_op_zdiv_r::ast_op_zdiv_r(const ast_op_zdiv_r &obj) : ast_expr_op(obj) { } @@ -6711,7 +6803,7 @@ ast_op_zdiv_r::ast_op_zdiv_r(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_zdiv_r &ast_op_zdiv_r::operator=(isl::ast_op_zdiv_r obj) { +ast_op_zdiv_r &ast_op_zdiv_r::operator=(ast_op_zdiv_r obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -6738,88 +6830,89 @@ std::string ast_op_zdiv_r::to_str() const { } -isl::ctx ast_op_zdiv_r::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_zdiv_r::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } // implementations for isl::basic_map -isl::basic_map manage(__isl_take isl_basic_map *ptr) { +basic_map manage(__isl_take isl_basic_map *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return basic_map(ptr); } -isl::basic_map manage_copy(__isl_keep isl_basic_map *ptr) { +basic_map manage_copy(__isl_keep isl_basic_map *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_basic_map_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_basic_map_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return basic_map(ptr); } basic_map::basic_map() : ptr(nullptr) {} -basic_map::basic_map(const isl::basic_map &obj) - : ptr(obj.copy()) +basic_map::basic_map(const basic_map &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_basic_map_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_basic_map_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } basic_map::basic_map(__isl_take isl_basic_map *ptr) : ptr(ptr) {} -basic_map::basic_map(isl::ctx ctx, const std::string &str) +basic_map::basic_map(ctx ctx, const std::string &str) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_read_from_str(ctx.release(), str.c_str()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -basic_map::basic_map(isl::basic_set domain, isl::basic_set range) +basic_map::basic_map(basic_set domain, basic_set range) { if (domain.is_null() || range.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = domain.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_from_domain_and_range(domain.release(), range.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -basic_map::basic_map(isl::aff aff) +basic_map::basic_map(aff aff) { if (aff.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = aff.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_from_aff(aff.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -basic_map::basic_map(isl::multi_aff maff) +basic_map::basic_map(multi_aff maff) { if (maff.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = maff.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_from_multi_aff(maff.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -basic_map &basic_map::operator=(isl::basic_map obj) { +basic_map &basic_map::operator=(basic_map obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -6871,426 +6964,426 @@ std::string basic_map::to_str() const { } -isl::ctx basic_map::get_ctx() const { - return isl::ctx(isl_basic_map_get_ctx(ptr)); +ctx basic_map::get_ctx() const { + return ctx(isl_basic_map_get_ctx(ptr)); } -isl::basic_map basic_map::affine_hull() const +basic_map basic_map::affine_hull() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_affine_hull(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_map basic_map::apply_domain(isl::basic_map bmap2) const +basic_map basic_map::apply_domain(basic_map bmap2) const { if (!ptr || bmap2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_apply_domain(copy(), bmap2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_map basic_map::apply_range(isl::basic_map bmap2) const +basic_map basic_map::apply_range(basic_map bmap2) const { if (!ptr || bmap2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_apply_range(copy(), bmap2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } bool basic_map::can_curry() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_can_curry(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } bool basic_map::can_uncurry() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_can_uncurry(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -isl::basic_map basic_map::curry() const +basic_map basic_map::curry() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_curry(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_set basic_map::deltas() const +basic_set basic_map::deltas() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_deltas(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_map basic_map::detect_equalities() const +basic_map basic_map::detect_equalities() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_detect_equalities(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_set basic_map::domain() const +basic_set basic_map::domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_map basic_map::empty(isl::space space) +basic_map basic_map::empty(space space) { if (space.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_empty(space.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_map basic_map::flatten() const +basic_map basic_map::flatten() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_flatten(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_map basic_map::flatten_domain() const +basic_map basic_map::flatten_domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_flatten_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_map basic_map::flatten_range() const +basic_map basic_map::flatten_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_flatten_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_map basic_map::from_domain(isl::basic_set bset) +basic_map basic_map::from_domain(basic_set bset) { if (bset.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = bset.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_from_domain(bset.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_map basic_map::from_range(isl::basic_set bset) +basic_map basic_map::from_range(basic_set bset) { if (bset.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = bset.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_from_range(bset.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::space basic_map::get_space() const +space basic_map::get_space() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_get_space(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_map basic_map::gist(isl::basic_map context) const +basic_map basic_map::gist(basic_map context) const { if (!ptr || context.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_gist(copy(), context.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_map basic_map::intersect(isl::basic_map bmap2) const +basic_map basic_map::intersect(basic_map bmap2) const { if (!ptr || bmap2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_intersect(copy(), bmap2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_map basic_map::intersect_domain(isl::basic_set bset) const +basic_map basic_map::intersect_domain(basic_set bset) const { if (!ptr || bset.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_intersect_domain(copy(), bset.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_map basic_map::intersect_range(isl::basic_set bset) const +basic_map basic_map::intersect_range(basic_set bset) const { if (!ptr || bset.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_intersect_range(copy(), bset.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } bool basic_map::is_empty() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_is_empty(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -bool basic_map::is_equal(const isl::basic_map &bmap2) const +bool basic_map::is_equal(const basic_map &bmap2) const { if (!ptr || bmap2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_is_equal(get(), bmap2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -bool basic_map::is_subset(const isl::basic_map &bmap2) const +bool basic_map::is_subset(const basic_map &bmap2) const { if (!ptr || bmap2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_is_subset(get(), bmap2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -isl::map basic_map::lexmax() const +map basic_map::lexmax() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_lexmax(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map basic_map::lexmin() const +map basic_map::lexmin() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_lexmin(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_map basic_map::reverse() const +basic_map basic_map::reverse() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_reverse(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_map basic_map::sample() const +basic_map basic_map::sample() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_sample(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_map basic_map::uncurry() const +basic_map basic_map::uncurry() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_uncurry(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map basic_map::unite(isl::basic_map bmap2) const +map basic_map::unite(basic_map bmap2) const { if (!ptr || bmap2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_union(copy(), bmap2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_set basic_map::wrap() const +basic_set basic_map::wrap() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_wrap(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } // implementations for isl::basic_map_list -isl::basic_map_list manage(__isl_take isl_basic_map_list *ptr) { +basic_map_list manage(__isl_take isl_basic_map_list *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return basic_map_list(ptr); } -isl::basic_map_list manage_copy(__isl_keep isl_basic_map_list *ptr) { +basic_map_list manage_copy(__isl_keep isl_basic_map_list *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_basic_map_list_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_basic_map_list_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return basic_map_list(ptr); } basic_map_list::basic_map_list() : ptr(nullptr) {} -basic_map_list::basic_map_list(const isl::basic_map_list &obj) - : ptr(obj.copy()) +basic_map_list::basic_map_list(const basic_map_list &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_basic_map_list_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_basic_map_list_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } basic_map_list::basic_map_list(__isl_take isl_basic_map_list *ptr) : ptr(ptr) {} -basic_map_list::basic_map_list(isl::basic_map el) +basic_map_list::basic_map_list(basic_map el) { if (el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = el.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_list_from_basic_map(el.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -basic_map_list::basic_map_list(isl::ctx ctx, int n) +basic_map_list::basic_map_list(ctx ctx, int n) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_list_alloc(ctx.release(), n); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -basic_map_list &basic_map_list::operator=(isl::basic_map_list obj) { +basic_map_list &basic_map_list::operator=(basic_map_list obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -7324,62 +7417,62 @@ basic_map_list::operator bool() const -isl::ctx basic_map_list::get_ctx() const { - return isl::ctx(isl_basic_map_list_get_ctx(ptr)); +ctx basic_map_list::get_ctx() const { + return ctx(isl_basic_map_list_get_ctx(ptr)); } -isl::basic_map_list basic_map_list::add(isl::basic_map el) const +basic_map_list basic_map_list::add(basic_map el) const { if (!ptr || el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_list_add(copy(), el.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_map_list basic_map_list::concat(isl::basic_map_list list2) const +basic_map_list basic_map_list::concat(basic_map_list list2) const { if (!ptr || list2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_list_concat(copy(), list2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_map_list basic_map_list::drop(unsigned int first, unsigned int n) const +basic_map_list basic_map_list::drop(unsigned int first, unsigned int n) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_list_drop(copy(), first, n); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -void basic_map_list::foreach(const std::function &fn) const +void basic_map_list::foreach(const std::function &fn) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); struct fn_data { - std::function func; + std::function func; std::exception_ptr eptr; } fn_data = { fn }; auto fn_lambda = [](isl_basic_map *arg_0, void *arg_1) -> isl_stat { auto *data = static_cast(arg_1); - try { - (data->func)(isl::manage(arg_0)); + ISL_CPP_TRY { + (data->func)(manage(arg_0)); return isl_stat_ok; - } catch (...) { + } ISL_CPP_CATCH_ALL { data->eptr = std::current_exception(); return isl_stat_error; } @@ -7388,109 +7481,112 @@ void basic_map_list::foreach(const std::function &fn) cons if (fn_data.eptr) std::rethrow_exception(fn_data.eptr); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return void(res); } -isl::basic_map basic_map_list::get_at(int index) const +basic_map basic_map_list::get_at(int index) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_list_get_at(get(), index); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_map basic_map_list::intersect() const +basic_map basic_map_list::intersect() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_list_intersect(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_map_list basic_map_list::reverse() const +basic_map_list basic_map_list::reverse() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_list_reverse(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } int basic_map_list::size() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_list_size(get()); return res; } // implementations for isl::basic_set -isl::basic_set manage(__isl_take isl_basic_set *ptr) { +basic_set manage(__isl_take isl_basic_set *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return basic_set(ptr); } -isl::basic_set manage_copy(__isl_keep isl_basic_set *ptr) { +basic_set manage_copy(__isl_keep isl_basic_set *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_basic_set_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_basic_set_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return basic_set(ptr); } basic_set::basic_set() : ptr(nullptr) {} -basic_set::basic_set(const isl::basic_set &obj) - : ptr(obj.copy()) +basic_set::basic_set(const basic_set &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_basic_set_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_basic_set_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } basic_set::basic_set(__isl_take isl_basic_set *ptr) : ptr(ptr) {} -basic_set::basic_set(isl::point pnt) +basic_set::basic_set(point pnt) { if (pnt.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = pnt.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_from_point(pnt.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -basic_set::basic_set(isl::ctx ctx, const std::string &str) +basic_set::basic_set(ctx ctx, const std::string &str) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_read_from_str(ctx.release(), str.c_str()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -basic_set &basic_set::operator=(isl::basic_set obj) { +basic_set &basic_set::operator=(basic_set obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -7542,244 +7638,244 @@ std::string basic_set::to_str() const { } -isl::ctx basic_set::get_ctx() const { - return isl::ctx(isl_basic_set_get_ctx(ptr)); +ctx basic_set::get_ctx() const { + return ctx(isl_basic_set_get_ctx(ptr)); } -isl::basic_set basic_set::affine_hull() const +basic_set basic_set::affine_hull() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_affine_hull(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_set basic_set::apply(isl::basic_map bmap) const +basic_set basic_set::apply(basic_map bmap) const { if (!ptr || bmap.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_apply(copy(), bmap.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set basic_set::compute_divs() const +set basic_set::compute_divs() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_compute_divs(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_set basic_set::detect_equalities() const +basic_set basic_set::detect_equalities() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_detect_equalities(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::val basic_set::dim_max_val(int pos) const +val basic_set::dim_max_val(int pos) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_dim_max_val(copy(), pos); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_set basic_set::flatten() const +basic_set basic_set::flatten() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_flatten(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_set basic_set::from_params() const +basic_set basic_set::from_params() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_from_params(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space basic_set::get_space() const +space basic_set::get_space() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_get_space(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_set basic_set::gist(isl::basic_set context) const +basic_set basic_set::gist(basic_set context) const { if (!ptr || context.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_gist(copy(), context.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_set basic_set::intersect(isl::basic_set bset2) const +basic_set basic_set::intersect(basic_set bset2) const { if (!ptr || bset2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_intersect(copy(), bset2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_set basic_set::intersect_params(isl::basic_set bset2) const +basic_set basic_set::intersect_params(basic_set bset2) const { if (!ptr || bset2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_intersect_params(copy(), bset2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } bool basic_set::is_empty() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_is_empty(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -bool basic_set::is_equal(const isl::basic_set &bset2) const +bool basic_set::is_equal(const basic_set &bset2) const { if (!ptr || bset2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_is_equal(get(), bset2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -bool basic_set::is_subset(const isl::basic_set &bset2) const +bool basic_set::is_subset(const basic_set &bset2) const { if (!ptr || bset2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_is_subset(get(), bset2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } bool basic_set::is_universe() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_is_universe(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } bool basic_set::is_wrapping() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_is_wrapping(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -isl::set basic_set::lexmax() const +set basic_set::lexmax() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_lexmax(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set basic_set::lexmin() const +set basic_set::lexmin() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_lexmin(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::val basic_set::max_val(const isl::aff &obj) const +val basic_set::max_val(const aff &obj) const { if (!ptr || obj.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_max_val(get(), obj.get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } unsigned int basic_set::n_dim() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_n_dim(get()); return res; } @@ -7787,176 +7883,177 @@ unsigned int basic_set::n_dim() const unsigned int basic_set::n_param() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_n_param(get()); return res; } -isl::basic_set basic_set::nat_universe(isl::space dim) +basic_set basic_set::nat_universe(space dim) { if (dim.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = dim.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_nat_universe(dim.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_set basic_set::params() const +basic_set basic_set::params() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_params(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } bool basic_set::plain_is_universe() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_plain_is_universe(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -isl::basic_set basic_set::sample() const +basic_set basic_set::sample() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_sample(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::point basic_set::sample_point() const +point basic_set::sample_point() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_sample_point(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_set basic_set::set_tuple_id(isl::id id) const +basic_set basic_set::set_tuple_id(id id) const { if (!ptr || id.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_set_tuple_id(copy(), id.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set basic_set::unite(isl::basic_set bset2) const +set basic_set::unite(basic_set bset2) const { if (!ptr || bset2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_union(copy(), bset2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_set basic_set::universe(isl::space space) +basic_set basic_set::universe(space space) { if (space.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_universe(space.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_map basic_set::unwrap() const +basic_map basic_set::unwrap() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_unwrap(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } // implementations for isl::basic_set_list -isl::basic_set_list manage(__isl_take isl_basic_set_list *ptr) { +basic_set_list manage(__isl_take isl_basic_set_list *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return basic_set_list(ptr); } -isl::basic_set_list manage_copy(__isl_keep isl_basic_set_list *ptr) { +basic_set_list manage_copy(__isl_keep isl_basic_set_list *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_basic_set_list_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_basic_set_list_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return basic_set_list(ptr); } basic_set_list::basic_set_list() : ptr(nullptr) {} -basic_set_list::basic_set_list(const isl::basic_set_list &obj) - : ptr(obj.copy()) +basic_set_list::basic_set_list(const basic_set_list &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_basic_set_list_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_basic_set_list_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } basic_set_list::basic_set_list(__isl_take isl_basic_set_list *ptr) : ptr(ptr) {} -basic_set_list::basic_set_list(isl::basic_set el) +basic_set_list::basic_set_list(basic_set el) { if (el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = el.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_list_from_basic_set(el.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -basic_set_list::basic_set_list(isl::ctx ctx, int n) +basic_set_list::basic_set_list(ctx ctx, int n) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_list_alloc(ctx.release(), n); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -basic_set_list &basic_set_list::operator=(isl::basic_set_list obj) { +basic_set_list &basic_set_list::operator=(basic_set_list obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -7990,62 +8087,62 @@ basic_set_list::operator bool() const -isl::ctx basic_set_list::get_ctx() const { - return isl::ctx(isl_basic_set_list_get_ctx(ptr)); +ctx basic_set_list::get_ctx() const { + return ctx(isl_basic_set_list_get_ctx(ptr)); } -isl::basic_set_list basic_set_list::add(isl::basic_set el) const +basic_set_list basic_set_list::add(basic_set el) const { if (!ptr || el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_list_add(copy(), el.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_set_list basic_set_list::concat(isl::basic_set_list list2) const +basic_set_list basic_set_list::concat(basic_set_list list2) const { if (!ptr || list2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_list_concat(copy(), list2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_set_list basic_set_list::drop(unsigned int first, unsigned int n) const +basic_set_list basic_set_list::drop(unsigned int first, unsigned int n) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_list_drop(copy(), first, n); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -void basic_set_list::foreach(const std::function &fn) const +void basic_set_list::foreach(const std::function &fn) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); struct fn_data { - std::function func; + std::function func; std::exception_ptr eptr; } fn_data = { fn }; auto fn_lambda = [](isl_basic_set *arg_0, void *arg_1) -> isl_stat { auto *data = static_cast(arg_1); - try { - (data->func)(isl::manage(arg_0)); + ISL_CPP_TRY { + (data->func)(manage(arg_0)); return isl_stat_ok; - } catch (...) { + } ISL_CPP_CATCH_ALL { data->eptr = std::current_exception(); return isl_stat_error; } @@ -8054,77 +8151,81 @@ void basic_set_list::foreach(const std::function &fn) cons if (fn_data.eptr) std::rethrow_exception(fn_data.eptr); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return void(res); } -isl::basic_set basic_set_list::get_at(int index) const +basic_set basic_set_list::get_at(int index) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_list_get_at(get(), index); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_set_list basic_set_list::reverse() const +basic_set_list basic_set_list::reverse() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_list_reverse(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } int basic_set_list::size() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_list_size(get()); return res; } // implementations for isl::fixed_box -isl::fixed_box manage(__isl_take isl_fixed_box *ptr) { +fixed_box manage(__isl_take isl_fixed_box *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return fixed_box(ptr); } -isl::fixed_box manage_copy(__isl_keep isl_fixed_box *ptr) { +fixed_box manage_copy(__isl_keep isl_fixed_box *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_fixed_box_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_fixed_box_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return fixed_box(ptr); } fixed_box::fixed_box() : ptr(nullptr) {} -fixed_box::fixed_box(const isl::fixed_box &obj) - : ptr(obj.copy()) +fixed_box::fixed_box(const fixed_box &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_fixed_box_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_fixed_box_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } fixed_box::fixed_box(__isl_take isl_fixed_box *ptr) : ptr(ptr) {} -fixed_box &fixed_box::operator=(isl::fixed_box obj) { +fixed_box &fixed_box::operator=(fixed_box obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -8158,99 +8259,103 @@ fixed_box::operator bool() const -isl::ctx fixed_box::get_ctx() const { - return isl::ctx(isl_fixed_box_get_ctx(ptr)); +ctx fixed_box::get_ctx() const { + return ctx(isl_fixed_box_get_ctx(ptr)); } -isl::multi_aff fixed_box::get_offset() const +multi_aff fixed_box::get_offset() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_fixed_box_get_offset(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_val fixed_box::get_size() const +multi_val fixed_box::get_size() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_fixed_box_get_size(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space fixed_box::get_space() const +space fixed_box::get_space() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_fixed_box_get_space(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } bool fixed_box::is_valid() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_fixed_box_is_valid(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } // implementations for isl::id -isl::id manage(__isl_take isl_id *ptr) { +id manage(__isl_take isl_id *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return id(ptr); } -isl::id manage_copy(__isl_keep isl_id *ptr) { +id manage_copy(__isl_keep isl_id *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_id_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_id_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return id(ptr); } id::id() : ptr(nullptr) {} -id::id(const isl::id &obj) - : ptr(obj.copy()) +id::id(const id &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_id_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_id_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } id::id(__isl_take isl_id *ptr) : ptr(ptr) {} -id::id(isl::ctx ctx, const std::string &str) +id::id(ctx ctx, const std::string &str) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_id_read_from_str(ctx.release(), str.c_str()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -id &id::operator=(isl::id obj) { +id &id::operator=(id obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -8298,74 +8403,77 @@ std::string id::to_str() const { } -isl::ctx id::get_ctx() const { - return isl::ctx(isl_id_get_ctx(ptr)); +ctx id::get_ctx() const { + return ctx(isl_id_get_ctx(ptr)); } std::string id::get_name() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_id_get_name(get()); std::string tmp(res); return tmp; } // implementations for isl::id_list -isl::id_list manage(__isl_take isl_id_list *ptr) { +id_list manage(__isl_take isl_id_list *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return id_list(ptr); } -isl::id_list manage_copy(__isl_keep isl_id_list *ptr) { +id_list manage_copy(__isl_keep isl_id_list *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_id_list_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_id_list_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return id_list(ptr); } id_list::id_list() : ptr(nullptr) {} -id_list::id_list(const isl::id_list &obj) - : ptr(obj.copy()) +id_list::id_list(const id_list &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_id_list_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_id_list_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } id_list::id_list(__isl_take isl_id_list *ptr) : ptr(ptr) {} -id_list::id_list(isl::id el) +id_list::id_list(id el) { if (el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = el.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_id_list_from_id(el.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -id_list::id_list(isl::ctx ctx, int n) +id_list::id_list(ctx ctx, int n) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_id_list_alloc(ctx.release(), n); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -id_list &id_list::operator=(isl::id_list obj) { +id_list &id_list::operator=(id_list obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -8399,62 +8507,62 @@ id_list::operator bool() const -isl::ctx id_list::get_ctx() const { - return isl::ctx(isl_id_list_get_ctx(ptr)); +ctx id_list::get_ctx() const { + return ctx(isl_id_list_get_ctx(ptr)); } -isl::id_list id_list::add(isl::id el) const +id_list id_list::add(id el) const { if (!ptr || el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_id_list_add(copy(), el.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::id_list id_list::concat(isl::id_list list2) const +id_list id_list::concat(id_list list2) const { if (!ptr || list2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_id_list_concat(copy(), list2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::id_list id_list::drop(unsigned int first, unsigned int n) const +id_list id_list::drop(unsigned int first, unsigned int n) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_id_list_drop(copy(), first, n); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -void id_list::foreach(const std::function &fn) const +void id_list::foreach(const std::function &fn) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); struct fn_data { - std::function func; + std::function func; std::exception_ptr eptr; } fn_data = { fn }; auto fn_lambda = [](isl_id *arg_0, void *arg_1) -> isl_stat { auto *data = static_cast(arg_1); - try { - (data->func)(isl::manage(arg_0)); + ISL_CPP_TRY { + (data->func)(manage(arg_0)); return isl_stat_ok; - } catch (...) { + } ISL_CPP_CATCH_ALL { data->eptr = std::current_exception(); return isl_stat_error; } @@ -8463,89 +8571,92 @@ void id_list::foreach(const std::function &fn) const if (fn_data.eptr) std::rethrow_exception(fn_data.eptr); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return void(res); } -isl::id id_list::get_at(int index) const +id id_list::get_at(int index) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_id_list_get_at(get(), index); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::id_list id_list::reverse() const +id_list id_list::reverse() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_id_list_reverse(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } int id_list::size() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_id_list_size(get()); return res; } // implementations for isl::local_space -isl::local_space manage(__isl_take isl_local_space *ptr) { +local_space manage(__isl_take isl_local_space *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return local_space(ptr); } -isl::local_space manage_copy(__isl_keep isl_local_space *ptr) { +local_space manage_copy(__isl_keep isl_local_space *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_local_space_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_local_space_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return local_space(ptr); } local_space::local_space() : ptr(nullptr) {} -local_space::local_space(const isl::local_space &obj) - : ptr(obj.copy()) +local_space::local_space(const local_space &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_local_space_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_local_space_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } local_space::local_space(__isl_take isl_local_space *ptr) : ptr(ptr) {} -local_space::local_space(isl::space dim) +local_space::local_space(space dim) { if (dim.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = dim.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_local_space_from_space(dim.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -local_space &local_space::operator=(isl::local_space obj) { +local_space &local_space::operator=(local_space obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -8583,255 +8694,255 @@ inline bool operator==(const local_space& C1, const local_space& C2) { -isl::ctx local_space::get_ctx() const { - return isl::ctx(isl_local_space_get_ctx(ptr)); +ctx local_space::get_ctx() const { + return ctx(isl_local_space_get_ctx(ptr)); } -isl::local_space local_space::domain() const +local_space local_space::domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_local_space_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::local_space local_space::flatten_domain() const +local_space local_space::flatten_domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_local_space_flatten_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::local_space local_space::flatten_range() const +local_space local_space::flatten_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_local_space_flatten_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::local_space local_space::from_domain() const +local_space local_space::from_domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_local_space_from_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::aff local_space::get_div(int pos) const +aff local_space::get_div(int pos) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_local_space_get_div(get(), pos); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space local_space::get_space() const +space local_space::get_space() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_local_space_get_space(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::local_space local_space::intersect(isl::local_space ls2) const +local_space local_space::intersect(local_space ls2) const { if (!ptr || ls2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_local_space_intersect(copy(), ls2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -bool local_space::is_equal(const isl::local_space &ls2) const +bool local_space::is_equal(const local_space &ls2) const { if (!ptr || ls2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_local_space_is_equal(get(), ls2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } bool local_space::is_params() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_local_space_is_params(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } bool local_space::is_set() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_local_space_is_set(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -isl::basic_map local_space::lifting() const +basic_map local_space::lifting() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_local_space_lifting(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::local_space local_space::range() const +local_space local_space::range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_local_space_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::local_space local_space::wrap() const +local_space local_space::wrap() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_local_space_wrap(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } // implementations for isl::map -isl::map manage(__isl_take isl_map *ptr) { +map manage(__isl_take isl_map *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return map(ptr); } -isl::map manage_copy(__isl_keep isl_map *ptr) { +map manage_copy(__isl_keep isl_map *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_map_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_map_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return map(ptr); } map::map() : ptr(nullptr) {} -map::map(const isl::map &obj) - : ptr(obj.copy()) +map::map(const map &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_map_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_map_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } map::map(__isl_take isl_map *ptr) : ptr(ptr) {} -map::map(isl::ctx ctx, const std::string &str) +map::map(ctx ctx, const std::string &str) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_read_from_str(ctx.release(), str.c_str()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -map::map(isl::basic_map bmap) +map::map(basic_map bmap) { if (bmap.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = bmap.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_from_basic_map(bmap.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -map::map(isl::set domain, isl::set range) +map::map(set domain, set range) { if (domain.is_null() || range.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = domain.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_from_domain_and_range(domain.release(), range.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -map::map(isl::aff aff) +map::map(aff aff) { if (aff.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = aff.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_from_aff(aff.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -map::map(isl::multi_aff maff) +map::map(multi_aff maff) { if (maff.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = maff.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_from_multi_aff(maff.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -map &map::operator=(isl::map obj) { +map &map::operator=(map obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -8883,279 +8994,278 @@ std::string map::to_str() const { } -isl::ctx map::get_ctx() const { - return isl::ctx(isl_map_get_ctx(ptr)); +ctx map::get_ctx() const { + return ctx(isl_map_get_ctx(ptr)); } -isl::basic_map map::affine_hull() const +basic_map map::affine_hull() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_affine_hull(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::apply_domain(isl::map map2) const +map map::apply_domain(map map2) const { if (!ptr || map2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_apply_domain(copy(), map2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::apply_range(isl::map map2) const +map map::apply_range(map map2) const { if (!ptr || map2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_apply_range(copy(), map2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } bool map::can_curry() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_can_curry(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } bool map::can_range_curry() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_can_range_curry(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } bool map::can_uncurry() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_can_uncurry(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -isl::map map::coalesce() const +map map::coalesce() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_coalesce(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::complement() const +map map::complement() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_complement(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::compute_divs() const +map map::compute_divs() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_compute_divs(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::curry() const +map map::curry() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_curry(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set map::deltas() const +set map::deltas() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_deltas(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::detect_equalities() const +map map::detect_equalities() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_detect_equalities(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set map::domain() const +set map::domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::domain_factor_domain() const +map map::domain_factor_domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_domain_factor_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::domain_factor_range() const +map map::domain_factor_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_domain_factor_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::domain_map() const +map map::domain_map() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_domain_map(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::domain_product(isl::map map2) const +map map::domain_product(map map2) const { if (!ptr || map2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_domain_product(copy(), map2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::empty(isl::space space) +map map::empty(space space) { if (space.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_empty(space.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::flatten() const +map map::flatten() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_flatten(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::flatten_domain() const +map map::flatten_domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_flatten_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::flatten_range() const +map map::flatten_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_flatten_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -void map::foreach_basic_map(const std::function &fn) const +void map::foreach_basic_map(const std::function &fn) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); struct fn_data { - std::function func; + std::function func; std::exception_ptr eptr; } fn_data = { fn }; auto fn_lambda = [](isl_basic_map *arg_0, void *arg_1) -> isl_stat { auto *data = static_cast(arg_1); - try { - (data->func)(isl::manage(arg_0)); + ISL_CPP_TRY { + (data->func)(manage(arg_0)); return isl_stat_ok; - } catch (...) { + } ISL_CPP_CATCH_ALL { data->eptr = std::current_exception(); return isl_stat_error; } @@ -9164,643 +9274,652 @@ void map::foreach_basic_map(const std::function &fn) const if (fn_data.eptr) std::rethrow_exception(fn_data.eptr); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return void(res); } -isl::map map::from(isl::pw_multi_aff pma) +map map::from(pw_multi_aff pma) { if (pma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = pma.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_from_pw_multi_aff(pma.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::from(isl::union_map umap) +map map::from(union_map umap) { if (umap.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = umap.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_from_union_map(umap.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::from_domain(isl::set set) +map map::from_domain(set set) { if (set.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = set.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_from_domain(set.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::from_range(isl::set set) +map map::from_range(set set) { if (set.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = set.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_from_range(set.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_map_list map::get_basic_map_list() const +basic_map_list map::get_basic_map_list() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_get_basic_map_list(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::fixed_box map::get_range_simple_fixed_box_hull() const +fixed_box map::get_range_simple_fixed_box_hull() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_get_range_simple_fixed_box_hull(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::stride_info map::get_range_stride_info(int pos) const +stride_info map::get_range_stride_info(int pos) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_get_range_stride_info(get(), pos); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::id map::get_range_tuple_id() const +id map::get_range_tuple_id() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_get_range_tuple_id(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space map::get_space() const +space map::get_space() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_get_space(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::gist(isl::map context) const +map map::gist(map context) const { if (!ptr || context.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_gist(copy(), context.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::gist_domain(isl::set context) const +map map::gist_domain(set context) const { if (!ptr || context.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_gist_domain(copy(), context.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::identity(isl::space dim) +map map::identity(space dim) { if (dim.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = dim.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_identity(dim.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::intersect(isl::map map2) const +map map::intersect(map map2) const { if (!ptr || map2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_intersect(copy(), map2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::intersect_domain(isl::set set) const +map map::intersect_domain(set set) const { if (!ptr || set.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_intersect_domain(copy(), set.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::intersect_params(isl::set params) const +map map::intersect_params(set params) const { if (!ptr || params.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_intersect_params(copy(), params.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::intersect_range(isl::set set) const +map map::intersect_range(set set) const { if (!ptr || set.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_intersect_range(copy(), set.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } bool map::is_bijective() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_is_bijective(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -bool map::is_disjoint(const isl::map &map2) const +bool map::is_disjoint(const map &map2) const { if (!ptr || map2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_is_disjoint(get(), map2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } bool map::is_empty() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_is_empty(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -bool map::is_equal(const isl::map &map2) const +bool map::is_equal(const map &map2) const { if (!ptr || map2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_is_equal(get(), map2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } bool map::is_injective() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_is_injective(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } bool map::is_single_valued() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_is_single_valued(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -bool map::is_strict_subset(const isl::map &map2) const +bool map::is_strict_subset(const map &map2) const { if (!ptr || map2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_is_strict_subset(get(), map2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -bool map::is_subset(const isl::map &map2) const +bool map::is_subset(const map &map2) const { if (!ptr || map2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_is_subset(get(), map2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -isl::map map::lexmax() const +map map::lexmax() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_lexmax(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::lexmin() const +map map::lexmin() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_lexmin(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } int map::n_basic_map() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_n_basic_map(get()); return res; } -isl::set map::params() const +set map::params() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_params(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_map map::polyhedral_hull() const +basic_map map::polyhedral_hull() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_polyhedral_hull(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::preimage_domain(isl::multi_aff ma) const +map map::preimage_domain(multi_aff ma) const { if (!ptr || ma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_preimage_domain_multi_aff(copy(), ma.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::preimage_range(isl::multi_aff ma) const +map map::preimage_range(multi_aff ma) const { if (!ptr || ma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_preimage_range_multi_aff(copy(), ma.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set map::range() const +set map::range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::range_curry() const +map map::range_curry() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_range_curry(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::range_factor_domain() const +map map::range_factor_domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_range_factor_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::range_factor_range() const +map map::range_factor_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_range_factor_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::range_map() const +map map::range_map() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_range_map(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::range_product(isl::map map2) const +map map::range_product(map map2) const { if (!ptr || map2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_range_product(copy(), map2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::reverse() const +map map::reverse() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_reverse(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_map map::sample() const +basic_map map::sample() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_sample(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::set_range_tuple_id(isl::id id) const +map map::set_range_tuple_id(id id) const { if (!ptr || id.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_set_range_tuple_id(copy(), id.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_map map::simple_hull() const +basic_map map::simple_hull() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_simple_hull(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::subtract(isl::map map2) const +map map::subtract(map map2) const { if (!ptr || map2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_subtract(copy(), map2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::sum(isl::map map2) const +map map::sum(map map2) const { if (!ptr || map2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_sum(copy(), map2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::uncurry() const +map map::uncurry() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_uncurry(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::unite(isl::map map2) const +map map::unite(map map2) const { if (!ptr || map2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_union(copy(), map2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::universe(isl::space space) +map map::universe(space space) { if (space.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_universe(space.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_map map::unshifted_simple_hull() const +basic_map map::unshifted_simple_hull() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_unshifted_simple_hull(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set map::wrap() const +set map::wrap() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_wrap(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); + return manage(res); +} + +map map::zip() const +{ + if (!ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_map_zip(copy()); + if (!res) + exception::throw_last_error(ctx); return manage(res); } // implementations for isl::map_list -isl::map_list manage(__isl_take isl_map_list *ptr) { +map_list manage(__isl_take isl_map_list *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return map_list(ptr); } -isl::map_list manage_copy(__isl_keep isl_map_list *ptr) { +map_list manage_copy(__isl_keep isl_map_list *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_map_list_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_map_list_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return map_list(ptr); } map_list::map_list() : ptr(nullptr) {} -map_list::map_list(const isl::map_list &obj) - : ptr(obj.copy()) +map_list::map_list(const map_list &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_map_list_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_map_list_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } map_list::map_list(__isl_take isl_map_list *ptr) : ptr(ptr) {} -map_list::map_list(isl::map el) +map_list::map_list(map el) { if (el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = el.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_list_from_map(el.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -map_list::map_list(isl::ctx ctx, int n) +map_list::map_list(ctx ctx, int n) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_list_alloc(ctx.release(), n); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -map_list &map_list::operator=(isl::map_list obj) { +map_list &map_list::operator=(map_list obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -9834,62 +9953,62 @@ map_list::operator bool() const -isl::ctx map_list::get_ctx() const { - return isl::ctx(isl_map_list_get_ctx(ptr)); +ctx map_list::get_ctx() const { + return ctx(isl_map_list_get_ctx(ptr)); } -isl::map_list map_list::add(isl::map el) const +map_list map_list::add(map el) const { if (!ptr || el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_list_add(copy(), el.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map_list map_list::concat(isl::map_list list2) const +map_list map_list::concat(map_list list2) const { if (!ptr || list2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_list_concat(copy(), list2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map_list map_list::drop(unsigned int first, unsigned int n) const +map_list map_list::drop(unsigned int first, unsigned int n) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_list_drop(copy(), first, n); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -void map_list::foreach(const std::function &fn) const +void map_list::foreach(const std::function &fn) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); struct fn_data { - std::function func; + std::function func; std::exception_ptr eptr; } fn_data = { fn }; auto fn_lambda = [](isl_map *arg_0, void *arg_1) -> isl_stat { auto *data = static_cast(arg_1); - try { - (data->func)(isl::manage(arg_0)); + ISL_CPP_TRY { + (data->func)(manage(arg_0)); return isl_stat_ok; - } catch (...) { + } ISL_CPP_CATCH_ALL { data->eptr = std::current_exception(); return isl_stat_error; } @@ -9898,109 +10017,111 @@ void map_list::foreach(const std::function &fn) const if (fn_data.eptr) std::rethrow_exception(fn_data.eptr); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return void(res); } -isl::map map_list::get_at(int index) const +map map_list::get_at(int index) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_list_get_at(get(), index); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map_list map_list::reverse() const +map_list map_list::reverse() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_list_reverse(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } int map_list::size() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_list_size(get()); return res; } // implementations for isl::multi_aff -isl::multi_aff manage(__isl_take isl_multi_aff *ptr) { +multi_aff manage(__isl_take isl_multi_aff *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return multi_aff(ptr); } -isl::multi_aff manage_copy(__isl_keep isl_multi_aff *ptr) { +multi_aff manage_copy(__isl_keep isl_multi_aff *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_multi_aff_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_multi_aff_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return multi_aff(ptr); } multi_aff::multi_aff() : ptr(nullptr) {} -multi_aff::multi_aff(const isl::multi_aff &obj) - : ptr(obj.copy()) +multi_aff::multi_aff(const multi_aff &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_multi_aff_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_multi_aff_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } multi_aff::multi_aff(__isl_take isl_multi_aff *ptr) : ptr(ptr) {} -multi_aff::multi_aff(isl::aff aff) -{ - if (aff.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - auto ctx = aff.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_aff_from_aff(aff.release()); - if (!res) - throw exception::create_from_last_error(ctx); - ptr = res; -} -multi_aff::multi_aff(isl::ctx ctx, const std::string &str) +multi_aff::multi_aff(ctx ctx, const std::string &str) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_read_from_str(ctx.release(), str.c_str()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -multi_aff::multi_aff(isl::space space, isl::aff_list list) +multi_aff::multi_aff(space space, aff_list list) { if (space.is_null() || list.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_from_aff_list(space.release(), list.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); + ptr = res; +} +multi_aff::multi_aff(aff aff) +{ + if (aff.is_null()) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = aff.get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_multi_aff_from_aff(aff.release()); + if (!res) + exception::throw_last_error(ctx); ptr = res; } -multi_aff &multi_aff::operator=(isl::multi_aff obj) { +multi_aff &multi_aff::operator=(multi_aff obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -10048,490 +10169,488 @@ std::string multi_aff::to_str() const { } -isl::ctx multi_aff::get_ctx() const { - return isl::ctx(isl_multi_aff_get_ctx(ptr)); +ctx multi_aff::get_ctx() const { + return ctx(isl_multi_aff_get_ctx(ptr)); } -isl::multi_aff multi_aff::add(isl::multi_aff multi2) const +multi_aff multi_aff::add(multi_aff multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_add(copy(), multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::align_params(isl::space model) const +multi_aff multi_aff::align_params(space model) const { if (!ptr || model.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_align_params(copy(), model.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::domain_map(isl::space space) +multi_aff multi_aff::domain_map(space space) { if (space.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_domain_map(space.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::factor_domain() const +multi_aff multi_aff::factor_domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_factor_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::factor_range() const +multi_aff multi_aff::factor_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_factor_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::flat_range_product(isl::multi_aff multi2) const +multi_aff multi_aff::flat_range_product(multi_aff multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_flat_range_product(copy(), multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::flatten_range() const +multi_aff multi_aff::flatten_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_flatten_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::floor() const +multi_aff multi_aff::floor() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_floor(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::from_range() const +multi_aff multi_aff::from_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_from_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::aff multi_aff::get_aff(int pos) const +aff multi_aff::get_aff(int pos) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_get_aff(get(), pos); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::aff_list multi_aff::get_aff_list() const +aff_list multi_aff::get_aff_list() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_get_aff_list(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space multi_aff::get_domain_space() const +space multi_aff::get_domain_space() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_get_domain_space(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::id multi_aff::get_range_tuple_id() const +id multi_aff::get_range_tuple_id() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_get_range_tuple_id(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space multi_aff::get_space() const +space multi_aff::get_space() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_get_space(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::identity(isl::space space) +multi_aff multi_aff::identity(space space) { if (space.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_identity(space.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::mod(isl::multi_val mv) const +multi_aff multi_aff::mod(multi_val mv) const { if (!ptr || mv.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_mod_multi_val(copy(), mv.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::neg() const +multi_aff multi_aff::neg() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_neg(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::product(isl::multi_aff multi2) const +multi_aff multi_aff::product(multi_aff multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_product(copy(), multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::pullback(isl::multi_aff ma2) const +multi_aff multi_aff::pullback(multi_aff ma2) const { if (!ptr || ma2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_pullback_multi_aff(copy(), ma2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::range_factor_domain() const +multi_aff multi_aff::range_factor_domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_range_factor_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::range_factor_range() const +multi_aff multi_aff::range_factor_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_range_factor_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::range_map(isl::space space) +multi_aff multi_aff::range_map(space space) { if (space.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_range_map(space.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::range_product(isl::multi_aff multi2) const +multi_aff multi_aff::range_product(multi_aff multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_range_product(copy(), multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::range_splice(unsigned int pos, isl::multi_aff multi2) const +multi_aff multi_aff::range_splice(unsigned int pos, multi_aff multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_range_splice(copy(), pos, multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::reset_user() const +multi_aff multi_aff::reset_user() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_reset_user(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::scale(isl::val v) const +multi_aff multi_aff::scale(val v) const { if (!ptr || v.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_scale_val(copy(), v.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::scale(isl::multi_val mv) const +multi_aff multi_aff::scale(multi_val mv) const { if (!ptr || mv.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_scale_multi_val(copy(), mv.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::scale_down(isl::val v) const +multi_aff multi_aff::scale_down(val v) const { if (!ptr || v.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_scale_down_val(copy(), v.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::scale_down(isl::multi_val mv) const +multi_aff multi_aff::scale_down(multi_val mv) const { if (!ptr || mv.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_scale_down_multi_val(copy(), mv.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::set_aff(int pos, isl::aff el) const +multi_aff multi_aff::set_aff(int pos, aff el) const { if (!ptr || el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_set_aff(copy(), pos, el.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::set_range_tuple_id(isl::id id) const +multi_aff multi_aff::set_range_tuple_id(id id) const { if (!ptr || id.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_set_range_tuple_id(copy(), id.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } int multi_aff::size() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_size(get()); return res; } -isl::multi_aff multi_aff::splice(unsigned int in_pos, unsigned int out_pos, isl::multi_aff multi2) const +multi_aff multi_aff::splice(unsigned int in_pos, unsigned int out_pos, multi_aff multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_splice(copy(), in_pos, out_pos, multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::sub(isl::multi_aff multi2) const +multi_aff multi_aff::sub(multi_aff multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_sub(copy(), multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::wrapped_range_map(isl::space space) +multi_aff multi_aff::wrapped_range_map(space space) { if (space.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_wrapped_range_map(space.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::zero(isl::space space) +multi_aff multi_aff::zero(space space) { if (space.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_zero(space.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } // implementations for isl::multi_id -isl::multi_id manage(__isl_take isl_multi_id *ptr) { +multi_id manage(__isl_take isl_multi_id *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return multi_id(ptr); } -isl::multi_id manage_copy(__isl_keep isl_multi_id *ptr) { +multi_id manage_copy(__isl_keep isl_multi_id *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_multi_id_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_multi_id_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return multi_id(ptr); } multi_id::multi_id() : ptr(nullptr) {} -multi_id::multi_id(const isl::multi_id &obj) - : ptr(obj.copy()) +multi_id::multi_id(const multi_id &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_multi_id_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_multi_id_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } multi_id::multi_id(__isl_take isl_multi_id *ptr) : ptr(ptr) {} -multi_id::multi_id(isl::space space, isl::id_list list) +multi_id::multi_id(space space, id_list list) { if (space.is_null() || list.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_id_from_id_list(space.release(), list.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -multi_id &multi_id::operator=(isl::multi_id obj) { +multi_id &multi_id::operator=(multi_id obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -10565,301 +10684,301 @@ multi_id::operator bool() const -isl::ctx multi_id::get_ctx() const { - return isl::ctx(isl_multi_id_get_ctx(ptr)); +ctx multi_id::get_ctx() const { + return ctx(isl_multi_id_get_ctx(ptr)); } -isl::multi_id multi_id::align_params(isl::space model) const +multi_id multi_id::align_params(space model) const { if (!ptr || model.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_id_align_params(copy(), model.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_id multi_id::factor_domain() const +multi_id multi_id::factor_domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_id_factor_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_id multi_id::factor_range() const +multi_id multi_id::factor_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_id_factor_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_id multi_id::flat_range_product(isl::multi_id multi2) const +multi_id multi_id::flat_range_product(multi_id multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_id_flat_range_product(copy(), multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_id multi_id::flatten_range() const +multi_id multi_id::flatten_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_id_flatten_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_id multi_id::from_range() const +multi_id multi_id::from_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_id_from_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space multi_id::get_domain_space() const +space multi_id::get_domain_space() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_id_get_domain_space(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::id multi_id::get_id(int pos) const +id multi_id::get_id(int pos) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_id_get_id(get(), pos); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::id_list multi_id::get_id_list() const +id_list multi_id::get_id_list() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_id_get_id_list(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space multi_id::get_space() const +space multi_id::get_space() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_id_get_space(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_id multi_id::range_factor_domain() const +multi_id multi_id::range_factor_domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_id_range_factor_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_id multi_id::range_factor_range() const +multi_id multi_id::range_factor_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_id_range_factor_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_id multi_id::range_product(isl::multi_id multi2) const +multi_id multi_id::range_product(multi_id multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_id_range_product(copy(), multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_id multi_id::range_splice(unsigned int pos, isl::multi_id multi2) const +multi_id multi_id::range_splice(unsigned int pos, multi_id multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_id_range_splice(copy(), pos, multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_id multi_id::reset_user() const +multi_id multi_id::reset_user() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_id_reset_user(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_id multi_id::set_id(int pos, isl::id el) const +multi_id multi_id::set_id(int pos, id el) const { if (!ptr || el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_id_set_id(copy(), pos, el.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } int multi_id::size() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_id_size(get()); return res; } // implementations for isl::multi_pw_aff -isl::multi_pw_aff manage(__isl_take isl_multi_pw_aff *ptr) { +multi_pw_aff manage(__isl_take isl_multi_pw_aff *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return multi_pw_aff(ptr); } -isl::multi_pw_aff manage_copy(__isl_keep isl_multi_pw_aff *ptr) { +multi_pw_aff manage_copy(__isl_keep isl_multi_pw_aff *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_multi_pw_aff_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_multi_pw_aff_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return multi_pw_aff(ptr); } multi_pw_aff::multi_pw_aff() : ptr(nullptr) {} -multi_pw_aff::multi_pw_aff(const isl::multi_pw_aff &obj) - : ptr(obj.copy()) +multi_pw_aff::multi_pw_aff(const multi_pw_aff &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_multi_pw_aff_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_multi_pw_aff_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } multi_pw_aff::multi_pw_aff(__isl_take isl_multi_pw_aff *ptr) : ptr(ptr) {} -multi_pw_aff::multi_pw_aff(isl::space space, isl::pw_aff_list list) +multi_pw_aff::multi_pw_aff(space space, pw_aff_list list) { if (space.is_null() || list.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_from_pw_aff_list(space.release(), list.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -multi_pw_aff::multi_pw_aff(isl::multi_aff ma) +multi_pw_aff::multi_pw_aff(multi_aff ma) { if (ma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = ma.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_from_multi_aff(ma.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -multi_pw_aff::multi_pw_aff(isl::pw_aff pa) +multi_pw_aff::multi_pw_aff(pw_aff pa) { if (pa.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = pa.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_from_pw_aff(pa.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -multi_pw_aff::multi_pw_aff(isl::pw_multi_aff pma) +multi_pw_aff::multi_pw_aff(pw_multi_aff pma) { if (pma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = pma.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_from_pw_multi_aff(pma.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -multi_pw_aff::multi_pw_aff(isl::ctx ctx, const std::string &str) +multi_pw_aff::multi_pw_aff(ctx ctx, const std::string &str) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_read_from_str(ctx.release(), str.c_str()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -multi_pw_aff &multi_pw_aff::operator=(isl::multi_pw_aff obj) { +multi_pw_aff &multi_pw_aff::operator=(multi_pw_aff obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -10911,543 +11030,540 @@ std::string multi_pw_aff::to_str() const { } -isl::ctx multi_pw_aff::get_ctx() const { - return isl::ctx(isl_multi_pw_aff_get_ctx(ptr)); +ctx multi_pw_aff::get_ctx() const { + return ctx(isl_multi_pw_aff_get_ctx(ptr)); } -isl::multi_pw_aff multi_pw_aff::add(isl::multi_pw_aff multi2) const +multi_pw_aff multi_pw_aff::add(multi_pw_aff multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_add(copy(), multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_pw_aff multi_pw_aff::align_params(isl::space model) const +multi_pw_aff multi_pw_aff::align_params(space model) const { if (!ptr || model.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_align_params(copy(), model.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set multi_pw_aff::domain() const +set multi_pw_aff::domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_pw_aff multi_pw_aff::factor_domain() const +multi_pw_aff multi_pw_aff::factor_domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_factor_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_pw_aff multi_pw_aff::factor_range() const +multi_pw_aff multi_pw_aff::factor_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_factor_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_pw_aff multi_pw_aff::flat_range_product(isl::multi_pw_aff multi2) const +multi_pw_aff multi_pw_aff::flat_range_product(multi_pw_aff multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_flat_range_product(copy(), multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_pw_aff multi_pw_aff::flatten_range() const +multi_pw_aff multi_pw_aff::flatten_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_flatten_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_pw_aff multi_pw_aff::from_range() const +multi_pw_aff multi_pw_aff::from_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_from_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space multi_pw_aff::get_domain_space() const +space multi_pw_aff::get_domain_space() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_get_domain_space(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff multi_pw_aff::get_pw_aff(int pos) const +pw_aff multi_pw_aff::get_pw_aff(int pos) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_get_pw_aff(get(), pos); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff_list multi_pw_aff::get_pw_aff_list() const +pw_aff_list multi_pw_aff::get_pw_aff_list() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_get_pw_aff_list(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::id multi_pw_aff::get_range_tuple_id() const +id multi_pw_aff::get_range_tuple_id() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_get_range_tuple_id(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space multi_pw_aff::get_space() const +space multi_pw_aff::get_space() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_get_space(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_pw_aff multi_pw_aff::identity(isl::space space) +multi_pw_aff multi_pw_aff::identity(space space) { if (space.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_identity(space.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -bool multi_pw_aff::is_equal(const isl::multi_pw_aff &mpa2) const +bool multi_pw_aff::is_equal(const multi_pw_aff &mpa2) const { if (!ptr || mpa2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_is_equal(get(), mpa2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -isl::multi_pw_aff multi_pw_aff::mod(isl::multi_val mv) const +multi_pw_aff multi_pw_aff::mod(multi_val mv) const { if (!ptr || mv.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_mod_multi_val(copy(), mv.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_pw_aff multi_pw_aff::neg() const +multi_pw_aff multi_pw_aff::neg() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_neg(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_pw_aff multi_pw_aff::product(isl::multi_pw_aff multi2) const +multi_pw_aff multi_pw_aff::product(multi_pw_aff multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_product(copy(), multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_pw_aff multi_pw_aff::pullback(isl::multi_aff ma) const +multi_pw_aff multi_pw_aff::pullback(multi_aff ma) const { if (!ptr || ma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_pullback_multi_aff(copy(), ma.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_pw_aff multi_pw_aff::pullback(isl::pw_multi_aff pma) const +multi_pw_aff multi_pw_aff::pullback(pw_multi_aff pma) const { if (!ptr || pma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_pullback_pw_multi_aff(copy(), pma.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_pw_aff multi_pw_aff::pullback(isl::multi_pw_aff mpa2) const +multi_pw_aff multi_pw_aff::pullback(multi_pw_aff mpa2) const { if (!ptr || mpa2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_pullback_multi_pw_aff(copy(), mpa2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_pw_aff multi_pw_aff::range_factor_domain() const +multi_pw_aff multi_pw_aff::range_factor_domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_range_factor_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_pw_aff multi_pw_aff::range_factor_range() const +multi_pw_aff multi_pw_aff::range_factor_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_range_factor_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_pw_aff multi_pw_aff::range_product(isl::multi_pw_aff multi2) const +multi_pw_aff multi_pw_aff::range_product(multi_pw_aff multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_range_product(copy(), multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_pw_aff multi_pw_aff::range_splice(unsigned int pos, isl::multi_pw_aff multi2) const +multi_pw_aff multi_pw_aff::range_splice(unsigned int pos, multi_pw_aff multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_range_splice(copy(), pos, multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_pw_aff multi_pw_aff::reset_user() const +multi_pw_aff multi_pw_aff::reset_user() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_reset_user(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_pw_aff multi_pw_aff::scale(isl::val v) const +multi_pw_aff multi_pw_aff::scale(val v) const { if (!ptr || v.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_scale_val(copy(), v.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_pw_aff multi_pw_aff::scale(isl::multi_val mv) const +multi_pw_aff multi_pw_aff::scale(multi_val mv) const { if (!ptr || mv.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_scale_multi_val(copy(), mv.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_pw_aff multi_pw_aff::scale_down(isl::val v) const +multi_pw_aff multi_pw_aff::scale_down(val v) const { if (!ptr || v.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_scale_down_val(copy(), v.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_pw_aff multi_pw_aff::scale_down(isl::multi_val mv) const +multi_pw_aff multi_pw_aff::scale_down(multi_val mv) const { if (!ptr || mv.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_scale_down_multi_val(copy(), mv.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_pw_aff multi_pw_aff::set_pw_aff(int pos, isl::pw_aff el) const +multi_pw_aff multi_pw_aff::set_pw_aff(int pos, pw_aff el) const { if (!ptr || el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_set_pw_aff(copy(), pos, el.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_pw_aff multi_pw_aff::set_range_tuple_id(isl::id id) const +multi_pw_aff multi_pw_aff::set_range_tuple_id(id id) const { if (!ptr || id.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_set_range_tuple_id(copy(), id.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } int multi_pw_aff::size() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_size(get()); return res; } -isl::multi_pw_aff multi_pw_aff::splice(unsigned int in_pos, unsigned int out_pos, isl::multi_pw_aff multi2) const +multi_pw_aff multi_pw_aff::splice(unsigned int in_pos, unsigned int out_pos, multi_pw_aff multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_splice(copy(), in_pos, out_pos, multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_pw_aff multi_pw_aff::sub(isl::multi_pw_aff multi2) const +multi_pw_aff multi_pw_aff::sub(multi_pw_aff multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_sub(copy(), multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_pw_aff multi_pw_aff::zero(isl::space space) +multi_pw_aff multi_pw_aff::zero(space space) { if (space.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_zero(space.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } // implementations for isl::multi_union_pw_aff -isl::multi_union_pw_aff manage(__isl_take isl_multi_union_pw_aff *ptr) { +multi_union_pw_aff manage(__isl_take isl_multi_union_pw_aff *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return multi_union_pw_aff(ptr); } -isl::multi_union_pw_aff manage_copy(__isl_keep isl_multi_union_pw_aff *ptr) { +multi_union_pw_aff manage_copy(__isl_keep isl_multi_union_pw_aff *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_multi_union_pw_aff_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_multi_union_pw_aff_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return multi_union_pw_aff(ptr); } multi_union_pw_aff::multi_union_pw_aff() : ptr(nullptr) {} -multi_union_pw_aff::multi_union_pw_aff(const isl::multi_union_pw_aff &obj) - : ptr(obj.copy()) +multi_union_pw_aff::multi_union_pw_aff(const multi_union_pw_aff &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_multi_union_pw_aff_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_multi_union_pw_aff_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } multi_union_pw_aff::multi_union_pw_aff(__isl_take isl_multi_union_pw_aff *ptr) : ptr(ptr) {} -multi_union_pw_aff::multi_union_pw_aff(isl::space space, isl::union_pw_aff_list list) -{ - if (space.is_null() || list.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_union_pw_aff_from_union_pw_aff_list(space.release(), list.release()); - if (!res) - throw exception::create_from_last_error(ctx); - ptr = res; -} -multi_union_pw_aff::multi_union_pw_aff(isl::union_pw_aff upa) +multi_union_pw_aff::multi_union_pw_aff(union_pw_aff upa) { if (upa.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = upa.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_from_union_pw_aff(upa.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -multi_union_pw_aff::multi_union_pw_aff(isl::multi_pw_aff mpa) +multi_union_pw_aff::multi_union_pw_aff(multi_pw_aff mpa) { if (mpa.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = mpa.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_from_multi_pw_aff(mpa.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -multi_union_pw_aff::multi_union_pw_aff(isl::union_set domain, isl::multi_val mv) +multi_union_pw_aff::multi_union_pw_aff(union_set domain, multi_val mv) { if (domain.is_null() || mv.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = domain.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_multi_val_on_domain(domain.release(), mv.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -multi_union_pw_aff::multi_union_pw_aff(isl::union_set domain, isl::multi_aff ma) +multi_union_pw_aff::multi_union_pw_aff(union_set domain, multi_aff ma) { if (domain.is_null() || ma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = domain.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_multi_aff_on_domain(domain.release(), ma.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); + ptr = res; +} +multi_union_pw_aff::multi_union_pw_aff(space space, union_pw_aff_list list) +{ + if (space.is_null() || list.is_null()) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = space.get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_multi_union_pw_aff_from_union_pw_aff_list(space.release(), list.release()); + if (!res) + exception::throw_last_error(ctx); ptr = res; } -multi_union_pw_aff::multi_union_pw_aff(isl::ctx ctx, const std::string &str) +multi_union_pw_aff::multi_union_pw_aff(ctx ctx, const std::string &str) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_read_from_str(ctx.release(), str.c_str()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -multi_union_pw_aff &multi_union_pw_aff::operator=(isl::multi_union_pw_aff obj) { +multi_union_pw_aff &multi_union_pw_aff::operator=(multi_union_pw_aff obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -11495,571 +11611,572 @@ std::string multi_union_pw_aff::to_str() const { } -isl::ctx multi_union_pw_aff::get_ctx() const { - return isl::ctx(isl_multi_union_pw_aff_get_ctx(ptr)); +ctx multi_union_pw_aff::get_ctx() const { + return ctx(isl_multi_union_pw_aff_get_ctx(ptr)); } -isl::multi_union_pw_aff multi_union_pw_aff::add(isl::multi_union_pw_aff multi2) const +multi_union_pw_aff multi_union_pw_aff::add(multi_union_pw_aff multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_add(copy(), multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::align_params(isl::space model) const +multi_union_pw_aff multi_union_pw_aff::align_params(space model) const { if (!ptr || model.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_align_params(copy(), model.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::apply(isl::multi_aff ma) const +multi_union_pw_aff multi_union_pw_aff::apply(multi_aff ma) const { if (!ptr || ma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_apply_multi_aff(copy(), ma.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::apply(isl::pw_multi_aff pma) const +multi_union_pw_aff multi_union_pw_aff::apply(pw_multi_aff pma) const { if (!ptr || pma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_apply_pw_multi_aff(copy(), pma.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set multi_union_pw_aff::domain() const +union_set multi_union_pw_aff::domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_pw_aff multi_union_pw_aff::extract_multi_pw_aff(isl::space space) const +multi_pw_aff multi_union_pw_aff::extract_multi_pw_aff(space space) const { if (!ptr || space.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_extract_multi_pw_aff(get(), space.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::factor_domain() const +multi_union_pw_aff multi_union_pw_aff::factor_domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_factor_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::factor_range() const +multi_union_pw_aff multi_union_pw_aff::factor_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_factor_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::flat_range_product(isl::multi_union_pw_aff multi2) const +multi_union_pw_aff multi_union_pw_aff::flat_range_product(multi_union_pw_aff multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_flat_range_product(copy(), multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::flatten_range() const +multi_union_pw_aff multi_union_pw_aff::flatten_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_flatten_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::floor() const +multi_union_pw_aff multi_union_pw_aff::floor() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_floor(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::from_range() const +multi_union_pw_aff multi_union_pw_aff::from_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_from_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::from_union_map(isl::union_map umap) +multi_union_pw_aff multi_union_pw_aff::from_union_map(union_map umap) { if (umap.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = umap.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_from_union_map(umap.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::space multi_union_pw_aff::get_domain_space() const +space multi_union_pw_aff::get_domain_space() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_get_domain_space(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::id multi_union_pw_aff::get_range_tuple_id() const +id multi_union_pw_aff::get_range_tuple_id() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_get_range_tuple_id(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space multi_union_pw_aff::get_space() const +space multi_union_pw_aff::get_space() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_get_space(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_pw_aff multi_union_pw_aff::get_union_pw_aff(int pos) const +union_pw_aff multi_union_pw_aff::get_union_pw_aff(int pos) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_get_union_pw_aff(get(), pos); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_pw_aff_list multi_union_pw_aff::get_union_pw_aff_list() const +union_pw_aff_list multi_union_pw_aff::get_union_pw_aff_list() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_get_union_pw_aff_list(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::gist(isl::union_set context) const +multi_union_pw_aff multi_union_pw_aff::gist(union_set context) const { if (!ptr || context.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_gist(copy(), context.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::intersect_domain(isl::union_set uset) const +multi_union_pw_aff multi_union_pw_aff::intersect_domain(union_set uset) const { if (!ptr || uset.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_intersect_domain(copy(), uset.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::intersect_params(isl::set params) const +multi_union_pw_aff multi_union_pw_aff::intersect_params(set params) const { if (!ptr || params.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_intersect_params(copy(), params.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -bool multi_union_pw_aff::involves_param(const isl::id &id) const +bool multi_union_pw_aff::involves_param(const id &id) const { if (!ptr || id.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_involves_param_id(get(), id.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -isl::multi_val multi_union_pw_aff::max_multi_val() const +multi_val multi_union_pw_aff::max_multi_val() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_max_multi_val(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_val multi_union_pw_aff::min_multi_val() const +multi_val multi_union_pw_aff::min_multi_val() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_min_multi_val(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::mod(isl::multi_val mv) const +multi_union_pw_aff multi_union_pw_aff::mod(multi_val mv) const { if (!ptr || mv.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_mod_multi_val(copy(), mv.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::neg() const +multi_union_pw_aff multi_union_pw_aff::neg() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_neg(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::pullback(isl::union_pw_multi_aff upma) const +multi_union_pw_aff multi_union_pw_aff::pullback(union_pw_multi_aff upma) const { if (!ptr || upma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_pullback_union_pw_multi_aff(copy(), upma.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::range_factor_domain() const +multi_union_pw_aff multi_union_pw_aff::range_factor_domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_range_factor_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::range_factor_range() const +multi_union_pw_aff multi_union_pw_aff::range_factor_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_range_factor_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::range_product(isl::multi_union_pw_aff multi2) const +multi_union_pw_aff multi_union_pw_aff::range_product(multi_union_pw_aff multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_range_product(copy(), multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::range_splice(unsigned int pos, isl::multi_union_pw_aff multi2) const +multi_union_pw_aff multi_union_pw_aff::range_splice(unsigned int pos, multi_union_pw_aff multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_range_splice(copy(), pos, multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::reset_user() const +multi_union_pw_aff multi_union_pw_aff::reset_user() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_reset_user(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::scale(isl::val v) const +multi_union_pw_aff multi_union_pw_aff::scale(val v) const { if (!ptr || v.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_scale_val(copy(), v.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::scale(isl::multi_val mv) const +multi_union_pw_aff multi_union_pw_aff::scale(multi_val mv) const { if (!ptr || mv.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_scale_multi_val(copy(), mv.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::scale_down(isl::val v) const +multi_union_pw_aff multi_union_pw_aff::scale_down(val v) const { if (!ptr || v.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_scale_down_val(copy(), v.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::scale_down(isl::multi_val mv) const +multi_union_pw_aff multi_union_pw_aff::scale_down(multi_val mv) const { if (!ptr || mv.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_scale_down_multi_val(copy(), mv.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::set_range_tuple_id(isl::id id) const +multi_union_pw_aff multi_union_pw_aff::set_range_tuple_id(id id) const { if (!ptr || id.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_set_range_tuple_id(copy(), id.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::set_union_pw_aff(int pos, isl::union_pw_aff el) const +multi_union_pw_aff multi_union_pw_aff::set_union_pw_aff(int pos, union_pw_aff el) const { if (!ptr || el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_set_union_pw_aff(copy(), pos, el.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } int multi_union_pw_aff::size() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_size(get()); return res; } -isl::multi_union_pw_aff multi_union_pw_aff::sub(isl::multi_union_pw_aff multi2) const +multi_union_pw_aff multi_union_pw_aff::sub(multi_union_pw_aff multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_sub(copy(), multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::union_add(isl::multi_union_pw_aff mupa2) const +multi_union_pw_aff multi_union_pw_aff::union_add(multi_union_pw_aff mupa2) const { if (!ptr || mupa2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_union_add(copy(), mupa2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::zero(isl::space space) +multi_union_pw_aff multi_union_pw_aff::zero(space space) { if (space.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_zero(space.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set multi_union_pw_aff::zero_union_set() const +union_set multi_union_pw_aff::zero_union_set() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_zero_union_set(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } // implementations for isl::multi_val -isl::multi_val manage(__isl_take isl_multi_val *ptr) { +multi_val manage(__isl_take isl_multi_val *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return multi_val(ptr); } -isl::multi_val manage_copy(__isl_keep isl_multi_val *ptr) { +multi_val manage_copy(__isl_keep isl_multi_val *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_multi_val_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_multi_val_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return multi_val(ptr); } multi_val::multi_val() : ptr(nullptr) {} -multi_val::multi_val(const isl::multi_val &obj) - : ptr(obj.copy()) +multi_val::multi_val(const multi_val &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_multi_val_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_multi_val_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } multi_val::multi_val(__isl_take isl_multi_val *ptr) : ptr(ptr) {} -multi_val::multi_val(isl::space space, isl::val_list list) +multi_val::multi_val(space space, val_list list) { if (space.is_null() || list.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_from_val_list(space.release(), list.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -multi_val &multi_val::operator=(isl::multi_val obj) { +multi_val &multi_val::operator=(multi_val obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -12107,414 +12224,416 @@ std::string multi_val::to_str() const { } -isl::ctx multi_val::get_ctx() const { - return isl::ctx(isl_multi_val_get_ctx(ptr)); +ctx multi_val::get_ctx() const { + return ctx(isl_multi_val_get_ctx(ptr)); } -isl::multi_val multi_val::add(isl::multi_val multi2) const +multi_val multi_val::add(multi_val multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_add(copy(), multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_val multi_val::align_params(isl::space model) const +multi_val multi_val::align_params(space model) const { if (!ptr || model.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_align_params(copy(), model.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_val multi_val::factor_domain() const +multi_val multi_val::factor_domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_factor_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_val multi_val::factor_range() const +multi_val multi_val::factor_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_factor_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_val multi_val::flat_range_product(isl::multi_val multi2) const +multi_val multi_val::flat_range_product(multi_val multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_flat_range_product(copy(), multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_val multi_val::flatten_range() const +multi_val multi_val::flatten_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_flatten_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_val multi_val::from_range() const +multi_val multi_val::from_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_from_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space multi_val::get_domain_space() const +space multi_val::get_domain_space() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_get_domain_space(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::id multi_val::get_range_tuple_id() const +id multi_val::get_range_tuple_id() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_get_range_tuple_id(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space multi_val::get_space() const +space multi_val::get_space() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_get_space(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::val multi_val::get_val(int pos) const +val multi_val::get_val(int pos) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_get_val(get(), pos); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::val_list multi_val::get_val_list() const +val_list multi_val::get_val_list() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_get_val_list(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_val multi_val::mod(isl::multi_val mv) const +multi_val multi_val::mod(multi_val mv) const { if (!ptr || mv.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_mod_multi_val(copy(), mv.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_val multi_val::neg() const +multi_val multi_val::neg() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_neg(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_val multi_val::product(isl::multi_val multi2) const +multi_val multi_val::product(multi_val multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_product(copy(), multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_val multi_val::range_factor_domain() const +multi_val multi_val::range_factor_domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_range_factor_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_val multi_val::range_factor_range() const +multi_val multi_val::range_factor_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_range_factor_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_val multi_val::range_product(isl::multi_val multi2) const +multi_val multi_val::range_product(multi_val multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_range_product(copy(), multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_val multi_val::range_splice(unsigned int pos, isl::multi_val multi2) const +multi_val multi_val::range_splice(unsigned int pos, multi_val multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_range_splice(copy(), pos, multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_val multi_val::reset_user() const +multi_val multi_val::reset_user() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_reset_user(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_val multi_val::scale(isl::val v) const +multi_val multi_val::scale(val v) const { if (!ptr || v.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_scale_val(copy(), v.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_val multi_val::scale(isl::multi_val mv) const +multi_val multi_val::scale(multi_val mv) const { if (!ptr || mv.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_scale_multi_val(copy(), mv.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_val multi_val::scale_down(isl::val v) const +multi_val multi_val::scale_down(val v) const { if (!ptr || v.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_scale_down_val(copy(), v.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_val multi_val::scale_down(isl::multi_val mv) const +multi_val multi_val::scale_down(multi_val mv) const { if (!ptr || mv.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_scale_down_multi_val(copy(), mv.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_val multi_val::set_range_tuple_id(isl::id id) const +multi_val multi_val::set_range_tuple_id(id id) const { if (!ptr || id.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_set_range_tuple_id(copy(), id.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_val multi_val::set_val(int pos, isl::val el) const +multi_val multi_val::set_val(int pos, val el) const { if (!ptr || el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_set_val(copy(), pos, el.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } int multi_val::size() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_size(get()); return res; } -isl::multi_val multi_val::splice(unsigned int in_pos, unsigned int out_pos, isl::multi_val multi2) const +multi_val multi_val::splice(unsigned int in_pos, unsigned int out_pos, multi_val multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_splice(copy(), in_pos, out_pos, multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_val multi_val::sub(isl::multi_val multi2) const +multi_val multi_val::sub(multi_val multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_sub(copy(), multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_val multi_val::zero(isl::space space) +multi_val multi_val::zero(space space) { if (space.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_zero(space.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } // implementations for isl::point -isl::point manage(__isl_take isl_point *ptr) { +point manage(__isl_take isl_point *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return point(ptr); } -isl::point manage_copy(__isl_keep isl_point *ptr) { +point manage_copy(__isl_keep isl_point *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_point_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_point_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return point(ptr); } point::point() : ptr(nullptr) {} -point::point(const isl::point &obj) - : ptr(obj.copy()) +point::point(const point &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_point_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_point_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } point::point(__isl_take isl_point *ptr) : ptr(ptr) {} -point::point(isl::space dim) +point::point(space dim) { if (dim.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = dim.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_point_zero(dim.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -point &point::operator=(isl::point obj) { +point &point::operator=(point obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -12562,111 +12681,112 @@ std::string point::to_str() const { } -isl::ctx point::get_ctx() const { - return isl::ctx(isl_point_get_ctx(ptr)); +ctx point::get_ctx() const { + return ctx(isl_point_get_ctx(ptr)); } -isl::space point::get_space() const +space point::get_space() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_point_get_space(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } bool point::is_void() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_point_is_void(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } // implementations for isl::pw_aff -isl::pw_aff manage(__isl_take isl_pw_aff *ptr) { +pw_aff manage(__isl_take isl_pw_aff *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return pw_aff(ptr); } -isl::pw_aff manage_copy(__isl_keep isl_pw_aff *ptr) { +pw_aff manage_copy(__isl_keep isl_pw_aff *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_pw_aff_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_pw_aff_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return pw_aff(ptr); } pw_aff::pw_aff() : ptr(nullptr) {} -pw_aff::pw_aff(const isl::pw_aff &obj) - : ptr(obj.copy()) +pw_aff::pw_aff(const pw_aff &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_pw_aff_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_pw_aff_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } pw_aff::pw_aff(__isl_take isl_pw_aff *ptr) : ptr(ptr) {} -pw_aff::pw_aff(isl::aff aff) +pw_aff::pw_aff(aff aff) { if (aff.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = aff.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_from_aff(aff.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -pw_aff::pw_aff(isl::local_space ls) +pw_aff::pw_aff(local_space ls) { if (ls.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = ls.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_zero_on_domain(ls.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -pw_aff::pw_aff(isl::set domain, isl::val v) +pw_aff::pw_aff(set domain, val v) { if (domain.is_null() || v.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = domain.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_val_on_domain(domain.release(), v.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -pw_aff::pw_aff(isl::ctx ctx, const std::string &str) +pw_aff::pw_aff(ctx ctx, const std::string &str) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_read_from_str(ctx.release(), str.c_str()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -pw_aff &pw_aff::operator=(isl::pw_aff obj) { +pw_aff &pw_aff::operator=(pw_aff obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -12718,122 +12838,122 @@ std::string pw_aff::to_str() const { } -isl::ctx pw_aff::get_ctx() const { - return isl::ctx(isl_pw_aff_get_ctx(ptr)); +ctx pw_aff::get_ctx() const { + return ctx(isl_pw_aff_get_ctx(ptr)); } -isl::pw_aff pw_aff::add(isl::pw_aff pwaff2) const +pw_aff pw_aff::add(pw_aff pwaff2) const { if (!ptr || pwaff2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_add(copy(), pwaff2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff pw_aff::ceil() const +pw_aff pw_aff::ceil() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_ceil(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff pw_aff::cond(isl::pw_aff pwaff_true, isl::pw_aff pwaff_false) const +pw_aff pw_aff::cond(pw_aff pwaff_true, pw_aff pwaff_false) const { if (!ptr || pwaff_true.is_null() || pwaff_false.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_cond(copy(), pwaff_true.release(), pwaff_false.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff pw_aff::div(isl::pw_aff pa2) const +pw_aff pw_aff::div(pw_aff pa2) const { if (!ptr || pa2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_div(copy(), pa2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set pw_aff::domain() const +set pw_aff::domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map pw_aff::eq_map(isl::pw_aff pa2) const +map pw_aff::eq_map(pw_aff pa2) const { if (!ptr || pa2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_eq_map(copy(), pa2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set pw_aff::eq_set(isl::pw_aff pwaff2) const +set pw_aff::eq_set(pw_aff pwaff2) const { if (!ptr || pwaff2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_eq_set(copy(), pwaff2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff pw_aff::floor() const +pw_aff pw_aff::floor() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_floor(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -void pw_aff::foreach_piece(const std::function &fn) const +void pw_aff::foreach_piece(const std::function &fn) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); struct fn_data { - std::function func; + std::function func; std::exception_ptr eptr; } fn_data = { fn }; auto fn_lambda = [](isl_set *arg_0, isl_aff *arg_1, void *arg_2) -> isl_stat { auto *data = static_cast(arg_2); - try { - (data->func)(isl::manage(arg_0), isl::manage(arg_1)); + ISL_CPP_TRY { + (data->func)(manage(arg_0), manage(arg_1)); return isl_stat_ok; - } catch (...) { + } ISL_CPP_CATCH_ALL { data->eptr = std::current_exception(); return isl_stat_error; } @@ -12842,457 +12962,460 @@ void pw_aff::foreach_piece(const std::function &fn) co if (fn_data.eptr) std::rethrow_exception(fn_data.eptr); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return void(res); } -isl::set pw_aff::ge_set(isl::pw_aff pwaff2) const +set pw_aff::ge_set(pw_aff pwaff2) const { if (!ptr || pwaff2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_ge_set(copy(), pwaff2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space pw_aff::get_space() const +space pw_aff::get_space() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_get_space(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map pw_aff::gt_map(isl::pw_aff pa2) const +map pw_aff::gt_map(pw_aff pa2) const { if (!ptr || pa2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_gt_map(copy(), pa2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set pw_aff::gt_set(isl::pw_aff pwaff2) const +set pw_aff::gt_set(pw_aff pwaff2) const { if (!ptr || pwaff2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_gt_set(copy(), pwaff2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff pw_aff::intersect_domain(isl::set set) const +pw_aff pw_aff::intersect_domain(set set) const { if (!ptr || set.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_intersect_domain(copy(), set.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff pw_aff::intersect_params(isl::set set) const +pw_aff pw_aff::intersect_params(set set) const { if (!ptr || set.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_intersect_params(copy(), set.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } bool pw_aff::involves_nan() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_involves_nan(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } bool pw_aff::is_cst() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_is_cst(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -bool pw_aff::is_equal(const isl::pw_aff &pa2) const +bool pw_aff::is_equal(const pw_aff &pa2) const { if (!ptr || pa2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_is_equal(get(), pa2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -isl::set pw_aff::le_set(isl::pw_aff pwaff2) const +set pw_aff::le_set(pw_aff pwaff2) const { if (!ptr || pwaff2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_le_set(copy(), pwaff2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map pw_aff::lt_map(isl::pw_aff pa2) const +map pw_aff::lt_map(pw_aff pa2) const { if (!ptr || pa2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_lt_map(copy(), pa2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set pw_aff::lt_set(isl::pw_aff pwaff2) const +set pw_aff::lt_set(pw_aff pwaff2) const { if (!ptr || pwaff2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_lt_set(copy(), pwaff2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff pw_aff::max(isl::pw_aff pwaff2) const +pw_aff pw_aff::max(pw_aff pwaff2) const { if (!ptr || pwaff2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_max(copy(), pwaff2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff pw_aff::min(isl::pw_aff pwaff2) const +pw_aff pw_aff::min(pw_aff pwaff2) const { if (!ptr || pwaff2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_min(copy(), pwaff2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff pw_aff::mod(isl::val mod) const +pw_aff pw_aff::mod(val mod) const { if (!ptr || mod.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_mod_val(copy(), mod.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff pw_aff::mul(isl::pw_aff pwaff2) const +pw_aff pw_aff::mul(pw_aff pwaff2) const { if (!ptr || pwaff2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_mul(copy(), pwaff2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } int pw_aff::n_piece() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_n_piece(get()); return res; } -isl::set pw_aff::ne_set(isl::pw_aff pwaff2) const +set pw_aff::ne_set(pw_aff pwaff2) const { if (!ptr || pwaff2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_ne_set(copy(), pwaff2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff pw_aff::neg() const +pw_aff pw_aff::neg() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_neg(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set pw_aff::nonneg_set() const +set pw_aff::nonneg_set() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_nonneg_set(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set pw_aff::params() const +set pw_aff::params() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_params(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set pw_aff::pos_set() const +set pw_aff::pos_set() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_pos_set(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff pw_aff::project_domain_on_params() const +pw_aff pw_aff::project_domain_on_params() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_project_domain_on_params(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff pw_aff::pullback(isl::multi_aff ma) const +pw_aff pw_aff::pullback(multi_aff ma) const { if (!ptr || ma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_pullback_multi_aff(copy(), ma.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff pw_aff::pullback(isl::pw_multi_aff pma) const +pw_aff pw_aff::pullback(pw_multi_aff pma) const { if (!ptr || pma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_pullback_pw_multi_aff(copy(), pma.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff pw_aff::pullback(isl::multi_pw_aff mpa) const +pw_aff pw_aff::pullback(multi_pw_aff mpa) const { if (!ptr || mpa.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_pullback_multi_pw_aff(copy(), mpa.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff pw_aff::scale(isl::val v) const +pw_aff pw_aff::scale(val v) const { if (!ptr || v.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_scale_val(copy(), v.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff pw_aff::scale_down(isl::val f) const +pw_aff pw_aff::scale_down(val f) const { if (!ptr || f.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_scale_down_val(copy(), f.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff pw_aff::sub(isl::pw_aff pwaff2) const +pw_aff pw_aff::sub(pw_aff pwaff2) const { if (!ptr || pwaff2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_sub(copy(), pwaff2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff pw_aff::tdiv_q(isl::pw_aff pa2) const +pw_aff pw_aff::tdiv_q(pw_aff pa2) const { if (!ptr || pa2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_tdiv_q(copy(), pa2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff pw_aff::tdiv_r(isl::pw_aff pa2) const +pw_aff pw_aff::tdiv_r(pw_aff pa2) const { if (!ptr || pa2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_tdiv_r(copy(), pa2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff pw_aff::union_add(isl::pw_aff pwaff2) const +pw_aff pw_aff::union_add(pw_aff pwaff2) const { if (!ptr || pwaff2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_union_add(copy(), pwaff2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set pw_aff::zero_set() const +set pw_aff::zero_set() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_zero_set(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } // implementations for isl::pw_aff_list -isl::pw_aff_list manage(__isl_take isl_pw_aff_list *ptr) { +pw_aff_list manage(__isl_take isl_pw_aff_list *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return pw_aff_list(ptr); } -isl::pw_aff_list manage_copy(__isl_keep isl_pw_aff_list *ptr) { +pw_aff_list manage_copy(__isl_keep isl_pw_aff_list *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_pw_aff_list_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_pw_aff_list_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return pw_aff_list(ptr); } pw_aff_list::pw_aff_list() : ptr(nullptr) {} -pw_aff_list::pw_aff_list(const isl::pw_aff_list &obj) - : ptr(obj.copy()) +pw_aff_list::pw_aff_list(const pw_aff_list &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_pw_aff_list_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_pw_aff_list_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } pw_aff_list::pw_aff_list(__isl_take isl_pw_aff_list *ptr) : ptr(ptr) {} -pw_aff_list::pw_aff_list(isl::pw_aff el) +pw_aff_list::pw_aff_list(pw_aff el) { if (el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = el.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_list_from_pw_aff(el.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -pw_aff_list::pw_aff_list(isl::ctx ctx, int n) +pw_aff_list::pw_aff_list(ctx ctx, int n) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_list_alloc(ctx.release(), n); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -pw_aff_list &pw_aff_list::operator=(isl::pw_aff_list obj) { +pw_aff_list &pw_aff_list::operator=(pw_aff_list obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -13326,62 +13449,62 @@ pw_aff_list::operator bool() const -isl::ctx pw_aff_list::get_ctx() const { - return isl::ctx(isl_pw_aff_list_get_ctx(ptr)); +ctx pw_aff_list::get_ctx() const { + return ctx(isl_pw_aff_list_get_ctx(ptr)); } -isl::pw_aff_list pw_aff_list::add(isl::pw_aff el) const +pw_aff_list pw_aff_list::add(pw_aff el) const { if (!ptr || el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_list_add(copy(), el.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff_list pw_aff_list::concat(isl::pw_aff_list list2) const +pw_aff_list pw_aff_list::concat(pw_aff_list list2) const { if (!ptr || list2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_list_concat(copy(), list2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff_list pw_aff_list::drop(unsigned int first, unsigned int n) const +pw_aff_list pw_aff_list::drop(unsigned int first, unsigned int n) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_list_drop(copy(), first, n); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -void pw_aff_list::foreach(const std::function &fn) const +void pw_aff_list::foreach(const std::function &fn) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); struct fn_data { - std::function func; + std::function func; std::exception_ptr eptr; } fn_data = { fn }; auto fn_lambda = [](isl_pw_aff *arg_0, void *arg_1) -> isl_stat { auto *data = static_cast(arg_1); - try { - (data->func)(isl::manage(arg_0)); + ISL_CPP_TRY { + (data->func)(manage(arg_0)); return isl_stat_ok; - } catch (...) { + } ISL_CPP_CATCH_ALL { data->eptr = std::current_exception(); return isl_stat_error; } @@ -13390,133 +13513,133 @@ void pw_aff_list::foreach(const std::function &fn) const if (fn_data.eptr) std::rethrow_exception(fn_data.eptr); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return void(res); } -isl::pw_aff pw_aff_list::get_at(int index) const +pw_aff pw_aff_list::get_at(int index) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_list_get_at(get(), index); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff_list pw_aff_list::reverse() const +pw_aff_list pw_aff_list::reverse() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_list_reverse(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } int pw_aff_list::size() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_list_size(get()); return res; } // implementations for isl::pw_multi_aff -isl::pw_multi_aff manage(__isl_take isl_pw_multi_aff *ptr) { +pw_multi_aff manage(__isl_take isl_pw_multi_aff *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return pw_multi_aff(ptr); } -isl::pw_multi_aff manage_copy(__isl_keep isl_pw_multi_aff *ptr) { +pw_multi_aff manage_copy(__isl_keep isl_pw_multi_aff *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_pw_multi_aff_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_pw_multi_aff_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return pw_multi_aff(ptr); } pw_multi_aff::pw_multi_aff() : ptr(nullptr) {} -pw_multi_aff::pw_multi_aff(const isl::pw_multi_aff &obj) - : ptr(obj.copy()) +pw_multi_aff::pw_multi_aff(const pw_multi_aff &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_pw_multi_aff_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_pw_multi_aff_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } pw_multi_aff::pw_multi_aff(__isl_take isl_pw_multi_aff *ptr) : ptr(ptr) {} -pw_multi_aff::pw_multi_aff(isl::multi_aff ma) +pw_multi_aff::pw_multi_aff(multi_aff ma) { if (ma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = ma.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_multi_aff_from_multi_aff(ma.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -pw_multi_aff::pw_multi_aff(isl::pw_aff pa) +pw_multi_aff::pw_multi_aff(pw_aff pa) { if (pa.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = pa.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_multi_aff_from_pw_aff(pa.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -pw_multi_aff::pw_multi_aff(isl::set domain, isl::multi_val mv) +pw_multi_aff::pw_multi_aff(set domain, multi_val mv) { if (domain.is_null() || mv.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = domain.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_multi_aff_multi_val_on_domain(domain.release(), mv.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -pw_multi_aff::pw_multi_aff(isl::map map) +pw_multi_aff::pw_multi_aff(map map) { if (map.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = map.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_multi_aff_from_map(map.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -pw_multi_aff::pw_multi_aff(isl::ctx ctx, const std::string &str) +pw_multi_aff::pw_multi_aff(ctx ctx, const std::string &str) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_multi_aff_read_from_str(ctx.release(), str.c_str()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -pw_multi_aff &pw_multi_aff::operator=(isl::pw_multi_aff obj) { +pw_multi_aff &pw_multi_aff::operator=(pw_multi_aff obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -13568,62 +13691,62 @@ std::string pw_multi_aff::to_str() const { } -isl::ctx pw_multi_aff::get_ctx() const { - return isl::ctx(isl_pw_multi_aff_get_ctx(ptr)); +ctx pw_multi_aff::get_ctx() const { + return ctx(isl_pw_multi_aff_get_ctx(ptr)); } -isl::pw_multi_aff pw_multi_aff::add(isl::pw_multi_aff pma2) const +pw_multi_aff pw_multi_aff::add(pw_multi_aff pma2) const { if (!ptr || pma2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_multi_aff_add(copy(), pma2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set pw_multi_aff::domain() const +set pw_multi_aff::domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_multi_aff_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_multi_aff pw_multi_aff::flat_range_product(isl::pw_multi_aff pma2) const +pw_multi_aff pw_multi_aff::flat_range_product(pw_multi_aff pma2) const { if (!ptr || pma2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_multi_aff_flat_range_product(copy(), pma2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -void pw_multi_aff::foreach_piece(const std::function &fn) const +void pw_multi_aff::foreach_piece(const std::function &fn) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); struct fn_data { - std::function func; + std::function func; std::exception_ptr eptr; } fn_data = { fn }; auto fn_lambda = [](isl_set *arg_0, isl_multi_aff *arg_1, void *arg_2) -> isl_stat { auto *data = static_cast(arg_2); - try { - (data->func)(isl::manage(arg_0), isl::manage(arg_1)); + ISL_CPP_TRY { + (data->func)(manage(arg_0), manage(arg_1)); return isl_stat_ok; - } catch (...) { + } ISL_CPP_CATCH_ALL { data->eptr = std::current_exception(); return isl_stat_error; } @@ -13632,267 +13755,269 @@ void pw_multi_aff::foreach_piece(const std::functionptr, obj.ptr); return *this; } @@ -13940,172 +14065,175 @@ std::string schedule::to_str() const { } -isl::ctx schedule::get_ctx() const { - return isl::ctx(isl_schedule_get_ctx(ptr)); +ctx schedule::get_ctx() const { + return ctx(isl_schedule_get_ctx(ptr)); } -isl::schedule schedule::from_domain(isl::union_set domain) +schedule schedule::from_domain(union_set domain) { if (domain.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = domain.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_from_domain(domain.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set schedule::get_domain() const +union_set schedule::get_domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_get_domain(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map schedule::get_map() const +union_map schedule::get_map() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_get_map(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::schedule_node schedule::get_root() const +schedule_node schedule::get_root() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_get_root(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::schedule schedule::insert_partial_schedule(isl::multi_union_pw_aff partial) const +schedule schedule::insert_partial_schedule(multi_union_pw_aff partial) const { if (!ptr || partial.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_insert_partial_schedule(copy(), partial.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -bool schedule::plain_is_equal(const isl::schedule &schedule2) const +bool schedule::plain_is_equal(const schedule &schedule2) const { if (!ptr || schedule2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_plain_is_equal(get(), schedule2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -isl::schedule schedule::pullback(isl::union_pw_multi_aff upma) const +schedule schedule::pullback(union_pw_multi_aff upma) const { if (!ptr || upma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_pullback_union_pw_multi_aff(copy(), upma.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::schedule schedule::reset_user() const +schedule schedule::reset_user() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_reset_user(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::schedule schedule::sequence(isl::schedule schedule2) const +schedule schedule::sequence(schedule schedule2) const { if (!ptr || schedule2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_sequence(copy(), schedule2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::schedule schedule::set(isl::schedule schedule2) const +schedule schedule::set(schedule schedule2) const { if (!ptr || schedule2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_set(copy(), schedule2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } // implementations for isl::schedule_constraints -isl::schedule_constraints manage(__isl_take isl_schedule_constraints *ptr) { +schedule_constraints manage(__isl_take isl_schedule_constraints *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return schedule_constraints(ptr); } -isl::schedule_constraints manage_copy(__isl_keep isl_schedule_constraints *ptr) { +schedule_constraints manage_copy(__isl_keep isl_schedule_constraints *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_schedule_constraints_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_schedule_constraints_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return schedule_constraints(ptr); } schedule_constraints::schedule_constraints() : ptr(nullptr) {} -schedule_constraints::schedule_constraints(const isl::schedule_constraints &obj) - : ptr(obj.copy()) +schedule_constraints::schedule_constraints(const schedule_constraints &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_schedule_constraints_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_schedule_constraints_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } schedule_constraints::schedule_constraints(__isl_take isl_schedule_constraints *ptr) : ptr(ptr) {} -schedule_constraints::schedule_constraints(isl::ctx ctx, const std::string &str) +schedule_constraints::schedule_constraints(ctx ctx, const std::string &str) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_constraints_read_from_str(ctx.release(), str.c_str()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -schedule_constraints &schedule_constraints::operator=(isl::schedule_constraints obj) { +schedule_constraints &schedule_constraints::operator=(schedule_constraints obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -14153,248 +14281,251 @@ std::string schedule_constraints::to_str() const { } -isl::ctx schedule_constraints::get_ctx() const { - return isl::ctx(isl_schedule_constraints_get_ctx(ptr)); +ctx schedule_constraints::get_ctx() const { + return ctx(isl_schedule_constraints_get_ctx(ptr)); } -isl::schedule schedule_constraints::compute_schedule() const +schedule schedule_constraints::compute_schedule() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_constraints_compute_schedule(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map schedule_constraints::get_coincidence() const +union_map schedule_constraints::get_coincidence() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_constraints_get_coincidence(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map schedule_constraints::get_conditional_validity() const +union_map schedule_constraints::get_conditional_validity() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_constraints_get_conditional_validity(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map schedule_constraints::get_conditional_validity_condition() const +union_map schedule_constraints::get_conditional_validity_condition() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_constraints_get_conditional_validity_condition(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set schedule_constraints::get_context() const +set schedule_constraints::get_context() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_constraints_get_context(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set schedule_constraints::get_domain() const +union_set schedule_constraints::get_domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_constraints_get_domain(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff schedule_constraints::get_prefix() const +multi_union_pw_aff schedule_constraints::get_prefix() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_constraints_get_prefix(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map schedule_constraints::get_proximity() const +union_map schedule_constraints::get_proximity() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_constraints_get_proximity(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map schedule_constraints::get_validity() const +union_map schedule_constraints::get_validity() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_constraints_get_validity(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::schedule_constraints schedule_constraints::intersect_domain(isl::union_set domain) const +schedule_constraints schedule_constraints::intersect_domain(union_set domain) const { if (!ptr || domain.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_constraints_intersect_domain(copy(), domain.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::schedule_constraints schedule_constraints::on_domain(isl::union_set domain) +schedule_constraints schedule_constraints::on_domain(union_set domain) { if (domain.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = domain.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_constraints_on_domain(domain.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::schedule_constraints schedule_constraints::set_coincidence(isl::union_map coincidence) const +schedule_constraints schedule_constraints::set_coincidence(union_map coincidence) const { if (!ptr || coincidence.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_constraints_set_coincidence(copy(), coincidence.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::schedule_constraints schedule_constraints::set_conditional_validity(isl::union_map condition, isl::union_map validity) const +schedule_constraints schedule_constraints::set_conditional_validity(union_map condition, union_map validity) const { if (!ptr || condition.is_null() || validity.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_constraints_set_conditional_validity(copy(), condition.release(), validity.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::schedule_constraints schedule_constraints::set_context(isl::set context) const +schedule_constraints schedule_constraints::set_context(set context) const { if (!ptr || context.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_constraints_set_context(copy(), context.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::schedule_constraints schedule_constraints::set_prefix(isl::multi_union_pw_aff prefix) const +schedule_constraints schedule_constraints::set_prefix(multi_union_pw_aff prefix) const { if (!ptr || prefix.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_constraints_set_prefix(copy(), prefix.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::schedule_constraints schedule_constraints::set_proximity(isl::union_map proximity) const +schedule_constraints schedule_constraints::set_proximity(union_map proximity) const { if (!ptr || proximity.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_constraints_set_proximity(copy(), proximity.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::schedule_constraints schedule_constraints::set_validity(isl::union_map validity) const +schedule_constraints schedule_constraints::set_validity(union_map validity) const { if (!ptr || validity.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_constraints_set_validity(copy(), validity.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } // implementations for isl::schedule_node -isl::schedule_node manage(__isl_take isl_schedule_node *ptr) { +schedule_node manage(__isl_take isl_schedule_node *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return schedule_node(ptr); } -isl::schedule_node manage_copy(__isl_keep isl_schedule_node *ptr) { +schedule_node manage_copy(__isl_keep isl_schedule_node *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_schedule_node_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_schedule_node_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return schedule_node(ptr); } schedule_node::schedule_node() : ptr(nullptr) {} -schedule_node::schedule_node(const isl::schedule_node &obj) - : ptr(obj.copy()) +schedule_node::schedule_node(const schedule_node &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_schedule_node_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_schedule_node_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } schedule_node::schedule_node(__isl_take isl_schedule_node *ptr) : ptr(ptr) {} -schedule_node &schedule_node::operator=(isl::schedule_node obj) { +schedule_node &schedule_node::operator=(schedule_node obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -14450,8 +14581,7 @@ template bool schedule_node::isa() { if (is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return isl_schedule_node_get_type(get()) == T::type; } template @@ -14460,74 +14590,74 @@ T schedule_node::as() return isa() ? T(copy()) : T(); } -isl::ctx schedule_node::get_ctx() const { - return isl::ctx(isl_schedule_node_get_ctx(ptr)); +ctx schedule_node::get_ctx() const { + return ctx(isl_schedule_node_get_ctx(ptr)); } -isl::schedule_node schedule_node::ancestor(int generation) const +schedule_node schedule_node::ancestor(int generation) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_ancestor(copy(), generation); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::schedule_node schedule_node::child(int pos) const +schedule_node schedule_node::child(int pos) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_child(copy(), pos); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::schedule_node schedule_node::cut() const +schedule_node schedule_node::cut() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_cut(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::schedule_node schedule_node::del() const +schedule_node schedule_node::del() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_delete(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -bool schedule_node::every_descendant(const std::function &test) const +bool schedule_node::every_descendant(const std::function &test) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); struct test_data { - std::function func; + std::function func; std::exception_ptr eptr; } test_data = { test }; auto test_lambda = [](isl_schedule_node *arg_0, void *arg_1) -> isl_bool { auto *data = static_cast(arg_1); - try { - auto ret = (data->func)(isl::manage_copy(arg_0)); + ISL_CPP_TRY { + auto ret = (data->func)(manage_copy(arg_0)); return ret ? isl_bool_true : isl_bool_false; - } catch (...) { + } ISL_CPP_CATCH_ALL { data->eptr = std::current_exception(); return isl_bool_error; } @@ -14536,38 +14666,38 @@ bool schedule_node::every_descendant(const std::function &fn) const +void schedule_node::foreach_descendant_top_down(const std::function &fn) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); struct fn_data { - std::function func; + std::function func; std::exception_ptr eptr; } fn_data = { fn }; auto fn_lambda = [](isl_schedule_node *arg_0, void *arg_1) -> isl_bool { auto *data = static_cast(arg_1); - try { - auto ret = (data->func)(isl::manage_copy(arg_0)); + ISL_CPP_TRY { + auto ret = (data->func)(manage_copy(arg_0)); return ret ? isl_bool_true : isl_bool_false; - } catch (...) { + } ISL_CPP_CATCH_ALL { data->eptr = std::current_exception(); return isl_bool_error; } @@ -14576,380 +14706,378 @@ void schedule_node::foreach_descendant_top_down(const std::function &fn) const +schedule_node schedule_node::map_descendant_bottom_up(const std::function &fn) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); struct fn_data { - std::function func; + std::function func; std::exception_ptr eptr; } fn_data = { fn }; auto fn_lambda = [](isl_schedule_node *arg_0, void *arg_1) -> isl_schedule_node * { auto *data = static_cast(arg_1); - try { - auto ret = (data->func)(isl::manage(arg_0)); + ISL_CPP_TRY { + auto ret = (data->func)(manage(arg_0)); return ret.release(); - } catch (...) { + } ISL_CPP_CATCH_ALL { data->eptr = std::current_exception(); return NULL; } @@ -14958,89 +15086,89 @@ isl::schedule_node schedule_node::map_descendant_bottom_up(const std::functionptr, obj.ptr); return *this; } @@ -15085,306 +15213,306 @@ std::string schedule_node_band::to_str() const { } -isl::ctx schedule_node_band::get_ctx() const { - return isl::ctx(isl_schedule_node_get_ctx(ptr)); +ctx schedule_node_band::get_ctx() const { + return ctx(isl_schedule_node_get_ctx(ptr)); } -isl::union_set schedule_node_band::get_ast_build_options() const +union_set schedule_node_band::get_ast_build_options() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_band_get_ast_build_options(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set schedule_node_band::get_ast_isolate_option() const +set schedule_node_band::get_ast_isolate_option() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_band_get_ast_isolate_option(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff schedule_node_band::get_partial_schedule() const +multi_union_pw_aff schedule_node_band::get_partial_schedule() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_band_get_partial_schedule(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map schedule_node_band::get_partial_schedule_union_map() const +union_map schedule_node_band::get_partial_schedule_union_map() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_band_get_partial_schedule_union_map(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } bool schedule_node_band::get_permutable() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_band_get_permutable(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -isl::space schedule_node_band::get_space() const +space schedule_node_band::get_space() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_band_get_space(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } bool schedule_node_band::member_get_coincident(int pos) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_band_member_get_coincident(get(), pos); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -isl::schedule_node_band schedule_node_band::member_set_coincident(int pos, int coincident) const +schedule_node_band schedule_node_band::member_set_coincident(int pos, int coincident) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_band_member_set_coincident(copy(), pos, coincident); if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res).as(); + exception::throw_last_error(ctx); + return manage(res).as(); } -isl::schedule_node_band schedule_node_band::mod(isl::multi_val mv) const +schedule_node_band schedule_node_band::mod(multi_val mv) const { if (!ptr || mv.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_band_mod(copy(), mv.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res).as(); + exception::throw_last_error(ctx); + return manage(res).as(); } unsigned int schedule_node_band::n_member() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_band_n_member(get()); return res; } -isl::schedule_node_band schedule_node_band::scale(isl::multi_val mv) const +schedule_node_band schedule_node_band::scale(multi_val mv) const { if (!ptr || mv.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_band_scale(copy(), mv.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res).as(); + exception::throw_last_error(ctx); + return manage(res).as(); } -isl::schedule_node_band schedule_node_band::scale_down(isl::multi_val mv) const +schedule_node_band schedule_node_band::scale_down(multi_val mv) const { if (!ptr || mv.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_band_scale_down(copy(), mv.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res).as(); + exception::throw_last_error(ctx); + return manage(res).as(); } -isl::schedule_node_band schedule_node_band::set_ast_build_options(isl::union_set options) const +schedule_node_band schedule_node_band::set_ast_build_options(union_set options) const { if (!ptr || options.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_band_set_ast_build_options(copy(), options.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res).as(); + exception::throw_last_error(ctx); + return manage(res).as(); } -isl::schedule_node_band schedule_node_band::set_permutable(int permutable) const +schedule_node_band schedule_node_band::set_permutable(int permutable) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_band_set_permutable(copy(), permutable); if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res).as(); + exception::throw_last_error(ctx); + return manage(res).as(); } -isl::schedule_node_band schedule_node_band::shift(isl::multi_union_pw_aff shift) const +schedule_node_band schedule_node_band::shift(multi_union_pw_aff shift) const { if (!ptr || shift.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_band_shift(copy(), shift.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res).as(); + exception::throw_last_error(ctx); + return manage(res).as(); } -isl::schedule_node_band schedule_node_band::split(int pos) const +schedule_node_band schedule_node_band::split(int pos) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_band_split(copy(), pos); if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res).as(); + exception::throw_last_error(ctx); + return manage(res).as(); } -isl::schedule_node_band schedule_node_band::tile(isl::multi_val sizes) const +schedule_node_band schedule_node_band::tile(multi_val sizes) const { if (!ptr || sizes.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_band_tile(copy(), sizes.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res).as(); + exception::throw_last_error(ctx); + return manage(res).as(); } -isl::schedule_node_band schedule_node_band::member_set_ast_loop_default(int pos) const +schedule_node_band schedule_node_band::member_set_ast_loop_default(int pos) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_band_member_set_ast_loop_type(copy(), pos, isl_ast_loop_default); if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res).as(); + exception::throw_last_error(ctx); + return manage(res).as(); } -isl::schedule_node_band schedule_node_band::member_set_ast_loop_atomic(int pos) const +schedule_node_band schedule_node_band::member_set_ast_loop_atomic(int pos) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_band_member_set_ast_loop_type(copy(), pos, isl_ast_loop_atomic); if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res).as(); + exception::throw_last_error(ctx); + return manage(res).as(); } -isl::schedule_node_band schedule_node_band::member_set_ast_loop_unroll(int pos) const +schedule_node_band schedule_node_band::member_set_ast_loop_unroll(int pos) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_band_member_set_ast_loop_type(copy(), pos, isl_ast_loop_unroll); if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res).as(); + exception::throw_last_error(ctx); + return manage(res).as(); } -isl::schedule_node_band schedule_node_band::member_set_ast_loop_separate(int pos) const +schedule_node_band schedule_node_band::member_set_ast_loop_separate(int pos) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_band_member_set_ast_loop_type(copy(), pos, isl_ast_loop_separate); if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res).as(); + exception::throw_last_error(ctx); + return manage(res).as(); } -isl::schedule_node_band schedule_node_band::member_set_isolate_ast_loop_default(int pos) const +schedule_node_band schedule_node_band::member_set_isolate_ast_loop_default(int pos) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_band_member_set_isolate_ast_loop_type(copy(), pos, isl_ast_loop_default); if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res).as(); + exception::throw_last_error(ctx); + return manage(res).as(); } -isl::schedule_node_band schedule_node_band::member_set_isolate_ast_loop_atomic(int pos) const +schedule_node_band schedule_node_band::member_set_isolate_ast_loop_atomic(int pos) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_band_member_set_isolate_ast_loop_type(copy(), pos, isl_ast_loop_atomic); if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res).as(); + exception::throw_last_error(ctx); + return manage(res).as(); } -isl::schedule_node_band schedule_node_band::member_set_isolate_ast_loop_unroll(int pos) const +schedule_node_band schedule_node_band::member_set_isolate_ast_loop_unroll(int pos) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_band_member_set_isolate_ast_loop_type(copy(), pos, isl_ast_loop_unroll); if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res).as(); + exception::throw_last_error(ctx); + return manage(res).as(); } -isl::schedule_node_band schedule_node_band::member_set_isolate_ast_loop_separate(int pos) const +schedule_node_band schedule_node_band::member_set_isolate_ast_loop_separate(int pos) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_band_member_set_isolate_ast_loop_type(copy(), pos, isl_ast_loop_separate); if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res).as(); + exception::throw_last_error(ctx); + return manage(res).as(); } // implementations for isl::schedule_node_context @@ -15392,7 +15520,7 @@ isl::schedule_node_band schedule_node_band::member_set_isolate_ast_loop_separate schedule_node_context::schedule_node_context() : schedule_node() {} -schedule_node_context::schedule_node_context(const isl::schedule_node_context &obj) +schedule_node_context::schedule_node_context(const schedule_node_context &obj) : schedule_node(obj) { } @@ -15401,7 +15529,7 @@ schedule_node_context::schedule_node_context(__isl_take isl_schedule_node *ptr) : schedule_node(ptr) {} -schedule_node_context &schedule_node_context::operator=(isl::schedule_node_context obj) { +schedule_node_context &schedule_node_context::operator=(schedule_node_context obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -15428,19 +15556,19 @@ std::string schedule_node_context::to_str() const { } -isl::ctx schedule_node_context::get_ctx() const { - return isl::ctx(isl_schedule_node_get_ctx(ptr)); +ctx schedule_node_context::get_ctx() const { + return ctx(isl_schedule_node_get_ctx(ptr)); } -isl::set schedule_node_context::get_context() const +set schedule_node_context::get_context() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_context_get_context(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } @@ -15449,7 +15577,7 @@ isl::set schedule_node_context::get_context() const schedule_node_domain::schedule_node_domain() : schedule_node() {} -schedule_node_domain::schedule_node_domain(const isl::schedule_node_domain &obj) +schedule_node_domain::schedule_node_domain(const schedule_node_domain &obj) : schedule_node(obj) { } @@ -15458,7 +15586,7 @@ schedule_node_domain::schedule_node_domain(__isl_take isl_schedule_node *ptr) : schedule_node(ptr) {} -schedule_node_domain &schedule_node_domain::operator=(isl::schedule_node_domain obj) { +schedule_node_domain &schedule_node_domain::operator=(schedule_node_domain obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -15485,19 +15613,19 @@ std::string schedule_node_domain::to_str() const { } -isl::ctx schedule_node_domain::get_ctx() const { - return isl::ctx(isl_schedule_node_get_ctx(ptr)); +ctx schedule_node_domain::get_ctx() const { + return ctx(isl_schedule_node_get_ctx(ptr)); } -isl::union_set schedule_node_domain::get_domain() const +union_set schedule_node_domain::get_domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_domain_get_domain(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } @@ -15506,7 +15634,7 @@ isl::union_set schedule_node_domain::get_domain() const schedule_node_expansion::schedule_node_expansion() : schedule_node() {} -schedule_node_expansion::schedule_node_expansion(const isl::schedule_node_expansion &obj) +schedule_node_expansion::schedule_node_expansion(const schedule_node_expansion &obj) : schedule_node(obj) { } @@ -15515,7 +15643,7 @@ schedule_node_expansion::schedule_node_expansion(__isl_take isl_schedule_node *p : schedule_node(ptr) {} -schedule_node_expansion &schedule_node_expansion::operator=(isl::schedule_node_expansion obj) { +schedule_node_expansion &schedule_node_expansion::operator=(schedule_node_expansion obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -15542,31 +15670,31 @@ std::string schedule_node_expansion::to_str() const { } -isl::ctx schedule_node_expansion::get_ctx() const { - return isl::ctx(isl_schedule_node_get_ctx(ptr)); +ctx schedule_node_expansion::get_ctx() const { + return ctx(isl_schedule_node_get_ctx(ptr)); } -isl::union_pw_multi_aff schedule_node_expansion::get_contraction() const +union_pw_multi_aff schedule_node_expansion::get_contraction() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_expansion_get_contraction(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map schedule_node_expansion::get_expansion() const +union_map schedule_node_expansion::get_expansion() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_expansion_get_expansion(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } @@ -15575,7 +15703,7 @@ isl::union_map schedule_node_expansion::get_expansion() const schedule_node_extension::schedule_node_extension() : schedule_node() {} -schedule_node_extension::schedule_node_extension(const isl::schedule_node_extension &obj) +schedule_node_extension::schedule_node_extension(const schedule_node_extension &obj) : schedule_node(obj) { } @@ -15584,7 +15712,7 @@ schedule_node_extension::schedule_node_extension(__isl_take isl_schedule_node *p : schedule_node(ptr) {} -schedule_node_extension &schedule_node_extension::operator=(isl::schedule_node_extension obj) { +schedule_node_extension &schedule_node_extension::operator=(schedule_node_extension obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -15611,19 +15739,19 @@ std::string schedule_node_extension::to_str() const { } -isl::ctx schedule_node_extension::get_ctx() const { - return isl::ctx(isl_schedule_node_get_ctx(ptr)); +ctx schedule_node_extension::get_ctx() const { + return ctx(isl_schedule_node_get_ctx(ptr)); } -isl::union_map schedule_node_extension::get_extension() const +union_map schedule_node_extension::get_extension() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_extension_get_extension(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } @@ -15632,7 +15760,7 @@ isl::union_map schedule_node_extension::get_extension() const schedule_node_filter::schedule_node_filter() : schedule_node() {} -schedule_node_filter::schedule_node_filter(const isl::schedule_node_filter &obj) +schedule_node_filter::schedule_node_filter(const schedule_node_filter &obj) : schedule_node(obj) { } @@ -15641,7 +15769,7 @@ schedule_node_filter::schedule_node_filter(__isl_take isl_schedule_node *ptr) : schedule_node(ptr) {} -schedule_node_filter &schedule_node_filter::operator=(isl::schedule_node_filter obj) { +schedule_node_filter &schedule_node_filter::operator=(schedule_node_filter obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -15668,19 +15796,19 @@ std::string schedule_node_filter::to_str() const { } -isl::ctx schedule_node_filter::get_ctx() const { - return isl::ctx(isl_schedule_node_get_ctx(ptr)); +ctx schedule_node_filter::get_ctx() const { + return ctx(isl_schedule_node_get_ctx(ptr)); } -isl::union_set schedule_node_filter::get_filter() const +union_set schedule_node_filter::get_filter() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_filter_get_filter(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } @@ -15689,7 +15817,7 @@ isl::union_set schedule_node_filter::get_filter() const schedule_node_guard::schedule_node_guard() : schedule_node() {} -schedule_node_guard::schedule_node_guard(const isl::schedule_node_guard &obj) +schedule_node_guard::schedule_node_guard(const schedule_node_guard &obj) : schedule_node(obj) { } @@ -15698,7 +15826,7 @@ schedule_node_guard::schedule_node_guard(__isl_take isl_schedule_node *ptr) : schedule_node(ptr) {} -schedule_node_guard &schedule_node_guard::operator=(isl::schedule_node_guard obj) { +schedule_node_guard &schedule_node_guard::operator=(schedule_node_guard obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -15725,19 +15853,19 @@ std::string schedule_node_guard::to_str() const { } -isl::ctx schedule_node_guard::get_ctx() const { - return isl::ctx(isl_schedule_node_get_ctx(ptr)); +ctx schedule_node_guard::get_ctx() const { + return ctx(isl_schedule_node_get_ctx(ptr)); } -isl::set schedule_node_guard::get_guard() const +set schedule_node_guard::get_guard() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_guard_get_guard(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } @@ -15746,7 +15874,7 @@ isl::set schedule_node_guard::get_guard() const schedule_node_leaf::schedule_node_leaf() : schedule_node() {} -schedule_node_leaf::schedule_node_leaf(const isl::schedule_node_leaf &obj) +schedule_node_leaf::schedule_node_leaf(const schedule_node_leaf &obj) : schedule_node(obj) { } @@ -15755,7 +15883,7 @@ schedule_node_leaf::schedule_node_leaf(__isl_take isl_schedule_node *ptr) : schedule_node(ptr) {} -schedule_node_leaf &schedule_node_leaf::operator=(isl::schedule_node_leaf obj) { +schedule_node_leaf &schedule_node_leaf::operator=(schedule_node_leaf obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -15782,8 +15910,8 @@ std::string schedule_node_leaf::to_str() const { } -isl::ctx schedule_node_leaf::get_ctx() const { - return isl::ctx(isl_schedule_node_get_ctx(ptr)); +ctx schedule_node_leaf::get_ctx() const { + return ctx(isl_schedule_node_get_ctx(ptr)); } @@ -15792,7 +15920,7 @@ isl::ctx schedule_node_leaf::get_ctx() const { schedule_node_mark::schedule_node_mark() : schedule_node() {} -schedule_node_mark::schedule_node_mark(const isl::schedule_node_mark &obj) +schedule_node_mark::schedule_node_mark(const schedule_node_mark &obj) : schedule_node(obj) { } @@ -15801,7 +15929,7 @@ schedule_node_mark::schedule_node_mark(__isl_take isl_schedule_node *ptr) : schedule_node(ptr) {} -schedule_node_mark &schedule_node_mark::operator=(isl::schedule_node_mark obj) { +schedule_node_mark &schedule_node_mark::operator=(schedule_node_mark obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -15828,19 +15956,19 @@ std::string schedule_node_mark::to_str() const { } -isl::ctx schedule_node_mark::get_ctx() const { - return isl::ctx(isl_schedule_node_get_ctx(ptr)); +ctx schedule_node_mark::get_ctx() const { + return ctx(isl_schedule_node_get_ctx(ptr)); } -isl::id schedule_node_mark::get_id() const +id schedule_node_mark::get_id() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_mark_get_id(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } @@ -15849,7 +15977,7 @@ isl::id schedule_node_mark::get_id() const schedule_node_sequence::schedule_node_sequence() : schedule_node() {} -schedule_node_sequence::schedule_node_sequence(const isl::schedule_node_sequence &obj) +schedule_node_sequence::schedule_node_sequence(const schedule_node_sequence &obj) : schedule_node(obj) { } @@ -15858,7 +15986,7 @@ schedule_node_sequence::schedule_node_sequence(__isl_take isl_schedule_node *ptr : schedule_node(ptr) {} -schedule_node_sequence &schedule_node_sequence::operator=(isl::schedule_node_sequence obj) { +schedule_node_sequence &schedule_node_sequence::operator=(schedule_node_sequence obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -15885,8 +16013,8 @@ std::string schedule_node_sequence::to_str() const { } -isl::ctx schedule_node_sequence::get_ctx() const { - return isl::ctx(isl_schedule_node_get_ctx(ptr)); +ctx schedule_node_sequence::get_ctx() const { + return ctx(isl_schedule_node_get_ctx(ptr)); } @@ -15895,7 +16023,7 @@ isl::ctx schedule_node_sequence::get_ctx() const { schedule_node_set::schedule_node_set() : schedule_node() {} -schedule_node_set::schedule_node_set(const isl::schedule_node_set &obj) +schedule_node_set::schedule_node_set(const schedule_node_set &obj) : schedule_node(obj) { } @@ -15904,7 +16032,7 @@ schedule_node_set::schedule_node_set(__isl_take isl_schedule_node *ptr) : schedule_node(ptr) {} -schedule_node_set &schedule_node_set::operator=(isl::schedule_node_set obj) { +schedule_node_set &schedule_node_set::operator=(schedule_node_set obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -15931,76 +16059,78 @@ std::string schedule_node_set::to_str() const { } -isl::ctx schedule_node_set::get_ctx() const { - return isl::ctx(isl_schedule_node_get_ctx(ptr)); +ctx schedule_node_set::get_ctx() const { + return ctx(isl_schedule_node_get_ctx(ptr)); } // implementations for isl::set -isl::set manage(__isl_take isl_set *ptr) { +set manage(__isl_take isl_set *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return set(ptr); } -isl::set manage_copy(__isl_keep isl_set *ptr) { +set manage_copy(__isl_keep isl_set *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_set_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_set_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return set(ptr); } set::set() : ptr(nullptr) {} -set::set(const isl::set &obj) - : ptr(obj.copy()) +set::set(const set &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_set_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_set_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } set::set(__isl_take isl_set *ptr) : ptr(ptr) {} -set::set(isl::point pnt) +set::set(point pnt) { if (pnt.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = pnt.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_from_point(pnt.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -set::set(isl::ctx ctx, const std::string &str) +set::set(ctx ctx, const std::string &str) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_read_from_str(ctx.release(), str.c_str()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -set::set(isl::basic_set bset) +set::set(basic_set bset) { if (bset.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = bset.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_from_basic_set(bset.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -set &set::operator=(isl::set obj) { +set &set::operator=(set obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -16052,171 +16182,170 @@ std::string set::to_str() const { } -isl::ctx set::get_ctx() const { - return isl::ctx(isl_set_get_ctx(ptr)); +ctx set::get_ctx() const { + return ctx(isl_set_get_ctx(ptr)); } -isl::basic_set set::affine_hull() const +basic_set set::affine_hull() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_affine_hull(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set set::align_params(isl::space model) const +set set::align_params(space model) const { if (!ptr || model.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_align_params(copy(), model.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set set::apply(isl::map map) const +set set::apply(map map) const { if (!ptr || map.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_apply(copy(), map.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set set::coalesce() const +set set::coalesce() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_coalesce(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set set::complement() const +set set::complement() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_complement(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set set::compute_divs() const +set set::compute_divs() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_compute_divs(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set set::detect_equalities() const +set set::detect_equalities() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_detect_equalities(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff set::dim_max(int pos) const +pw_aff set::dim_max(int pos) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_dim_max(copy(), pos); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff set::dim_min(int pos) const +pw_aff set::dim_min(int pos) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_dim_min(copy(), pos); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set set::empty(isl::space space) +set set::empty(space space) { if (space.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_empty(space.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::set set::flatten() const +set set::flatten() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_flatten(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map set::flatten_map() const +map set::flatten_map() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_flatten_map(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -void set::foreach_basic_set(const std::function &fn) const +void set::foreach_basic_set(const std::function &fn) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); struct fn_data { - std::function func; + std::function func; std::exception_ptr eptr; } fn_data = { fn }; auto fn_lambda = [](isl_basic_set *arg_0, void *arg_1) -> isl_stat { auto *data = static_cast(arg_1); - try { - (data->func)(isl::manage(arg_0)); + ISL_CPP_TRY { + (data->func)(manage(arg_0)); return isl_stat_ok; - } catch (...) { + } ISL_CPP_CATCH_ALL { data->eptr = std::current_exception(); return isl_stat_error; } @@ -16225,329 +16354,327 @@ void set::foreach_basic_set(const std::function &fn) const if (fn_data.eptr) std::rethrow_exception(fn_data.eptr); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return void(res); } -isl::set set::from(isl::multi_aff ma) +set set::from(multi_aff ma) { if (ma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = ma.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_from_multi_aff(ma.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::set set::from_params() const +set set::from_params() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_from_params(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set set::from_union_set(isl::union_set uset) +set set::from_union_set(union_set uset) { if (uset.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = uset.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_from_union_set(uset.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_set_list set::get_basic_set_list() const +basic_set_list set::get_basic_set_list() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_get_basic_set_list(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space set::get_space() const +space set::get_space() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_get_space(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::val set::get_stride(int pos) const +val set::get_stride(int pos) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_get_stride(get(), pos); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::id set::get_tuple_id() const +id set::get_tuple_id() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_get_tuple_id(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } std::string set::get_tuple_name() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_get_tuple_name(get()); std::string tmp(res); return tmp; } -isl::set set::gist(isl::set context) const +set set::gist(set context) const { if (!ptr || context.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_gist(copy(), context.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } bool set::has_tuple_id() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_has_tuple_id(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } bool set::has_tuple_name() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_has_tuple_name(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -isl::map set::identity() const +map set::identity() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_identity(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set set::intersect(isl::set set2) const +set set::intersect(set set2) const { if (!ptr || set2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_intersect(copy(), set2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set set::intersect_params(isl::set params) const +set set::intersect_params(set params) const { if (!ptr || params.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_intersect_params(copy(), params.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -bool set::involves_param(const isl::id &id) const +bool set::involves_param(const id &id) const { if (!ptr || id.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_involves_param_id(get(), id.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -bool set::is_disjoint(const isl::set &set2) const +bool set::is_disjoint(const set &set2) const { if (!ptr || set2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_is_disjoint(get(), set2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } bool set::is_empty() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_is_empty(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -bool set::is_equal(const isl::set &set2) const +bool set::is_equal(const set &set2) const { if (!ptr || set2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_is_equal(get(), set2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } bool set::is_singleton() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_is_singleton(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -bool set::is_strict_subset(const isl::set &set2) const +bool set::is_strict_subset(const set &set2) const { if (!ptr || set2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_is_strict_subset(get(), set2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -bool set::is_subset(const isl::set &set2) const +bool set::is_subset(const set &set2) const { if (!ptr || set2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_is_subset(get(), set2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } bool set::is_wrapping() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_is_wrapping(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -isl::set set::lexmax() const +set set::lexmax() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_lexmax(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set set::lexmin() const +set set::lexmin() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_lexmin(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::val set::max_val(const isl::aff &obj) const +val set::max_val(const aff &obj) const { if (!ptr || obj.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_max_val(get(), obj.get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::val set::min_val(const isl::aff &obj) const +val set::min_val(const aff &obj) const { if (!ptr || obj.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_min_val(get(), obj.get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } int set::n_basic_set() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_n_basic_set(get()); return res; } @@ -16555,9 +16682,9 @@ int set::n_basic_set() const unsigned int set::n_dim() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_n_dim(get()); return res; } @@ -16565,308 +16692,309 @@ unsigned int set::n_dim() const unsigned int set::n_param() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_n_param(get()); return res; } -isl::set set::nat_universe(isl::space dim) +set set::nat_universe(space dim) { if (dim.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = dim.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_nat_universe(dim.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::set set::params() const +set set::params() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_params(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } bool set::plain_is_universe() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_plain_is_universe(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -isl::basic_set set::polyhedral_hull() const +basic_set set::polyhedral_hull() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_polyhedral_hull(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set set::preimage_multi_aff(isl::multi_aff ma) const +set set::preimage_multi_aff(multi_aff ma) const { if (!ptr || ma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_preimage_multi_aff(copy(), ma.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set set::product(isl::set set2) const +set set::product(set set2) const { if (!ptr || set2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_product(copy(), set2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set set::reset_tuple_id() const +set set::reset_tuple_id() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_reset_tuple_id(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_set set::sample() const +basic_set set::sample() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_sample(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::point set::sample_point() const +point set::sample_point() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_sample_point(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set set::set_tuple_id(isl::id id) const +set set::set_tuple_id(id id) const { if (!ptr || id.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_set_tuple_id(copy(), id.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set set::set_tuple_name(const std::string &s) const +set set::set_tuple_name(const std::string &s) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_set_tuple_name(copy(), s.c_str()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_set set::simple_hull() const +basic_set set::simple_hull() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_simple_hull(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set set::subtract(isl::set set2) const +set set::subtract(set set2) const { if (!ptr || set2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_subtract(copy(), set2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set set::unbind_params(isl::multi_id tuple) const +set set::unbind_params(multi_id tuple) const { if (!ptr || tuple.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_unbind_params(copy(), tuple.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map set::unbind_params_insert_domain(isl::multi_id domain) const +map set::unbind_params_insert_domain(multi_id domain) const { if (!ptr || domain.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_unbind_params_insert_domain(copy(), domain.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set set::unite(isl::set set2) const +set set::unite(set set2) const { if (!ptr || set2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_union(copy(), set2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set set::universe(isl::space space) +set set::universe(space space) { if (space.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_universe(space.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_set set::unshifted_simple_hull() const +basic_set set::unshifted_simple_hull() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_unshifted_simple_hull(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map set::unwrap() const +map set::unwrap() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_unwrap(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map set::wrapped_domain_map() const +map set::wrapped_domain_map() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_wrapped_domain_map(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } // implementations for isl::set_list -isl::set_list manage(__isl_take isl_set_list *ptr) { +set_list manage(__isl_take isl_set_list *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return set_list(ptr); } -isl::set_list manage_copy(__isl_keep isl_set_list *ptr) { +set_list manage_copy(__isl_keep isl_set_list *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_set_list_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_set_list_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return set_list(ptr); } set_list::set_list() : ptr(nullptr) {} -set_list::set_list(const isl::set_list &obj) - : ptr(obj.copy()) +set_list::set_list(const set_list &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_set_list_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_set_list_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } set_list::set_list(__isl_take isl_set_list *ptr) : ptr(ptr) {} -set_list::set_list(isl::set el) +set_list::set_list(set el) { if (el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = el.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_list_from_set(el.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -set_list::set_list(isl::ctx ctx, int n) +set_list::set_list(ctx ctx, int n) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_list_alloc(ctx.release(), n); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -set_list &set_list::operator=(isl::set_list obj) { +set_list &set_list::operator=(set_list obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -16900,62 +17028,62 @@ set_list::operator bool() const -isl::ctx set_list::get_ctx() const { - return isl::ctx(isl_set_list_get_ctx(ptr)); +ctx set_list::get_ctx() const { + return ctx(isl_set_list_get_ctx(ptr)); } -isl::set_list set_list::add(isl::set el) const +set_list set_list::add(set el) const { if (!ptr || el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_list_add(copy(), el.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set_list set_list::concat(isl::set_list list2) const +set_list set_list::concat(set_list list2) const { if (!ptr || list2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_list_concat(copy(), list2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set_list set_list::drop(unsigned int first, unsigned int n) const +set_list set_list::drop(unsigned int first, unsigned int n) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_list_drop(copy(), first, n); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -void set_list::foreach(const std::function &fn) const +void set_list::foreach(const std::function &fn) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); struct fn_data { - std::function func; + std::function func; std::exception_ptr eptr; } fn_data = { fn }; auto fn_lambda = [](isl_set *arg_0, void *arg_1) -> isl_stat { auto *data = static_cast(arg_1); - try { - (data->func)(isl::manage(arg_0)); + ISL_CPP_TRY { + (data->func)(manage(arg_0)); return isl_stat_ok; - } catch (...) { + } ISL_CPP_CATCH_ALL { data->eptr = std::current_exception(); return isl_stat_error; } @@ -16964,101 +17092,105 @@ void set_list::foreach(const std::function &fn) const if (fn_data.eptr) std::rethrow_exception(fn_data.eptr); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return void(res); } -isl::set set_list::get_at(int index) const +set set_list::get_at(int index) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_list_get_at(get(), index); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set_list set_list::reverse() const +set_list set_list::reverse() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_list_reverse(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } int set_list::size() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_list_size(get()); return res; } // implementations for isl::space -isl::space manage(__isl_take isl_space *ptr) { +space manage(__isl_take isl_space *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return space(ptr); } -isl::space manage_copy(__isl_keep isl_space *ptr) { +space manage_copy(__isl_keep isl_space *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_space_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_space_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return space(ptr); } space::space() : ptr(nullptr) {} -space::space(const isl::space &obj) - : ptr(obj.copy()) +space::space(const space &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_space_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_space_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } space::space(__isl_take isl_space *ptr) : ptr(ptr) {} -space::space(isl::ctx ctx, unsigned int nparam, unsigned int n_in, unsigned int n_out) +space::space(ctx ctx, unsigned int nparam, unsigned int n_in, unsigned int n_out) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_alloc(ctx.release(), nparam, n_in, n_out); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -space::space(isl::ctx ctx, unsigned int nparam, unsigned int dim) +space::space(ctx ctx, unsigned int nparam, unsigned int dim) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_set_alloc(ctx.release(), nparam, dim); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -space::space(isl::ctx ctx, unsigned int nparam) +space::space(ctx ctx, unsigned int nparam) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_params_alloc(ctx.release(), nparam); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -space &space::operator=(isl::space obj) { +space &space::operator=(space obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -17110,427 +17242,431 @@ std::string space::to_str() const { } -isl::ctx space::get_ctx() const { - return isl::ctx(isl_space_get_ctx(ptr)); +ctx space::get_ctx() const { + return ctx(isl_space_get_ctx(ptr)); } -isl::space space::add_named_tuple_id_ui(isl::id tuple_id, unsigned int dim) const +space space::add_named_tuple_id_ui(id tuple_id, unsigned int dim) const { if (!ptr || tuple_id.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_add_named_tuple_id_ui(copy(), tuple_id.release(), dim); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space space::add_param(isl::id id) const +space space::add_param(id id) const { if (!ptr || id.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_add_param_id(copy(), id.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space space::add_unnamed_tuple_ui(unsigned int dim) const +space space::add_unnamed_tuple_ui(unsigned int dim) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_add_unnamed_tuple_ui(copy(), dim); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space space::align_params(isl::space dim2) const +space space::align_params(space dim2) const { if (!ptr || dim2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_align_params(copy(), dim2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } bool space::can_curry() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_can_curry(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } bool space::can_uncurry() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_can_uncurry(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -isl::space space::curry() const +space space::curry() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_curry(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space space::domain() const +space space::domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space space::domain_map() const +space space::domain_map() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_domain_map(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space space::domain_product(isl::space right) const +space space::domain_product(space right) const { if (!ptr || right.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_domain_product(copy(), right.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space space::from_domain() const +space space::from_domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_from_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space space::from_range() const +space space::from_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_from_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::id space::get_map_range_tuple_id() const +id space::get_map_range_tuple_id() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_get_map_range_tuple_id(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -bool space::has_equal_params(const isl::space &space2) const +bool space::has_equal_params(const space &space2) const { if (!ptr || space2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_has_equal_params(get(), space2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -bool space::has_equal_tuples(const isl::space &space2) const +bool space::has_equal_tuples(const space &space2) const { if (!ptr || space2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_has_equal_tuples(get(), space2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -bool space::has_param(const isl::id &id) const +bool space::has_param(const id &id) const { if (!ptr || id.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_has_param_id(get(), id.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -bool space::is_equal(const isl::space &space2) const +bool space::is_equal(const space &space2) const { if (!ptr || space2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_is_equal(get(), space2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } bool space::is_params() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_is_params(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } bool space::is_set() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_is_set(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } bool space::is_wrapping() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_is_wrapping(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -isl::space space::map_from_domain_and_range(isl::space range) const +space space::map_from_domain_and_range(space range) const { if (!ptr || range.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_map_from_domain_and_range(copy(), range.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space space::map_from_set() const +space space::map_from_set() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_map_from_set(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space space::params() const +space space::params() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_params(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space space::product(isl::space right) const +space space::product(space right) const { if (!ptr || right.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_product(copy(), right.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space space::range() const +space space::range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space space::range_map() const +space space::range_map() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_range_map(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space space::range_product(isl::space right) const +space space::range_product(space right) const { if (!ptr || right.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_range_product(copy(), right.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space space::set_from_params() const +space space::set_from_params() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_set_from_params(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space space::set_set_tuple_id(isl::id id) const +space space::set_set_tuple_id(id id) const { if (!ptr || id.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_set_set_tuple_id(copy(), id.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space space::uncurry() const +space space::uncurry() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_uncurry(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space space::unwrap() const +space space::unwrap() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_unwrap(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space space::wrap() const +space space::wrap() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_wrap(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } // implementations for isl::stride_info -isl::stride_info manage(__isl_take isl_stride_info *ptr) { +stride_info manage(__isl_take isl_stride_info *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return stride_info(ptr); } -isl::stride_info manage_copy(__isl_keep isl_stride_info *ptr) { +stride_info manage_copy(__isl_keep isl_stride_info *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_stride_info_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_stride_info_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return stride_info(ptr); } stride_info::stride_info() : ptr(nullptr) {} -stride_info::stride_info(const isl::stride_info &obj) - : ptr(obj.copy()) +stride_info::stride_info(const stride_info &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_stride_info_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_stride_info_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } stride_info::stride_info(__isl_take isl_stride_info *ptr) : ptr(ptr) {} -stride_info &stride_info::operator=(isl::stride_info obj) { +stride_info &stride_info::operator=(stride_info obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -17564,79 +17700,82 @@ stride_info::operator bool() const -isl::ctx stride_info::get_ctx() const { - return isl::ctx(isl_stride_info_get_ctx(ptr)); +ctx stride_info::get_ctx() const { + return ctx(isl_stride_info_get_ctx(ptr)); } -isl::aff stride_info::get_offset() const +aff stride_info::get_offset() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_stride_info_get_offset(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::val stride_info::get_stride() const +val stride_info::get_stride() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_stride_info_get_stride(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } // implementations for isl::union_access_info -isl::union_access_info manage(__isl_take isl_union_access_info *ptr) { +union_access_info manage(__isl_take isl_union_access_info *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return union_access_info(ptr); } -isl::union_access_info manage_copy(__isl_keep isl_union_access_info *ptr) { +union_access_info manage_copy(__isl_keep isl_union_access_info *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_union_access_info_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_union_access_info_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return union_access_info(ptr); } union_access_info::union_access_info() : ptr(nullptr) {} -union_access_info::union_access_info(const isl::union_access_info &obj) - : ptr(obj.copy()) +union_access_info::union_access_info(const union_access_info &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_union_access_info_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_union_access_info_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } union_access_info::union_access_info(__isl_take isl_union_access_info *ptr) : ptr(ptr) {} -union_access_info::union_access_info(isl::union_map sink) +union_access_info::union_access_info(union_map sink) { if (sink.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = sink.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_access_info_from_sink(sink.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -union_access_info &union_access_info::operator=(isl::union_access_info obj) { +union_access_info &union_access_info::operator=(union_access_info obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -17684,115 +17823,119 @@ std::string union_access_info::to_str() const { } -isl::ctx union_access_info::get_ctx() const { - return isl::ctx(isl_union_access_info_get_ctx(ptr)); +ctx union_access_info::get_ctx() const { + return ctx(isl_union_access_info_get_ctx(ptr)); } -isl::union_flow union_access_info::compute_flow() const +union_flow union_access_info::compute_flow() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_access_info_compute_flow(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_access_info union_access_info::set_kill(isl::union_map kill) const +union_access_info union_access_info::set_kill(union_map kill) const { if (!ptr || kill.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_access_info_set_kill(copy(), kill.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_access_info union_access_info::set_may_source(isl::union_map may_source) const +union_access_info union_access_info::set_may_source(union_map may_source) const { if (!ptr || may_source.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_access_info_set_may_source(copy(), may_source.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_access_info union_access_info::set_must_source(isl::union_map must_source) const +union_access_info union_access_info::set_must_source(union_map must_source) const { if (!ptr || must_source.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_access_info_set_must_source(copy(), must_source.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_access_info union_access_info::set_schedule(isl::schedule schedule) const +union_access_info union_access_info::set_schedule(schedule schedule) const { if (!ptr || schedule.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_access_info_set_schedule(copy(), schedule.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_access_info union_access_info::set_schedule_map(isl::union_map schedule_map) const +union_access_info union_access_info::set_schedule_map(union_map schedule_map) const { if (!ptr || schedule_map.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_access_info_set_schedule_map(copy(), schedule_map.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } // implementations for isl::union_flow -isl::union_flow manage(__isl_take isl_union_flow *ptr) { +union_flow manage(__isl_take isl_union_flow *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return union_flow(ptr); } -isl::union_flow manage_copy(__isl_keep isl_union_flow *ptr) { +union_flow manage_copy(__isl_keep isl_union_flow *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_union_flow_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_union_flow_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return union_flow(ptr); } union_flow::union_flow() : ptr(nullptr) {} -union_flow::union_flow(const isl::union_flow &obj) - : ptr(obj.copy()) +union_flow::union_flow(const union_flow &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_union_flow_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_union_flow_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } union_flow::union_flow(__isl_take isl_union_flow *ptr) : ptr(ptr) {} -union_flow &union_flow::operator=(isl::union_flow obj) { +union_flow &union_flow::operator=(union_flow obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -17840,147 +17983,149 @@ std::string union_flow::to_str() const { } -isl::ctx union_flow::get_ctx() const { - return isl::ctx(isl_union_flow_get_ctx(ptr)); +ctx union_flow::get_ctx() const { + return ctx(isl_union_flow_get_ctx(ptr)); } -isl::union_map union_flow::get_full_may_dependence() const +union_map union_flow::get_full_may_dependence() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_flow_get_full_may_dependence(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_flow::get_full_must_dependence() const +union_map union_flow::get_full_must_dependence() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_flow_get_full_must_dependence(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_flow::get_may_dependence() const +union_map union_flow::get_may_dependence() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_flow_get_may_dependence(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_flow::get_may_no_source() const +union_map union_flow::get_may_no_source() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_flow_get_may_no_source(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_flow::get_must_dependence() const +union_map union_flow::get_must_dependence() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_flow_get_must_dependence(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_flow::get_must_no_source() const +union_map union_flow::get_must_no_source() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_flow_get_must_no_source(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } // implementations for isl::union_map -isl::union_map manage(__isl_take isl_union_map *ptr) { +union_map manage(__isl_take isl_union_map *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return union_map(ptr); } -isl::union_map manage_copy(__isl_keep isl_union_map *ptr) { +union_map manage_copy(__isl_keep isl_union_map *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_union_map_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_union_map_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return union_map(ptr); } union_map::union_map() : ptr(nullptr) {} -union_map::union_map(const isl::union_map &obj) - : ptr(obj.copy()) +union_map::union_map(const union_map &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_union_map_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_union_map_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } union_map::union_map(__isl_take isl_union_map *ptr) : ptr(ptr) {} -union_map::union_map(isl::basic_map bmap) +union_map::union_map(basic_map bmap) { if (bmap.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = bmap.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_from_basic_map(bmap.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -union_map::union_map(isl::map map) +union_map::union_map(map map) { if (map.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = map.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_from_map(map.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -union_map::union_map(isl::ctx ctx, const std::string &str) +union_map::union_map(ctx ctx, const std::string &str) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_read_from_str(ctx.release(), str.c_str()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -union_map &union_map::operator=(isl::union_map obj) { +union_map &union_map::operator=(union_map obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -18032,291 +18177,290 @@ std::string union_map::to_str() const { } -isl::ctx union_map::get_ctx() const { - return isl::ctx(isl_union_map_get_ctx(ptr)); +ctx union_map::get_ctx() const { + return ctx(isl_union_map_get_ctx(ptr)); } -isl::union_map union_map::add_map(isl::map map) const +union_map union_map::add_map(map map) const { if (!ptr || map.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_add_map(copy(), map.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::affine_hull() const +union_map union_map::affine_hull() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_affine_hull(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::apply_domain(isl::union_map umap2) const +union_map union_map::apply_domain(union_map umap2) const { if (!ptr || umap2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_apply_domain(copy(), umap2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::apply_range(isl::union_map umap2) const +union_map union_map::apply_range(union_map umap2) const { if (!ptr || umap2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_apply_range(copy(), umap2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::coalesce() const +union_map union_map::coalesce() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_coalesce(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::compute_divs() const +union_map union_map::compute_divs() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_compute_divs(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::curry() const +union_map union_map::curry() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_curry(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set union_map::deltas() const +union_set union_map::deltas() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_deltas(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::detect_equalities() const +union_map union_map::detect_equalities() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_detect_equalities(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set union_map::domain() const +union_set union_map::domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::domain_factor_domain() const +union_map union_map::domain_factor_domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_domain_factor_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::domain_factor_range() const +union_map union_map::domain_factor_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_domain_factor_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::domain_map() const +union_map union_map::domain_map() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_domain_map(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_pw_multi_aff union_map::domain_map_union_pw_multi_aff() const +union_pw_multi_aff union_map::domain_map_union_pw_multi_aff() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_domain_map_union_pw_multi_aff(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::domain_product(isl::union_map umap2) const +union_map union_map::domain_product(union_map umap2) const { if (!ptr || umap2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_domain_product(copy(), umap2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::empty(isl::space space) +union_map union_map::empty(space space) { if (space.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_empty(space.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::eq_at(isl::multi_union_pw_aff mupa) const +union_map union_map::eq_at(multi_union_pw_aff mupa) const { if (!ptr || mupa.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_eq_at_multi_union_pw_aff(copy(), mupa.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map union_map::extract_map(isl::space dim) const +map union_map::extract_map(space dim) const { if (!ptr || dim.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_extract_map(get(), dim.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::factor_domain() const +union_map union_map::factor_domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_factor_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::factor_range() const +union_map union_map::factor_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_factor_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::fixed_power(isl::val exp) const +union_map union_map::fixed_power(val exp) const { if (!ptr || exp.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_fixed_power_val(copy(), exp.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::flat_range_product(isl::union_map umap2) const +union_map union_map::flat_range_product(union_map umap2) const { if (!ptr || umap2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_flat_range_product(copy(), umap2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -void union_map::foreach_map(const std::function &fn) const +void union_map::foreach_map(const std::function &fn) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); struct fn_data { - std::function func; + std::function func; std::exception_ptr eptr; } fn_data = { fn }; auto fn_lambda = [](isl_map *arg_0, void *arg_1) -> isl_stat { auto *data = static_cast(arg_1); - try { - (data->func)(isl::manage(arg_0)); + ISL_CPP_TRY { + (data->func)(manage(arg_0)); return isl_stat_ok; - } catch (...) { + } ISL_CPP_CATCH_ALL { data->eptr = std::current_exception(); return isl_stat_error; } @@ -18325,630 +18469,626 @@ void union_map::foreach_map(const std::function &fn) const if (fn_data.eptr) std::rethrow_exception(fn_data.eptr); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return void(res); } -isl::union_map union_map::from(isl::union_pw_multi_aff upma) +union_map union_map::from(union_pw_multi_aff upma) { if (upma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = upma.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_from_union_pw_multi_aff(upma.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::from(isl::multi_union_pw_aff mupa) +union_map union_map::from(multi_union_pw_aff mupa) { if (mupa.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = mupa.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_from_multi_union_pw_aff(mupa.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::from_domain(isl::union_set uset) +union_map union_map::from_domain(union_set uset) { if (uset.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = uset.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_from_domain(uset.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::from_domain_and_range(isl::union_set domain, isl::union_set range) +union_map union_map::from_domain_and_range(union_set domain, union_set range) { if (domain.is_null() || range.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = domain.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_from_domain_and_range(domain.release(), range.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::from_range(isl::union_set uset) +union_map union_map::from_range(union_set uset) { if (uset.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = uset.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_from_range(uset.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::map_list union_map::get_map_list() const +map_list union_map::get_map_list() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_get_map_list(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space union_map::get_space() const +space union_map::get_space() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_get_space(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::gist(isl::union_map context) const +union_map union_map::gist(union_map context) const { if (!ptr || context.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_gist(copy(), context.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::gist_domain(isl::union_set uset) const +union_map union_map::gist_domain(union_set uset) const { if (!ptr || uset.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_gist_domain(copy(), uset.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::gist_params(isl::set set) const +union_map union_map::gist_params(set set) const { if (!ptr || set.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_gist_params(copy(), set.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::gist_range(isl::union_set uset) const +union_map union_map::gist_range(union_set uset) const { if (!ptr || uset.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_gist_range(copy(), uset.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::intersect(isl::union_map umap2) const +union_map union_map::intersect(union_map umap2) const { if (!ptr || umap2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_intersect(copy(), umap2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::intersect_domain(isl::union_set uset) const +union_map union_map::intersect_domain(union_set uset) const { if (!ptr || uset.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_intersect_domain(copy(), uset.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::intersect_params(isl::set set) const +union_map union_map::intersect_params(set set) const { if (!ptr || set.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_intersect_params(copy(), set.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::intersect_range(isl::union_set uset) const +union_map union_map::intersect_range(union_set uset) const { if (!ptr || uset.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_intersect_range(copy(), uset.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } bool union_map::is_bijective() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_is_bijective(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } bool union_map::is_empty() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_is_empty(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -bool union_map::is_equal(const isl::union_map &umap2) const +bool union_map::is_equal(const union_map &umap2) const { if (!ptr || umap2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_is_equal(get(), umap2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } bool union_map::is_injective() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_is_injective(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } bool union_map::is_single_valued() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_is_single_valued(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -bool union_map::is_strict_subset(const isl::union_map &umap2) const +bool union_map::is_strict_subset(const union_map &umap2) const { if (!ptr || umap2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_is_strict_subset(get(), umap2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -bool union_map::is_subset(const isl::union_map &umap2) const +bool union_map::is_subset(const union_map &umap2) const { if (!ptr || umap2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_is_subset(get(), umap2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -isl::union_map union_map::lex_gt_at(isl::multi_union_pw_aff mupa) const +union_map union_map::lex_gt_at(multi_union_pw_aff mupa) const { if (!ptr || mupa.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_lex_gt_at_multi_union_pw_aff(copy(), mupa.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::lex_lt_at(isl::multi_union_pw_aff mupa) const +union_map union_map::lex_lt_at(multi_union_pw_aff mupa) const { if (!ptr || mupa.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_lex_lt_at_multi_union_pw_aff(copy(), mupa.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::lexmax() const +union_map union_map::lexmax() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_lexmax(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::lexmin() const +union_map union_map::lexmin() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_lexmin(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } int union_map::n_map() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_n_map(get()); return res; } -isl::union_map union_map::polyhedral_hull() const +union_map union_map::polyhedral_hull() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_polyhedral_hull(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::preimage_range_multi_aff(isl::multi_aff ma) const +union_map union_map::preimage_range_multi_aff(multi_aff ma) const { if (!ptr || ma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_preimage_range_multi_aff(copy(), ma.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::product(isl::union_map umap2) const +union_map union_map::product(union_map umap2) const { if (!ptr || umap2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_product(copy(), umap2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::project_out_all_params() const +union_map union_map::project_out_all_params() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_project_out_all_params(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set union_map::range() const +union_set union_map::range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::range_factor_domain() const +union_map union_map::range_factor_domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_range_factor_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::range_factor_range() const +union_map union_map::range_factor_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_range_factor_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::range_map() const +union_map union_map::range_map() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_range_map(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::range_product(isl::union_map umap2) const +union_map union_map::range_product(union_map umap2) const { if (!ptr || umap2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_range_product(copy(), umap2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::reverse() const +union_map union_map::reverse() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_reverse(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::subtract(isl::union_map umap2) const +union_map union_map::subtract(union_map umap2) const { if (!ptr || umap2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_subtract(copy(), umap2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::subtract_domain(isl::union_set dom) const +union_map union_map::subtract_domain(union_set dom) const { if (!ptr || dom.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_subtract_domain(copy(), dom.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::subtract_range(isl::union_set dom) const +union_map union_map::subtract_range(union_set dom) const { if (!ptr || dom.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_subtract_range(copy(), dom.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::uncurry() const +union_map union_map::uncurry() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_uncurry(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::unite(isl::union_map umap2) const +union_map union_map::unite(union_map umap2) const { if (!ptr || umap2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_union(copy(), umap2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::universe() const +union_map union_map::universe() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_universe(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set union_map::wrap() const +union_set union_map::wrap() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_wrap(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::zip() const +union_map union_map::zip() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_zip(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } // implementations for isl::union_pw_aff -isl::union_pw_aff manage(__isl_take isl_union_pw_aff *ptr) { +union_pw_aff manage(__isl_take isl_union_pw_aff *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return union_pw_aff(ptr); } -isl::union_pw_aff manage_copy(__isl_keep isl_union_pw_aff *ptr) { +union_pw_aff manage_copy(__isl_keep isl_union_pw_aff *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_union_pw_aff_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_union_pw_aff_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return union_pw_aff(ptr); } union_pw_aff::union_pw_aff() : ptr(nullptr) {} -union_pw_aff::union_pw_aff(const isl::union_pw_aff &obj) - : ptr(obj.copy()) +union_pw_aff::union_pw_aff(const union_pw_aff &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_union_pw_aff_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_union_pw_aff_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } union_pw_aff::union_pw_aff(__isl_take isl_union_pw_aff *ptr) : ptr(ptr) {} -union_pw_aff::union_pw_aff(isl::pw_aff pa) +union_pw_aff::union_pw_aff(pw_aff pa) { if (pa.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = pa.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_from_pw_aff(pa.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -union_pw_aff::union_pw_aff(isl::union_set domain, isl::val v) +union_pw_aff::union_pw_aff(union_set domain, val v) { if (domain.is_null() || v.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = domain.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_val_on_domain(domain.release(), v.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -union_pw_aff::union_pw_aff(isl::union_set domain, isl::aff aff) +union_pw_aff::union_pw_aff(union_set domain, aff aff) { if (domain.is_null() || aff.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = domain.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_aff_on_domain(domain.release(), aff.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -union_pw_aff::union_pw_aff(isl::ctx ctx, const std::string &str) +union_pw_aff::union_pw_aff(ctx ctx, const std::string &str) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_read_from_str(ctx.release(), str.c_str()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -union_pw_aff &union_pw_aff::operator=(isl::union_pw_aff obj) { +union_pw_aff &union_pw_aff::operator=(union_pw_aff obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -18996,99 +19136,98 @@ std::string union_pw_aff::to_str() const { } -isl::ctx union_pw_aff::get_ctx() const { - return isl::ctx(isl_union_pw_aff_get_ctx(ptr)); +ctx union_pw_aff::get_ctx() const { + return ctx(isl_union_pw_aff_get_ctx(ptr)); } -isl::union_pw_aff union_pw_aff::add(isl::union_pw_aff upa2) const +union_pw_aff union_pw_aff::add(union_pw_aff upa2) const { if (!ptr || upa2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_add(copy(), upa2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set union_pw_aff::domain() const +union_set union_pw_aff::domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_pw_aff union_pw_aff::empty(isl::space space) +union_pw_aff union_pw_aff::empty(space space) { if (space.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_empty(space.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff union_pw_aff::extract_on_domain(isl::space space) const +pw_aff union_pw_aff::extract_on_domain(space space) const { if (!ptr || space.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_extract_on_domain_space(get(), space.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff union_pw_aff::extract_pw_aff(isl::space space) const +pw_aff union_pw_aff::extract_pw_aff(space space) const { if (!ptr || space.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_extract_pw_aff(get(), space.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_pw_aff union_pw_aff::floor() const +union_pw_aff union_pw_aff::floor() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_floor(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -void union_pw_aff::foreach_pw_aff(const std::function &fn) const +void union_pw_aff::foreach_pw_aff(const std::function &fn) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); struct fn_data { - std::function func; + std::function func; std::exception_ptr eptr; } fn_data = { fn }; auto fn_lambda = [](isl_pw_aff *arg_0, void *arg_1) -> isl_stat { auto *data = static_cast(arg_1); - try { - (data->func)(isl::manage(arg_0)); + ISL_CPP_TRY { + (data->func)(manage(arg_0)); return isl_stat_ok; - } catch (...) { + } ISL_CPP_CATCH_ALL { data->eptr = std::current_exception(); return isl_stat_error; } @@ -19097,254 +19236,256 @@ void union_pw_aff::foreach_pw_aff(const std::function &fn) co if (fn_data.eptr) std::rethrow_exception(fn_data.eptr); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return void(res); } -isl::pw_aff_list union_pw_aff::get_pw_aff_list() const +pw_aff_list union_pw_aff::get_pw_aff_list() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_get_pw_aff_list(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space union_pw_aff::get_space() const +space union_pw_aff::get_space() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_get_space(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_pw_aff union_pw_aff::intersect_domain(isl::union_set uset) const +union_pw_aff union_pw_aff::intersect_domain(union_set uset) const { if (!ptr || uset.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_intersect_domain(copy(), uset.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -bool union_pw_aff::involves_param(const isl::id &id) const +bool union_pw_aff::involves_param(const id &id) const { if (!ptr || id.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_involves_param_id(get(), id.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -isl::val union_pw_aff::max_val() const +val union_pw_aff::max_val() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_max_val(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::val union_pw_aff::min_val() const +val union_pw_aff::min_val() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_min_val(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_pw_aff union_pw_aff::mod(isl::val f) const +union_pw_aff union_pw_aff::mod(val f) const { if (!ptr || f.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_mod_val(copy(), f.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } int union_pw_aff::n_pw_aff() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_n_pw_aff(get()); return res; } -isl::union_pw_aff union_pw_aff::param_on_domain(isl::union_set domain, isl::id id) +union_pw_aff union_pw_aff::param_on_domain(union_set domain, id id) { if (domain.is_null() || id.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = domain.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_param_on_domain_id(domain.release(), id.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -bool union_pw_aff::plain_is_equal(const isl::union_pw_aff &upa2) const +bool union_pw_aff::plain_is_equal(const union_pw_aff &upa2) const { if (!ptr || upa2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_plain_is_equal(get(), upa2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -isl::union_pw_aff union_pw_aff::pullback(isl::union_pw_multi_aff upma) const +union_pw_aff union_pw_aff::pullback(union_pw_multi_aff upma) const { if (!ptr || upma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_pullback_union_pw_multi_aff(copy(), upma.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_pw_aff union_pw_aff::scale(isl::val v) const +union_pw_aff union_pw_aff::scale(val v) const { if (!ptr || v.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_scale_val(copy(), v.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_pw_aff union_pw_aff::scale_down(isl::val v) const +union_pw_aff union_pw_aff::scale_down(val v) const { if (!ptr || v.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_scale_down_val(copy(), v.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_pw_aff union_pw_aff::sub(isl::union_pw_aff upa2) const +union_pw_aff union_pw_aff::sub(union_pw_aff upa2) const { if (!ptr || upa2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_sub(copy(), upa2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_pw_aff union_pw_aff::union_add(isl::union_pw_aff upa2) const +union_pw_aff union_pw_aff::union_add(union_pw_aff upa2) const { if (!ptr || upa2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_union_add(copy(), upa2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set union_pw_aff::zero_union_set() const +union_set union_pw_aff::zero_union_set() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_zero_union_set(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } // implementations for isl::union_pw_aff_list -isl::union_pw_aff_list manage(__isl_take isl_union_pw_aff_list *ptr) { +union_pw_aff_list manage(__isl_take isl_union_pw_aff_list *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return union_pw_aff_list(ptr); } -isl::union_pw_aff_list manage_copy(__isl_keep isl_union_pw_aff_list *ptr) { +union_pw_aff_list manage_copy(__isl_keep isl_union_pw_aff_list *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_union_pw_aff_list_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_union_pw_aff_list_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return union_pw_aff_list(ptr); } union_pw_aff_list::union_pw_aff_list() : ptr(nullptr) {} -union_pw_aff_list::union_pw_aff_list(const isl::union_pw_aff_list &obj) - : ptr(obj.copy()) +union_pw_aff_list::union_pw_aff_list(const union_pw_aff_list &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_union_pw_aff_list_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_union_pw_aff_list_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } union_pw_aff_list::union_pw_aff_list(__isl_take isl_union_pw_aff_list *ptr) : ptr(ptr) {} -union_pw_aff_list::union_pw_aff_list(isl::union_pw_aff el) +union_pw_aff_list::union_pw_aff_list(union_pw_aff el) { if (el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = el.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_list_from_union_pw_aff(el.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -union_pw_aff_list::union_pw_aff_list(isl::ctx ctx, int n) +union_pw_aff_list::union_pw_aff_list(ctx ctx, int n) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_list_alloc(ctx.release(), n); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -union_pw_aff_list &union_pw_aff_list::operator=(isl::union_pw_aff_list obj) { +union_pw_aff_list &union_pw_aff_list::operator=(union_pw_aff_list obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -19378,62 +19519,62 @@ union_pw_aff_list::operator bool() const -isl::ctx union_pw_aff_list::get_ctx() const { - return isl::ctx(isl_union_pw_aff_list_get_ctx(ptr)); +ctx union_pw_aff_list::get_ctx() const { + return ctx(isl_union_pw_aff_list_get_ctx(ptr)); } -isl::union_pw_aff_list union_pw_aff_list::add(isl::union_pw_aff el) const +union_pw_aff_list union_pw_aff_list::add(union_pw_aff el) const { if (!ptr || el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_list_add(copy(), el.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_pw_aff_list union_pw_aff_list::concat(isl::union_pw_aff_list list2) const +union_pw_aff_list union_pw_aff_list::concat(union_pw_aff_list list2) const { if (!ptr || list2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_list_concat(copy(), list2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_pw_aff_list union_pw_aff_list::drop(unsigned int first, unsigned int n) const +union_pw_aff_list union_pw_aff_list::drop(unsigned int first, unsigned int n) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_list_drop(copy(), first, n); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -void union_pw_aff_list::foreach(const std::function &fn) const +void union_pw_aff_list::foreach(const std::function &fn) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); struct fn_data { - std::function func; + std::function func; std::exception_ptr eptr; } fn_data = { fn }; auto fn_lambda = [](isl_union_pw_aff *arg_0, void *arg_1) -> isl_stat { auto *data = static_cast(arg_1); - try { - (data->func)(isl::manage(arg_0)); + ISL_CPP_TRY { + (data->func)(manage(arg_0)); return isl_stat_ok; - } catch (...) { + } ISL_CPP_CATCH_ALL { data->eptr = std::current_exception(); return isl_stat_error; } @@ -19442,121 +19583,122 @@ void union_pw_aff_list::foreach(const std::function &fn if (fn_data.eptr) std::rethrow_exception(fn_data.eptr); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return void(res); } -isl::union_pw_aff union_pw_aff_list::get_at(int index) const +union_pw_aff union_pw_aff_list::get_at(int index) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_list_get_at(get(), index); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_pw_aff_list union_pw_aff_list::reverse() const +union_pw_aff_list union_pw_aff_list::reverse() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_list_reverse(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } int union_pw_aff_list::size() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_list_size(get()); return res; } // implementations for isl::union_pw_multi_aff -isl::union_pw_multi_aff manage(__isl_take isl_union_pw_multi_aff *ptr) { +union_pw_multi_aff manage(__isl_take isl_union_pw_multi_aff *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return union_pw_multi_aff(ptr); } -isl::union_pw_multi_aff manage_copy(__isl_keep isl_union_pw_multi_aff *ptr) { +union_pw_multi_aff manage_copy(__isl_keep isl_union_pw_multi_aff *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_union_pw_multi_aff_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_union_pw_multi_aff_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return union_pw_multi_aff(ptr); } union_pw_multi_aff::union_pw_multi_aff() : ptr(nullptr) {} -union_pw_multi_aff::union_pw_multi_aff(const isl::union_pw_multi_aff &obj) - : ptr(obj.copy()) +union_pw_multi_aff::union_pw_multi_aff(const union_pw_multi_aff &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_union_pw_multi_aff_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_union_pw_multi_aff_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } union_pw_multi_aff::union_pw_multi_aff(__isl_take isl_union_pw_multi_aff *ptr) : ptr(ptr) {} -union_pw_multi_aff::union_pw_multi_aff(isl::pw_multi_aff pma) +union_pw_multi_aff::union_pw_multi_aff(pw_multi_aff pma) { if (pma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = pma.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_multi_aff_from_pw_multi_aff(pma.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -union_pw_multi_aff::union_pw_multi_aff(isl::union_set domain, isl::multi_val mv) +union_pw_multi_aff::union_pw_multi_aff(union_set domain, multi_val mv) { if (domain.is_null() || mv.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = domain.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_multi_aff_multi_val_on_domain(domain.release(), mv.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -union_pw_multi_aff::union_pw_multi_aff(isl::ctx ctx, const std::string &str) +union_pw_multi_aff::union_pw_multi_aff(ctx ctx, const std::string &str) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_multi_aff_read_from_str(ctx.release(), str.c_str()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -union_pw_multi_aff::union_pw_multi_aff(isl::union_pw_aff upa) +union_pw_multi_aff::union_pw_multi_aff(union_pw_aff upa) { if (upa.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = upa.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_multi_aff_from_union_pw_aff(upa.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -union_pw_multi_aff &union_pw_multi_aff::operator=(isl::union_pw_multi_aff obj) { +union_pw_multi_aff &union_pw_multi_aff::operator=(union_pw_multi_aff obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -19604,74 +19746,74 @@ std::string union_pw_multi_aff::to_str() const { } -isl::ctx union_pw_multi_aff::get_ctx() const { - return isl::ctx(isl_union_pw_multi_aff_get_ctx(ptr)); +ctx union_pw_multi_aff::get_ctx() const { + return ctx(isl_union_pw_multi_aff_get_ctx(ptr)); } -isl::union_pw_multi_aff union_pw_multi_aff::add(isl::union_pw_multi_aff upma2) const +union_pw_multi_aff union_pw_multi_aff::add(union_pw_multi_aff upma2) const { if (!ptr || upma2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_multi_aff_add(copy(), upma2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set union_pw_multi_aff::domain() const +union_set union_pw_multi_aff::domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_multi_aff_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_multi_aff union_pw_multi_aff::extract_pw_multi_aff(isl::space space) const +pw_multi_aff union_pw_multi_aff::extract_pw_multi_aff(space space) const { if (!ptr || space.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_multi_aff_extract_pw_multi_aff(get(), space.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_pw_multi_aff union_pw_multi_aff::flat_range_product(isl::union_pw_multi_aff upma2) const +union_pw_multi_aff union_pw_multi_aff::flat_range_product(union_pw_multi_aff upma2) const { if (!ptr || upma2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_multi_aff_flat_range_product(copy(), upma2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -void union_pw_multi_aff::foreach_pw_multi_aff(const std::function &fn) const +void union_pw_multi_aff::foreach_pw_multi_aff(const std::function &fn) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); struct fn_data { - std::function func; + std::function func; std::exception_ptr eptr; } fn_data = { fn }; auto fn_lambda = [](isl_pw_multi_aff *arg_0, void *arg_1) -> isl_stat { auto *data = static_cast(arg_1); - try { - (data->func)(isl::manage(arg_0)); + ISL_CPP_TRY { + (data->func)(manage(arg_0)); return isl_stat_ok; - } catch (...) { + } ISL_CPP_CATCH_ALL { data->eptr = std::current_exception(); return isl_stat_error; } @@ -19680,195 +19822,194 @@ void union_pw_multi_aff::foreach_pw_multi_aff(const std::functionptr, obj.ptr); return *this; } @@ -19920,111 +20061,110 @@ std::string union_set::to_str() const { } -isl::ctx union_set::get_ctx() const { - return isl::ctx(isl_union_set_get_ctx(ptr)); +ctx union_set::get_ctx() const { + return ctx(isl_union_set_get_ctx(ptr)); } -isl::union_set union_set::add_set(isl::set set) const +union_set union_set::add_set(set set) const { if (!ptr || set.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_add_set(copy(), set.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set union_set::affine_hull() const +union_set union_set::affine_hull() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_affine_hull(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set union_set::apply(isl::union_map umap) const +union_set union_set::apply(union_map umap) const { if (!ptr || umap.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_apply(copy(), umap.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set union_set::coalesce() const +union_set union_set::coalesce() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_coalesce(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set union_set::compute_divs() const +union_set union_set::compute_divs() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_compute_divs(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set union_set::detect_equalities() const +union_set union_set::detect_equalities() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_detect_equalities(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set union_set::empty(isl::space space) +union_set union_set::empty(space space) { if (space.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_empty(space.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -bool union_set::every_set(const std::function &test) const +bool union_set::every_set(const std::function &test) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); struct test_data { - std::function func; + std::function func; std::exception_ptr eptr; } test_data = { test }; auto test_lambda = [](isl_set *arg_0, void *arg_1) -> isl_bool { auto *data = static_cast(arg_1); - try { - auto ret = (data->func)(isl::manage_copy(arg_0)); + ISL_CPP_TRY { + auto ret = (data->func)(manage_copy(arg_0)); return ret ? isl_bool_true : isl_bool_false; - } catch (...) { + } ISL_CPP_CATCH_ALL { data->eptr = std::current_exception(); return isl_bool_error; } @@ -20033,38 +20173,38 @@ bool union_set::every_set(const std::function &test) const if (test_data.eptr) std::rethrow_exception(test_data.eptr); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -isl::set union_set::extract_set(isl::space dim) const +set union_set::extract_set(space dim) const { if (!ptr || dim.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_extract_set(get(), dim.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -void union_set::foreach_point(const std::function &fn) const +void union_set::foreach_point(const std::function &fn) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); struct fn_data { - std::function func; + std::function func; std::exception_ptr eptr; } fn_data = { fn }; auto fn_lambda = [](isl_point *arg_0, void *arg_1) -> isl_stat { auto *data = static_cast(arg_1); - try { - (data->func)(isl::manage(arg_0)); + ISL_CPP_TRY { + (data->func)(manage(arg_0)); return isl_stat_ok; - } catch (...) { + } ISL_CPP_CATCH_ALL { data->eptr = std::current_exception(); return isl_stat_error; } @@ -20073,26 +20213,26 @@ void union_set::foreach_point(const std::function &fn) const if (fn_data.eptr) std::rethrow_exception(fn_data.eptr); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return void(res); } -void union_set::foreach_set(const std::function &fn) const +void union_set::foreach_set(const std::function &fn) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); struct fn_data { - std::function func; + std::function func; std::exception_ptr eptr; } fn_data = { fn }; auto fn_lambda = [](isl_set *arg_0, void *arg_1) -> isl_stat { auto *data = static_cast(arg_1); - try { - (data->func)(isl::manage(arg_0)); + ISL_CPP_TRY { + (data->func)(manage(arg_0)); return isl_stat_ok; - } catch (...) { + } ISL_CPP_CATCH_ALL { data->eptr = std::current_exception(); return isl_stat_error; } @@ -20101,397 +20241,400 @@ void union_set::foreach_set(const std::function &fn) const if (fn_data.eptr) std::rethrow_exception(fn_data.eptr); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return void(res); } -isl::set_list union_set::get_set_list() const +set_list union_set::get_set_list() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_get_set_list(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space union_set::get_space() const +space union_set::get_space() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_get_space(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set union_set::gist(isl::union_set context) const +union_set union_set::gist(union_set context) const { if (!ptr || context.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_gist(copy(), context.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set union_set::gist_params(isl::set set) const +union_set union_set::gist_params(set set) const { if (!ptr || set.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_gist_params(copy(), set.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_set::identity() const +union_map union_set::identity() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_identity(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set union_set::intersect(isl::union_set uset2) const +union_set union_set::intersect(union_set uset2) const { if (!ptr || uset2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_intersect(copy(), uset2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set union_set::intersect_params(isl::set set) const +union_set union_set::intersect_params(set set) const { if (!ptr || set.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_intersect_params(copy(), set.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -bool union_set::involves_param(const isl::id &id) const +bool union_set::involves_param(const id &id) const { if (!ptr || id.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_involves_param_id(get(), id.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -bool union_set::is_disjoint(const isl::union_set &uset2) const +bool union_set::is_disjoint(const union_set &uset2) const { if (!ptr || uset2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_is_disjoint(get(), uset2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } bool union_set::is_empty() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_is_empty(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -bool union_set::is_equal(const isl::union_set &uset2) const +bool union_set::is_equal(const union_set &uset2) const { if (!ptr || uset2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_is_equal(get(), uset2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } bool union_set::is_params() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_is_params(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -bool union_set::is_strict_subset(const isl::union_set &uset2) const +bool union_set::is_strict_subset(const union_set &uset2) const { if (!ptr || uset2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_is_strict_subset(get(), uset2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -bool union_set::is_subset(const isl::union_set &uset2) const +bool union_set::is_subset(const union_set &uset2) const { if (!ptr || uset2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_is_subset(get(), uset2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -isl::union_set union_set::lexmax() const +union_set union_set::lexmax() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_lexmax(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set union_set::lexmin() const +union_set union_set::lexmin() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_lexmin(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } int union_set::n_set() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_n_set(get()); return res; } -isl::set union_set::params() const +set union_set::params() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_params(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set union_set::polyhedral_hull() const +union_set union_set::polyhedral_hull() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_polyhedral_hull(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set union_set::preimage(isl::multi_aff ma) const +union_set union_set::preimage(multi_aff ma) const { if (!ptr || ma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_preimage_multi_aff(copy(), ma.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set union_set::preimage(isl::pw_multi_aff pma) const +union_set union_set::preimage(pw_multi_aff pma) const { if (!ptr || pma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_preimage_pw_multi_aff(copy(), pma.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set union_set::preimage(isl::union_pw_multi_aff upma) const +union_set union_set::preimage(union_pw_multi_aff upma) const { if (!ptr || upma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_preimage_union_pw_multi_aff(copy(), upma.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::point union_set::sample_point() const +point union_set::sample_point() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_sample_point(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set union_set::subtract(isl::union_set uset2) const +union_set union_set::subtract(union_set uset2) const { if (!ptr || uset2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_subtract(copy(), uset2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set union_set::unite(isl::union_set uset2) const +union_set union_set::unite(union_set uset2) const { if (!ptr || uset2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_union(copy(), uset2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set union_set::universe() const +union_set union_set::universe() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_universe(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_set::unwrap() const +union_map union_set::unwrap() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_unwrap(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_set::wrapped_domain_map() const +union_map union_set::wrapped_domain_map() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_wrapped_domain_map(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } // implementations for isl::union_set_list -isl::union_set_list manage(__isl_take isl_union_set_list *ptr) { +union_set_list manage(__isl_take isl_union_set_list *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return union_set_list(ptr); } -isl::union_set_list manage_copy(__isl_keep isl_union_set_list *ptr) { +union_set_list manage_copy(__isl_keep isl_union_set_list *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_union_set_list_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_union_set_list_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return union_set_list(ptr); } union_set_list::union_set_list() : ptr(nullptr) {} -union_set_list::union_set_list(const isl::union_set_list &obj) - : ptr(obj.copy()) +union_set_list::union_set_list(const union_set_list &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_union_set_list_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_union_set_list_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } union_set_list::union_set_list(__isl_take isl_union_set_list *ptr) : ptr(ptr) {} -union_set_list::union_set_list(isl::union_set el) +union_set_list::union_set_list(union_set el) { if (el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = el.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_list_from_union_set(el.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -union_set_list::union_set_list(isl::ctx ctx, int n) +union_set_list::union_set_list(ctx ctx, int n) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_list_alloc(ctx.release(), n); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -union_set_list &union_set_list::operator=(isl::union_set_list obj) { +union_set_list &union_set_list::operator=(union_set_list obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -20525,62 +20668,62 @@ union_set_list::operator bool() const -isl::ctx union_set_list::get_ctx() const { - return isl::ctx(isl_union_set_list_get_ctx(ptr)); +ctx union_set_list::get_ctx() const { + return ctx(isl_union_set_list_get_ctx(ptr)); } -isl::union_set_list union_set_list::add(isl::union_set el) const +union_set_list union_set_list::add(union_set el) const { if (!ptr || el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_list_add(copy(), el.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set_list union_set_list::concat(isl::union_set_list list2) const +union_set_list union_set_list::concat(union_set_list list2) const { if (!ptr || list2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_list_concat(copy(), list2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set_list union_set_list::drop(unsigned int first, unsigned int n) const +union_set_list union_set_list::drop(unsigned int first, unsigned int n) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_list_drop(copy(), first, n); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -void union_set_list::foreach(const std::function &fn) const +void union_set_list::foreach(const std::function &fn) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); struct fn_data { - std::function func; + std::function func; std::exception_ptr eptr; } fn_data = { fn }; auto fn_lambda = [](isl_union_set *arg_0, void *arg_1) -> isl_stat { auto *data = static_cast(arg_1); - try { - (data->func)(isl::manage(arg_0)); + ISL_CPP_TRY { + (data->func)(manage(arg_0)); return isl_stat_ok; - } catch (...) { + } ISL_CPP_CATCH_ALL { data->eptr = std::current_exception(); return isl_stat_error; } @@ -20589,93 +20732,97 @@ void union_set_list::foreach(const std::function &fn) cons if (fn_data.eptr) std::rethrow_exception(fn_data.eptr); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return void(res); } -isl::union_set union_set_list::get_at(int index) const +union_set union_set_list::get_at(int index) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_list_get_at(get(), index); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set_list union_set_list::reverse() const +union_set_list union_set_list::reverse() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_list_reverse(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } int union_set_list::size() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_list_size(get()); return res; } // implementations for isl::val -isl::val manage(__isl_take isl_val *ptr) { +val manage(__isl_take isl_val *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return val(ptr); } -isl::val manage_copy(__isl_keep isl_val *ptr) { +val manage_copy(__isl_keep isl_val *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_val_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_val_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return val(ptr); } val::val() : ptr(nullptr) {} -val::val(const isl::val &obj) - : ptr(obj.copy()) +val::val(const val &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_val_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_val_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } val::val(__isl_take isl_val *ptr) : ptr(ptr) {} -val::val(isl::ctx ctx, const std::string &str) +val::val(ctx ctx, const std::string &str) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_read_from_str(ctx.release(), str.c_str()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -val::val(isl::ctx ctx, long i) +val::val(ctx ctx, long i) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_int_from_si(ctx.release(), i); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -val &val::operator=(isl::val obj) { +val &val::operator=(val obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -20723,134 +20870,134 @@ std::string val::to_str() const { } -isl::ctx val::get_ctx() const { - return isl::ctx(isl_val_get_ctx(ptr)); +ctx val::get_ctx() const { + return ctx(isl_val_get_ctx(ptr)); } -isl::val val::abs() const +val val::abs() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_abs(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -bool val::abs_eq(const isl::val &v2) const +bool val::abs_eq(const val &v2) const { if (!ptr || v2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_abs_eq(get(), v2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -isl::val val::add(isl::val v2) const +val val::add(val v2) const { if (!ptr || v2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_add(copy(), v2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::val val::ceil() const +val val::ceil() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_ceil(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } int val::cmp_si(long i) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_cmp_si(get(), i); return res; } -isl::val val::div(isl::val v2) const +val val::div(val v2) const { if (!ptr || v2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_div(copy(), v2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -bool val::eq(const isl::val &v2) const +bool val::eq(const val &v2) const { if (!ptr || v2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_eq(get(), v2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -isl::val val::floor() const +val val::floor() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_floor(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::val val::gcd(isl::val v2) const +val val::gcd(val v2) const { if (!ptr || v2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_gcd(copy(), v2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -bool val::ge(const isl::val &v2) const +bool val::ge(const val &v2) const { if (!ptr || v2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_ge(get(), v2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } long val::get_den_si() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_get_den_si(get()); return res; } @@ -20858,430 +21005,433 @@ long val::get_den_si() const long val::get_num_si() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_get_num_si(get()); return res; } -bool val::gt(const isl::val &v2) const +bool val::gt(const val &v2) const { if (!ptr || v2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_gt(get(), v2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -isl::val val::infty(isl::ctx ctx) +val val::infty(ctx ctx) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_infty(ctx.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::val val::inv() const +val val::inv() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_inv(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -bool val::is_divisible_by(const isl::val &v2) const +bool val::is_divisible_by(const val &v2) const { if (!ptr || v2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_is_divisible_by(get(), v2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } bool val::is_infty() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_is_infty(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } bool val::is_int() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_is_int(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } bool val::is_nan() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_is_nan(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } bool val::is_neg() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_is_neg(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } bool val::is_neginfty() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_is_neginfty(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } bool val::is_negone() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_is_negone(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } bool val::is_nonneg() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_is_nonneg(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } bool val::is_nonpos() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_is_nonpos(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } bool val::is_one() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_is_one(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } bool val::is_pos() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_is_pos(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } bool val::is_rat() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_is_rat(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } bool val::is_zero() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_is_zero(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -bool val::le(const isl::val &v2) const +bool val::le(const val &v2) const { if (!ptr || v2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_le(get(), v2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -bool val::lt(const isl::val &v2) const +bool val::lt(const val &v2) const { if (!ptr || v2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_lt(get(), v2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -isl::val val::max(isl::val v2) const +val val::max(val v2) const { if (!ptr || v2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_max(copy(), v2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::val val::min(isl::val v2) const +val val::min(val v2) const { if (!ptr || v2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_min(copy(), v2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::val val::mod(isl::val v2) const +val val::mod(val v2) const { if (!ptr || v2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_mod(copy(), v2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::val val::mul(isl::val v2) const +val val::mul(val v2) const { if (!ptr || v2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_mul(copy(), v2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::val val::nan(isl::ctx ctx) +val val::nan(ctx ctx) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_nan(ctx.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -bool val::ne(const isl::val &v2) const +bool val::ne(const val &v2) const { if (!ptr || v2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_ne(get(), v2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -isl::val val::neg() const +val val::neg() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_neg(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::val val::neginfty(isl::ctx ctx) +val val::neginfty(ctx ctx) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_neginfty(ctx.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::val val::negone(isl::ctx ctx) +val val::negone(ctx ctx) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_negone(ctx.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::val val::one(isl::ctx ctx) +val val::one(ctx ctx) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_one(ctx.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } int val::sgn() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_sgn(get()); return res; } -isl::val val::sub(isl::val v2) const +val val::sub(val v2) const { if (!ptr || v2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_sub(copy(), v2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::val val::trunc() const +val val::trunc() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_trunc(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::val val::zero(isl::ctx ctx) +val val::zero(ctx ctx) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_zero(ctx.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } // implementations for isl::val_list -isl::val_list manage(__isl_take isl_val_list *ptr) { +val_list manage(__isl_take isl_val_list *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return val_list(ptr); } -isl::val_list manage_copy(__isl_keep isl_val_list *ptr) { +val_list manage_copy(__isl_keep isl_val_list *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_val_list_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_val_list_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return val_list(ptr); } val_list::val_list() : ptr(nullptr) {} -val_list::val_list(const isl::val_list &obj) - : ptr(obj.copy()) +val_list::val_list(const val_list &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_val_list_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_val_list_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } val_list::val_list(__isl_take isl_val_list *ptr) : ptr(ptr) {} -val_list::val_list(isl::val el) +val_list::val_list(val el) { if (el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = el.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_list_from_val(el.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -val_list::val_list(isl::ctx ctx, int n) +val_list::val_list(ctx ctx, int n) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_list_alloc(ctx.release(), n); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -val_list &val_list::operator=(isl::val_list obj) { +val_list &val_list::operator=(val_list obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -21315,62 +21465,62 @@ val_list::operator bool() const -isl::ctx val_list::get_ctx() const { - return isl::ctx(isl_val_list_get_ctx(ptr)); +ctx val_list::get_ctx() const { + return ctx(isl_val_list_get_ctx(ptr)); } -isl::val_list val_list::add(isl::val el) const +val_list val_list::add(val el) const { if (!ptr || el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_list_add(copy(), el.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::val_list val_list::concat(isl::val_list list2) const +val_list val_list::concat(val_list list2) const { if (!ptr || list2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_list_concat(copy(), list2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::val_list val_list::drop(unsigned int first, unsigned int n) const +val_list val_list::drop(unsigned int first, unsigned int n) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_list_drop(copy(), first, n); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -void val_list::foreach(const std::function &fn) const +void val_list::foreach(const std::function &fn) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); struct fn_data { - std::function func; + std::function func; std::exception_ptr eptr; } fn_data = { fn }; auto fn_lambda = [](isl_val *arg_0, void *arg_1) -> isl_stat { auto *data = static_cast(arg_1); - try { - (data->func)(isl::manage(arg_0)); + ISL_CPP_TRY { + (data->func)(manage(arg_0)); return isl_stat_ok; - } catch (...) { + } ISL_CPP_CATCH_ALL { data->eptr = std::current_exception(); return isl_stat_error; } @@ -21379,40 +21529,40 @@ void val_list::foreach(const std::function &fn) const if (fn_data.eptr) std::rethrow_exception(fn_data.eptr); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return void(res); } -isl::val val_list::get_at(int index) const +val val_list::get_at(int index) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_list_get_at(get(), index); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::val_list val_list::reverse() const +val_list val_list::reverse() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_list_reverse(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } int val_list::size() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_list_size(get()); return res; } diff --git a/third-party/islpp b/third-party/islpp index 6771372d7..96fef8767 160000 --- a/third-party/islpp +++ b/third-party/islpp @@ -1 +1 @@ -Subproject commit 6771372d7b0f792f05609b2da9a84a71af3aac05 +Subproject commit 96fef8767ee8823d0316e040c827c78b28802ce9 From c75259088b6c596967b02ce6598c9d56cc1f37cf Mon Sep 17 00:00:00 2001 From: tosaka2 Date: Tue, 21 Aug 2018 12:09:25 +0900 Subject: [PATCH 149/152] Fix a broken link in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b6384f964..1eebf0944 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ After a few generations of `autotuning` on a 2-GPU P100 system, we see results r ![Autotuning Sample](docs/source/_static/img/autotuning.png) -In C++ a minimal autotuning example resembles the [following](example/example_tensordot.cc): +In C++ a minimal autotuning example resembles the [following](tc/examples/tensordot.cc): ```cpp TEST(TensorDot, SimpleAutotune) { // 1. Define and setup the TC compilation unit with CUDA memory From 744d35e6c105c9bd61838352ed50eed8fef21336 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Tue, 21 Aug 2018 16:33:29 +0200 Subject: [PATCH 150/152] ScheduleTreeMapping::ScheduleTreeMapping: drop redundant initialization The filter_ field was being explicitly initialized to its default value, which is confusing, especially since the body of the constructor performs a proper initialization of this field. --- tc/core/polyhedral/schedule_tree_elem.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tc/core/polyhedral/schedule_tree_elem.cc b/tc/core/polyhedral/schedule_tree_elem.cc index 442d805ab..816df26f8 100644 --- a/tc/core/polyhedral/schedule_tree_elem.cc +++ b/tc/core/polyhedral/schedule_tree_elem.cc @@ -129,9 +129,7 @@ std::unique_ptr ScheduleTreeMapping::make( ScheduleTreeMapping::ScheduleTreeMapping( isl::ctx ctx, const ScheduleTreeMapping::Mapping& mapping) - : ScheduleTree(ctx, {}, NodeType), - mapping(mapping), - filter_(isl::union_set()) { + : ScheduleTree(ctx, {}, NodeType), mapping(mapping) { TC_CHECK_GT(mapping.size(), 0u) << "empty mapping filter"; auto domain = mapping.cbegin()->second.domain(); From 10be3f307fa85c62ebf150896a9af73c7df0b5ba Mon Sep 17 00:00:00 2001 From: Priya Goyal Date: Mon, 7 Oct 2019 16:10:02 -0700 Subject: [PATCH 151/152] Add file headers for OSS requirement --- build.sh | 14 ++++++++++++++ check_and_fix_format.sh | 14 ++++++++++++++ cmake/FindCuDNN.cmake | 16 +++++++++++++++- cmake/GetGitRevisionDescription.cmake | 14 ++++++++++++++ cmake/GetGitRevisionDescription.cmake.in | 14 ++++++++++++++ cmake/select_compute_arch.cmake | 16 +++++++++++++++- conda_recipes/caffe2/build.sh | 14 ++++++++++++++ conda_recipes/conda_build_tc.sh | 14 ++++++++++++++ conda_recipes/halide/build.sh | 14 ++++++++++++++ conda_recipes/llvm-tapir50/build.sh | 14 ++++++++++++++ conda_recipes/llvm-trunk/build.sh | 14 ++++++++++++++ conda_recipes/tensor_comprehensions/build.sh | 14 ++++++++++++++ docs/source/_static/css/tc_theme.css | 14 ++++++++++++++ docs/source/conf.py | 14 ++++++++++++++ external/isl/gitversion.h.in | 14 ++++++++++++++ external/isl/isl_config.h | 14 ++++++++++++++ isl_interface/include/isl/cpp.h | 14 ++++++++++++++ isl_interface/include/isl/stdint.h | 14 ++++++++++++++ isl_interface/isl_config.h | 14 ++++++++++++++ setup.py | 14 ++++++++++++++ tc/benchmarks/scripts/8.0.sh | 14 ++++++++++++++ tc/benchmarks/scripts/9.0.sh | 14 ++++++++++++++ tc/benchmarks/scripts/autotuner_parallel.sh | 14 ++++++++++++++ tc/benchmarks/scripts/report.sh | 14 ++++++++++++++ tc/core/check.h | 14 ++++++++++++++ tc/core/utils/type_traits.h | 14 ++++++++++++++ tc/lang/test_expected/annotate.expected | 14 ++++++++++++++ tc/lang/test_expected/builtins.expected | 14 ++++++++++++++ tc/lang/test_expected/comments.expected | 14 ++++++++++++++ tc/lang/test_expected/comprehension.expected | 14 ++++++++++++++ tc/lang/test_expected/convolution.expected | 14 ++++++++++++++ tc/lang/test_expected/function.expected | 14 ++++++++++++++ tc/lang/test_expected/indirect.expected | 14 ++++++++++++++ tc/lang/test_expected/lexer.expected | 14 ++++++++++++++ tc/lang/test_expected/lexer2.expected | 14 ++++++++++++++ tc/lang/test_expected/math.expected | 14 ++++++++++++++ tc/lang/test_expected/maxeq.expected | 14 ++++++++++++++ tc/lang/test_expected/scalar.expected | 14 ++++++++++++++ tc/lang/test_expected/sema-env.expected | 14 ++++++++++++++ tc/lang/test_expected/sema.expected | 14 ++++++++++++++ tc/lang/test_expected/statement.expected | 14 ++++++++++++++ tc/lang/test_expected/trinary.expected | 14 ++++++++++++++ tc/proto/compcache.proto | 14 ++++++++++++++ tc/proto/mapping_options.proto | 14 ++++++++++++++ tc/version/version.cc.in | 14 ++++++++++++++ test.sh | 14 ++++++++++++++ test_cpu.sh | 14 ++++++++++++++ 47 files changed, 660 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index 1d6a94d96..385b8639b 100755 --- a/build.sh +++ b/build.sh @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## #! /bin/bash set -ex diff --git a/check_and_fix_format.sh b/check_and_fix_format.sh index b4252e7f0..3794839b1 100755 --- a/check_and_fix_format.sh +++ b/check_and_fix_format.sh @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## #! /bin/bash CLANG=${CLANG:=clang-format-4.0} diff --git a/cmake/FindCuDNN.cmake b/cmake/FindCuDNN.cmake index bf6f1f4fe..f9cddd10e 100644 --- a/cmake/FindCuDNN.cmake +++ b/cmake/FindCuDNN.cmake @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## # Taken from Caffe2 # - Try to find cuDNN @@ -52,4 +66,4 @@ if(CUDNN_FOUND) set(CUDNN_LIBRARIES ${CUDNN_LIBRARY}) message(STATUS "Found cuDNN: v${CUDNN_VERSION} (include: ${CUDNN_INCLUDE_DIR}, library: ${CUDNN_LIBRARY})") mark_as_advanced(CUDNN_ROOT_DIR CUDNN_LIBRARY CUDNN_INCLUDE_DIR) -endif() \ No newline at end of file +endif() diff --git a/cmake/GetGitRevisionDescription.cmake b/cmake/GetGitRevisionDescription.cmake index aa78ad8ff..8b9c4dd29 100644 --- a/cmake/GetGitRevisionDescription.cmake +++ b/cmake/GetGitRevisionDescription.cmake @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## # - Returns a version string from Git # # These functions force a re-configure on each git commit so that you can diff --git a/cmake/GetGitRevisionDescription.cmake.in b/cmake/GetGitRevisionDescription.cmake.in index 6d8b708ef..88e6f36f6 100644 --- a/cmake/GetGitRevisionDescription.cmake.in +++ b/cmake/GetGitRevisionDescription.cmake.in @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## # # Internal file for GetGitRevisionDescription.cmake # diff --git a/cmake/select_compute_arch.cmake b/cmake/select_compute_arch.cmake index 9334b0485..85902acb0 100644 --- a/cmake/select_compute_arch.cmake +++ b/cmake/select_compute_arch.cmake @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## # Synopsis: # CUDA_SELECT_NVCC_ARCH_FLAGS(out_variable [target_CUDA_architectures]) # -- Selects GPU arch flags for nvcc based on target_CUDA_architectures @@ -197,4 +211,4 @@ function(CUDA_SELECT_NVCC_ARCH_FLAGS out_variable) string(REPLACE ";" " " nvcc_archs_readable "${nvcc_archs_readable}") set(${out_variable} ${nvcc_flags} PARENT_SCOPE) set(${out_variable}_readable ${nvcc_archs_readable} PARENT_SCOPE) -endfunction() \ No newline at end of file +endfunction() diff --git a/conda_recipes/caffe2/build.sh b/conda_recipes/caffe2/build.sh index 17068db9e..e4c66bb78 100644 --- a/conda_recipes/caffe2/build.sh +++ b/conda_recipes/caffe2/build.sh @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## #!/usr/bin/env bash set -e diff --git a/conda_recipes/conda_build_tc.sh b/conda_recipes/conda_build_tc.sh index aeb682bef..4ef3dd78c 100755 --- a/conda_recipes/conda_build_tc.sh +++ b/conda_recipes/conda_build_tc.sh @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## #!/usr/bin/env bash set -e diff --git a/conda_recipes/halide/build.sh b/conda_recipes/halide/build.sh index da5dd1b0e..8fb3735af 100644 --- a/conda_recipes/halide/build.sh +++ b/conda_recipes/halide/build.sh @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## #!/usr/bin/env bash set -e diff --git a/conda_recipes/llvm-tapir50/build.sh b/conda_recipes/llvm-tapir50/build.sh index b42950e1e..37d4d31ec 100644 --- a/conda_recipes/llvm-tapir50/build.sh +++ b/conda_recipes/llvm-tapir50/build.sh @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## #!/usr/bin/env bash set -e diff --git a/conda_recipes/llvm-trunk/build.sh b/conda_recipes/llvm-trunk/build.sh index fcae8ff35..78f972ad0 100644 --- a/conda_recipes/llvm-trunk/build.sh +++ b/conda_recipes/llvm-trunk/build.sh @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## #!/usr/bin/env bash set -e diff --git a/conda_recipes/tensor_comprehensions/build.sh b/conda_recipes/tensor_comprehensions/build.sh index fd7b6dc38..0f0d832a0 100755 --- a/conda_recipes/tensor_comprehensions/build.sh +++ b/conda_recipes/tensor_comprehensions/build.sh @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## #!/usr/bin/env bash set -e diff --git a/docs/source/_static/css/tc_theme.css b/docs/source/_static/css/tc_theme.css index 46600755e..1d5085dda 100644 --- a/docs/source/_static/css/tc_theme.css +++ b/docs/source/_static/css/tc_theme.css @@ -1,3 +1,17 @@ +/* # Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################# */ body { font-family: "Lato","proxima-nova","Helvetica Neue",Arial,sans-serif; } diff --git a/docs/source/conf.py b/docs/source/conf.py index 10fe9451a..b2b71c922 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## #!/usr/bin/env python3 # -*- coding: utf-8 -*- # diff --git a/external/isl/gitversion.h.in b/external/isl/gitversion.h.in index 29eace46a..c3a36627e 100644 --- a/external/isl/gitversion.h.in +++ b/external/isl/gitversion.h.in @@ -1 +1,15 @@ +// Copyright (c) 2017-present, Facebook, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ############################################################################# #define GIT_HEAD_ID "${ISL_GIT_VERSION}" diff --git a/external/isl/isl_config.h b/external/isl/isl_config.h index 8cfb4cbb7..f884c1677 100644 --- a/external/isl/isl_config.h +++ b/external/isl/isl_config.h @@ -1,3 +1,17 @@ +// Copyright (c) 2017-present, Facebook, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ############################################################################## /* Hard-coded configuration variables. */ /* define if your compiler has __attribute__ */ diff --git a/isl_interface/include/isl/cpp.h b/isl_interface/include/isl/cpp.h index a08305047..d60fc4aa5 100644 --- a/isl_interface/include/isl/cpp.h +++ b/isl_interface/include/isl/cpp.h @@ -1,3 +1,17 @@ +// Copyright (c) 2017-present, Facebook, Inc. +// # +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// # +// http://www.apache.org/licenses/LICENSE-2.0 +// # +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ############################################################################## /// These are automatically generated C++ bindings for isl. /// /// isl is a library for computing with integer sets and maps described by diff --git a/isl_interface/include/isl/stdint.h b/isl_interface/include/isl/stdint.h index 5a397d191..923608de9 100644 --- a/isl_interface/include/isl/stdint.h +++ b/isl_interface/include/isl/stdint.h @@ -1,3 +1,17 @@ +// Copyright (c) 2017-present, Facebook, Inc. +// # +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// # +// http://www.apache.org/licenses/LICENSE-2.0 +// # +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ############################################################################## // Mock version of isl/stdint.h for use in parsing the isl headers. // Assume C99 and simply include stdint.h. #include diff --git a/isl_interface/isl_config.h b/isl_interface/isl_config.h index 8c4c30a65..71655eb48 100644 --- a/isl_interface/isl_config.h +++ b/isl_interface/isl_config.h @@ -1,3 +1,17 @@ +// Copyright (c) 2017-present, Facebook, Inc. +// # +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// # +// http://www.apache.org/licenses/LICENSE-2.0 +// # +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ############################################################################## // Mock version of isl's isl_config.h configuration file. // extract_interface.cc expects this file to contain all // the required defines, but in TC they are set using diff --git a/setup.py b/setup.py index 4150a94c2..8d579c957 100644 --- a/setup.py +++ b/setup.py @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## from setuptools import setup, Extension, distutils, Command, find_packages import setuptools.command.install import setuptools.command.develop diff --git a/tc/benchmarks/scripts/8.0.sh b/tc/benchmarks/scripts/8.0.sh index 369a01c6f..625bbe255 100755 --- a/tc/benchmarks/scripts/8.0.sh +++ b/tc/benchmarks/scripts/8.0.sh @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## #! /bin/bash module avail diff --git a/tc/benchmarks/scripts/9.0.sh b/tc/benchmarks/scripts/9.0.sh index 340f51acc..6b253aa36 100755 --- a/tc/benchmarks/scripts/9.0.sh +++ b/tc/benchmarks/scripts/9.0.sh @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## #! /bin/bash module avail diff --git a/tc/benchmarks/scripts/autotuner_parallel.sh b/tc/benchmarks/scripts/autotuner_parallel.sh index 07b351a2b..c34965933 100755 --- a/tc/benchmarks/scripts/autotuner_parallel.sh +++ b/tc/benchmarks/scripts/autotuner_parallel.sh @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## #!/bin/sh #SBATCH -J TensorComprehensions # A single job name for the array diff --git a/tc/benchmarks/scripts/report.sh b/tc/benchmarks/scripts/report.sh index 00863f111..5d4f3a00e 100755 --- a/tc/benchmarks/scripts/report.sh +++ b/tc/benchmarks/scripts/report.sh @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## #! /bin/bash [ -z "$BACKEND" ] && echo "Need to set BACKEND (P100 or V100)" && exit 1; diff --git a/tc/core/check.h b/tc/core/check.h index e9f54ae19..90b7243b8 100644 --- a/tc/core/check.h +++ b/tc/core/check.h @@ -1,3 +1,17 @@ +// Copyright (c) 2017-present, Facebook, Inc. +// # +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// # +// http://www.apache.org/licenses/LICENSE-2.0 +// # +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ############################################################################## #pragma once #include diff --git a/tc/core/utils/type_traits.h b/tc/core/utils/type_traits.h index 5a93d0c8f..9ce4f3e54 100644 --- a/tc/core/utils/type_traits.h +++ b/tc/core/utils/type_traits.h @@ -1,3 +1,17 @@ +// Copyright (c) 2017-present, Facebook, Inc. +// # +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// # +// http://www.apache.org/licenses/LICENSE-2.0 +// # +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ############################################################################## #include namespace tc { diff --git a/tc/lang/test_expected/annotate.expected b/tc/lang/test_expected/annotate.expected index 937d7b75c..1cade9f62 100644 --- a/tc/lang/test_expected/annotate.expected +++ b/tc/lang/test_expected/annotate.expected @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## (def (ident fun) (list diff --git a/tc/lang/test_expected/builtins.expected b/tc/lang/test_expected/builtins.expected index ec8252c49..fdce29896 100644 --- a/tc/lang/test_expected/builtins.expected +++ b/tc/lang/test_expected/builtins.expected @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## (def (ident fun) (list diff --git a/tc/lang/test_expected/comments.expected b/tc/lang/test_expected/comments.expected index 0ca85db9e..7a6d7ac19 100644 --- a/tc/lang/test_expected/comments.expected +++ b/tc/lang/test_expected/comments.expected @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## (def (ident fun) (list diff --git a/tc/lang/test_expected/comprehension.expected b/tc/lang/test_expected/comprehension.expected index 0d6ca1947..35e694055 100644 --- a/tc/lang/test_expected/comprehension.expected +++ b/tc/lang/test_expected/comprehension.expected @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## (comprehension (ident R) (list (ident i) (ident j)) diff --git a/tc/lang/test_expected/convolution.expected b/tc/lang/test_expected/convolution.expected index b71d1758d..5b26581ef 100644 --- a/tc/lang/test_expected/convolution.expected +++ b/tc/lang/test_expected/convolution.expected @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## (def (ident conv) (list diff --git a/tc/lang/test_expected/function.expected b/tc/lang/test_expected/function.expected index 11b008e99..f60e13aa1 100644 --- a/tc/lang/test_expected/function.expected +++ b/tc/lang/test_expected/function.expected @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## (apply (ident foo) (list diff --git a/tc/lang/test_expected/indirect.expected b/tc/lang/test_expected/indirect.expected index 2a9da760d..f47d5e806 100644 --- a/tc/lang/test_expected/indirect.expected +++ b/tc/lang/test_expected/indirect.expected @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## (def (ident fun) (list diff --git a/tc/lang/test_expected/lexer.expected b/tc/lang/test_expected/lexer.expected index c9a2d19e0..dc542fbf0 100644 --- a/tc/lang/test_expected/lexer.expected +++ b/tc/lang/test_expected/lexer.expected @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## FOUND 'min' min min+max 1.4 .3 3 3. ~~~ <--- HERE diff --git a/tc/lang/test_expected/lexer2.expected b/tc/lang/test_expected/lexer2.expected index 457f1f5cc..201bb50d1 100644 --- a/tc/lang/test_expected/lexer2.expected +++ b/tc/lang/test_expected/lexer2.expected @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## min ~~~... <--- HERE 4.63 diff --git a/tc/lang/test_expected/math.expected b/tc/lang/test_expected/math.expected index 700d8d7d8..2b99f71a3 100644 --- a/tc/lang/test_expected/math.expected +++ b/tc/lang/test_expected/math.expected @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## (- (+ (+ diff --git a/tc/lang/test_expected/maxeq.expected b/tc/lang/test_expected/maxeq.expected index fbdfc865b..ea2c55f34 100644 --- a/tc/lang/test_expected/maxeq.expected +++ b/tc/lang/test_expected/maxeq.expected @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## (def (ident fun) (list diff --git a/tc/lang/test_expected/scalar.expected b/tc/lang/test_expected/scalar.expected index f1d381fca..d803a403c 100644 --- a/tc/lang/test_expected/scalar.expected +++ b/tc/lang/test_expected/scalar.expected @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## (def (ident fun) (list diff --git a/tc/lang/test_expected/sema-env.expected b/tc/lang/test_expected/sema-env.expected index d052a9d32..8a35c4d00 100644 --- a/tc/lang/test_expected/sema-env.expected +++ b/tc/lang/test_expected/sema-env.expected @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## B: (int32) H: (int32) IP: (int32) diff --git a/tc/lang/test_expected/sema.expected b/tc/lang/test_expected/sema.expected index 720bb14ec..8d8d11b5a 100644 --- a/tc/lang/test_expected/sema.expected +++ b/tc/lang/test_expected/sema.expected @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## (def (ident conv) (list diff --git a/tc/lang/test_expected/statement.expected b/tc/lang/test_expected/statement.expected index c3750c25d..ad60f1ae3 100644 --- a/tc/lang/test_expected/statement.expected +++ b/tc/lang/test_expected/statement.expected @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## (comprehension (ident output) (list diff --git a/tc/lang/test_expected/trinary.expected b/tc/lang/test_expected/trinary.expected index 7efa23aba..5f52899aa 100644 --- a/tc/lang/test_expected/trinary.expected +++ b/tc/lang/test_expected/trinary.expected @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## (? (ident a) (const 3 (int32)) diff --git a/tc/proto/compcache.proto b/tc/proto/compcache.proto index 5bc615118..3fe815ac6 100644 --- a/tc/proto/compcache.proto +++ b/tc/proto/compcache.proto @@ -1,3 +1,17 @@ +/* Copyright (c) 2017-present, Facebook, Inc. +/* +/* Licensed under the Apache License, Version 2.0 (the "License"); +/* you may not use this file except in compliance with the License. +/* You may obtain a copy of the License at +/* +/* http://www.apache.org/licenses/LICENSE-2.0 +/* +/* Unless required by applicable law or agreed to in writing, software +/* distributed under the License is distributed on an "AS IS" BASIS, +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +/* See the License for the specific language governing permissions and +/* limitations under the License. +/* ############################################################################# syntax = "proto2"; import "mapping_options.proto"; diff --git a/tc/proto/mapping_options.proto b/tc/proto/mapping_options.proto index 8beaf46dc..4b7572424 100644 --- a/tc/proto/mapping_options.proto +++ b/tc/proto/mapping_options.proto @@ -1,3 +1,17 @@ +/* Copyright (c) 2017-present, Facebook, Inc. +/* +/* Licensed under the Apache License, Version 2.0 (the "License"); +/* you may not use this file except in compliance with the License. +/* You may obtain a copy of the License at +/* +/* http://www.apache.org/licenses/LICENSE-2.0 +/* +/* Unless required by applicable law or agreed to in writing, software +/* distributed under the License is distributed on an "AS IS" BASIS, +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +/* See the License for the specific language governing permissions and +/* limitations under the License. +/* ############################################################################# syntax = "proto2"; package tc; diff --git a/tc/version/version.cc.in b/tc/version/version.cc.in index d8e221496..97bb73e4a 100644 --- a/tc/version/version.cc.in +++ b/tc/version/version.cc.in @@ -1,3 +1,17 @@ +/* Copyright (c) 2017-present, Facebook, Inc. +/* +/* Licensed under the Apache License, Version 2.0 (the "License"); +/* you may not use this file except in compliance with the License. +/* You may obtain a copy of the License at +/* +/* http://www.apache.org/licenses/LICENSE-2.0 +/* +/* Unless required by applicable law or agreed to in writing, software +/* distributed under the License is distributed on an "AS IS" BASIS, +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +/* See the License for the specific language governing permissions and +/* limitations under the License. +/* ############################################################################# #include namespace tc { diff --git a/test.sh b/test.sh index 93bb521f0..ca846e150 100755 --- a/test.sh +++ b/test.sh @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## #! /bin/bash set -e diff --git a/test_cpu.sh b/test_cpu.sh index 3efcb5311..01f8a39a0 100755 --- a/test_cpu.sh +++ b/test_cpu.sh @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## #! /bin/bash set -e From 680f8c9d61664a78294cd75335091fe3cac2bb72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20O=E2=80=99Shannessy?= Date: Fri, 28 Apr 2023 11:02:40 -0700 Subject: [PATCH 152/152] Remove references to unmaintained website --- .github/ISSUE_TEMPLATE.md | 2 +- README.md | 1 - docs/source/contacts.rst | 6 ------ 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 757a5e21b..b1d97f315 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -2,7 +2,7 @@ Tensor Comprehensions Github Issues Guidelines ---------------------------------------------- If you have a feature request or a bug report (build issue), please open an issue on Github and fill the template below so we can help you better and faster. If you have some general -questions about Tensor Comprehensions, please visit our [slack channel](https://tensorcomprehensions.herokuapp.com/) or email us at tensorcomp@fb.com +questions about Tensor Comprehensions, please email us at tensorcomp@fb.com For build issues, please add `[Build]` at the beginning of issue title. diff --git a/README.md b/README.md index 1eebf0944..5567b40ea 100644 --- a/README.md +++ b/README.md @@ -131,7 +131,6 @@ You can find documentation [here](https://facebookresearch.github.io/TensorCompr * **Email**: tensorcomp@fb.com * **GitHub issues**: bug reports, feature requests, install issues, RFCs, thoughts, etc. -* **Slack**: For discussion around framework integration, build support, collaboration, etc. join our slack channel https://tensorcomprehensions.herokuapp.com/. # Code of Conduct See the [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) file for more details. diff --git a/docs/source/contacts.rst b/docs/source/contacts.rst index fef45d711..d8c00d8b9 100644 --- a/docs/source/contacts.rst +++ b/docs/source/contacts.rst @@ -20,9 +20,3 @@ Contributions Want to contribute? Open a `pull request on Github `_. Don't forget to read the `contributor's instructions `_. Different parts of Tensor Comprehensions are managed by different people, make sure to tag the `code owners `_ of the part you are modifying. - - -Slack channel -------------- - -For a faster and tighter interaction, join our team on Slack: `TensorComprehensions.slack.com `_.