From 81029ecdb41c1b1fb12fecd004308b61bc91f829 Mon Sep 17 00:00:00 2001 From: Pavlo Ratushnyi Date: Sat, 28 Nov 2026 12:51:22 +0100 Subject: [PATCH] engine: the draft trace line checks LELEKA_TRACE_DRAFT itself, as the function did (STRA-338) trace_draft_line lost its own switch check when the switch became a field of the window loop's decode settings, and two of its three callers printed a DRAFT line per draft unguarded; the speed A/B with tracing off showed 518 DRAFT lines on the candidate against none on the base. The function takes the switch again and every caller passes it. --- .../native_serve_port_original_serve_port.rs | 2 +- .../original_serve_native/native_window.rs | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_native/native_serve_port_original_serve_port.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_native/native_serve_port_original_serve_port.rs index 1afdf78f..01762ed4 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_native/native_serve_port_original_serve_port.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_native/native_serve_port_original_serve_port.rs @@ -181,7 +181,7 @@ where self.live()?; let cell = first.cell; let c = self.host.draft_first(first, limits, coupled)?; - trace_draft_line(cell, 0, &c); + trace_draft_line(self.decode.trace_draft, (cell, 0), &c); Ok(c) } fn drain_first(&mut self) -> Result<()> { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_native/native_window.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_native/native_window.rs index f2eda9b0..4badef04 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_native/native_window.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_native/native_window.rs @@ -175,7 +175,7 @@ where self.failed = true; } if let Ok(c) = &finished { - trace_draft_line(position, accepted_row, c); + trace_draft_line(self.decode.trace_draft, (position, accepted_row), c); } finished } @@ -224,8 +224,8 @@ where if draft.is_err() { self.failed = true; } - if let (Ok(c), true) = (&draft, self.decode.trace_draft) { - trace_draft_line(position, accepted_row, c); + if let Ok(c) = &draft { + trace_draft_line(self.decode.trace_draft, (position, accepted_row), c); } draft } @@ -235,7 +235,10 @@ where /// their probabilities). The draft's numerics /// are bit-compared across builds and settings by diffing these lines (draft-round identity gate); nothing reads them /// in production. -pub(super) fn trace_draft_line(position: i64, accepted_row: usize, c: &DraftCompletion) { +pub(super) fn trace_draft_line(on: bool, (position, accepted_row): (i64, usize), c: &DraftCompletion) { + if !on { + return; + } let bits: Vec = c.probabilities.iter().map(|p| format!("{:08x}", p.to_bits())).collect(); eprintln!( "DRAFT position={position} accepted_row={accepted_row} cell={} ids={:?} pbits=[{}]",