ring diagnostic: LELEKA_PREFILL_DIAG_SKIP_EXPERT_DMA=N skips the expert copies after the first N (cold slots are uninitialised and the finite guards refuse them)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Pavlo Ratushnyi
2026-11-10 17:45:06 +01:00
co-authored by Claude Sonnet 5.5
parent c1cb1ff5e6
commit 1b49397cd0
2 changed files with 11 additions and 4 deletions
@@ -5,10 +5,17 @@
use super::*;
/// `LELEKA_PREFILL_DIAG_SKIP_EXPERT_DMA=1` (EXPERIMENTAL, diagnostic, wrong outputs): the copy ring issues no
/// expert copies, so a profile shows the ring's compute alone. Never set in serving.
/// expert copies, so a profile shows the ring's compute alone. `=N` with N > 1 skips only after the first N real
/// copies, so the ring slots hold real expert blobs by then (a cold boot's slots are uninitialised and the finite
/// guards refuse them). Never set in serving.
pub(super) fn skip_expert_dma() -> bool {
static ON: std::sync::OnceLock<bool> = std::sync::OnceLock::new();
*ON.get_or_init(|| std::env::var_os("LELEKA_PREFILL_DIAG_SKIP_EXPERT_DMA").is_some_and(|v| v == "1"))
static AFTER: std::sync::OnceLock<Option<u64>> = std::sync::OnceLock::new();
static COPIES: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(0);
let after = *AFTER.get_or_init(|| {
let value = std::env::var("LELEKA_PREFILL_DIAG_SKIP_EXPERT_DMA").ok()?;
value.parse::<u64>().ok().filter(|&n| n >= 1)
});
after.is_some_and(|n| n == 1 || COPIES.fetch_add(1, std::sync::atomic::Ordering::Relaxed) >= n)
}
#[cfg(not(all(
feature = "cuda-driver",
+1 -1
View File
@@ -98,7 +98,7 @@ for v in $VARS; do
XT) export LELEKA_DRAFT_CHAIN_PIPELINE=1 LELEKA_DRAFT_CHECK_MERGE=1 LELEKA_PREFIX_PARK_FAST=1 LELEKA_TRACE_DRAFT=1;;
Y) export LELEKA_DRAFT_CHECK_MERGE=1 LELEKA_PREFIX_PARK_FAST=1 LELEKA_DECODE_GRAPH_REUSE=1;;
YP) export LELEKA_DRAFT_CHECK_MERGE=1 LELEKA_PREFIX_PARK_FAST=1 LELEKA_DECODE_GRAPH_REUSE=1 LELEKA_SERVE_PROFILE=1;;
DSP) export LELEKA_PREFILL_DIAG_SKIP_EXPERT_DMA=1 LELEKA_SERVE_PROFILE=1;; # diagnostic, WRONG outputs: how much of moe.ring is bytes
DSP) export LELEKA_PREFILL_DIAG_SKIP_EXPERT_DMA=40000 LELEKA_SERVE_PROFILE=1;; # diagnostic, WRONG outputs: how much of moe.ring is bytes
PF) export LELEKA_PREFIX_PARK_FAST=1;;
PA) export LELEKA_PREFIX_PARK_FAST=1 LELEKA_PREFIX_PARK_ASYNC=1;;
PFP) export LELEKA_PREFIX_PARK_FAST=1 LELEKA_SERVE_PROFILE=1;;