From 1af2d4e2dbee151d9c0cdab6efa79b019093aaaa Mon Sep 17 00:00:00 2001 From: Pavlo Ratushnyi Date: Sat, 24 Oct 2026 00:04:26 +0200 Subject: [PATCH] perf(prefill): deferred guard status is on by default Job 971 (ABBA, separate processes, 16,000 tokens, chunk 8192, stream + aligned copies): 4,349-4,363 -> 4,553-4,571 tok/s (+4.8%); final residual R hashes of both chunks and the greedy ids are identical to the immediate guards. LELEKA_PREFILL_DEFER_GUARDS=0 restores the immediate guards. Co-Authored-By: Claude Sonnet 5.5 --- crates/cuda-driver/src/deferred_status.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/cuda-driver/src/deferred_status.rs b/crates/cuda-driver/src/deferred_status.rs index a63de325..68f8aff0 100644 --- a/crates/cuda-driver/src/deferred_status.rs +++ b/crates/cuda-driver/src/deferred_status.rs @@ -1,4 +1,4 @@ -//! `LELEKA_PREFILL_DEFER_GUARDS=1` (EXPERIMENTAL, claude/schedule): deferred guard status for the prompt producer's `run`. +//! `LELEKA_PREFILL_DEFER_GUARDS` (default on, `=0` restores the immediate guards; claude/schedule): deferred guard status for the prompt producer's `run`. //! //! Today every `OriginalPromptDevice::run` (the hyper-connection reads and injections: about 560 per 8192-token chunk) zeroes its status //! words with a synchronous upload, runs its kernels, drains the whole context, reads the words back and refuses on the first set one: @@ -50,7 +50,7 @@ pub(crate) fn evaluate(readback: &[u8], stride: usize, order: &[usize], labels: /// Read once: the switch. Off by default (experimental mode). pub(crate) fn enabled() -> bool { static ON: std::sync::OnceLock = std::sync::OnceLock::new(); - *ON.get_or_init(|| std::env::var("LELEKA_PREFILL_DEFER_GUARDS").is_ok_and(|v| v == "1")) + *ON.get_or_init(|| std::env::var("LELEKA_PREFILL_DEFER_GUARDS").map_or(true, |v| v != "0")) } #[cfg(all(feature = "cuda-driver", target_os = "linux", target_pointer_width = "64"))]