Lines Matching refs:isl
15 /* Test the pointer interface for interaction between isl C and C++ types.
18 * - construction from an isl C object
20 * - get a non-owned C pointer from an isl C++ object usable in __isl_keep
22 * - use copy to get an owned C pointer from an isl C++ object which is usable
25 * - use release to get an owned C pointer from an isl C++ object which is
29 void test_pointer(isl::ctx ctx)
32 isl::set empty = isl::manage(c_empty);
43 /* Test that isl objects can be constructed.
59 * Construction from an isl C pointer is tested in test_pointer.
61 void test_constructors(isl::ctx ctx)
63 isl::val null;
66 isl::val zero_from_str = isl::val(ctx, "0");
69 isl::val zero_int_con = isl::val(ctx, 0);
72 isl::val zero_static_con = isl::val::zero(ctx);
75 isl::basic_set bs(ctx, "{ [1] }");
76 isl::set result(ctx, "{ [1] }");
77 isl::set s = bs;
79 isl::set s2(bs);
82 isl::union_set us(ctx, "{ A[1]; B[2, 3] }");
83 isl::union_set empty = isl::union_set::empty(ctx);
91 void test_parameters_int(isl::ctx ctx)
93 isl::val long_max_str(ctx, std::to_string(LONG_MAX));
94 isl::val long_max_int(ctx, LONG_MAX);
97 isl::val long_min_str(ctx, std::to_string(LONG_MIN));
98 isl::val long_min_int(ctx, LONG_MIN);
101 isl::val long_zero_str = isl::val(ctx, std::to_string(0));
102 isl::val long_zero_int = isl::val(ctx, 0);
106 /* Test isl objects parameters.
108 * Verify that isl objects can be passed as lvalue and rvalue parameters.
109 * Also verify that isl object parameters are automatically type converted if
111 * any additional parameters, apart from the isl object on which
114 void test_parameters_obj(isl::ctx ctx)
116 isl::set a(ctx, "{ [0] }");
117 isl::set b(ctx, "{ [1] }");
118 isl::set c(ctx, "{ [2] }");
119 isl::set expected(ctx, "{ [i] : 0 <= i <= 2 }");
121 isl::set tmp = a.unite(b);
122 isl::set res_lvalue_param = tmp.unite(c);
125 isl::set res_rvalue_param = a.unite(b).unite(c);
128 isl::basic_set a2(ctx, "{ [0] }");
131 isl::val two(ctx, 2);
132 isl::val half(ctx, "1/2");
133 isl::val res_only_this_param = two.inv();
139 * This includes integer and isl C++ object parameters.
141 void test_parameters(isl::ctx ctx)
147 /* Test that isl objects are returned correctly.
152 void test_return_obj(isl::ctx ctx)
154 isl::val one(ctx, "1");
155 isl::val two(ctx, "2");
156 isl::val three(ctx, "3");
158 isl::val res = one.add(two);
165 void test_return_int(isl::ctx ctx)
167 isl::val one(ctx, "1");
168 isl::val neg_one(ctx, "-1");
169 isl::val zero(ctx, "0");
177 * Do so by calling overloaded isl::ast_build::from_expr methods.
179 void test_return_string(isl::ctx ctx)
181 isl::set context(ctx, "[n] -> { : }");
182 isl::ast_build build = isl::ast_build::from_context(context);
183 isl::pw_aff pw_aff(ctx, "[n] -> { [n] }");
184 isl::set set(ctx, "[n] -> { : n >= 0 }");
186 isl::ast_expr expr = build.expr_from(pw_aff);
198 static void test_every_generic(isl::ctx ctx)
200 isl::union_set us(ctx, "{ A[i]; B[j] }");
202 auto is_empty = [] (isl::set s) {
207 auto is_non_empty = [] (isl::set s) {
212 auto in_A = [] (isl::set s) {
213 return s.is_subset(isl::set(s.ctx(), "{ A[x] }"));
217 auto not_in_A = [] (isl::set s) {
218 return !s.is_subset(isl::set(s.ctx(), "{ A[x] }"));
225 static void test_space(isl::ctx ctx)
227 isl::space unit = isl::space::unit(ctx);
228 isl::space set_space = unit.add_named_tuple("A", 3);
229 isl::space map_space = set_space.add_named_tuple("B", 2);
231 isl::set set = isl::set::universe(set_space);
232 isl::map map = isl::map::universe(map_space);
233 assert(IS_TRUE(set.is_equal(isl::set(ctx, "{ A[*,*,*] }"))));
234 assert(IS_TRUE(map.is_equal(isl::map(ctx, "{ A[*,*,*] -> B[*,*] }"))));
241 static isl::schedule construct_schedule_tree(isl::ctx ctx)
243 isl::union_set A(ctx, "{ A[i] : 0 <= i < 10 }");
244 isl::union_set B(ctx, "{ B[i] : 0 <= i < 20 }");
246 auto node = isl::schedule_node::from_domain(A.unite(B));
249 isl::union_set_list filters(ctx, 0);
253 isl::multi_union_pw_aff f_A(ctx, "[ { A[i] -> [i] } ]");
257 auto band = node.as<isl::schedule_node_band>();
261 isl::multi_union_pw_aff f_B(ctx, "[ { B[i] -> [i] } ]");
278 static isl::schedule_node test_schedule_tree_generic(isl::ctx ctx)
283 assert(IS_TRUE(root.isa<isl::schedule_node_domain>()));
284 root = root.as<isl::schedule_node_domain>().child(0).parent();
287 auto inc_count = [&count](isl::schedule_node node) {
303 static void test_ast_build_unroll(isl::schedule schedule)
306 auto mark_unroll = [](isl::schedule_node node) {
307 if (IS_TRUE(node.isa<isl::schedule_node_band>())) {
308 auto band = node.as<isl::schedule_node_band>();
318 [&count_ast](isl::ast_node node, isl::ast_build build) {
322 auto build = isl::ast_build(schedule.ctx());
336 static isl::schedule test_ast_build_generic(isl::ctx ctx)
342 [&count_ast](isl::ast_node node, isl::ast_build build) {
346 auto build = isl::ast_build(ctx);
365 static void test_ast_build_expr(isl::ctx ctx)
367 isl::pw_aff pa(ctx, "[n] -> { [n + 1] }");
368 isl::ast_build build = isl::ast_build::from_context(pa.domain());
371 auto op = expr.as<isl::ast_expr_op>();
372 assert(IS_TRUE(op.isa<isl::ast_expr_op_add>()));