Techniqueadvanced
Latency-insensitive design
Also called relay station insertion, Carloni latency-insensitive protocol.
Carloni, McMillan and Sangiovanni-Vincentelli's method that wraps blocks in shells with valid and stop signals so long wires can take relay stations without changing behaviour.
Latency-insensitive design is a way to build a synchronous chip so that the wires between its blocks may take any number of clock cycles without changing what the chip computes. Carloni, McMillan and Sangiovanni-Vincentelli (2001) wrap each block, a pearl, in a shell that passes data with a valid bit and stalls the pearl when an input is missing or an output is blocked, using a stop signal that flows backwards. A long wire can then be cut by relay stations, small two-place buffers that add one cycle each, after placement and routing, when the wire delays are known. The data streams stay the same, only shifted in time. The price is throughput: on a cycle of the block graph with shells and relay stations, only valid data circulate in stages, and the system throughput is the least of over all cycles, a minimum cycle ratio.
In plain words
On a big chip, a signal may need more than one clock tick to cross from one block to another, and this is often found out only at the end of the design. Latency-insensitive design plans for it. Each block gets a wrapper that only lets the block work when all its inputs have fresh data and its outputs have room. Every wire carries a flag that says whether the data on it is real or empty. If a wire is too long, we cut it with small holding stations that add one tick. The blocks still see the same numbers in the same order, just later. In a loop of blocks, the empty slots added by the stations slow the whole loop down.
When it applies
- A synchronous design whose blocks are patient: a block can be stalled for a cycle and resume with the same state, for example by gating its clock or by a hold enable on its registers.
- The communication between blocks is point to point, through channels that carry data and could tolerate extra delay if the receiver waits for it.
- Wire delays are known only after placement and routing, or change between technology versions, and redesigning the blocks for each change is too costly.
- The loss of throughput on the cycles of the block graph is acceptable, or the design has few cycles.
The template
Model the design as a directed graph whose vertices are the pearls and whose arcs are the channels.
LATENCY-INSENSITIVE(G, the clock period T, the wire delays)- 1
for each pearl P: make P patient, so that a stall input freezes its state for one cycle - 2
wrap P in a shell: a queue on each input channel, a valid bit on each output, and a stop signal back to each sender - 3
the shell fires P in a cycle exactly when every input queue has a valid datum and no output receives stop - 4
place and route the design and measure the delay of each channel - 5
for each channel of delay D > T, insert ⌈D / T⌉ − 1 relay stations, each a two-place buffer with valid and stop - 6
build the marked graph of the system and compute θ = the minimum over cycles of tokens / stages - 7
if θ is too low then move relay stations off the critical cycles, enlarge queues, or change the floorplan, and go to L4 - 8
return the system
The holes are the shell protocol of L2 and L3, the size of the queues, and the choices of L7.
Why the behaviour does not change. A shell fires its pearl only on valid inputs, and a relay station passes valid data in order and only drops the empty slots. So each pearl sees, on each input, the same sequence of valid data as in the original design, with empty cycles in between, and produces the same sequence of valid outputs. Carloni, McMillan and Sangiovanni-Vincentelli call two such systems latency equivalent: they agree on the valid data of every signal, in order, and differ only in the timing.
The marked graph. Each shell and each relay station is a stage that takes one cycle. Each channel segment between two stages is an arc with tokens: an arc out of a shell starts with 1 token, the valid datum in the shell's output register, and an arc out of a relay station starts with 0 tokens, since relay stations start empty. A stage fires when every incoming arc has a token. Firing removes one token from each incoming arc and, one cycle later, adds one to each outgoing arc. Each stage fires at most once per cycle, which is a self-loop with 1 token. With unbounded queues this is a timed marked graph, a Petri net in which each place has one input and one output transition, also called a timed event graph.
Theorem (throughput). Let the graph be strongly connected, and for a cycle let be its tokens and its number of stages. In the schedule in which every stage fires as soon as it can, every stage fires times in the first cycles, with
For a cycle of shells and relay stations, and .
Proof. The total of the tokens on a cycle never changes, since each firing of a stage on the cycle takes one token from its incoming arc on the cycle and puts one on its outgoing arc on the cycle. Let be the number of firings of stage in cycles . For an arc with initial tokens, the firings of up to cycle use tokens that were there at the start or produced by up to cycle , so . Adding this around a cycle through gives , so fires at most times in any consecutive cycles, and the rate is at most for every cycle, hence at most .
For the other direction, give each arc the weight . Every cycle has weight , so there is no negative cycle and shortest path potentials exist with on every arc. Set and fire for the -th time, , in cycle , with a constant that makes all these times nonnegative. On an arc , the -th firing of needs the -th firing of to happen at least one cycle earlier when . From we get , and taking ceilings keeps the gap of 1. The self-loops give , so successive firings of one stage are at least one cycle apart. So this periodic schedule is feasible, and it fires every stage about times in cycles. The as-soon-as-possible schedule fires every stage no later than any feasible schedule, by induction on the firings, so it reaches at least the same count.
Since every stage takes one cycle, is the number of arcs of , and is the least mean token count per arc over all cycles. It is computed by Karp's minimum mean cycle algorithm in time, or by the search of the minimum ratio problem. If the graph has no cycle except the self-loops, : relay stations on an acyclic design add latency but cost no throughput.
Finite queues. With a queue of capacity on a channel, the stop signal blocks the sender when the queue is full. In the marked graph this is a reverse arc from the receiver to the sender with tokens, the free places, where is the initial tokens of the forward arc. The theorem applies to the graph with the reverse arcs, which is strongly connected even when the design is acyclic.
Classic examples
A ring of three shells. Shells , and form a ring , and routing puts one relay station on and one on . The only cycle has and , so : in every 5 cycles, each shell does 3 cycles of useful work. A simulation of the as-soon-as-possible firing gives exactly 3 firings per 5 cycles in steady state. Both wires are long, so neither relay station can be removed. A ring of 6 shells with the same two relay stations would have .
Reconvergent paths and queue size. Shell sends to shell on two channels, one direct and one through a relay station . With unbounded queues the design is acyclic and . With queues of capacity , the reverse arcs create cycles. The cycle , using the forward arcs through and the reverse arc of the direct channel, has tokens on 3 arcs. The other cycles, such as with tokens on 2 arcs, give or more. So : for , for and for . The short path fills its queue while waits for the datum on the long path, and the stop signal then stalls . Simulation of the firing gives the same three values.
A pipeline. A chain of shells with any number of relay stations and queues of capacity 2 has, on each pair of forward and reverse arcs, tokens on 2 arcs, so . This is why relay stations hold two places: a one-place station on a channel would give a cycle of 1 token on 2 arcs and halve the throughput.
Variations
- Synchronous elastic circuits. Later work by Cortadella, Kishinevsky and others uses the same valid and stop handshake at the level of single registers, with simpler controllers.
- Queue sizing. Choose the queue capacities to reach on all cycles created by back pressure, with the least total size, as in Collins and Carloni (2008).
- Recycling. Add relay stations on short paths of reconvergent structures to balance them, which can raise the throughput when queues are small, at the cost of latency.
- Pipelining the pearls. Combine relay station insertion with retiming, which moves registers across the logic to spread the delay of long paths.
- Dataflow view. Shells with valid and stop signals implement a dataflow network, close to synchronous dataflow graphs with unit rates and to the iteration bound of DSP loops.
Pitfalls
- Pearls that are not patient. A block with internal timing assumptions, such as a memory with a fixed read latency, breaks when stalled unless its shell handles it.
- Combinational stop paths. The stop signal runs backwards through the shells. If each shell passes it on without a register, it forms a long combinational path that defeats the purpose. Relay stations with two places break it.
- Relay stations on tight cycles. One relay station on a cycle of two shells drops the throughput to . Place blocks so that the critical cycles have short wires.
- Initial tokens. A cycle with no valid token at the start never fires. Every cycle of the original design passes through a register, which gives it a token.
- Off-chip interfaces. The environment must follow the protocol too, or a protocol converter is needed at the chip boundary.
Exercises
- A ring of 4 shells has relay stations on 3 of its channels. What is , and how many relay stations can a ring of 4 shells take before the throughput falls below ?
- Prove that in a marked graph the token count of every cycle is constant over time.
- In the reconvergent example, put a second relay station on the long path. Find as a function of , and the least that gives .
- Show that for an acyclic design with unbounded queues, the latency from input to output grows by the number of relay stations on the longest path, while stays 1.
References
- Luca P. Carloni, Kenneth L. McMillan and Alberto L. Sangiovanni-Vincentelli, Theory of latency-insensitive design, IEEE Transactions on Computer-Aided Design 20(9), 1059 to 1076, 2001, whole paper (patient processes, shells and relay stations, and the equivalence of a latency-insensitive system with the original one up to stalling)
- Luca P. Carloni and Alberto L. Sangiovanni-Vincentelli, Performance analysis and optimization of latency insensitive systems, Proceedings of the 37th Design Automation Conference, 2000, whole paper (the throughput of a system with relay stations on its cycles)
- Rebecca L. Collins and Luca P. Carloni, Topology-based performance analysis and optimization of latency-insensitive systems, IEEE Transactions on Computer-Aided Design 27(12), 2008, whole paper (marked graph models with finite queues and back pressure, and queue sizing)
- C. V. Ramamoorthy and Gary S. Ho, Performance evaluation of asynchronous concurrent systems using Petri nets, IEEE Transactions on Software Engineering SE-6(5), 440 to 449, 1980, whole paper (the cycle time of a timed marked graph is the largest ratio of delay to tokens over its cycles)
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 | W2 basic |
|
Tag KTPTAC Edit this page History Report an error Markdown