Techniquecore
ILP formulation of operation scheduling
Also called ALPS scheduling, integer programming scheduling for HLS.
Writes high-level synthesis scheduling as a 0-1 integer program with one variable per operation and step, plus precedence and resource rows, solved exactly.
The ILP formulation writes the scheduling problems of high-level synthesis as a 0-1 integer program. There is one binary variable for each operation and each step in which may start, equal to 1 when starts in step . Linear rows say that each operation starts once, that it starts after its predecessors end, and that no step uses more units of a type than allowed. The same rows serve resource-constrained scheduling, with the latency as the objective, and latency-constrained scheduling, with the unit counts as variables and the cost as the objective. A general solver then gives a proved optimum. Hwang, Lee and Hsu (1991) made the model practical in their ALPS scheduler by creating variables only inside the window from the ASAP to the ALAP start of each operation.
In plain words
Make a grid with one row per operation and one column per clock step. Each operation must put exactly one mark in its row, in the step where it starts. Rules on the grid say that a mark must come after the marks of the operations it needs, and that one column cannot hold more multiplies than there are multipliers. A solver for this kind of yes or no grid puzzle then finds the best placement of the marks. It is slow on big graphs, but its answer is the true best.
When it applies
Use it when an exact schedule is worth the solver time: graphs with tens to a few hundred operations, a moderate number of steps, and a good solver at hand. It also gives the reference optimum for judging heuristics such as list scheduling and force-directed scheduling. It needs an upper bound on the latency to fix the columns. A list schedule gives one.
It fits any constraint that is linear in the start indicators: precedences with delays, unit limits per step, timing windows, mutually exclusive operations, and unit limits modulo an initiation interval. It does not fit costs that are not linear in the indicators, such as the exact multiplexer area of a binding, without more variables.
The template
Let be the sequencing graph, the delays, the types, and a latency bound. Let be the ASAP and ALAP starts for , from ASAP and ALAP scheduling. Every schedule has , so only these steps get a variable.
- Variables. for and .
- One start. for each . The start step is then .
- Precedence. For each edge , .
- Resources. For each type and step ,
which counts the operations of type that are busy in step . 5. Objective. For resource-constrained scheduling, add a sink after every operation and minimize . For latency-constrained scheduling, make each an integer variable and minimize . 6. Solve. Give the model to a 0-1 or mixed integer solver, which runs branch and bound on the LP relaxation. 7. Read the schedule. is the with .
Why it is exact. Integer solutions and schedules match one to one. Given a schedule within , set and all other variables to 0. Then row 2 holds, row 3 is , and row 4 counts, for each and , the operations of type with , which are exactly those busy in step . Conversely, a 0-1 solution has exactly one 1 per operation by row 2, so it defines , and the same reading of rows 3 and 4 shows that is a schedule. Both maps keep the objective, so an optimal integer solution is an optimal schedule.
A stronger precedence row. Row 3 is one row per edge. For unit delays it can be replaced, for each edge and step , by
which says that starts at or later and starts at or earlier cannot both hold. For delay , replace in the second sum by . Integer solutions are the same. Every fractional solution of these rows also meets row 3, so the LP relaxation is at least as tight. The price is one row per edge and step.
Size. There are variables, rows of kinds 2 and 3, and rows of kind 4. Tight windows from a good bound make the model much smaller.
Classic examples
- The small gap. Take two independent operations of one type with one unit, delay 1, a sink , and . The best integer schedule runs them in steps 0 and 1, so . The LP relaxation can set for both, which meets the resource rows with equality and gives . Then row 3 allows . So the LP bound is against the optimum 2, and the solver must branch.
- The differential equation example. With and unit delays, the windows of the high-level synthesis example give 21 variables for 11 operations, against 44 for the full grid. The operations to lie on paths of 4 steps and have one step each, and have 2, and to have 3. The optimum for latency-constrained scheduling with unit costs needs 2 multipliers and 2 ALUs, as on the latency-constrained scheduling page.
- ALPS. Hwang, Lee and Hsu solved time-constrained, resource-constrained and feasible scheduling, the last a test whether given unit counts and a latency bound admit any schedule. They also modeled chaining, multicycle and pipelined units, functional pipelining, loop folding, mutually exclusive operations and bus limits, and the lifetimes of variables, all in the same 0-1 form.
Variations
- Pipelined units. In row 4, count only the start step: replace the inner sum by .
- Modulo resources. For a loop with initiation interval , the resource row for residue sums over all and over the busy steps. This is an exact model of modulo scheduling. See SDC modulo scheduling for a faster heuristic.
- Module selection. Use for each type that can run , with and the delay of in the precedence rows.
- Mutually exclusive operations. Two operations on different arms of a branch can share a unit in one step. Count them as one in row 4, for example with one row per set of operations that can run together.
- Timing windows. A rule is the linear row .
- Register and lifetime costs. Lifetimes are linear in the starts, so a cost on the sum of lifetimes adds no new variable. The exact register count needs one more variable per step.
- Difference constraints only. If the resource rows are dropped and the starts are used as integer variables directly, every row has the form . That matrix is totally unimodular, so an LP solves it. This is the idea of SDC scheduling, which then handles resources by a heuristic order.
Pitfalls
- No bound, no model. The columns need a latency bound. A bound that is too small makes the model infeasible, and one that is too large makes it big. Use a list schedule for an upper bound and the critical path for a lower bound.
- Weak rows. The one-row-per-edge precedence gives a weak LP bound, and the solver spends time branching. The stronger rows help on hard instances.
- Multicycle operations. Row 4 must count every busy step of an operation, not only its start, unless the unit is pipelined. A model that counts only starts for a non-pipelined unit allows two operations on one unit at the same time.
- Fractional reading. Read the schedule only from an integer solution. Rounding an LP solution does not keep the precedences in general.
- Symmetry. Units of one type are identical, and many schedules have the same cost. Solvers waste time on symmetric branches unless the model or the solver breaks the symmetry.
- Scale. The number of variables grows with . Models with thousands of operations and long latencies are out of reach of exact solving in reasonable time, which is why heuristic schedulers dominate in tools.
Exercises
- Show that the stronger precedence row for unit delays implies for every fractional solution that meets the one-start rows.
- Write the model for the chain of unit multiplies, one multiplier and . How many variables remain after the windows are applied?
- Give a family of graphs where the LP bound of the template with row 3 stays near half of the optimal latency.
- Write the resource rows for a pipelined multiplier of delay 2 under modulo scheduling with .
References
- Cheng-Tsung Hwang, Jiahn-Humg Lee and Yu-Chin Hsu, A formal approach to the scheduling problem in high level synthesis, IEEE Transactions on Computer-Aided Design 10(4), 464 to 475, 1991, the 0-1 model with variables only inside the ASAP to ALAP window, time-constrained, resource-constrained and feasible scheduling, and the extensions to chaining, multicycle and pipelined units, functional pipelining and loop folding
- Giovanni De Micheli, Synthesis and Optimization of Digital Circuits, McGraw-Hill, 1994, Chapter 5, Scheduling Algorithms (the integer linear programming model in the section on scheduling with resource constraints)
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Visual | V0 none |
|
| Writing | W3 standard |
|
Tag FXNRG0 Edit this page History Report an error Markdown