Blame isl-0.16.1/isl_options.c

Packit fb9d21
/*
Packit fb9d21
 * Copyright 2008-2009 Katholieke Universiteit Leuven
Packit fb9d21
 *
Packit fb9d21
 * Use of this software is governed by the MIT license
Packit fb9d21
 *
Packit fb9d21
 * Written by Sven Verdoolaege, K.U.Leuven, Departement
Packit fb9d21
 * Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium
Packit fb9d21
 */
Packit fb9d21
Packit fb9d21
#include <stdio.h>
Packit fb9d21
#include <stdlib.h>
Packit fb9d21
#include <string.h>
Packit fb9d21
Packit fb9d21
#include <isl/ctx.h>
Packit fb9d21
#include <isl_options_private.h>
Packit fb9d21
#include <isl/ast_build.h>
Packit fb9d21
#include <isl/schedule.h>
Packit fb9d21
#include <isl/version.h>
Packit fb9d21
Packit fb9d21
struct isl_arg_choice isl_pip_context_choice[] = {
Packit fb9d21
	{"gbr",		ISL_CONTEXT_GBR},
Packit fb9d21
	{"lexmin",	ISL_CONTEXT_LEXMIN},
Packit fb9d21
	{0}
Packit fb9d21
};
Packit fb9d21
Packit fb9d21
struct isl_arg_choice isl_gbr_choice[] = {
Packit fb9d21
	{"never",	ISL_GBR_NEVER},
Packit fb9d21
	{"once",	ISL_GBR_ONCE},
Packit fb9d21
	{"always",	ISL_GBR_ALWAYS},
Packit fb9d21
	{0}
Packit fb9d21
};
Packit fb9d21
Packit fb9d21
struct isl_arg_choice isl_closure_choice[] = {
Packit fb9d21
	{"isl",		ISL_CLOSURE_ISL},
Packit fb9d21
	{"box",		ISL_CLOSURE_BOX},
Packit fb9d21
	{0}
Packit fb9d21
};
Packit fb9d21
Packit fb9d21
static struct isl_arg_choice bound[] = {
Packit fb9d21
	{"bernstein",	ISL_BOUND_BERNSTEIN},
Packit fb9d21
	{"range",	ISL_BOUND_RANGE},
Packit fb9d21
	{0}
Packit fb9d21
};
Packit fb9d21
Packit fb9d21
static struct isl_arg_choice on_error[] = {
Packit fb9d21
	{"warn",	ISL_ON_ERROR_WARN},
Packit fb9d21
	{"continue",	ISL_ON_ERROR_CONTINUE},
Packit fb9d21
	{"abort",	ISL_ON_ERROR_ABORT},
Packit fb9d21
	{0}
Packit fb9d21
};
Packit fb9d21
Packit fb9d21
static struct isl_arg_choice isl_schedule_algorithm_choice[] = {
Packit fb9d21
	{"isl",		ISL_SCHEDULE_ALGORITHM_ISL},
Packit fb9d21
	{"feautrier",   ISL_SCHEDULE_ALGORITHM_FEAUTRIER},
Packit fb9d21
	{0}
Packit fb9d21
};
Packit fb9d21
Packit fb9d21
static struct isl_arg_flags bernstein_recurse[] = {
Packit fb9d21
	{"none",	ISL_BERNSTEIN_FACTORS | ISL_BERNSTEIN_INTERVALS, 0},
Packit fb9d21
	{"factors",	ISL_BERNSTEIN_FACTORS | ISL_BERNSTEIN_INTERVALS,
Packit fb9d21
			ISL_BERNSTEIN_FACTORS},
Packit fb9d21
	{"intervals",	ISL_BERNSTEIN_FACTORS | ISL_BERNSTEIN_INTERVALS,
Packit fb9d21
			ISL_BERNSTEIN_INTERVALS},
Packit fb9d21
	{"full",	ISL_BERNSTEIN_FACTORS | ISL_BERNSTEIN_INTERVALS,
Packit fb9d21
			ISL_BERNSTEIN_FACTORS | ISL_BERNSTEIN_INTERVALS},
Packit fb9d21
	{0}
Packit fb9d21
};
Packit fb9d21
Packit fb9d21
static struct isl_arg_choice convex[] = {
Packit fb9d21
	{"wrap",	ISL_CONVEX_HULL_WRAP},
Packit fb9d21
	{"fm",		ISL_CONVEX_HULL_FM},
Packit fb9d21
	{0}
Packit fb9d21
};
Packit fb9d21
Packit fb9d21
#define		ISL_SCHEDULE_FUSE_MAX			0
Packit fb9d21
#define		ISL_SCHEDULE_FUSE_MIN			1
Packit fb9d21
Packit fb9d21
static struct isl_arg_choice fuse[] = {
Packit fb9d21
	{"max",		ISL_SCHEDULE_FUSE_MAX},
Packit fb9d21
	{"min",		ISL_SCHEDULE_FUSE_MIN},
Packit fb9d21
	{0}
Packit fb9d21
};
Packit fb9d21
Packit fb9d21
/* Callback for setting the "schedule-fuse" option.
Packit fb9d21
 * This (now hidden) option tries to mimic an option that was
Packit fb9d21
 * replaced by the schedule-serialize-sccs option.
Packit fb9d21
 * Setting the old option to ISL_SCHEDULE_FUSE_MIN is now
Packit fb9d21
 * expressed by turning on the schedule-serialize-sccs option.
Packit fb9d21
 */
Packit fb9d21
static int set_fuse(void *opt, unsigned val)
Packit fb9d21
{
Packit fb9d21
	struct isl_options *options = opt;
Packit fb9d21
Packit fb9d21
	options->schedule_serialize_sccs = (val == ISL_SCHEDULE_FUSE_MIN);
Packit fb9d21
Packit fb9d21
	return 0;
Packit fb9d21
}
Packit fb9d21
Packit fb9d21
static struct isl_arg_choice separation_bounds[] = {
Packit fb9d21
	{"explicit",	ISL_AST_BUILD_SEPARATION_BOUNDS_EXPLICIT},
Packit fb9d21
	{"implicit",	ISL_AST_BUILD_SEPARATION_BOUNDS_IMPLICIT},
Packit fb9d21
	{0}
Packit fb9d21
};
Packit fb9d21
Packit fb9d21
static void print_version(void)
Packit fb9d21
{
Packit fb9d21
	printf("%s", isl_version());
Packit fb9d21
}
Packit fb9d21
Packit fb9d21
ISL_ARGS_START(struct isl_options, isl_options_args)
Packit fb9d21
ISL_ARG_CHOICE(struct isl_options, context, 0, "context", \
Packit fb9d21
	isl_pip_context_choice,	ISL_CONTEXT_GBR,
Packit fb9d21
	"how to handle the pip context tableau")
Packit fb9d21
ISL_ARG_CHOICE(struct isl_options, gbr, 0, "gbr", \
Packit fb9d21
	isl_gbr_choice,	ISL_GBR_ALWAYS,
Packit fb9d21
	"how often to use generalized basis reduction")
Packit fb9d21
ISL_ARG_CHOICE(struct isl_options, closure, 0, "closure", \
Packit fb9d21
	isl_closure_choice,	ISL_CLOSURE_ISL,
Packit fb9d21
	"closure operation to use")
Packit fb9d21
ISL_ARG_BOOL(struct isl_options, gbr_only_first, 0, "gbr-only-first", 0,
Packit fb9d21
	"only perform basis reduction in first direction")
Packit fb9d21
ISL_ARG_CHOICE(struct isl_options, bound, 0, "bound", bound,
Packit fb9d21
	ISL_BOUND_BERNSTEIN, "algorithm to use for computing bounds")
Packit fb9d21
ISL_ARG_CHOICE(struct isl_options, on_error, 0, "on-error", on_error,
Packit fb9d21
	ISL_ON_ERROR_WARN, "how to react if an error is detected")
Packit fb9d21
ISL_ARG_FLAGS(struct isl_options, bernstein_recurse, 0,
Packit fb9d21
	"bernstein-recurse", bernstein_recurse, ISL_BERNSTEIN_FACTORS, NULL)
Packit fb9d21
ISL_ARG_BOOL(struct isl_options, bernstein_triangulate, 0,
Packit fb9d21
	"bernstein-triangulate", 1,
Packit fb9d21
	"triangulate domains during Bernstein expansion")
Packit fb9d21
ISL_ARG_BOOL(struct isl_options, pip_symmetry, 0, "pip-symmetry", 1,
Packit fb9d21
	"detect simple symmetries in PIP input")
Packit fb9d21
ISL_ARG_CHOICE(struct isl_options, convex, 0, "convex-hull", \
Packit fb9d21
	convex,	ISL_CONVEX_HULL_WRAP, "convex hull algorithm to use")
Packit fb9d21
ISL_ARG_BOOL(struct isl_options, coalesce_bounded_wrapping, 0,
Packit fb9d21
	"coalesce-bounded-wrapping", 1, "bound wrapping during coalescing")
Packit fb9d21
ISL_ARG_INT(struct isl_options, schedule_max_coefficient, 0,
Packit fb9d21
	"schedule-max-coefficient", "limit", -1, "Only consider schedules "
Packit fb9d21
	"where the coefficients of the variable and parameter dimensions "
Packit fb9d21
        "do not exceed <limit>. A value of -1 allows arbitrary coefficients.")
Packit fb9d21
ISL_ARG_INT(struct isl_options, schedule_max_constant_term, 0,
Packit fb9d21
	"schedule-max-constant-term", "limit", -1, "Only consider schedules "
Packit fb9d21
	"where the coefficients of the constant dimension do not exceed "
Packit fb9d21
	"<limit>. A value of -1 allows arbitrary coefficients.")
Packit fb9d21
ISL_ARG_BOOL(struct isl_options, schedule_parametric, 0,
Packit fb9d21
	"schedule-parametric", 1, "construct possibly parametric schedules")
Packit fb9d21
ISL_ARG_BOOL(struct isl_options, schedule_outer_coincidence, 0,
Packit fb9d21
	"schedule-outer-coincidence", 0,
Packit fb9d21
	"try to construct schedules where the outer member of each band "
Packit fb9d21
	"satisfies the coincidence constraints")
Packit fb9d21
ISL_ARG_BOOL(struct isl_options, schedule_maximize_band_depth, 0,
Packit fb9d21
	"schedule-maximize-band-depth", 0,
Packit fb9d21
	"maximize the number of scheduling dimensions in a band")
Packit fb9d21
ISL_ARG_BOOL(struct isl_options, schedule_split_scaled, 0,
Packit fb9d21
	"schedule-split-scaled", 1,
Packit fb9d21
	"split non-tilable bands with scaled schedules")
Packit fb9d21
ISL_ARG_BOOL(struct isl_options, schedule_separate_components, 0,
Packit fb9d21
	"schedule-separate-components", 1,
Packit fb9d21
	"separate components in dependence graph")
Packit fb9d21
ISL_ARG_CHOICE(struct isl_options, schedule_algorithm, 0,
Packit fb9d21
	"schedule-algorithm", isl_schedule_algorithm_choice,
Packit fb9d21
	ISL_SCHEDULE_ALGORITHM_ISL, "scheduling algorithm to use")
Packit fb9d21
ISL_ARG_BOOL(struct isl_options, schedule_serialize_sccs, 0,
Packit fb9d21
	"schedule-serialize-sccs", 0,
Packit fb9d21
	"serialize strongly connected components in dependence graph")
Packit fb9d21
ISL_ARG_PHANTOM_USER_CHOICE_F(0, "schedule-fuse", fuse, &set_fuse,
Packit fb9d21
	ISL_SCHEDULE_FUSE_MAX, "level of fusion during scheduling",
Packit fb9d21
	ISL_ARG_HIDDEN)
Packit fb9d21
ISL_ARG_BOOL(struct isl_options, tile_scale_tile_loops, 0,
Packit fb9d21
	"tile-scale-tile-loops", 1, "scale tile loops")
Packit fb9d21
ISL_ARG_BOOL(struct isl_options, tile_shift_point_loops, 0,
Packit fb9d21
	"tile-shift-point-loops", 1, "shift point loops to start at zero")
Packit fb9d21
ISL_ARG_STR(struct isl_options, ast_iterator_type, 0,
Packit fb9d21
	"ast-iterator-type", "type", "int",
Packit fb9d21
	"type used for iterators during printing of AST")
Packit fb9d21
ISL_ARG_BOOL(struct isl_options, ast_always_print_block, 0,
Packit fb9d21
	"ast-always-print-block", 0, "print for and if bodies as a block "
Packit fb9d21
	"regardless of the number of statements in the body")
Packit fb9d21
ISL_ARG_BOOL(struct isl_options, ast_build_atomic_upper_bound, 0,
Packit fb9d21
	"ast-build-atomic-upper-bound", 1, "generate atomic upper bounds")
Packit fb9d21
ISL_ARG_BOOL(struct isl_options, ast_build_prefer_pdiv, 0,
Packit fb9d21
	"ast-build-prefer-pdiv", 1, "prefer pdiv operation over fdiv")
Packit fb9d21
ISL_ARG_BOOL(struct isl_options, ast_build_exploit_nested_bounds, 0,
Packit fb9d21
	"ast-build-exploit-nested-bounds", 1,
Packit fb9d21
	"simplify conditions based on bounds of nested for loops")
Packit fb9d21
ISL_ARG_BOOL(struct isl_options, ast_build_group_coscheduled, 0,
Packit fb9d21
	"ast-build-group-coscheduled", 0,
Packit fb9d21
	"keep coscheduled domain elements together")
Packit fb9d21
ISL_ARG_CHOICE(struct isl_options, ast_build_separation_bounds, 0,
Packit fb9d21
	"ast-build-separation-bounds", separation_bounds,
Packit fb9d21
	ISL_AST_BUILD_SEPARATION_BOUNDS_EXPLICIT,
Packit fb9d21
	"bounds to use during separation")
Packit fb9d21
ISL_ARG_BOOL(struct isl_options, ast_build_scale_strides, 0,
Packit fb9d21
	"ast-build-scale-strides", 1,
Packit fb9d21
	"allow iterators of strided loops to be scaled down")
Packit fb9d21
ISL_ARG_BOOL(struct isl_options, ast_build_allow_else, 0,
Packit fb9d21
	"ast-build-allow-else", 1, "generate if statements with else branches")
Packit fb9d21
ISL_ARG_BOOL(struct isl_options, ast_build_allow_or, 0,
Packit fb9d21
	"ast-build-allow-or", 1, "generate if conditions with disjunctions")
Packit fb9d21
ISL_ARG_BOOL(struct isl_options, print_stats, 0, "print-stats", 0,
Packit fb9d21
	"print statistics for every isl_ctx")
Packit fb9d21
ISL_ARG_ULONG(struct isl_options, max_operations, 0,
Packit fb9d21
	"max-operations", 0, "default number of maximal operations per isl_ctx")
Packit fb9d21
ISL_ARG_VERSION(print_version)
Packit fb9d21
ISL_ARGS_END
Packit fb9d21
Packit fb9d21
ISL_ARG_DEF(isl_options, struct isl_options, isl_options_args)
Packit fb9d21
Packit fb9d21
ISL_ARG_CTX_DEF(isl_options, struct isl_options, isl_options_args)
Packit fb9d21
Packit fb9d21
ISL_CTX_SET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args, bound)
Packit fb9d21
ISL_CTX_GET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args, bound)
Packit fb9d21
Packit fb9d21
ISL_CTX_SET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args,
Packit fb9d21
	on_error)
Packit fb9d21
ISL_CTX_GET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args,
Packit fb9d21
	on_error)
Packit fb9d21
Packit fb9d21
ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
Packit fb9d21
	coalesce_bounded_wrapping)
Packit fb9d21
ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
Packit fb9d21
	coalesce_bounded_wrapping)
Packit fb9d21
Packit fb9d21
ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
Packit fb9d21
	gbr_only_first)
Packit fb9d21
ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
Packit fb9d21
	gbr_only_first)
Packit fb9d21
Packit fb9d21
ISL_CTX_SET_INT_DEF(isl_options, struct isl_options, isl_options_args,
Packit fb9d21
	schedule_max_coefficient)
Packit fb9d21
ISL_CTX_GET_INT_DEF(isl_options, struct isl_options, isl_options_args,
Packit fb9d21
	schedule_max_coefficient)
Packit fb9d21
Packit fb9d21
ISL_CTX_SET_INT_DEF(isl_options, struct isl_options, isl_options_args,
Packit fb9d21
	schedule_max_constant_term)
Packit fb9d21
ISL_CTX_GET_INT_DEF(isl_options, struct isl_options, isl_options_args,
Packit fb9d21
	schedule_max_constant_term)
Packit fb9d21
Packit fb9d21
ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
Packit fb9d21
	schedule_maximize_band_depth)
Packit fb9d21
ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
Packit fb9d21
	schedule_maximize_band_depth)
Packit fb9d21
Packit fb9d21
ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
Packit fb9d21
	schedule_split_scaled)
Packit fb9d21
ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
Packit fb9d21
	schedule_split_scaled)
Packit fb9d21
Packit fb9d21
ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
Packit fb9d21
	schedule_separate_components)
Packit fb9d21
ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
Packit fb9d21
	schedule_separate_components)
Packit fb9d21
Packit fb9d21
ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
Packit fb9d21
	schedule_outer_coincidence)
Packit fb9d21
ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
Packit fb9d21
	schedule_outer_coincidence)
Packit fb9d21
Packit fb9d21
ISL_CTX_SET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args,
Packit fb9d21
	schedule_algorithm)
Packit fb9d21
ISL_CTX_GET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args,
Packit fb9d21
	schedule_algorithm)
Packit fb9d21
Packit fb9d21
ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
Packit fb9d21
	schedule_serialize_sccs)
Packit fb9d21
ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
Packit fb9d21
	schedule_serialize_sccs)
Packit fb9d21
Packit fb9d21
ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
Packit fb9d21
	tile_scale_tile_loops)
Packit fb9d21
ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
Packit fb9d21
	tile_scale_tile_loops)
Packit fb9d21
Packit fb9d21
ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
Packit fb9d21
	tile_shift_point_loops)
Packit fb9d21
ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
Packit fb9d21
	tile_shift_point_loops)
Packit fb9d21
Packit fb9d21
ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
Packit fb9d21
	ast_build_atomic_upper_bound)
Packit fb9d21
ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
Packit fb9d21
	ast_build_atomic_upper_bound)
Packit fb9d21
Packit fb9d21
ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
Packit fb9d21
	ast_build_prefer_pdiv)
Packit fb9d21
ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
Packit fb9d21
	ast_build_prefer_pdiv)
Packit fb9d21
Packit fb9d21
ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
Packit fb9d21
	ast_build_exploit_nested_bounds)
Packit fb9d21
ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
Packit fb9d21
	ast_build_exploit_nested_bounds)
Packit fb9d21
Packit fb9d21
ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
Packit fb9d21
	ast_build_group_coscheduled)
Packit fb9d21
ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
Packit fb9d21
	ast_build_group_coscheduled)
Packit fb9d21
Packit fb9d21
ISL_CTX_SET_STR_DEF(isl_options, struct isl_options, isl_options_args,
Packit fb9d21
	ast_iterator_type)
Packit fb9d21
ISL_CTX_GET_STR_DEF(isl_options, struct isl_options, isl_options_args,
Packit fb9d21
	ast_iterator_type)
Packit fb9d21
Packit fb9d21
ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
Packit fb9d21
	ast_always_print_block)
Packit fb9d21
ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
Packit fb9d21
	ast_always_print_block)
Packit fb9d21
Packit fb9d21
ISL_CTX_SET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args,
Packit fb9d21
	ast_build_separation_bounds)
Packit fb9d21
ISL_CTX_GET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args,
Packit fb9d21
	ast_build_separation_bounds)
Packit fb9d21
Packit fb9d21
ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
Packit fb9d21
	ast_build_scale_strides)
Packit fb9d21
ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
Packit fb9d21
	ast_build_scale_strides)
Packit fb9d21
Packit fb9d21
ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
Packit fb9d21
	ast_build_allow_else)
Packit fb9d21
ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
Packit fb9d21
	ast_build_allow_else)
Packit fb9d21
Packit fb9d21
ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
Packit fb9d21
	ast_build_allow_or)
Packit fb9d21
ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
Packit fb9d21
	ast_build_allow_or)