Algorithm Search⌘K

Problemcore

Latency-constrained scheduling

Also called time-constrained scheduling, minimum-resource latency-constrained scheduling.

Schedule the operations of a sequencing graph within a given number of control steps so that the number of functional units needed is least.

Latency-constrained scheduling is the scheduling problem of high-level synthesis in which the number of control steps is fixed and the goal is to need as few functional units as possible. The latency bound usually comes from a throughput target or from a real-time deadline. The input is a sequencing graph with a delay and a unit type for each operation, and a cost for each unit type, such as its area. A schedule must respect the data edges and end within the bound. The units of a type that it needs are the largest number of operations of that type that run in one step, and the cost is the weighted sum of these numbers. It is the partner of resource-constrained scheduling, which fixes the units and minimizes the latency, and it is NP-hard for the same reason.

In plain words

You must finish a set of dependent calculations within a fixed number of clock ticks. You do not care how fast within that limit, but every multiplier and adder that the chip needs costs area. If many multiplies fall in the same tick, you must build many multipliers. So you want to spread the operations of each kind evenly over the ticks, without breaking the order that the data needs. A tight deadline leaves little room to spread, and a loose one leaves a lot.

Definition

Input.

  • A sequencing graph G=(V,E)G = (V, E) with no cycle.
  • For each operation vv, an integer delay d(v)≥1d(v) \ge 1 and a type t(v)∈Kt(v) \in K.
  • A latency bound LL, an integer.
  • A cost ck>0c_k > 0 for each type kk.

Feasible solutions. A schedule s:V→{0,1,…}s : V \to \{0, 1, \ldots\} with s(v)≥s(u)+d(u)s(v) \ge s(u) + d(u) for each edge (u,v)(u, v) and s(v)+d(v)≤Ls(v) + d(v) \le L for each vv. Units are not pipelined and there is no chaining, as in resource-constrained scheduling.

Objective. The schedule needs

ak(s)=max⁡0≤j<L∣{v:t(v)=k, s(v)≤j<s(v)+d(v)}∣a_k(s) = \max_{0 \le j < L} \left|\{ v : t(v) = k,\ s(v) \le j < s(v) + d(v) \}\right|

units of type kk. Minimize the cost ∑k∈Kck ak(s)\sum_{k \in K} c_k\, a_k(s).

Decision form. Given the input and a cost CC, is there a schedule with cost at most CC?

A feasible schedule exists exactly when LL is at least the critical path, the largest sum of delays on a path of GG, since the ASAP schedule ends at the critical path.

Variants

  • Registers and interconnect. Add the registers, which follow the number of values live across a step, and the multiplexers to the cost. The schedule then fixes more of the area.
  • Several unit types per operation. Each operation may run on more than one type, with different delays and costs. The schedule and the module selection are then chosen together.
  • Pipelined units. An operation occupies its unit only in its first step, so the count runs over starts only.
  • Chaining. The clock period is given and dependent operations may share a step. See operation chaining.
  • Loops with a target initiation interval. The latency bound is replaced by a bound IIII on the distance between iterations, and the units are counted modulo IIII.
  • Power. Minimize the peak or the variance of the number of active units per step, which is the same kind of balancing.

Examples

Take the differential equation example of Paulin and Knight, with the operations and edges that the high-level synthesis page gives: six multiplies, five ALU operations, unit delays and a critical path of 4. With the cost 1 for each unit, the optimum for each latency bound is

latency bound LL multipliers ALUs units in total
3 none none infeasible
4 2 2 4
5 2 1 3
6 2 1 3
7 1 1 2

At L=4L = 4, at least 2 multipliers are needed: the paths v1→v3→v4→v5v_1 \to v_3 \to v_4 \to v_5 and v2→v3→v4→v5v_2 \to v_3 \to v_4 \to v_5 have 4 operations each, so the multiplies v1v_1 and v2v_2 must both run in step 0. At L=6L = 6, one multiplier is still too few, because six multiplies in a row take steps 0 to 5 and the last one feeds an ALU operation that would end at step 7. The schedule on the force-directed scheduling page reaches the optimum at L=4L = 4.

A second example shows why the bound matters for balance. Take four independent additions and L=2L = 2. A schedule that puts all four in step 0 needs 4 adders. Two in each step need 2, the optimum, which meets the lower bound ⌈4/2⌉\lceil 4 / 2 \rceil.

Known algorithms

  • Force-directed scheduling. Paulin and Knight's heuristic balances the expected use of each type over the steps. See force-directed scheduling.
  • Integer programming. The 0-1 program with one variable per operation and step, plus one integer variable aka_k per type, gives the optimum for small graphs. See the ILP formulation.
  • Search over unit vectors. For each unit vector aa in order of cost, run a resource-constrained scheduler and stop at the first aa whose latency is at most LL. This is exact if the inner scheduler is exact. With list scheduling inside it is a heuristic.
  • SDC scheduling. An LP over difference constraints can minimize a linear proxy, such as the sum of starts or a lifetime cost, under the latency bound. It does not count units exactly. See SDC scheduling.
  • Branch and bound. Search over the frames of the operations, cut off by the lower bounds below.
AlgorithmTimeSpacePropertiesCode
SDC-based schedulingO(V (V + E) + V C) worstO(V^2 + C) extradeterministicnot exactofflineiterative1 language

Bounds

Let a(v)a(v) and b(v)b(v) be the ASAP and ALAP starts of vv for the bound LL, from ASAP and ALAP scheduling. Every schedule has a(v)≤s(v)≤b(v)a(v) \le s(v) \le b(v).

Window bound. For steps j1<j2j_1 < j_2, let Wk[j1,j2]W_k[j_1, j_2] be the sum of d(v)d(v) over the operations of type kk with a(v)≥j1a(v) \ge j_1 and b(v)+d(v)≤j2b(v) + d(v) \le j_2. In every schedule these operations run entirely inside the steps j1j_1 to j2−1j_2 - 1, which offer ak(j2−j1)a_k (j_2 - j_1) busy cycles of type kk. So

ak≥max⁡j1<j2⌈Wk[j1,j2]j2−j1⌉.a_k \ge \max_{j_1 < j_2} \left\lceil \frac{W_k[j_1, j_2]}{j_2 - j_1} \right\rceil.

With j1=0j_1 = 0 and j2=Lj_2 = L this gives ak≥⌈Wk/L⌉a_k \ge \lceil W_k / L \rceil. Narrow windows give better bounds: in the example at L=4L = 4, the window from step 0 to 1 holds v1v_1 and v2v_2, which gives 2 multipliers.

Monotone in LL. A schedule for LL is also a schedule for L+1L + 1, so the optimum cost does not rise as LL grows. It reaches ∑kck\sum_k c_k, one unit of each type that occurs, once LL is large enough for a schedule that runs one operation of each type at a time.

Trade-off curve. For one type, the optimum for LL is the least aa whose resource-constrained optimum is at most LL. So the two problems give the same curve of latency against units, read along different axes.

Reductions

In NP. A schedule is a certificate: its starts are below LL, and the edges, the bound and the cost can be checked in time polynomial in ∣V∣+∣E∣|V| + |E| and LL. If LL exceeds ∑vd(v)\sum_v d(v), it can be replaced by ∑vd(v)\sum_v d(v) without changing the answer, since every schedule can be shifted to start each operation no later than that.

NP-hard. Take one type with cost 1 and unit delays. The question "is there a schedule within LL that needs at most mm units" is the question "can unit-time tasks with precedences finish by the deadline LL on mm processors". Ullman (1975) proved this NP-complete when mm and LL are part of the input. So the decision form is NP-complete, and minimizing the units is NP-hard. The hard instances have small numbers, so the hardness holds in the strong sense.

Equivalence with resource-constrained scheduling. For one type, an algorithm for either optimization problem solves the other with a binary search over LL or over mm, and LL and mm need not exceed ∣V∣⋅max⁡vd(v)|V| \cdot \max_v d(v) and ∣V∣|V|. So the two problems are polynomially equivalent.

Applications

  • Signal processing datapaths. A filter or a transform must take a new sample every fixed number of cycles, which fixes LL. The goal is the smallest datapath.
  • Real-time control. A control loop has a deadline per period, and the unit count sets the cost of the chip.
  • Low power. Spreading the operations evenly lowers the peak current and the number of units that must be powered.
  • Design space exploration. Solving it for each LL gives the area side of the area and latency trade-off curve.

References

  1. Giovanni De Micheli, Synthesis and Optimization of Digital Circuits, McGraw-Hill, 1994, Chapter 5, Scheduling Algorithms (the sections on scheduling with resource constraints and on force-directed scheduling)
  2. Pierre G. Paulin and John P. Knight, Force-directed scheduling for the behavioral synthesis of ASICs, IEEE Transactions on Computer-Aided Design 8(6), 661 to 679, 1989, time-constrained scheduling, the distribution graphs and the differential equation example
  3. J. D. Ullman, NP-complete scheduling problems, Journal of Computer and System Sciences 10(3), 1975, the NP-completeness of scheduling unit-time tasks with precedence constraints on a given number of processors

Where this leads

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.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW2 basic
  • a contract.yaml