chain pipeline: profile counters mtp.chain_gate.* (which condition decided each draft)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Pavlo Ratushnyi
2026-11-10 02:46:17 +01:00
co-authored by Claude Sonnet 5.5
parent e7a26c60c5
commit 4b0f87bf08
@@ -48,6 +48,7 @@ impl<'ctx> OriginalMtpDrafter<'ctx> {
first.saturating_add(a),
MTP_ORIGINAL_MAX_CELLS,
);
crate::host_profile::add(chain_gate(policy.chain_pipeline, (cp, min_p, limit)), 0.0);
if policy.chain_pipeline && !cp && min_p <= 0.0 && limit > 2 {
let count = self.finish_chain_pipelined(ring, policy, (key, limit), (&mut ids, &mut probabilities))?;
return Ok((ids, probabilities, count));
@@ -396,3 +397,18 @@ type ChainGraphs<'ctx> = OriginalGraphRegistry<'ctx, OriginalMtpDraftProgram<'ct
fn chain_key(j: usize) -> OriginalGraphKey {
OriginalGraphKey::MtpChain { step: j as u8 }
}
/// Which condition of the pipelined chain decided this draft (profile counters `mtp.chain_gate.*`, one per draft).
fn chain_gate(switch_on: bool, (coupled, min_p, limit): (bool, f32, i32)) -> &'static str {
if !switch_on {
"mtp.chain_gate.switch_off"
} else if coupled {
"mtp.chain_gate.coupled"
} else if min_p > 0.0 {
"mtp.chain_gate.min_p"
} else if limit <= 2 {
"mtp.chain_gate.short"
} else {
"mtp.chain_gate.pipelined"
}
}