diff --git a/crates/deploy/src/profile.rs b/crates/deploy/src/profile.rs index c05e1692..3b334df0 100644 --- a/crates/deploy/src/profile.rs +++ b/crates/deploy/src/profile.rs @@ -671,6 +671,7 @@ mod tests { // the engine switches are the server's plus the page-cache form of the PLE reader let mut expected = server.engine_env.clone(); expected.insert("LELEKA_PLE_DIRECT".into(), "0".into()); + expected.insert("LELEKA_ORIGINAL_SERVE_GGUF_PLE".into(), "1".into()); assert_eq!(ggufp.engine_env, expected); // experimental: never auto-selected assert!(!ggufp.matches(&gpu("NVIDIA GeForce RTX 5090", 120, 32607))); diff --git a/crates/leleka-runtime/src/backend.rs b/crates/leleka-runtime/src/backend.rs index 1d8986d3..735e2783 100644 --- a/crates/leleka-runtime/src/backend.rs +++ b/crates/leleka-runtime/src/backend.rs @@ -364,6 +364,7 @@ pub fn original_serve_choice( kar_staged: config.kar_ple_source.is_some(), mtp: config.mtp_source.is_some(), kar_expert: config.kar_expert_source.is_some(), + gguf_ple: std::env::var("LELEKA_ORIGINAL_SERVE_GGUF_PLE").is_ok_and(|v| v == "1"), experimental: !config.experimental.is_off(), context_tokens: config.context_tokens, }; diff --git a/crates/leleka-runtime/src/backend_original_serve.rs b/crates/leleka-runtime/src/backend_original_serve.rs index 427034fd..69a2b1ad 100644 --- a/crates/leleka-runtime/src/backend_original_serve.rs +++ b/crates/leleka-runtime/src/backend_original_serve.rs @@ -207,6 +207,9 @@ pub(super) struct ConfigFacts { pub(super) kar_staged: bool, pub(super) mtp: bool, pub(super) kar_expert: bool, + /// EXPERIMENTAL (`LELEKA_ORIGINAL_SERVE_GGUF_PLE=1`, profile `rtx5090-32g-gguf-ple`): the Original path may run without any KAR archive, the PLE rows + /// coming from the GGUF shard (`qwen4exp-native-mtp-v1`). Off by default; a KAR load without an archive is still refused at Load. + pub(super) gguf_ple: bool, /// Any experimental mode (`NativeBackendConfig::experimental`) is enabled. pub(super) experimental: bool, pub(super) context_tokens: u32, @@ -222,7 +225,7 @@ fn ineligible(facts: &ConfigFacts) -> Option<&'static str> { if facts.experimental { return Some("an experimental mode is configured and the Original path does not consume it"); } - if !facts.kar_inherited || facts.kar_staged { + if facts.kar_staged || (!facts.kar_inherited && !facts.gguf_ple) { return Some("the Original path needs the inherited sealed KAR archive (no staged KAR source)"); } if !facts.mtp { @@ -1027,7 +1030,7 @@ mod tests { use super::*; fn facts() -> ConfigFacts { - ConfigFacts { kar_inherited: true, kar_staged: false, mtp: true, kar_expert: false, experimental: false, context_tokens: 32768 } + ConfigFacts { kar_inherited: true, kar_staged: false, mtp: true, kar_expert: false, gguf_ple: false, experimental: false, context_tokens: 32768 } } #[test] @@ -1046,6 +1049,18 @@ mod tests { panic!("an unsealed build must stay on the preview path"); }; assert!(reason.contains("router") && reason.contains("head"), "{reason}"); + // the experimental GGUF-PLE opt-in lets the Original path start without an archive, and only that + let gguf = ConfigFacts { kar_inherited: false, gguf_ple: true, ..facts() }; + assert_eq!(choose(OriginalServeMode::Auto, &gguf, &[]).unwrap(), OriginalServeChoice::Original); + assert_eq!(choose(OriginalServeMode::Original, &gguf, &[]).unwrap(), OriginalServeChoice::Original); + assert!(matches!( + choose(OriginalServeMode::Auto, &ConfigFacts { kar_staged: true, ..gguf }, &[]).unwrap(), + OriginalServeChoice::Preview { .. } + )); + assert!(matches!( + choose(OriginalServeMode::Auto, &ConfigFacts { mtp: false, ..gguf }, &[]).unwrap(), + OriginalServeChoice::Preview { .. } + )); for broken in [ ConfigFacts { kar_inherited: false, ..facts() }, ConfigFacts { kar_staged: true, ..facts() }, diff --git a/deploy/rust-runtime/profiles/rtx5090-32g-gguf-ple.json b/deploy/rust-runtime/profiles/rtx5090-32g-gguf-ple.json index 447726d7..537e23d1 100644 --- a/deploy/rust-runtime/profiles/rtx5090-32g-gguf-ple.json +++ b/deploy/rust-runtime/profiles/rtx5090-32g-gguf-ple.json @@ -13,6 +13,6 @@ "min_vram_total_mib": 30000, "min_ram_total_bytes": 68719476736, "min_ram_available_bytes": 62000000000, - "engine_env": {"LELEKA_ORIGINAL_SERVE_EXPERT_PER_LAYER": "yes", "LELEKA_CHAIN": "all", "LELEKA_ORIGINAL_SERVE_SEED": "off", "LELEKA_SM120_ATTN_DAILY_MTP": "1", "LELEKA_PLE_DIRECT": "0"}, + "engine_env": {"LELEKA_ORIGINAL_SERVE_EXPERT_PER_LAYER": "yes", "LELEKA_CHAIN": "all", "LELEKA_ORIGINAL_SERVE_SEED": "off", "LELEKA_SM120_ATTN_DAILY_MTP": "1", "LELEKA_PLE_DIRECT": "0", "LELEKA_ORIGINAL_SERVE_GGUF_PLE": "1"}, "memory": {"prefix_cache_mib": "6144", "prefix_cache_tail": "reply", "prefix_cache_block": 8192, "soft_floor_mib": 4096, "hard_floor_mib": 2048, "reserve_mib": 2048, "lock": "off", "heal": false} } diff --git a/scripts/e2e/kar-off/kar_off_install.sh b/scripts/e2e/kar-off/kar_off_install.sh index c2f2379a..f192d841 100644 --- a/scripts/e2e/kar-off/kar_off_install.sh +++ b/scripts/e2e/kar-off/kar_off_install.sh @@ -1,10 +1,11 @@ #!/usr/bin/env bash -# Install the KAR on / off tools on the server (run ON the server): kar_off_install.sh LELEKA_BINARY SCRIPTS_DIR +# Install the KAR on / off tools on the server (run ON the server): kar_off_install.sh LELEKA_BINARY SCRIPTS_DIR [LELEKA_INFERENCE_BINARY] # LELEKA_BINARY the `leleka` built from the kar_source=none commit (Linux x86_64) SCRIPTS_DIR scripts/e2e/kar-off copied to the server +# LELEKA_INFERENCE_BINARY the engine built from the same commit (the GGUF-PLE opt-in LELEKA_ORIGINAL_SERVE_GGUF_PLE); both arms then run this engine # Creates /data/leleka-e2e/kar-off-ab/{tools,pkg,inputs.sha256,INSTALL.sha256,pkg.sha256}. The package is the release 17e3729 binaries (hard links, no copy) with `leleka` replaced; nothing under # codex-compare/ or spd-gap/ is changed. Frozen measurement inputs (tools + the recorded requests of the two cells) are listed with their sha256. set -euo pipefail -BIN=${1:?leleka binary}; SRC=${2:?scripts dir} +BIN=${1:?leleka binary}; SRC=${2:?scripts dir}; ENG=${3:-} K=/data/leleka-e2e/kar-off-ab; CMP=/data/leleka-e2e/codex-compare mkdir -p "$K/tools" "$K/pkg/bin" "$K/runs" chmod u+w "$K"/tools/* "$K"/pkg/bin/leleka "$K"/*.sha256 2>/dev/null || true @@ -13,11 +14,13 @@ install -m 0555 /data/leleka-e2e/spd-gap/tools/replay_fwd.py "$K/tools/replay_fw OURS=$CMP/ours-pkg for b in leleka-cli leleka-daemon leleka-inference leleka-seal-exec strata-next; do ln -f "$OURS/bin/$b" "$K/pkg/bin/$b" 2>/dev/null || cp -p "$OURS/bin/$b" "$K/pkg/bin/$b"; done install -m 0555 "$BIN" "$K/pkg/bin/leleka" -python3 -I - "$OURS/MANIFEST.json" "$K/pkg/MANIFEST.json" "$K/pkg/bin/leleka" <<'PY' +[ -n "$ENG" ] && install -m 0555 "$ENG" "$K/pkg/bin/leleka-inference" +python3 -I - "$OURS/MANIFEST.json" "$K/pkg/MANIFEST.json" "$K/pkg/bin" <<'PY' import hashlib, json, sys m = json.load(open(sys.argv[1])) -m["binaries"]["leleka"] = hashlib.sha256(open(sys.argv[3], "rb").read()).hexdigest() -m["kar_off_ab_note"] = "`leleka` rebuilt from the kar_source=none commit (docs/experiments/kar-off-ab-5090.md); every other binary is the release 17e3729 one" +for b in ("leleka", "leleka-inference"): + m["binaries"][b] = hashlib.sha256(open(sys.argv[3] + "/" + b, "rb").read()).hexdigest() +m["kar_off_ab_note"] = "`leleka` and `leleka-inference` rebuilt from the kar_source=none commits (docs/experiments/kar-off-ab-5090.md); the other binaries are the release 17e3729 ones" json.dump(m, open(sys.argv[2], "w"), indent=2) PY ( cd "$K/pkg" && sha256sum bin/* MANIFEST.json > ../pkg.sha256 ) diff --git a/scripts/e2e/kar-off/kar_off_speed.py b/scripts/e2e/kar-off/kar_off_speed.py index 1f0382e3..52b21075 100644 --- a/scripts/e2e/kar-off/kar_off_speed.py +++ b/scripts/e2e/kar-off/kar_off_speed.py @@ -71,6 +71,8 @@ def main(): ap.add_argument("--md") ap.add_argument("--json") a = ap.parse_args() + if hasattr(sys.stdout, "reconfigure"): + sys.stdout.reconfigure(encoding="utf-8") runs = {} for d in sorted(glob.glob(os.path.join(a.run_dir, "*-p[0-9]*"))): m = re.match(r"(kar|gguf)-p(\d+)$", os.path.basename(d)) @@ -104,7 +106,7 @@ def main(): text = "\n".join(lines) + "\n" print(text) if a.md: - open(a.md, "w").write(text) + open(a.md, "w", encoding="utf-8").write(text) if a.json: json.dump({"runs": {f"{k[0]}-p{k[1]}": v for k, v in runs.items()}, "summary": summary}, open(a.json, "w"), indent=1) return 0