1#ifndef FREE_TENSOR_PRESBURGER_H
2#define FREE_TENSOR_PRESBURGER_H
6#include <isl/id_type.h>
8#include <unordered_set>
16#include <isl/options.h>
19#include <isl/space_type.h>
38#define COPY_ISL_PTR(ptr, type) _COPY_ISL_PTR(ptr, isl_##type##_copy)
41 return copy(
const_cast<T *
>(ptr));
59 isl_ctx *ctx_ =
nullptr;
62 PBCtx() : ctx_(isl_ctx_alloc()) {
63 isl_options_set_on_error(ctx_, ISL_ON_ERROR_ABORT);
77 isl_map *map_ =
nullptr;
83 : ctx_(
ctx), map_(isl_map_read_from_str(
ctx->
get(), str.c_str())) {
84 if (map_ ==
nullptr) {
85 ERROR(
"Unable to construct an PBMap from " + str);
89 if (map_ !=
nullptr) {
97 if (map_ !=
nullptr) {
106 ctx_ = std::move(other.ctx_);
107 if (map_ !=
nullptr) {
114 bool isValid()
const {
return map_ !=
nullptr; }
116 const auto &
ctx()
const {
return ctx_; }
117 auto &
ctx() {
return ctx_; }
130 bool isValid()
const {
return !data_.empty(); }
131 const auto &
data()
const {
return data_; }
133 return os << s.data_;
141 return isl_map_is_empty(
get());
146 isl_size
nBasic()
const {
return isl_map_n_basic_map(
get()); }
148 isl_size
nInDims()
const {
return isl_map_dim(
get(), isl_dim_in); }
149 isl_size
nOutDims()
const {
return isl_map_dim(
get(), isl_dim_out); }
153 return isl_map_get_dim_name(
get(), isl_dim_in, i);
156 return isl_map_get_dim_name(
get(), isl_dim_out, i);
159 return isl_map_get_dim_name(
get(), isl_dim_param, i);
163 return os << isl_map_to_str(map.map_);
169 isl_val *val_ =
nullptr;
175 if (val_ !=
nullptr) {
183 if (val_ !=
nullptr) {
192 ctx_ = std::move(other.ctx_);
193 if (val_ !=
nullptr) {
200 bool isValid()
const {
return val_ !=
nullptr; }
202 const auto &
ctx()
const {
return ctx_; }
203 auto &
ctx() {
return ctx_; }
209 bool isNaN()
const {
return isl_val_is_nan(
get()); }
210 bool isRat()
const {
return isl_val_is_rat(
get()); }
211 bool isInt()
const {
return isl_val_is_int(
get()); }
212 bool isInf()
const {
return isl_val_is_infty(
get()); }
215 int numSi()
const {
return isl_val_get_num_si(
get()); }
216 int denSi()
const {
return isl_val_get_den_si(
get()); }
219 return os << isl_val_to_str(val.val_);
225 isl_set *set_ =
nullptr;
231 : ctx_(
ctx), set_(isl_set_read_from_str(
ctx->
get(), str.c_str())) {
232 if (set_ ==
nullptr) {
233 ERROR(
"Unable to construct an PBSet from " + str);
237 if (set_ !=
nullptr) {
245 if (set_ !=
nullptr) {
254 ctx_ = std::move(other.ctx_);
255 if (set_ !=
nullptr) {
262 bool isValid()
const {
return set_ !=
nullptr; }
264 const auto &
ctx()
const {
return ctx_; }
265 auto &
ctx() {
return ctx_; }
278 bool isValid()
const {
return !data_.empty(); }
279 const auto &
data()
const {
return data_; }
281 return os << s.data_;
289 return isl_set_is_empty(
get());
294 isl_size
nBasic()
const {
return isl_set_n_basic_set(set_); }
296 isl_size
nDims()
const {
return isl_set_dim(
get(), isl_dim_set); }
300 return isl_set_get_dim_name(
get(), isl_dim_set, i);
303 return isl_set_get_dim_name(
get(), isl_dim_param, i);
307 return isl_set_dim_has_lower_bound(
get(), isl_dim_set, i);
310 return isl_set_dim_has_upper_bound(
get(), isl_dim_set, i);
314 return os << isl_set_to_str(set.set_);
320 isl_space *space_ =
nullptr;
325 : ctx_(
ctx), space_(space) {}
327 : ctx_(set.
ctx()), space_(isl_set_get_space(set.
get())) {}
329 : ctx_(map.
ctx()), space_(isl_map_get_space(map.
get())) {}
331 if (space_ !=
nullptr) {
332 isl_space_free(space_);
339 if (space_ !=
nullptr) {
340 isl_space_free(space_);
342 space_ = other.
copy();
347 : ctx_(
std::
move(other.ctx_)), space_(other.
move()) {}
349 ctx_ = std::move(other.ctx_);
350 if (space_ !=
nullptr) {
351 isl_space_free(space_);
353 space_ = other.move();
357 bool isValid()
const {
return space_ !=
nullptr; }
359 const auto &
ctx()
const {
return ctx_; }
360 auto &
ctx() {
return ctx_; }
367 if (space_ ==
nullptr || other.space_ ==
nullptr)
368 return space_ == other.space_;
369 return isl_space_is_equal(
get(), other.
get());
373 return os << isl_space_to_str(space.space_);
379 isl_pw_aff *func_ =
nullptr;
386 : ctx_(
ctx),
func_(isl_pw_aff_read_from_str(
ctx->
get(), str.c_str())) {
387 if (
func_ ==
nullptr) {
388 ERROR(
"Unable to construct an PBSingleFunc from " + str);
392 : ctx_(
ctx),
func_(isl_pw_aff_from_aff(func)) {}
395 if (
func_ !=
nullptr) {
396 isl_pw_aff_free(
func_);
401 : ctx_(other.ctx_),
func_(other.
copy()) {}
404 if (
func_ !=
nullptr) {
405 isl_pw_aff_free(
func_);
414 ctx_ = std::move(other.ctx_);
415 if (
func_ !=
nullptr) {
416 isl_pw_aff_free(
func_);
418 func_ = other.move();
424 const auto &
ctx()
const {
return ctx_; }
425 auto &
ctx() {
return ctx_; }
438 bool isValid()
const {
return !data_.empty(); }
439 const auto &
data()
const {
return data_; }
441 return os << s.data_;
449 isl_size
nInDims()
const {
return isl_pw_aff_dim(
get(), isl_dim_in); }
451 std::vector<std::pair<PBSet, PBSingleFunc>>
pieces()
const {
452 typedef std::vector<std::pair<PBSet, PBSingleFunc>> Result;
453 std::pair<Result, Ref<PBCtx>> userData;
454 isl_pw_aff_foreach_piece(
456 [](isl_set *set, isl_aff *piece,
void *userDataRaw) {
457 auto &[result,
ctx] =
458 *(std::pair<Result, Ref<PBCtx>> *)userDataRaw;
465 return userData.first;
470 return os << isl_pw_aff_to_str(func.func_);
476 isl_pw_multi_aff *func_ =
nullptr;
484 func_(isl_pw_multi_aff_read_from_str(
ctx->
get(), str.c_str())) {
485 if (
func_ ==
nullptr) {
486 ERROR(
"Unable to construct an PBFunc from " + str);
491 : ctx_(singleFunc.
ctx()),
492 func_(isl_pw_multi_aff_from_pw_aff(singleFunc.
copy())) {}
495 func_(isl_pw_multi_aff_from_pw_aff(singleFunc.
move())) {}
498 : ctx_(map.
ctx()),
func_(isl_pw_multi_aff_from_map(map.
copy())) {}
501 func_(isl_pw_multi_aff_from_map(map.
move())) {}
504 : ctx_(set.
ctx()),
func_(isl_pw_multi_aff_from_set(set.
copy())) {}
507 func_(isl_pw_multi_aff_from_set(set.
move())) {}
510 if (
func_ !=
nullptr) {
511 isl_pw_multi_aff_free(
func_);
518 if (
func_ !=
nullptr) {
519 isl_pw_multi_aff_free(
func_);
527 ctx_ = std::move(other.ctx_);
528 if (
func_ !=
nullptr) {
529 isl_pw_multi_aff_free(
func_);
531 func_ = other.move();
537 const auto &
ctx()
const {
return ctx_; }
538 auto &
ctx() {
return ctx_; }
551 bool isValid()
const {
return !data_.empty(); }
552 const auto &
data()
const {
return data_; }
554 return os << s.data_;
560 isl_size
nInDims()
const {
return isl_pw_multi_aff_dim(
get(), isl_dim_in); }
562 return isl_pw_multi_aff_dim(
get(), isl_dim_out);
566 return {ctx_, isl_pw_multi_aff_get_pw_aff(
get(), 0)};
569 std::vector<std::pair<PBSet, PBFunc>>
pieces()
const {
570 typedef std::vector<std::pair<PBSet, PBFunc>> Result;
571 std::pair<Result, Ref<PBCtx>> userData;
572 isl_pw_multi_aff_foreach_piece(
574 [](isl_set *set, isl_multi_aff *piece,
void *userDataRaw) {
575 auto &[result,
ctx] =
576 *(std::pair<Result, Ref<PBCtx>> *)userDataRaw;
579 PBFunc(
ctx, isl_pw_multi_aff_from_multi_aff(piece)));
583 return userData.first;
587 return os << isl_pw_multi_aff_to_str(func.func_);
593 isl_point *point_ =
nullptr;
598 : ctx_(
ctx), point_(point) {}
601 if (point_ !=
nullptr) {
602 isl_point_free(point_);
609 if (point_ !=
nullptr) {
610 isl_point_free(point_);
612 point_ = other.
copy();
617 : ctx_(
std::
move(other.ctx_)), point_(other.
move()) {}
619 ctx_ = std::move(other.ctx_);
620 if (point_ !=
nullptr) {
621 isl_point_free(point_);
623 point_ = other.move();
627 bool isValid()
const {
return point_ !=
nullptr; }
633 bool isVoid()
const {
return isl_point_is_void(point_); }
635 const auto &
ctx()
const {
return ctx_; }
636 auto &
ctx() {
return ctx_; }
640 std::vector<PBVal> result;
641 isl_size nCoord = isl_space_dim(
642 PBSpace(ctx_, isl_point_get_space(point_)).
get(), isl_dim_set);
643 for (isl_size i = 0; i < nCoord; ++i)
645 ctx_, isl_point_get_coordinate_val(point_, isl_dim_set, i));
651concept PBMapRef = std::same_as<PBMap, std::decay_t<T>>;
653concept PBValRef = std::same_as<PBVal, std::decay_t<T>>;
655concept PBSetRef = std::same_as<PBSet, std::decay_t<T>>;
659concept PBFuncRef = std::same_as<PBFunc, std::decay_t<T>>;
663template <
typename T>
auto PBRefTake(std::remove_reference_t<T> &t) {
666template <
typename T>
auto PBRefTake(std::remove_reference_t<T> &&t) {
667 static_assert(!std::is_lvalue_reference_v<T>);
672 if (
lhs.ctx()->get() !=
rhs.ctx()->get()) {
674 "Operands of a Presburger operation should be on the same context");
680 return {set.
ctx(), isl_set_project_out_all_params(PBRefTake<T>(set))};
683 return {map.
ctx(), isl_map_project_out_all_params(PBRefTake<T>(map))};
689 isl_set_project_out_param_id(
691 isl_id_alloc(set.ctx()->get(), name.c_str(),
nullptr))};
696 isl_set_project_out(PBRefTake<T>(set), isl_dim_param, first,
n)};
701 isl_set_project_out(PBRefTake<T>(set), isl_dim_set, first,
n)};
707 isl_map_project_out_param_id(
709 isl_id_alloc(map.ctx()->get(), name.c_str(),
nullptr))};
714 isl_map_project_out(PBRefTake<T>(map), isl_dim_param, first,
n)};
719 isl_map_project_out(PBRefTake<T>(map), isl_dim_in, first,
n)};
724 isl_map_project_out(PBRefTake<T>(map), isl_dim_out, first,
n)};
729 isl_set_insert_dims(PBRefTake<T>(set), isl_dim_set, first,
n)};
734 isl_map_insert_dims(PBRefTake<T>(map), isl_dim_in, first,
n)};
739 isl_map_insert_dims(PBRefTake<T>(map), isl_dim_out, first,
n)};
743 return {set.
ctx(), isl_set_fix_si(PBRefTake<T>(set), isl_dim_set, pos, x)};
746 return {map.set(), isl_map_fix_si(PBRefTake<T>(map), isl_dim_in, pos, x)};
749 return {map.
ctx(), isl_map_fix_si(PBRefTake<T>(map), isl_dim_out, pos, x)};
754 isl_set_lower_bound_si(PBRefTake<T>(set), isl_dim_set, pos, x)};
758 isl_map_lower_bound_si(PBRefTake<T>(map), isl_dim_in, pos, x)};
762 isl_map_lower_bound_si(PBRefTake<T>(map), isl_dim_out, pos, x)};
767 isl_set_upper_bound_si(PBRefTake<T>(set), isl_dim_set, pos, x)};
771 isl_map_upper_bound_si(PBRefTake<T>(map), isl_dim_in, pos, x)};
775 isl_map_upper_bound_si(PBRefTake<T>(map), isl_dim_out, pos, x)};
779 return {set.
ctx(), isl_map_from_domain(
PBRefTake(set))};
788 return {map.
ctx(), isl_map_move_dims(PBRefTake<T>(map), isl_dim_out, target,
789 isl_dim_in, first,
n)};
794 return {map.
ctx(), isl_map_move_dims(PBRefTake<T>(map), isl_dim_in, target,
795 isl_dim_out, first,
n)};
809 return {map.
ctx(), isl_map_move_dims(PBRefTake<T>(map), isl_dim_param,
810 target, isl_dim_in, first,
n)};
815 return {map.
ctx(), isl_map_move_dims(PBRefTake<T>(map), isl_dim_param,
816 target, isl_dim_out, first,
n)};
822 return {map.
ctx(), isl_map_move_dims(PBRefTake<T>(map), isl_dim_in, target,
823 isl_dim_param, first,
n)};
828 return {map.
ctx(), isl_map_move_dims(PBRefTake<T>(map), isl_dim_out, target,
829 isl_dim_param, first,
n)};
834 return {set.
ctx(), isl_set_move_dims(PBRefTake<T>(set), isl_dim_param,
835 target, isl_dim_set, first,
n)};
839 return {set.
ctx(), isl_set_move_dims(PBRefTake<T>(set), isl_dim_set, target,
840 isl_dim_param, first,
n)};
843template <PBSetRef T, PBSetRef U>
845 auto n = std::max(
lhs.nDims(),
rhs.nDims());
846 return std::make_pair(
853 return {set.ctx(), isl_set_complement(PBRefTake<T>(set))};
857 return {map.ctx(), isl_map_complement(PBRefTake<T>(map))};
862 return {map.ctx(), isl_map_reverse(PBRefTake<T>(map))};
867 "," + std::to_string(
rhs.nBasic()));
869 isl_map_subtract(PBRefTake<T>(
lhs), PBRefTake<U>(
rhs))};
873 "," + std::to_string(
rhs.nBasic()));
875 isl_set_subtract(PBRefTake<T>(
lhs), PBRefTake<U>(
rhs))};
880 "nBasic=" + std::to_string(
lhs.nBasic()) +
"," +
881 std::to_string(
rhs.nBasic()));
883 isl_map_intersect(PBRefTake<T>(
lhs), PBRefTake<U>(
rhs))};
887 "nBasic=" + std::to_string(
lhs.nBasic()) +
"," +
888 std::to_string(
rhs.nBasic()));
890 isl_set_intersect(PBRefTake<T>(
lhs), PBRefTake<U>(
rhs))};
895 "nBasic=" + std::to_string(
lhs.nBasic()) +
"," +
896 std::to_string(
rhs.nBasic()));
898 isl_map_intersect_domain(PBRefTake<T>(
lhs), PBRefTake<U>(
rhs))};
902 "nBasic=" + std::to_string(
lhs.nBasic()) +
"," +
903 std::to_string(
rhs.nBasic()));
905 isl_map_intersect_range(PBRefTake<T>(
lhs), PBRefTake<U>(
rhs))};
908template <PBSingleFuncRef T, PBSetRef U>
911 isl_pw_aff_intersect_domain(PBRefTake<T>(
lhs), PBRefTake<U>(
rhs))};
915 PBRefTake<T>(
lhs), PBRefTake<U>(
rhs))};
920 isl_set_intersect_params(PBRefTake<T>(
lhs), PBRefTake<U>(
rhs))};
924 isl_map_intersect_params(PBRefTake<T>(
lhs), PBRefTake<U>(
rhs))};
929 "," + std::to_string(
rhs.nBasic()));
931 isl_map_union(PBRefTake<T>(
lhs), PBRefTake<U>(
rhs))};
936 "," + std::to_string(
rhs.nBasic()));
938 isl_set_union(PBRefTake<T>(
lhs), PBRefTake<U>(
rhs))};
944 isl_set_apply(PBRefTake<T>(
lhs), PBRefTake<U>(
rhs))};
950 isl_map_apply_domain(PBRefTake<T>(
lhs), PBRefTake<U>(
rhs))};
956 isl_map_apply_range(PBRefTake<T>(
lhs), PBRefTake<U>(
rhs))};
962 isl_map_sum(PBRefTake<T>(
lhs), PBRefTake<U>(
rhs))};
967 isl_set_sum(PBRefTake<T>(
lhs), PBRefTake<U>(
rhs))};
972 return {map.ctx(), isl_map_neg(PBRefTake<T>(map))};
976 return {set.ctx(), isl_set_neg(PBRefTake<T>(set))};
981 return {map.ctx(), isl_map_lexmax(PBRefTake<T>(map))};
986 return {map.ctx(), isl_map_lexmin(PBRefTake<T>(map))};
991 return {set.ctx(), isl_set_lexmax(PBRefTake<T>(set))};
996 return {set.ctx(), isl_set_lexmin(PBRefTake<T>(set))};
1001 return {space.ctx(), isl_map_identity(PBRefTake<T>(space))};
1006 return {space.ctx(), isl_map_lex_ge(PBRefTake<T>(space))};
1011 return {space.ctx(), isl_map_lex_gt(PBRefTake<T>(space))};
1016 return {space.ctx(), isl_map_lex_le(PBRefTake<T>(space))};
1021 return {space.ctx(), isl_map_lex_lt(PBRefTake<T>(space))};
1026 return {ctx, isl_space_alloc(ctx->
get(), nparam, nIn, nOut)};
1031 return {ctx, isl_space_set_alloc(ctx->
get(), nparam, dim)};
1035 return {space.
ctx(), isl_set_empty(PBRefTake<T>(space))};
1039 return {space.
ctx(), isl_map_empty(PBRefTake<T>(space))};
1043 return {space.
ctx(), isl_set_universe(PBRefTake<T>(space))};
1047 return {space.
ctx(), isl_map_universe(PBRefTake<T>(space))};
1051 return {map.
ctx(), isl_map_domain(PBRefTake<T>(map))};
1055 return {map.
ctx(), isl_map_range(PBRefTake<T>(map))};
1058template <PBSingleFuncRef T> PBSet
domain(T &&func) {
1059 return {func.
ctx(), isl_pw_aff_domain(PBRefTake<T>(func))};
1061template <PBFuncRef T> PBSet
domain(T &&func) {
1062 return {func.
ctx(), isl_multi_pw_aff_domain(PBRefTake<T>(func))};
1066 return {set.
ctx(), isl_set_params(PBRefTake<T>(set))};
1068template <PBMapRef T> PBSet
params(T &&map) {
1069 return {map.
ctx(), isl_map_params(PBRefTake<T>(map))};
1074 return {set.ctx(), isl_set_coalesce(PBRefTake<T>(set))};
1079 return {map.ctx(), isl_map_coalesce(PBRefTake<T>(map))};
1084 isl_set_flat_product(PBRefTake<T>(
lhs), PBRefTake<U>(
rhs))};
1088 return {set.
ctx(), isl_set_dim_max_val(PBRefTake<T>(set), pos)};
1092 return {set.
ctx(), isl_set_dim_min_val(PBRefTake<T>(set), pos)};
1097 isl_set_plain_get_val_if_fixed(set.
get(), isl_dim_set, pos)};
1101 return {space.
ctx(), isl_space_map_from_set(PBRefTake<T>(space))};
1105 return {map.
ctx(), isl_map_wrap(PBRefTake<T>(map))};
1109 return {set.
ctx(), isl_set_unwrap(PBRefTake<T>(set))};
1113 return {set.
ctx(), isl_set_flatten(PBRefTake<T>(set))};
1116 return {map.
ctx(), isl_map_flatten_domain(PBRefTake<T>(map))};
1119 return {map.
ctx(), isl_map_flatten_range(PBRefTake<T>(map))};
1127 return {set.
ctx(), isl_set_sample_point(PBRefTake<T>(set))};
1130template <PBSingleFuncRef T, PBSingleFuncRef U>
1133 isl_pw_aff_min(PBRefTake<T>(
lhs), PBRefTake<U>(
rhs))};
1136template <PBSingleFuncRef T, PBSingleFuncRef U>
1139 isl_pw_aff_max(PBRefTake<T>(
lhs), PBRefTake<U>(
rhs))};
1160 auto coefficientsMap = isl_map_from_basic_map(isl_basic_set_unwrap(
1161 isl_set_coefficients(isl_set_remove_divs(PBRefTake<T>(set)))));
1162 auto ctx = isl_map_get_ctx(coefficientsMap);
1163 auto paramsSpace = isl_space_domain(isl_map_get_space(coefficientsMap));
1164 auto nParams = isl_space_dim(paramsSpace, isl_dim_set);
1165 auto cPoint = isl_point_zero(paramsSpace);
1166 isl_point_set_coordinate_val(cPoint, isl_dim_set, nParams - 1,
1167 isl_val_int_from_si(ctx, -c));
1168 return apply(
PBSet(set.ctx(), isl_set_from_point(cPoint)),
1169 PBMap(set.ctx(), coefficientsMap));
1173 return isl_set_is_subset(small.
get(), big.
get());
1176 return isl_map_is_subset(small.
get(), big.
get());
1181 "," + std::to_string(
rhs.nBasic()));
1182 return isl_set_is_equal(
lhs.get(),
rhs.get());
1187 "," + std::to_string(
rhs.nBasic()));
1188 return isl_map_is_equal(
lhs.get(),
rhs.get());
1192 return isl_pw_aff_is_equal(
lhs.get(),
rhs.get());
1196 return isl_pw_multi_aff_is_equal(
lhs.get(),
rhs.get());
1201 explicit PBBuildExpr(
const std::string &expr) : expr_(expr) {}
1215 return PBBuildExpr(
"(" + a.expr_ +
" + " + b.expr_ +
")");
1218 return *
this = *
this + other;
1223 return PBBuildExpr(
"(" + a.expr_ +
" - " + b.expr_ +
")");
1226 return *
this = *
this - other;
1230 return PBBuildExpr(
"(" + a.expr_ +
" * " + b.expr_ +
")");
1233 return *
this = *
this * other;
1237 return PBBuildExpr(
"(" + a.expr_ +
" / " + b.expr_ +
")");
1240 return *
this = *
this / other;
1244 return PBBuildExpr(
"ceil(" + a.expr_ +
" / " + b.expr_ +
")");
1247 return PBBuildExpr(
"floor(" + a.expr_ +
" / " + b.expr_ +
")");
1251 return PBBuildExpr(
"(" + a.expr_ +
" % " + b.expr_ +
")");
1254 return *
this = *
this % other;
1258 return PBBuildExpr(
"(" + a.expr_ +
" < " + b.expr_ +
")");
1262 return PBBuildExpr(
"(" + a.expr_ +
" <= " + b.expr_ +
")");
1266 return PBBuildExpr(
"(" + a.expr_ +
" > " + b.expr_ +
")");
1270 return PBBuildExpr(
"(" + a.expr_ +
" >= " + b.expr_ +
")");
1274 return PBBuildExpr(
"(" + a.expr_ +
" = " + b.expr_ +
")");
1278 return PBBuildExpr(
"(" + a.expr_ +
" != " + b.expr_ +
")");
1282 return PBBuildExpr(
"(" + a.expr_ +
" and " + b.expr_ +
")");
1286 return PBBuildExpr(
"(" + a.expr_ +
" or " + b.expr_ +
")");
1290 return PBBuildExpr(
"max(" + a.expr_ +
", " + b.expr_ +
")");
1294 return PBBuildExpr(
"min(" + a.expr_ +
", " + b.expr_ +
")");
1301 int anonVarNum_ = 0;
1302 std::unordered_set<std::string> namedVars;
1304 std::vector<PBBuildExpr> constraints_;
1308 std::vector<PBBuildExpr>
newVars(
int n,
const std::string &prefix =
"");
1321 template <
typename T = std::initializer_list<PBBuildExpr>>
1326 const std::vector<PBBuildExpr> &
constraints()
const {
return constraints_; }
1331 std::vector<PBBuildExpr> inputs_;
1332 std::vector<PBBuildExpr> outputs_;
1343 for (
auto &&e : exprs)
1347 std::vector<PBBuildExpr>
newInputs(
int n,
const std::string &prefix =
"");
1348 const std::vector<PBBuildExpr> &
inputs()
const {
return inputs_; }
1353 for (
auto &&e : exprs)
1357 std::vector<PBBuildExpr>
newOutputs(
int n,
const std::string &prefix =
"");
1358 const std::vector<PBBuildExpr> &
outputs()
const {
return outputs_; }
1365 std::vector<PBBuildExpr> vars_;
1376 for (
auto &&e : exprs)
1380 std::vector<PBBuildExpr>
newVars(
int n,
const std::string &prefix =
"");
1381 const std::vector<PBBuildExpr> &
vars()
const {
return vars_; }
1388 -> std::optional<
decltype(func(args...))> {
1389 decltype(func(args...)) ret;
1390 if (
timeout([&]() { ret = func(args...); }, seconds)) {
1393 return std::nullopt;
Definition: presburger.h:1199
friend std::ostream & operator<<(std::ostream &os, const PBBuildExpr &e)
Definition: presburger.cc:6
friend PBBuildExpr ceilDiv(const PBBuildExpr &a, const PBBuildExpr &b)
Definition: presburger.h:1243
friend PBBuildExpr operator-(const PBBuildExpr &a, const PBBuildExpr &b)
Definition: presburger.h:1222
PBBuildExpr(bool b)
Definition: presburger.h:1211
PBBuildExpr operator-() const
Definition: presburger.h:1221
PBBuildExpr(std::integral auto i)
Definition: presburger.h:1212
friend PBBuildExpr operator/(const PBBuildExpr &a, const PBBuildExpr &b)
Definition: presburger.h:1236
friend PBBuildExpr operator>=(const PBBuildExpr &a, const PBBuildExpr &b)
Definition: presburger.h:1269
friend PBBuildExpr max(const PBBuildExpr &a, const PBBuildExpr &b)
Definition: presburger.h:1289
friend PBBuildExpr floorDiv(const PBBuildExpr &a, const PBBuildExpr &b)
Definition: presburger.h:1246
PBBuildExpr & operator-=(const PBBuildExpr &other)
Definition: presburger.h:1225
PBBuildExpr & operator/=(const PBBuildExpr &other)
Definition: presburger.h:1239
friend PBBuildExpr operator<(const PBBuildExpr &a, const PBBuildExpr &b)
Definition: presburger.h:1257
friend PBBuildExpr operator>(const PBBuildExpr &a, const PBBuildExpr &b)
Definition: presburger.h:1265
PBBuildExpr & operator*=(const PBBuildExpr &other)
Definition: presburger.h:1232
PBBuildExpr(PBBuildExpr &&)=default
friend PBBuildExpr operator*(const PBBuildExpr &a, const PBBuildExpr &b)
Definition: presburger.h:1229
friend PBBuildExpr operator&&(const PBBuildExpr &a, const PBBuildExpr &b)
Definition: presburger.h:1281
friend PBBuildExpr operator==(const PBBuildExpr &a, const PBBuildExpr &b)
Definition: presburger.h:1273
PBBuildExpr & operator=(const PBBuildExpr &)=default
friend PBBuildExpr operator%(const PBBuildExpr &a, const PBBuildExpr &b)
Definition: presburger.h:1250
friend PBBuildExpr operator+(const PBBuildExpr &a, const PBBuildExpr &b)
Definition: presburger.h:1214
friend PBBuildExpr operator<=(const PBBuildExpr &a, const PBBuildExpr &b)
Definition: presburger.h:1261
PBBuildExpr(const PBBuildExpr &)=default
friend PBBuildExpr operator!=(const PBBuildExpr &a, const PBBuildExpr &b)
Definition: presburger.h:1277
friend PBBuildExpr min(const PBBuildExpr &a, const PBBuildExpr &b)
Definition: presburger.h:1293
friend PBBuildExpr operator||(const PBBuildExpr &a, const PBBuildExpr &b)
Definition: presburger.h:1285
PBBuildExpr & operator=(PBBuildExpr &&)=default
PBBuildExpr & operator%=(const PBBuildExpr &other)
Definition: presburger.h:1253
PBBuildExpr & operator+=(const PBBuildExpr &other)
Definition: presburger.h:1217
Definition: presburger.h:1300
PBBuilder(PBBuilder &&)=default
PBBuilder & operator=(PBBuilder &&)=default
void clearConstraints()
Definition: presburger.h:1327
void addConstraint(const PBBuildExpr &constraint)
Definition: presburger.cc:33
std::string getConstraintsStr() const
Definition: presburger.cc:29
const std::vector< PBBuildExpr > & constraints() const
Definition: presburger.h:1326
void addConstraints(T &&constraints)
Definition: presburger.h:1322
PBBuildExpr newVar(const std::string &name="")
Definition: presburger.cc:11
std::vector< PBBuildExpr > newVars(int n, const std::string &prefix="")
Definition: presburger.cc:21
PBBuilder(const PBBuilder &)=default
PBBuilder & operator=(const PBBuilder &)=default
Definition: presburger.h:58
isl_ctx * get() const
Definition: presburger.h:72
PBCtx(const PBCtx &other)=delete
PBCtx()
Definition: presburger.h:62
~PBCtx()
Definition: presburger.h:65
PBCtx & operator=(const PBCtx &other)=delete
PBCtx(PBCtx &&other)=delete
PBCtx & operator=(PBCtx &&other)=delete
Definition: presburger.h:544
const auto & data() const
Definition: presburger.h:552
Serialized(const std::string &data)
Definition: presburger.h:549
bool isValid() const
Definition: presburger.h:551
friend std::ostream & operator<<(std::ostream &os, const Serialized &s)
Definition: presburger.h:553
PBFunc to(const Ref< PBCtx > &ctx) const
Definition: presburger.h:550
Serialized()
Definition: presburger.h:548
Definition: presburger.h:474
std::vector< std::pair< PBSet, PBFunc > > pieces() const
Definition: presburger.h:569
isl_pw_multi_aff * move()
Definition: presburger.h:542
~PBFunc()
Definition: presburger.h:509
PBSingleFunc operator[](isl_size i) const
Definition: presburger.h:565
const auto & ctx() const
Definition: presburger.h:537
PBFunc to(const Ref< PBCtx > &ctx) const
Definition: presburger.h:558
PBFunc & operator=(PBFunc &&other)
Definition: presburger.h:526
friend std::ostream & operator<<(std::ostream &os, const PBFunc &func)
Definition: presburger.h:586
PBFunc(const PBMap &map)
Definition: presburger.h:497
isl_size nOutDims() const
Definition: presburger.h:561
Serialized toSerialized() const
Definition: presburger.h:557
PBFunc(PBFunc &&other)
Definition: presburger.h:525
PBFunc & operator=(const PBFunc &other)
Definition: presburger.h:516
isl_size nInDims() const
Definition: presburger.h:560
isl_pw_multi_aff * copy() const
Definition: presburger.h:541
auto & ctx()
Definition: presburger.h:538
PBFunc(PBMap &&map)
Definition: presburger.h:499
PBFunc(const Ref< PBCtx > &ctx, isl_pw_multi_aff *func)
Definition: presburger.h:480
PBFunc(const Ref< PBCtx > &ctx, const std::string &str)
Definition: presburger.h:482
PBFunc(const PBSet &set)
Definition: presburger.h:503
PBFunc(const PBSingleFunc &singleFunc)
Definition: presburger.h:490
PBFunc(PBSet &&set)
Definition: presburger.h:505
bool isValid() const
Definition: presburger.h:535
isl_pw_multi_aff * get() const
Definition: presburger.h:540
PBFunc()
Definition: presburger.h:479
PBFunc(const PBFunc &other)
Definition: presburger.h:515
PBFunc(PBSingleFunc &&singleFunc)
Definition: presburger.h:493
Definition: presburger.h:1330
void addOutputs(auto &&exprs)
Definition: presburger.h:1352
PBBuildExpr newOutput(const std::string &name)
Definition: presburger.cc:60
void addInput(const PBBuildExpr &expr)
Definition: presburger.cc:41
PBBuildExpr newInput(const std::string &name)
Definition: presburger.cc:44
PBMapBuilder(PBMapBuilder &&)=default
std::vector< PBBuildExpr > newInputs(int n, const std::string &prefix="")
Definition: presburger.cc:49
const std::vector< PBBuildExpr > & inputs() const
Definition: presburger.h:1348
PBMapBuilder & operator=(PBMapBuilder &&)=default
void addOutput(const PBBuildExpr &expr)
Definition: presburger.cc:57
std::vector< PBBuildExpr > newOutputs(int n, const std::string &prefix="")
Definition: presburger.cc:65
void clearOutputs()
Definition: presburger.h:1359
PBMapBuilder & operator=(const PBMapBuilder &)=default
PBMap build(const Ref< PBCtx > &ctx) const
Definition: presburger.cc:73
PBMapBuilder(const PBMapBuilder &)=default
void addInputs(auto &&exprs)
Definition: presburger.h:1342
void clearInputs()
Definition: presburger.h:1349
const std::vector< PBBuildExpr > & outputs() const
Definition: presburger.h:1358
Definition: presburger.h:123
const auto & data() const
Definition: presburger.h:131
PBMap to(const Ref< PBCtx > &ctx) const
Definition: presburger.h:129
Serialized()
Definition: presburger.h:127
friend std::ostream & operator<<(std::ostream &os, const Serialized &s)
Definition: presburger.h:132
bool isValid() const
Definition: presburger.h:130
Serialized(const std::string &data)
Definition: presburger.h:128
Definition: presburger.h:75
auto & ctx()
Definition: presburger.h:117
bool isValid() const
Definition: presburger.h:114
PBMap()
Definition: presburger.h:80
isl_map * move()
Definition: presburger.h:121
PBMap(PBMap &&other)
Definition: presburger.h:104
const char * nameParamDim(unsigned i) const
Definition: presburger.h:158
const char * nameOutDim(unsigned i) const
Definition: presburger.h:155
bool isBijective() const
Definition: presburger.h:144
isl_size nParamDims() const
Definition: presburger.h:150
Serialized toSerialized() const
Definition: presburger.h:136
isl_size nBasic() const
Definition: presburger.h:146
isl_size nInDims() const
Definition: presburger.h:148
isl_size nOutDims() const
Definition: presburger.h:149
isl_map * get() const
Definition: presburger.h:119
bool empty() const
Definition: presburger.h:139
bool isSingleValued() const
Definition: presburger.h:143
PBMap to(const Ref< PBCtx > &ctx) const
Definition: presburger.h:137
PBMap(const Ref< PBCtx > &ctx, isl_map *map)
Definition: presburger.h:81
isl_map * copy() const
Definition: presburger.h:120
PBMap & operator=(PBMap &&other)
Definition: presburger.h:105
PBMap & operator=(const PBMap &other)
Definition: presburger.h:95
PBMap(const PBMap &other)
Definition: presburger.h:94
friend std::ostream & operator<<(std::ostream &os, const PBMap &map)
Definition: presburger.h:162
~PBMap()
Definition: presburger.h:88
const char * nameInDim(unsigned i) const
Definition: presburger.h:152
PBMap(const Ref< PBCtx > &ctx, const std::string &str)
Definition: presburger.h:82
const auto & ctx() const
Definition: presburger.h:116
Definition: presburger.h:591
auto & ctx()
Definition: presburger.h:636
const auto & ctx() const
Definition: presburger.h:635
std::vector< PBVal > coordinates() const
Definition: presburger.h:638
bool isValid() const
Definition: presburger.h:627
~PBPoint()
Definition: presburger.h:600
isl_point * copy() const
Definition: presburger.h:630
bool isVoid() const
Definition: presburger.h:633
PBPoint()
Definition: presburger.h:596
PBPoint(const PBPoint &other)
Definition: presburger.h:606
isl_point * get() const
Definition: presburger.h:629
PBPoint & operator=(const PBPoint &other)
Definition: presburger.h:607
PBPoint(const Ref< PBCtx > &ctx, isl_point *point)
Definition: presburger.h:597
PBPoint & operator=(PBPoint &&other)
Definition: presburger.h:618
isl_point * move()
Definition: presburger.h:631
PBPoint(PBPoint &&other)
Definition: presburger.h:616
Definition: presburger.h:1364
void addVars(auto &&exprs)
Definition: presburger.h:1375
void addVar(const PBBuildExpr &expr)
Definition: presburger.cc:78
PBSetBuilder(PBSetBuilder &&)=default
void clearVars()
Definition: presburger.h:1382
std::vector< PBBuildExpr > newVars(int n, const std::string &prefix="")
Definition: presburger.cc:84
PBSetBuilder & operator=(const PBSetBuilder &)=default
PBSetBuilder(const PBSetBuilder &)=default
const std::vector< PBBuildExpr > & vars() const
Definition: presburger.h:1381
PBSetBuilder & operator=(PBSetBuilder &&)=default
PBSet build(const Ref< PBCtx > &ctx) const
Definition: presburger.cc:92
PBBuildExpr newVar(const std::string &name)
Definition: presburger.cc:79
Definition: presburger.h:271
const auto & data() const
Definition: presburger.h:279
Serialized(const std::string &data)
Definition: presburger.h:276
friend std::ostream & operator<<(std::ostream &os, const Serialized &s)
Definition: presburger.h:280
Serialized()
Definition: presburger.h:275
PBSet to(const Ref< PBCtx > &ctx) const
Definition: presburger.h:277
bool isValid() const
Definition: presburger.h:278
Definition: presburger.h:223
auto & ctx()
Definition: presburger.h:265
PBSet & operator=(PBSet &&other)
Definition: presburger.h:253
PBSet()
Definition: presburger.h:228
const char * nameParamDim(unsigned i) const
Definition: presburger.h:302
PBSet(const Ref< PBCtx > &ctx, const std::string &str)
Definition: presburger.h:230
isl_size nParamDims() const
Definition: presburger.h:297
isl_set * move()
Definition: presburger.h:269
bool isSingleValued() const
Definition: presburger.h:292
friend std::ostream & operator<<(std::ostream &os, const PBSet &set)
Definition: presburger.h:313
bool empty() const
Definition: presburger.h:287
bool isValid() const
Definition: presburger.h:262
const char * nameDim(unsigned i) const
Definition: presburger.h:299
bool hasUpperBound(unsigned i) const
Definition: presburger.h:309
PBSet & operator=(const PBSet &other)
Definition: presburger.h:243
isl_set * get() const
Definition: presburger.h:267
isl_size nBasic() const
Definition: presburger.h:294
PBSet(const Ref< PBCtx > &ctx, isl_set *set)
Definition: presburger.h:229
PBSet(const PBSet &other)
Definition: presburger.h:242
PBSet to(const Ref< PBCtx > &ctx) const
Definition: presburger.h:285
const auto & ctx() const
Definition: presburger.h:264
PBSet(PBSet &&other)
Definition: presburger.h:252
bool hasLowerBound(unsigned i) const
Definition: presburger.h:306
isl_set * copy() const
Definition: presburger.h:268
~PBSet()
Definition: presburger.h:236
isl_size nDims() const
Definition: presburger.h:296
Serialized toSerialized() const
Definition: presburger.h:284
Definition: presburger.h:431
const auto & data() const
Definition: presburger.h:439
bool isValid() const
Definition: presburger.h:438
PBSingleFunc to(const Ref< PBCtx > &ctx) const
Definition: presburger.h:437
Serialized()
Definition: presburger.h:435
Serialized(const std::string &data)
Definition: presburger.h:436
friend std::ostream & operator<<(std::ostream &os, const Serialized &s)
Definition: presburger.h:440
Definition: presburger.h:377
PBSingleFunc(const Ref< PBCtx > &ctx, isl_pw_aff *func)
Definition: presburger.h:383
PBSingleFunc & operator=(const PBSingleFunc &other)
Definition: presburger.h:402
const auto & ctx() const
Definition: presburger.h:424
~PBSingleFunc()
Definition: presburger.h:394
isl_pw_aff * get() const
Definition: presburger.h:427
PBSingleFunc(const Ref< PBCtx > &ctx, isl_aff *func)
Definition: presburger.h:391
std::vector< std::pair< PBSet, PBSingleFunc > > pieces() const
Definition: presburger.h:451
auto & ctx()
Definition: presburger.h:425
isl_pw_aff * move()
Definition: presburger.h:429
bool isValid() const
Definition: presburger.h:422
PBSingleFunc(PBSingleFunc &&other)
Definition: presburger.h:411
friend std::ostream & operator<<(std::ostream &os, const PBSingleFunc &func)
Definition: presburger.h:468
isl_size nInDims() const
Definition: presburger.h:449
PBSingleFunc(const PBSingleFunc &other)
Definition: presburger.h:400
PBSingleFunc(const Ref< PBCtx > &ctx, const std::string &str)
Definition: presburger.h:385
Serialized toSerialized() const
Definition: presburger.h:444
isl_pw_aff * copy() const
Definition: presburger.h:428
PBSingleFunc()
Definition: presburger.h:382
PBSingleFunc & operator=(PBSingleFunc &&other)
Definition: presburger.h:413
PBSingleFunc to(const Ref< PBCtx > &ctx) const
Definition: presburger.h:445
Definition: presburger.h:318
const auto & ctx() const
Definition: presburger.h:359
friend std::ostream & operator<<(std::ostream &os, const PBSpace &space)
Definition: presburger.h:372
isl_space * move()
Definition: presburger.h:364
PBSpace(PBSpace &&other)
Definition: presburger.h:346
bool operator==(const PBSpace &other) const
Definition: presburger.h:366
PBSpace & operator=(PBSpace &&other)
Definition: presburger.h:348
PBSpace(const Ref< PBCtx > &ctx, isl_space *space)
Definition: presburger.h:324
PBSpace(const PBMap &map)
Definition: presburger.h:328
PBSpace(const PBSpace &other)
Definition: presburger.h:336
PBSpace(const PBSet &set)
Definition: presburger.h:326
PBSpace()
Definition: presburger.h:323
auto & ctx()
Definition: presburger.h:360
isl_space * get() const
Definition: presburger.h:362
PBSpace & operator=(const PBSpace &other)
Definition: presburger.h:337
isl_space * copy() const
Definition: presburger.h:363
~PBSpace()
Definition: presburger.h:330
bool isValid() const
Definition: presburger.h:357
Definition: presburger.h:167
PBVal(PBVal &&other)
Definition: presburger.h:190
auto & ctx()
Definition: presburger.h:203
PBVal()
Definition: presburger.h:172
bool isValid() const
Definition: presburger.h:200
isl_val * move()
Definition: presburger.h:207
PBVal & operator=(PBVal &&other)
Definition: presburger.h:191
bool isNaN() const
Definition: presburger.h:209
PBVal(const Ref< PBCtx > &ctx, isl_val *val)
Definition: presburger.h:173
bool isNegInf() const
Definition: presburger.h:213
PBVal(const PBVal &other)
Definition: presburger.h:180
friend std::ostream & operator<<(std::ostream &os, const PBVal &val)
Definition: presburger.h:218
int numSi() const
Definition: presburger.h:215
bool isInt() const
Definition: presburger.h:211
bool isInf() const
Definition: presburger.h:212
const auto & ctx() const
Definition: presburger.h:202
bool isRat() const
Definition: presburger.h:210
PBVal & operator=(const PBVal &other)
Definition: presburger.h:181
isl_val * get() const
Definition: presburger.h:205
~PBVal()
Definition: presburger.h:174
isl_val * copy() const
Definition: presburger.h:206
int denSi() const
Definition: presburger.h:216
T * get() const
Definition: ref.h:101
Definition: presburger.h:659
Definition: presburger.h:651
Definition: presburger.h:655
Definition: presburger.h:661
Definition: presburger.h:657
Definition: presburger.h:653
#define ASSERT(expr)
Definition: except.h:152
#define ERROR(msg)
Definition: except.h:141
Definition: allocator.h:9
PBMap moveDimsInputToParam(T &&map, unsigned first, unsigned n, unsigned target)
Definition: presburger.h:807
PBMap moveDimsInputToOutput(T &&map, unsigned first, unsigned n, unsigned target)
Definition: presburger.h:786
T * _COPY_ISL_PTR(const T *ptr, T *(copy)(T *))
Definition: presburger.h:39
PBMap sum(T &&lhs, U &&rhs)
Definition: presburger.h:959
PBMap intersectDomain(T &&lhs, U &&rhs)
Definition: presburger.h:893
auto pbFuncWithTimeout(const auto &func, int seconds, const auto &...args) -> std::optional< decltype(func(args...))>
Definition: presburger.h:1387
PBMap unwrap(T &&set)
Definition: presburger.h:1108
auto PBRefTake(std::remove_reference_t< T > &t)
Definition: presburger.h:663
auto && lhs
Definition: const_fold.cc:70
PBSpace spaceAlloc(const Ref< PBCtx > &ctx, unsigned nparam, unsigned nIn, unsigned nOut)
Definition: presburger.h:1024
PBSingleFunc max(T &&lhs, U &&rhs)
Definition: presburger.h:1137
PBMap applyRange(T &&lhs, U &&rhs)
Definition: presburger.h:953
PBSet params(T &&set)
Definition: presburger.h:1065
PBMap moveDimsParamToOutput(T &&map, unsigned first, unsigned n, unsigned target)
Definition: presburger.h:826
PBSet projectOutParamDims(T &&set, unsigned first, unsigned n)
Definition: presburger.h:694
PBMap projectOutOutputDims(T &&map, unsigned first, unsigned n)
Definition: presburger.h:722
PBMap insertOutputDims(T &&map, unsigned first, unsigned n)
Definition: presburger.h:737
PBMap upperBoundOutputDim(T &&map, unsigned pos, int x)
Definition: presburger.h:773
PBMap flattenDomain(T &&map)
Definition: presburger.h:1115
std::string toString(const AST &op)
Definition: print_ast.cc:784
PBSet insertDims(T &&set, unsigned first, unsigned n)
Definition: presburger.h:727
PBMap moveDimsOutputToParam(T &&map, unsigned first, unsigned n, unsigned target)
Definition: presburger.h:813
PBMap identity(T &&space)
Definition: presburger.h:999
PBMap projectOutInputDims(T &&map, unsigned first, unsigned n)
Definition: presburger.h:717
PBSet flatten(T &&set)
Definition: presburger.h:1112
PBSet domain(T &&map)
Definition: presburger.h:1050
PBSet moveDimsParamToSet(T &&set, unsigned first, unsigned n, unsigned target)
Definition: presburger.h:838
bool operator==(const Allocator< T > &lhs, const Allocator< T > &rhs)
Definition: allocator.h:100
PBMap moveDimsOutputToInput(T &&map, unsigned first, unsigned n, unsigned target)
Definition: presburger.h:792
T * MOVE_ISL_PTR(T *&ptr)
Definition: presburger.h:44
PBMap flattenRange(T &&map)
Definition: presburger.h:1118
PBMap insertInputDims(T &&map, unsigned first, unsigned n)
Definition: presburger.h:732
PBMap lexGT(T &&space)
Definition: presburger.h:1009
PBSet flattenMapToSet(T &&map)
Definition: presburger.h:1122
PBSet projectOutAllParams(T &&set)
Definition: presburger.h:679
PBMap lexLE(T &&space)
Definition: presburger.h:1014
PBSpace spaceSetAlloc(const Ref< PBCtx > &ctx, unsigned nparam, unsigned dim)
Definition: presburger.h:1029
PBSet projectOutDims(T &&set, unsigned first, unsigned n)
Definition: presburger.h:699
PBMap lowerBoundInputDim(T &&map, unsigned pos, int x)
Definition: presburger.h:756
PBSet moveDimsSetToParam(T &&set, unsigned first, unsigned n, unsigned target)
Definition: presburger.h:833
PBSet apply(T &&lhs, U &&rhs)
Definition: presburger.h:941
PBSet wrap(T &&map)
Definition: presburger.h:1104
PBVal dimMinVal(T &&set, int pos)
Definition: presburger.h:1091
PBSpace spaceMapFromSet(T &&space)
Definition: presburger.h:1100
PBSet lowerBoundDim(T &&set, unsigned pos, int x)
Definition: presburger.h:752
PBMap applyDomain(T &&lhs, U &&rhs)
Definition: presburger.h:947
PBSet complement(T &&set)
Definition: presburger.h:851
PBMap emptyMap(T &&space)
Definition: presburger.h:1038
PBMap fixInputDim(T &&map, unsigned pos, int x)
Definition: presburger.h:745
PBMap fixOutputDim(T &&map, unsigned pos, int x)
Definition: presburger.h:748
PBMap neg(T &&map)
Definition: presburger.h:970
PBMap lexmax(T &&map)
Definition: presburger.h:979
PBSet coefficients(T &&set, int64_t c=0)
Definition: presburger.h:1155
PBSet universeSet(T &&space)
Definition: presburger.h:1042
PBMap subtract(T &&lhs, U &&rhs)
Definition: presburger.h:865
std::vector< T > uni(const std::vector< T > &lhs, const std::vector< T > &rhs)
Definition: container_utils.h:85
PBMap lexGE(T &&space)
Definition: presburger.h:1004
auto auto && rhs
Definition: const_fold.cc:70
PBPoint sample(T &&set)
Definition: presburger.h:1126
Ref< PBCtx > commonCtx(const auto &lhs, const auto &rhs)
Definition: presburger.h:671
PBSet fixDim(T &&set, unsigned pos, int x)
Definition: presburger.h:742
PBMap lexmin(T &&map)
Definition: presburger.h:984
PBMap reverse(T &&map)
Definition: presburger.h:860
PBSet upperBoundDim(T &&set, unsigned pos, int x)
Definition: presburger.h:765
PBMap universeMap(T &&space)
Definition: presburger.h:1046
PBMap upperBoundInputDim(T &&map, unsigned pos, int x)
Definition: presburger.h:769
PBMap moveDimsParamToInput(T &&map, unsigned first, unsigned n, unsigned target)
Definition: presburger.h:820
PBSet projectOutParamById(T &&set, const std::string &name)
Definition: presburger.h:687
PBSet range(T &&map)
Definition: presburger.h:1054
PBSet emptySet(T &&space)
Definition: presburger.h:1034
PBMap lexLT(T &&space)
Definition: presburger.h:1019
PBVal dimMaxVal(T &&set, int pos)
Definition: presburger.h:1087
bool timeout(const std::function< void()> &func, int seconds)
Definition: timeout.cc:36
PBMap intersectRange(T &&lhs, U &&rhs)
Definition: presburger.h:900
PBSingleFunc min(T &&lhs, U &&rhs)
Definition: presburger.h:1131
PBMap newDomainOnlyMap(T &&set)
Definition: presburger.h:778
std::pair< PBSet, PBSet > padToSameDims(T &&lhs, U &&rhs)
Definition: presburger.h:844
PBSet intersectParams(T &&lhs, U &&rhs)
Definition: presburger.h:918
PBMap lowerBoundOutputDim(T &&map, unsigned pos, int x)
Definition: presburger.h:760
PBSet cartesianProduct(T &&lhs, U &&rhs)
Definition: presburger.h:1082
PBVal dimFixVal(const PBSet &set, int pos)
Definition: presburger.h:1095
std::unordered_map< T, std::pair< V1, V2 >, Hash, KeyEqual > intersect(const std::unordered_map< T, V1, Hash, KeyEqual > &lhs, const std::unordered_map< T, V2, Hash, KeyEqual > &rhs)
Definition: container_utils.h:24
PBSet coalesce(T &&set)
Definition: presburger.h:1072
bool isSubset(const PBSet &small, const PBSet &big)
Definition: presburger.h:1172
T * GET_ISL_PTR(T *ptr)
Definition: presburger.h:33
PBMap newRangeOnlyMap(T &&set)
Definition: presburger.h:781
std::vector< Expr > vars_
Definition: pluto.cc:250
#define COPY_ISL_PTR(ptr, type)
Definition: presburger.h:38
#define DEBUG_PROFILE_VERBOSE(name, detail)
Definition: profile.h:45
#define DEBUG_PROFILE(name)
Definition: profile.h:43
PBFunc::Serialized func_
Definition: prop_one_time_use.cc:22