Skip to main content

eval_credit_flow

Function eval_credit_flow 

Source
pub fn eval_credit_flow(
    c: &Choreography,
    mp: &Metapipeline,
    iters: usize,
    depth_override: Option<usize>,
) -> CreditRun
Expand description

Run the pipeline as a cycle-exact token/credit machine for iters iterations.

Stage s issues iteration t at the latest of: its own initiation interval since its last issue; the arrival of every input token (issue(w, t) + forward); and a free credit on every output channel — which, with depth credits outstanding, is the return of the credit spent on iteration t - depth (issue(r, t - depth) + backward). Stages are visited in edge order, a topological order of the metapipelines this models (writer < reader).

The verdict is CreditRun::throughput_loss, not the raw stall count: a producer whose own interval is shorter than the pipeline’s is supposed to be paced by back-pressure, and that costs nothing. A depth is right when the loss is zero and wrong the moment one credit is removed.