isl_schedule.c: extract out reset_band
[isl.git] / isl_options.c
blob58bc13f405766dfc24eec88f2f58345e284c64f3
1 /*
2 * Copyright 2008-2009 Katholieke Universiteit Leuven
4 * Use of this software is governed by the MIT license
6 * Written by Sven Verdoolaege, K.U.Leuven, Departement
7 * Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium
8 */
10 #include <stdio.h>
11 #include <stdlib.h>
12 #include <string.h>
14 #include <isl/ctx.h>
15 #include <isl_options_private.h>
16 #include <isl/ast_build.h>
17 #include <isl/schedule.h>
18 #include <isl/version.h>
20 struct isl_arg_choice isl_pip_context_choice[] = {
21 {"gbr", ISL_CONTEXT_GBR},
22 {"lexmin", ISL_CONTEXT_LEXMIN},
23 {0}
26 struct isl_arg_choice isl_gbr_choice[] = {
27 {"never", ISL_GBR_NEVER},
28 {"once", ISL_GBR_ONCE},
29 {"always", ISL_GBR_ALWAYS},
30 {0}
33 struct isl_arg_choice isl_closure_choice[] = {
34 {"isl", ISL_CLOSURE_ISL},
35 {"box", ISL_CLOSURE_BOX},
36 {0}
39 static struct isl_arg_choice bound[] = {
40 {"bernstein", ISL_BOUND_BERNSTEIN},
41 {"range", ISL_BOUND_RANGE},
42 {0}
45 static struct isl_arg_choice on_error[] = {
46 {"warn", ISL_ON_ERROR_WARN},
47 {"continue", ISL_ON_ERROR_CONTINUE},
48 {"abort", ISL_ON_ERROR_ABORT},
49 {0}
52 static struct isl_arg_choice isl_schedule_algorithm_choice[] = {
53 {"isl", ISL_SCHEDULE_ALGORITHM_ISL},
54 {"feautrier", ISL_SCHEDULE_ALGORITHM_FEAUTRIER},
55 {0}
58 static struct isl_arg_flags bernstein_recurse[] = {
59 {"none", ISL_BERNSTEIN_FACTORS | ISL_BERNSTEIN_INTERVALS, 0},
60 {"factors", ISL_BERNSTEIN_FACTORS | ISL_BERNSTEIN_INTERVALS,
61 ISL_BERNSTEIN_FACTORS},
62 {"intervals", ISL_BERNSTEIN_FACTORS | ISL_BERNSTEIN_INTERVALS,
63 ISL_BERNSTEIN_INTERVALS},
64 {"full", ISL_BERNSTEIN_FACTORS | ISL_BERNSTEIN_INTERVALS,
65 ISL_BERNSTEIN_FACTORS | ISL_BERNSTEIN_INTERVALS},
66 {0}
69 static struct isl_arg_choice convex[] = {
70 {"wrap", ISL_CONVEX_HULL_WRAP},
71 {"fm", ISL_CONVEX_HULL_FM},
72 {0}
75 static struct isl_arg_choice fuse[] = {
76 {"max", ISL_SCHEDULE_FUSE_MAX},
77 {"min", ISL_SCHEDULE_FUSE_MIN},
78 {0}
81 static struct isl_arg_choice separation_bounds[] = {
82 {"explicit", ISL_AST_BUILD_SEPARATION_BOUNDS_EXPLICIT},
83 {"implicit", ISL_AST_BUILD_SEPARATION_BOUNDS_IMPLICIT},
84 {0}
87 static void print_version(void)
89 printf("%s", isl_version());
92 ISL_ARGS_START(struct isl_options, isl_options_args)
93 ISL_ARG_CHOICE(struct isl_options, context, 0, "context", \
94 isl_pip_context_choice, ISL_CONTEXT_GBR,
95 "how to handle the pip context tableau")
96 ISL_ARG_CHOICE(struct isl_options, gbr, 0, "gbr", \
97 isl_gbr_choice, ISL_GBR_ALWAYS,
98 "how often to use generalized basis reduction")
99 ISL_ARG_CHOICE(struct isl_options, closure, 0, "closure", \
100 isl_closure_choice, ISL_CLOSURE_ISL,
101 "closure operation to use")
102 ISL_ARG_BOOL(struct isl_options, gbr_only_first, 0, "gbr-only-first", 0,
103 "only perform basis reduction in first direction")
104 ISL_ARG_CHOICE(struct isl_options, bound, 0, "bound", bound,
105 ISL_BOUND_BERNSTEIN, "algorithm to use for computing bounds")
106 ISL_ARG_CHOICE(struct isl_options, on_error, 0, "on-error", on_error,
107 ISL_ON_ERROR_WARN, "how to react if an error is detected")
108 ISL_ARG_FLAGS(struct isl_options, bernstein_recurse, 0,
109 "bernstein-recurse", bernstein_recurse, ISL_BERNSTEIN_FACTORS, NULL)
110 ISL_ARG_BOOL(struct isl_options, bernstein_triangulate, 0,
111 "bernstein-triangulate", 1,
112 "triangulate domains during Bernstein expansion")
113 ISL_ARG_BOOL(struct isl_options, pip_symmetry, 0, "pip-symmetry", 1,
114 "detect simple symmetries in PIP input")
115 ISL_ARG_CHOICE(struct isl_options, convex, 0, "convex-hull", \
116 convex, ISL_CONVEX_HULL_WRAP, "convex hull algorithm to use")
117 ISL_ARG_BOOL(struct isl_options, coalesce_bounded_wrapping, 0,
118 "coalesce-bounded-wrapping", 1, "bound wrapping during coalescing")
119 ISL_ARG_INT(struct isl_options, schedule_max_coefficient, 0,
120 "schedule-max-coefficient", "limit", -1, "Only consider schedules "
121 "where the coefficients of the variable and parameter dimensions "
122 "do not exceed <limit>. A value of -1 allows arbitrary coefficients.")
123 ISL_ARG_INT(struct isl_options, schedule_max_constant_term, 0,
124 "schedule-max-constant-term", "limit", -1, "Only consider schedules "
125 "where the coefficients of the constant dimension do not exceed "
126 "<limit>. A value of -1 allows arbitrary coefficients.")
127 ISL_ARG_BOOL(struct isl_options, schedule_parametric, 0,
128 "schedule-parametric", 1, "construct possibly parametric schedules")
129 ISL_ARG_BOOL(struct isl_options, schedule_outer_zero_distance, 0,
130 "schedule-outer-zero-distance", 0,
131 "try to construct schedules with outer zero distances over "
132 "proximity dependences")
133 ISL_ARG_BOOL(struct isl_options, schedule_maximize_band_depth, 0,
134 "schedule-maximize-band-depth", 0,
135 "maximize the number of scheduling dimensions in a band")
136 ISL_ARG_BOOL(struct isl_options, schedule_split_scaled, 0,
137 "schedule-split-scaled", 1,
138 "split non-tilable bands with scaled schedules")
139 ISL_ARG_BOOL(struct isl_options, schedule_separate_components, 0,
140 "schedule-separate-components", 1,
141 "separate components in dependence graph")
142 ISL_ARG_CHOICE(struct isl_options, schedule_algorithm, 0,
143 "schedule-algorithm", isl_schedule_algorithm_choice,
144 ISL_SCHEDULE_ALGORITHM_ISL, "scheduling algorithm to use")
145 ISL_ARG_CHOICE(struct isl_options, schedule_fuse, 0, "schedule-fuse", fuse,
146 ISL_SCHEDULE_FUSE_MAX, "level of fusion during scheduling")
147 ISL_ARG_BOOL(struct isl_options, tile_scale_tile_loops, 0,
148 "tile-scale-tile-loops", 1, "scale tile loops")
149 ISL_ARG_BOOL(struct isl_options, tile_shift_point_loops, 0,
150 "tile-shift-point-loops", 1, "shift point loops to start at zero")
151 ISL_ARG_STR(struct isl_options, ast_iterator_type, 0,
152 "ast-iterator-type", "type", "int",
153 "type used for iterators during printing of AST")
154 ISL_ARG_BOOL(struct isl_options, ast_build_atomic_upper_bound, 0,
155 "ast-build-atomic-upper-bound", 1, "generate atomic upper bounds")
156 ISL_ARG_BOOL(struct isl_options, ast_build_prefer_pdiv, 0,
157 "ast-build-prefer-pdiv", 1, "prefer pdiv operation over fdiv")
158 ISL_ARG_BOOL(struct isl_options, ast_build_exploit_nested_bounds, 0,
159 "ast-build-exploit-nested-bounds", 1,
160 "simplify conditions based on bounds of nested for loops")
161 ISL_ARG_BOOL(struct isl_options, ast_build_group_coscheduled, 0,
162 "ast-build-group-coscheduled", 0,
163 "keep coscheduled domain elements together")
164 ISL_ARG_CHOICE(struct isl_options, ast_build_separation_bounds, 0,
165 "ast-build-separation-bounds", separation_bounds,
166 ISL_AST_BUILD_SEPARATION_BOUNDS_EXPLICIT,
167 "bounds to use during separation")
168 ISL_ARG_BOOL(struct isl_options, ast_build_scale_strides, 0,
169 "ast-build-scale-strides", 1,
170 "allow iterators of strided loops to be scaled down")
171 ISL_ARG_BOOL(struct isl_options, ast_build_allow_else, 0,
172 "ast-build-allow-else", 1, "generate if statements with else branches")
173 ISL_ARG_BOOL(struct isl_options, ast_build_allow_or, 0,
174 "ast-build-allow-or", 1, "generate if conditions with disjunctions")
175 ISL_ARG_VERSION(print_version)
176 ISL_ARGS_END
178 ISL_ARG_DEF(isl_options, struct isl_options, isl_options_args)
180 ISL_ARG_CTX_DEF(isl_options, struct isl_options, isl_options_args)
182 ISL_CTX_SET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args, bound)
183 ISL_CTX_GET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args, bound)
185 ISL_CTX_SET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args,
186 on_error)
187 ISL_CTX_GET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args,
188 on_error)
190 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
191 coalesce_bounded_wrapping)
192 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
193 coalesce_bounded_wrapping)
195 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
196 gbr_only_first)
197 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
198 gbr_only_first)
200 ISL_CTX_SET_INT_DEF(isl_options, struct isl_options, isl_options_args,
201 schedule_max_coefficient)
202 ISL_CTX_GET_INT_DEF(isl_options, struct isl_options, isl_options_args,
203 schedule_max_coefficient)
205 ISL_CTX_SET_INT_DEF(isl_options, struct isl_options, isl_options_args,
206 schedule_max_constant_term)
207 ISL_CTX_GET_INT_DEF(isl_options, struct isl_options, isl_options_args,
208 schedule_max_constant_term)
210 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
211 schedule_maximize_band_depth)
212 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
213 schedule_maximize_band_depth)
215 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
216 schedule_split_scaled)
217 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
218 schedule_split_scaled)
220 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
221 schedule_separate_components)
222 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
223 schedule_separate_components)
225 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
226 schedule_outer_zero_distance)
227 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
228 schedule_outer_zero_distance)
230 ISL_CTX_SET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args,
231 schedule_algorithm)
232 ISL_CTX_GET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args,
233 schedule_algorithm)
235 ISL_CTX_SET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args,
236 schedule_fuse)
237 ISL_CTX_GET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args,
238 schedule_fuse)
240 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
241 tile_scale_tile_loops)
242 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
243 tile_scale_tile_loops)
245 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
246 tile_shift_point_loops)
247 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
248 tile_shift_point_loops)
250 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
251 ast_build_atomic_upper_bound)
252 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
253 ast_build_atomic_upper_bound)
255 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
256 ast_build_prefer_pdiv)
257 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
258 ast_build_prefer_pdiv)
260 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
261 ast_build_exploit_nested_bounds)
262 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
263 ast_build_exploit_nested_bounds)
265 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
266 ast_build_group_coscheduled)
267 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
268 ast_build_group_coscheduled)
270 ISL_CTX_SET_STR_DEF(isl_options, struct isl_options, isl_options_args,
271 ast_iterator_type)
272 ISL_CTX_GET_STR_DEF(isl_options, struct isl_options, isl_options_args,
273 ast_iterator_type)
275 ISL_CTX_SET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args,
276 ast_build_separation_bounds)
277 ISL_CTX_GET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args,
278 ast_build_separation_bounds)
280 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
281 ast_build_scale_strides)
282 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
283 ast_build_scale_strides)
285 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
286 ast_build_allow_else)
287 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
288 ast_build_allow_else)
290 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
291 ast_build_allow_or)
292 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
293 ast_build_allow_or)