• No results found

Scheduling

In document Integer Set Library: Manual (Page 170-175)

1.5 Polyhedral Compilation Library

1.5.3 Scheduling

The functionality described in this section is fairly new and may be subject to change.

#include <isl/schedule.h> __isl_give isl_schedule *

isl_schedule_constraints_compute_schedule(

__isl_take isl_schedule_constraints *sc);

The function isl schedule constraints compute schedulecan be used to compute a schedule that satisfies the given schedule constraints. These schedule con- straints include the iteration domain for which a schedule should be computed and de- pendences between pairs of iterations. In particular, these dependences includevalidity

dependences andproximitydependences. By default, the algorithm used to construct the schedule is similar to that ofPluto. Alternatively, Feautrier’s multi-dimensional scheduling algorithm can be selected. The generated schedule respects all validity de- pendences. That is, all dependence distances over these dependences in the scheduled space are lexicographically positive.

The default algorithm tries to ensure that the dependence distances over coinci- dence constraints are zero and to minimize the dependence distances over proximity dependences. Moreover, it tries to obtain sequences (bands) of schedule dimensions for groups of domains where the dependence distances over validity dependences have only non-negative values. Note that when minimizing the maximal dependence dis- tance over proximity dependences, a single affine expression in the parameters is con- structed that bounds all dependence distances. If no such expression exists, then the algorithm will fail and resort to an alternative scheduling algorithm. In particular, this

means that adding proximity dependences may eliminate valid solutions. A typical ex- ample where this phenomenon may occur is when some subset of the proximity depen- dences has no restriction on some parameter, forcing the coefficient of that parameter to be zero, while some other subset forces the dependence distance to depend on that parameter, requiring the same coefficient to be non-zero. When using Feautrier’s algo- rithm, the coincidence and proximity constraints are only taken into account during the extension to a full-dimensional schedule.

Anisl schedule constraintsobject can be constructed and manipulated using the following functions.

#include <isl/schedule.h> __isl_give isl_schedule_constraints * isl_schedule_constraints_copy( __isl_keep isl_schedule_constraints *sc); __isl_give isl_schedule_constraints * isl_schedule_constraints_on_domain(

__isl_take isl_union_set *domain); __isl_give isl_schedule_constraints * isl_schedule_constraints_set_context(

__isl_take isl_schedule_constraints *sc, __isl_take isl_set *context);

__isl_give isl_schedule_constraints * isl_schedule_constraints_set_validity(

__isl_take isl_schedule_constraints *sc, __isl_take isl_union_map *validity); __isl_give isl_schedule_constraints *

isl_schedule_constraints_set_coincidence(

__isl_take isl_schedule_constraints *sc, __isl_take isl_union_map *coincidence); __isl_give isl_schedule_constraints *

isl_schedule_constraints_set_proximity(

__isl_take isl_schedule_constraints *sc, __isl_take isl_union_map *proximity); __isl_give isl_schedule_constraints *

isl_schedule_constraints_set_conditional_validity( __isl_take isl_schedule_constraints *sc, __isl_take isl_union_map *condition, __isl_take isl_union_map *validity); __isl_null isl_schedule_constraints *

isl_schedule_constraints_free(

__isl_take isl_schedule_constraints *sc);

The initialisl schedule constraintsobject created byisl schedule constraints on domain

does not impose any constraints. That is, it has an empty set of dependences. The func- tionisl schedule constraints set contextallows the user to specify additional constraints on the parameters that may be assumed to hold during the construction

of the schedule. The functionisl schedule constraints set validityreplaces the validity dependences, mapping domain elementsito domain elements that should be scheduled afteri. The functionisl schedule constraints set coincidence

replaces the coincidence dependences, mapping domain elementsito domain elements

that should be scheduled together withI, if possible. The functionisl schedule constraints set proximity

replaces the proximity dependences, mapping domain elementsito domain elements that should be scheduled either beforeIor as early as possible afteri.

The functionisl schedule constraints set conditional validityreplaces the conditional validity constraints. A conditional validity constraint is only imposed when any of the corresponding conditions is satisfied, i.e., when any of them is non- zero. That is, the scheduler ensures that within each band if the dependence distances over the condition constraints are not all zero then all corresponding conditional valid- ity constraints are respected. A conditional validity constraint corresponds to a con- dition if the two are adjacent, i.e., if the domain of one relation intersect the range of the other relation. The typical use case of conditional validity constraints is to allow order constraints between live ranges to be violated as long as the live ranges them- selves are local to the band. To allow more fine-grained control over which conditions correspond to which conditional validity constraints, the domains and ranges of these relations may includetags. That is, the domains and ranges of those relation may them- selves be wrapped relations where the iteration domain appears in the domain of those wrapped relations and the range of the wrapped relations can be arbitrarily chosen by the user. Conditions and conditional validity constraints are only considered adjacent to each other if the entire wrapped relation matches. In particular, a relation with a tag will never be considered adjacent to a relation without a tag.

Anisl schedule constraintsobject can be inspected using the following func- tions. #include <isl/schedule.h> __isl_give isl_union_map * isl_schedule_constraints_get_validity( __isl_keep isl_schedule_constraints *sc); __isl_give isl_union_map * isl_schedule_constraints_get_coincidence( __isl_keep isl_schedule_constraints *sc); __isl_give isl_union_map * isl_schedule_constraints_get_conditional_validity( __isl_keep isl_schedule_constraints *sc); __isl_give isl_union_map * isl_schedule_constraints_get_conditional_validity_condition( __isl_keep isl_schedule_constraints *sc);

The following function computes a schedule directly from an iteration domain and validity and proximity dependences and is implemented in terms of the functions de- scribed above. The use ofisl union set compute scheduleis discouraged.

__isl_give isl_schedule *isl_union_set_compute_schedule( __isl_take isl_union_set *domain,

__isl_take isl_union_map *validity, __isl_take isl_union_map *proximity);

The generated schedule represents a schedule tree. For more information on sched- ule trees, see§1.5.1.

Options

#include <isl/schedule.h>

isl_stat isl_options_set_schedule_max_coefficient( isl_ctx *ctx, int val);

int isl_options_get_schedule_max_coefficient( isl_ctx *ctx);

isl_stat isl_options_set_schedule_max_constant_term( isl_ctx *ctx, int val);

int isl_options_get_schedule_max_constant_term( isl_ctx *ctx);

isl_stat isl_options_set_schedule_serialize_sccs( isl_ctx *ctx, int val);

int isl_options_get_schedule_serialize_sccs(isl_ctx *ctx); isl_stat isl_options_set_schedule_maximize_band_depth(

isl_ctx *ctx, int val);

int isl_options_get_schedule_maximize_band_depth( isl_ctx *ctx);

isl_stat isl_options_set_schedule_outer_coincidence( isl_ctx *ctx, int val);

int isl_options_get_schedule_outer_coincidence( isl_ctx *ctx);

isl_stat isl_options_set_schedule_split_scaled( isl_ctx *ctx, int val);

int isl_options_get_schedule_split_scaled( isl_ctx *ctx);

isl_stat isl_options_set_schedule_algorithm( isl_ctx *ctx, int val);

int isl_options_get_schedule_algorithm( isl_ctx *ctx);

isl_stat isl_options_set_schedule_separate_components( isl_ctx *ctx, int val);

int isl_options_get_schedule_separate_components( isl_ctx *ctx);

• schedule max coefficient

This option enforces that the coefficients for variable and parameter dimensions in the calculated schedule are not larger than the specified value. This option

can significantly increase the speed of the scheduling calculation and may also prevent fusing of unrelated dimensions. A value of -1 means that this option does not introduce bounds on the variable or parameter coefficients.

• schedule max constant term

This option enforces that the constant coefficients in the calculated schedule are not larger than the maximal constant term. This option can significantly increase the speed of the scheduling calculation and may also prevent fusing of unrelated dimensions. A value of -1 means that this option does not introduce bounds on the constant coefficients.

• schedule serialize sccs

If this option is set, then all strongly connected components in the dependence graph are serialized as soon as they are detected. This means in particular that instances of statements will only appear in the same band node if these state- ments belong to the same strongly connected component at the point where the band node is constructed.

• schedule maximize band depth

If this option is set, we do not split bands at the point where we detect splitting is necessary. Instead, we backtrack and split bands as early as possible. This reduces the number of splits and maximizes the width of the bands. Wider bands give more possibilities for tiling. Note that if theschedule serialize sccs

options is set, then bands will be split as early as possible, even if there is no need. Theschedule maximize band depthoption therefore has no effect in this case.

• schedule outer coincidence

If this option is set, then we try to construct schedules where the outermost scheduling dimension in each band satisfies the coincidence constraints.

• schedule split scaled

If this option is set, then we try to construct schedules in which the constant term is split offfrom the linear part if the linear parts of the scheduling rows for all nodes in the graphs have a common non-trivial divisor. The constant term is then placed in a separate band and the linear part is reduced.

• schedule algorithm

Selects the scheduling algorithm to be used. Available scheduling algorithms are

ISL SCHEDULE ALGORITHM ISLandISL SCHEDULE ALGORITHM FEAUTRIER.

• schedule separate components

If this option is set then the functionisl schedule get mapwill treat set nodes in the same way as sequence nodes.

In document Integer Set Library: Manual (Page 170-175)

Related documents