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
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
},
26 struct isl_arg_choice isl_gbr_choice
[] = {
27 {"never", ISL_GBR_NEVER
},
28 {"once", ISL_GBR_ONCE
},
29 {"always", ISL_GBR_ALWAYS
},
33 struct isl_arg_choice isl_closure_choice
[] = {
34 {"isl", ISL_CLOSURE_ISL
},
35 {"box", ISL_CLOSURE_BOX
},
39 static struct isl_arg_choice bound
[] = {
40 {"bernstein", ISL_BOUND_BERNSTEIN
},
41 {"range", ISL_BOUND_RANGE
},
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
},
52 static struct isl_arg_choice isl_schedule_algorithm_choice
[] = {
53 {"isl", ISL_SCHEDULE_ALGORITHM_ISL
},
54 {"feautrier", ISL_SCHEDULE_ALGORITHM_FEAUTRIER
},
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
},
69 static struct isl_arg_choice convex
[] = {
70 {"wrap", ISL_CONVEX_HULL_WRAP
},
71 {"fm", ISL_CONVEX_HULL_FM
},
75 #define ISL_SCHEDULE_FUSE_MAX 0
76 #define ISL_SCHEDULE_FUSE_MIN 1
78 static struct isl_arg_choice fuse
[] = {
79 {"max", ISL_SCHEDULE_FUSE_MAX
},
80 {"min", ISL_SCHEDULE_FUSE_MIN
},
84 /* Callback for setting the "schedule-fuse" option.
85 * This (now hidden) option tries to mimic an option that was
86 * replaced by the schedule-serialize-sccs option.
87 * Setting the old option to ISL_SCHEDULE_FUSE_MIN is now
88 * expressed by turning on the schedule-serialize-sccs option.
90 static int set_fuse(void *opt
, unsigned val
)
92 struct isl_options
*options
= opt
;
94 options
->schedule_serialize_sccs
= (val
== ISL_SCHEDULE_FUSE_MIN
);
99 static struct isl_arg_choice separation_bounds
[] = {
100 {"explicit", ISL_AST_BUILD_SEPARATION_BOUNDS_EXPLICIT
},
101 {"implicit", ISL_AST_BUILD_SEPARATION_BOUNDS_IMPLICIT
},
105 static void print_version(void)
107 printf("%s", isl_version());
110 ISL_ARGS_START(struct isl_options
, isl_options_args
)
111 ISL_ARG_CHOICE(struct isl_options
, context
, 0, "context", \
112 isl_pip_context_choice
, ISL_CONTEXT_GBR
,
113 "how to handle the pip context tableau")
114 ISL_ARG_CHOICE(struct isl_options
, gbr
, 0, "gbr", \
115 isl_gbr_choice
, ISL_GBR_ALWAYS
,
116 "how often to use generalized basis reduction")
117 ISL_ARG_CHOICE(struct isl_options
, closure
, 0, "closure", \
118 isl_closure_choice
, ISL_CLOSURE_ISL
,
119 "closure operation to use")
120 ISL_ARG_BOOL(struct isl_options
, gbr_only_first
, 0, "gbr-only-first", 0,
121 "only perform basis reduction in first direction")
122 ISL_ARG_CHOICE(struct isl_options
, bound
, 0, "bound", bound
,
123 ISL_BOUND_BERNSTEIN
, "algorithm to use for computing bounds")
124 ISL_ARG_CHOICE(struct isl_options
, on_error
, 0, "on-error", on_error
,
125 ISL_ON_ERROR_WARN
, "how to react if an error is detected")
126 ISL_ARG_FLAGS(struct isl_options
, bernstein_recurse
, 0,
127 "bernstein-recurse", bernstein_recurse
, ISL_BERNSTEIN_FACTORS
, NULL
)
128 ISL_ARG_BOOL(struct isl_options
, bernstein_triangulate
, 0,
129 "bernstein-triangulate", 1,
130 "triangulate domains during Bernstein expansion")
131 ISL_ARG_BOOL(struct isl_options
, pip_symmetry
, 0, "pip-symmetry", 1,
132 "detect simple symmetries in PIP input")
133 ISL_ARG_CHOICE(struct isl_options
, convex
, 0, "convex-hull", \
134 convex
, ISL_CONVEX_HULL_WRAP
, "convex hull algorithm to use")
135 ISL_ARG_BOOL(struct isl_options
, coalesce_bounded_wrapping
, 0,
136 "coalesce-bounded-wrapping", 1, "bound wrapping during coalescing")
137 ISL_ARG_INT(struct isl_options
, schedule_max_coefficient
, 0,
138 "schedule-max-coefficient", "limit", -1, "Only consider schedules "
139 "where the coefficients of the variable and parameter dimensions "
140 "do not exceed <limit>. A value of -1 allows arbitrary coefficients.")
141 ISL_ARG_INT(struct isl_options
, schedule_max_constant_term
, 0,
142 "schedule-max-constant-term", "limit", -1, "Only consider schedules "
143 "where the coefficients of the constant dimension do not exceed "
144 "<limit>. A value of -1 allows arbitrary coefficients.")
145 ISL_ARG_BOOL(struct isl_options
, schedule_parametric
, 0,
146 "schedule-parametric", 1, "construct possibly parametric schedules")
147 ISL_ARG_BOOL(struct isl_options
, schedule_outer_coincidence
, 0,
148 "schedule-outer-coincidence", 0,
149 "try to construct schedules where the outer member of each band "
150 "satisfies the coincidence constraints")
151 ISL_ARG_BOOL(struct isl_options
, schedule_maximize_band_depth
, 0,
152 "schedule-maximize-band-depth", 0,
153 "maximize the number of scheduling dimensions in a band")
154 ISL_ARG_BOOL(struct isl_options
, schedule_maximize_coincidence
, 0,
155 "schedule-maximize-coincidence", 0,
156 "maximize the number of coincident dimensions in a band")
157 ISL_ARG_BOOL(struct isl_options
, schedule_split_scaled
, 0,
158 "schedule-split-scaled", 1,
159 "split non-tilable bands with scaled schedules")
160 ISL_ARG_BOOL(struct isl_options
, schedule_separate_components
, 0,
161 "schedule-separate-components", 1,
162 "separate components in dependence graph")
163 ISL_ARG_BOOL(struct isl_options
, schedule_whole_component
, 0,
164 "schedule-whole-component", 1,
165 "try and compute schedule for entire component first")
166 ISL_ARG_CHOICE(struct isl_options
, schedule_algorithm
, 0,
167 "schedule-algorithm", isl_schedule_algorithm_choice
,
168 ISL_SCHEDULE_ALGORITHM_ISL
, "scheduling algorithm to use")
169 ISL_ARG_BOOL(struct isl_options
, schedule_serialize_sccs
, 0,
170 "schedule-serialize-sccs", 0,
171 "serialize strongly connected components in dependence graph")
172 ISL_ARG_PHANTOM_USER_CHOICE_F(0, "schedule-fuse", fuse
, &set_fuse
,
173 ISL_SCHEDULE_FUSE_MAX
, "level of fusion during scheduling",
175 ISL_ARG_BOOL(struct isl_options
, tile_scale_tile_loops
, 0,
176 "tile-scale-tile-loops", 1, "scale tile loops")
177 ISL_ARG_BOOL(struct isl_options
, tile_shift_point_loops
, 0,
178 "tile-shift-point-loops", 1, "shift point loops to start at zero")
179 ISL_ARG_STR(struct isl_options
, ast_iterator_type
, 0,
180 "ast-iterator-type", "type", "int",
181 "type used for iterators during printing of AST")
182 ISL_ARG_BOOL(struct isl_options
, ast_always_print_block
, 0,
183 "ast-always-print-block", 0, "print for and if bodies as a block "
184 "regardless of the number of statements in the body")
185 ISL_ARG_BOOL(struct isl_options
, ast_print_macro_once
, 0,
186 "ast-print-macro-once", 0, "only print macro definitions once")
187 ISL_ARG_BOOL(struct isl_options
, ast_build_atomic_upper_bound
, 0,
188 "ast-build-atomic-upper-bound", 1, "generate atomic upper bounds")
189 ISL_ARG_BOOL(struct isl_options
, ast_build_prefer_pdiv
, 0,
190 "ast-build-prefer-pdiv", 1, "prefer pdiv operation over fdiv")
191 ISL_ARG_BOOL(struct isl_options
, ast_build_detect_min_max
, 0,
192 "ast-build-detect-min-max", 0, "detect min/max expressions")
193 ISL_ARG_BOOL(struct isl_options
, ast_build_exploit_nested_bounds
, 0,
194 "ast-build-exploit-nested-bounds", 1,
195 "simplify conditions based on bounds of nested for loops")
196 ISL_ARG_BOOL(struct isl_options
, ast_build_group_coscheduled
, 0,
197 "ast-build-group-coscheduled", 0,
198 "keep coscheduled domain elements together")
199 ISL_ARG_CHOICE(struct isl_options
, ast_build_separation_bounds
, 0,
200 "ast-build-separation-bounds", separation_bounds
,
201 ISL_AST_BUILD_SEPARATION_BOUNDS_EXPLICIT
,
202 "bounds to use during separation")
203 ISL_ARG_BOOL(struct isl_options
, ast_build_scale_strides
, 0,
204 "ast-build-scale-strides", 1,
205 "allow iterators of strided loops to be scaled down")
206 ISL_ARG_BOOL(struct isl_options
, ast_build_allow_else
, 0,
207 "ast-build-allow-else", 1, "generate if statements with else branches")
208 ISL_ARG_BOOL(struct isl_options
, ast_build_allow_or
, 0,
209 "ast-build-allow-or", 1, "generate if conditions with disjunctions")
210 ISL_ARG_BOOL(struct isl_options
, print_stats
, 0, "print-stats", 0,
211 "print statistics for every isl_ctx")
212 ISL_ARG_ULONG(struct isl_options
, max_operations
, 0,
213 "max-operations", 0, "default number of maximal operations per isl_ctx")
214 ISL_ARG_VERSION(print_version
)
217 ISL_ARG_DEF(isl_options
, struct isl_options
, isl_options_args
)
219 ISL_ARG_CTX_DEF(isl_options
, struct isl_options
, isl_options_args
)
221 ISL_CTX_SET_CHOICE_DEF(isl_options
, struct isl_options
, isl_options_args
, bound
)
222 ISL_CTX_GET_CHOICE_DEF(isl_options
, struct isl_options
, isl_options_args
, bound
)
224 ISL_CTX_SET_CHOICE_DEF(isl_options
, struct isl_options
, isl_options_args
,
226 ISL_CTX_GET_CHOICE_DEF(isl_options
, struct isl_options
, isl_options_args
,
229 ISL_CTX_SET_BOOL_DEF(isl_options
, struct isl_options
, isl_options_args
,
230 coalesce_bounded_wrapping
)
231 ISL_CTX_GET_BOOL_DEF(isl_options
, struct isl_options
, isl_options_args
,
232 coalesce_bounded_wrapping
)
234 ISL_CTX_SET_BOOL_DEF(isl_options
, struct isl_options
, isl_options_args
,
236 ISL_CTX_GET_BOOL_DEF(isl_options
, struct isl_options
, isl_options_args
,
239 ISL_CTX_SET_INT_DEF(isl_options
, struct isl_options
, isl_options_args
,
240 schedule_max_coefficient
)
241 ISL_CTX_GET_INT_DEF(isl_options
, struct isl_options
, isl_options_args
,
242 schedule_max_coefficient
)
244 ISL_CTX_SET_INT_DEF(isl_options
, struct isl_options
, isl_options_args
,
245 schedule_max_constant_term
)
246 ISL_CTX_GET_INT_DEF(isl_options
, struct isl_options
, isl_options_args
,
247 schedule_max_constant_term
)
249 ISL_CTX_SET_BOOL_DEF(isl_options
, struct isl_options
, isl_options_args
,
250 schedule_maximize_band_depth
)
251 ISL_CTX_GET_BOOL_DEF(isl_options
, struct isl_options
, isl_options_args
,
252 schedule_maximize_band_depth
)
254 ISL_CTX_SET_BOOL_DEF(isl_options
, struct isl_options
, isl_options_args
,
255 schedule_maximize_coincidence
)
256 ISL_CTX_GET_BOOL_DEF(isl_options
, struct isl_options
, isl_options_args
,
257 schedule_maximize_coincidence
)
259 ISL_CTX_SET_BOOL_DEF(isl_options
, struct isl_options
, isl_options_args
,
260 schedule_split_scaled
)
261 ISL_CTX_GET_BOOL_DEF(isl_options
, struct isl_options
, isl_options_args
,
262 schedule_split_scaled
)
264 ISL_CTX_SET_BOOL_DEF(isl_options
, struct isl_options
, isl_options_args
,
265 schedule_separate_components
)
266 ISL_CTX_GET_BOOL_DEF(isl_options
, struct isl_options
, isl_options_args
,
267 schedule_separate_components
)
269 ISL_CTX_SET_BOOL_DEF(isl_options
, struct isl_options
, isl_options_args
,
270 schedule_whole_component
)
271 ISL_CTX_GET_BOOL_DEF(isl_options
, struct isl_options
, isl_options_args
,
272 schedule_whole_component
)
274 ISL_CTX_SET_BOOL_DEF(isl_options
, struct isl_options
, isl_options_args
,
275 schedule_outer_coincidence
)
276 ISL_CTX_GET_BOOL_DEF(isl_options
, struct isl_options
, isl_options_args
,
277 schedule_outer_coincidence
)
279 ISL_CTX_SET_CHOICE_DEF(isl_options
, struct isl_options
, isl_options_args
,
281 ISL_CTX_GET_CHOICE_DEF(isl_options
, struct isl_options
, isl_options_args
,
284 ISL_CTX_SET_BOOL_DEF(isl_options
, struct isl_options
, isl_options_args
,
285 schedule_serialize_sccs
)
286 ISL_CTX_GET_BOOL_DEF(isl_options
, struct isl_options
, isl_options_args
,
287 schedule_serialize_sccs
)
289 ISL_CTX_SET_BOOL_DEF(isl_options
, struct isl_options
, isl_options_args
,
290 tile_scale_tile_loops
)
291 ISL_CTX_GET_BOOL_DEF(isl_options
, struct isl_options
, isl_options_args
,
292 tile_scale_tile_loops
)
294 ISL_CTX_SET_BOOL_DEF(isl_options
, struct isl_options
, isl_options_args
,
295 tile_shift_point_loops
)
296 ISL_CTX_GET_BOOL_DEF(isl_options
, struct isl_options
, isl_options_args
,
297 tile_shift_point_loops
)
299 ISL_CTX_SET_BOOL_DEF(isl_options
, struct isl_options
, isl_options_args
,
300 ast_build_atomic_upper_bound
)
301 ISL_CTX_GET_BOOL_DEF(isl_options
, struct isl_options
, isl_options_args
,
302 ast_build_atomic_upper_bound
)
304 ISL_CTX_SET_BOOL_DEF(isl_options
, struct isl_options
, isl_options_args
,
305 ast_build_prefer_pdiv
)
306 ISL_CTX_GET_BOOL_DEF(isl_options
, struct isl_options
, isl_options_args
,
307 ast_build_prefer_pdiv
)
309 ISL_CTX_SET_BOOL_DEF(isl_options
, struct isl_options
, isl_options_args
,
310 ast_build_detect_min_max
)
311 ISL_CTX_GET_BOOL_DEF(isl_options
, struct isl_options
, isl_options_args
,
312 ast_build_detect_min_max
)
314 ISL_CTX_SET_BOOL_DEF(isl_options
, struct isl_options
, isl_options_args
,
315 ast_build_exploit_nested_bounds
)
316 ISL_CTX_GET_BOOL_DEF(isl_options
, struct isl_options
, isl_options_args
,
317 ast_build_exploit_nested_bounds
)
319 ISL_CTX_SET_BOOL_DEF(isl_options
, struct isl_options
, isl_options_args
,
320 ast_build_group_coscheduled
)
321 ISL_CTX_GET_BOOL_DEF(isl_options
, struct isl_options
, isl_options_args
,
322 ast_build_group_coscheduled
)
324 ISL_CTX_SET_STR_DEF(isl_options
, struct isl_options
, isl_options_args
,
326 ISL_CTX_GET_STR_DEF(isl_options
, struct isl_options
, isl_options_args
,
329 ISL_CTX_SET_BOOL_DEF(isl_options
, struct isl_options
, isl_options_args
,
330 ast_always_print_block
)
331 ISL_CTX_GET_BOOL_DEF(isl_options
, struct isl_options
, isl_options_args
,
332 ast_always_print_block
)
334 ISL_CTX_SET_BOOL_DEF(isl_options
, struct isl_options
, isl_options_args
,
335 ast_print_macro_once
)
336 ISL_CTX_GET_BOOL_DEF(isl_options
, struct isl_options
, isl_options_args
,
337 ast_print_macro_once
)
339 ISL_CTX_SET_CHOICE_DEF(isl_options
, struct isl_options
, isl_options_args
,
340 ast_build_separation_bounds
)
341 ISL_CTX_GET_CHOICE_DEF(isl_options
, struct isl_options
, isl_options_args
,
342 ast_build_separation_bounds
)
344 ISL_CTX_SET_BOOL_DEF(isl_options
, struct isl_options
, isl_options_args
,
345 ast_build_scale_strides
)
346 ISL_CTX_GET_BOOL_DEF(isl_options
, struct isl_options
, isl_options_args
,
347 ast_build_scale_strides
)
349 ISL_CTX_SET_BOOL_DEF(isl_options
, struct isl_options
, isl_options_args
,
350 ast_build_allow_else
)
351 ISL_CTX_GET_BOOL_DEF(isl_options
, struct isl_options
, isl_options_args
,
352 ast_build_allow_else
)
354 ISL_CTX_SET_BOOL_DEF(isl_options
, struct isl_options
, isl_options_args
,
356 ISL_CTX_GET_BOOL_DEF(isl_options
, struct isl_options
, isl_options_args
,