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 <noreply@anthropic.com>
This commit is contained in:
Pavlo Ratushnyi
2026-10-24 00:04:26 +02:00
co-authored by Claude Sonnet 5.5
parent 1823923fba
commit 1af2d4e2db
+2 -2
View File
@@ -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<bool> = 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"))]