cuda-driver: LELEKA_MTP_SNAPSHOT_MEMO=off restores the full page scan (A/B control for the snapshot validation memo)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Pavlo Ratushnyi
2026-10-29 01:12:19 +01:00
co-authored by Claude Sonnet 5.5
parent 286c2538ef
commit ea657e3eb5
+6 -1
View File
@@ -81,6 +81,11 @@ pub use prefill::{
OriginalMtpRetainedScalarWeights, OriginalMtpScalarPolicy, OriginalMtpScalarPrefill,
OriginalMtpStepOutput,
};
/// `LELEKA_MTP_SNAPSHOT_MEMO=off`: scan every page of a snapshot on each `validate_snapshot` (the earlier behaviour; the A/B control).
fn snapshot_memo() -> bool {
static ON: std::sync::OnceLock<bool> = std::sync::OnceLock::new();
*ON.get_or_init(|| !std::env::var("LELEKA_MTP_SNAPSHOT_MEMO").is_ok_and(|v| v == "off" || v == "0"))
}
struct Page {
runs: [Box<[u8]>; 4],
}
@@ -774,7 +779,7 @@ impl<'ctx> MtpOriginalInt8<'ctx> {
{
return Err(Error::InvalidQwenShape);
}
if s.0.checked.get() {
if s.0.checked.get() && snapshot_memo() {
return Ok(());
}
for p in s.0.pages.iter().take(s.0.end.div_ceil(4)) {