add isl_schedule_node_gist
[isl.git] / isl_options.c
blobf41b6e0ec451cd3c5b6f25bdc3ec0e3bede1ccec
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_coincidence, 0,
130 "schedule-outer-coincidence", 0,
131 "try to construct schedules where the outer member of each band "
132 "satisfies the coincidence constraints")
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_always_print_block, 0,
155 "ast-always-print-block", 0, "print for and if bodies as a block "
156 "regardless of the number of statements in the body")
157 ISL_ARG_BOOL(struct isl_options, ast_build_atomic_upper_bound, 0,
158 "ast-build-atomic-upper-bound", 1, "generate atomic upper bounds")
159 ISL_ARG_BOOL(struct isl_options, ast_build_prefer_pdiv, 0,
160 "ast-build-prefer-pdiv", 1, "prefer pdiv operation over fdiv")
161 ISL_ARG_BOOL(struct isl_options, ast_build_exploit_nested_bounds, 0,
162 "ast-build-exploit-nested-bounds", 1,
163 "simplify conditions based on bounds of nested for loops")
164 ISL_ARG_BOOL(struct isl_options, ast_build_group_coscheduled, 0,
165 "ast-build-group-coscheduled", 0,
166 "keep coscheduled domain elements together")
167 ISL_ARG_CHOICE(struct isl_options, ast_build_separation_bounds, 0,
168 "ast-build-separation-bounds", separation_bounds,
169 ISL_AST_BUILD_SEPARATION_BOUNDS_EXPLICIT,
170 "bounds to use during separation")
171 ISL_ARG_BOOL(struct isl_options, ast_build_scale_strides, 0,
172 "ast-build-scale-strides", 1,
173 "allow iterators of strided loops to be scaled down")
174 ISL_ARG_BOOL(struct isl_options, ast_build_allow_else, 0,
175 "ast-build-allow-else", 1, "generate if statements with else branches")
176 ISL_ARG_BOOL(struct isl_options, ast_build_allow_or, 0,
177 "ast-build-allow-or", 1, "generate if conditions with disjunctions")
178 ISL_ARG_BOOL(struct isl_options, print_stats, 0, "print-stats", 0,
179 "print statistics for every isl_ctx")
180 ISL_ARG_ULONG(struct isl_options, max_operations, 0,
181 "max-operations", 0, "default number of maximal operations per isl_ctx")
182 ISL_ARG_VERSION(print_version)
183 ISL_ARGS_END
185 ISL_ARG_DEF(isl_options, struct isl_options, isl_options_args)
187 ISL_ARG_CTX_DEF(isl_options, struct isl_options, isl_options_args)
189 ISL_CTX_SET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args, bound)
190 ISL_CTX_GET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args, bound)
192 ISL_CTX_SET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args,
193 on_error)
194 ISL_CTX_GET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args,
195 on_error)
197 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
198 coalesce_bounded_wrapping)
199 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
200 coalesce_bounded_wrapping)
202 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
203 gbr_only_first)
204 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
205 gbr_only_first)
207 ISL_CTX_SET_INT_DEF(isl_options, struct isl_options, isl_options_args,
208 schedule_max_coefficient)
209 ISL_CTX_GET_INT_DEF(isl_options, struct isl_options, isl_options_args,
210 schedule_max_coefficient)
212 ISL_CTX_SET_INT_DEF(isl_options, struct isl_options, isl_options_args,
213 schedule_max_constant_term)
214 ISL_CTX_GET_INT_DEF(isl_options, struct isl_options, isl_options_args,
215 schedule_max_constant_term)
217 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
218 schedule_maximize_band_depth)
219 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
220 schedule_maximize_band_depth)
222 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
223 schedule_split_scaled)
224 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
225 schedule_split_scaled)
227 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
228 schedule_separate_components)
229 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
230 schedule_separate_components)
232 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
233 schedule_outer_coincidence)
234 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
235 schedule_outer_coincidence)
237 ISL_CTX_SET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args,
238 schedule_algorithm)
239 ISL_CTX_GET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args,
240 schedule_algorithm)
242 ISL_CTX_SET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args,
243 schedule_fuse)
244 ISL_CTX_GET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args,
245 schedule_fuse)
247 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
248 tile_scale_tile_loops)
249 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
250 tile_scale_tile_loops)
252 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
253 tile_shift_point_loops)
254 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
255 tile_shift_point_loops)
257 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
258 ast_build_atomic_upper_bound)
259 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
260 ast_build_atomic_upper_bound)
262 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
263 ast_build_prefer_pdiv)
264 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
265 ast_build_prefer_pdiv)
267 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
268 ast_build_exploit_nested_bounds)
269 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
270 ast_build_exploit_nested_bounds)
272 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
273 ast_build_group_coscheduled)
274 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
275 ast_build_group_coscheduled)
277 ISL_CTX_SET_STR_DEF(isl_options, struct isl_options, isl_options_args,
278 ast_iterator_type)
279 ISL_CTX_GET_STR_DEF(isl_options, struct isl_options, isl_options_args,
280 ast_iterator_type)
282 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
283 ast_always_print_block)
284 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
285 ast_always_print_block)
287 ISL_CTX_SET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args,
288 ast_build_separation_bounds)
289 ISL_CTX_GET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args,
290 ast_build_separation_bounds)
292 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
293 ast_build_scale_strides)
294 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
295 ast_build_scale_strides)
297 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
298 ast_build_allow_else)
299 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
300 ast_build_allow_else)
302 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
303 ast_build_allow_or)
304 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
305 ast_build_allow_or)