From b66ed637ffe997fa7645deb649250dc599f3cb46 Mon Sep 17 00:00:00 2001 From: Pavlo Ratushnyi Date: Sat, 14 Nov 2026 20:19:50 +0100 Subject: [PATCH 01/10] engine-qwen35-cuda: the GPU proofs use leleka-gateway-text instead of compiling its prompt.rs as a module; 23 more #[path] modules become ordinary; orphan renderer copy to garbage rust_modtree.py: a cfg(feature = "preview-path") attribute was taken for a #[path] attribute (two modules were invisible to the tools). path_to_modules.py keeps a file that two parents declare (native_down_pair_io.rs, one copy of the state each). Co-Authored-By: Claude Sonnet 5.5 --- Cargo.lock | 1 + crates/engine-qwen35-cuda/Cargo.toml | 2 + crates/engine-qwen35-cuda/src/backend.rs | 9 - .../combined_changed_boundary_proof.rs | 1 - .../combined_changed_boundary_proof/rig.rs | 0 .../combined_prefix_numeric.rs | 0 .../combined_prefix_numeric_sdet.rs | 0 .../layer0_native_mmq_proof.rs | 0 .../native_down_candidate_only.rs | 12 +- .../adaptive_slots.rs} | 4 +- .../adaptive_slots}/cleanup.rs | 0 .../adaptive_slots}/observe.rs | 0 .../fivecase_frames.rs | 2 +- .../fivecase_runtime.rs | 2 +- .../native_down_candidate_only/pair_arm.rs} | 0 .../pair_checks.rs} | 0 .../native_down_candidate_only/pair_owner.rs} | 2 +- .../pair_proofs.rs} | 0 .../native_down_candidate_only/pair_run.rs} | 0 .../native_down_pair_io.rs | 0 .../native_down_public_pair.rs | 7 +- .../long_public_preflight.rs} | 6 +- .../native_down_public_pair/pair_arm.rs} | 0 .../native_down_public_pair/pair_run.rs} | 2 +- .../native_resident_mmq_model_proof.rs | 0 .../resident_mmq_model_proof.rs | 0 .../singleload_proof.rs | 0 .../long_public_preflight/public_renderer.rs | 355 ------------------ scripts/dev/drop_allow_unused.py | 150 ++++++++ scripts/dev/path_to_modules.py | 7 +- scripts/dev/rust_modtree.py | 2 +- scripts/dev/unglob_by_errors.py | 247 ++++++++++++ 32 files changed, 415 insertions(+), 396 deletions(-) rename crates/engine-qwen35-cuda/src/{gpu_proofs => backend}/combined_changed_boundary_proof.rs (98%) rename crates/engine-qwen35-cuda/src/{gpu_proofs => backend}/combined_changed_boundary_proof/rig.rs (100%) rename crates/engine-qwen35-cuda/src/{gpu_proofs => backend}/combined_prefix_numeric.rs (100%) rename crates/engine-qwen35-cuda/src/{gpu_proofs => backend}/combined_prefix_numeric_sdet.rs (100%) rename crates/engine-qwen35-cuda/src/{gpu_proofs => backend}/layer0_native_mmq_proof.rs (100%) rename crates/engine-qwen35-cuda/src/{gpu_proofs => backend}/native_down_candidate_only.rs (90%) rename crates/engine-qwen35-cuda/src/{gpu_proofs/native_down_adaptive_candidate_only.rs => backend/native_down_candidate_only/adaptive_slots.rs} (98%) rename crates/engine-qwen35-cuda/src/{gpu_proofs/native_down_adaptive_candidate_only => backend/native_down_candidate_only/adaptive_slots}/cleanup.rs (100%) rename crates/engine-qwen35-cuda/src/{gpu_proofs/native_down_adaptive_candidate_only => backend/native_down_candidate_only/adaptive_slots}/observe.rs (100%) rename crates/engine-qwen35-cuda/src/{gpu_proofs => backend/native_down_candidate_only}/fivecase_frames.rs (98%) rename crates/engine-qwen35-cuda/src/{gpu_proofs => backend/native_down_candidate_only}/fivecase_runtime.rs (99%) rename crates/engine-qwen35-cuda/src/{gpu_proofs/native_down_pair_arm.rs => backend/native_down_candidate_only/pair_arm.rs} (100%) rename crates/engine-qwen35-cuda/src/{gpu_proofs/native_down_pair_checks.rs => backend/native_down_candidate_only/pair_checks.rs} (100%) rename crates/engine-qwen35-cuda/src/{gpu_proofs/native_down_pair_owner.rs => backend/native_down_candidate_only/pair_owner.rs} (99%) rename crates/engine-qwen35-cuda/src/{gpu_proofs/native_down_pair_proofs.rs => backend/native_down_candidate_only/pair_proofs.rs} (100%) rename crates/engine-qwen35-cuda/src/{gpu_proofs/native_down_pair_run.rs => backend/native_down_candidate_only/pair_run.rs} (100%) rename crates/engine-qwen35-cuda/src/{gpu_proofs => backend}/native_down_pair_io.rs (100%) rename crates/engine-qwen35-cuda/src/{gpu_proofs => backend}/native_down_public_pair.rs (78%) rename crates/engine-qwen35-cuda/src/{gpu_proofs/long_public_preflight/long_public_request.rs => backend/native_down_public_pair/long_public_preflight.rs} (98%) rename crates/engine-qwen35-cuda/src/{gpu_proofs/native_down_public_pair_arm.rs => backend/native_down_public_pair/pair_arm.rs} (100%) rename crates/engine-qwen35-cuda/src/{gpu_proofs/native_down_public_pair_run.rs => backend/native_down_public_pair/pair_run.rs} (99%) rename crates/engine-qwen35-cuda/src/{gpu_proofs => backend}/native_resident_mmq_model_proof.rs (100%) rename crates/engine-qwen35-cuda/src/{gpu_proofs => backend}/resident_mmq_model_proof.rs (100%) rename crates/engine-qwen35-cuda/src/{gpu_proofs => backend}/singleload_proof.rs (100%) delete mode 100644 crates/engine-qwen35-cuda/src/gpu_proofs/long_public_preflight/public_renderer.rs create mode 100644 scripts/dev/drop_allow_unused.py create mode 100644 scripts/dev/unglob_by_errors.py diff --git a/Cargo.lock b/Cargo.lock index f9a785eb..bc2f898a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1350,6 +1350,7 @@ dependencies = [ "leleka-cuda-driver", "leleka-engine-core", "leleka-experimental-ref", + "leleka-gateway-text", "leleka-memory", "leleka-memory-os", "leleka-model-format", diff --git a/crates/engine-qwen35-cuda/Cargo.toml b/crates/engine-qwen35-cuda/Cargo.toml index f9b23eba..fd53aa05 100644 --- a/crates/engine-qwen35-cuda/Cargo.toml +++ b/crates/engine-qwen35-cuda/Cargo.toml @@ -46,5 +46,7 @@ workspace = true [dev-dependencies] serde_json = "1" leleka-engine-core = { path = "../engine-core", features = ["testing"] } +# The GPU proofs render prompts with the gateway renderer itself (they used to compile its source file as a module). +leleka-gateway-text = { path = "../gateway-text" } # Model-free device probe of the VRAM expert tier (test builds only). leleka-cuda-driver = { path = "../cuda-driver", features = ["cuda-driver", "expert-tier-probe"] } diff --git a/crates/engine-qwen35-cuda/src/backend.rs b/crates/engine-qwen35-cuda/src/backend.rs index 5494c795..c2deffa2 100644 --- a/crates/engine-qwen35-cuda/src/backend.rs +++ b/crates/engine-qwen35-cuda/src/backend.rs @@ -157,11 +157,9 @@ mod backend_measurement_sdet; #[cfg(feature = "preview-path")] #[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -#[path = "gpu_proofs/combined_prefix_numeric.rs"] mod combined_prefix_numeric; #[cfg(feature = "preview-path")] #[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -#[path = "gpu_proofs/combined_prefix_numeric_sdet.rs"] mod combined_prefix_numeric_sdet; #[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] mod original_serve_arms; @@ -179,37 +177,30 @@ mod original_serve_smoke; mod original_serve_ttft; #[cfg(feature = "preview-path")] #[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -#[path = "gpu_proofs/singleload_proof.rs"] mod singleload_proof; #[cfg(feature = "preview-path")] #[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -#[path = "gpu_proofs/resident_mmq_model_proof.rs"] mod resident_mmq_model_proof; #[cfg(feature = "preview-path")] #[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -#[path = "gpu_proofs/native_resident_mmq_model_proof.rs"] mod native_resident_mmq_model_proof; #[cfg(feature = "preview-path")] #[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -#[path = "gpu_proofs/layer0_native_mmq_proof.rs"] mod layer0_native_mmq_proof; #[cfg(feature = "preview-path")] #[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -#[path = "gpu_proofs/combined_changed_boundary_proof.rs"] mod combined_changed_boundary_proof; #[cfg(feature = "preview-path")] #[cfg(all(test, target_os = "linux", target_arch = "x86_64"))] -#[path = "gpu_proofs/native_down_public_pair.rs"] mod native_down_public_pair; #[cfg(feature = "preview-path")] #[cfg(all(test, target_os = "linux", target_arch = "x86_64"))] -#[path = "gpu_proofs/native_down_candidate_only.rs"] mod native_down_candidate_only; #[cfg(test)] diff --git a/crates/engine-qwen35-cuda/src/gpu_proofs/combined_changed_boundary_proof.rs b/crates/engine-qwen35-cuda/src/backend/combined_changed_boundary_proof.rs similarity index 98% rename from crates/engine-qwen35-cuda/src/gpu_proofs/combined_changed_boundary_proof.rs rename to crates/engine-qwen35-cuda/src/backend/combined_changed_boundary_proof.rs index 7dbff742..7a40b905 100644 --- a/crates/engine-qwen35-cuda/src/gpu_proofs/combined_changed_boundary_proof.rs +++ b/crates/engine-qwen35-cuda/src/backend/combined_changed_boundary_proof.rs @@ -2,7 +2,6 @@ use super::*; use crate::qwen_forward::loaded_target_owners::LoadedTargetOwners as LoadedTarget; use std::env; -#[path = "combined_changed_boundary_proof/rig.rs"] pub(super) mod rig; use rig::{DEVICE_BUDGET, Owners, bind_pinned, require_opt_in, unwrap_phase}; diff --git a/crates/engine-qwen35-cuda/src/gpu_proofs/combined_changed_boundary_proof/rig.rs b/crates/engine-qwen35-cuda/src/backend/combined_changed_boundary_proof/rig.rs similarity index 100% rename from crates/engine-qwen35-cuda/src/gpu_proofs/combined_changed_boundary_proof/rig.rs rename to crates/engine-qwen35-cuda/src/backend/combined_changed_boundary_proof/rig.rs diff --git a/crates/engine-qwen35-cuda/src/gpu_proofs/combined_prefix_numeric.rs b/crates/engine-qwen35-cuda/src/backend/combined_prefix_numeric.rs similarity index 100% rename from crates/engine-qwen35-cuda/src/gpu_proofs/combined_prefix_numeric.rs rename to crates/engine-qwen35-cuda/src/backend/combined_prefix_numeric.rs diff --git a/crates/engine-qwen35-cuda/src/gpu_proofs/combined_prefix_numeric_sdet.rs b/crates/engine-qwen35-cuda/src/backend/combined_prefix_numeric_sdet.rs similarity index 100% rename from crates/engine-qwen35-cuda/src/gpu_proofs/combined_prefix_numeric_sdet.rs rename to crates/engine-qwen35-cuda/src/backend/combined_prefix_numeric_sdet.rs diff --git a/crates/engine-qwen35-cuda/src/gpu_proofs/layer0_native_mmq_proof.rs b/crates/engine-qwen35-cuda/src/backend/layer0_native_mmq_proof.rs similarity index 100% rename from crates/engine-qwen35-cuda/src/gpu_proofs/layer0_native_mmq_proof.rs rename to crates/engine-qwen35-cuda/src/backend/layer0_native_mmq_proof.rs diff --git a/crates/engine-qwen35-cuda/src/gpu_proofs/native_down_candidate_only.rs b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only.rs similarity index 90% rename from crates/engine-qwen35-cuda/src/gpu_proofs/native_down_candidate_only.rs rename to crates/engine-qwen35-cuda/src/backend/native_down_candidate_only.rs index 9e04ab32..68134a23 100644 --- a/crates/engine-qwen35-cuda/src/gpu_proofs/native_down_candidate_only.rs +++ b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only.rs @@ -10,29 +10,22 @@ use std::{ panic::{AssertUnwindSafe, catch_unwind, resume_unwind}, }; // EXACT existing daemon pure renderer, Effort::None. No hand-built ChatML. -#[path = "../../../../crates/gateway-text/src/prompt.rs"] -#[allow(dead_code)] -mod public_renderer; +use leleka_gateway_text::prompt as public_renderer; // Files, request framing and counters shared with the one-load pair (native_down_public_pair.rs). #[path = "native_down_pair_io.rs"] mod pair_io; use pair_io::*; // The retained completed Native arm and the checks of the MTP window witnesses. -#[path = "native_down_pair_checks.rs"] mod pair_checks; use pair_checks::*; // One actual owner generation on a fresh target/draft state. -#[path = "native_down_pair_arm.rs"] mod pair_arm; use pair_arm::*; // The one loaded owner, its ordered teardown and the run of a proof on it. -#[path = "native_down_pair_owner.rs"] mod pair_owner; use pair_owner::*; -#[path = "native_down_pair_run.rs"] mod pair_run; use pair_run::*; -#[path = "native_down_pair_proofs.rs"] mod pair_proofs; use pair_proofs::*; #[test] @@ -90,7 +83,6 @@ fn pinned_five_public_cases_resident_owners() { } // Private framing only; Root owns the unchanged five-case consumer/caller. -#[path = "fivecase_frames.rs"] mod fivecase_frames; impl Inputs<'_, '_, '_> { fn prepare_five_public_frames(&self) -> (PathBuf, String) { @@ -99,7 +91,6 @@ impl Inputs<'_, '_, '_> { } // Private loaded-owner helper; Root supplies sealed genuine tokenizer frames. -#[path = "fivecase_runtime.rs"] mod fivecase_runtime; impl Inputs<'_, '_, '_> { fn arm_five_public_cases( @@ -111,5 +102,4 @@ impl Inputs<'_, '_, '_> { } } -#[path = "native_down_adaptive_candidate_only.rs"] mod adaptive_slots; diff --git a/crates/engine-qwen35-cuda/src/gpu_proofs/native_down_adaptive_candidate_only.rs b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/adaptive_slots.rs similarity index 98% rename from crates/engine-qwen35-cuda/src/gpu_proofs/native_down_adaptive_candidate_only.rs rename to crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/adaptive_slots.rs index f11117c5..2f954f2b 100644 --- a/crates/engine-qwen35-cuda/src/gpu_proofs/native_down_adaptive_candidate_only.rs +++ b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/adaptive_slots.rs @@ -5,10 +5,8 @@ use super::*; use leleka_model_format::qwen4exp::{ProvisionalExpertSource, ResidentExpertSourceReport}; use std::path::Path; -#[path = "native_down_adaptive_candidate_only/observe.rs"] mod observe; use observe::*; -#[path = "native_down_adaptive_candidate_only/cleanup.rs"] mod cleanup; use cleanup::*; @@ -30,7 +28,7 @@ fn save_public_admission(root: &Path, baseline: &Baseline, tokenizer: &Tokenizer let (req, ids, canonical) = request(tokenizer); assert_eq!(ids, baseline.input_ids); assert_eq!(ids.len(), 202); - let renderer = sha(include_bytes!("../../../../crates/gateway-text/src/prompt.rs")); + let renderer = sha(include_bytes!("../../../../gateway-text/src/prompt.rs")); save( root, "BASELINE-ADMISSION.json", diff --git a/crates/engine-qwen35-cuda/src/gpu_proofs/native_down_adaptive_candidate_only/cleanup.rs b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/adaptive_slots/cleanup.rs similarity index 100% rename from crates/engine-qwen35-cuda/src/gpu_proofs/native_down_adaptive_candidate_only/cleanup.rs rename to crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/adaptive_slots/cleanup.rs diff --git a/crates/engine-qwen35-cuda/src/gpu_proofs/native_down_adaptive_candidate_only/observe.rs b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/adaptive_slots/observe.rs similarity index 100% rename from crates/engine-qwen35-cuda/src/gpu_proofs/native_down_adaptive_candidate_only/observe.rs rename to crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/adaptive_slots/observe.rs diff --git a/crates/engine-qwen35-cuda/src/gpu_proofs/fivecase_frames.rs b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/fivecase_frames.rs similarity index 98% rename from crates/engine-qwen35-cuda/src/gpu_proofs/fivecase_frames.rs rename to crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/fivecase_frames.rs index 1c44a9a4..3cb28b56 100644 --- a/crates/engine-qwen35-cuda/src/gpu_proofs/fivecase_frames.rs +++ b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/fivecase_frames.rs @@ -142,7 +142,7 @@ fn write_frame( pub(super) fn prepare(inputs: &Inputs<'_, '_, '_>) -> (PathBuf, String) { let (root, uid) = fresh_frames_root(); let requests = build_requests(inputs); - let renderer = sha(include_bytes!("../../../../crates/gateway-text/src/prompt.rs")); + let renderer = sha(include_bytes!("../../../../gateway-text/src/prompt.rs")); check_requests(&requests); let entries: Vec = requests .iter() diff --git a/crates/engine-qwen35-cuda/src/gpu_proofs/fivecase_runtime.rs b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/fivecase_runtime.rs similarity index 99% rename from crates/engine-qwen35-cuda/src/gpu_proofs/fivecase_runtime.rs rename to crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/fivecase_runtime.rs index 87464cf6..5211d602 100644 --- a/crates/engine-qwen35-cuda/src/gpu_proofs/fivecase_runtime.rs +++ b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/fivecase_runtime.rs @@ -94,7 +94,7 @@ fn admit_manifest_header(manifest: &Value) -> String { assert_eq!(number(manifest, "case_count"), CASE_COUNT as u64); assert_eq!(text(manifest, "baseline_frame_sha256"), BASE_FRAME_SHA); assert_eq!(text(manifest, "model_digest"), MODEL_DIGEST); - let renderer = sha(include_bytes!("../../../../crates/gateway-text/src/prompt.rs")); + let renderer = sha(include_bytes!("../../../../gateway-text/src/prompt.rs")); assert_eq!(text(manifest, "renderer_source_sha256"), renderer); renderer } diff --git a/crates/engine-qwen35-cuda/src/gpu_proofs/native_down_pair_arm.rs b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_arm.rs similarity index 100% rename from crates/engine-qwen35-cuda/src/gpu_proofs/native_down_pair_arm.rs rename to crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_arm.rs diff --git a/crates/engine-qwen35-cuda/src/gpu_proofs/native_down_pair_checks.rs b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_checks.rs similarity index 100% rename from crates/engine-qwen35-cuda/src/gpu_proofs/native_down_pair_checks.rs rename to crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_checks.rs diff --git a/crates/engine-qwen35-cuda/src/gpu_proofs/native_down_pair_owner.rs b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_owner.rs similarity index 99% rename from crates/engine-qwen35-cuda/src/gpu_proofs/native_down_pair_owner.rs rename to crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_owner.rs index 7b4a072c..66a7dc9f 100644 --- a/crates/engine-qwen35-cuda/src/gpu_proofs/native_down_pair_owner.rs +++ b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_owner.rs @@ -105,7 +105,7 @@ fn pinned_tokenizer(artifact: &Qwen4ExpArtifact) -> (Tokenizer, u32) { (tokenizer, eos) } fn renderer_sha() -> String { - sha(include_bytes!("../../../../crates/gateway-text/src/prompt.rs")) + sha(include_bytes!("../../../../gateway-text/src/prompt.rs")) } fn baseline_admission_json() -> Value { json!({"baseline_sha256":BASELINE_SHA,"retained_run":"24993ad2-9c7c-4a90-bfac-3e6e0b5685c1", diff --git a/crates/engine-qwen35-cuda/src/gpu_proofs/native_down_pair_proofs.rs b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_proofs.rs similarity index 100% rename from crates/engine-qwen35-cuda/src/gpu_proofs/native_down_pair_proofs.rs rename to crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_proofs.rs diff --git a/crates/engine-qwen35-cuda/src/gpu_proofs/native_down_pair_run.rs b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_run.rs similarity index 100% rename from crates/engine-qwen35-cuda/src/gpu_proofs/native_down_pair_run.rs rename to crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_run.rs diff --git a/crates/engine-qwen35-cuda/src/gpu_proofs/native_down_pair_io.rs b/crates/engine-qwen35-cuda/src/backend/native_down_pair_io.rs similarity index 100% rename from crates/engine-qwen35-cuda/src/gpu_proofs/native_down_pair_io.rs rename to crates/engine-qwen35-cuda/src/backend/native_down_pair_io.rs diff --git a/crates/engine-qwen35-cuda/src/gpu_proofs/native_down_public_pair.rs b/crates/engine-qwen35-cuda/src/backend/native_down_public_pair.rs similarity index 78% rename from crates/engine-qwen35-cuda/src/gpu_proofs/native_down_public_pair.rs rename to crates/engine-qwen35-cuda/src/backend/native_down_public_pair.rs index 6207a32d..fbe75e3e 100644 --- a/crates/engine-qwen35-cuda/src/gpu_proofs/native_down_public_pair.rs +++ b/crates/engine-qwen35-cuda/src/backend/native_down_public_pair.rs @@ -9,20 +9,15 @@ use std::{ panic::{AssertUnwindSafe, catch_unwind, resume_unwind}, }; // EXACT existing daemon pure renderer, Effort::None. No hand-built ChatML. -#[path = "long_public_preflight/long_public_request.rs"] mod long_public_preflight; -#[path = "../../../../crates/gateway-text/src/prompt.rs"] -#[allow(dead_code)] -mod public_renderer; +use leleka_gateway_text::prompt as public_renderer; // Files, request framing and counters shared with the candidate-only proofs (native_down_candidate_only.rs). #[path = "native_down_pair_io.rs"] mod pair_io; use pair_io::*; // One actual owner generation, and the run of the pair on the one loaded owner. -#[path = "native_down_public_pair_arm.rs"] mod pair_arm; use pair_arm::*; -#[path = "native_down_public_pair_run.rs"] mod pair_run; #[test] diff --git a/crates/engine-qwen35-cuda/src/gpu_proofs/long_public_preflight/long_public_request.rs b/crates/engine-qwen35-cuda/src/backend/native_down_public_pair/long_public_preflight.rs similarity index 98% rename from crates/engine-qwen35-cuda/src/gpu_proofs/long_public_preflight/long_public_request.rs rename to crates/engine-qwen35-cuda/src/backend/native_down_public_pair/long_public_preflight.rs index 1943880d..eb3e3e64 100644 --- a/crates/engine-qwen35-cuda/src/gpu_proofs/long_public_preflight/long_public_request.rs +++ b/crates/engine-qwen35-cuda/src/backend/native_down_public_pair/long_public_preflight.rs @@ -9,9 +9,7 @@ use std::{ os::unix::fs::OpenOptionsExt, path::Path, }; -#[path = "../../../../../crates/gateway-text/src/prompt.rs"] -#[allow(dead_code)] -mod public_renderer; +use leleka_gateway_text::prompt as public_renderer; const BYTE_CAP: usize = 1024 * 1024; const ARTIFACT_CAP: usize = 16 * 1024 * 1024; const CONTEXT: usize = 262144; @@ -176,7 +174,7 @@ fn push_frame_summary( bound_model_digest: &str, artifacts: &mut Vec, ) -> io::Result { - let renderer = digest(include_bytes!("../../../../../crates/gateway-text/src/prompt.rs")); + let renderer = digest(include_bytes!("../../../../gateway-text/src/prompt.rs")); let frame = json!({ "schema":"public-long-preflight-v1","model_digest":bound_model_digest, "renderer_source_sha256":renderer, diff --git a/crates/engine-qwen35-cuda/src/gpu_proofs/native_down_public_pair_arm.rs b/crates/engine-qwen35-cuda/src/backend/native_down_public_pair/pair_arm.rs similarity index 100% rename from crates/engine-qwen35-cuda/src/gpu_proofs/native_down_public_pair_arm.rs rename to crates/engine-qwen35-cuda/src/backend/native_down_public_pair/pair_arm.rs diff --git a/crates/engine-qwen35-cuda/src/gpu_proofs/native_down_public_pair_run.rs b/crates/engine-qwen35-cuda/src/backend/native_down_public_pair/pair_run.rs similarity index 99% rename from crates/engine-qwen35-cuda/src/gpu_proofs/native_down_public_pair_run.rs rename to crates/engine-qwen35-cuda/src/backend/native_down_public_pair/pair_run.rs index 64239028..6100c2e5 100644 --- a/crates/engine-qwen35-cuda/src/gpu_proofs/native_down_public_pair_run.rs +++ b/crates/engine-qwen35-cuda/src/backend/native_down_public_pair/pair_run.rs @@ -69,7 +69,7 @@ fn pinned_tokenizer(artifact: &Qwen4ExpArtifact) -> (Tokenizer, u32) { (tokenizer, eos) } fn frame_json(case: &Case) -> Value { - json!({"renderer_source_sha256":sha(include_bytes!("../../../../crates/gateway-text/src/prompt.rs")), + json!({"renderer_source_sha256":sha(include_bytes!("../../../../gateway-text/src/prompt.rs")), "framed_prompt":case.req.prompt,"framed_prompt_sha256":sha(case.req.prompt.as_bytes()), "input_token_ids":case.ids,"framed_count":case.ids.len(),"model_digest":MODEL_DIGEST, "max_output_tokens":CAP,"temperature_milli":0}) diff --git a/crates/engine-qwen35-cuda/src/gpu_proofs/native_resident_mmq_model_proof.rs b/crates/engine-qwen35-cuda/src/backend/native_resident_mmq_model_proof.rs similarity index 100% rename from crates/engine-qwen35-cuda/src/gpu_proofs/native_resident_mmq_model_proof.rs rename to crates/engine-qwen35-cuda/src/backend/native_resident_mmq_model_proof.rs diff --git a/crates/engine-qwen35-cuda/src/gpu_proofs/resident_mmq_model_proof.rs b/crates/engine-qwen35-cuda/src/backend/resident_mmq_model_proof.rs similarity index 100% rename from crates/engine-qwen35-cuda/src/gpu_proofs/resident_mmq_model_proof.rs rename to crates/engine-qwen35-cuda/src/backend/resident_mmq_model_proof.rs diff --git a/crates/engine-qwen35-cuda/src/gpu_proofs/singleload_proof.rs b/crates/engine-qwen35-cuda/src/backend/singleload_proof.rs similarity index 100% rename from crates/engine-qwen35-cuda/src/gpu_proofs/singleload_proof.rs rename to crates/engine-qwen35-cuda/src/backend/singleload_proof.rs diff --git a/crates/engine-qwen35-cuda/src/gpu_proofs/long_public_preflight/public_renderer.rs b/crates/engine-qwen35-cuda/src/gpu_proofs/long_public_preflight/public_renderer.rs deleted file mode 100644 index 24b72b5a..00000000 --- a/crates/engine-qwen35-cuda/src/gpu_proofs/long_public_preflight/public_renderer.rs +++ /dev/null @@ -1,355 +0,0 @@ -//! Supported text subset of the pinned Strata Qwen chat template. -//! The no-tool path and a representative tool continuation are byte-for-byte -//! checked against upstream golden cases. Tool definitions are adapted from -//! Responses function objects. -use serde_json::Value; - -#[derive(Clone, Copy, Debug, PartialEq, Eq)] -pub enum Role { - System, - Developer, - User, - Assistant, -} - -#[derive(Clone, Copy, Debug)] -pub struct Message<'a> { - pub role: Role, - pub content: &'a str, - pub reasoning: Option<&'a str>, -} - -#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] -pub enum Effort { - None, - Low, - Medium, - High, - #[default] - XHigh, -} - -const XHIGH: &str = "Reasoning effort is set to xhigh. Please think carefully through the task, validate key \ - assumptions, consider plausible alternatives, and prioritize correctness, consistency, and clarity in the final \ - answer."; -const LOW: &str = "Reasoning effort is set to low. Keep your thinking brief and focused, moving directly to the \ - conclusion without unnecessary elaboration."; - -pub fn render(messages: &[Message<'_>], effort: Effort) -> Result { - render_with_tools(messages, effort, &[]) -} - -const TOOLS_FOOTER: &str = "\ -\n\n\nIf you choose to call a function ONLY reply in the following format with NO suffix:\n\ -\n\n\n\nvalue_1\n\ -\n\nThis is the value for the second parameter\nthat can \ -span\nmultiple lines\n\n\n\n\n\nReminder:\n- Function \ -calls MUST follow the specified format: an inner block must be nested \ -within XML tags\n- Required parameters MUST be specified\n- You may provide \ -optional reasoning for your function call in natural language BEFORE the function call, but NOT \ -after\n- If there is no function call available, answer the question like normal with your current \ -knowledge and do not tell the user about function calls\n"; - -/// The index of the first message that is not system or developer; those must all come first and a user message -/// must come last. -fn first_non_system(messages: &[Message<'_>]) -> Result { - if messages.is_empty() { - return Err("prompt needs a message"); - } - let first_non_system = messages - .iter() - .position(|message| !matches!(message.role, Role::System | Role::Developer)) - .unwrap_or(messages.len()); - if first_non_system == messages.len() - || messages[first_non_system..] - .iter() - .any(|message| matches!(message.role, Role::System | Role::Developer)) - { - return Err("system and developer messages must be at the beginning"); - } - if messages - .last() - .is_none_or(|message| message.role != Role::User) - { - return Err("generation needs a final user message"); - } - Ok(first_non_system) -} - -/// One tool definition as the template prints it. -fn push_tool(prompt: &mut String, tool: &Value) -> Result<(), &'static str> { - let name = tool - .get("name") - .and_then(Value::as_str) - .ok_or("tool needs a name")?; - prompt.push('\n'); - prompt.push_str("{\"type\": \"function\", \"function\": {\"name\": "); - prompt.push_str(&serde_json::to_string(name).expect("string JSON")); - if let Some(description) = tool.get("description").and_then(Value::as_str) { - prompt.push_str(", \"description\": "); - prompt.push_str(&serde_json::to_string(description).expect("string JSON")); - } - if let Some(parameters) = tool.get("parameters") { - prompt.push_str(", \"parameters\": "); - write_template_json(parameters, prompt); - } - if let Some(strict) = tool.get("strict") { - prompt.push_str(", \"strict\": "); - write_template_json(strict, prompt); - } - prompt.push_str("}}"); - Ok(()) -} - -/// The `# Tools` section of the system block. -fn push_tools(prompt: &mut String, instruction: &str, tools: &[Value]) -> Result<(), &'static str> { - if !instruction.is_empty() { - prompt.push_str("\n\n"); - } - prompt.push_str("# Tools\n\nYou have access to the following functions:\n\n"); - for tool in tools { - push_tool(prompt, tool)?; - } - prompt.push_str(TOOLS_FOOTER); - Ok(()) -} - -/// The system block: effort instruction, tool section and the joined system messages. -fn push_system_block( - prompt: &mut String, - instruction: &str, - system: &str, - tools: &[Value], -) -> Result<(), &'static str> { - if instruction.is_empty() && system.is_empty() && tools.is_empty() { - return Ok(()); - } - prompt.push_str("<|im_start|>system\n"); - prompt.push_str(instruction); - if !tools.is_empty() { - push_tools(prompt, instruction, tools)?; - } - if !system.is_empty() && (!instruction.is_empty() || !tools.is_empty()) { - prompt.push_str("\n\n"); - } - prompt.push_str(system); - prompt.push_str("<|im_end|>\n"); - Ok(()) -} - -/// The user and assistant turns after the system block. -fn push_turns(prompt: &mut String, turns: &[Message<'_>]) { - for message in turns { - match message.role { - Role::User => { - prompt.push_str("<|im_start|>user\n"); - prompt.push_str(message.content.trim()); - prompt.push_str("<|im_end|>\n"); - } - Role::Assistant => { - prompt.push_str("<|im_start|>assistant\n\n"); - prompt.push_str(message.reasoning.unwrap_or("").trim()); - prompt.push_str("\n\n\n"); - prompt.push_str(message.content.trim()); - prompt.push_str("<|im_end|>\n"); - } - Role::System | Role::Developer => unreachable!(), - } - } -} - -pub fn render_with_tools( - messages: &[Message<'_>], - effort: Effort, - tools: &[Value], -) -> Result { - let first_non_system = first_non_system(messages)?; - let system = messages[..first_non_system] - .iter() - .map(|message| message.content.trim()) - .filter(|content| !content.is_empty()) - .collect::>() - .join("\n"); - let instruction = match effort { - Effort::None | Effort::Medium => "", - Effort::Low => LOW, - Effort::High | Effort::XHigh => XHIGH, - }; - let mut prompt = String::new(); - push_system_block(&mut prompt, instruction, &system, tools)?; - push_turns(&mut prompt, &messages[first_non_system..]); - prompt.push_str("<|im_start|>assistant\n\n"); - if effort == Effort::None { - prompt.push_str("\n\n\n"); - } - Ok(prompt) -} - -/// The keys of a JSON-schema-like object in template order: `type` first when the object has one. -fn template_keys(fields: &serde_json::Map) -> Vec<&String> { - let mut keys = fields.keys().collect::>(); - if fields.contains_key("type") { - let priority = |key: &str| match key { - "type" => 0, - "properties" => 1, - "required" => 2, - "items" => 3, - "enum" => 4, - "description" => 5, - "additionalProperties" => 6, - _ => 7, - }; - keys.sort_by_key(|key| (priority(key), key.as_str())); - } - keys -} - -fn write_template_json(value: &Value, output: &mut String) { - match value { - Value::Object(fields) => { - output.push('{'); - for (index, key) in template_keys(fields).into_iter().enumerate() { - if index > 0 { - output.push_str(", "); - } - output.push_str(&serde_json::to_string(key).expect("object key JSON")); - output.push_str(": "); - write_template_json(&fields[key], output); - } - output.push('}'); - } - Value::Array(items) => { - output.push('['); - for (index, item) in items.iter().enumerate() { - if index > 0 { - output.push_str(", "); - } - write_template_json(item, output); - } - output.push(']'); - } - _ => output.push_str(&value.to_string()), - } -} - -#[cfg(test)] -mod tests { - use super::*; - use serde_json::{Value, json}; - - fn golden_cases() -> Vec { - serde_json::from_str(include_str!("../../../engine/strata/serve/chat_golden.json")).unwrap() - } - - fn golden_messages(case: &Value) -> Vec> { - case["messages"] - .as_array() - .unwrap() - .iter() - .map(|message| Message { - role: match message["role"].as_str().unwrap() { - "system" => Role::System, - "developer" => Role::Developer, - "user" => Role::User, - "assistant" => Role::Assistant, - role => panic!("unsupported role: {role}"), - }, - content: message["content"].as_str().unwrap(), - reasoning: message["reasoning_content"].as_str(), - }) - .collect::>() - } - - fn assert_text_case_matches(golden: &[Value], name: &str) { - let case = golden.iter().find(|case| case["name"] == name).unwrap(); - let messages = golden_messages(case); - let effort = if name == "thinking disabled" { - Effort::None - } else { - Effort::XHigh - }; - assert_eq!( - render(&messages, effort).unwrap(), - case["rendered"], - "{name}" - ); - } - - #[test] - fn text_prompt_matches_upstream_golden_bytes() { - let golden = golden_cases(); - for name in [ - "single user", - "system + user", - "multi-turn", - "assistant with thinking", - "unicode content", - "empty user", - "whitespace and newlines", - "thinking disabled", - ] { - assert_text_case_matches(&golden, name); - } - } - - fn weather_messages() -> [Message<'static>; 4] { - [ - Message { - role: Role::User, - content: "Weather in Oslo?", - reasoning: None, - }, - Message { - role: Role::Assistant, - content: "\n\n\nOslo\n\n\ - \n", - reasoning: None, - }, - Message { - role: Role::User, - content: "\n{\"temp\": 3}\n", - reasoning: None, - }, - Message { - role: Role::User, - content: "And in Bergen?", - reasoning: None, - }, - ] - } - - #[test] - fn representative_tool_prompt_matches_upstream_golden_bytes() { - let golden = golden_cases(); - let case = golden - .iter() - .find(|case| case["name"] == "tool call and response") - .unwrap(); - let function = &case["tools"][0]["function"]; - let tools = [json!({ - "type":"function", "name":function["name"], "description":function["description"], - "parameters":function["parameters"] - })]; - let messages = weather_messages(); - assert_eq!( - render_with_tools(&messages, Effort::XHigh, &tools).unwrap(), - case["rendered"] - ); - } - - #[test] - fn rejects_unrepresentable_message_order() { - let system = Message { - role: Role::System, - content: "rules", - reasoning: None, - }; - let user = Message { - role: Role::User, - content: "question", - reasoning: None, - }; - assert!(render(&[user, system], Effort::XHigh).is_err()); - assert!(render(&[system], Effort::XHigh).is_err()); - } -} diff --git a/scripts/dev/drop_allow_unused.py b/scripts/dev/drop_allow_unused.py new file mode 100644 index 00000000..a64d8417 --- /dev/null +++ b/scripts/dev/drop_allow_unused.py @@ -0,0 +1,150 @@ +"""Remove `#[allow(unused_imports)]` and what it hid (STRA-338 stage 10, ratchet `allow-unused-imports`). + +Usage: python scripts/dev/drop_allow_unused.py WORKTREE CRATE_DIR PACKAGE [--keep-test-only] + +The attribute sat on re-exports (`pub use child::name;`) that the splits kept so the old paths still resolve. Without it the compiler +says which of them nobody uses: + + * a name unused in the unit-test build is unused everywhere (that build compiles all code and the tests): it is deleted from its + `use` statement, the statement goes when nothing is left; + * a name used by the test build only is kept as `#[cfg(test)] use ..;` (the statement is split when it names others too). + +One round is `cargo check --lib --bins` and `--tests`; the loop repeats because deleting a re-export can make another one unused. +Offline refactoring aid, not part of the product. +""" +import collections +import json +import pathlib +import re +import sys + +sys.path.insert(0, str(pathlib.Path(__file__).parent)) +import explicit_imports as ei # noqa: E402 +from unglob_by_errors import PLATFORM_FILES # noqa: E402 + +ALLOW = re.compile(r"^[ \t]*#\[allow\(unused_imports\)\][ \t]*\n", re.M) +USE_STATEMENT = re.compile(r"(?ms)^(?P(?:[ \t]*(?:#\[[^\n]*\]|///[^\n]*)\n)*)(?P[ \t]*(?:pub(?:\([^)]*\))?[ \t]+)?use[ \t]+)" + r"(?P[^;]*?);[ \t]*\n") +NL = chr(10) +NAME = re.compile(rf"(?:\bas\s+)?({ei.IDENT})\s*$") + + +def bound(item): + """The name an import item binds (`a::B` -> B, `a::b as c` -> c); None for globs and `as _`.""" + m = NAME.search(item) + return m.group(1) if m and not item.rstrip().endswith("as _") else None + + +def statement_names(body): + """[(name as it is bound, source text of the item)] of `a::b::{c, d as e}` or `a::b::c` (one level of braces).""" + body = body.strip() + brace = body.find("{") + if brace < 0: + return [(bound(body), body)], body, None + prefix, inner = body[:brace], body[brace + 1 : body.rindex("}")] + items = [i.strip() for i in inner.split(",") if i.strip()] + return [(bound(i), i) for i in items], prefix, items + + +def build(attrs, head, prefix, items): + """One `use` statement for `items` below `prefix`, wrapped at 120 columns like rustfmt does.""" + indent = head[: len(head) - len(head.lstrip())] + if len(items) == 1 and not items[0].startswith("self"): + return f"{attrs}{head}{prefix}{items[0]};{NL}" + one = f"{head}{prefix}{{{', '.join(items)}}};" + if len(one) <= 120: + return f"{attrs}{one}{NL}" + lines, cur = [], indent + " " + for item in items: + if len(cur) + len(item) + 1 > 120: + lines.append(cur.rstrip()) + cur = indent + " " + cur += item + ", " + lines.append(cur.rstrip()) + return f"{attrs}{head}{prefix}{{{NL}{NL.join(lines)}{NL}{indent}}};{NL}" + + +def rewrite(text, drop, test_only): + """The text with `drop` names deleted and `test_only` names moved under `#[cfg(test)]`.""" + def fix(m): + if "{" in m.group("body").split("{", 1)[-1]: # nested braces: left for a person + return m.group(0) + names, prefix, items = statement_names(m.group("body")) + gone = [i for n, i in names if n in drop] + moved = [i for n, i in names if n in test_only] + if not gone and not moved: + return m.group(0) + attrs, head = m.group("attrs"), m.group("head") + if items is None: # a single path + return f"{attrs}#[cfg(test)]{NL}{head}{m.group('body').strip()};{NL}" if moved else "" + left = [i for n, i in names if n not in drop and n not in test_only] + out = build(attrs, head, prefix, left) if left else "" + if moved: + out += build("" if left else attrs, head, prefix, moved).replace(head, "#[cfg(test)]" + NL + head, 1) + return out + + return USE_STATEMENT.sub(fix, text) + + +def write(path, text): + with open(path, "w", encoding="utf-8", newline=chr(10)) as handle: + handle.write(text) + + +def flagged_counts(msgs): + """Counter {(file, name): messages} of the unused-import warnings (a name flagged by two units counts twice).""" + counts = collections.Counter() + for m in msgs: + for r, names in ei.flagged([m], "unused").items(): + counts.update((r, n) for n in names) + return counts + + +def classify(counts_a, counts_b): + """({file: names unused everywhere}, {file: names used by the test build only}) from the two builds. + `--tests` builds the library once more as a dependency of the integration tests, so it repeats the first build's + warnings; what it says on top of that comes from the unit-test build.""" + drop, test_only = collections.defaultdict(set), collections.defaultdict(set) + for (r, name), n_a in counts_a.items(): + if counts_b.get((r, name), 0) > n_a: + drop[r].add(name) + else: + test_only[r].add(name) + for (r, name), n_b in counts_b.items(): + if (r, name) not in counts_a: # a file only the test build compiles + drop[r].add(name) + return drop, test_only + + +def main(): + wt, crate_dir, package = sys.argv[1:4] + wtp = pathlib.Path(wt).resolve() + rel = lambda f: f.resolve().relative_to(wtp).as_posix() # noqa: E731 + crate = pathlib.Path(crate_dir).resolve() + files = {f: f.read_text(encoding="utf-8") for f in (crate / "src").rglob("*.rs")} + for f, text in files.items(): + if ALLOW.search(text) and "--keep-allow" not in sys.argv: + files[f] = ALLOW.sub("", text) + write(f, files[f]) + for round_no in range(1, 8): + a = ei.run_cargo(wt, f"-p {package} --lib --bins", "da-a.json") + b = ei.run_cargo(wt, f"-p {package} --tests", "da-b.json") + drop_by_file, test_by_file = classify(flagged_counts(a), flagged_counts(b)) + touched = 0 + by_rel = {rel(f): f for f in files} + for r in set(drop_by_file) | set(test_by_file): + f = by_rel.get(r) + if f is None or r.split("/src/", 1)[-1] in PLATFORM_FILES: # their other-platform code is not built here + continue + new = rewrite(files[f], drop_by_file.get(r, set()), test_by_file.get(r, set())) + if new != files[f]: + files[f] = new + write(f, new) + touched += 1 + print(f"round {round_no}: {touched} files edited", flush=True) + if not touched: + break + + +if __name__ == "__main__": + main() diff --git a/scripts/dev/path_to_modules.py b/scripts/dev/path_to_modules.py index a7c92041..ff581275 100644 --- a/scripts/dev/path_to_modules.py +++ b/scripts/dev/path_to_modules.py @@ -9,6 +9,7 @@ a moved module are moved the same way (their `#[path]` or their place next to th paths of `include_str!`/`include_bytes!` in a moved file are rewritten. Without --apply the plan is printed. Offline refactoring aid, not part of the product. """ +import collections import os import pathlib import re @@ -33,6 +34,7 @@ def canonical_base(new_file, keeps_attr): def plan(crate, every): src = crate.root_dir.resolve() / "src" + declared_by = collections.Counter(child.file for mod in crate.by_file.values() for child in mod.children.values()) """(moves {old file: new file}, dropped [(parent file, module name)], problems [str]).""" moves, dropped, problems = {}, [], [] new_file = {crate.root.file: crate.root.file} @@ -51,7 +53,8 @@ def plan(crate, every): current = child.file is_modrs = current.name == "mod.rs" canonical = base / name / "mod.rs" if is_modrs else base / f"{name}.rs" - if not current.is_relative_to(src): # a file of the crate's `tests/` directory stays where it is + shared = declared_by[current] > 1 # a file two parents declare (each owns a copy of its state) cannot be moved + if shared or not current.is_relative_to(src): # a file of the crate's `tests/` directory stays where it is new_file[current], keeps[current], changed[current] = current, True, False queue.append(child) continue @@ -82,7 +85,7 @@ def rewrite_includes(text, old, new): """Fix the relative path of include_str!/include_bytes! in a file that moves from `old` to `new`.""" def fix(m): target = (old.parent / m.group(2)).resolve() - return f'{m.group(1)}"{pathlib.PurePosixPath(os.path.relpath(target, new.parent)).as_posix()}"' + return f'{m.group(1)}"{os.path.relpath(target, new.parent).replace(os.sep, "/")}"' return re.sub(r'(include_(?:str|bytes)!\()"([^"]+)"', fix, text) diff --git a/scripts/dev/rust_modtree.py b/scripts/dev/rust_modtree.py index f12e3acb..c69c20df 100644 --- a/scripts/dev/rust_modtree.py +++ b/scripts/dev/rust_modtree.py @@ -343,7 +343,7 @@ class Crate: m = re.match(rf"(?:pub(?:\s*\([^)]*\))?\s+)?mod\s+({IDENT})\s*;", t) if m: child_name = m.group(1) - path_attr = next((re.search(r'path\s*=\s*"([^"]+)"', a) for a in attrs if "path" in a), None) + path_attr = next((m for m in (re.match(r'#\[path\s*=\s*"([^"]+)"', a) for a in attrs) if m), None) if path_attr: cand = [(file.parent / path_attr.group(1)).resolve()] else: diff --git a/scripts/dev/unglob_by_errors.py b/scripts/dev/unglob_by_errors.py new file mode 100644 index 00000000..14e694ae --- /dev/null +++ b/scripts/dev/unglob_by_errors.py @@ -0,0 +1,247 @@ +"""Replace `use super::*;` by explicit imports, guided by the compiler's errors (STRA-338 stage 10, `glob-super-import`). + +Usage: python scripts/dev/unglob_by_errors.py WORKTREE CRATE_DIR PACKAGE [--include-tests] [--max-rounds N] + +`explicit_imports.py` expands every glob file at once and gives a file back its glob when the build fails. This driver keeps +the expansion and repairs it from the compiler's messages instead, so the files that tool could not close (GPU proofs, test +modules, names behind an inner cfg) become explicit too: + + * a name the file uses but does not have (`cannot find type/value/function/trait/macro X`, an `enum Result takes 2 generic + arguments` from the prelude instead of the crate alias) is added as `use super::X;`; + * `unresolved import super::X` adds X to the parent's own imports when the parent is also expanded here; + * a trait whose methods are called but is not in scope is added with the path rustc suggests; + * a name that only the test build needs gets `#[cfg(test)]`; a name no build uses is removed. + +Each round is one `cargo check --lib --bins` and one `--tests` (through scripts/dev/wsl-cargo.sh on Windows). The Plan, the module +tree and the rendering are those of explicit_imports.py. Offline refactoring aid, not part of the product. +""" +import collections +import json +import pathlib +import posixpath +import re +import sys + +sys.path.insert(0, str(pathlib.Path(__file__).parent)) +import explicit_imports as ei # noqa: E402 + +IDENT = ei.IDENT +MISSING = [ + re.compile(rf"cannot find (?:type|value|function|trait|macro|struct, variant or union type|tuple struct or tuple variant|" + rf"unit struct, unit variant or constant|derive macro|attribute macro|function, tuple struct or tuple variant|" + rf"value, found) `({IDENT})` in this scope"), + re.compile(rf"failed to resolve: use of undeclared (?:type|module|crate or module) `({IDENT})`"), + re.compile(rf"failed to resolve: use of unresolved module or unlinked crate `({IDENT})`"), + re.compile(rf"failed to resolve: use of undeclared type or module `({IDENT})`"), + re.compile(rf"(?:enum|struct|type alias|trait) `({IDENT})` takes \d+ generic argument"), + re.compile(rf"cannot find .*? `({IDENT})` in module"), +] +BAD_IMPORT = re.compile(r"unresolved imports? (.*)") +SUPER_NAME = re.compile(rf"`super::({IDENT})`") +TRAIT_HELP = re.compile(r"(?:trait|traits).*(?:not in scope|perhaps you want to import)") + + +def messages(wt, package, args, out_name): + """compiler-message dicts of `cargo check --message-format=json` over `args`.""" + return ei.run_cargo(wt, f"-p {package} {args}", out_name) + + +def span_file(message): + for span in message.get("spans", []): + if span.get("is_primary"): + return posixpath.normpath(span["file_name"]) + return None + + +def missing_names(message): + text = message["message"] + for rx in MISSING: + m = rx.search(text) + if m: + return [m.group(1)] + return [] + + +def trait_paths(message): + """`crate::a::Trait` paths rustc suggests importing for a method call (children of an E0599).""" + found = [] + for child in message.get("children", []): + if not TRAIT_HELP.search(child.get("message", "")): + continue + for span in child.get("spans", []): + replacement = span.get("suggested_replacement") or "" + for m in re.finditer(r"use ([\w:]+);", replacement): + found.append(m.group(1)) + return found + + +def collect(msgs): + """({file: {name}}, {file: {bad super name}}, {file: {trait path}}, {file: other error text}) of one build.""" + missing, bad, traits, other = (collections.defaultdict(set) for _ in range(4)) + for m in msgs: + if m["level"] != "error": + continue + f = span_file(m) + if f is None: + continue + names = missing_names(m) + paths = trait_paths(m) + bad_import = BAD_IMPORT.match(m["message"]) + if names: + missing[f].update(names) + elif bad_import: + bad[f].update(SUPER_NAME.findall(bad_import.group(1))) + elif paths: + traits[f].update(paths) + else: + other[f].add(m["message"][:100]) + return missing, bad, traits, other + + +PLATFORM_FILES = { + "backend/original_serve/runner/owner_run_steps.rs", "memory_governor/page_cache.rs", + "model_binding/qwen4exp_input/mtp/backing.rs", "model_binding/qwen4exp_input/mtp/mtp_weight_reads.rs", + "model_binding/qwen4exp_input/mtp/read_expert_rows.rs", "model_binding/qwen4exp_kar_ple/pinned_profile_tests.rs", + "model_binding/qwen4exp_kar_ple/private_copy/inode.rs", "model_binding/qwen4exp_kar_ple/private_copy/checked_reader.rs", + "model_binding/qwen4exp_kar_ple/inherited_kar_archive.rs", "model_binding/qwen4exp_kar_ple/load_pinned_inherited_archive.rs", + "model_binding/qwen4exp_kar_ple/pinned_profile.rs", "qwen_forward/original_serve_residency/open_tier.rs", +} + + +def prune_existing(plan, rel): + """Files that already carry explicit `use super::{..}` lists: their names become the seed of the prune.""" + plan.prune = True + todo = [] + for f, text in plan.texts.items(): + names = {} + for m in ei.USE_SUPER_RE.finditer(text): + block = m.group(0) + cfg_lines = [ln for ln in block.splitlines() if ln.startswith("#[cfg(")] + cfg = chr(10).join(cfg_lines) + kind = "test" if cfg == "#[cfg(test)]" else "normal" + if cfg == "#[cfg(test)]": + cfg = "" + for name in re.findall(IDENT, block.split("use super::", 1)[1]): + names[name] = kind + if cfg: + plan.cfgs.setdefault(f, {})[name] = cfg + if names: + plan.imports[f] = names + todo.append(f) + return todo + + +def select(plan, rel): + """(todo, skipped, keep_all) of the glob files, by the skip rules and the --include-tests/--platform/--opaque flags.""" + only = [a for a in sys.argv[4:] if not a.startswith("--") and not a.isdigit()] + todo, skipped, keep_all = [], {}, set() + for f in plan.candidates(): + reason = plan.skip_reason(f) + if reason == "test module" and "--include-tests" in sys.argv: + reason = None + if reason == "platform cfg" and "--platform" in sys.argv: + reason = None + keep_all.add(f) # the other platform's code is not compiled here: unused names are reported, not removed + if reason == "opaque glob in the parent chain" and "--opaque" in sys.argv: + reason = None + if only and not any(o in rel(f) for o in only): + continue + (skipped.__setitem__(f, reason) if reason else todo.append(f)) + return todo, skipped, keep_all + + +def main(): + wt, crate_dir, package = sys.argv[1:4] + max_rounds = int(sys.argv[sys.argv.index("--max-rounds") + 1]) if "--max-rounds" in sys.argv else 12 + plan = ei.Plan(wt, crate_dir) + wtp = pathlib.Path(wt).resolve() + rel = lambda f: f.resolve().relative_to(wtp).as_posix() # noqa: E731 + by_rel = {rel(f): f for f in plan.crate.by_file} + only = [a for a in sys.argv[4:] if not a.startswith("--") and not a.isdigit()] + todo, skipped, keep_all = [], {}, set() + if "--prune-existing" in sys.argv: + todo = prune_existing(plan, rel) + keep_all = {f for f in todo if rel(f).split("/src/", 1)[1] in PLATFORM_FILES} + todo = [f for f in todo if f not in keep_all] + for f in keep_all: + plan.imports.pop(f, None) + else: + todo, skipped, keep_all = select(plan, rel) + needs = plan.compute_needs(todo) + plan.blocked = {f for f in plan.blocked if f in todo} # a conditional name is repaired by the build below + plan.apply(todo, needs) + for f, conditional in plan.cfgs.items(): # a name declared twice under complementary platform cfgs is always there + for n in [n for n, c in conditional.items() if "not(true)" in c or c.strip() in ("", "true")]: + del conditional[n] + print(f"{package}: {len(todo)} files to expand, {len(skipped)} skipped", flush=True) + for reason, n in collections.Counter(skipped.values()).items(): + print(f" skipped {n}: {reason}", flush=True) + for round_no in range(1, max_rounds + 1): + plan.write() + a = messages(wt, package, "--lib --bins", "ug-a.json") + b = messages(wt, package, "--tests", "ug-b.json") + am, ab, at, ao = collect(a) + bm, bb, bt, bo = collect(b) + changed = 0 + for f in todo: + r, imp = rel(f), plan.imports.setdefault(f, {}) + wanted = (am[r], "normal"), (bm[r] - am[r], "test") + for names, kind in wanted: + for n in names: + if n not in imp: + imp[n] = kind + changed += 1 + elif plan.cfgs.get(f, {}).pop(n, None) is not None: # the name is there but its cfg hides it + changed += 1 + for path in at[r] | bt[r]: + key = "@anon:" + path + if key not in imp: + imp[key] = "normal" if path in at[r] else "test" + changed += 1 + for n in ab[r] | bb[r]: + parent = plan.crate.by_file[f].parent + if parent is not None and parent.file in todo: + kind = "normal" if n in ab[r] else "test" + if plan.imports.setdefault(parent.file, {}).get(n) != "normal": + plan.imports[parent.file][n] = kind + changed += 1 + elif n in imp: + del imp[n] # the name is not in the parent: another path is needed (listed below) + changed += 1 + other = {r: v for r, v in {**ao, **bo}.items() if r in {rel(f) for f in todo}} + print(f"round {round_no}: {changed} imports added, {sum(len(v) for v in other.values())} other errors in " + f"{len(other)} files", flush=True) + if changed: + continue + if other: + for r, v in sorted(other.items())[:20]: + print(" ", r, sorted(v)[:2]) + break + unused_a, unused_b = ei.flagged(a, "unused"), ei.flagged(b, "unused") + pruned = 0 + for f in todo: + r, imp = rel(f), plan.imports[f] + if f in keep_all: + print(" unused here, kept:", r, sorted(set(unused_a.get(r, ())) & set(unused_b.get(r, ()))), flush=True) + continue + for name in list(imp): + a_unused = name in unused_a.get(r, ()) + b_unused = name in unused_b.get(r, ()) + if b_unused: + del imp[name] + pruned += 1 + elif a_unused and imp[name] == "normal": + imp[name] = "test" + pruned += 1 + print(f" pruned or moved to cfg(test): {pruned}", flush=True) + if not pruned: + break + plan.write() + left = [rel(f) for f in plan.texts if ei.GLOB_RE.search(open(f, encoding="utf-8").read())] + print(f"{len(left)} files still carry the glob") + ei.WORK.mkdir(parents=True, exist_ok=True) + (ei.WORK / f"unglob_{package}.json").write_text(json.dumps(left, indent=0)) + + +if __name__ == "__main__": + main() From c0d34a6648fc6e8bdf535615a6e51837c5540aa4 Mon Sep 17 00:00:00 2001 From: Pavlo Ratushnyi Date: Sat, 14 Nov 2026 20:35:20 +0100 Subject: [PATCH 02/10] engine-qwen35-cuda: explicit imports instead of use super::* in all 193 files (test modules, GPU proofs and platform-cfg files included) Co-Authored-By: Claude Sonnet 5.5 --- .../src/backend/clock_tests.rs | 6 ++++- .../combined_changed_boundary_proof.rs | 18 ++++++++++++++- .../combined_changed_boundary_proof/rig.rs | 6 ++++- .../src/backend/combined_prefix_numeric.rs | 10 ++++++++- .../backend/combined_prefix_numeric_sdet.rs | 4 +++- .../src/backend/generate.rs | 8 ++++++- .../src/backend/layer0_native_mmq_proof.rs | 4 +++- .../src/backend/lifecycle_tests.rs | 5 ++++- crates/engine-qwen35-cuda/src/backend/load.rs | 8 ++++++- .../src/backend/load_cuda.rs | 6 ++++- .../src/backend/load_tests.rs | 5 ++++- .../src/backend/load_weights.rs | 5 ++++- .../src/backend/native_down_candidate_only.rs | 17 +++++++++++++- .../adaptive_slots.rs | 21 +++++++++++++++++- .../adaptive_slots/cleanup.rs | 5 ++++- .../adaptive_slots/observe.rs | 4 +++- .../fivecase_frames.rs | 5 ++++- .../fivecase_runtime.rs | 5 ++++- .../native_down_candidate_only/pair_arm.rs | 9 +++++++- .../native_down_candidate_only/pair_checks.rs | 2 +- .../native_down_candidate_only/pair_owner.rs | 7 +++++- .../native_down_candidate_only/pair_proofs.rs | 6 ++++- .../native_down_candidate_only/pair_run.rs | 5 ++++- .../src/backend/native_down_pair_io.rs | 5 ++++- .../src/backend/native_down_public_pair.rs | 22 ++++++++++++++++++- .../native_down_public_pair/pair_arm.rs | 9 +++++++- .../native_down_public_pair/pair_run.rs | 10 ++++++++- .../native_resident_mmq_model_proof.rs | 4 +++- .../original_serve/runner/owner_run_steps.rs | 12 ++++++++-- .../src/backend/original_serve/tests.rs | 2 +- .../backend/original_serve_memory_smoke.rs | 18 ++++++++++++++- .../original_serve_memory_smoke/leak.rs | 2 +- .../original_serve_memory_smoke/load.rs | 6 ++++- .../original_serve_memory_smoke/probe.rs | 2 +- .../original_serve_memory_smoke/reader.rs | 2 +- .../original_serve_memory_smoke/shed.rs | 2 +- .../original_serve_memory_smoke/soak.rs | 2 +- .../original_serve_memory_smoke/traffic.rs | 2 +- .../backend/original_serve_prefix_smoke.rs | 18 ++++++++++++++- .../original_serve_prefix_smoke/extras.rs | 2 +- .../original_serve_prefix_smoke/run.rs | 6 ++++- .../src/backend/original_serve_smoke.rs | 20 ++++++++++++++++- .../original_serve_smoke/smoke_conv.rs | 5 ++++- .../original_serve_smoke/smoke_coverage.rs | 5 ++++- .../original_serve_smoke/smoke_long.rs | 7 +++++- .../original_serve_smoke/smoke_main.rs | 21 +++++++++++++++++- .../original_serve_smoke/smoke_main/corpus.rs | 4 +++- .../original_serve_smoke/smoke_stack.rs | 5 ++++- .../src/backend/profile_tests.rs | 5 ++++- .../src/backend/resident_mmq_model_proof.rs | 4 +++- .../src/backend/serve_run.rs | 6 ++++- .../src/backend/singleload_proof.rs | 4 +++- .../engine-qwen35-cuda/src/backend/tests.rs | 13 ++++++++++- .../src/conversation/resident/tests.rs | 2 +- .../src/experimental/tests.rs | 5 ++++- .../src/memory_governor/page_cache.rs | 5 ++++- .../model_binding/qwen4exp_input/gdn/tests.rs | 2 +- .../model_binding/qwen4exp_input/gr/tests.rs | 2 +- .../qwen4exp_input/mtp/backing.rs | 6 ++++- .../qwen4exp_input/mtp/mtp_weight_reads.rs | 8 +++++-- .../qwen4exp_input/mtp/read_expert_rows.rs | 7 ++++-- .../model_binding/qwen4exp_input/mtp/tests.rs | 5 ++++- .../qwen4exp_input/validate_ple_descriptor.rs | 8 +++++-- .../qwen4exp_kar_ple/inherited_kar_archive.rs | 7 ++++-- .../load_pinned_inherited_archive.rs | 8 +++++-- .../qwen4exp_kar_ple/pinned_profile.rs | 8 +++++-- .../qwen4exp_kar_ple/pinned_profile_tests.rs | 6 ++++- .../private_copy/checked_reader.rs | 6 +++-- .../qwen4exp_kar_ple/private_copy/inode.rs | 6 +++-- .../dense_weight_cache/workspaces.rs | 8 +++++-- .../qwen_forward/executor/prefill_chunk.rs | 9 +++++++- .../prefill_chunk/check_chunk_on_loaded.rs | 6 +++-- .../executor/prefill_chunk/mmq_evaluation.rs | 6 ++++- .../prefill_chunk/native_mmq_evaluation.rs | 2 +- .../executor/prefill_chunk/qwen_forward.rs | 13 +++++++++-- .../qwen_forward/prefill_chunk_planned.rs | 14 ++++++++++-- .../prefill_chunk_planned/chunk_layer.rs | 8 +++++-- .../prefill_chunk_planned/chunk_setup.rs | 9 ++++++-- .../prefill_chunk_planned/window_attention.rs | 10 +++++++-- .../prefill_chunk_planned/window_experts.rs | 6 +++-- .../prefill_chunk_planned/window_ffn.rs | 8 +++++-- .../prefill_chunk/read_chunk_attention_ffn.rs | 8 +++++-- .../executor/prefill_chunk/window_numeric.rs | 9 +++++++- .../prefill_chunk/window_numeric/proof.rs | 7 ++++-- .../executor/reset_replay_sdet.rs | 5 ++++- .../src/qwen_forward/executor/step_layers.rs | 8 +++++-- .../src/qwen_forward/executor/tests.rs | 5 ++++- .../src/qwen_forward/gdn/chain/gpu_tests.rs | 5 ++++- .../gdn/chain/row_queue_gpu_tests.rs | 6 ++++- .../src/qwen_forward/gdn/chunk_device.rs | 14 +++++++++++- .../chunk_device/gdn_chunk_device_methods.rs | 15 +++++++++++-- .../chunk_device_batch_compute.rs | 8 +++++-- .../gdn/chunk_device/numeric_gpu.rs | 13 ++++++++++- .../numeric_gpu/batch_adoption.rs | 6 +++-- .../gdn/chunk_device/numeric_gpu/exercise.rs | 8 +++++-- .../src/qwen_forward/gdn/driver_error.rs | 7 ++++-- .../src/qwen_forward/gdn/four_borrow_gpu.rs | 5 ++++- .../gdn/input_scratch_gpu_tests.rs | 5 ++++- .../src/qwen_forward/gdn/mirror/gpu_tests.rs | 2 +- .../src/qwen_forward/gdn/prefill_batch.rs | 6 ++++- .../src/qwen_forward/gdn/prefill_batch/gpu.rs | 2 +- .../src/qwen_forward/gdn/verification.rs | 7 +++++- .../gdn/verification/numeric_gpu.rs | 5 ++++- .../qwen_forward/gr/gr_residual_reuse_gpu.rs | 5 ++++- .../qwen_forward/gr/output_workspace_gpu.rs | 8 ++++++- .../output_workspace_proof_stages.rs | 6 ++++- .../src/qwen_forward/gr/retained_handoff.rs | 10 ++++++++- .../gr/retained_handoff/installed.rs | 5 ++++- .../src/qwen_forward/gr/tests.rs | 4 +++- .../src/qwen_forward/input/gather_rows.rs | 10 +++++++-- .../qwen_forward/kar_ple_cache/lru_tests.rs | 2 +- .../kar_ple_cache/row_parity_probe.rs | 2 +- .../qwen_forward/kar_ple_cache/slot_tests.rs | 2 +- .../moe_expert/expert_matrix_projection.rs | 12 ++++++++-- .../src/qwen_forward/moe_expert/grouped.rs | 15 ++++++++++++- .../moe_expert/grouped/direct_gpu.rs | 12 +++++++++- .../moe_expert/grouped/direct_gpu/arm.rs | 6 +++-- .../grouped/direct_gpu/loaded_arms.rs | 6 +++-- .../moe_expert/grouped/direct_gpu/policy.rs | 8 +++++-- .../moe_expert/grouped/direct_gpu/probe.rs | 6 +++-- .../moe_expert/grouped/layer0_pair.rs | 5 ++++- .../src/qwen_forward/moe_expert/tests.rs | 4 +++- .../qwen_forward/moe_prefill_batch/tests.rs | 5 ++++- .../src/qwen_forward/moe_route/tests.rs | 5 ++++- .../cache_lru_index/lru_index.rs | 6 +++-- .../moe_weight_cache/cache_profile_fill.rs | 13 ++++++++++- .../cache_profile_fill/moe_weight_cache.rs | 15 +++++++++++-- .../pinned_triplet_preload.rs | 10 +++++++-- .../cache_profile_fill/profile_build.rs | 7 ++++-- .../shared_quartet_preload.rs | 7 +++++- .../src/qwen_forward/mtp/kv_only.rs | 4 +++- .../mtp/state/chunk/mtp_session.rs | 6 +++-- .../mtp/state/prefix_draft_snapshot.rs | 7 ++++-- .../src/qwen_forward/mtp/state/tests.rs | 5 ++++- .../src/qwen_forward/mtp_attention/tests.rs | 2 +- .../src/qwen_forward/mtp_decode/batch_gpu.rs | 7 +++++- .../src/qwen_forward/mtp_decode/chunk.rs | 2 +- .../qwen_forward/mtp_decode/mtp_decoder.rs | 11 ++++++++-- .../mtp_decoder/draft_warm_and_window.rs | 7 ++++-- .../mtp_experts/fixed_workspace/role.rs | 8 +++++-- .../fixed_workspace/transport_drop.rs | 9 ++++++-- .../mtp_expert_transport/shared_project.rs | 12 ++++++++-- .../src/qwen_forward/mtp_experts/tests.rs | 2 +- .../original_serve_config/tests.rs | 8 ++++++- .../original_serve_engine/env_tests.rs | 2 +- .../original_serve_engine/tests.rs | 7 +++++- .../original_serve_host/ple_on_chain/tests.rs | 2 +- .../qwen_forward/original_serve_host/tests.rs | 2 +- .../qwen_forward/original_serve_pool/tests.rs | 4 +++- .../original_serve_request/tests.rs | 5 ++++- .../original_serve_residency/open_tier.rs | 10 +++++++-- .../original_serve_residency/tests.rs | 9 +++++--- .../tier_env_tests.rs | 2 +- .../conversation/tests.rs | 2 +- .../open_phase_steps.rs | 11 ++++++++-- .../prefix/clock_tests.rs | 2 +- .../original_serve_stack/prefix/tests.rs | 6 ++++- .../original_serve_stack/tests.rs | 5 ++++- .../original_serve_verifier/tests.rs | 4 +++- .../original_spec_controller/tests.rs | 6 ++++- .../output/output_stage_test_replay.rs | 9 ++++++-- .../src/qwen_forward/output/tests.rs | 5 ++++- .../qsa_attention/attention_scratch.rs | 8 ++++++- .../qsa_attention/attention_scratch/gpu.rs | 5 ++++- .../src/qwen_forward/qsa_index/context.rs | 10 +++++++-- .../qwen_forward/qsa_index/index_resident.rs | 13 ++++++++++- .../index_resident/synthetic_late_prior.rs | 4 ++-- .../qsa_index/input_reuse_gpu_tests.rs | 5 ++++- .../qwen_forward/qsa_index/prompt_device.rs | 10 ++++++++- .../prompt_device/resident_device.rs | 14 +++++++++++- .../prompt_device/resident_device/scalar.rs | 9 +++++++- .../resident_device/scalar/scalar_row_run.rs | 3 ++- .../qwen_forward/qsa_index/selected_cache.rs | 7 +++++- .../qsa_index/selected_cache/tests.rs | 5 ++++- .../src/qwen_forward/session/chunk.rs | 7 +++++- .../session/chunk/qwen_chunk_txn.rs | 12 ++++++++-- .../qwen_chunk_txn_micro_window.rs | 8 +++++-- .../session/chunk/test_gdn_component_rows.rs | 9 ++++++-- .../src/qwen_forward/session/chunk/verify.rs | 8 ++++++- .../session/chunk/verify/tests.rs | 6 ++++- .../qwen_forward/session/original_prompt.rs | 7 +++++- .../session/original_prompt/draft.rs | 5 ++++- .../qwen_forward/session/original_verified.rs | 4 +++- .../session/original_verified/tests.rs | 2 +- .../session/reset_replay_snapshot.rs | 6 +++-- .../src/qwen_forward/session/tests.rs | 6 ++++- .../src/serve_meta/tests.rs | 5 ++++- .../src/serve_tuning/tests.rs | 2 +- .../src/settings/capture_tests.rs | 2 +- .../src/settings/decode_tests.rs | 2 +- .../src/settings/diagnostics_tests.rs | 2 +- .../src/settings/kv_tests.rs | 2 +- .../src/settings/memory_tests.rs | 2 +- .../src/settings/serve_tests.rs | 2 +- 194 files changed, 1065 insertions(+), 248 deletions(-) diff --git a/crates/engine-qwen35-cuda/src/backend/clock_tests.rs b/crates/engine-qwen35-cuda/src/backend/clock_tests.rs index ebdce422..4b520367 100644 --- a/crates/engine-qwen35-cuda/src/backend/clock_tests.rs +++ b/crates/engine-qwen35-cuda/src/backend/clock_tests.rs @@ -1,7 +1,11 @@ //! The request clocks of the backend on a manual clock (STRA-338 S14): the terminal publication deadline, the //! prefill/decode accounting of the measurement recorder and the clock reads of the source verification. -use super::*; +use super::{ + BACKPRESSURE_TIMEOUT, Clock, ContractError, Duration, EvaluationMeasurement, FinishReason, GenerationEvent, + GenerationFailure, GenerationSink, GenerationTerminal, NativeBackendConfig, Usage, emit_event, emit_terminal, + measurement, verify_sources_parallel, +}; use leleka_obs::time::ManualClock; fn completed() -> GenerationTerminal { diff --git a/crates/engine-qwen35-cuda/src/backend/combined_changed_boundary_proof.rs b/crates/engine-qwen35-cuda/src/backend/combined_changed_boundary_proof.rs index 7a40b905..b51e95ba 100644 --- a/crates/engine-qwen35-cuda/src/backend/combined_changed_boundary_proof.rs +++ b/crates/engine-qwen35-cuda/src/backend/combined_changed_boundary_proof.rs @@ -1,5 +1,21 @@ //! Private sole new changed-path model gate; actual source identity/load preserved. -use super::*; +use super::{ + Arc, AtomicBool, AtomicU64, BACKEND_API_VERSION, Backend, BackendCapabilities, BackendError, BackendIdentity, + CacheCounts, Clock, ContractError, DeferredTail, Digest, Driver, Duration, ErrorCode, EvaluationExecution, + EvaluationMeasurement, EvaluationObserver, ExperimentalConfig, ExpertSource, FinishReason, GenerationEvent, + GenerationRequest, GenerationSink, GenerationStream, GenerationTerminal, InferenceMode, InheritedKarArchive, + InputBindingError, KarArchiveRef, KarExpertLevels, KarExpertSource, KarExpertSourceConfig, LOAD_CONFIG_VERSION, + LoadedModel, MeasurementFailure, ModelBinding, ModelDescriptor, Mutex, Ordering, OriginalServeChoice, + OriginalServeMode, OriginalServeOptions, PathBuf, PrefixCacheOptions, PrefixTail, Qwen4ExpArtifact, Qwen35Cuda, + Qwen35CudaStart, Rc, Receiver, RecentIds, RuntimeConfig, SHARD0, SHARD1, Sha256, SupportedModelTuple, SyncSender, + SystemClock, Tokenizer, Usage, VerifiedGgufFile, WindowWitness, close_context, load, thread, +}; +#[cfg(feature = "preview-path")] +use super::{ + DenseWeightCache, Dimension, InputConstants, Instant, KarPleCache, MoeWeightCache, MtpDecoder, MtpWindowError, + MtpWindowSpec, OutputStage, Position, QwenForward, QwenSession, ResidentConversations, ResidentPolicy, + TargetStepProduct, TokenId, +}; use crate::qwen_forward::loaded_target_owners::LoadedTargetOwners as LoadedTarget; use std::env; pub(super) mod rig; diff --git a/crates/engine-qwen35-cuda/src/backend/combined_changed_boundary_proof/rig.rs b/crates/engine-qwen35-cuda/src/backend/combined_changed_boundary_proof/rig.rs index fe7ab3b1..e09f59d2 100644 --- a/crates/engine-qwen35-cuda/src/backend/combined_changed_boundary_proof/rig.rs +++ b/crates/engine-qwen35-cuda/src/backend/combined_changed_boundary_proof/rig.rs @@ -1,7 +1,11 @@ //! The loaded real owners the single-load GPU proofs share: the pinned binding over the inherited sealed archive, //! the device owners built on one bounded Context, a phase run on a fresh target owner, and the teardown whose //! results are asserted only after every attempt was made. Opening and scheduling stay with each proof. -use super::*; +use super::{ + InheritedKarArchive, ModelBinding, PathBuf, Qwen4ExpArtifact, Rc, SHARD0, SHARD1, Tokenizer, VerifiedGgufFile, +}; +#[cfg(feature = "preview-path")] +use super::{DenseWeightCache, KarPleCache, MoeWeightCache, OutputStage, QwenSession}; use std::{ env, panic::{AssertUnwindSafe, catch_unwind}, diff --git a/crates/engine-qwen35-cuda/src/backend/combined_prefix_numeric.rs b/crates/engine-qwen35-cuda/src/backend/combined_prefix_numeric.rs index 6d44f03f..b0325b46 100644 --- a/crates/engine-qwen35-cuda/src/backend/combined_prefix_numeric.rs +++ b/crates/engine-qwen35-cuda/src/backend/combined_prefix_numeric.rs @@ -1,7 +1,15 @@ //! Disposable, real-owner numerical observation. Never an actor publication gate. //! Forced inputs are public IDs; no expected model tensors or invented state. use super::combined_changed_boundary_proof::rig::Owners; -use super::*; +use super::{ + AtomicBool, EvaluationExecution, FinishReason, Generation, GenerationSink, ModelBinding, MtpContinuation, Mutex, + Shared, SystemClock, Tokenizer, generate_mtp_resume, +}; +#[cfg(feature = "preview-path")] +use super::{ + DenseWeightCache, Dimension, KarPleCache, MoeWeightCache, MtpDecoder, OutputStage, QwenSession, TargetStepProduct, + TokenId, +}; use crate::qwen_forward::mtp::KnownNext; use crate::qwen_forward::mtp_decode::DraftHeadOwners; use crate::qwen_forward::{mtp::PrefixDraftSnapshot, session::ResetReplaySnapshot}; diff --git a/crates/engine-qwen35-cuda/src/backend/combined_prefix_numeric_sdet.rs b/crates/engine-qwen35-cuda/src/backend/combined_prefix_numeric_sdet.rs index eb30f0cf..64727086 100644 --- a/crates/engine-qwen35-cuda/src/backend/combined_prefix_numeric_sdet.rs +++ b/crates/engine-qwen35-cuda/src/backend/combined_prefix_numeric_sdet.rs @@ -3,7 +3,9 @@ use super::combined_changed_boundary_proof::rig::{ DEVICE_BUDGET, MOE_REFUSAL, Owners, PinnedTokenizer, bind_pinned_with_tokenizer, require_opt_in, }; -use super::*; +use super::{Driver, ModelBinding, PathBuf, Rc, Tokenizer}; +#[cfg(feature = "preview-path")] +use super::{MoeWeightCache, QwenSession}; use std::{ env, panic::{AssertUnwindSafe, catch_unwind, resume_unwind}, diff --git a/crates/engine-qwen35-cuda/src/backend/generate.rs b/crates/engine-qwen35-cuda/src/backend/generate.rs index e9d6a2da..523b2ba7 100644 --- a/crates/engine-qwen35-cuda/src/backend/generate.rs +++ b/crates/engine-qwen35-cuda/src/backend/generate.rs @@ -1,5 +1,11 @@ //! The single-token generation step loop. -use super::*; +use super::{ + AtomicBool, BackendError, Clock, DenseWeightCache, Dimension, ErrorCode, EvaluationExecution, FinishReason, + GENERATION_TIMEOUT, GenerationEvent, GenerationFailure, GenerationSink, Instant, KarPleCache, ModelBinding, + MoeWeightCache, MtpDecoder, Ordering, OutputStage, Position, QwenForward, QwenSession, Shared, SystemClock, + TargetStepProduct, TokenId, Tokenizer, Usage, Utf8Pending, emit_event, error, exhausted, generate_mtp, invalid, + measurement, native_position, unavailable, unsupported, +}; use crate::qwen_forward::executor::{PrefillChunkInputs, StepCaches, StepRequest}; pub(super) struct Generation<'a, 'context, 'driver, C: Clock = SystemClock> { diff --git a/crates/engine-qwen35-cuda/src/backend/layer0_native_mmq_proof.rs b/crates/engine-qwen35-cuda/src/backend/layer0_native_mmq_proof.rs index aa664e39..7f19143b 100644 --- a/crates/engine-qwen35-cuda/src/backend/layer0_native_mmq_proof.rs +++ b/crates/engine-qwen35-cuda/src/backend/layer0_native_mmq_proof.rs @@ -1,6 +1,8 @@ //! Private sole new changed-path model gate; actual source identity/load preserved. use super::combined_changed_boundary_proof::rig::{DEVICE_BUDGET, Owners, bind_pinned, require_opt_in}; -use super::*; +use super::{Driver, EvaluationExecution, ModelBinding, PathBuf, Rc}; +#[cfg(feature = "preview-path")] +use super::{MoeWeightCache, QwenForward}; use crate::qwen_forward::loaded_target_owners::LoadedTargetOwners; use std::{env, panic::resume_unwind}; diff --git a/crates/engine-qwen35-cuda/src/backend/lifecycle_tests.rs b/crates/engine-qwen35-cuda/src/backend/lifecycle_tests.rs index 35ef7acd..c500e7b0 100644 --- a/crates/engine-qwen35-cuda/src/backend/lifecycle_tests.rs +++ b/crates/engine-qwen35-cuda/src/backend/lifecycle_tests.rs @@ -5,7 +5,10 @@ //! `FakeDevice` (no GPU). Time is a `ManualClock` that the device moves by the scripted cost of a chunk or a round, so //! the deadline and the prefill/decode accounting are exact. Normal completion, stop, length, acceptance and timing //! are here; `ends` holds the cancel, deadline and error exits, `prefix` the cross-session cache. -use super::*; +use super::{ + Arc, AtomicBool, ErrorCode, FinishReason, GenerationEvent, GenerationFailure, GenerationRequest, GenerationSink, + GenerationStream, GenerationTerminal, Mutex, Ordering, Shared, Tokenizer, Usage, original_serve, +}; use crate::qwen_forward::original_serve_engine::{ServeOutcome, ServeStop}; use crate::qwen_forward::original_serve_request::{ServeDevice, ServeError, ServeRequest}; use crate::qwen_forward::original_serve_stack::lifecycle_fake::{FakeDevice, FakeStack, Script, greedy_continuation}; diff --git a/crates/engine-qwen35-cuda/src/backend/load.rs b/crates/engine-qwen35-cuda/src/backend/load.rs index 07e9c6d9..79637a8a 100644 --- a/crates/engine-qwen35-cuda/src/backend/load.rs +++ b/crates/engine-qwen35-cuda/src/backend/load.rs @@ -1,6 +1,12 @@ //! The owner-side Load: bind the sources, open CUDA, build the caches, then serve generations until Unload. //! The phases live in `load_*.rs`; this file fixes the order they run in. -use super::*; +use super::{ + Announcement, BackendError, Bound, Closed, Command, EvaluationExecution, EvaluationObserver, Identity, LoadedModel, + ModelDescriptor, NativeBackendConfig, OptimizedBackendConfig, Ordering, QwenSession, Rc, Receiver, Reply, + RuntimeConfig, Serving, Shared, SystemClock, admit_load, bind_model, build_loaded, check_not_cancelled, + close_context, close_weights, experimental_modes, launch_original, load_weights, new_conversations, + open_checked_context, open_driver, original_serve, probe_experimental_plan, serve_commands, start_governor, +}; use leleka_cuda_driver::Context; /// Everything one Load needs from its owner thread. diff --git a/crates/engine-qwen35-cuda/src/backend/load_cuda.rs b/crates/engine-qwen35-cuda/src/backend/load_cuda.rs index 73eee9e1..2ae66141 100644 --- a/crates/engine-qwen35-cuda/src/backend/load_cuda.rs +++ b/crates/engine-qwen35-cuda/src/backend/load_cuda.rs @@ -1,5 +1,9 @@ //! The CUDA half of a Load: driver, device context, load-time probes and the hand-over to the Original serve stack. -use super::*; +use super::{ + Announcement, BackendError, Bound, Driver, Governed, LoadEnv, LoadPhase, ModelBinding, NativeBackendConfig, Rc, + build_loaded, exhausted, experimental_modes, load_failure, original_serve, probe_experimental, + probe_kar_level_decode, unavailable, +}; use leleka_cuda_driver::Context; pub(super) fn open_driver() -> Result { diff --git a/crates/engine-qwen35-cuda/src/backend/load_tests.rs b/crates/engine-qwen35-cuda/src/backend/load_tests.rs index 54a084cc..abcf50c8 100644 --- a/crates/engine-qwen35-cuda/src/backend/load_tests.rs +++ b/crates/engine-qwen35-cuda/src/backend/load_tests.rs @@ -1,6 +1,9 @@ //! What the phase functions of the Load (STRA-338 S5b) must keep from the code they replaced: the policy flags, the //! execution gates and the weight-cache log line, each compared with the expressions of the former `serve_load`. -use super::*; +use super::{ + Counters, EvaluationExecution, OptimizedBackendConfig, OptimizedOwnerPolicy, PolicyFlags, execution_gate_message, + generation_cache_line, +}; #[cfg(feature = "preview-path")] use crate::qwen_forward::dense_weight_cache::DenseCacheCounters; #[cfg(feature = "preview-path")] diff --git a/crates/engine-qwen35-cuda/src/backend/load_weights.rs b/crates/engine-qwen35-cuda/src/backend/load_weights.rs index f097cc36..092a73bf 100644 --- a/crates/engine-qwen35-cuda/src/backend/load_weights.rs +++ b/crates/engine-qwen35-cuda/src/backend/load_weights.rs @@ -1,5 +1,8 @@ //! The weight caches a native Load builds on the CUDA context: output head, KAR PLE cache, dense and MoE weights. -use super::*; +use super::{ + BackendError, Bound, DenseWeightCache, KarPleCache, LoadEnv, LoadPhase, ModelBinding, MoeWeightCache, OutputStage, + PolicyFlags, exhausted, invalid, load_failure, load_forward_failure, load_moe, +}; use leleka_cuda_driver::Context; type ForwardResult = Result; diff --git a/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only.rs b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only.rs index 68134a23..cb8f8217 100644 --- a/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only.rs +++ b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only.rs @@ -1,6 +1,21 @@ //! Candidate-only PUBLIC quality proof against one retained actual Native arm. //! Historical wall time is never used as an A/B measurement. -use super::*; +use super::{ + Arc, AtomicBool, AtomicU64, BACKEND_API_VERSION, Backend, BackendCapabilities, BackendError, BackendIdentity, + CacheCounts, Clock, ContractError, DeferredTail, DenseWeightCache, Digest, Dimension, Driver, Duration, ErrorCode, + EvaluationExecution, EvaluationMeasurement, EvaluationObserver, ExperimentalConfig, ExpertSource, FRAME_LIMIT, + FinishReason, Generation, GenerationEvent, GenerationFailure, GenerationRequest, GenerationSink, GenerationStream, + GenerationTerminal, InferenceMode, InheritedKarArchive, InputBindingError, InputConstants, Instant, + KAR_MTP_PROFILE, KarArchiveRef, KarExpertLevels, KarExpertSource, KarExpertSourceConfig, KarPleCache, + LOAD_CONFIG_VERSION, LoadedModel, MODEL_DIGEST, MeasurementFailure, ModelBinding, ModelDescriptor, MoeWeightCache, + MtpContinuation, MtpDecoder, MtpWindowError, MtpWindowSpec, Mutex, Ordering, OriginalServeChoice, + OriginalServeMode, OriginalServeOptions, OutputStage, PathBuf, Position, PrefixCacheOptions, PrefixTail, QUEUE, + Qwen4ExpArtifact, Qwen35Cuda, Qwen35CudaStart, QwenForward, QwenSession, Rc, Receiver, RecentIds, + ResidentConversations, ResidentPolicy, RuntimeConfig, SHARD0, SHARD1, Sha256, Shared, SupportedModelTuple, + SyncSender, SystemClock, TargetStepProduct, TokenId, Tokenizer, Usage, VerifiedGgufFile, WindowWitness, + combined_changed_boundary_proof, emit_terminal, error, generate, generate_mtp_resume, load, measurement, owner, + prepare_prompt, request, session, spawn, thread, +}; use serde_json::{Value, json}; use std::{ env, diff --git a/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/adaptive_slots.rs b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/adaptive_slots.rs index 2f954f2b..97fa3cfb 100644 --- a/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/adaptive_slots.rs +++ b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/adaptive_slots.rs @@ -1,7 +1,26 @@ //! Configured five PUBLIC cases on one actual Strata adaptive cache owner. //! No Native inference replay; original paired quality/timing remains separately required. use super::super::combined_changed_boundary_proof::rig::close_context_flags; -use super::*; +use super::{ + Arc, AssertUnwindSafe, AtomicBool, AtomicU64, BACKEND_API_VERSION, BASELINE_SHA, Backend, BackendCapabilities, + BackendError, BackendIdentity, Baseline, CAP, CacheCounts, Clock, ContractError, DEVICE_BUDGET, DeferredTail, + Digest, Driver, Duration, ErrorCode, EvaluationMeasurement, EvaluationObserver, ExperimentalConfig, ExpertSource, + FinishReason, GenerationEvent, GenerationRequest, GenerationSink, GenerationStream, GenerationTerminal, + InferenceMode, InheritedKarArchive, InputBindingError, Inputs, KAR_MTP_PROFILE, KarArchiveRef, KarExpertLevels, + KarExpertSource, KarExpertSourceConfig, LOAD_CONFIG_VERSION, LoadedModel, MODEL_DIGEST, MeasurementFailure, + ModelBinding, ModelDescriptor, Mutex, OpenOptions, OpenOptionsExt, Ordering, OriginalServeChoice, + OriginalServeMode, OriginalServeOptions, PathBuf, PrefixCacheOptions, PrefixTail, Proof, Qwen4ExpArtifact, + Qwen35Cuda, Qwen35CudaStart, Rc, Read, Receiver, RecentIds, RuntimeConfig, SHARD0, SHARD1, Sha256, Shared, + SupportedModelTuple, SyncSender, SystemClock, Tokenizer, Usage, Value, VerifiedGgufFile, WindowWitness, Write, + baseline, catch_unwind, env, error, fivecase_runtime, json, metadata, path, request, resume_unwind, save, sha, + thread, token_ids, +}; +#[cfg(feature = "preview-path")] +use super::{ + DenseWeightCache, Dimension, InputConstants, Instant, KarPleCache, MoeWeightCache, MtpDecoder, MtpWindowError, + MtpWindowSpec, OutputStage, Position, QwenForward, QwenSession, ResidentConversations, ResidentPolicy, + TargetStepProduct, TokenId, +}; use leleka_model_format::qwen4exp::{ProvisionalExpertSource, ResidentExpertSourceReport}; use std::path::Path; diff --git a/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/adaptive_slots/cleanup.rs b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/adaptive_slots/cleanup.rs index 35ccf97f..6f50c2e7 100644 --- a/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/adaptive_slots/cleanup.rs +++ b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/adaptive_slots/cleanup.rs @@ -1,5 +1,8 @@ //! The cleanup documents of the adaptive proof and the assertions made once every teardown attempt was done. -use super::*; +use super::{ + AdaptiveClosed, AssertUnwindSafe, Baseline, InheritedKarArchive, KAR_MTP_PROFILE, MODEL_DIGEST, ModelBinding, Path, + Value, bank_copies_json, catch_unwind, fivecase_runtime, json, resume_unwind, save, token_ids, +}; /// The owner wall profile as the artifacts record it. pub(super) struct OwnerWall { diff --git a/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/adaptive_slots/observe.rs b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/adaptive_slots/observe.rs index 50f938fa..4558ed4c 100644 --- a/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/adaptive_slots/observe.rs +++ b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/adaptive_slots/observe.rs @@ -1,5 +1,7 @@ //! What the adaptive owners reported before and during their ordered teardown. -use super::*; +use super::{AdaptiveOwners, ModelBinding, Value, bank_report_json, json}; +#[cfg(feature = "preview-path")] +use super::{DenseWeightCache, MoeWeightCache}; /// A completion counter as the artifacts record it, and whether it is positive. pub(super) struct Count { diff --git a/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/fivecase_frames.rs b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/fivecase_frames.rs index 3cb28b56..714d4d46 100644 --- a/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/fivecase_frames.rs +++ b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/fivecase_frames.rs @@ -1,6 +1,9 @@ //! Private CPU-only framing on the caller's already admitted tokenizer. //! No model load, generation, expected outputs or state/capability publication. -use super::*; +use super::{ + CAP, GenerationRequest, Inputs, MODEL_DIGEST, OpenOptions, OpenOptionsExt, PathBuf, Read, Tokenizer, Value, env, + json, path, prepare_prompt, public_renderer, request, save, sha, +}; use std::os::unix::fs::{MetadataExt, PermissionsExt}; const BASE_FRAME_SHA: &str = "9512d4883fca31282206c3a03c8d4d3f3085b5c1dfedd998c8957061e01514e4"; diff --git a/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/fivecase_runtime.rs b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/fivecase_runtime.rs index 5211d602..a9326ff1 100644 --- a/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/fivecase_runtime.rs +++ b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/fivecase_runtime.rs @@ -1,6 +1,9 @@ //! Private five fresh public requests on the caller's one admitted model owner. //! This helper neither loads weights nor supplies an output oracle. -use super::*; +use super::{ + Arm, CAP, EvaluationExecution, FinishReason, GenerationRequest, Inputs, KAR_MTP_PROFILE, MODEL_DIGEST, OpenOptions, + OpenOptionsExt, Read, Tokenizer, Value, candidate_windows, env, json, path, prepare_prompt, save, sha, token_ids, +}; use std::os::unix::fs::MetadataExt; const CASE_COUNT: usize = 5; const BASE_FRAME_SHA: &str = "9512d4883fca31282206c3a03c8d4d3f3085b5c1dfedd998c8957061e01514e4"; diff --git a/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_arm.rs b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_arm.rs index 6e45880b..2eae83bb 100644 --- a/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_arm.rs +++ b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_arm.rs @@ -1,6 +1,13 @@ //! One actual owner generation on a fresh target/draft state: bounded stream consumer, failure artifact and the //! measurement record of a completed arm. -use super::*; +use super::{ + AtomicBool, CacheCounts, Duration, EvaluationExecution, EvaluationMeasurement, FRAME_LIMIT, FinishReason, + Generation, GenerationEvent, GenerationFailure, GenerationRequest, GenerationSink, GenerationStream, + GenerationTerminal, ModelBinding, MtpContinuation, Ordering, QUEUE, Rc, Shared, SystemClock, Tokenizer, Usage, + Value, WindowWitness, cache, cache_json, emit_terminal, generate_mtp_resume, json, measurement, path, save, thread, +}; +#[cfg(feature = "preview-path")] +use super::{DenseWeightCache, Instant, KarPleCache, MoeWeightCache, OutputStage, QwenSession}; const WALL_BOUNDARY: &str = "immediately before generate_mtp_resume through terminal, actual channel EOF and \ consumer join; excludes session teardown and helpers"; diff --git a/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_checks.rs b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_checks.rs index e5544a4a..cd3840f7 100644 --- a/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_checks.rs +++ b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_checks.rs @@ -1,5 +1,5 @@ //! The retained completed Native arm and the checks of the MTP window witnesses of a candidate arm. -use super::*; +use super::{Arm, FRAME_LIMIT, Value, WindowWitness, json, sealed_bytes, sha}; pub(super) const BASELINE_SHA: &str = "4d61ee949d37a738500c889f23f07310b6d75c7c8dfe5f50173eceafe1882fbe"; pub(super) struct Baseline { diff --git a/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_owner.rs b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_owner.rs index 66a7dc9f..401ea479 100644 --- a/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_owner.rs +++ b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_owner.rs @@ -1,6 +1,11 @@ //! The one loaded owner of the PUBLIC candidate proofs: admission of the sealed inputs, the load, the ordered //! teardown and the artifacts of it. The proofs differ only in the `Proof` hooks (`native_down_pair_proofs.rs`). -use super::*; +use super::{ + AtomicBool, BASELINE_SHA, Baseline, CAP, DenseWeightCache, GenerationRequest, InheritedKarArchive, Inputs, Instant, + KAR_MTP_PROFILE, KarPleCache, MODEL_DIGEST, ModelBinding, MoeWeightCache, Mutex, OpenOptions, OpenOptionsExt, + OutputStage, PathBuf, Qwen4ExpArtifact, Rc, Read, SHARD0, SHARD1, Shared, Tokenizer, Value, VerifiedGgufFile, + baseline, env, json, metadata, path, request, save, sha, +}; use crate::qwen_forward::owner_wall_profile::{self, Sample}; use leleka_model_format::qwen4exp::{ProvisionalExpertSource, ResidentExpertSourceReport}; use std::os::unix::fs::PermissionsExt; diff --git a/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_proofs.rs b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_proofs.rs index f7306d30..fb7337b8 100644 --- a/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_proofs.rs +++ b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_proofs.rs @@ -1,6 +1,10 @@ //! The four PUBLIC candidate proofs: they differ in the caches they load, in what they generate and in what //! they conclude; the owner, the teardown and the artifacts are shared (`native_down_pair_run.rs`). -use super::*; +use super::{ + Arm, BASELINE_SHA, Baseline, CAP, Check, DenseWeightCache, EvaluationExecution, Finish, FinishReason, + KAR_MTP_PROFILE, MODEL_DIGEST, ModelBinding, MoeFacts, MoeWeightCache, Owner, Proof, QwenForward, QwenSession, Rc, + RunCtx, Value, cache_json, candidate_windows, fivecase_runtime, json, merged, save, token_ids, with_counters, +}; use crate::qwen_forward::moe_expert::LoadedArms; use crate::qwen_forward::moe_weight_cache::LearnedMainWitness; use fivecase_runtime::FiveCaseReport; diff --git a/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_run.rs b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_run.rs index be19b50e..59481686 100644 --- a/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_run.rs +++ b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_run.rs @@ -1,6 +1,9 @@ //! Runs a `Proof` on the one loaded owner: generation, ordered teardown, the cleanup artifacts that survive a //! failed generation, and the assertions that follow every attempted teardown. -use super::*; +use super::{ + AssertUnwindSafe, DEVICE_BUDGET, Driver, Finish, Host, InheritedKarArchive, ModelBinding, Owner, OwnerCounters, + Proof, Rc, RunCtx, Teardown, Value, Witnessed, bank_json, catch_unwind, json, merged, resume_unwind, save, +}; use crate::qwen_forward::owner_wall_profile::{self, Sample}; const SCOPE: &str = diff --git a/crates/engine-qwen35-cuda/src/backend/native_down_pair_io.rs b/crates/engine-qwen35-cuda/src/backend/native_down_pair_io.rs index 519f7159..d2cee6ef 100644 --- a/crates/engine-qwen35-cuda/src/backend/native_down_pair_io.rs +++ b/crates/engine-qwen35-cuda/src/backend/native_down_pair_io.rs @@ -1,6 +1,9 @@ //! Files, environment, request framing and counters shared by the PUBLIC pair proofs. //! Included by `native_down_candidate_only.rs` and `native_down_public_pair.rs` (each owns its copy of the state). -use super::*; +use super::{ + CacheCounts, Digest, GenerationRequest, OpenOptions, OpenOptionsExt, Ordering, PathBuf, Read, Sha256, Tokenizer, + Value, Write, env, json, prepare_prompt, public_renderer, +}; pub(super) const ARTIFACT_CAP: usize = 16 * 1024 * 1024; pub(super) static ARTIFACT_BYTES: std::sync::atomic::AtomicUsize = std::sync::atomic::AtomicUsize::new(0); diff --git a/crates/engine-qwen35-cuda/src/backend/native_down_public_pair.rs b/crates/engine-qwen35-cuda/src/backend/native_down_public_pair.rs index fbe75e3e..7bb955cc 100644 --- a/crates/engine-qwen35-cuda/src/backend/native_down_public_pair.rs +++ b/crates/engine-qwen35-cuda/src/backend/native_down_public_pair.rs @@ -1,5 +1,25 @@ //! One-load private PUBLIC generation pair; actual owner timings, never HTTP timings. -use super::*; +use super::{ + Arc, AtomicBool, AtomicU64, BACKEND_API_VERSION, Backend, BackendCapabilities, BackendError, BackendIdentity, + CacheCounts, Clock, ContractError, DeferredTail, Digest, Driver, Duration, ErrorCode, EvaluationExecution, + EvaluationMeasurement, EvaluationObserver, ExperimentalConfig, ExpertSource, FRAME_LIMIT, FinishReason, Generation, + GenerationEvent, GenerationFailure, GenerationRequest, GenerationSink, GenerationStream, GenerationTerminal, + InferenceMode, InheritedKarArchive, InputBindingError, KAR_MTP_PROFILE, KarArchiveRef, KarExpertLevels, + KarExpertSource, KarExpertSourceConfig, LOAD_CONFIG_VERSION, LoadedModel, MODEL_DIGEST, MeasurementFailure, + ModelBinding, ModelDescriptor, MtpContinuation, Mutex, Ordering, OriginalServeChoice, OriginalServeMode, + OriginalServeOptions, PathBuf, PrefixCacheOptions, PrefixTail, QUEUE, Qwen4ExpArtifact, Qwen35Cuda, + Qwen35CudaStart, Rc, Receiver, RecentIds, RuntimeConfig, SHARD0, SHARD1, Sha256, Shared, SupportedModelTuple, + SyncSender, SystemClock, Tokenizer, Usage, VerifiedGgufFile, WindowWitness, emit_terminal, error, + generate_mtp_resume, load, measurement, owner, request, spawn, thread, +}; +#[cfg(feature = "preview-path")] +use super::{ + DenseWeightCache, Dimension, InputConstants, Instant, KarPleCache, MoeWeightCache, MtpDecoder, MtpWindowError, + MtpWindowSpec, OutputStage, Position, QwenForward, QwenSession, ResidentConversations, ResidentPolicy, + TargetStepProduct, TokenId, session, +}; +#[cfg(test)] +use super::prepare_prompt; use serde_json::{Value, json}; use std::{ env, diff --git a/crates/engine-qwen35-cuda/src/backend/native_down_public_pair/pair_arm.rs b/crates/engine-qwen35-cuda/src/backend/native_down_public_pair/pair_arm.rs index 7f8bd020..adfd81fd 100644 --- a/crates/engine-qwen35-cuda/src/backend/native_down_public_pair/pair_arm.rs +++ b/crates/engine-qwen35-cuda/src/backend/native_down_public_pair/pair_arm.rs @@ -1,6 +1,13 @@ //! One actual owner generation of the one-load PUBLIC pair on a fresh target/draft state: bounded stream //! consumer, failure artifact and the measurement record of a completed arm. -use super::*; +use super::{ + AtomicBool, CacheCounts, Duration, EvaluationExecution, EvaluationMeasurement, FRAME_LIMIT, FinishReason, + Generation, GenerationEvent, GenerationFailure, GenerationRequest, GenerationSink, GenerationStream, + GenerationTerminal, ModelBinding, MtpContinuation, QUEUE, Rc, Shared, SystemClock, Tokenizer, Usage, Value, + WindowWitness, cache, cache_json, emit_terminal, generate_mtp_resume, json, measurement, path, save, thread, +}; +#[cfg(feature = "preview-path")] +use super::{DenseWeightCache, KarPleCache, MoeWeightCache, OutputStage, QwenSession}; pub(super) struct Arm { pub(super) measurement: EvaluationMeasurement, diff --git a/crates/engine-qwen35-cuda/src/backend/native_down_public_pair/pair_run.rs b/crates/engine-qwen35-cuda/src/backend/native_down_public_pair/pair_run.rs index 6100c2e5..f11c8353 100644 --- a/crates/engine-qwen35-cuda/src/backend/native_down_public_pair/pair_run.rs +++ b/crates/engine-qwen35-cuda/src/backend/native_down_public_pair/pair_run.rs @@ -1,5 +1,13 @@ //! The one-load PUBLIC pair: sealed inputs, one owner load, four arms (two warm, two measured) and the artifacts. -use super::*; +use super::{ + ARTIFACT_BYTES, ARTIFACT_CAP, Arm, AssertUnwindSafe, AtomicBool, CAP, DEVICE_BUDGET, Driver, Duration, + EvaluationExecution, GenerationRequest, InheritedKarArchive, Inputs, KAR_MTP_PROFILE, MODEL_DIGEST, ModelBinding, + Mutex, Ordering, PathBuf, Qwen4ExpArtifact, Rc, SHARD0, SHARD1, Shared, Tokenizer, Value, VerifiedGgufFile, + catch_unwind, env, json, long_public_preflight, merged, metadata, ns, path, request, reserve_artifacts, + resume_unwind, save, sha, +}; +#[cfg(feature = "preview-path")] +use super::{DenseWeightCache, KarPleCache, MoeWeightCache, OutputStage}; use std::os::unix::fs::PermissionsExt; const NATIVE_POLICY: &str = "native64-same-dual-cache-retained-mtp-kv"; diff --git a/crates/engine-qwen35-cuda/src/backend/native_resident_mmq_model_proof.rs b/crates/engine-qwen35-cuda/src/backend/native_resident_mmq_model_proof.rs index d407e2ea..a58466d1 100644 --- a/crates/engine-qwen35-cuda/src/backend/native_resident_mmq_model_proof.rs +++ b/crates/engine-qwen35-cuda/src/backend/native_resident_mmq_model_proof.rs @@ -1,6 +1,8 @@ //! Private sole new changed-path model gate; actual source identity/load preserved. use super::combined_changed_boundary_proof::rig::{DEVICE_BUDGET, Owners, bind_pinned, require_opt_in}; -use super::*; +use super::{Driver, EvaluationExecution, ModelBinding, PathBuf, Rc}; +#[cfg(feature = "preview-path")] +use super::{MoeWeightCache, QwenForward}; use crate::qwen_forward::loaded_target_owners::LoadedTargetOwners; use std::{env, panic::resume_unwind}; diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve/runner/owner_run_steps.rs b/crates/engine-qwen35-cuda/src/backend/original_serve/runner/owner_run_steps.rs index 6312395b..1bb36299 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve/runner/owner_run_steps.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve/runner/owner_run_steps.rs @@ -1,8 +1,16 @@ //! The steps of the Original owner loop `run`: open and report the stack, admit and serve a generate command, //! sweep idle sessions and close everything; early exits stay in `run`. -#[allow(unused_imports)] -use super::*; +use super::{ + ActiveGuard, Admission, AtomicBool, BackendError, CapturedIds, ClientLink, Clock, Command, DeferredTail, Duration, + ErrorCode, FinishReason, ForwardError, GENERATION_TIMEOUT, GenerationEvent, GenerationFailure, GenerationRequest, + GenerationSink, GenerationTerminal, IdleSweep, Live, LoadPhase, LoadedModel, LoopCtx, ModelBinding, Ordering, + OriginalServeOptions, OriginalServeStack, PREFIX_SUMMARY, PathBuf, PhaseDurations, PrefixTail, QUEUE, Rc, Receiver, + ReopenEnv, Reply, RequestToServe, ServeDevice, ServeError, ServeFailure, ServeRequest, ServeStop, Shared, + StackConfig, SystemClock, TokenVocabulary, Tokenizer, Usage, Utf8Pending, context_fits, emit_terminal, exhausted, + generate, invalid, load_failure, meta_facts, open_error, prepare_prompt, publish_prefix_summary, stack_config, + unavailable, +}; use leleka_backend_api::GenerationStream; use leleka_cuda_driver::Context; use std::sync::Arc; diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve/tests.rs b/crates/engine-qwen35-cuda/src/backend/original_serve/tests.rs index b54f0e21..7fa58caa 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve/tests.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve/tests.rs @@ -1,6 +1,6 @@ //! Unit tests of `original_serve`. -use super::*; +use super::{ConfigFacts, OriginalServeChoice, OriginalServeMode, OriginalServeOptions, PathBuf, choose, context_fits}; fn facts() -> ConfigFacts { ConfigFacts { diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke.rs index e3e93465..6c37b5c1 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke.rs @@ -23,7 +23,23 @@ //! //! Output lines: `MEM-REPORT ` (the governor's full report), `MEM-CENSUS `, `MEM-SOAK ...`, `MEM-SHED //! ...`, `MEM-RESULT`. -use super::*; +use super::{ + Arc, AtomicBool, AtomicU64, BACKEND_API_VERSION, Backend, BackendCapabilities, BackendError, BackendIdentity, + CacheCounts, Clock, ContractError, DeferredTail, Digest, Driver, Duration, ErrorCode, EvaluationMeasurement, + EvaluationObserver, ExperimentalConfig, ExpertSource, FinishReason, GenerationEvent, GenerationRequest, + GenerationSink, GenerationStream, GenerationTerminal, InferenceMode, InheritedKarArchive, InputBindingError, + KarArchiveRef, KarExpertLevels, KarExpertSource, KarExpertSourceConfig, LOAD_CONFIG_VERSION, LoadedModel, + MeasurementFailure, ModelBinding, ModelDescriptor, Mutex, Ordering, OriginalServeChoice, OriginalServeMode, + OriginalServeOptions, PathBuf, PrefixCacheOptions, PrefixTail, Qwen4ExpArtifact, Qwen35Cuda, Qwen35CudaStart, Rc, + Receiver, RecentIds, RuntimeConfig, SHARD0, SHARD1, Sha256, SupportedModelTuple, SyncSender, SystemClock, + Tokenizer, Usage, VerifiedGgufFile, WindowWitness, config, probes, spawn, thread, +}; +#[cfg(feature = "preview-path")] +use super::{ + DenseWeightCache, Dimension, InputConstants, Instant, KarPleCache, MoeWeightCache, MtpDecoder, MtpWindowError, + MtpWindowSpec, OutputStage, Position, QwenForward, QwenSession, ResidentConversations, ResidentPolicy, + TargetStepProduct, TokenId, session, +}; use crate::qwen_forward::original_serve_stack::dbg_el; use crate::qwen_forward::{ original_serve_request::{ServeError, ServeRequest}, diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/leak.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/leak.rs index 5c6904fc..f7b0b69c 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/leak.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/leak.rs @@ -3,7 +3,7 @@ //! prefix store and the glibc heap, then fits the slope of each series against the request count after the //! warm-up and prints it with its confidence interval. use super::traffic::{Tally, TrafficRequest}; -use super::*; +use super::{Census, Mem, PathBuf, env, list, number, print_report}; const TSV_HEADER: &str = "t_s\treq\trss\trss_anon\trss_file\trss_shmem\tswap\tavail\tcached\tshmem_sys\t\ active_file\tinactive_file\tvram_used\tvram_acct\tprefix_store\tmalloc_arena\tmalloc_in_use\tmalloc_free\t\ diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/load.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/load.rs index 559e3017..cac55044 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/load.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/load.rs @@ -1,6 +1,10 @@ //! Loads the pinned model under the memory governor, opens the serve stack as production starts it and runs the //! scenario of `LELEKA_MEM_SCENARIO` on it. -use super::*; +use super::{ + CancelAt, Census, Driver, Governor, InheritedKarArchive, ModelBinding, OriginalServeStack, PathBuf, PrefixBudget, + PrefixConfig, Qwen4ExpArtifact, Rc, Rng, SHARD0, SHARD1, ServeError, StackConfig, Tokenizer, VerifiedGgufFile, + census, dbg_el, env, filler, guard, number, print_report, required_path, serve_one, text, +}; /// What the operator asked for. struct Plan { diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/probe.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/probe.rs index 7af75310..927c0a5f 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/probe.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/probe.rs @@ -1,5 +1,5 @@ //! Model-free probe of the sealed KAR memfd under the governor's residency guard. -use super::*; +use super::{Governor, InheritedKarArchive, env, guard, number, required_path}; /// One second of the probe: the memfd's swapped bytes, the cost of looking, and the swap counters since the last. fn probe_second(governor: &Governor, t: u64, last_in: &mut Option<(u64, u64)>) { diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/reader.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/reader.rs index 3a439ca3..4eee1020 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/reader.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/reader.rs @@ -1,7 +1,7 @@ //! The reader scenario: decode speed and the memfd's residency while a competing reader streams a big file //! through the page cache (what the Original did when it read the KAR file next to the memfd): phase A without the //! reader, B with it, C after. -use super::*; +use super::{Mem, NO_STOP, PathBuf, number, print_report, text}; use std::sync::Arc; use std::sync::atomic::{AtomicBool, AtomicU64, Ordering}; diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/shed.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/shed.rs index 6860327a..9932c0d2 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/shed.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/shed.rs @@ -1,6 +1,6 @@ //! The shed scenario: the prefix cache evicted, requests refused and the budget restored, driven by floors moved //! next to the memory the host has now, so the real limit is never approached. -use super::*; +use super::{Admission, Level, Mem, RequestShape, number, print_report}; use std::time::Duration; fn available() -> u64 { diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/soak.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/soak.rs index 60803b4b..1df06f3f 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/soak.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/soak.rs @@ -1,6 +1,6 @@ //! The soak scenario: mixed requests (cancels, refusals, long prompts, prefix-cache churn) judged flat after warm-up. use super::traffic::{Tally, TrafficRequest}; -use super::*; +use super::{Census, Mem, Tolerances, check_flat, list, number, print_report}; /// The knobs of the soak. struct Soak { diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/traffic.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/traffic.rs index 6c6fed19..f9a98683 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/traffic.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/traffic.rs @@ -1,6 +1,6 @@ //! The mixed traffic of the soak and the leak scenarios: sessions that grow by tool turns, big prompts, //! unshared prompts, cancels and requests the governor must refuse. -use super::*; +use super::{Admission, Mem, RequestShape, ServeError}; /// What the traffic has done so far. #[derive(Default)] diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_prefix_smoke.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_prefix_smoke.rs index c056b168..c706a7de 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_prefix_smoke.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_prefix_smoke.rs @@ -33,7 +33,23 @@ //! //! Run: `cargo test -p leleka-engine-qwen35-cuda -- --ignored --exact //! backend::original_serve_prefix_smoke::original_serve_prefix_cache_smoke`. -use super::*; +use super::{ + Arc, AtomicBool, AtomicU64, BACKEND_API_VERSION, Backend, BackendCapabilities, BackendError, BackendIdentity, + CacheCounts, Clock, ContractError, DeferredTail, Digest, Driver, Duration, ErrorCode, EvaluationMeasurement, + EvaluationObserver, ExperimentalConfig, ExpertSource, FinishReason, GenerationEvent, GenerationRequest, + GenerationSink, GenerationStream, GenerationTerminal, InferenceMode, InheritedKarArchive, InputBindingError, + KarArchiveRef, KarExpertLevels, KarExpertSource, KarExpertSourceConfig, LOAD_CONFIG_VERSION, LoadedModel, + MeasurementFailure, ModelBinding, ModelDescriptor, Mutex, Ordering, OriginalServeChoice, OriginalServeMode, + OriginalServeOptions, PathBuf, PrefixCacheOptions, PrefixTail, Qwen4ExpArtifact, Qwen35Cuda, Qwen35CudaStart, Rc, + Receiver, RecentIds, RuntimeConfig, SHARD0, SHARD1, Sha256, SupportedModelTuple, SyncSender, SystemClock, + Tokenizer, Usage, VerifiedGgufFile, WindowWitness, config, probes, request, +}; +#[cfg(feature = "preview-path")] +use super::{ + DenseWeightCache, Dimension, InputConstants, Instant, KarPleCache, MoeWeightCache, MtpDecoder, MtpWindowError, + MtpWindowSpec, OutputStage, Position, QwenForward, QwenSession, ResidentConversations, ResidentPolicy, + TargetStepProduct, TokenId, session, +}; use crate::qwen_forward::original_serve_stack::dbg_el; use crate::qwen_forward::{ original_serve_request::{ServeError, ServeRequest}, diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_prefix_smoke/extras.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_prefix_smoke/extras.rs index a5c81bbd..f946e8fa 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_prefix_smoke/extras.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_prefix_smoke/extras.rs @@ -1,7 +1,7 @@ //! What the prefix-cache smoke does around the served requests: the per-request accounting, the verification //! against a full read, the summary, the pool protocol on the live cache and the cancellation checks. use super::run::Pfx; -use super::*; +use super::{CancelAt, ServeError, Served, env, filler, ids, mem_available_mib, rss_mib, serve_one}; /// What the served requests added up to. #[derive(Default)] diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_prefix_smoke/run.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_prefix_smoke/run.rs index e897abef..7d30d4cf 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_prefix_smoke/run.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_prefix_smoke/run.rs @@ -1,7 +1,11 @@ //! Loads the pinned model, opens the stack in the mode asked for and serves the scripted workload. use super::extras::{RequestAt, Tally}; use super::workload::{Plan, Workload}; -use super::*; +use super::{ + CancelAt, Driver, InheritedKarArchive, ModelBinding, OriginalServeStack, PathBuf, PrefixBudget, PrefixConfig, + Qwen4ExpArtifact, Rc, SHARD0, SHARD1, ServeError, Served, StackConfig, Tokenizer, VerifiedGgufFile, dbg_el, env, + filler, mem_available_mib, number, required_path, rss_mib, serve_one, text, workload, +}; /// The pinned tokenizer and EOS, the KAR archive and the binding with its expert source. struct Pinned { diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_smoke.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_smoke.rs index e290b7b6..c46585b2 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_smoke.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_smoke.rs @@ -25,7 +25,25 @@ //! While the verifier window producers listed in `UNBOUND_PRODUCERS` are unbound the stack refuses to open //! with the first missing producer's name; that refusal is the expected result of this smoke until they land. use super::super::qwen_forward::original_serve_stack::dbg_el; -use super::*; +use super::{ + Arc, AtomicBool, AtomicU64, BACKEND_API_VERSION, Backend, BackendCapabilities, BackendError, BackendIdentity, + CacheCounts, Clock, ContractError, DeferredTail, Digest, Driver, Duration, ErrorCode, EvaluationMeasurement, + EvaluationObserver, ExperimentalConfig, ExpertSource, FinishReason, GenerationEvent, GenerationRequest, + GenerationSink, GenerationStream, GenerationTerminal, InferenceMode, InheritedKarArchive, InputBindingError, + KarArchiveRef, KarExpertLevels, KarExpertSource, KarExpertSourceConfig, LOAD_CONFIG_VERSION, LoadedModel, + MeasurementFailure, ModelBinding, ModelDescriptor, Mutex, Ordering, OriginalServeChoice, OriginalServeMode, + OriginalServeOptions, PathBuf, PrefixCacheOptions, PrefixTail, Qwen4ExpArtifact, Qwen35Cuda, Qwen35CudaStart, Rc, + Receiver, RecentIds, RuntimeConfig, SHARD0, SHARD1, Sha256, SupportedModelTuple, SyncSender, SystemClock, + Tokenizer, Usage, VerifiedGgufFile, WindowWitness, config, load, original_prompt, probes, +}; +#[cfg(all(test, target_arch = "x86_64"))] +use super::original_serve_arms; +#[cfg(feature = "preview-path")] +use super::{ + DenseWeightCache, Dimension, InputConstants, Instant, KarPleCache, MoeWeightCache, MtpDecoder, MtpWindowError, + MtpWindowSpec, OutputStage, Position, QwenForward, QwenSession, ResidentConversations, ResidentPolicy, + TargetStepProduct, TokenId, +}; use crate::qwen_forward::{ original_serve_request::{RequestSampling, ServeError, ServeRequest}, original_serve_stack::{OriginalServeStack, StackConfig}, diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_conv.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_conv.rs index 79d5369e..247525d6 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_conv.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_conv.rs @@ -1,6 +1,9 @@ //! The conversation cache on the real model: the resume smoke, and the requests, the timing and the chunk //! comparison the coverage smoke shares. -use super::*; +use super::{ + OriginalServeStack, PROMPT, PathBuf, ServeError, StackConfig, Tokenizer, dbg_el, env, env_or, open_pinned, + open_stack, optin, request, with_context, +}; /// What one request of the conversation smokes returned. pub(super) struct Served { diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_coverage.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_coverage.rs index 2532fc21..3c3c22b8 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_coverage.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_coverage.rs @@ -1,7 +1,10 @@ //! Coverage of the conversation cache on the real model (documented on //! `original_serve_conversation_coverage_smoke`): every resumed request is compared token for token with the //! same request read from the empty prompt; every check prints a `CONV-CHECK name ok|FAIL` line. -use super::*; +use super::{ + CancelAfter, OriginalServeStack, PROMPT, PathBuf, PromptRequest, ServeError, Served, StackConfig, Tokenizer, + agent_sampler, dbg_el, env, env_or, ids, open_pinned, open_stack, optin, same_chunks, serve_once, with_context, +}; /// The knobs of the coverage smoke. struct Knobs { diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_long.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_long.rs index dfbc1f2c..5e2c4335 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_long.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_long.rs @@ -1,6 +1,11 @@ //! Long-context smoke of the streamed INT8 KV: one greedy request over a prompt far longer than the resident //! window (documented on `original_serve_long_context_streamed_kv_smoke`). -use super::*; +use super::{ + OriginalServeStack, PathBuf, ServeRequest, StackConfig, Tokenizer, collect, dbg_el, env, env_or, ids, number, + open_pinned, open_stack, request, with_context, +}; +#[cfg(all(test, target_arch = "x86_64"))] +use super::original_serve_arms; use std::time::Instant; const COLORS: [&str; 8] = ["amber", "blue", "crimson", "green", "grey", "ivory", "orange", "violet"]; diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_main.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_main.rs index 2488c776..8c067990 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_main.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_main.rs @@ -1,6 +1,25 @@ //! The main smoke: greedy twice across a reset, a sampled request, a cancellation, the optional parity corpus //! and a short prompt on the scalar draft-KV path. -use super::*; +use super::{ + Arc, AtomicBool, AtomicU64, BACKEND_API_VERSION, Backend, BackendCapabilities, BackendError, BackendIdentity, + CacheCounts, Clock, ContractError, DeferredTail, Digest, Driver, Duration, ErrorCode, EvaluationMeasurement, + EvaluationObserver, ExperimentalConfig, ExpertSource, FinishReason, GenerationEvent, GenerationRequest, + GenerationSink, GenerationStream, GenerationTerminal, InferenceMode, InheritedKarArchive, InputBindingError, + KarArchiveRef, KarExpertLevels, KarExpertSource, KarExpertSourceConfig, LOAD_CONFIG_VERSION, LoadedModel, + MeasurementFailure, ModelBinding, ModelDescriptor, Mutex, Ordering, OriginalServeChoice, OriginalServeMode, + OriginalServeOptions, OriginalServeStack, PROMPT, PathBuf, PrefixCacheOptions, PrefixTail, Qwen4ExpArtifact, + Qwen35Cuda, Qwen35CudaStart, Rc, Receiver, RecentIds, RuntimeConfig, ServeError, ServeRequest, Sha256, StackConfig, + SupportedModelTuple, SyncSender, SystemClock, Tokenizer, Usage, VerifiedGgufFile, WindowWitness, agent_sampler, + collect, dbg_el, env, env_or, ids, open_pinned, open_stack, optin, report_timing, request, with_context, +}; +#[cfg(all(test, target_arch = "x86_64"))] +use super::original_serve_arms; +#[cfg(feature = "preview-path")] +use super::{ + DenseWeightCache, Dimension, InputConstants, Instant, KarPleCache, MoeWeightCache, MtpDecoder, MtpWindowError, + MtpWindowSpec, OutputStage, Position, QwenForward, QwenSession, ResidentConversations, ResidentPolicy, + TargetStepProduct, TokenId, +}; mod corpus; diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_main/corpus.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_main/corpus.rs index 64f46d14..7219897f 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_main/corpus.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_main/corpus.rs @@ -1,7 +1,9 @@ //! The parity corpus of the main smoke: every line of `LELEKA_SMOKE_PROMPTS` is tokenized with the verified //! tokenizer, served greedily for `LELEKA_SMOKE_MAX_NEW` tokens (default 64) and printed as ids so the Original //! can be run on the same ids. -use super::*; +use super::{ServeError, ServeRequest, Smoke, Tokenizer, agent_sampler, env, env_or, report_timing}; +#[cfg(all(test, target_arch = "x86_64"))] +use super::original_serve_arms; use crate::qwen_forward::{ original_serve_engine::ServeOutcome, original_serve_request::{RequestSampling, original_stop_tokens}, diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_stack.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_stack.rs index e57c7c39..4b6a3cc2 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_stack.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_stack.rs @@ -1,6 +1,9 @@ //! The pinned model, the Context and the Original serve stack the smokes of `backend_original_serve_smoke.rs` //! run on, and the helpers they share. -use super::*; +use super::{ + Driver, InheritedKarArchive, ModelBinding, OriginalServeStack, Qwen4ExpArtifact, Rc, SHARD0, SHARD1, ServeError, + ServeRequest, StackConfig, Tokenizer, VerifiedGgufFile, dbg_el, env, required_path, +}; use crate::qwen_forward::original_serve_engine::ServeOutcome; use std::str::FromStr; diff --git a/crates/engine-qwen35-cuda/src/backend/profile_tests.rs b/crates/engine-qwen35-cuda/src/backend/profile_tests.rs index e942643a..1986d684 100644 --- a/crates/engine-qwen35-cuda/src/backend/profile_tests.rs +++ b/crates/engine-qwen35-cuda/src/backend/profile_tests.rs @@ -1,7 +1,10 @@ //! The ranked expert profile read through the WeightSource port: the refusals and their order are the ones of the //! former file read, and the double of the port stands in for the file. use super::sources::{read_pinned_profile, read_ranked_expert_profile}; -use super::*; +use super::{ + BackendError, Digest, ErrorCode, RANKED_EXPERT_PROFILE_BYTES, RANKED_EXPERT_PROFILE_SHA, RankedExpertProfileSource, + Sha256, +}; use leleka_model_format::weight_source::MemWeightSource; fn hex(bytes: &[u8]) -> String { diff --git a/crates/engine-qwen35-cuda/src/backend/resident_mmq_model_proof.rs b/crates/engine-qwen35-cuda/src/backend/resident_mmq_model_proof.rs index 6d2f00d9..83887271 100644 --- a/crates/engine-qwen35-cuda/src/backend/resident_mmq_model_proof.rs +++ b/crates/engine-qwen35-cuda/src/backend/resident_mmq_model_proof.rs @@ -1,6 +1,8 @@ //! Private sole new changed-path model gate; actual source identity/load preserved. use super::combined_changed_boundary_proof::rig::{DEVICE_BUDGET, MOE_REFUSAL, Owners, bind_pinned, require_opt_in}; -use super::*; +use super::{Driver, PathBuf, Rc}; +#[cfg(feature = "preview-path")] +use super::{MoeWeightCache, QwenForward}; use crate::qwen_forward::loaded_target_owners::LoadedTargetOwners; use std::{env, panic::resume_unwind}; diff --git a/crates/engine-qwen35-cuda/src/backend/serve_run.rs b/crates/engine-qwen35-cuda/src/backend/serve_run.rs index 5b432cc8..68efa4f5 100644 --- a/crates/engine-qwen35-cuda/src/backend/serve_run.rs +++ b/crates/engine-qwen35-cuda/src/backend/serve_run.rs @@ -1,5 +1,9 @@ //! Running one admitted generation: the Generation step context and the choice of the generation loop. -use super::*; +use super::{ + Admitted, Exchange, FinishReason, Generation, GenerationFailure, InferenceMode, Job, MtpContinuation, Ordering, + QwenSession, Serving, Usage, clock_seed, generate, generate_mtp_resume, invalid, measurement, request_sampler, + unavailable, unsupported, +}; use std::cell::RefCell; pub(super) type Sampler = Result, leleka_sampler_ref::SamplingError>; diff --git a/crates/engine-qwen35-cuda/src/backend/singleload_proof.rs b/crates/engine-qwen35-cuda/src/backend/singleload_proof.rs index 32ef4c6a..55c99dcc 100644 --- a/crates/engine-qwen35-cuda/src/backend/singleload_proof.rs +++ b/crates/engine-qwen35-cuda/src/backend/singleload_proof.rs @@ -4,7 +4,9 @@ use super::combined_changed_boundary_proof::rig::{ DEVICE_BUDGET, MOE_REFUSAL, Owners, PinnedTokenizer, bind_pinned, bind_pinned_with_tokenizer, require_opt_in, }; -use super::*; +use super::{Driver, ModelBinding, PathBuf, Rc, Tokenizer}; +#[cfg(feature = "preview-path")] +use super::{MoeWeightCache, QwenForward, QwenSession}; use crate::qwen_forward::loaded_target_owners::LoadedTargetOwners; use std::{ env, diff --git a/crates/engine-qwen35-cuda/src/backend/tests.rs b/crates/engine-qwen35-cuda/src/backend/tests.rs index 33cd5052..1477b82b 100644 --- a/crates/engine-qwen35-cuda/src/backend/tests.rs +++ b/crates/engine-qwen35-cuda/src/backend/tests.rs @@ -1,4 +1,15 @@ -use super::*; +use super::{ + Active, ActiveGuard, Arc, AtomicBool, Backend, BackendError, Command, DeferredTail, Digest, ErrorCode, + EvaluationExecution, FRAME_LIMIT, GenerationRequest, InferenceMode, KAR_LOAD_REPLY_TIMEOUT, KAR_PROFILE, + LOAD_CONFIG_VERSION, LoadedModel, MODE_DIGEST, MODEL_DIGEST, ModelDescriptor, Mutex, OPTIMIZED_EXECUTION, + OUTPUT_LIMIT, Ordering, PROMPT_LIMIT, Proxy, QUEUE, QUEUED_OWNERS_EXECUTION, RANKED_EXPERT_PROFILE_SHA, + REPLY_TIMEOUT, RecentIds, RuntimeConfig, SHARD0, Sha256, Shared, SyncSender, Tokenizer, Utf8Pending, + kar_expert_mode_digest, kar_mode_digest, load_reply_timeout, mpsc, optimized_execution_digest, + pinned_model_descriptor, prepare_prompt, queued_owners_execution_digest, request_sampler, validate_handle, + validate_kar_selection, validate_load, validate_request, +}; +#[cfg(feature = "preview-path")] +use super::{Dimension, InputConstants, Position, native_position}; #[test] fn queued_owner_identity_is_distinct_and_binds_profile_and_actual_bound_mode() { let old_fields = [ diff --git a/crates/engine-qwen35-cuda/src/conversation/resident/tests.rs b/crates/engine-qwen35-cuda/src/conversation/resident/tests.rs index 05b42faf..7bf82d4c 100644 --- a/crates/engine-qwen35-cuda/src/conversation/resident/tests.rs +++ b/crates/engine-qwen35-cuda/src/conversation/resident/tests.rs @@ -1,6 +1,6 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). -use super::*; +use super::{ResidentConversations, ResidentPolicy, ResumeSource}; fn policy(budget_gib: usize, slots: usize) -> ResidentPolicy { ResidentPolicy { budget_bytes: budget_gib << 30, slots, fixed_bytes: 100 << 20, bytes_per_token: 20_000 } diff --git a/crates/engine-qwen35-cuda/src/experimental/tests.rs b/crates/engine-qwen35-cuda/src/experimental/tests.rs index 0a52a15e..0cfc2d99 100644 --- a/crates/engine-qwen35-cuda/src/experimental/tests.rs +++ b/crates/engine-qwen35-cuda/src/experimental/tests.rs @@ -1,6 +1,9 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). -use super::*; +use super::{ + ExperimentalConfig, ExperimentalError, KvFormat, Mode, OptIn, PathBuf, Program, ensure_consumed, + load_control_vector_tables, mode_digest, plan, pool_bytes, +}; fn cfg(modes: &[Mode], resident: i64) -> ExperimentalConfig { let mut opt_in = OptIn::default(); diff --git a/crates/engine-qwen35-cuda/src/memory_governor/page_cache.rs b/crates/engine-qwen35-cuda/src/memory_governor/page_cache.rs index 0f087edc..bbe73443 100644 --- a/crates/engine-qwen35-cuda/src/memory_governor/page_cache.rs +++ b/crates/engine-qwen35-cuda/src/memory_governor/page_cache.rs @@ -1,6 +1,9 @@ //! Page-cache release after the load (`drop_file_cache`), moved out of `memory_governor` by STRA-338 (size). -use super::*; +use super::{ + BackendError, CacheWish, DeviceSample, Entry, EnvSource, FixedItem, Governor, GovernorConfig, HostFacts, HostProc, + KarForm, Mutex, OpenStage, PlanInput, SamplerGuard, Settings, Space, VramFacts, When, +}; /// Give back the page cache the load created: the shards were read once to verify and to copy the resident bank, and /// nothing reads those pages again (the bank is a RAM copy). Left in place they are the cache pressure that pushed the diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/gdn/tests.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/gdn/tests.rs index 1f0f5546..152e1f18 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/gdn/tests.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/gdn/tests.rs @@ -1,6 +1,6 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). -use super::*; +use super::{E, NATIVE_EPSILON, TensorSignature, block_range, descriptor, exact_bf16, kind}; #[test] fn epsilon_is_exact_original_layer_operand() { assert_eq!(NATIVE_EPSILON.to_bits(), 0x358637bd); diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/gr/tests.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/gr/tests.rs index f8c3d7b7..7b1c8b58 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/gr/tests.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/gr/tests.rs @@ -1,6 +1,6 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). -use super::*; +use super::{GrRole, InputBindingError, TensorSignature, exact_bf16, role_set, validate_descriptor}; #[test] fn gr_binding_accepts_only_exact_finite_bf16_containers() { for bits in [0, 0x80000000, 0x3f800000, 0x00010000, 0x7f7f0000] { diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/backing.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/backing.rs index 144d6228..628f694c 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/backing.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/backing.rs @@ -1,7 +1,11 @@ //! Methods of `OwnedCopy`: `create`, `writer`, `owns_directory`, `owns_file` and 1 more. //! Implements `Drop for OwnedCopy`. Functions: `inode`, `regular`, `root`, `copy_exact` and 8 more. -use super::*; +use super::{ + BindingIdentity, DENSE_BYTES, DESCRIPTORS, Dense, Descriptor, EXPERT_BLOB, EXPERT_BYTES, FILE_PINS, File, + INDEX_BYTES, INDEX_LIMIT, InputBindingError, InputResult, MAX_READ, MAX_ROWS, ModelBinding, MtpExpertMatrix, + MtpExpertRef, MtpIndex, MtpKind, MtpRole, MtpRows, MtpWeights, Path, read_exact_range, read_expert_rows, +}; use sha2::{Digest, Sha256}; use std::io::Read; use std::os::unix::fs::{DirBuilderExt, MetadataExt, OpenOptionsExt, PermissionsExt}; diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/mtp_weight_reads.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/mtp_weight_reads.rs index ad60e93f..fe25a4b9 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/mtp_weight_reads.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/mtp_weight_reads.rs @@ -1,7 +1,11 @@ //! The reads of the MTP weights: dense rows, expert rows and the binding identity check. -#[allow(unused_imports)] -use super::*; +use super::{ + BindingIdentity, DENSE_BYTES, DESCRIPTORS, Dense, Descriptor, EXPERT_BLOB, EXPERT_BYTES, FILE_PINS, File, + INDEX_BYTES, INDEX_LIMIT, InputBindingError, InputResult, MAX_READ, MAX_ROWS, ModelBinding, MtpExpertMatrix, + MtpExpertRef, MtpIndex, MtpKind, MtpRole, MtpRows, MtpWeights, Path, backing, descriptor, read_exact_range, + read_expert_rows, row_range, validate_numeric, +}; impl MtpWeights { /// Operator-only fixed profile. The copy owns an unnamed read-only inode for diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/read_expert_rows.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/read_expert_rows.rs index 47521e8b..74665dbd 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/read_expert_rows.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/read_expert_rows.rs @@ -1,8 +1,11 @@ //! Functions: `read_expert_rows`, `read_expert_row`, `row_range`, `allocate` and 3 more. //! Split out of `mtp` to keep its files under the line limit. -#[allow(unused_imports)] -use super::*; +use super::{ + BindingIdentity, DENSE_BYTES, DESCRIPTORS, Dense, Descriptor, EXPERT_BLOB, EXPERT_BYTES, FILE_PINS, File, + INDEX_BYTES, INDEX_LIMIT, InputBindingError, InputResult, MAX_READ, MAX_ROWS, ModelBinding, MtpExpertMatrix, + MtpExpertRef, MtpIndex, MtpKind, MtpRole, MtpRows, MtpWeights, Path, backing, +}; pub(super) fn read_expert_rows( experts: &File, diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/tests.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/tests.rs index ba1425e8..0eecf459 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/tests.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/tests.rs @@ -1,6 +1,9 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). -use super::*; +use super::{ + BindingIdentity, DESCRIPTORS, INDEX_LIMIT, InputBindingError, MtpIndex, MtpKind, MtpRole, interleave_q2, row_range, + rt_dense_name, rt_dense_roles, rt_dense_shape, validate_identity, validate_numeric, +}; fn index() -> String { DESCRIPTORS .iter() diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/validate_ple_descriptor.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/validate_ple_descriptor.rs index f9e30568..fde7c92c 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/validate_ple_descriptor.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/validate_ple_descriptor.rs @@ -1,8 +1,12 @@ //! Methods of `InputConstants`: `test_fixture`. Methods of `BindingIdentity`: `test_identity`. //! Functions: `validate_ple_descriptor`, `bind_layers`, `bind_layer`. -#[allow(unused_imports)] -use super::*; +use super::{ + BoundLayer, BoundLayerKind, GlobalRole, InputBindingError, InputResult, LayerRole, PLE_ROWS, Qwen4ExpArtifact, + TensorRole, +}; +#[cfg(test)] +use super::{BindingIdentity, InputConstants, Rc}; pub(super) fn validate_ple_descriptor(artifact: &Qwen4ExpArtifact) -> InputResult<()> { let ple = artifact diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/inherited_kar_archive.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/inherited_kar_archive.rs index d2b5d9e6..16ee32f6 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/inherited_kar_archive.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/inherited_kar_archive.rs @@ -1,8 +1,11 @@ //! Methods of `InheritedKarArchive`: `open`, `open_sparse`, `open_sparse`, `sparse_extents` and 7 more. //! Functions: `open_sealed_archive_fd`, `open_read_only_archive`, `check_read_only_archive`, `reopen_read_only_archi... -#[allow(unused_imports)] -use super::*; +use super::{ + ARCHIVE_DIGEST, BindingIdentity, File, InheritedKarArchive, InputBindingError, InputResult, KarError, + KarPlePartProvenance, KarPleProfile, KarPleProfileSpec, PINNED_ARCHIVE_BYTES, PLE_ROWS, PROVENANCE_DIGEST, Path, + PathBuf, RefCell, SparseArchive, VerifiedKarPleArtifact, private_copy, +}; use leleka_model_format::weight_source::{BackingKind, FileWeightSource, Verification, WeightIdentity}; #[cfg(test)] diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/load_pinned_inherited_archive.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/load_pinned_inherited_archive.rs index 9d2540d3..5be59a2a 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/load_pinned_inherited_archive.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/load_pinned_inherited_archive.rs @@ -1,8 +1,12 @@ //! Methods of `KarRowPacket`: `payload`, `partition`. Methods of `KarRowReader`: `read_rows`. //! Functions: `open_archive_reader`, `load_pinned_inherited_archive`, `log_startup_read`, `load_pinned_inherited_arc... -#[allow(unused_imports)] -use super::*; +use super::{ + BindingIdentity, File, InheritedKarArchive, InputBindingError, InputResult, KarError, KarPleBinding, + KarPlePartProvenance, KarPleProfile, KarPleProfileSpec, KarRowPacket, KarRowReader, LoadPhase, NATIVE_DIGESTS, + PINNED_ARCHIVE_BYTES, PLE_ROWS, PROVENANCE_DIGEST, Path, PathBuf, RefCell, VerifiedKarPleArtifact, + open_sealed_archive_fd, pinned_profile, reopen_read_only_archive, verify_open_provenance, +}; /// The read handle of the inherited archive: a read-only reopen of the file, or the sealed memfd itself. #[cfg(target_os = "linux")] diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/pinned_profile.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/pinned_profile.rs index 54a64455..eb2263ce 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/pinned_profile.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/pinned_profile.rs @@ -1,8 +1,12 @@ //! Methods of `InheritedKarArchive`: `expert_capture_observation`. //! Functions: `pinned_profile`, `pinned_parts`, `pinned_profile_spec`, `load_pinned_archive` and 3 more. -#[allow(unused_imports)] -use super::*; +use super::{ + ARCHIVE_DIGEST, BindingIdentity, File, InheritedKarArchive, InputBindingError, InputResult, KarError, + KarPlePartProvenance, KarPleProfile, KarPleProfileSpec, LoadPhase, NATIVE_DIGESTS, PART0_F32_DIGEST, + PART1_F32_DIGEST, PLE_ROWS, PROVENANCE_DIGEST, Path, PathBuf, RefCell, VIRTUAL_F32_DIGEST, VerifiedKarPleArtifact, + error, input_failure, kar_failure, private_copy, +}; /// Candidate expectations from independently verified v4 conversion receipts /// d51353be and 0d8a4a52. Construction reads no archive and grants no serving diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/pinned_profile_tests.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/pinned_profile_tests.rs index e7c24590..765a889f 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/pinned_profile_tests.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/pinned_profile_tests.rs @@ -1,7 +1,11 @@ //! Implements `Write for BrokenSink`. //! Functions: `diagnostic_cases`, `assert_kar_diagnostic_redacts`, `assert_input_diagnostic_survives_broken_sink`, `... -use super::*; +use super::{ + BindingIdentity, File, InputBindingError, InputResult, KarError, KarPlePartProvenance, KarPleProfile, + KarPleProfileSpec, LoadPhase, NATIVE_DIGESTS, PLE_ROWS, Path, PathBuf, RefCell, VerifiedKarPleArtifact, error, + input_diagnostic, kar_diagnostic, pinned_profile, pinned_profile_spec, +}; #[cfg(not(target_os = "windows"))] struct BrokenSink; diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/private_copy/checked_reader.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/private_copy/checked_reader.rs index 15ca77af..c38b579c 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/private_copy/checked_reader.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/private_copy/checked_reader.rs @@ -1,8 +1,10 @@ //! Functions: `checked_reader`, `copy_exact`, `copy_exact_reporting`, `copy_buffer` and 1 more. //! Split out of `private_copy` to keep its files under the line limit. -#[allow(unused_imports)] -use super::*; +use super::{ + COPY_BUFFER, File, InputBindingError, InputResult, IoPhase, LoadPhase, Metadata, MetadataExt, OpenOptions, + OpenOptionsExt, Path, Read, SOURCE_FLAGS, Seek, Write, inode, input_failure, phase_error, report_io, +}; #[cfg(target_os = "macos")] pub(super) fn checked_reader(own: &OwnedCopy, bytes: u64) -> InputResult { diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/private_copy/inode.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/private_copy/inode.rs index c08842b8..2a04e19b 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/private_copy/inode.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/private_copy/inode.rs @@ -1,8 +1,10 @@ //! Methods of `OwnedCopy`: `create`, `created`, `writer`, `detach` and 2 more. Implements `Drop for OwnedCopy`. //! Functions: `inode`, `diagnostic`, `report_io`, `phase_error` and 8 more. -#[allow(unused_imports)] -use super::*; +use super::{ + File, Inode, InputBindingError, InputResult, IoPhase, LoadPhase, Metadata, MetadataExt, OpenOptions, + OpenOptionsExt, Path, Read, SOURCE_FLAGS, Seek, Write, checked_reader, copy_exact, input_failure, +}; pub(super) fn inode(meta: &Metadata) -> Inode { (meta.dev(), meta.ino()) diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/workspaces.rs b/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/workspaces.rs index 8de5cecf..e6ac1bf0 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/workspaces.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/workspaces.rs @@ -1,8 +1,12 @@ //! The lazily created workspaces of the dense weight cache, moved out of it by STRA-338 (size): consecutive owners, //! declared in the order the cache dropped them, so the drop order is unchanged. -#[allow(unused_imports)] -use super::*; +use super::{ + DeviceBuffer, GdnInputScratch, GrBatchInjectWorkspace, GrScratch, QkScratch, QsaAttentionScratch, QsaIndexKeyCache, + QsaInputScratch, QsaSelectedCache, Rc, RefCell, RouterScratch, +}; +#[cfg(test)] +use super::Cell; /// Every scratch owner of the cache that starts empty (`None` or an empty list) and is filled on first use. #[derive(Default)] diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk.rs index 81d4e73a..095553e6 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk.rs @@ -3,7 +3,14 @@ //! attention, then completes the whole FFN GR bank. Qualification is pending. #![allow(dead_code)] use super::super::session::chunk::QwenChunkTxn; -use super::*; +use super::{ + BindingIdentity, BoundLayerKind, DenseWeightCache, Dimension, Error, ForwardPhase, GdnStage, GrRead, GrStage, + InjectedResidual, InputStage, KarPleCache, LayerEntry, LayerId, ModelBinding, MoeExpertStage, MoeRouteStage, + MoeWeightCache, OutputStage, Position, QsaAttentionStage, QsaIndexStage, QsaPrepareRequest, QwenForward, + QwenSession, QwenStepTxn, Result, Stage, StepCaches, StepPurpose, StepRequest, TargetStepOrigin, TargetStepProduct, + TokenId, VerificationChunk, VerificationSource, WindowCaches, diagnose, prefill_chunk, + prepare_layer_attention_micro, read_layer_attention, validate_layer_plan, +}; #[derive(Clone, Copy)] enum ChunkMoePolicy { Native, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/check_chunk_on_loaded.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/check_chunk_on_loaded.rs index 98430e36..cc2806e2 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/check_chunk_on_loaded.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/check_chunk_on_loaded.rs @@ -2,8 +2,10 @@ //! Methods of `Rig`: `snapshot`, `prefill`, `step_final`, `prefill_chunk` and 7 more. #![cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -#[allow(unused_imports)] -use super::*; +use super::{ + DenseWeightCache, Dimension, Error, KarPleCache, ModelBinding, MoeWeightCache, OutputStage, Position, + PrefillChunkInputs, QwenForward, QwenSession, Result, Stage, TokenId, +}; use crate::qwen_forward::executor::{PrefillStepProduct, StepCaches, StepRequest, TargetStepProduct}; use crate::qwen_forward::loaded_target_owners::LoadedTargetOwners; use crate::qwen_forward::mtp::KnownNext; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/mmq_evaluation.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/mmq_evaluation.rs index 18b11396..fa276bda 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/mmq_evaluation.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/mmq_evaluation.rs @@ -1,5 +1,9 @@ //! Only the explicitly selected new full-model MMQ gate. Old observers unchanged. -use super::*; +use super::{ + ChunkMoePolicy, DenseWeightCache, Dimension, Error, KarPleCache, ModelBinding, MoeWeightCache, OutputStage, + Position, PrefillChunkInputs, QwenForward, QwenSession, Result, Stage, StepCaches, StepRequest, TargetStepProduct, + TokenId, +}; use crate::qwen_forward::loaded_target_owners::LoadedTargetOwners; use crate::qwen_forward::mtp::KnownNext; use crate::qwen_forward::mtp::MtpChunkNumericSnapshot; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/native_mmq_evaluation.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/native_mmq_evaluation.rs index d454697f..d363b188 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/native_mmq_evaluation.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/native_mmq_evaluation.rs @@ -1,6 +1,6 @@ //! Separate native-certified activation model observer. Original failed observer unchanged. use super::mmq_evaluation::{ChunkExact, ChunkRun, MmqRun, Observation, pos}; -use super::*; +use super::{QwenForward, TokenId}; use crate::qwen_forward::loaded_target_owners::LoadedTargetOwners; use crate::qwen_forward::mtp_decode::MtpDecoder; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward.rs index 99137de5..be175d50 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward.rs @@ -1,8 +1,17 @@ //! Groups the submodules `joint_chunk`, `prefill_chunk_cached_windowed`, `prefill_chunk_native_windowed` and 1 more. //! Split out of `prefill_chunk` to keep its files under the line limit. -#[allow(unused_imports)] -use super::*; +use super::{ + AttentionHandoff, BindingIdentity, BoundLayerKind, ChunkMoePolicy, DenseWeightCache, Dimension, Error, + ForwardPhase, GdnStage, GrRead, GrStage, InjectedResidual, InputStage, KarPleCache, LayerEntry, LayerId, MicroEnv, + ModelBinding, MoeExpertStage, MoeRouteStage, MoeWeightCache, OutputStage, Position, QsaAttentionStage, + QsaIndexStage, QsaPrepareRequest, QwenChunkTxn, QwenForward, QwenSession, QwenStepTxn, Result, Stage, StepCaches, + StepPurpose, StepRequest, TargetStepOrigin, TargetStepProduct, TokenId, VerificationChunk, VerificationSource, + WindowCaches, chunk_diagnostic, diagnose, prefill_chunk, prepare_layer_attention_micro, prepare_micro_ffn_rows, + prepare_q6_layer_columns, qwen_forward, read_chunk_attention_ffn, read_layer_attention, validate_layer_plan, +}; +#[cfg(all(test, target_arch = "x86_64"))] +use super::{check_chunk_on_loaded, window_numeric}; mod joint_chunk; #[allow(unused_imports)] diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned.rs index f7314c4c..4db0ebcc 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned.rs @@ -1,8 +1,18 @@ //! Methods of `ChunkEnv`: `new`, `with_boundary`, `native_prompt`. Methods of `ChunkRun`: `window`. //! Defines `MicroBank`, `MicroBank`, `NativeMoe` and 6 more. -#[allow(unused_imports)] -use super::*; +use super::{ + AllocationTrace, AttentionHandoff, BindingIdentity, BoundLayerKind, ChunkMoePolicy, DenseWeightCache, Dimension, + Error, ForwardPhase, GdnStage, GrRead, GrStage, InjectedResidual, InputStage, KarPleCache, LayerEntry, LayerId, + MicroEnv, ModelBinding, MoeExpertStage, MoeRouteStage, MoeWeightCache, OutputStage, Position, PrefillChunkInputs, + PrefillChunkPlan, QsaAttentionStage, QsaIndexStage, QsaPrepareRequest, QwenChunkTxn, QwenForward, QwenSession, + QwenStepTxn, Result, Stage, StepCaches, StepPurpose, StepRequest, TargetStepOrigin, TokenId, VerificationChunk, + VerificationSource, WindowCaches, chunk_diagnostic, diagnose, prepare_layer_attention_micro, + prepare_micro_ffn_rows, prepare_q6_layer_columns, qwen_forward, read_chunk_attention_ffn, read_layer_attention, + validate_layer_plan, +}; +#[cfg(all(test, target_arch = "x86_64"))] +use super::window_numeric; use leleka_cuda_driver::Context; mod chunk_layer; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/chunk_layer.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/chunk_layer.rs index 6cfc359b..ce89ceca 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/chunk_layer.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/chunk_layer.rs @@ -2,8 +2,12 @@ use super::window_experts::ExpertRun; use super::window_ffn::WindowOwners; -#[allow(unused_imports)] -use super::*; +use super::{ + BoundLayerKind, ChunkEnv, ChunkRun, Context, Dimension, Error, GdnPlan, InjectedResidual, LayerId, MoeWeightCache, + NativeMoe, QwenChunkTxn, QwenForward, Result, +}; +#[cfg(all(test, target_arch = "x86_64"))] +use super::window_numeric; use crate::qwen_forward::gdn::chunk_device::GdnChunkDevice; use crate::qwen_forward::moe_expert::ChunkFfnLayer; use crate::qwen_forward::session::chunk::{ChunkFfnRow, ChunkMicroWindow}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/chunk_setup.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/chunk_setup.rs index d1bcf062..496b946d 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/chunk_setup.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/chunk_setup.rs @@ -1,7 +1,12 @@ //! STRA-338 size: admission, transaction begin, input rows and output head of one prefill chunk. -#[allow(unused_imports)] -use super::*; +use super::{ + ChunkEnv, ChunkMoePolicy, ChunkOpening, Context, DenseWeightCache, Error, InjectedResidual, InputStage, + KarPleCache, ModelBinding, MoeWeightCache, OutputStage, PrefillChunkInputs, PrefillChunkPlan, QwenChunkTxn, + QwenForward, QwenSession, QwenStepTxn, Result, Stage, chunk_diagnostic, +}; +#[cfg(all(test, target_arch = "x86_64"))] +use super::window_numeric; /// The MMQ actor context, and the contexts of the recurrence and verification GDN owners when they are in use. type ChunkContexts<'ctx, 'driver> = diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/window_attention.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/window_attention.rs index f79636b3..65062021 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/window_attention.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/window_attention.rs @@ -1,7 +1,13 @@ //! STRA-338 size: the attention reads of one window of a prefill layer. -#[allow(unused_imports)] -use super::*; +use super::{ + ChunkEnv, ChunkRun, Error, GrStage, InjectedResidual, InputStage, LayerEntry, LayerId, MicroBank, QwenChunkTxn, + QwenForward, Result, Stage, chunk_diagnostic, prepare_layer_attention_micro, read_layer_attention, +}; +#[cfg(all(test, target_arch = "x86_64"))] +use super::window_numeric; +#[cfg(test)] +use super::QwenStepTxn; use crate::qwen_forward::session::chunk::ChunkAttentionRow; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] use crate::qwen_forward::{ diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/window_experts.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/window_experts.rs index 733eebc6..82248e3f 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/window_experts.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/window_experts.rs @@ -1,7 +1,9 @@ //! STRA-338 size: the expert execution and the batched FFN injection of one window of a prefill layer. -#[allow(unused_imports)] -use super::*; +use super::{ + ChunkEnv, ChunkMoePolicy, ChunkRun, Error, GrStage, InjectedResidual, LayerId, MoeExpertStage, MoeWeightCache, + NativeMoe, QwenChunkTxn, QwenForward, Result, Stage, chunk_diagnostic, +}; use crate::qwen_forward::gr::GrBatchRow; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] use crate::qwen_forward::moe_expert::NativePromptFinish; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/window_ffn.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/window_ffn.rs index 8da4ecfa..7606f215 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/window_ffn.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/window_ffn.rs @@ -1,7 +1,11 @@ //! STRA-338 size: the projected columns and the prepared FFN rows of one window of a prefill layer. -#[allow(unused_imports)] -use super::*; +use super::{ + AttentionHandoff, BoundLayerKind, ChunkEnv, ChunkRun, Error, ForwardPhase, GdnStage, InjectedResidual, LayerId, + MicroBank, MicroEnv, MoeExpertStage, MoeRouteStage, NativeMoe, Position, QwenChunkTxn, QwenForward, QwenStepTxn, + Result, Stage, TokenId, chunk_diagnostic, diagnose, prepare_micro_ffn_rows, prepare_q6_layer_columns, + read_chunk_attention_ffn, +}; use crate::qwen_forward::gdn::chunk_device::{ChunkEdge, GdnChunkDevice}; use crate::qwen_forward::gdn::{DeviceChunkRow, GdnLayerInput}; use crate::qwen_forward::gr::DetachedGrRead; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/read_chunk_attention_ffn.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/read_chunk_attention_ffn.rs index 20f5e318..ea40d3bf 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/read_chunk_attention_ffn.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/read_chunk_attention_ffn.rs @@ -1,8 +1,12 @@ //! Methods of `AttentionHandoff`: `new`. //! Methods of `QwenForward`: `test_layer0_pair_on_loaded`, `run_layer0_diagnostic`. -#[allow(unused_imports)] -use super::*; +use super::{DenseWeightCache, ForwardPhase, GrStage, ModelBinding, Result, diagnose}; +#[cfg(test)] +use super::{ + ChunkMoePolicy, Dimension, Error, KarPleCache, MoeWeightCache, OutputStage, PrefillChunkInputs, QwenForward, + QwenSession, Stage, TokenId, +}; use crate::qwen_forward::gr::AttentionBlockOutput; #[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] use crate::qwen_forward::loaded_target_owners::LoadedTargetOwners; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/window_numeric.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/window_numeric.rs index bbf01b2d..6f76e6a6 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/window_numeric.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/window_numeric.rs @@ -1,7 +1,14 @@ //! Changed MicroWindow boundary observer. No model loading or serving switch. //! The returned report owns only counts/booleans; its assertions belong AFTER //! the caller has closed all actual GPU owners and checked allocated_bytes=0. -use super::*; +use super::{ + AttentionHandoff, BindingIdentity, BoundLayerKind, ChunkMoePolicy, DenseWeightCache, Dimension, Error, GdnStage, + GrRead, GrStage, InjectedResidual, InputStage, KarPleCache, LayerEntry, LayerId, MicroEnv, ModelBinding, + MoeExpertStage, MoeRouteStage, MoeWeightCache, OutputStage, Position, PrefillChunkInputs, PrefillChunkPlan, + QsaAttentionStage, QsaIndexStage, QsaPrepareRequest, QwenChunkTxn, QwenForward, QwenSession, QwenStepTxn, Result, + Stage, StepCaches, StepPurpose, StepRequest, TargetStepOrigin, TargetStepProduct, TokenId, VerificationChunk, + VerificationSource, WindowCaches, qwen_forward, +}; use crate::qwen_forward::loaded_target_owners::LoadedTargetOwners; use crate::qwen_forward::mtp_decode::MtpDecoder; use std::{cell::Cell, rc::Rc}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/window_numeric/proof.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/window_numeric/proof.rs index f99ae017..dc9ae9c8 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/window_numeric/proof.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/window_numeric/proof.rs @@ -1,7 +1,10 @@ //! The proof phases of the window boundary observer (STRA-338 size: extract-method only). -#[allow(unused_imports)] -use super::*; +use super::{ + BoundaryPlan, Cell, ChunkMoePolicy, DenseWeightCache, Dimension, Error, KarPleCache, ModelBinding, MoeWeightCache, + MtpDecoder, OutputStage, PartialReport, Position, PrefillChunkInputs, PrefillChunkPlan, QwenChunkTxn, QwenForward, + QwenSession, Rc, Result, Stage, StepCaches, StepRequest, TargetStepProduct, TokenId, owned_journal, tokens, +}; use crate::qwen_forward::mtp::KnownNext; use crate::qwen_forward::mtp::MtpChunkNumericSnapshot; use crate::qwen_forward::session::ResetReplaySnapshot; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/reset_replay_sdet.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/reset_replay_sdet.rs index c175ee24..f5111017 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/reset_replay_sdet.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/reset_replay_sdet.rs @@ -1,6 +1,9 @@ //! Cache-reset-replay numerical proof, moved out of `executor.rs` by STRA-338 (size); same module path as before. -use super::*; +use super::{ + BoundLayerKind, DenseWeightCache, Dimension, KarPleCache, ModelBinding, MoeWeightCache, OutputStage, Position, + QwenForward, QwenSession, Result, StepCaches, StepRequest, TokenId, validate_layer_plan, +}; use crate::qwen_forward::loaded_target_owners::LoadedTargetOwners; use crate::qwen_forward::{ dense_weight_cache::DenseCacheCounters, moe_weight_cache::WeightCacheCounters, session::ResetReplaySnapshot, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/step_layers.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/step_layers.rs index 07ee9b6a..7a5576a4 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/step_layers.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/step_layers.rs @@ -1,7 +1,11 @@ //! Phases of `QwenForward::step_core` (STRA-338 size: extract-method only, same order of operations). -#[allow(unused_imports)] -use super::*; +use super::{ + BoundLayerKind, DenseWeightCache, Dimension, Error, ForwardPhase, GdnStage, GrRead, GrStage, InjectedResidual, + InputStage, KarPleCache, LayerId, ModelBinding, MoeExpertStage, MoeRouteStage, MoeWeightCache, OutputStage, + Position, QsaAttentionStage, QsaIndexStage, QsaPrepareRequest, QwenStepTxn, Result, TokenId, diagnose, + read_layer_attention, validate_layer_plan, +}; use crate::qwen_forward::gdn::GdnLayerInput; use crate::qwen_forward::moe_expert::ExpertRowRequest; use crate::qwen_forward::qsa_attention::QsaReady; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/tests.rs index 7b82ed9b..33c2ff59 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/tests.rs @@ -1,6 +1,9 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). -use super::*; +use super::{ + BoundLayerKind, Dimension, Error, LayerId, OutputStage, Position, QwenForward, QwenSession, QwenStepTxn, Result, + Stage, TokenId, validate_descriptors, +}; #[test] fn topology_validation_requires_the_exact_contiguous_closed_sequence() { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chain/gpu_tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chain/gpu_tests.rs index 9640d90e..63086880 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chain/gpu_tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chain/gpu_tests.rs @@ -5,7 +5,10 @@ use super::super::{ GateHostOperands, GdnOwner, GdnPrior, GdnStateMirror, OutNormScale, RecurrenceOperands, convolve, gates, normalize_qk, out_norm, recur, release, upload, }; -use super::*; +use super::{ + BindingIdentity, CHANNELS, Cell, Chain, Context, DeviceBuffer, Error, GdnMatrixKind, HISTORY_ELEMENTS, Product, Rc, + Role, TokenLayer, VALUES, allocate, download, +}; use crate::qwen_forward::contract::{Dimension, LayerId, Position, TokenId}; use leleka_cuda_driver::{Bf16ProjectionShape, Driver}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chain/row_queue_gpu_tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chain/row_queue_gpu_tests.rs index 1b510138..3f0492dd 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chain/row_queue_gpu_tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chain/row_queue_gpu_tests.rs @@ -7,7 +7,11 @@ use super::super::{ GateHostOperands, OutNormScale, RecurrenceOperands, STATE_ELEMENTS, convolve, gates, normalize_qk, out_norm, recur, release, upload, }; -use super::*; +use super::{ + BindingIdentity, CHANNELS, Cell, Chain, Context, DeviceBuffer, DeviceOperand, Error, GdnMatrixKind, GdnRowQueue, + HISTORY_ELEMENTS, QkScratch, QkvInput, QueueInputs, QueuedRow, Rc, Result, Role, TokenLayer, VALUES, allocate, + download, +}; use crate::qwen_forward::contract::{Dimension, LayerId, Position, TokenId}; use leleka_cuda_driver::{Bf16ProjectionShape, Driver}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device.rs index 1e6560b8..757f9fa4 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device.rs @@ -2,7 +2,19 @@ #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] use super::super::session::chunk::GdnChunkMicro; use super::super::session::chunk::{GdnChunkRow, GdnChunkSeal, GdnChunkStart}; -use super::*; +use super::{ + ALL_MIRROR_BYTES, Bf16ProjectionShape, BindingIdentity, BoundLayerKind, Context, DenseFormat, DenseWeightCache, + DeviceBuffer, DeviceChunkRow, Dimension, DriverError, Error, GateHostOperands, GdnInputLease, GdnInputScratch, + GdnLayerInput, GdnMatrixKind, GdnMatrixLayout, GdnMatrixRole, GdnOwner, GdnPending, GdnPrior, GdnStateKey, + GdnStateMirror, GdnWeights, GrRole, HISTORY_ELEMENTS, InputBindingError, LayerId, LeaseClaim, LeasedProjection, + MirrorAuthority, MirrorStep, ModelBinding, OutNormScale, ProjectedQkvSource, ProjectionKind, ProjectionOperands, + ProjectionSpec, PromptLayer, PromptProgram, PromptSource, Q5KProjectionShape, Q6KProjectionShape, QkScratch, + QwenStepTxn, ReadoutClaim, RecurrenceOperands, ResidualReady, Result, STATE_ELEMENTS, Stage, TokenLayer, VALUES, + allocate, chain, download, download_unchecked, driver_error, pool_enabled, preflight_budget, release, state, + upload, validate_values, verification, +}; +#[cfg(test)] +use super::CHANNELS; use leleka_cuda_driver::{GdnRowQueue, GdnStateFiniteGuard}; use std::{cell::Cell, rc::Rc}; pub(in crate::qwen_forward) const CHUNK_DEVICE_CHARGE: usize = 2 * STATE_ELEMENTS * 4 + 4; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/gdn_chunk_device_methods.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/gdn_chunk_device_methods.rs index fbb9e73b..ebcd590f 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/gdn_chunk_device_methods.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/gdn_chunk_device_methods.rs @@ -1,8 +1,19 @@ //! Groups the submodules `chunk_device_batch_compute`, `chunk_device_construction`, `chunk_device_finish_cleanup`. //! Split out of `chunk_device` to keep its files under the line limit. -#[allow(unused_imports)] -use super::*; +use super::{ + ALL_MIRROR_BYTES, Bf16ProjectionShape, BindingIdentity, BoundLayerKind, CHUNK_DEVICE_CHARGE, Cell, ChunkEdge, + ChunkReadout, Context, DenseFormat, DenseWeightCache, DeviceBuffer, DeviceChunkRow, Dimension, DriverError, Error, + GateHostOperands, GdnChunkDevice, GdnChunkMicro, GdnChunkRow, GdnChunkSeal, GdnChunkStart, GdnInputLease, + GdnInputScratch, GdnLayerInput, GdnMatrixKind, GdnMatrixLayout, GdnMatrixRole, GdnOwner, GdnPending, GdnPrior, + GdnRowQueue, GdnStateFiniteGuard, GdnStateKey, GdnStateMirror, GdnWeights, GrRole, HISTORY_ELEMENTS, + InputBindingError, LayerId, LeaseClaim, LeasedProjection, MirrorAuthority, MirrorStep, ModelBinding, OutNormScale, + ProjectedQkvSource, ProjectionKind, ProjectionOperands, ProjectionSpec, PromptLayer, PromptProgram, PromptSource, + Q5KProjectionShape, Q6KProjectionShape, QkScratch, QwenStepTxn, Rc, ReadoutClaim, ReadoutDownload, + RecurrenceOperands, ResidualReady, Result, STATE_ELEMENTS, Stage, TokenLayer, VALUES, allocate, chain, download, + download_unchecked, driver_error, micro_rows, mirror_reuse_enabled, pool_enabled, preflight_budget, release, state, + upload, validate_values, verification, +}; mod chunk_device_batch_compute; mod chunk_device_construction; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/gdn_chunk_device_methods/chunk_device_batch_compute.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/gdn_chunk_device_methods/chunk_device_batch_compute.rs index 4969f312..460d22fb 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/gdn_chunk_device_methods/chunk_device_batch_compute.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/gdn_chunk_device_methods/chunk_device_batch_compute.rs @@ -1,8 +1,12 @@ //! Methods of `GdnChunkDevice`: `finish_batch`, `history`, `step_source`, `read_checked` and 13 more. //! Split out of `gdn_chunk_device_methods` to keep its files under the line limit. -#[allow(unused_imports)] -use super::*; +use super::{ + ChunkEdge, ChunkReadout, DeviceBuffer, Error, GdnChunkDevice, GdnChunkRow, HISTORY_ELEMENTS, Rc, ReadoutDownload, + Result, VALUES, allocate, download, driver_error, preflight_budget, validate_values, +}; +#[cfg(test)] +use super::upload; impl<'ctx> GdnChunkDevice<'ctx> { /// Adopt the final state of a batch that drained clean: the separate `next` diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/numeric_gpu.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/numeric_gpu.rs index ea1b657f..346878c5 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/numeric_gpu.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/numeric_gpu.rs @@ -3,7 +3,18 @@ use super::super::super::contract::{Dimension, LayerId}; use super::super::super::session::chunk::TestGdnComponentRows; use super::super::{RecurrenceOperands, convolve, recur}; -use super::*; +use super::{ + ALL_MIRROR_BYTES, Bf16ProjectionShape, BindingIdentity, BoundLayerKind, CHANNELS, CHUNK_DEVICE_CHARGE, Cell, + ChunkReadout, Context, DenseFormat, DenseWeightCache, DeviceBuffer, DeviceChunkRow, DriverError, Error, + GateHostOperands, GdnChunkDevice, GdnChunkMicro, GdnChunkRow, GdnChunkSeal, GdnChunkStart, GdnInputLease, + GdnInputScratch, GdnLayerInput, GdnMatrixKind, GdnMatrixLayout, GdnMatrixRole, GdnOwner, GdnPending, GdnPrior, + GdnRowQueue, GdnStateFiniteGuard, GdnStateKey, GdnStateMirror, GdnWeights, GrRole, HISTORY_ELEMENTS, + InputBindingError, LeaseClaim, LeasedProjection, MirrorAuthority, MirrorStep, ModelBinding, OutNormScale, + ProjectedQkvSource, ProjectionKind, ProjectionOperands, ProjectionSpec, PromptLayer, PromptProgram, PromptSource, + Q5KProjectionShape, Q6KProjectionShape, QkScratch, QwenStepTxn, Rc, ReadoutClaim, ResidualReady, Result, + STATE_ELEMENTS, Stage, TokenLayer, allocate, chain, download, driver_error, preflight_budget, release, state, + upload, validate_values, +}; use leleka_cuda_driver::Driver; const ROWS: usize = 65; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/numeric_gpu/batch_adoption.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/numeric_gpu/batch_adoption.rs index 54cff189..87950278 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/numeric_gpu/batch_adoption.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/numeric_gpu/batch_adoption.rs @@ -1,8 +1,10 @@ //! Functions: `batch_adoption`, `adoption_rows`, `adoption_phase`, `batch_operand_guards` and 6 more. //! Split out of `numeric_gpu` to keep its files under the line limit. -#[allow(unused_imports)] -use super::*; +use super::{ + BindingIdentity, Context, Dimension, Error, GdnChunkDevice, GdnChunkRow, GdnPrior, HISTORY_ELEMENTS, LayerId, + Result, STATE_ELEMENTS, TestGdnComponentRows, component_owner, difference, download, driver_error, require, +}; // Batch adoption of the Strata-prefill step. Pure ownership/identity: no kernel // runs here, the final state is a recognisable pattern written into `next`. diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/numeric_gpu/exercise.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/numeric_gpu/exercise.rs index fe326ba3..81e5f18f 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/numeric_gpu/exercise.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/numeric_gpu/exercise.rs @@ -1,8 +1,12 @@ //! Methods of `Fixture`: `new`, `row_guards`, `run_rows`, `compute_row` and 12 more. //! Functions: `require_rejected_clean`, `exercise`, `run_gdn_chunk_numeric`. Defines `Fixture`, `ComputedRow`. -#[allow(unused_imports)] -use super::*; +use super::{ + BUDGET, BindingIdentity, CHUNK_DEVICE_CHARGE, ChunkReadout, Context, Counts, DeviceBuffer, Dimension, Driver, + Error, GdnChunkDevice, GdnChunkRow, GdnChunkSeal, GdnPrior, GdnStateFiniteGuard, LayerId, Operands, Rc, Reference, + Result, STATE_ELEMENTS, TestGdnComponentRows, component_owner, convolution_input, convolution_weights, convolve, + difference, download, driver_error, operands, reference, require, upload, +}; // The prior, the same-PTX reference and the row sources every stage of the component proof uses. struct Fixture { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/driver_error.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/driver_error.rs index af9719f4..aa103a5f 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/driver_error.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/driver_error.rs @@ -1,8 +1,11 @@ //! Functions: `driver_error`, `validate_candidates`, `state_index`, `key_head`. //! Split out of `gdn` to keep its files under the line limit. -#[allow(unused_imports)] -use super::*; +use super::{DriverError, Error, KEY_HEADS, Result, Stage, VALUE_HEADS, WIDTH}; +#[cfg(test)] +use super::CandidateFixture; +#[cfg(test)] +use super::{HISTORY_ELEMENTS, STATE_ELEMENTS, TokenLayer, validate_values}; pub(in super::super) fn driver_error(error: DriverError) -> Error { if crate::driver_errors_traced() { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/four_borrow_gpu.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/four_borrow_gpu.rs index 49b09a85..3f23f160 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/four_borrow_gpu.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/four_borrow_gpu.rs @@ -1,6 +1,9 @@ //! ONE binding-loaded layer0 transport proof; no synthetic ModelBinding, //! fabricated session advancement or all48/full-model qualification. -use super::*; +use super::{ + Context, DenseWeightCache, Dimension, Error, FOUR_BORROW_BYTES, GdnPrior, GdnStage, HISTORY_ELEMENTS, LayerId, + ModelBinding, QwenStepTxn, ResidualReady, Result, STATE_ELEMENTS, Stage, VALUES, validate_values, +}; use crate::qwen_forward::gdn::GdnLayerInput; use crate::qwen_forward::{ contract::{Position, TokenId}, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/input_scratch_gpu_tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/input_scratch_gpu_tests.rs index 3bd12d48..67bfa62e 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/input_scratch_gpu_tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/input_scratch_gpu_tests.rs @@ -1,6 +1,9 @@ //! New per-layer input lease parity; synthetic component, never ModelBinding. #![cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -use super::*; +use super::{ + BindingIdentity, Context, DeviceBuffer, Error, GdnInputLease, GdnInputScratch, GdnMatrixKind, GdnMatrixLayout, + GdnMatrixRole, LeaseClaim, allocate, dispatch_projection, download, input_scratch, project_retained, upload, +}; use input_scratch::INPUT_BYTES; use leleka_cuda_driver::Driver; use std::{ diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/mirror/gpu_tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/mirror/gpu_tests.rs index 3e05d547..1775b1ce 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/mirror/gpu_tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/mirror/gpu_tests.rs @@ -1,7 +1,7 @@ //! New device mirror against the actual uncached recurrence, not a model oracle. #![cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] use super::super::{GdnOwner, HISTORY_ELEMENTS, RecurrenceOperands, recur}; -use super::*; +use super::{BindingIdentity, Cell, Context, Error, GdnPrior, GdnStateMirror, MIRROR_BYTES, MirrorNext, Rc, VALUES}; use crate::qwen_forward::contract::{Dimension, LayerId, Position, TokenId, TokenLayer}; use leleka_cuda_driver::Driver; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/prefill_batch.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/prefill_batch.rs index 50cd289e..a2bac559 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/prefill_batch.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/prefill_batch.rs @@ -13,7 +13,11 @@ use super::super::session::chunk::GdnChunkMicro; use super::chunk_device::GdnChunkDevice; use super::chunk_producer::ChunkReady; -use super::*; +use super::{ + BoundLayerKind, CHANNELS, Context, DenseWeightCache, DeviceBuffer, Dimension, Error, GdnMatrixKind, GdnMatrixRole, + GdnStage, HISTORY_ELEMENTS, LayerId, ModelBinding, PromptLayer, Result, Stage, TokenLayer, VALUE_HEADS, VALUES, + download, driver_error, validate_values, +}; use leleka_cuda_driver::{GDN_BATCH_EPSILON, GDN_BATCH_MAX_TOKENS, GdnGemm, GdnNativeFormat, GdnPrefillBatch}; const MIXED: usize = 2560; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/prefill_batch/gpu.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/prefill_batch/gpu.rs index 356249ef..e4014c8c 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/prefill_batch/gpu.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/prefill_batch/gpu.rs @@ -3,7 +3,7 @@ //! and the chunk adoption in `gdn_chunk_numeric_gpu.rs`; the full model step //! needs a bound `ModelBinding`, a loaded `DenseWeightCache` and a real //! adapter, so its qualification is Root's Original17 prefill gate. -use super::*; +use super::{BATCH_SCRATCH_BYTES, Bf16Profile, EAGER_TOKENS, GdnBatchResources, batch_device_bytes}; use leleka_cuda_driver::Driver; #[test] diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/verification.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/verification.rs index ca7c5254..42607b35 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/verification.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/verification.rs @@ -3,7 +3,12 @@ use super::super::session::{ TargetStepOrigin, chunk::{GdnChunkRow, GdnChunkStart}, }; -use super::*; +use super::{ + BindingIdentity, CHANNELS, Context, DeviceBuffer, Error, GdnPrior, HISTORY_ELEMENTS, LayerId, Result, + STATE_ELEMENTS, Stage, TokenLayer, VALUES, allocate, chain, download, driver_error, validate_values, +}; +#[cfg(test)] +use super::{CandidatePair, upload}; use leleka_cuda_driver::GdnStateFiniteGuard; use std::{ cell::{Cell, RefCell}, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/verification/numeric_gpu.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/verification/numeric_gpu.rs index d5e3ca4f..533f41da 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/verification/numeric_gpu.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/verification/numeric_gpu.rs @@ -1,5 +1,8 @@ //! Numerical transport proof of the MTP verification journal (test-only; moved out of the parent file by STRA-338). -use super::*; +use super::{ + COUNTS, CandidatePair, Context, DeviceBuffer, Error, GdnStateFiniteGuard, Result, STATE_ELEMENTS, VALUES, + VerifiedRowBuffers, allocate, compute_row, download, driver_error, upload, +}; use leleka_cuda_driver::Driver; struct Numerical<'ctx> { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gr/gr_residual_reuse_gpu.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gr/gr_residual_reuse_gpu.rs index 81f76219..faa380f6 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gr/gr_residual_reuse_gpu.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gr/gr_residual_reuse_gpu.rs @@ -1,6 +1,9 @@ //! New GR residual transport parity through actual private serving helpers. #![cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -use super::*; +use super::{ + BindingIdentity, Cell, Context, DeviceBuffer, Error, GrScratch, Rc, download_f32, inject_cached_cuda, + read_cached_cuda, upload_bf16, upload_f32, +}; use leleka_cuda_driver::Driver; use std::cell::RefCell; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gr/output_workspace_gpu.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gr/output_workspace_gpu.rs index 0c79ccd4..407ea719 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gr/output_workspace_gpu.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gr/output_workspace_gpu.rs @@ -1,7 +1,13 @@ //! Functions: `run_proof`, `compare_outputs`, `release_owners`, `original_first_fixed_outputs_repeat_overwrite_abort... //! Defines `Tally`. -use super::*; +use super::{ + AttentionBlockOutput, BindingIdentity, Cell, Context, DenseWeightCache, DetachedGrRead, DeviceBuffer, Dimension, + DriverError, Error, GR_OUTPUT_BYTES, GR_OUTPUT_DEVICE_BYTES, GrBatchRow, GrMicroAttention, GrMicroAttentionBank, + GrMicroAttentionBlock, GrMicroBlock, GrMicroInput, GrRole, GrScratch, GrWeights, InputBindingError, LayerId, + MicroBlockRequest, ModelBinding, PleReady, QwenStepTxn, Rc, ReadCandidate, RefCell, RefMut, Result, TokenLayer, + download_f32, driver_error, inject_cached_cuda, read_cached_cuda, retained_handoff, upload_bf16, upload_f32, +}; use leleka_cuda_driver::Driver; #[derive(Default)] diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gr/output_workspace_gpu/output_workspace_proof_stages.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gr/output_workspace_gpu/output_workspace_proof_stages.rs index 215f17a5..585ce05f 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gr/output_workspace_gpu/output_workspace_proof_stages.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gr/output_workspace_gpu/output_workspace_proof_stages.rs @@ -1,5 +1,9 @@ //! The stages of the output workspace proof; the parent owns the tally, the proof driver and the test. -use super::*; +use super::{ + BindingIdentity, Cell, Context, DeviceBuffer, Error, GrScratch, Rc, ReadCandidate, RefCell, Result, Tally, block, + check_handoff, coefficients, compare_outputs, download_f32, driver_error, fresh_inject, fresh_read, + inject_cached_cuda, poison_all, read_cached_cuda, retained_handoff, streams, upload_bf16, upload_f32, +}; type Weights<'m, 'c> = &'m [DeviceBuffer<'c>; 4]; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gr/retained_handoff.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gr/retained_handoff.rs index 02970e42..b3621bc8 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gr/retained_handoff.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gr/retained_handoff.rs @@ -2,7 +2,15 @@ //! The actual finite host witness remains canonical; only its duplicate H2D //! is removed. No device-only host proof or changed arithmetic is introduced. use super::read_cached_cuda::borrow_injection; -use super::*; +use super::{ + Cell, Context, DenseWeightCache, DetachedGrRead, DeviceBuffer, Error, GrMicroAttentionBank, GrMicroAttentionBlock, + GrPhase, GrRead, GrRole, GrScratch, GrStage, InjectedResidual, LayerId, ModelBinding, QwenStepTxn, + READ_DEVICE_BYTES, Rc, ReadCandidate, RefMut, ResidualReady, Result, TokenLayer, admit_budget, batch_chunk, + copy_cached_f32, diagnose, download_f32, driver_error, read_cached_cuda, validate_layer, validate_streams, + validate_values, +}; +#[cfg(test)] +use super::{BindingIdentity, inject_cached_cuda, upload_bf16, upload_f32}; /// The attention block output an attention residual is injected with, and the token and layer it was computed for. #[derive(Clone, Copy)] pub(in crate::qwen_forward) struct AttentionBlockOutput<'a> { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gr/retained_handoff/installed.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gr/retained_handoff/installed.rs index bd793c6a..8b83f4cc 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gr/retained_handoff/installed.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gr/retained_handoff/installed.rs @@ -1,6 +1,9 @@ //! Only the new actual attention-injection -> FFN GR ownership/transport seam. //! Scalar host-roundtrip executes FIRST. No fabricated model/session proof. -use super::*; +use super::{ + BindingIdentity, Cell, Context, DeviceBuffer, Error, GrScratch, Rc, download_f32, inject_cached_cuda, + inject_replace_residual, read_cached_cuda, replace_residual_buffer, upload_bf16, upload_f32, +}; use leleka_cuda_driver::Driver; use std::cell::RefCell; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gr/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gr/tests.rs index c1c260cd..6375eba7 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gr/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gr/tests.rs @@ -1,6 +1,8 @@ //! Unit tests of `gr`. -use super::*; +use super::{ + BindingIdentity, Dimension, Error, GrRole, InjectedResidual, LayerId, TokenLayer, validate_layer, validate_streams, +}; #[test] fn gr_preflight_keeps_all_inputs_unchanged_on_shape_or_numeric_refusal() { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/input/gather_rows.rs b/crates/engine-qwen35-cuda/src/qwen_forward/input/gather_rows.rs index 3dfa1c29..53c5d647 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/input/gather_rows.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/input/gather_rows.rs @@ -1,8 +1,14 @@ //! Methods of `InputReady`: `test_fixture`. Methods of `PleOwner`: `new`, `matches`. //! Functions: `gather_rows`, `binding_error`. -#[allow(unused_imports)] -use super::*; +use super::{ + BindingIdentity, Dimension, EMBEDDING_VALUES, Error, GrRole, InjectedResidual, InputBindingError, InputError, + LayerId, ModelBinding, PLE_HC, PLE_HISTORY, PLE_ROW_VALUES, PleMicroBatchReady, PleMicroInput, PleOwner, + PlePending, PlePrior, PleReady, PleState, Position, QwenStepTxn, Rc, Result, Stage, TokenLayer, ple_values, + ple_zeros, +}; +#[cfg(test)] +use super::{InputReady, ResidualStreams, TokenId}; pub(super) fn gather_rows( rows: &[u64; 16], diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache/lru_tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache/lru_tests.rs index ebd71eda..8fad61f9 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache/lru_tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache/lru_tests.rs @@ -1,7 +1,7 @@ //! Methods of `Rng`: `next`, `row`. Methods of `Scan`: `new`, `victim`, `plan`, `gather`. //! Functions: `token`, `gather_equals_the_full_scan_on_random_sequences`, `chunks_and_gathers_interleaved_keep_every... -use super::*; +use super::{Lookup, Residents, SLOTS, assign_slots, lookup_rows, plan_gather, publish_gather}; use std::collections::HashMap; struct Rng(u64); diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache/row_parity_probe.rs b/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache/row_parity_probe.rs index 55c269cf..9b8ab142 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache/row_parity_probe.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache/row_parity_probe.rs @@ -1,7 +1,7 @@ //! Functions: `fnv`, `probe_binding`, `probe_rows`, `dump_decoded_rows_for_original_comparison` and 2 more. //! Split out of `kar_ple_cache` to keep its files under the line limit. -use super::*; +use super::{BindingIdentity, KarPleBinding, KarPleCache, PLE_ROWS}; use crate::model_binding::qwen4exp_kar_ple::pinned_profile; use leleka_cuda_driver::Driver; use leleka_model_format::kar::{KarInspection, VerifiedKarPleArtifact}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache/slot_tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache/slot_tests.rs index ecf1b60b..3d6dca7d 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache/slot_tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache/slot_tests.rs @@ -1,7 +1,7 @@ //! Functions: `apply`, `the_scatter_staging_buffers_match_the_update_records`, `chunk`, `consistent` and 9 more. //! Defines `Given`. -use super::*; +use super::{Error, Lookup, MAX_MISSES, Residents, UPDATE_RECORD_BYTES, assign_slots, lookup_rows, scratch_bytes}; /// What `KarPleCache::commit` does to the map, over the pure parts. fn apply(entries: &mut Residents, lookup: &Lookup, miss_slot: &[u32], victims: &[Option], stamp: u64) { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/expert_matrix_projection.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/expert_matrix_projection.rs index 5eb0486b..4e89fa25 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/expert_matrix_projection.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/expert_matrix_projection.rs @@ -1,8 +1,16 @@ //! Functions: `matrix_dims`, `gate_up_dims`, `prepared_routed_format`, `gate_up_prepared_format` and 15 more. //! Defines `MatrixDims`, `ExpertMatrix`, `ExpertActivation` and 2 more. -#[allow(unused_imports)] -use super::*; +use super::{ + BoundExpert, CachedMoeMatrix, Context, DEVICE_PEAK, DenseFormat, DeviceBuffer, Error, FF, ModelBinding, + MoeExpertBlock, MoeExpertSelection, MoeExpertWeights, MoeMatrixKind, MoeMatrixRole, MoeWeightCache, N, + ProjectionKind, ProjectionSpec, Q5KProjectionShape, Q6KProjectionShape, Result, RoutedFormat, RoutedGateUpQ8, + Stage, binding_error, download_f32, driver_error, upload_bytes, +}; +#[cfg(test)] +use super::TILE; +#[cfg(test)] +use super::validate_values; /// Shape and format of one expert matrix as the binding declares it. #[derive(Clone, Copy)] diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped.rs index be0af4c0..02a2cccb 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped.rs @@ -2,7 +2,20 @@ //! Exact scalar Q8_1 arithmetic; this is not the tensorcore MMQ numerical profile. use super::super::gr::{DetachedGrRead, GrStage}; use super::super::session::chunk::{ChunkFfnRow, QwenChunkTxn}; -use super::*; +use super::{ + ActualDown, ActualSlotPacket, BindingIdentity, BoundExpert, CachedMoeMatrix, Cell, CompletedCpuRow, Context, + DEVICE_PEAK, DeviceBuffer, DownOrigin, DownProvenance, DownScope, DownSelection, DriverError, Error, + ExpertActivation, ExpertReady, FF, GrRole, K, LayerId, MatrixDims, MmqChunkRequest, ModelBinding, + MoeExpertSelection, MoeExpertStage, MoeExpertWeights, MoeMatrixKind, MoeMatrixRole, MoeWeightCache, N, PackedDown, + QwenStepTxn, Rc, Result, RetainedDown, RoutedExperts, RoutedFormat, RoutedGateUpQ8, SharedTailRow, SourceMatrix, + Stage, StepCuda, TokenLayer, TransportBuffer, admit_budget, binding_error, cached_mlp_down, download_f32, + driver_error, dual_routed_format, execute_cuda_cached, launch_cached_projection, moe_down, validate_values, +}; +#[cfg(test)] +use super::{ + DeclaredMatrix, DenseFormat, ExpertMatrix, ExpertRowRequest, InputBindingError, KarExpertSource, KarSourceError, + MoeExpertBlock, ProjectionKind, ProjectionSpec, Q5KProjectionShape, Q6KProjectionShape, ResidualReady, +}; use leleka_cuda_driver::DownColumns; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] mod adaptive_packets; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu.rs index 36075ad2..7adfe339 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu.rs @@ -1,6 +1,16 @@ //! ONE loaded actual-row transport proof. No source admission, ModelBinding, //! session advancement, standalone Load or full-model qualification is minted. -use super::*; +use super::{ + BindingIdentity, BoundExpert, CachedMoeMatrix, ChunkFfnLayer, ChunkFfnRow, CompletedCpuRow, Context, DEVICE_PEAK, + DeclaredMatrix, DenseFormat, DeviceBuffer, DownColumns, DownProvenance, DownScope, DownSelection, DriverError, + Error, ExpertActivation, ExpertGroup, ExpertMatrix, ExpertReady, ExpertRowRequest, FF, GrRole, GrStage, + InputBindingError, K, KarExpertSource, KarSourceError, LayerId, MatrixDims, MmqChunkRequest, ModelBinding, + MoeExpertBlock, MoeExpertSelection, MoeExpertStage, MoeExpertWeights, MoeMatrixKind, MoeMatrixRole, MoeWeightCache, + N, NativePromptFinish, PackedDown, PacketGroupMembers, PreparedMoeRow, ProjectionKind, ProjectionSpec, + Q5KProjectionShape, Q6KProjectionShape, QwenChunkTxn, Rc, ResidualReady, Result, RetainedDown, RoutedExperts, + RoutedFormat, RoutedGateUpQ8, RowTail, SharedTailRow, SourceMatrix, Stage, StepCuda, TokenLayer, TransportBuffer, + download_f32, driver_error, moe_down, validate_values, +}; use crate::qwen_forward::gr::DetachedGrRead; use crate::qwen_forward::session::{QwenStepTxn, ResetReplaySnapshot, chunk::ChunkAttentionRow}; use crate::qwen_forward::{ diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu/arm.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu/arm.rs index b83ac0a6..bf231305 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu/arm.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu/arm.rs @@ -1,8 +1,10 @@ //! Functions: `arm`, `probe_payload`, `preflight_copy`, `corrupted_bytes` and 1 more. //! Split out of `direct_gpu` to keep its files under the line limit. -#[allow(unused_imports)] -use super::*; +use super::{ + Cell, ChunkFfnLayer, DEVICE_PEAK, DownScope, Error, FF, K, LoadedArms, MoeExpertStage, N, Observation, ObservedArm, + QwenChunkTxn, Result, SLOTS, arm_chunk_rows, arm_tokens, cancel_probe, +}; pub(super) fn arm<'ctx>( arms: &mut LoadedArms<'_, '_, 'ctx>, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu/loaded_arms.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu/loaded_arms.rs index b71abf35..8d458a04 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu/loaded_arms.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu/loaded_arms.rs @@ -1,8 +1,10 @@ //! Methods of `LoadedArms`: `arm`, `matches_snapshot`, `precheck`, `reference_and_candidate` and 2 more. //! Methods of `QwenForward`: `test_direct_down_on_loaded`. -#[allow(unused_imports)] -use super::*; +use super::{ + CANCELLED_ON_COPY, DirectDownReport, DirectRun, Error, K, LoadedArms, N, ObservedArm, QwenForward, + ResetReplaySnapshot, Result, Stage, arm, compare, output_differences, same_outputs, transport_probe, +}; impl LoadedArms<'_, '_, '_> { pub(super) fn arm(&mut self, old: bool, cancel_after_copy: bool) -> Result { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu/policy.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu/policy.rs index 9538e1a9..3d9b7147 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu/policy.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu/policy.rs @@ -1,8 +1,12 @@ //! Methods of `Observation`: `begin`, `take`. Methods of `DirectDownReport`: `assert_after_teardown`. //! Implements `Drop for Observation`. Functions: `policy`, `copy_completed`, `observe_packet`, `compare` and 7 more. -#[allow(unused_imports)] -use super::*; +use super::{ + CANCELLED_ON_COPY, COPIED, ChunkAttentionRow, ChunkFfnRow, DenseWeightCache, DetachedGrRead, DeviceBuffer, + Dimension, DirectDownReport, Error, GdnStage, GrStage, InputStage, K, KarPleCache, LayerId, ModelBinding, + MoeExpertStage, MoeRouteStage, N, OLD, Observation, PACKETS, PreparedMoeRow, QwenChunkTxn, QwenStepTxn, Result, + TokenId, download_f32, validate_values, +}; use crate::qwen_forward::gdn::GdnLayerInput; pub(in super::super) fn policy(actual: bool) -> bool { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu/probe.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu/probe.rs index f3354031..1c468146 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu/probe.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu/probe.rs @@ -1,8 +1,10 @@ //! Methods of `Probe`: `run`, `fill_sentinels`, `split_and_pack_old`, `copy_direct` and 7 more. //! Functions: `transport_probe`, `output_differences`, `same_outputs`. -#[allow(unused_imports)] -use super::*; +use super::{ + Cell, Context, DownScope, DownSelection, DriverError, Error, ExpertReady, K, N, Probe, Rc, Result, SLOTS, + corrupted_bytes, download_f32, driver_error, preflight_copy, probe_payload, refuse_alien_scope, validate_values, +}; impl<'ctx> Probe<'_, 'ctx> { pub(super) fn run(&mut self) -> Result { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/layer0_pair.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/layer0_pair.rs index aaebea33..bef7bdba 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/layer0_pair.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/layer0_pair.rs @@ -1,5 +1,8 @@ //! Same actual sealed rows and transaction, native first, no publication. -use super::*; +use super::{ + ChunkFfnLayer, ChunkFfnRow, Error, ExpertReady, K, LayerId, ModelBinding, MoeExpertStage, MoeWeightCache, + QwenChunkTxn, Result, +}; use crate::qwen_forward::layer0_mmq_observation as observation; fn counters(cache: &MoeWeightCache<'_>) -> [u64; 5] { let c = cache.counters(); diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/tests.rs index 9ad5e2c9..dfb7a46c 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/tests.rs @@ -1,6 +1,8 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). -use super::*; +use super::{DEVICE_PEAK, Error, FF, N, admit_budget}; +#[cfg(test)] +use super::collect_rows; #[test] fn completed_tiles_keep_all_rows_and_late_failure_withholds_candidate() { let values = collect_rows(N, |first, count| { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_prefill_batch/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_prefill_batch/tests.rs index e0470d6f..c042c301 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_prefill_batch/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_prefill_batch/tests.rs @@ -1,6 +1,9 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). -use super::*; +use super::{ + EXPERTS, Error, FF, GdnNativeFormat, MIXED, MoeBf16Profile, MoeWeightDescriptor, SELECTED, device_bytes, + down_format, f32_bytes, gate_up_format, validate_route_row, +}; fn descending() -> ([i32; SELECTED], [f32; SELECTED]) { (std::array::from_fn(|i| (i * 7) as i32), std::array::from_fn(|i| 0.2 - i as f32 * 0.01)) diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_route/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_route/tests.rs index d64817fb..a6ecbfca 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_route/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_route/tests.rs @@ -1,4 +1,7 @@ -use super::*; +use super::{ + BindingIdentity, DriverError, EXPERTS, Error, ExpertId, LOGITS_BYTES, LayerId, Result, RoutedExperts, RouterLogits, + SELECTED, Stage, TokenId, TokenLayer, map_driver_error, route_with, +}; use crate::qwen_forward::contract::{Dimension, Position}; // The oracle's explicit lane-index loops preserve the fixed warp traversal. diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_lru_index/lru_index.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_lru_index/lru_index.rs index 65b517d9..864d8cd7 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_lru_index/lru_index.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_lru_index/lru_index.rs @@ -1,8 +1,10 @@ //! Methods of `LruIndex`: `new`, `with_capacity`, `metadata_bytes`, `len` and 15 more. //! Split out of `cache_lru_index` to keep its files under the line limit. -#[allow(unused_imports)] -use super::*; +use super::{ + ABSENT, Error, HOST_LIMIT, LruIndex, MAX_KEYS, MAX_PROTECTED, MoeWeightDescriptor, Node, PER_LAYER, + PreparedUpdates, Result, slot, +}; impl LruIndex { #[cfg(any(test, all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64")))] diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill.rs index 6e8f58e2..644c1ba9 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill.rs @@ -1,5 +1,16 @@ //! Binding-authenticated constructor; metadata alone cannot produce weights. -use super::*; +use super::{ + AdaptiveWitness, BindingIdentity, BoundExpert, Cell, Context, DeviceBuffer, DeviceRef, EncodedWeight, Entry, Error, + FixedMtpWeights, HashMap, LearnedMainWitness, LruIndex, MAIN_LIMIT, MmqChunkRequest, MmqFormat, MmqWeights, + MmqWorkspace, ModelBinding, MoeExpertSelection, MoeExpertWeights, MoeMatrixRole, MoeWeightCache, + MoeWeightDescriptor, MtpExpertPicks, MtpHeadSources, MtpInputWorkspace, MtpKind, MtpKvClaim, MtpKvResident, + MtpRole, MtpStepSite, PREFILL_STREAM_OVERRIDE, PendingMtpKv, PreparedUpdates, PromptWeightOwners, Rc, RefCell, + Result, RetainedOriginalMtpWeights, RoutedFiniteStage, RoutedGroupWorkspace, RoutedStageFiniteGuard, SharedKeys, + SharedPermanentWitness, SharedTailRow, SharedWeightsRequest, SourceMatrix, TripletLoanRequest, WORKING_RESERVE, + WeightCacheCounters, binding_error, cache_profile, cache_strata_adaptive, driver_error, +}; +#[cfg(test)] +use super::room_fits; #[cfg(test)] use cache_profile::ProfileWitness; use cache_profile::{HOST_CAP, PROFILE_SHA, PinnedPool, PrefixPlan, ProfileLimits, RankedProfile}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/moe_weight_cache.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/moe_weight_cache.rs index 36d9fda3..7786e9cd 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/moe_weight_cache.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/moe_weight_cache.rs @@ -1,8 +1,19 @@ //! Groups the submodules `pinned_triplet_preload`, `profile_ranked_fill_and_pool`. //! Split out of `cache_profile_fill` to keep its files under the line limit. -#[allow(unused_imports)] -use super::*; +use super::{ + AdaptiveWitness, BindingIdentity, BoundExpert, Cell, Context, DeviceBuffer, DeviceRef, EncodedWeight, Entry, Error, + FixedMtpWeights, HOST_CAP, HashMap, LearnedMainWitness, LruIndex, MAIN_LIMIT, MmqChunkRequest, MmqFormat, + MmqWeights, MmqWorkspace, ModelBinding, MoeExpertSelection, MoeExpertWeights, MoeMatrixRole, MoeWeightCache, + MoeWeightDescriptor, MtpExpertPicks, MtpHeadSources, MtpInputWorkspace, MtpKind, MtpKvClaim, MtpKvResident, + MtpRole, MtpStepSite, PREFILL_STREAM_OVERRIDE, PROFILE_SHA, PendingMtpKv, PinnedPool, PrefixPlan, PreparedUpdates, + ProfileLimits, PromptWeightOwners, RankedProfile, Rc, RefCell, Result, RetainedOriginalMtpWeights, + RoutedFiniteStage, RoutedGroupWorkspace, RoutedStageFiniteGuard, SharedKeys, SharedPermanentWitness, SharedTailRow, + SharedWeightsRequest, SourceMatrix, TripletLoanRequest, WORKING_RESERVE, binding_error, driver_error, + profile_window_spill_with_floor, +}; +#[cfg(test)] +use super::ProfileWitness; mod pinned_triplet_preload; mod profile_ranked_fill_and_pool; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/moe_weight_cache/pinned_triplet_preload.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/moe_weight_cache/pinned_triplet_preload.rs index c1976144..76872ac1 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/moe_weight_cache/pinned_triplet_preload.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/moe_weight_cache/pinned_triplet_preload.rs @@ -1,8 +1,14 @@ //! Methods of `MoeWeightCache`: `preload_pinned_triplet`, `admit_pinned_triplet`, `pinned_layouts`, `check_pinned_ro... //! Defines `PinnedLayouts`, `PinnedSource`, `PinnedAdmission`. -#[allow(unused_imports)] -use super::*; +use super::{ + DeviceRef, EncodedWeight, Entry, Error, MAIN_LIMIT, ModelBinding, MoeWeightCache, MoeWeightDescriptor, Result, + WORKING_RESERVE, binding_error, driver_error, +}; +#[cfg(test)] +use super::ProfileWitness; +#[cfg(test)] +use super::PinnedPool; /// Layouts, charges and the checked next counters of one pinned triplet upload. #[derive(Clone, Copy)] diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/profile_build.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/profile_build.rs index 7a3b772c..5d90efa4 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/profile_build.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/profile_build.rs @@ -2,8 +2,11 @@ //! extract-method only). // Stays a glob on purpose: the file is at the 400-line limit and the explicit list would put it over. -#[allow(unused_imports)] -use super::*; +use super::{ + Context, Entry, Error, HOST_CAP, HashMap, MAIN_LIMIT, ModelBinding, MoeMatrixRole, MoeWeightCache, + MoeWeightDescriptor, PinnedPool, PrefixPlan, ProfileLimits, RankedProfile, Result, WORKING_RESERVE, + WeightCacheCounters, binding_error, cache_profile, driver_error, profile_window_spill_with_floor, +}; /// Which sizing and seeding the profile build uses. #[allow(dead_code)] diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/shared_quartet_preload.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/shared_quartet_preload.rs index be970cc5..9120d462 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/shared_quartet_preload.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/shared_quartet_preload.rs @@ -4,7 +4,12 @@ #[allow(unused_imports)] #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] use super::profile_build::{ProfileFile, ProfileKind, ProfileRequest}; -use super::*; +use super::{ + DeviceRef, EncodedWeight, Entry, Error, MAIN_LIMIT, ModelBinding, MoeWeightCache, MoeWeightDescriptor, Result, + WORKING_RESERVE, binding_error, cache_profile, driver_error, +}; +#[cfg(test)] +use super::{Context, PROFILE_SHA, RankedProfile}; /// The room a shared quartet upload must leave free: the spill allowance and the main pool size once the quartet is /// inserted. diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp/kv_only.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp/kv_only.rs index 3d4effe1..7f659162 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp/kv_only.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp/kv_only.rs @@ -1,5 +1,7 @@ //! Private canonical cell producer. It never represents a ready draft/residual. -use super::*; +use super::{Error, ModelBinding, MoeWeightCache, MtpFrame, MtpInput, QwenSession, Result}; +#[cfg(test)] +use super::{Cell, MtpSession, Rc}; use crate::qwen_forward::session::chunk::{ChunkRowResidual, QwenChunkTxn}; // The same validated frame and canonical packed K/V tuple. diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/chunk/mtp_session.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/chunk/mtp_session.rs index 72626b18..238c23cf 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/chunk/mtp_session.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/chunk/mtp_session.rs @@ -1,8 +1,10 @@ //! Methods of `MtpSession`: `test_chunk_snapshot`, `test_chunk_eq`. //! Split out of `chunk` to keep its files under the line limit. -#[allow(unused_imports)] -use super::*; +#[cfg(all(test, target_arch = "x86_64"))] +use super::MtpChunkNumericSnapshot; +#[cfg(test)] +use super::{MtpSession, Rc}; #[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] impl MtpSession { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/prefix_draft_snapshot.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/prefix_draft_snapshot.rs index ae8d78aa..2ebf9e07 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/prefix_draft_snapshot.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/prefix_draft_snapshot.rs @@ -1,8 +1,11 @@ //! Methods of `PrefixDraftSnapshot`: `has_prefix`, `numeric_eq`, `retained_bytes`. //! Methods of `MtpSession`: `test_prefix_snapshot`, `admit_snapshot_owner`, `admit_snapshot_frame`. -#[allow(unused_imports)] -use super::*; +use super::{CellPair, Error, HALF_ROW, MtpCheckpoint, MtpFrame, Rc, Result}; +#[cfg(all(test, target_arch = "x86_64"))] +use super::PrefixDraftSnapshot; +#[cfg(test)] +use super::{ModelBinding, MtpSession}; #[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] impl PrefixDraftSnapshot { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/tests.rs index c7de3c36..510c1d5e 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/tests.rs @@ -1,6 +1,9 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). -use super::*; +use super::{ + BindingIdentity, Cell, CellPair, DenseKv, Dimension, Error, HALF_ROW, MtpCheckpoint, MtpFrame, MtpSession, + Position, Rc, TokenId, Weak, first_seed_retained_charge, validate_half, +}; use crate::qwen_forward::session::QwenSession; fn draft() -> (MtpSession, MtpFrame) { let binding = BindingIdentity::test_identity(); diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_attention/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_attention/tests.rs index f5788120..282b5669 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_attention/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_attention/tests.rs @@ -1,6 +1,6 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). -use super::*; +use super::{Error, geometry, validate_window}; #[test] fn mtp_attention_new_causal_geometry_and_budget_boundaries() { for (position, width, half_bytes, scratch) in [ diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu.rs index 8edf3483..14c39eb8 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu.rs @@ -1,6 +1,11 @@ //! ONE authentic changed MTP boundary. Root schedules this ignored entry only. //! Full heads/state stay private; output contains counts and predicates only. -use super::*; +use super::{ + DenseWeightCache, Dimension, DraftHeadOwners, Error, KarPleCache, KnownNext, ModelBinding, MoeWeightCache, + MtpDecoder, MtpInput, MtpSession, MtpWindowError, MtpWindowRequest, MtpWindowSpec, OutputStage, Position, + PrefillStepProduct, QwenForward, QwenSession, ReadyMtpChunk, Result, StepSessions, TargetStepProduct, TokenId, + VerificationChunk, VerificationSource, WindowCaches, WindowOwners, mtp, +}; use crate::model_binding::qwen4exp_kar_ple::InheritedKarArchive; use crate::qwen_forward::contract::Stage; use crate::qwen_forward::session::ResetReplaySnapshot; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/chunk.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/chunk.rs index 4d551d2e..8536a674 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/chunk.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/chunk.rs @@ -1,5 +1,5 @@ //! Real ordered MTP warm edges with a jointly published target chunk. -use super::*; +use super::{Error, ModelBinding, MoeWeightCache, MtpDecoder, Result, mtp, reserve}; use crate::qwen_forward::{ mtp::MtpChunkStage, session::chunk::{ChunkDraftPublication, QwenChunkTxn}, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/mtp_decoder.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/mtp_decoder.rs index d275798c..26821682 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/mtp_decoder.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/mtp_decoder.rs @@ -1,8 +1,15 @@ //! The methods of `MtpDecoder` that run a window: the batched window (with its plan), the scalar window and the //! draft warm-up. Separate from `mtp_decode`, which holds the decoder itself. -#[allow(unused_imports)] -use super::*; +use super::{ + DenseWeightCache, Dimension, DraftHeadOwners, Error, KarPleCache, KnownNext, ModelBinding, MoeWeightCache, + MtpDecoder, MtpInput, MtpSession, MtpVerifiedWindow, MtpWindowError, MtpWindowRequest, MtpWindowSpec, OutputStage, + Position, PrefillStepProduct, QwenForward, QwenSession, ReadyMtpChunk, Result, StepSessions, TargetStepProduct, + TokenId, VerificationChunk, VerificationSource, WindowCaches, WindowOwners, first_seed_reuse_enabled, + kv_prefill_host_charge, mtp, needed_draft_predictions, reserve, window_limit, window_stage_error, +}; +#[cfg(all(test, target_arch = "x86_64"))] +use super::batch_gpu; mod batched_window_plan; mod batched_window; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/mtp_decoder/draft_warm_and_window.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/mtp_decoder/draft_warm_and_window.rs index 9bd966e5..63900082 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/mtp_decoder/draft_warm_and_window.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/mtp_decoder/draft_warm_and_window.rs @@ -1,7 +1,10 @@ //! MtpDecoder: draft warming along known-next edges, and the window entry that picks the batched or scalar window. -#[allow(unused_imports)] -use super::*; +use super::{ + Dimension, DraftHeadOwners, Error, KnownNext, ModelBinding, MoeWeightCache, MtpDecoder, MtpInput, MtpSession, + MtpVerifiedWindow, MtpWindowError, MtpWindowRequest, PrefillStepProduct, QwenSession, Result, StepSessions, + TargetStepProduct, TokenId, WindowOwners, kv_prefill_host_charge, mtp, reserve, +}; impl MtpDecoder { pub(crate) fn new(binding: &ModelBinding) -> Result { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace/role.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace/role.rs index b1813f4d..d2b727b2 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace/role.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace/role.rs @@ -1,8 +1,12 @@ //! Methods of `Role`: `slot`, `output_slot`, `count`. //! Methods of `Transport`: `new`, `note`, `allocate`, `buffer` and 11 more. -#[allow(unused_imports)] -use super::*; +use super::{ + Cell, DEVICE_PEAK, DeviceBuffer, Error, FF, Finite, FixedBuffers, N, Rc, Result, Role, Slot, Transport, at, + download, moe_driver_error, preflight, validate_values, +}; +#[cfg(test)] +use super::K; impl Role { pub(super) fn slot(self) -> Slot { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace/transport_drop.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace/transport_drop.rs index f7588007..aca3f382 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace/transport_drop.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace/transport_drop.rs @@ -1,8 +1,13 @@ //! Methods of `Packed`: `new`, `pack`, `observe_packed`, `combine`. Methods of `Slot`: `bytes`. //! Implements `Drop for Transport`. Functions: `at`, `routed_hidden`, `routed_down`, `routed` and 8 more. -#[allow(unused_imports)] -use super::*; +use super::{ + CHARGES, Cell, DenseFormat, DeviceBuffer, Error, ExpertInputs, FF, Finite, FixedBuffers, K, N, Packed, + ProjectionKind, ProjectionSpec, QuantizedIndices, Rc, Result, Role, RouteSlot, Slot, Transport, moe_driver_error, + preflight, validate_route, validate_values, +}; +#[cfg(test)] +use super::download; impl Drop for Transport<'_, '_> { fn drop(&mut self) { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/mtp_expert_transport/shared_project.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/mtp_expert_transport/shared_project.rs index f4b5cb04..fe6cff1e 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/mtp_expert_transport/shared_project.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/mtp_expert_transport/shared_project.rs @@ -1,8 +1,16 @@ //! Methods of `Packed`: `new`, `pack`, `observe_packed`, `combine`. //! Functions: `shared_project`, `shared_hidden`, `shared_down`, `shared_scaled` and 6 more. -#[allow(unused_imports)] -use super::*; +use super::{ + Cell, Context, DenseFormat, DeviceBuffer, Error, FF, Finite, K, N, Packed, ProjectionKind, ProjectionSpec, Rc, + Result, Role, RoutedExpert, Transport, at, moe_driver_error, preflight, routed, validate_route, validate_values, +}; +#[cfg(all(test, target_arch = "x86_64"))] +use super::FixedReference; +#[cfg(test)] +use super::ObservedOutput; +#[cfg(test)] +use super::download; pub(super) fn shared_project( transport: &mut Transport<'_>, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/tests.rs index e2ef6ee9..efae8aa1 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/tests.rs @@ -1,6 +1,6 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). -use super::*; +use super::{Error, K, down_tile, gate_up_tile, validate_route}; fn fixture(rows: usize, blocks: usize, salt: u8) -> Vec { let mut bytes = vec![0; rows * blocks * 18]; for row in 0..rows { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_config/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_config/tests.rs index b259f621..e2ecd974 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_config/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_config/tests.rs @@ -1,6 +1,12 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). -use super::*; +use super::{ + Error, ExpertBlobSizes, OriginalMtpGrVariant, RopeConstants, SamplerPath, driver_sampler_params, greedy_params, + legacy_footprint, mtp_full_policy, mtp_pack_experts_needed, mtp_scalar_policy, prefill_layout_options, + sampler_path, verify_geometry, +}; +#[cfg(test)] +use super::legacy_footprint_from; #[test] fn the_pack_expert_bank_is_needed_only_without_an_rt_directory() { // pack-driven draft (no RT directory): the pack's experts are the draft layer's experts diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/env_tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/env_tests.rs index b0a9626d..2eed6bf0 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/env_tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/env_tests.rs @@ -3,7 +3,7 @@ //! `NanGuard::from_environment`): what each spelling selects, and which malformed values are ignored. use super::super::original_spec_adaptive::{AdaptiveConfig, FLOOR_CEILING_LEGACY}; use super::super::original_spec_controller::NanGuard; -use super::*; +use super::{MAX_T, OriginalServeSettings}; use crate::settings::MapEnv; const VOCAB: u32 = 1000; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/tests.rs index 7b78292a..4763a638 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/tests.rs @@ -2,7 +2,12 @@ use super::super::original_spec_controller::{NanGuard, OriginalSpecController, SpecConfig, SpecError, SpecWindow}; use super::super::original_spec_draft::{DraftPreparation, DraftSampling, VerifiedWindow}; -use super::*; +use super::{ + ADAPTIVE_DEFAULT, AdaptiveConfig, CommittedWindow, DraftCompletion, DraftLimits, DraftPick, EnvSource, Error, + FirstDraftSeed, MAX_T, OriginalDraftEngine, OriginalFirstDraftEngine, OriginalServeEngine, OriginalServePort, + OriginalServeSettings, OriginalSpecEngine, Rc, Result, ServeCallbacks, ServeOutcome, ServeStop, ServedWindow, + SpeculativeRequest, TargetSeedRow, serve_request, +}; use std::cell::RefCell; const VOCAB: u32 = 1000; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_host/ple_on_chain/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_host/ple_on_chain/tests.rs index 7300c7f1..6e76dcd7 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_host/ple_on_chain/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_host/ple_on_chain/tests.rs @@ -1,6 +1,6 @@ //! The ahead gather asks for exactly the rows the window's own fold asks for. -use super::*; +use super::{PleOnChain, WindowStart, enabled, window_before, window_input}; /// `InputStage::original_window_ple`'s fold: row `i` sees the last two tokens of `predecessors ++ tokens[..i]`. fn folded_before(predecessors: [i32; 2], tokens: &[i32]) -> Vec<[i32; 2]> { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_host/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_host/tests.rs index f6c8f7b8..10f5d4b7 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_host/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_host/tests.rs @@ -1,6 +1,6 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). -use super::*; +use super::{HostOutcome, RequestSampling, SamplerParams, SamplerPath}; fn greedy() -> SamplerParams { crate::qwen_forward::original_serve_config::greedy_params(1) diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_pool/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_pool/tests.rs index 34203e95..790b9fd9 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_pool/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_pool/tests.rs @@ -1,6 +1,8 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). -use super::*; +use super::{Error, ExpertJob, HIDDEN, TOP_K, output_offset, plan_experts_where, scatter, selection}; +#[cfg(test)] +use super::plan_experts; fn ids(rows: &[[i32; TOP_K]]) -> Vec { rows.iter().flatten().copied().collect() diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_request/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_request/tests.rs index 833a3add..e0b02ba8 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_request/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_request/tests.rs @@ -1,7 +1,10 @@ //! Unit tests of `original_serve_request`. use super::super::original_serve_engine::ServeStop; -use super::*; +use super::{ + Admission, ENDOFTEXT_TOKEN, Error, RequestOwners, ServeError, ServeOutcome, ServeRequest, SpecError, admit, + original_stop_tokens, run_request, +}; use leleka_cuda_driver::SamplerPath; fn request(prompt: usize, max_new: usize) -> ServeRequest { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/open_tier.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/open_tier.rs index ee346b0c..04c4d0bf 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/open_tier.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/open_tier.rs @@ -1,8 +1,14 @@ //! Functions: `open_tier`, `fill_and_pin`, `read_profile`, `warn_decode_headroom` and 15 more. //! Split out of `original_serve_residency` to keep its files under the line limit. -#[allow(unused_imports)] -use super::*; +use super::{ + AtomicU32, Context, CpuExpertPool, EnvSource, Error, ExpertTierConfig, LOAN_FLOOR, MappedExpertBank, ModelBinding, + MoeWeightCache, ORIGINAL_VERIFY_MAX_PCIE_FETCHES, Ordering, OriginalCacheOptions, OriginalExpertCache, + OriginalGpuStream, OriginalRankedExperts, OriginalServePool, OriginalVerifyCpuRows, OriginalVerifyCpuSink, + OriginalVerifyGpuPlan, OriginalVerifyPcieSource, PathBuf, PcieSplitPolicy, Rc, ResidentExpertBankSpan, Result, + RoutedGroup, SpanCache, StrataPcieAuto, SwapSources, TieOrder, VANILLA_FREE_FLOOR_MIB, VERIFIER_ASSEMBLY_MIB, + driver_error, original_cache_startup, span_cache_enabled, +}; use leleka_cuda_driver::RefillBatchOptions; /// generate.cpp startup of the tier for the serve stack: size and open the cache after every other owner, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/tests.rs index 7e693e81..0fc54c52 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/tests.rs @@ -1,6 +1,11 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). -use super::*; +use super::{ + EXPERTS, ExpertTierConfig, GroupSplit, LAYERS, PcieLag, PcieMode, PcieSplitPolicy, ResidencyState, RoutedGroup, + VANILLA_FREE_FLOOR_MIB, VERIFIER_ASSEMBLY_MIB, adapt_decay, choose_swaps, split_group_pcie, split_group_tail, +}; +#[cfg(test)] +use super::{choose_swaps_reference, split_group}; #[test] fn adapt_decay_outside_zero_to_one_falls_back_to_the_default_with_a_line() { @@ -107,8 +112,6 @@ fn choose_swaps_timing() { eprintln!("choose_swaps: new {fast:.0} us, reference {slow:.0} us per call ({a} {b})"); } -use super::*; - fn row(ids: [i32; 10]) -> Vec { ids.to_vec() } diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/tier_env_tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/tier_env_tests.rs index e7172287..975b24d8 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/tier_env_tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/tier_env_tests.rs @@ -1,6 +1,6 @@ //! Golden cases of `ExpertTierConfig::from_source`, the strict parser of the `LELEKA_ORIGINAL_SERVE_*` tier //! switches: a value that does not parse (or fails `validate`) is refused, never ignored. -use super::*; +use super::{ExpertTierConfig, PathBuf, PcieMode, ResidencyState, Result}; use crate::settings::MapEnv; const P: &str = "LELEKA_ORIGINAL_SERVE_"; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/conversation/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/conversation/tests.rs index 21c64c68..20f401d6 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/conversation/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/conversation/tests.rs @@ -1,6 +1,6 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). -use super::*; +use super::{ConversationConfig, Error, PromptOptions, RequestStart, ResumeDevice, ServeConversation, TURN_TOKEN}; use crate::backend::original_prompt::{PlanLimits, PromptPath, PromptPlan, ResumePoint}; /// A device whose state is the token list it holds; points are copies of it. A restore is only possible diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/open_phase_steps.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/open_phase_steps.rs index 3a2a3bf0..48b42a19 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/open_phase_steps.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/open_phase_steps.rs @@ -2,8 +2,15 @@ //! embedding), in the order `open` runs them. Each step keeps its stage marks, notes and error context. // Stays a glob on purpose: the file is at the 400-line limit and the explicit list would put it over. -#[allow(unused_imports)] -use super::*; +use super::{ + Context, DenseWeightCache, DraftAttachmentTables, DraftAttachmentTarget, Error, ExecutorOpening, ExecutorSizing, + ExecutorTarget, KarPleCache, LOAN_TIER_ROWS, LoanTier, ModelBinding, MoeWeightCache, NativeHeadDispatch, + OriginalExpertCache, OriginalMtpFullOwner, OriginalNativeOutput, OriginalPromptEmbedding, OriginalPromptExecutor, + OriginalServeSettings, OriginalSpecController, PARKED_BYTES_PER_TOKEN, PARKED_STATE_ESTIMATE, PINNED_MODEL, + PrefillLayoutOptions, PrefixServe, PromptWeights, QwenSession, Rc, RtMtpLoad, ServeFailure, StackBlock, + StackConfig, StackState, VOCABULARY, at, dbg_el, failure, operator_note, original_serve_residency, prefill_bytes, + vram_note, +}; use crate::qwen_forward::session::original_prompt::draft::OriginalDraftSession; /// The window policies of the environment: the live one, the parked arms and the widest window any of them needs. diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/clock_tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/clock_tests.rs index 0574c43a..c8c2a308 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/clock_tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/clock_tests.rs @@ -1,7 +1,7 @@ //! The retention clock of the prefix cache on a manual clock (STRA-338 S14). use super::tests::{Fake, G, cfg, request}; -use super::*; +use super::{AnyClock, PrefixServe}; use leleka_obs::time::ManualClock; /// The retention clock is the one the cache was built with (STRA-338 S14): a session survives exactly its retention. diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/tests.rs index 5d3c55a7..e0fd1b35 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/tests.rs @@ -1,6 +1,10 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). -use super::*; +use super::{ + AnyClock, ByteSize, ChunkOutcome, Clock, Consider, Error, PolicyParams, PrefixBudget, PrefixConfig, PrefixDevice, + PrefixMatch, PrefixServe, PrefixStore, PrefixSummary, Reject, Start, Stats, Stopwatch, StoreConfig, TailMode, + budget, +}; use crate::backend::original_prompt::{PlanLimits, PromptOptions, PromptPath, PromptPlan, ResumePoint}; pub(super) const G: usize = 256; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/tests.rs index 69b63281..f2a4bbe0 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/tests.rs @@ -1,6 +1,9 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). -use super::*; +use super::{ + ADMITTED_CAPACITIES, Error, ExpertBlobSizes, KvFormat, LoanTier, PlanError, PrefillLayoutOptions, StackConfig, + TURN_TOKEN, plan_error, prefill_bytes, prefill_layout_options, tier_for, +}; #[test] fn a_chunk_borrows_the_smallest_rung_that_holds_it() { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_verifier/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_verifier/tests.rs index c7cbf21c..cba5d972 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_verifier/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_verifier/tests.rs @@ -1,6 +1,8 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). -use super::*; +use super::{ + Error, PLE_HISTORY_BYTES, PLE_HISTORY_VALUES, ServeFailure, Stage, assemble_with_window_fallback, window_cap_after, +}; use leleka_cuda_driver::Error as D; #[test] diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/tests.rs index 82dc4af6..354051af 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/tests.rs @@ -1,7 +1,11 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). use super::super::original_spec_draft::{DraftPick, FirstSeedPoint, OriginalFirstDraftEngine, TargetSeedRow}; -use super::*; +use super::{ + AdaptiveConfig, AdaptivePolicy, Choice, DraftBatch, DraftPlan, DraftPolicy, DraftPreparation, DraftSampling, Error, + MAX_T, NanGuard, Offer, Origin, OriginalDraftEngine, OriginalSpecController, OriginalSpecEngine, PrefixMemo, Rc, + Result, RoundFacts, SpecConfig, SpecError, SpecStats, SpecWindow, SuffixDrafter, VerifiedWindow, +}; mod golden; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/output/output_stage_test_replay.rs b/crates/engine-qwen35-cuda/src/qwen_forward/output/output_stage_test_replay.rs index 0ca188c4..c4f9ece8 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/output/output_stage_test_replay.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/output/output_stage_test_replay.rs @@ -1,8 +1,13 @@ //! Methods of `OutputStage`: `test_prefix_begin_target`, `test_reset_replay_record`, `test_reset_replay_capture`, `s... //! Functions: `greedy`, `selected_token`, `validate_weight_owner`, `encode_activation` and 4 more. -#[allow(unused_imports)] -use super::*; +use super::{ + ACTIVATION_BYTES, BindingIdentity, Dimension, EMBEDDING, Error, FiniteF32, FiniteLogits, HeadGreedySelection, + LOGIT_BYTES, LogitValues, OUTPUT_WEIGHT_BYTES, OutputBindingError, OutputWeights, Result, Stage, TokenId, + VOCABULARY, +}; +#[cfg(test)] +use super::OutputStage; // The real ignored reset test opts in explicitly. Other test callers retain // no extra values; production builds have neither this storage nor a reader. diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/output/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/output/tests.rs index e221415b..d7cb62f7 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/output/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/output/tests.rs @@ -1,6 +1,9 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). -use super::*; +use super::{ + BindingIdentity, Dimension, Error, FiniteF32, FiniteLogits, LOGIT_BYTES, LogitValues, OutputWeights, Position, + TokenId, VOCABULARY, combine, decode_logits, greedy, validate_weight_owner, +}; fn finite_values(fill: f32) -> Vec { vec![FiniteF32::new(fill).expect("finite fixture"); VOCABULARY] diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_attention/attention_scratch.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_attention/attention_scratch.rs index a77d305c..b5da2426 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_attention/attention_scratch.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_attention/attention_scratch.rs @@ -1,5 +1,11 @@ //! Exclusive current-row storage only; no checkpoint or cross-row finite proof. -use super::*; +use super::{ + BindingIdentity, Cell, Context, DenseWeightCache, DeviceBuffer, Error, LayerId, ModelBinding, Q, QsaAttendBuffers, + QsaAttentionStage, QsaPrepared, QsaReady, QsaSelectedCache, QwenStepTxn, Rc, Result, TokenLayer, admit_budget, + attention_driver_error, download, release_retained, validate_values, +}; +#[cfg(test)] +use super::{SelectedKvBytes, attend_retained, gate_retained, release, upload_bytes}; use std::cell::{RefCell, RefMut}; pub(in crate::qwen_forward) const SCRATCH_BYTES: usize = 108_544; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_attention/attention_scratch/gpu.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_attention/attention_scratch/gpu.rs index 887bd046..c8354765 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_attention/attention_scratch/gpu.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_attention/attention_scratch/gpu.rs @@ -1,5 +1,8 @@ //! Numeric whole-owner test only; never fabricates a model or prepared row. -use super::*; +use super::{ + Cell, Context, DeviceBuffer, Error, Q, Rc, RefCell, Result, SCRATCH_BYTES, SIZES, ScratchBuffers, SelectedKvBytes, + attend_retained, attention_driver_error, gate_retained, release, upload_bytes, validate_values, +}; use crate::model_binding::qwen4exp_input::QsaMatrixKind; use leleka_cuda_driver::{Bf16ProjectionShape, Driver}; use std::panic::{AssertUnwindSafe, catch_unwind, resume_unwind}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/context.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/context.rs index 22db4250..54fe6a15 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/context.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/context.rs @@ -1,8 +1,14 @@ //! Methods of `QsaOwner`: `new`, `matches`. //! Methods of `QsaPrior`: `oracle_capture_parts`, `test_reset_replay_numeric_eq`, `same_native_kv`, `same_pages` and... -#[allow(unused_imports)] -use super::*; +use super::{ + BindingIdentity, Directory, Error, KV, LayerId, PackedKv, Position, QsaOwner, QsaPrior, Rc, Result, Stage, State, + reserve, validate_half, validate_ids, validate_values, +}; +#[cfg(all(test, target_arch = "x86_64"))] +use super::OracleQsaParts; +#[cfg(test)] +use super::PAGE; /// The serving context in cells (262144 unless configured; see `contract::serving_cells`). pub(super) fn context() -> usize { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/index_resident.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/index_resident.rs index 2c9e6762..f0a66c49 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/index_resident.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/index_resident.rs @@ -1,6 +1,17 @@ //! Actor-owned bounded index-key mirror; host QsaPrior remains canonical. //! Only exact immutable parent identity permits incremental device publication. -use super::*; +use super::{ + Bf16ProjectionShape, BindingIdentity, BlockQuery, Context, DenseFormat, DenseWeightCache, DeviceBuffer, Directory, + DriverError, Error, GrRole, InputBindingError, KvPage, LayerId, ModelBinding, PAGE, Position, ProjectionKind, + ProjectionSources, ProjectionSpec, Q5KProjectionShape, Q6KProjectionShape, QsaAttendBuffers, QsaGated, + QsaInputLease, QsaInputScratch, QsaLayerProjection, QsaMatrixKind, QsaMatrixLayout, QsaMatrixRole, QsaOwner, + QsaPrior, QsaSelectedCache, QsaSelectionRequest, QsaWeights, QwenStepTxn, Rc, ResidualReady, Result, Stage, State, + TokenLayer, admit_budget, context, device_peak, driver_error, reserve, select_with_keys, validate_values, +}; +#[cfg(all(test, target_arch = "x86_64"))] +use super::combined_qsa_observer; +#[cfg(test)] +use super::{KV, QsaPending, select}; use std::cell::Cell; const ROW_BYTES: usize = 128 * 4; #[derive(Debug, PartialEq, Eq)] diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/index_resident/synthetic_late_prior.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/index_resident/synthetic_late_prior.rs index ed005940..436d28fd 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/index_resident/synthetic_late_prior.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/index_resident/synthetic_late_prior.rs @@ -1,8 +1,8 @@ //! Functions: `synthetic_late_prior`, `synthetic_late_prior_for`. //! Split out of `index_resident` to keep its files under the line limit. -#[allow(unused_imports)] -use super::*; +#[cfg(test)] +use super::{BindingIdentity, Directory, KvPage, LayerId, PAGE, QsaOwner, QsaPrior, Rc, State}; #[cfg(test)] pub(super) fn synthetic_late_prior(position: u64) -> QsaPrior { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/input_reuse_gpu_tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/input_reuse_gpu_tests.rs index 36d00af4..bd710af3 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/input_reuse_gpu_tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/input_reuse_gpu_tests.rs @@ -1,6 +1,9 @@ //! New QSA current-source lease parity; synthetic component, never ModelBinding. #![cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -use super::*; +use super::{ + BindingIdentity, Context, DeviceBuffer, Error, QsaInputLease, QsaInputScratch, QsaMatrixKind, QsaMatrixLayout, + QsaMatrixRole, allocate, dispatch_projection, download, input_scratch, project_input_numeric, upload, +}; use crate::qwen_forward::gdn::LeaseClaim; use input_scratch::INPUT_BYTES; use leleka_cuda_driver::Driver; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device.rs index cd80e1c8..1ba96826 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device.rs @@ -5,7 +5,15 @@ use super::super::dense_weight_cache::QsaResident; use super::super::qsa_attention::PromptDevices; use super::super::qsa_prompt_index::PromptChunkOwners; use super::super::session::{TargetStepOrigin, chunk::QwenChunkTxn}; -use super::*; +use super::{ + Bf16ProjectionShape, BindingIdentity, BlockQuery, Cell, Context, DenseFormat, DenseWeightCache, DeviceBuffer, + Directory, DriverError, Error, GrRole, InputBindingError, LayerId, ModelBinding, Position, ProjectionKind, + ProjectionSources, ProjectionSpec, Q5KProjectionShape, Q6KProjectionShape, QsaAttendBuffers, QsaGated, + QsaIndexKeyCache, QsaInputLease, QsaInputScratch, QsaLayerProjection, QsaMatrixKind, QsaMatrixLayout, + QsaMatrixRole, QsaOwner, QsaPending, QsaPrior, QsaSelectedCache, QsaSelectionRequest, QsaWeights, QwenStepTxn, Rc, + ResidualReady, Result, Stage, TokenLayer, allocate, context, download, driver_error, project, + project_scratch_out_numeric, upload, validate_values, +}; use crate::qwen_forward::prompt_device_rows::PromptWeights; use leleka_cuda_driver::{ CompletedQsaKvAppend, NativeBatchWorkspace, OriginalDeviceBlock, OriginalDeviceGrRead, OriginalQsaDeviceSelection, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device.rs index 59b90426..61b07083 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device.rs @@ -3,7 +3,19 @@ //! Root session adapter validates the actual Attention(layer) physical read and //! stores all twelve actual seals before joint target/draft publication. use super::super::super::{input::InputReady, session::QwenSession}; -use super::*; +use super::{ + Bf16ProjectionShape, BindingIdentity, BlockQuery, CompletedQsaKvAppend, Context, DenseFormat, DenseWeightCache, + DeviceBuffer, Directory, DriverError, Error, GrRole, InputBindingError, LayerId, ModelBinding, + NativeBatchWorkspace, OriginalDeviceBlock, OriginalDeviceGrRead, OriginalQsaDeviceSelection, + OriginalQsaPromptDevice, OriginalQsaPromptWeights, Position, ProjectionKind, ProjectionSources, ProjectionSpec, + PromptChunkOwners, PromptDevices, PromptWeights, Q5KProjectionShape, Q6KProjectionShape, QsaAttendBuffers, + QsaChunkPrior, QsaGated, QsaIndexKeyCache, QsaIndexPrior, QsaInputLease, QsaInputScratch, QsaKvAppendTarget, + QsaLayerProjection, QsaMatrixKind, QsaMatrixLayout, QsaMatrixRole, QsaNativeKind, QsaOwner, QsaPrior, + QsaPromptIndexState, QsaPromptKv, QsaResident, QsaSelectedCache, QsaSelectionRequest, QsaWeights, QwenChunkTxn, + QwenStepTxn, Rc, ResidualReady, Result, Stage, TargetStepOrigin, TokenLayer, allocate, check_prompt_shapes, + context, device_error, download, native, project, project_scratch_out_numeric, prompt_projections, upload, + validate_values, +}; use leleka_cuda_driver::{ OriginalQsaIndexBatch, OriginalQsaIndexCheckpoint, OriginalQsaResidentAppendTarget, OriginalQsaResidentIndex, QsaNativeWeight, ResidentContinuation, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/scalar.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/scalar.rs index bcb2ba60..c179be2c 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/scalar.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/scalar.rs @@ -1,7 +1,14 @@ //! Genuine current scalar target/MTP continuation of the same live resident //! layer. Old scalar projection/gate/Out math is retained; no index/page image. use super::resident_qsa_layer::mint; -use super::*; +use super::{ + BindingIdentity, Context, DenseWeightCache, DeviceBuffer, Error, GrRole, LayerId, ModelBinding, + NativeBatchWorkspace, OriginalQsaIndexCheckpoint, OriginalQsaMappedAppend, OriginalQsaMappedJournal, + OriginalQsaResidentIndex, OriginalQsaResidentTransport, QsaMatrixKind, QsaMatrixRole, QsaResident, QsaWeights, + QwenStepTxn, Rc, ResidentQsaLayer, ResidentQsaPrior, ResidentQsaSeal, ResidualReady, Result, Stage, + TargetStepOrigin, TokenLayer, allocate, device_error, download, project, project_scratch_out_numeric, upload, + validate_values, +}; use leleka_cuda_driver::{ OriginalQsaResidentScalarIndex, OriginalQsaResidentScalarSelection, QsaAttentionInputs, QsaNativeDecode, QsaNativeGate, ResidentContinuation, ScalarStepRows, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/scalar/scalar_row_run.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/scalar/scalar_row_run.rs index e1c89836..75d8fa5d 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/scalar/scalar_row_run.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/scalar/scalar_row_run.rs @@ -8,6 +8,7 @@ use super::{ ScalarOwners, ScalarStep, TargetStepOrigin, TokenLayer, allocate, driver, gate_and_out, mint, upload, validate_values, }; +use crate::qwen_forward::qsa_index::admit_budget; /// The transaction, the input row and the projection branch agree with the layer before any lineage is looked at. fn validate_scalar_row( @@ -90,7 +91,7 @@ impl<'source, 'lease, 'index, 'weights, 'ctx> ResidentQsaScalar<'source, 'lease, let ScalarStep { binding, cache, txn, input } = step; let ScalarOwners { attention, stage, gate_owner } = owners; self.validate(binding, cache, txn, input)?; - super::super::super::admit_budget(self.context)?; + admit_budget(self.context)?; let append = self.kv.append_resident_decode(workspace, stage, &self.prior.0.kv, &self.selected).map_err(driver)?; let attended = self.attend(workspace, attention, &append)?; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/selected_cache.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/selected_cache.rs index 6bc7a2a4..3f9127d2 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/selected_cache.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/selected_cache.rs @@ -1,6 +1,11 @@ //! Lossless selected-cell residency. The immutable host pages remain canonical. //! A lookup address is only an index: every hit also proves a live identical Rc page. -use super::*; +use super::{ + BindingIdentity, Cell, Context, DeviceBuffer, Error, KV, KvPage, QsaOwner, QsaPrepared, QsaPrior, Rc, Result, + device_peak, driver_error, reserve, validate_half, validate_ids, +}; +#[cfg(test)] +use super::{LayerId, Position, QsaPending, TokenLayer}; use leleka_cuda_driver::QsaSelectedKvWorkspace; use std::{collections::HashMap, rc::Weak}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/selected_cache/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/selected_cache/tests.rs index 739c075a..f3e52a4e 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/selected_cache/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/selected_cache/tests.rs @@ -1,6 +1,9 @@ //! Unit tests of the selected-cell cache (moved out of the file by STRA-338; the test ids are unchanged). -use super::*; +use super::{ + BindingIdentity, Error, KV, LayerDirectory, LayerId, Plan, Position, QsaOwner, QsaPending, QsaPrior, Rc, Result, + TokenLayer, plan, +}; use crate::qwen_forward::contract::{Dimension, TokenId}; fn append(prior: &QsaPrior, word: u16) -> Result { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk.rs index a4d70f47..29121f58 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk.rs @@ -1,6 +1,11 @@ //! Private layer-major staging. Original committed owner never advances here. #![allow(dead_code)] -use super::*; +use super::{ + BindingIdentity, BoundLayerKind, Context, Dimension, Error, FiniteLogits, GdnOwner, GdnPending, GdnPrior, GrRole, + InjectedResidual, InputReady, LayerId, ModelBinding, PleOwner, PlePending, PlePrior, Position, QsaIndexPrior, + QsaOwner, QsaPending, QwenSession, QwenStepTxn, Rc, Result, STATE_CAPACITY, Stage, TargetStepOrigin, ThreadId, + TokenId, TokenLayer, chunk, +}; mod txn_groups; mod verify; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn.rs index 5d0e640b..9ccf55b9 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn.rs @@ -1,8 +1,16 @@ //! Groups the submodules `qwen_chunk_txn_attention_sources`, `qwen_chunk_txn_begin`, `qwen_chunk_txn_ffn_after_atten... //! Split out of `chunk` to keep its files under the line limit. -#[allow(unused_imports)] -use super::*; +use super::{ + ActiveMicroWindow, AttentionProgress, AttentionSource, BatchProgress, BindingIdentity, BoundLayerKind, + ChunkAttentionRow, ChunkCommit, ChunkDraftPublication, ChunkFfnRow, ChunkMicroWindow, ChunkRowResidual, Context, + Dimension, Error, FfnInjectionRow, FiniteLogits, GdnChunkAnchor, GdnChunkJournal, GdnChunkMicro, GdnChunkRow, + GdnChunkSeal, GdnChunkStart, GdnOwner, GdnPending, GdnPrior, GrRole, InjectedResidual, InputReady, LayerId, + MicroProgress, ModelBinding, PleOwner, PlePending, PlePrior, Position, PreparedLayerRow, PromptInit, QsaIndexPrior, + QsaOwner, QsaPending, QwenChunkTxn, QwenSession, QwenStepTxn, Rc, Result, Row, STATE_CAPACITY, Stage, + TargetStepOrigin, ThreadId, TokenId, TokenLayer, VerifiedDraftPublication, VerifiedTargetPrefix, chunk, + host_charge, host_charge_bounded, +}; mod qwen_chunk_txn_attention_sources; mod qwen_chunk_txn_begin; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn/qwen_chunk_txn_micro_window.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn/qwen_chunk_txn_micro_window.rs index c287cfb7..53f727f2 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn/qwen_chunk_txn_micro_window.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn/qwen_chunk_txn_micro_window.rs @@ -1,8 +1,12 @@ //! Methods of `QwenChunkTxn`: `check_micro_open`, `micro_misaligned`, `phase_in_flight`, `micro_width` and 19 more. //! Split out of `qwen_chunk_txn` to keep its files under the line limit. -#[allow(unused_imports)] -use super::*; +use super::{ + ActiveMicroWindow, ChunkMicroWindow, Context, Error, LayerId, Position, QsaIndexPrior, QwenChunkTxn, Rc, Result, + STATE_CAPACITY, +}; +#[cfg(test)] +use super::{Dimension, GrRole, InjectedResidual, Stage}; impl<'session, 'driver> QwenChunkTxn<'session, 'driver> { /// A micro window opens only on an idle windowed transaction, at the cursor, for the current layer. diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/test_gdn_component_rows.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/test_gdn_component_rows.rs index f72f2015..45411d88 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/test_gdn_component_rows.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/test_gdn_component_rows.rs @@ -1,8 +1,13 @@ //! Methods of `TestGdnComponentRows`: `new`, `start`, `row`, `seal`. //! Split out of `chunk` to keep its files under the line limit. -#[allow(unused_imports)] -use super::*; +#[cfg(all(test, target_arch = "x86_64"))] +use super::TestGdnComponentRows; +#[cfg(test)] +use super::{ + BindingIdentity, Dimension, Error, GdnChunkAnchor, GdnChunkRow, GdnChunkSeal, GdnChunkStart, GdnPrior, Position, + Rc, Result, TokenId, TokenLayer, +}; #[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] impl TestGdnComponentRows { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/verify.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/verify.rs index 30a32d38..ed07c9db 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/verify.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/verify.rs @@ -1,6 +1,12 @@ //! Private complete-state journal for a bounded target verification window. //! No provisional row is a committed TargetStepProduct or an origin. -use super::*; +use super::{ + ChunkCommit, ChunkRowResidual, Dimension, Error, GdnChunkAnchor, GdnChunkJournal, GdnPrior, GrRole, + InjectedResidual, LayerId, ModelBinding, PlePrior, Position, QsaIndexPrior, QwenChunkTxn, QwenSession, QwenStepTxn, + Rc, Result, Row, STATE_CAPACITY, Stage, TargetStepOrigin, TokenId, TokenLayer, host_charge_bounded, +}; +#[cfg(test)] +use super::{GdnChunkStart, PromptInit}; use crate::qwen_forward::executor::TargetStepProduct; const HOST_LIMIT: usize = 512 * 1024 * 1024; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/verify/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/verify/tests.rs index 7a32c319..09432b25 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/verify/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/verify/tests.rs @@ -1,6 +1,10 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). -use super::*; +use super::{ + Dimension, Error, GdnChunkAnchor, GdnChunkStart, HOST_LIMIT, LayerId, PlePrior, Position, PrefixState, PromptInit, + QwenChunkTxn, QwenSession, Rc, Row, Stage, TokenId, TokenLayer, VerificationJournal, greedy_prefix, + host_charge_bounded, verification_extra_charge, +}; fn token(value: u64) -> TokenId { TokenId::new(value, Dimension::new(248320).unwrap()).unwrap() } diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt.rs index 6eeff8fb..222fe1a9 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt.rs @@ -6,7 +6,12 @@ use super::super::prompt_device_rows::PromptWeights; use super::super::qsa_index::prompt_device::resident_device::{ ParkedLayerSpan, ParkedPrefix, ResidentQsaLayer, ResidentQsaOwners, ResidentQsaPrior, ResidentQsaSeal, SpanExport, }; -use super::*; +use super::{ + BindingIdentity, BoundLayerKind, Context, Dimension, Error, FiniteLogits, GdnOwner, GdnPending, GdnPrior, GrRole, + InjectedResidual, InputReady, LayerId, ModelBinding, PleOwner, PlePending, PlePrior, Position, QsaIndexPrior, + QsaOwner, QsaPending, QwenSession, QwenStepTxn, Rc, Result, STATE_CAPACITY, Stage, TargetStepOrigin, ThreadId, + TokenId, TokenLayer, chunk, +}; use std::cell::{Cell, RefCell}; pub(in crate::qwen_forward) mod draft; mod prompt_txn_owners; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/draft.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/draft.rs index 1a74d2fa..f02c4e78 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/draft.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/draft.rs @@ -1,6 +1,9 @@ //! Canonical Original INT8 draft owner. Actual immutable driver snapshots are //! bound to the real target branch; end metadata never invents older KV cells. -use super::*; +use super::{ + BindingIdentity, DenseWeightCache, Error, ModelBinding, OriginalPromptTxn, QwenSession, Result, Stage, + TargetStepOrigin, +}; use leleka_cuda_driver::{CompletedDraftKv, CompletedOriginalMtpDraft, Context, MtpInt8Snapshot, MtpOriginalInt8}; pub(in crate::qwen_forward) struct OriginalDraftSession<'ctx> { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/original_verified.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/original_verified.rs index 00df7299..d1ea21e8 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/original_verified.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/original_verified.rs @@ -19,7 +19,9 @@ //! describe a position the session does not hold); a checkpoint restore replaces every prior and ends it. use super::super::qsa_index::prompt_device::resident_device::ResidentQsaPrior; use super::checkpoint::{committed_origin, origin_at}; -use super::*; +use super::{ + Dimension, Error, GdnPrior, LayerId, PlePrior, Position, QwenSession, Result, STATE_CAPACITY, TargetStepOrigin, +}; /// Largest verified window (`kVerifyMaxT`). pub(in crate::qwen_forward) const MAX_WINDOW_ROWS: usize = 8; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/original_verified/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/original_verified/tests.rs index b037c6cf..fbeff6cb 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/original_verified/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/original_verified/tests.rs @@ -1,6 +1,6 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). -use super::*; +use super::{Error, GdnPrior, OriginalVerifiedLineage, PlePrior, QwenSession, STATE_CAPACITY, predecessors_after}; use crate::model_binding::qwen4exp_input::BindingIdentity; fn session(gdn: &[usize], ple: bool) -> QwenSession<'static> { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/reset_replay_snapshot.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/reset_replay_snapshot.rs index 2a5751ed..006c184a 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/reset_replay_snapshot.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/reset_replay_snapshot.rs @@ -1,8 +1,10 @@ //! Methods of `ResetReplaySnapshot`: `has_prefix`, `numeric_eq`, `same_shape`, `retained_bytes`. //! Methods of `QwenSession`: `oracle_capture_committed`, `validate_reset_states`, `validate_reset_ple`, `validate_re... -#[allow(unused_imports)] -use super::*; +#[cfg(all(test, target_arch = "x86_64"))] +use super::ResetReplaySnapshot; +#[cfg(test)] +use super::{Dimension, Error, LayerId, ModelBinding, Position, QwenSession, Result, STATE_CAPACITY}; #[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] impl ResetReplaySnapshot { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/tests.rs index 83b03773..000eec53 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/tests.rs @@ -1,6 +1,10 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). -use super::*; +use super::{ + BoundLayerKind, Context, Error, FiniteLogits, GdnOwner, GdnPending, GdnPrior, GrRole, InjectedResidual, InputReady, + LayerId, ModelBinding, PleOwner, PlePending, PlePrior, Position, QsaIndexPrior, QsaOwner, QsaPending, QwenSession, + Rc, Result, Stage, TargetStepOrigin, ThreadId, TokenId, TokenLayer, +}; use crate::model_binding::qwen4exp_input::BindingIdentity; use crate::qwen_forward::contract::Dimension; diff --git a/crates/engine-qwen35-cuda/src/serve_meta/tests.rs b/crates/engine-qwen35-cuda/src/serve_meta/tests.rs index eb12cea2..7dcb9731 100644 --- a/crates/engine-qwen35-cuda/src/serve_meta/tests.rs +++ b/crates/engine-qwen35-cuda/src/serve_meta/tests.rs @@ -1,6 +1,9 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). -use super::*; +use super::{ + BuildInfo, CacheFacts, ConfigFacts, MODEL_DIGEST_MAPPING, ModelFile, ModelInfo, Path, ProfileInfo, cache_line, + startup_lines, token, +}; const DIGEST: &str = "sha256:80d5e3333801cedbca81a5c19c24ed6bb48fd56977acd190318f66b23a1766a3"; const PROFILE_SHA: &str = "b5ebb652ad9b091e0e045e44d8adeb49fa7319c2f365c2ad150a3d567221e0cb"; diff --git a/crates/engine-qwen35-cuda/src/serve_tuning/tests.rs b/crates/engine-qwen35-cuda/src/serve_tuning/tests.rs index e254e7d6..c7c5c7ac 100644 --- a/crates/engine-qwen35-cuda/src/serve_tuning/tests.rs +++ b/crates/engine-qwen35-cuda/src/serve_tuning/tests.rs @@ -1,4 +1,4 @@ -use super::*; +use super::{OriginalServeOptions, PrefixCacheOptions, PrefixTail, Tuning, describe}; fn base() -> (OriginalServeOptions, u32) { let options = OriginalServeOptions { diff --git a/crates/engine-qwen35-cuda/src/settings/capture_tests.rs b/crates/engine-qwen35-cuda/src/settings/capture_tests.rs index bee15337..9b9ea93b 100644 --- a/crates/engine-qwen35-cuda/src/settings/capture_tests.rs +++ b/crates/engine-qwen35-cuda/src/settings/capture_tests.rs @@ -1,4 +1,4 @@ -use super::*; +use super::{EnvSource, MapEnv, ServeSettings, Settings}; #[test] fn only_the_operator_namespace_is_captured() { diff --git a/crates/engine-qwen35-cuda/src/settings/decode_tests.rs b/crates/engine-qwen35-cuda/src/settings/decode_tests.rs index 3619d1e7..2ecbcadb 100644 --- a/crates/engine-qwen35-cuda/src/settings/decode_tests.rs +++ b/crates/engine-qwen35-cuda/src/settings/decode_tests.rs @@ -1,5 +1,5 @@ //! Golden cases of the decode topic: each row is what the call site this field replaced returned for that value. -use super::*; +use super::{DecodeSettings, MapEnv, PleOnChain}; fn decode(pairs: &[(&str, &str)]) -> DecodeSettings { DecodeSettings::from_source(&MapEnv::of(pairs)) diff --git a/crates/engine-qwen35-cuda/src/settings/diagnostics_tests.rs b/crates/engine-qwen35-cuda/src/settings/diagnostics_tests.rs index 5a424651..b0dce80e 100644 --- a/crates/engine-qwen35-cuda/src/settings/diagnostics_tests.rs +++ b/crates/engine-qwen35-cuda/src/settings/diagnostics_tests.rs @@ -1,5 +1,5 @@ //! Golden cases of the diagnostics topic: each row is what the call site this field replaced returned for that value. -use super::*; +use super::{DiagnosticsSettings, MapEnv}; fn diag(pairs: &[(&str, &str)]) -> DiagnosticsSettings { DiagnosticsSettings::from_source(&MapEnv::of(pairs)) diff --git a/crates/engine-qwen35-cuda/src/settings/kv_tests.rs b/crates/engine-qwen35-cuda/src/settings/kv_tests.rs index 65eac585..0a619cba 100644 --- a/crates/engine-qwen35-cuda/src/settings/kv_tests.rs +++ b/crates/engine-qwen35-cuda/src/settings/kv_tests.rs @@ -1,5 +1,5 @@ //! Golden cases of the kv topic: each row is what the call site this field replaced returned for that value. -use super::*; +use super::{KvSettings, MapEnv}; fn kv(pairs: &[(&str, &str)]) -> KvSettings { KvSettings::from_source(&MapEnv::of(pairs)) diff --git a/crates/engine-qwen35-cuda/src/settings/memory_tests.rs b/crates/engine-qwen35-cuda/src/settings/memory_tests.rs index 4f00d787..90484943 100644 --- a/crates/engine-qwen35-cuda/src/settings/memory_tests.rs +++ b/crates/engine-qwen35-cuda/src/settings/memory_tests.rs @@ -1,5 +1,5 @@ //! Golden cases of the memory topic: each row is what the call site this field replaced returned for that value. -use super::*; +use super::{MapEnv, MemorySettings}; fn memory(pairs: &[(&str, &str)]) -> MemorySettings { MemorySettings::from_source(&MapEnv::of(pairs)) diff --git a/crates/engine-qwen35-cuda/src/settings/serve_tests.rs b/crates/engine-qwen35-cuda/src/settings/serve_tests.rs index 3abac8b2..1028654d 100644 --- a/crates/engine-qwen35-cuda/src/settings/serve_tests.rs +++ b/crates/engine-qwen35-cuda/src/settings/serve_tests.rs @@ -1,6 +1,6 @@ //! Golden cases of the serve topic: each row is what the call site this field replaced returned for that value. use super::parse::*; -use super::*; +use super::{MapEnv, ServeSettings}; fn serve(pairs: &[(&str, &str)]) -> ServeSettings { ServeSettings::from_source(&MapEnv::of(pairs)) From 001f2a3063b1a234279f39c79bbde69810afcf4b Mon Sep 17 00:00:00 2001 From: Pavlo Ratushnyi Date: Sat, 14 Nov 2026 20:53:02 +0100 Subject: [PATCH 03/10] Low-level crates: the generated doc headers (Methods of ..., Functions: ..., Split out of ...) are real descriptions: what the file holds and why it is a file of its own (604 files, comment lines only) Co-Authored-By: Claude Sonnet 5.5 --- crates/context/src/context_policy/tests.rs | 3 ++- crates/context/src/geometry/tests.rs | 3 ++- crates/context/src/memory_plan/tests.rs | 3 ++- crates/context/src/rope_scaling/rope_scaling_type.rs | 4 ++-- crates/context/src/rope_scaling/tests.rs | 3 ++- crates/cpu-sys/src/c_reference/abi_version.rs | 4 ++-- crates/cpu-sys/src/c_reference/quantize_q8_0_scalar.rs | 4 ++-- crates/cpu-sys/src/oracle.rs | 4 ++-- crates/cpu-sys/src/simd/x86.rs | 4 ++-- crates/cuda-driver/src/api/async_api.rs | 4 ++-- crates/cuda-driver/src/arch_ptx/stream_k_off.rs | 4 ++-- crates/cuda-driver/src/bringup_trace_enabled.rs | 4 ++-- crates/cuda-driver/src/closed_kernels/program.rs | 4 ++-- crates/cuda-driver/src/closed_kernels/s_gemv_slots.rs | 4 ++-- crates/cuda-driver/src/closed_kernels/tests.rs | 3 ++- crates/cuda-driver/src/closed_kernels_gpu/closed_kernels.rs | 4 ++-- .../closed_kernels/closed_kernels_flash_and_s_gemv.rs | 4 ++-- .../closed_kernels/closed_kernels_open_admit_run.rs | 4 ++-- crates/cuda-driver/src/closed_kernels_gpu/failure.rs | 4 ++-- crates/cuda-driver/src/closed_kernels_gpu_smoke/rng.rs | 4 ++-- crates/cuda-driver/src/context.rs | 4 ++-- .../cuda-driver/src/context_gate_up_projection_admission.rs | 4 ++-- crates/cuda-driver/src/context_matvec_k_quant_projections.rs | 4 ++-- crates/cuda-driver/src/context_projection_kernel_slots.rs | 4 ++-- .../cuda-driver/src/context_q8_1_and_gate_up_projection.rs | 4 ++-- crates/cuda-driver/src/context_unload_close_destroy.rs | 4 ++-- crates/cuda-driver/src/device_buffer.rs | 4 ++-- crates/cuda-driver/src/device_slab/tests.rs | 3 ++- crates/cuda-driver/src/experimental/kv_shape.rs | 4 ++-- crates/cuda-driver/src/experimental/mode.rs | 4 ++-- crates/cuda-driver/src/experimental/tests.rs | 3 ++- crates/cuda-driver/src/experimental_gpu/context.rs | 4 ++-- crates/cuda-driver/src/experimental_gpu/stream_map.rs | 4 ++-- crates/cuda-driver/src/family_tests.rs | 4 ++-- crates/cuda-driver/src/ffi/api.rs | 4 ++-- crates/cuda-driver/src/ffi/context_handle.rs | 4 ++-- crates/cuda-driver/src/ffi/driver_backed/api.rs | 4 ++-- .../src/ffi/driver_backed/device_context_memory_copies.rs | 4 ++-- crates/cuda-driver/src/ffi/driver_backed/library_drop.rs | 4 ++-- .../src/ffi/driver_backed/library_load_fixed_operations.rs | 4 ++-- .../src/ffi/driver_backed/matvec_projection_launches.rs | 4 ++-- .../src/ffi/driver_backed/mmq_original_group_launches.rs | 4 ++-- .../ffi/driver_backed/mmq_resident_qsa_selected_launches.rs | 4 ++-- crates/cuda-driver/src/ffi/function_handle.rs | 4 ++-- .../src/ffi/mmq_abi/mmq_original_gather_arguments.rs | 4 ++-- crates/cuda-driver/src/ffi/mmq_abi/mmq_resident_arguments.rs | 4 ++-- crates/cuda-driver/src/ffi/mmq_abi/owned.rs | 4 ++-- crates/cuda-driver/src/ffi/original_file_source/arena.rs | 4 ++-- crates/cuda-driver/src/ffi/original_file_source/check.rs | 4 ++-- crates/cuda-driver/src/ffi/original_stager/api.rs | 4 ++-- crates/cuda-driver/src/ffi/original_stager/check.rs | 4 ++-- crates/cuda-driver/src/ffi/original_stager/host_buffer.rs | 4 ++-- crates/cuda-driver/src/ffi/projection_tests.rs | 4 ++-- crates/cuda-driver/src/ffi/q5_projection_arguments_drop.rs | 4 ++-- crates/cuda-driver/src/ffi/qsa_selected_arguments.rs | 4 ++-- crates/cuda-driver/src/ffi/tests.rs | 3 ++- crates/cuda-driver/src/gdn_native_batch/tests.rs | 3 ++- crates/cuda-driver/src/kar_decode_levels/tests.rs | 3 ++- crates/cuda-driver/src/kar_decode_levels_gpu/context.rs | 4 ++-- crates/cuda-driver/src/kar_decode_levels_gpu/expert_mlp.rs | 3 ++- crates/cuda-driver/src/kar_decode_levels_gpu/f32_bytes.rs | 4 ++-- .../src/kar_decode_levels_gpu/kar_decode_levels.rs | 4 ++-- crates/cuda-driver/src/kv_stream_gpu/rng.rs | 4 ++-- crates/cuda-driver/src/mapped_expert_bank/context.rs | 4 ++-- .../src/mapped_expert_bank/mapped_expert_bank_drop.rs | 4 ++-- .../mapped_expert_bank_close.rs | 4 ++-- .../mapped_expert_bank_pcie_and_triplets.rs | 4 ++-- .../mapped_expert_bank_pieces_and_pinning.rs | 4 ++-- crates/cuda-driver/src/mmq/asset.rs | 4 ++-- crates/cuda-driver/src/mmq/context.rs | 4 ++-- crates/cuda-driver/src/mmq/mmq_experiment.rs | 4 ++-- crates/cuda-driver/src/mmq/mmq_experiment_drop.rs | 4 ++-- crates/cuda-driver/src/mmq/mmq_numeric_gpu_tests/digest.rs | 4 ++-- .../src/mmq/mmq_numeric_gpu_tests/format_cases.rs | 4 ++-- crates/cuda-driver/src/mmq/release_triplet.rs | 4 ++-- crates/cuda-driver/src/mmq/resident/asset.rs | 4 ++-- .../src/mmq/resident/mmq_native_resident_gpu_tests/digest.rs | 4 ++-- .../mmq_native_resident_gpu_tests/native_hidden_q8.rs | 4 ++-- .../src/mmq/resident/mmq_resident_gpu_tests/digest.rs | 4 ++-- .../mmq_resident_gpu_tests/live_packet_alias_drop.rs | 3 +-- .../src/mmq/resident/mmq_resident_gpu_tests/native_owner.rs | 4 ++-- .../mmq/resident/mmq_resident_gpu_tests/resident_chain.rs | 4 ++-- crates/cuda-driver/src/mmq/resident/mmq_workspace.rs | 4 ++-- .../src/mmq/resident/mmq_workspace/mmq_workspace_bring_up.rs | 4 ++-- .../mmq_workspace/mmq_workspace_gate_up_chunk_close.rs | 4 ++-- .../src/mmq/resident/mmq_workspace/projection_plan.rs | 4 ++-- crates/cuda-driver/src/mmq/resident/mmq_workspace_drop.rs | 4 ++-- crates/cuda-driver/src/mmq/resident/original_group/asset.rs | 4 ++-- .../original_group/copy_ring/chunk_stream/chunk_stream.rs | 4 ++-- .../original_group/copy_ring/host_stage/host_stage.rs | 4 ++-- .../original_group/copy_ring/host_stage/verify_enabled.rs | 4 ++-- .../original_group/copy_ring/original_mmq_copy_schedule.rs | 4 ++-- .../copy_ring/original_mmq_copy_schedule_drop.rs | 3 +-- .../src/mmq/resident/original_group/copy_ring/ring.rs | 3 +-- .../original_group/copy_ring/ring/ring_construction.rs | 4 ++-- .../original_group/copy_ring/ring/ring_gather_and_finish.rs | 4 ++-- .../copy_ring/ring/ring_stage_expert_copies.rs | 4 ++-- .../src/mmq/resident/original_group/copy_ring/ring_drop.rs | 3 +-- .../mmq/resident/original_group/copy_ring/skip_expert_dma.rs | 4 ++-- crates/cuda-driver/src/mmq/resident/original_group/kind.rs | 4 ++-- .../src/mmq/resident/original_group/mmq_workspace.rs | 4 ++-- .../src/mmq/resident/original_group/original_mmq_layer.rs | 4 ++-- .../original_group/original_mmq_layer/finite_and_quantize.rs | 4 ++-- .../original_group/original_mmq_layer/group_projection.rs | 4 ++-- .../original_mmq_layer/original_mmq_layer_stage_experts.rs | 4 ++-- .../src/mmq/resident/original_group/original_mmq_output.rs | 4 ++-- .../stream_all_mmq/group_producer_gather_project.rs | 4 ++-- .../original_group/stream_all_mmq/original_mmq_layer.rs | 4 ++-- .../mmq/resident/original_group/stream_all_mmq/transport.rs | 4 ++-- crates/cuda-driver/src/mmq/tile.rs | 4 ++-- crates/cuda-driver/src/mmq_original_host_stage/tests.rs | 3 ++- .../grouped_gu21_gu23_gpu/grouped_numeric_run.rs | 4 ++-- .../src/moe_group_projection/grouped_gu21_gu23_gpu/guards.rs | 4 ++-- .../grouped_gu21_gu23_nc4_gpu/grouped_upload_run.rs | 4 ++-- .../moe_group_projection/grouped_gu21_gu23_nc4_gpu/guards.rs | 4 ++-- crates/cuda-driver/src/moe_prefill_batch/tests.rs | 3 ++- .../src/mtp_dense_kv/original_int8/abi/arguments.rs | 4 ++-- .../src/mtp_dense_kv/original_int8/abi/host_enabled.rs | 4 ++-- .../src/mtp_dense_kv/original_int8/mtp_int8_owner_id.rs | 4 ++-- .../mtp_original_int8_attend_split_k.rs | 4 ++-- .../mtp_original_int8_kv_only_replay.rs | 4 ++-- .../mtp_original_int8_restore.rs | 4 ++-- .../mtp_original_int8_ring_bring_up.rs | 4 ++-- .../mtp_original_int8_validate_execute.rs | 4 ++-- .../original_int8/mtp_original_int8_state_adoption.rs | 4 ++-- .../src/mtp_dense_kv/original_int8/physical_ring.rs | 4 ++-- .../mtp_dense_kv/original_int8/prefill/completed_draft_kv.rs | 4 ++-- .../original_int8/prefill/original_mtp_prefill.rs | 4 ++-- .../prefill/original_mtp_prefill/kernel_commands.rs | 4 ++-- .../original_mtp_prefill/original_mtp_prefill_close.rs | 4 ++-- .../prefill/original_mtp_prefill/projection_commands.rs | 4 ++-- .../prefill/original_mtp_prefill/record_walk.rs | 4 ++-- .../prefill/original_mtp_prefill/run_and_settle.rs | 4 ++-- .../original_int8/prefill/original_mtp_prefill_drop.rs | 3 +-- .../src/mtp_dense_kv/original_int8/prefill/region.rs | 4 ++-- .../original_int8/prefill/scalar/full_forward/context.rs | 3 +-- .../full_forward/context_original_mtp_shared_layout.rs | 4 ++-- .../full_drafter/completed_original_mtp_draft.rs | 4 ++-- .../scalar/full_forward/full_drafter/original_mtp_drafter.rs | 4 ++-- .../original_mtp_drafter_finish_chain.rs | 4 ++-- .../original_mtp_drafter_launch_rounds.rs | 4 ++-- .../original_mtp_drafter/original_mtp_drafter_new_draft.rs | 4 ++-- .../full_drafter/original_mtp_drafter_from_verifier.rs | 4 ++-- .../full_drafter/round_lifecycle/original_mtp_drafter.rs | 4 ++-- .../round_lifecycle/original_mtp_prefill_plan.rs | 4 ++-- .../full_drafter/round_lifecycle/public_draft_output_copy.rs | 3 +-- .../scalar/full_forward/full_forward_prefix_program.rs | 4 ++-- .../full_forward_program_alias_checks.rs | 4 ++-- .../full_forward_prefix_program/original_mtp_full_forward.rs | 4 ++-- .../original_int8/prefill/scalar/full_forward/full_owned.rs | 4 ++-- .../full_forward/full_round/original_mtp_draft_program.rs | 4 ++-- .../prefill/scalar/full_forward/full_round/post_select.rs | 4 ++-- .../prefill/scalar/full_forward/full_round/put.rs | 4 ++-- .../prefill/scalar/full_forward/full_round/staged_source.rs | 4 ++-- .../scalar/full_forward/matrix_vector_buffers_and_shape.rs | 4 ++-- .../full_forward_final_gr_stages.rs | 4 ++-- .../full_forward_finite_tail_mlp_gr.rs | 4 ++-- .../original_mtp_full_forward.rs | 4 ++-- .../scalar/full_forward/original_mtp_forward_program.rs | 4 ++-- .../original_mtp_forward_program_original_graph.rs | 3 +-- .../prefill/scalar/full_forward/original_mtp_full_forward.rs | 4 ++-- .../scalar/full_forward/original_mtp_retained_prefix.rs | 4 ++-- .../session_coupling/original_mtp_session_plan.rs | 4 ++-- .../session_coupling/original_mtp_session_resources.rs | 4 ++-- .../full_forward/session_coupling/session_owned_drop.rs | 4 ++-- .../prefill/scalar/full_forward/symbols/assets_types.rs | 4 ++-- .../prefill/scalar/full_forward/symbols/chain_asset_types.rs | 3 +-- .../prefill/scalar/full_forward/validate_scalar_prefix.rs | 4 ++-- .../scalar/graph_resources_original_graph_resources.rs | 4 ++-- .../prefill/scalar/original_mtp_scalar_prefill.rs | 4 ++-- .../original_mtp_scalar_prefill_admit_new.rs | 4 ++-- .../original_mtp_scalar_prefill_close.rs | 4 ++-- .../original_mtp_scalar_prefill_record_gr.rs | 4 ++-- .../prefill/scalar/original_mtp_scalar_prefill_drop.rs | 3 +-- .../src/mtp_dense_kv/original_int8/ring_state/a16.rs | 4 ++-- .../src/mtp_dense_kv/original_int8/ring_state/pin_failure.rs | 4 ++-- .../src/mtp_dense_kv/original_int8/ring_state/selected.rs | 4 ++-- crates/cuda-driver/src/mtp_original_full_ffi/tests.rs | 2 +- crates/cuda-driver/src/native_head/alias_tests.rs | 4 ++-- crates/cuda-driver/src/native_head/dispatch.rs | 4 ++-- crates/cuda-driver/src/native_head/head_owned.rs | 4 ++-- crates/cuda-driver/src/native_head/iq_entries_types.rs | 4 ++-- crates/cuda-driver/src/native_head/native_asset.rs | 4 ++-- crates/cuda-driver/src/native_head/native_asset_pin_types.rs | 4 ++-- crates/cuda-driver/src/native_head/native_entries_types.rs | 3 +-- crates/cuda-driver/src/native_head/original_native_embed.rs | 4 ++-- .../native_head/original_native_embed_rows_original_graph.rs | 3 +-- .../cuda-driver/src/native_head/original_native_head_rows.rs | 3 +-- .../original_native_head_rows_greedy_submit.rs | 4 ++-- .../original_native_head_rows_sampling.rs | 4 ++-- .../original_native_head_rows_drop_original_graph.rs | 4 ++-- .../native_head/original_native_head_rows_original_native.rs | 4 ++-- crates/cuda-driver/src/native_head/projection_commands.rs | 4 ++-- crates/cuda-driver/src/native_parity/native_parity_expert.rs | 4 ++-- .../native_parity_dequantize_diagnostics.rs | 4 ++-- .../native_parity_operations/native_parity_expert_enqueue.rs | 4 ++-- crates/cuda-driver/src/native_parity/sealed_ptx.rs | 4 ++-- .../src/native_prompt_device/original_device_block.rs | 4 ++-- .../src/native_prompt_device/original_ple_history.rs | 4 ++-- .../src/native_prompt_device/original_prompt_device.rs | 4 ++-- .../original_prompt_device_apply_ple.rs | 4 ++-- .../original_prompt_device_bring_up.rs | 4 ++-- .../original_prompt_device_close_modules.rs | 4 ++-- .../original_prompt_device_gr_read_plan.rs | 4 ++-- .../original_prompt_device_initialize_rows.rs | 4 ++-- .../original_prompt_device_inject_gr.rs | 4 ++-- .../original_prompt_device/original_prompt_device_read_gr.rs | 4 ++-- .../src/native_prompt_device/original_prompt_device_drop.rs | 3 +-- .../stage_impl/gr_gpu_tests/enable_types.rs | 4 ++-- .../src/native_prompt_device/stage_impl/gr_gpu_tests/rng.rs | 4 ++-- crates/cuda-driver/src/original_conversation_state/tests.rs | 3 ++- .../src/original_expert_cache/original_cache_prefix.rs | 4 ++-- .../src/original_expert_cache/original_expert_cache_drop.rs | 3 +-- .../original_expert_cache_adaptive_swaps.rs | 4 ++-- .../original_expert_cache_file_slot_fill.rs | 4 ++-- .../original_expert_cache_open_and_slots.rs | 4 ++-- .../original_expert_cache_verify_and_lend.rs | 4 ++-- crates/cuda-driver/src/original_expert_stager/context.rs | 4 ++-- .../src/original_expert_stager/original_stager_batch.rs | 4 ++-- .../src/original_expert_stager/original_stager_options.rs | 4 ++-- .../stream_all/original_expert_stager.rs | 4 ++-- .../stream_all/original_stream_all_options.rs | 4 ++-- .../original_stream_all_options/original_expert_stager.rs | 4 ++-- .../original_stream_all_options/original_stream_all.rs | 4 ++-- .../original_stream_all_options_issuer.rs | 4 ++-- crates/cuda-driver/src/original_expert_stager/tests.rs | 3 ++- crates/cuda-driver/src/original_expert_stager_ffi/tests.rs | 3 ++- .../src/original_file_expert_source/available_memory.rs | 4 ++-- .../file_expert_source_swap_exchanges.rs | 4 ++-- .../file_expert_source_cache_complement.rs | 4 ++-- .../file_expert_source_prefetch.rs | 4 ++-- .../file_expert_source_stages_and_blobs.rs | 4 ++-- .../file_expert_source_status_counters.rs | 4 ++-- .../original_resident_options_and_blob.rs | 4 ++-- .../cuda-driver/src/original_file_expert_source_ffi/tests.rs | 3 ++- crates/cuda-driver/src/original_gpu_schedule/abi/api.rs | 4 ++-- crates/cuda-driver/src/original_gpu_schedule/abi/platform.rs | 4 ++-- .../src/original_gpu_schedule/abi/platform/api.rs | 4 ++-- .../abi/platform/async_copies_and_flag_writes.rs | 4 ++-- .../src/original_gpu_schedule/abi/platform/library_drop.rs | 4 ++-- .../src/original_gpu_schedule/original_gpu_graph.rs | 4 ++-- .../src/original_gpu_schedule/original_gpu_stream.rs | 4 ++-- .../src/original_gpu_schedule/original_graph_key.rs | 4 ++-- .../src/original_gpu_schedule/set_side_streams_wanted.rs | 4 ++-- crates/cuda-driver/src/original_gpu_schedule/transport.rs | 4 ++-- crates/cuda-driver/src/original_moe_prompt_device/blank.rs | 4 ++-- .../original_moe_prompt_device_drop.rs | 4 ++-- .../original_moe_prompt_device_new_run.rs | 4 ++-- .../original_moe_prompt_device_prepare.rs | 4 ++-- .../original_moe_prompt_device_release.rs | 4 ++-- .../src/original_mtp_actor/loaded/inconsistent.rs | 4 ++-- .../src/original_mtp_actor/loaded/original_mtp_actor.rs | 4 ++-- .../original_mtp_actor/original_mtp_actor_adopt_loaded.rs | 4 ++-- .../src/original_mtp_actor/loaded/original_mtp_actor_drop.rs | 3 +-- crates/cuda-driver/src/original_mtp_draft_vocab/tests.rs | 3 ++- crates/cuda-driver/src/original_mtp_rt/read_index.rs | 4 ++-- crates/cuda-driver/src/original_mtp_rt/rt_error.rs | 4 ++-- crates/cuda-driver/src/original_mtp_rt/tests.rs | 3 ++- crates/cuda-driver/src/original_sampler/asset.rs | 4 ++-- .../src/original_sampler/original_sampler_drop.rs | 3 +-- .../original_sampler_operations/original_sampler_bring_up.rs | 4 ++-- .../original_sampler_close_resources.rs | 4 ++-- .../original_sampler_coupled_draft.rs | 4 ++-- .../original_sampler_run_verify_window.rs | 4 ++-- crates/cuda-driver/src/original_session_state/add.rs | 4 ++-- .../src/original_session_state/original_session_layout.rs | 4 ++-- crates/cuda-driver/src/original_session_state/qsa_price.rs | 4 ++-- .../original_verify/gpu_plan/cpu_sink_publish_gpu_plan.rs | 4 ++-- .../src/original_verify/gpu_plan/dma_options_for.rs | 4 ++-- crates/cuda-driver/src/original_verify/gr/assets.rs | 4 ++-- crates/cuda-driver/src/original_verify/gr/plan_hc_read.rs | 4 ++-- crates/cuda-driver/src/original_verify/gr/plan_ple_row.rs | 4 ++-- .../cuda-driver/src/original_verify/moe/pcie_fast_kernel.rs | 4 ++-- .../src/original_verify/moe/plan_expert_groups.rs | 4 ++-- .../cuda-driver/src/original_verify/moe/plan_f32_to_bf16.rs | 4 ++-- .../src/original_verify/original_verify_gdn_journal.rs | 4 ++-- .../original_verify_gdn_journal/original_verify_window.rs | 4 ++-- .../verify_gdn_journal_ladder_logits_scan.rs | 4 ++-- .../verify_gdn_journal_stage_and_commit.rs | 4 ++-- .../verify_gdn_journal_window_launches.rs | 4 ++-- crates/cuda-driver/src/original_verify/proj/admit_matrix.rs | 4 ++-- .../src/original_verify/proj/head_iq_entries_types.rs | 4 ++-- .../src/original_verify/proj/head_native_entries_types.rs | 4 ++-- .../cuda-driver/src/original_verify/proj/q8_1_row_bytes.rs | 4 ++-- crates/cuda-driver/src/original_verify/qsa/assets.rs | 4 ++-- crates/cuda-driver/src/original_verify/qsa/qsa_window.rs | 4 ++-- .../qsa/qsa_window/qsa_window_query_key_paths.rs | 4 ++-- .../qsa/qsa_window/qsa_window_select_and_attend.rs | 4 ++-- .../src/original_verify/schedule/commit_sync_forced.rs | 4 ++-- .../src/original_verify/schedule/original_verifier.rs | 4 ++-- .../schedule/verifier_commit_window_lifecycle.rs | 4 ++-- .../schedule/verifier_logits_diagnostics_close.rs | 4 ++-- .../cuda-driver/src/original_verify/share_window_modules.rs | 4 ++-- .../share_window_modules/original_verify_bank.rs | 4 ++-- .../src/original_verify/share_window_modules/physical.rs | 4 ++-- .../verify_bank_and_canonical_gdn_open.rs | 4 ++-- .../share_window_modules/verify_bank_plan_and_window_rows.rs | 4 ++-- .../src/original_verify/window_ops/all_window_assets.rs | 4 ++-- .../src/original_verify/window_ops/original_verifier.rs | 4 ++-- .../window_ops/window_ops_kernels_and_pcie_plan.rs | 4 ++-- crates/cuda-driver/src/original_verify_gpu_plan/tests.rs | 3 ++- crates/cuda-driver/src/original_verify_window_gr/tests.rs | 3 ++- crates/cuda-driver/src/original_verify_window_moe/tests.rs | 3 ++- crates/cuda-driver/src/original_verify_window_ops/tests.rs | 3 ++- .../cuda-driver/src/original_verify_window_planner/tests.rs | 3 ++- crates/cuda-driver/src/original_verify_window_proj/tests.rs | 3 ++- crates/cuda-driver/src/original_verify_window_qsa/tests.rs | 3 ++- .../cuda-driver/src/original_verify_window_record/tests.rs | 2 +- crates/cuda-driver/src/ple_batch_ffi/driver_backed/blas.rs | 4 ++-- .../driver_backed/kernel_module_launch_and_close.rs | 4 ++-- .../cuda-driver/src/ple_batch_ffi/driver_backed/library.rs | 4 ++-- crates/cuda-driver/src/ple_batch_ffi/kernel_arguments.rs | 4 ++-- crates/cuda-driver/src/ple_batch_queue/assets.rs | 5 +++-- .../cuda-driver/src/ple_batch_queue/ple_batch_queue_drop.rs | 4 ++-- .../ple_batch_queue_operations/ple_batch_queue_bring_up.rs | 5 +++-- .../ple_batch_queue_operations/ple_batch_queue_close.rs | 4 ++-- .../ple_batch_queue_operations/ple_batch_queue_compose.rs | 4 ++-- crates/cuda-driver/src/projection_grids_and_bounds.rs | 4 ++-- crates/cuda-driver/src/prompt_sync_trace_types.rs | 4 ++-- crates/cuda-driver/src/q5_kshape_types.rs | 4 ++-- crates/cuda-driver/src/q6_k_shape.rs | 4 ++-- crates/cuda-driver/src/qsa_late/gpu_tests/rng.rs | 4 ++-- crates/cuda-driver/src/qsa_late/gpu_tests/scan_both.rs | 4 ++-- .../src/qsa_late/gpu_tests/time_scores_and_topk.rs | 4 ++-- .../cuda-driver/src/qsa_native_batch/native_projections.rs | 5 +++-- crates/cuda-driver/src/qsa_native_batch/qsa_native_kind.rs | 4 ++-- .../qsa_prompt_attention/attention_kernel_plan_and_passes.rs | 4 ++-- .../attention_kernel_plan_and_passes/attention_passes.rs | 4 ++-- .../prompt_attention_owner.rs | 4 ++-- .../attention_kernel_plan_and_passes/reject_mutual_alias.rs | 4 ++-- .../src/qsa_prompt_attention/qsa_attention_inputs.rs | 4 ++-- .../src/qsa_prompt_attention/qsa_prompt_attention_drop.rs | 4 ++-- crates/cuda-driver/src/qsa_prompt_index/append_select.rs | 4 ++-- crates/cuda-driver/src/qsa_prompt_index/index_run.rs | 4 ++-- crates/cuda-driver/src/qsa_prompt_index/max_blocks.rs | 4 ++-- .../src/qsa_prompt_index/prompt_device/context.rs | 4 ++-- .../src/qsa_prompt_index/prompt_device/device_prepare.rs | 4 ++-- .../prompt_device/original_qsa_prompt_device.rs | 4 ++-- .../resident_device/original_qsa_prompt_device.rs | 4 ++-- .../resident_device/qsa_prompt_device_resident_bring_up.rs | 4 ++-- .../resident_device/qsa_resident_prompt_device_prepare.rs | 4 ++-- .../qsa_prompt_index/prompt_device/selection_completion.rs | 4 ++-- .../src/qsa_prompt_index/qsa_prompt_index_read_and_close.rs | 4 ++-- .../src/qsa_prompt_index/qsa_prompt_index_workspace.rs | 4 ++-- .../src/qsa_prompt_index/resident_index/image_bytes.rs | 4 ++-- .../resident_index/original_qsa_index_batch.rs | 4 ++-- .../resident_index/original_qsa_resident_index.rs | 4 ++-- .../resident_index/qsa_resident_index_checkpoint_restore.rs | 4 ++-- .../verification_commit/original_verify_qsa_journal.rs | 4 ++-- .../verification_commit/original_verify_rope.rs | 4 ++-- .../verification_commit/verify_qsa_journal_capture_commit.rs | 4 ++-- .../verify_qsa_journal_publish_discard.rs | 4 ++-- .../src/qsa_prompt_index/resident_program/prefix_replay.rs | 4 ++-- .../resident_program/qsa_prompt_index_workspace.rs | 4 ++-- .../src/qsa_prompt_index/resident_transfer/enabled.rs | 4 ++-- .../mapped_journal/original_qsa_mapped_journal.rs | 4 ++-- .../mapped_journal/original_qsa_mapped_prefix.rs | 4 ++-- .../qsa_mapped_journal_append_and_resolve.rs | 4 ++-- .../qsa_mapped_journal_prefix_and_prefetch.rs | 4 ++-- crates/cuda-driver/src/qsa_prompt_kv/offsets.rs | 4 ++-- crates/cuda-driver/src/qsa_prompt_kv/qsa_prompt_kv_drop.rs | 4 ++-- crates/cuda-driver/src/qsa_prompt_kv/staged_append.rs | 4 ++-- .../staged_append/qsa_prompt_kv_append_bounded_close.rs | 4 ++-- .../qsa_prompt_kv/staged_append/qsa_prompt_kv_bring_up.rs | 4 ++-- crates/cuda-driver/src/qsa_selected_kv/asset.rs | 4 ++-- .../src/qsa_selected_kv/qsa_selected_kv_attend_io.rs | 4 ++-- .../src/qsa_selected_kv/qsa_selected_kv_workspace.rs | 4 ++-- crates/cuda-driver/src/qwen_dispatch/admission.rs | 4 ++-- crates/cuda-driver/src/qwen_dispatch/cache.rs | 4 ++-- crates/cuda-driver/src/qwen_dispatch/context.rs | 4 ++-- .../src/qwen_dispatch/context/context_gr_gate_mean_inject.rs | 4 ++-- .../src/qwen_dispatch/context/gdn_ple_fixed_kernels.rs | 4 ++-- .../src/qwen_dispatch/context/gdn_step_kernels.rs | 4 ++-- .../cuda-driver/src/qwen_dispatch/context/gr_read_chain.rs | 4 ++-- .../src/qwen_dispatch/context/mtp_dense_attention.rs | 4 ++-- .../src/qwen_dispatch/context/mtp_fixed_kernels.rs | 4 ++-- .../src/qwen_dispatch/context/qsa_fixed_kernels.rs | 4 ++-- .../src/qwen_dispatch/gdn_closed_queue/gdn_queue_stage.rs | 4 ++-- .../src/qwen_dispatch/gdn_closed_queue/gdn_row_prefix.rs | 4 ++-- .../gdn_closed_queue/gdn_row_prefix/convolution_stages.rs | 4 ++-- .../gdn_row_prefix/gdn_row_prefix_fenced_drain.rs | 4 ++-- .../gdn_closed_queue/gdn_row_prefix/recurrence_stages.rs | 4 ++-- .../src/qwen_dispatch/gdn_closed_queue/gdn_row_queue.rs | 4 ++-- .../src/qwen_dispatch/gdn_closed_queue/gpu/bytes.rs | 4 ++-- .../qwen_dispatch/gdn_closed_queue/gpu/columns_pair_cases.rs | 4 ++-- .../src/qwen_dispatch/gdn_fused_t1/gdn_fused_prefix.rs | 4 ++-- .../gdn_fused_t1/gdn_fused_prefix/fused_stage_binding.rs | 4 ++-- .../gdn_fused_prefix/gdn_fused_prefix_step_norm_drain.rs | 4 ++-- crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/pinned.rs | 4 ++-- crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/words.rs | 4 ++-- .../src/qwen_dispatch/gdn_native_batch/context.rs | 4 ++-- .../src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix.rs | 4 ++-- .../gdn_native_batch/gdn_batch_prefix/native_projection.rs | 4 ++-- .../gdn_batch_prefix/qkv_and_z_projections.rs | 4 ++-- .../gdn_batch_prefix/recurrence_and_output.rs | 4 ++-- .../src/qwen_dispatch/gdn_native_batch/gpu/bytes_of.rs | 4 ++-- .../qwen_dispatch/gdn_native_batch/gpu/host_gemm_adapter.rs | 4 ++-- .../src/qwen_dispatch/gdn_native_batch/gpu/run_case.rs | 4 ++-- .../cuda-driver/src/qwen_dispatch/gdn_native_batch/pinned.rs | 4 ++-- .../qwen_dispatch/gdn_native_batch/prompt_device/context.rs | 3 +-- .../prompt_device/original_gdn_prompt_device.rs | 4 ++-- .../original_gdn_prompt_device_admit_open.rs | 4 ++-- .../original_gdn_prompt_device_close.rs | 4 ++-- .../original_gdn_prompt_device/prompt_block_produce.rs | 4 ++-- .../prompt_device/original_gdn_prompt_device_drop.rs | 3 +-- .../prompt_device/stage_gpu_tests/enable_types.rs | 3 +-- .../gdn_native_batch/prompt_device/stage_gpu_tests/rng.rs | 4 ++-- .../src/qwen_dispatch/gdn_native_batch/staging.rs | 4 ++-- .../cuda-driver/src/qwen_dispatch/gdn_products_installed.rs | 4 ++-- .../cuda-driver/src/qwen_dispatch/gr_batch_read/context.rs | 3 +-- .../src/qwen_dispatch/gr_batch_read/gr_microbatch_read.rs | 4 ++-- .../gr_microbatch_read/gr_microbatch_read_inject.rs | 4 ++-- .../gr_microbatch_read/gr_microbatch_read_open.rs | 4 ++-- .../gr_batch_read/gr_microbatch_read/micro_stage_launch.rs | 4 ++-- .../qwen_dispatch/gr_batch_read/gr_microbatch_read_drop.rs | 3 +-- .../cuda-driver/src/qwen_dispatch/gr_native_batch/context.rs | 4 ++-- .../qwen_dispatch/gr_native_batch/gr_native_batch_drop.rs | 3 +-- .../gr_native_batch_operations/native_command_drain.rs | 4 ++-- .../gr_native_batch_operations/native_gemm_launch.rs | 4 ++-- .../gr_native_batch_operations/native_inject.rs | 4 ++-- .../src/qwen_dispatch/moe_prefill_batch/gpu/bytes_of.rs | 4 ++-- .../moe_prefill_batch/gpu/clean_window_check.rs | 4 ++-- .../src/qwen_dispatch/moe_prefill_batch/gpu/fixture.rs | 4 ++-- .../src/qwen_dispatch/moe_prefill_batch/moe_batch_prefix.rs | 4 ++-- .../moe_prefill_batch/moe_batch_prefix/combine_stage.rs | 4 ++-- .../moe_batch_prefix/moe_batch_prefix_router_pack.rs | 4 ++-- .../moe_batch_prefix/shared_expert_projections.rs | 4 ++-- .../src/qwen_dispatch/moe_prefill_batch/pinned.rs | 4 ++-- .../cuda-driver/src/qwen_dispatch/moe_prefill_batch/words.rs | 4 ++-- .../src/qwen_dispatch/mtp_input_workspace/gpu/bytes.rs | 4 ++-- .../qwen_dispatch/mtp_input_workspace/gpu/numeric_case.rs | 4 ++-- .../mtp_input_workspace/mtp_input_completion.rs | 4 ++-- .../qwen_dispatch/mtp_input_workspace/mtp_input_prefix.rs | 4 ++-- .../src/qwen_dispatch/ple_closed_queue/float_owner.rs | 4 ++-- .../qwen_dispatch/ple_closed_queue/ple_closed_completion.rs | 4 ++-- .../ple_closed_queue/ple_closed_queue_compose_close.rs | 4 ++-- crates/cuda-driver/src/qwen_dispatch/prepare_gr_read_set.rs | 5 +++-- crates/cuda-driver/src/qwen_dispatch/queued_gr_installed.rs | 4 ++-- .../qwen_shared_tail/shared_expert_workspace.rs | 4 ++-- .../shared_expert_workspace_append_close.rs | 4 ++-- .../shared_expert_workspace_bring_up.rs | 4 ++-- .../shared_expert_workspace_compose.rs | 4 ++-- .../qwen_shared_tail/shared_expert_workspace_drop.rs | 4 ++-- .../src/qwen_dispatch/qwen_shared_tail/shared_gu_kind.rs | 4 ++-- .../qwen_shared_tail/shared_tail_gpu/guard_probe.rs | 4 ++-- .../qwen_shared_tail/shared_tail_gpu/original.rs | 4 ++-- .../qwen_dispatch/qwen_shared_tail/shared_tail_gpu/read.rs | 4 ++-- crates/cuda-driver/src/qwen_dispatch/tests.rs | 3 ++- crates/cuda-driver/src/qwen_ffi/asset.rs | 4 ++-- .../src/qwen_ffi/asset_validation_and_bf16_layout.rs | 4 ++-- crates/cuda-driver/src/qwen_ffi/bf16_receipt_types.rs | 4 ++-- crates/cuda-driver/src/qwen_ffi/mock_asset.rs | 4 ++-- crates/cuda-driver/src/qwen_ffi/mtp_extended_assets_types.rs | 4 ++-- crates/cuda-driver/src/qwen_ffi/mtp_s2_full_layout.rs | 4 ++-- crates/cuda-driver/src/qwen_ffi/n_types.rs | 4 ++-- crates/cuda-driver/src/qwen_ffi/operation.rs | 4 ++-- .../cuda-driver/src/qwen_ffi/qsa_attention_receipt_types.rs | 4 ++-- crates/cuda-driver/src/qwen_ffi/qsa_layout.rs | 4 ++-- crates/cuda-driver/src/qwen_ffi/tests.rs | 3 ++- crates/cuda-driver/src/routed_group_workspace/context.rs | 4 ++-- .../cuda-driver/src/routed_resident_queue/gpu/queue_cases.rs | 4 ++-- crates/cuda-driver/src/routed_resident_queue/gpu/run.rs | 4 ++-- crates/cuda-driver/src/routed_resident_queue/gpu/upload.rs | 4 ++-- .../src/routed_resident_queue/routed_resident_completion.rs | 4 ++-- .../src/routed_resident_queue/routed_resident_queue_drop.rs | 4 ++-- crates/cuda-driver/src/tests.rs | 3 ++- crates/cuda-model/src/original_mtp_loader/loader_error.rs | 4 ++-- .../src/original_mtp_loader/original_mtp_load_plan.rs | 4 ++-- crates/cuda-model/src/original_mtp_loader/tests.rs | 3 ++- crates/cuda-model/src/original_prefill_schedule/planner.rs | 4 ++-- crates/cuda-model/src/original_prefill_schedule/tests.rs | 3 ++- .../src/qsa_prompt_attention_select/pool_presence.rs | 4 ++-- .../cuda-model/src/qsa_prompt_attention_select/q_prescale.rs | 4 ++-- crates/cuda-model/src/qsa_prompt_attention_select/tests.rs | 3 ++- crates/cuda-model/src/s_gemv_legacy/tests.rs | 3 ++- crates/experimental-ref/src/cache/tests.rs | 3 ++- crates/experimental-ref/src/cvec/load_control_vectors.rs | 4 ++-- crates/experimental-ref/src/cvec/tests.rs | 3 ++- crates/experimental-ref/src/keyless/tests.rs | 3 ++- crates/experimental-ref/src/kv_stream/map_bytes.rs | 4 ++-- crates/experimental-ref/src/kv_stream/residency_map.rs | 4 ++-- crates/experimental-ref/src/kv_stream/tests.rs | 3 ++- crates/experimental-ref/src/layout/tests.rs | 3 ++- crates/experimental-ref/src/remote_experts/tests.rs | 3 ++- crates/gptoss/src/ops/tests.rs | 3 ++- crates/harmony/src/parse/tests.rs | 3 ++- crates/harmony/src/render/render_namespace.rs | 4 ++-- crates/harmony/src/render/render_options.rs | 4 ++-- crates/igpu/src/shaders/gemm.rs | 4 ++-- crates/leleka-memory/src/governor/governor_config.rs | 4 ++-- crates/leleka-memory/src/governor/tests.rs | 3 ++- crates/leleka-memory/src/lock/lock_mode.rs | 4 ++-- crates/leleka-memory/src/lock/tests.rs | 3 ++- crates/leleka-memory/src/plan/auto_prefix_budget.rs | 4 ++-- crates/leleka-memory/src/plan/policy.rs | 4 ++-- crates/leleka-memory/src/plan/tests.rs | 3 ++- crates/leleka-memory/src/pressure/tests.rs | 3 ++- crates/leleka-memory/src/procfs/tests.rs | 3 ++- crates/leleka-memory/src/telemetry/lock.rs | 4 ++-- crates/leleka-memory/src/telemetry/render.rs | 4 ++-- crates/leleka-memory/src/telemetry/tests.rs | 3 ++- crates/libc-shim/src/cuda_trace/tests.rs | 3 ++- crates/model-format/src/bulk_read/for_each_chunk.rs | 4 ++-- crates/model-format/src/bulk_read/strategy.rs | 4 ++-- crates/model-format/src/bulk_read/tests.rs | 3 ++- crates/model-format/src/gguf/cursor.rs | 4 ++-- crates/model-format/src/gguf/parse_artifact_digest.rs | 4 ++-- crates/model-format/src/gguf/read_index_file.rs | 4 ++-- .../src/gguf/read_metadata_snapshot_with_architecture.rs | 4 ++-- crates/model-format/src/gguf/resident/next_source_id.rs | 4 ++-- .../src/gguf/resident/verified_gguf_capture_retention.rs | 4 ++-- crates/model-format/src/gguf/resident/verified_gguf_file.rs | 4 ++-- crates/model-format/src/gguf/stream_buffer_bytes.rs | 4 ++-- crates/model-format/src/gguf/tests.rs | 3 ++- crates/model-format/src/gguf/value_width.rs | 4 ++-- crates/model-format/src/gguf/verified_gguf_file.rs | 4 ++-- crates/model-format/src/kar/decode_record_range.rs | 4 ++-- crates/model-format/src/kar/extents/extent.rs | 4 ++-- crates/model-format/src/kar/extents/kar_inspection.rs | 4 ++-- crates/model-format/src/kar/independent_handles.rs | 4 ++-- crates/model-format/src/kar/inspect_file.rs | 4 ++-- crates/model-format/src/kar/kar_ple_profile.rs | 4 ++-- crates/model-format/src/kar/read_region.rs | 4 ++-- crates/model-format/src/kar/verified_kar_ple_artifact.rs | 4 ++-- .../model-format/src/kar_kernel_model/decode_params_valid.rs | 4 ++-- crates/model-format/src/kar_levels/expert_scratch.rs | 4 ++-- crates/model-format/src/kar_levels/selection.rs | 4 ++-- crates/model-format/src/native_dense_plan/tests.rs | 3 ++- .../src/pinned_arena_plan/expert_parallel_load.rs | 4 ++-- crates/model-format/src/pinned_arena_plan/fnv1a64.rs | 4 ++-- crates/model-format/src/pinned_arena_plan/tests.rs | 3 ++- crates/model-format/src/ple_reader/file_page_source.rs | 4 ++-- crates/model-format/src/ple_reader/ple_reader_debug_drop.rs | 4 ++-- crates/model-format/src/qwen4exp/expected_inventory.rs | 4 ++-- .../expert_source_bank/digest_capture/capture_admit.rs | 4 ++-- .../digest_capture/provisional_expert_source.rs | 4 ++-- .../digest_capture/provisional_expert_source_incremental.rs | 4 ++-- .../digest_capture/provisional_expert_source_test_hooks.rs | 4 ++-- .../expert_source_bank/digest_capture/qwen4_exp_artifact.rs | 4 ++-- .../src/qwen4exp/expert_source_bank/qwen4_exp_artifact.rs | 4 ++-- .../expert_source_bank/resident_expert_bank_lease.rs | 4 ++-- .../qwen4exp/expert_source_bank/retention_metadata_bytes.rs | 4 ++-- crates/model-format/src/qwen4exp/plan_stream_rows.rs | 4 ++-- crates/model-format/src/qwen4exp/qwen4_exp_artifact.rs | 4 ++-- .../model-format/src/qwen4exp/routed_moe_source_opening.rs | 4 ++-- crates/model-format/src/qwen4exp/validate_logical_views.rs | 4 ++-- .../model-format/src/qwen4exp/validate_owner_index_split.rs | 4 ++-- crates/model-format/src/qwen4exp/validate_role_inventory.rs | 4 ++-- .../src/qwen4exp/whole_dense_matrix_transport_tests.rs | 4 ++-- crates/model-format/src/qwen4exp/whole_moe_matrix_sdet.rs | 4 ++-- crates/native-cpu-expert/src/cpu_pool.rs | 4 ++-- crates/native-cpu-expert/src/gate_up_format.rs | 4 ++-- crates/native-cpu-expert/src/rust_bench_frontend/cpu_blob.rs | 4 ++-- .../src/rust_bench_frontend/float_reference.rs | 4 ++-- .../native-cpu-expert/src/rust_bench_frontend/numerical.rs | 4 ++-- crates/native-cpu-expert/src/rust_dequant/iq.rs | 4 ++-- crates/native-cpu-expert/src/rust_dequant/kquant.rs | 4 ++-- crates/native-cpu-expert/src/rust_dequant/plain.rs | 4 ++-- .../native-cpu-expert/src/rust_general_pool/expert_pool.rs | 4 ++-- .../src/rust_general_pool/expert_pool_split_multi_run.rs | 4 ++-- .../native-cpu-expert/src/rust_general_pool/job_default.rs | 4 ++-- .../rust_general_pool/shared_wait_done_and_quantize_lanes.rs | 4 ++-- crates/native-cpu-expert/src/rust_ggml/kind.rs | 4 ++-- crates/native-cpu-expert/src/rust_ggml/native_format.rs | 4 ++-- crates/native-cpu-expert/src/rust_ggml/quantize_raw.rs | 4 ++-- crates/native-cpu-expert/src/rust_iq/iq4nl_n.rs | 4 ++-- crates/native-cpu-expert/src/rust_iq/tests.rs | 3 ++- crates/native-cpu-expert/src/rust_iq/u16.rs | 4 ++-- crates/native-cpu-expert/src/rust_legacy/admit.rs | 4 ++-- crates/native-cpu-expert/src/rust_legacy/gate_each.rs | 4 ++-- .../native-cpu-expert/src/rust_legacy/set_oracle_q8_zero.rs | 4 ++-- crates/native-cpu-expert/src/rust_legacy/tests.rs | 3 ++- .../src/rust_native_general/group_dot_bytes_policy.rs | 4 ++-- .../native-cpu-expert/src/rust_native_general/iq4nl_rows.rs | 4 ++-- .../src/rust_native_general/native_activation_quantize.rs | 4 ++-- crates/native-cpu-expert/src/rust_native_general/tests.rs | 3 ++- crates/native-cpu-expert/src/rust_pool/native_act_default.rs | 4 ++-- crates/native-cpu-expert/src/rust_pool/native_pool.rs | 4 ++-- .../src/rust_pool/native_pool_group_compute.rs | 4 ++-- crates/native-cpu-expert/src/rust_weight_iq/alloc.rs | 4 ++-- crates/native-cpu-expert/src/rust_weight_iq/grid.rs | 4 ++-- crates/native-cpu-expert/src/rust_weight_iq/iq1_m.rs | 4 ++-- crates/native-cpu-expert/src/rust_weight_iq/iq2_xxs.rs | 4 ++-- crates/native-cpu-expert/src/rust_weight_iq/iq3.rs | 4 ++-- crates/native-cpu-expert/src/rust_weight_quant/best_fp4.rs | 4 ++-- crates/native-cpu-expert/src/rust_weight_quant/iq4.rs | 4 ++-- crates/native-cpu-expert/src/rust_weight_quant/nearest.rs | 4 ++-- crates/native-cpu-expert/src/rust_weight_quant/q45k.rs | 4 ++-- crates/native-cpu-expert/src/rust_weight_quant/qp.rs | 4 ++-- crates/obs/src/level.rs | 4 ++-- crates/obs/src/redact/tests.rs | 3 ++- crates/obs/src/write_stderr.rs | 4 ++-- crates/sampler-ref/src/chain/tests.rs | 3 ++- crates/sampler-ref/src/params/tests.rs | 3 ++- crates/sampler-ref/src/serve/tests.rs | 3 ++- crates/serving-policy/src/cvec/build_tables.rs | 4 ++-- crates/serving-policy/src/cvec/cursor.rs | 4 ++-- crates/serving-policy/src/cvec/tests.rs | 3 ++- crates/serving-policy/src/shared/shared_defaults.rs | 4 ++-- crates/serving-policy/src/shared/tests.rs | 3 ++- crates/serving-policy/src/vision/tests.rs | 3 ++- crates/tokenizer/src/fast/unicode_ranges.rs | 4 ++-- crates/tokenizer/src/gguf_bpe/tests.rs | 3 ++- crates/tokenizer/src/gguf_bpe/utf8_stream.rs | 4 ++-- 604 files changed, 1187 insertions(+), 1143 deletions(-) diff --git a/crates/context/src/context_policy/tests.rs b/crates/context/src/context_policy/tests.rs index 28234dc5..0632b334 100644 --- a/crates/context/src/context_policy/tests.rs +++ b/crates/context/src/context_policy/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the context policy: 2x256k needs no scaling and 1x512k needs YaRN 2, INT8 pool closing, refusal of +//! explicit none past the trained range, stray scale, bad rope knobs and request errors, and state sizing by slots. use super::*; diff --git a/crates/context/src/geometry/tests.rs b/crates/context/src/geometry/tests.rs index c5442f58..8f8c1e2a 100644 --- a/crates/context/src/geometry/tests.rs +++ b/crates/context/src/geometry/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the cell-count geometry: at the trained cell count every value equals its frozen literal, the resident +//! window follows kv_plan, 512k scales linear sizes by exactly two, and invalid cell counts and boundaries. use super::*; diff --git a/crates/context/src/memory_plan/tests.rs b/crates/context/src/memory_plan/tests.rs index daf95e53..9188ddf3 100644 --- a/crates/context/src/memory_plan/tests.rs +++ b/crates/context/src/memory_plan/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the memory plan arithmetic: real geometry constants, per-cell bytes, INT8 generic versus literal, +//! pool derivation quirks, does-not-close messages, overflow reporting, Q4 versus INT8 closing, FP32 indexer store. use super::*; diff --git a/crates/context/src/rope_scaling/rope_scaling_type.rs b/crates/context/src/rope_scaling/rope_scaling_type.rs index 67ec1721..690a004f 100644 --- a/crates/context/src/rope_scaling/rope_scaling_type.rs +++ b/crates/context/src/rope_scaling/rope_scaling_type.rs @@ -1,5 +1,5 @@ -//! Methods of `RopeScalingType`: `name`, `parse`. Methods of `RopeScalingError`: `reason`. -//! Implements `Default for RopeKernelArgs`, `Display for RopeScalingError` and 5 more. +//! RoPE scaling types and errors: the scaling method names, default kernel arguments, the RopeScaling +//! configuration with its validation and kernel arguments, YaRN ramp and angle, and RoPE table errors and size. use super::{ DEFAULT_FREQ_BASE, PI, RopeKernelArgs, RopeScaling, RopeScalingError, RopeScalingType, RopeTableError, diff --git a/crates/context/src/rope_scaling/tests.rs b/crates/context/src/rope_scaling/tests.rs index 9bf113b5..77d9f5b6 100644 --- a/crates/context/src/rope_scaling/tests.rs +++ b/crates/context/src/rope_scaling/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of RoPE scaling: identity default, YaRN mscale and clamped correction dims, rejection of non-finite or bad +//! configs, prefix-stable chunkable tables, table bytes at charter contexts, and setup/knob resolution. use super::*; diff --git a/crates/cpu-sys/src/c_reference/abi_version.rs b/crates/cpu-sys/src/c_reference/abi_version.rs index c63e63c9..428180ec 100644 --- a/crates/cpu-sys/src/c_reference/abi_version.rs +++ b/crates/cpu-sys/src/c_reference/abi_version.rs @@ -1,5 +1,5 @@ -//! Functions: `abi_version`, `check_i8`, `check_i4`, `dot_i8i8_scalar` and 17 more. -//! Split out of `c_reference` to keep its files under the line limit. +//! Safe Rust wrappers over the C reference kernels: ABI version, int8/int4 dots, MXFP4 x Q8_0 dots and block sums, +//! and the q8r layout, at scalar, AVX2 and AVX-VNNI level, with the shared length checks that make the FFI calls sound. use super::{BLOCK_ELEMS, KernelError, MAX_DOT_LEN, MXFP4_BLOCK_BYTES, Q8_0_BLOCK_BYTES, avx2_available, ffi}; diff --git a/crates/cpu-sys/src/c_reference/quantize_q8_0_scalar.rs b/crates/cpu-sys/src/c_reference/quantize_q8_0_scalar.rs index 2247ae8f..5b8f41c7 100644 --- a/crates/cpu-sys/src/c_reference/quantize_q8_0_scalar.rs +++ b/crates/cpu-sys/src/c_reference/quantize_q8_0_scalar.rs @@ -1,5 +1,5 @@ -//! Functions: `quantize_q8_0_scalar`, `quantize_q8_0_avx2`, `dot_q8_0_q8_0_scalar`, `q8_0_q8_0_isums_scalar` and 10 ... -//! Split out of `c_reference` to keep its files under the line limit. +//! Safe wrappers over the C reference for Q8_0: float quantizer, Q8_0 x Q8_0 dots and block sums, float to half +//! conversion, and the AVX2/AVX-VNNI int8 and int4 dots; each SIMD level is checked against its scalar twin. use super::{KernelError, avx2_available, check_i4, check_i8, check_mx_out, check_q8, check_quantize, ffi}; #[cfg(target_arch="x86_64")] diff --git a/crates/cpu-sys/src/oracle.rs b/crates/cpu-sys/src/oracle.rs index d7c0e351..27935940 100644 --- a/crates/cpu-sys/src/oracle.rs +++ b/crates/cpu-sys/src/oracle.rs @@ -1,5 +1,5 @@ -//! Functions: `block_bytes`, `aligned`, `unaligned`, `dequantize_mxfp4` and 3 more. -//! Split out of `crate` to keep its files under the line limit. +//! Safe wrappers over the pinned ggml MXFP4 and Q8_0 quantize/dequantize routines (compiled C), used as the oracle +//! that the Rust kernels are compared against; copies buffers to 8-byte aligned storage for ggml structs. use super::{BLOCK_ELEMS, MXFP4_BLOCK_BYTES, Q8_0_BLOCK_BYTES}; diff --git a/crates/cpu-sys/src/simd/x86.rs b/crates/cpu-sys/src/simd/x86.rs index fec031f1..b5618cb2 100644 --- a/crates/cpu-sys/src/simd/x86.rs +++ b/crates/cpu-sys/src/simd/x86.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `reductions_and_int_dots`, `mxfp4_q8_dots`, `q8_dots_and_mxfp4_tiles` and 4 more. -//! Split out of `simd` to keep its files under the line limit. +//! x86-64 kernel set: holds the register-tiled macros and the shared safety contract, and declares the kernel groups +//! (int dots, MXFP4 and Q8 dots, tiles, attention and f16 elementwise, Q8_0 quantizer) at AVX2 and AVX-VNNI level. //! AVX2 (+FMA +F16C) and AVX-VNNI kernels. Every function is `unsafe`: the caller must have //! verified the CPU features named in its `target_feature` attribute and that all slices have the diff --git a/crates/cuda-driver/src/api/async_api.rs b/crates/cuda-driver/src/api/async_api.rs index 861c24d6..70f510e0 100644 --- a/crates/cuda-driver/src/api/async_api.rs +++ b/crates/cuda-driver/src/api/async_api.rs @@ -1,5 +1,5 @@ -//! Methods of `AsyncApi`: `load`, `create_stream`, `create_event`, `register` and 12 more. -//! Methods of `MappedApi`: `load`, `register_bank`, `bank_alias`, `unregister_bank` and 12 more. +//! Stub implementations of AsyncApi and MappedApi for builds without a usable CUDA driver (no cuda-driver feature, +//! non-Linux/Windows or non-64-bit target): every method fails with UnsupportedPlatform, so callers compile unchanged. #[cfg(not(all( feature = "cuda-driver", diff --git a/crates/cuda-driver/src/arch_ptx/stream_k_off.rs b/crates/cuda-driver/src/arch_ptx/stream_k_off.rs index f0346c87..88b485a2 100644 --- a/crates/cuda-driver/src/arch_ptx/stream_k_off.rs +++ b/crates/cuda-driver/src/arch_ptx/stream_k_off.rs @@ -1,5 +1,5 @@ -//! Functions: `stream_k_off`, `marker_files_present`, `forced_sms`, `chunk_drain` and 10 more. -//! Split out of `arch_ptx` to keep its files under the line limit. +//! Run-time policy of the per-architecture PTX layer: the stream-K on/off switch (env vars and marker files), the +//! forced SM count and chunk-drain diagnostics, the compute-capability gates, and the sm_86 companion image lookup. use super::STREAM_K_AVOIDED; #[cfg(feature = "sm86")] diff --git a/crates/cuda-driver/src/bringup_trace_enabled.rs b/crates/cuda-driver/src/bringup_trace_enabled.rs index cbd4aaac..14ed6d7d 100644 --- a/crates/cuda-driver/src/bringup_trace_enabled.rs +++ b/crates/cuda-driver/src/bringup_trace_enabled.rs @@ -1,5 +1,5 @@ -//! Methods of `PromptSyncTrace`: `enter`. Methods of `Driver`: `load`, `version`, `device`. -//! Implements `Drop for PromptSyncTrace`, `Drop for RoutedGateUpQ8`. Functions: `combine`, `valid_size`. +//! Driver bring-up core: Driver::load/device, Device::create_context and the Context constructor, the poison flag +//! (PoisonCell) with its trace, the prompt-sync trace guard, and the scratch release of RoutedGateUpQ8. use super::{ Cell, Context, Device, Driver, Error, PoisonCell, PromptSyncTrace, Rc, Result, RoutedGateUpQ8, ffi, qwen_dispatch, diff --git a/crates/cuda-driver/src/closed_kernels/program.rs b/crates/cuda-driver/src/closed_kernels/program.rs index d8ae7e20..944678e2 100644 --- a/crates/cuda-driver/src/closed_kernels/program.rs +++ b/crates/cuda-driver/src/closed_kernels/program.rs @@ -1,5 +1,5 @@ -//! Methods of `Program`: `name`, `ptx`, `pin`, `source` and 1 more. Methods of `Slot`: `kind`. -//! Functions: `admit_ptx`, `admit`, `s_gemv_entry_index`, `conforms` and 5 more. +//! Program catalogue of the closed kernels: name, sealed PTX, pin and CUDA source of each Program, fail-closed +//! PTX admission against its digest pin, and the slot lists and operand sizes of flash, poison and S-GEMV launches. use super::{ Arg, DEVICE_POISON_PTX, Entry, ExperimentalError, FLASH_ENTRIES, FlashBytes, Kernel, MAX_ENTRY_ARGUMENTS, diff --git a/crates/cuda-driver/src/closed_kernels/s_gemv_slots.rs b/crates/cuda-driver/src/closed_kernels/s_gemv_slots.rs index 3efdfc7f..ca42b5e8 100644 --- a/crates/cuda-driver/src/closed_kernels/s_gemv_slots.rs +++ b/crates/cuda-driver/src/closed_kernels/s_gemv_slots.rs @@ -1,5 +1,5 @@ -//! Functions: `s_gemv_slots`, `head_slots`. -//! Split out of `closed_kernels` to keep its files under the line limit. +//! Builds the ordered kernel-argument slots of a planned S-form GEMV (pointers, sizes, code bias, codebook, shift), +//! one layout per kernel variant; kept apart so program.rs holds only the catalogue and its admission. use super::{Kernel, Plan, Role, SForm, Slot}; diff --git a/crates/cuda-driver/src/closed_kernels/tests.rs b/crates/cuda-driver/src/closed_kernels/tests.rs index 1d0fe45c..d78c678d 100644 --- a/crates/cuda-driver/src/closed_kernels/tests.rs +++ b/crates/cuda-driver/src/closed_kernels/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Shared helpers of the closed-kernel tests: they read parameter kinds from the checked-in .cu sources and from the +//! Entry tables so submodules can assert that every Rust signature matches its CUDA entry and every sealed PTX its pin. use super::*; use crate::s_gemv_legacy as sg; diff --git a/crates/cuda-driver/src/closed_kernels_gpu/closed_kernels.rs b/crates/cuda-driver/src/closed_kernels_gpu/closed_kernels.rs index 5bd08248..734ea422 100644 --- a/crates/cuda-driver/src/closed_kernels_gpu/closed_kernels.rs +++ b/crates/cuda-driver/src/closed_kernels_gpu/closed_kernels.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `closed_kernels_flash_and_s_gemv`, `closed_kernels_open_admit_run`. -//! Split out of `closed_kernels_gpu` to keep its files under the line limit. +//! Module root of the ClosedKernels owner on a live context: it shares the imports of its two files, one for +//! opening, admitting and running launches and one for the concrete flash / poison / S-GEMV entry points. use super::{ Admitted, ClosedKernels, Context, DeviceBuffer, DriverResult, Error, ExperimentalError, FLASH_SHORT, diff --git a/crates/cuda-driver/src/closed_kernels_gpu/closed_kernels/closed_kernels_flash_and_s_gemv.rs b/crates/cuda-driver/src/closed_kernels_gpu/closed_kernels/closed_kernels_flash_and_s_gemv.rs index b5ef1a45..7d6fc96c 100644 --- a/crates/cuda-driver/src/closed_kernels_gpu/closed_kernels/closed_kernels_flash_and_s_gemv.rs +++ b/crates/cuda-driver/src/closed_kernels_gpu/closed_kernels/closed_kernels_flash_and_s_gemv.rs @@ -1,5 +1,5 @@ -//! Methods of `FlashBuffers`: `admit`, `operands`. -//! Methods of `ClosedKernels`: `native_flash_attn_short`, `poison_f32`, `s_gemv`, `s2_gemv`. +//! The launch entry points of ClosedKernels: short FlashAttention step, quiet-NaN poison fill and the S / S2 GEMV. +//! Each checks its operands (FlashBuffers, s_gemv_operands) and builds one Launch; opening and running are elsewhere. use super::{ ClosedKernels, DeviceBuffer, Error, ExperimentalError, FLASH_SHORT, FlashStepBuffers, Geometry, Operand, diff --git a/crates/cuda-driver/src/closed_kernels_gpu/closed_kernels/closed_kernels_open_admit_run.rs b/crates/cuda-driver/src/closed_kernels_gpu/closed_kernels/closed_kernels_open_admit_run.rs index cea0c28e..58b7154a 100644 --- a/crates/cuda-driver/src/closed_kernels_gpu/closed_kernels/closed_kernels_open_admit_run.rs +++ b/crates/cuda-driver/src/closed_kernels_gpu/closed_kernels/closed_kernels_open_admit_run.rs @@ -1,5 +1,5 @@ -//! Methods of `ClosedKernels`: `open`, `close`, `expect`, `build` and 4 more. -//! Functions: `resolve_functions`, `reject_aliasing`. +//! Lifecycle and launch plumbing of ClosedKernels: open (pin gate, module load, entry resolution), close, and the +//! per-launch checks (signature, geometry, operand admission, alias rejection) that turn slots into a Launch. use super::{ Admitted, ClosedKernels, Context, DriverResult, Error, Geometry, Launch, Operand, Program, Rc, Result, Role, Slot, diff --git a/crates/cuda-driver/src/closed_kernels_gpu/failure.rs b/crates/cuda-driver/src/closed_kernels_gpu/failure.rs index 8d846875..dc6beb5f 100644 --- a/crates/cuda-driver/src/closed_kernels_gpu/failure.rs +++ b/crates/cuda-driver/src/closed_kernels_gpu/failure.rs @@ -1,5 +1,5 @@ -//! Functions: `failure`. -//! Split out of `closed_kernels_gpu` to keep its files under the line limit. +//! Folds a primary driver failure and the outcome of the mandatory context restore into one ExperimentalError, +//! so no restore error is lost behind the first one. use super::{DriverResult, Error, ExperimentalError, combine}; diff --git a/crates/cuda-driver/src/closed_kernels_gpu_smoke/rng.rs b/crates/cuda-driver/src/closed_kernels_gpu_smoke/rng.rs index 813fd76a..03c22045 100644 --- a/crates/cuda-driver/src/closed_kernels_gpu_smoke/rng.rs +++ b/crates/cuda-driver/src/closed_kernels_gpu_smoke/rng.rs @@ -1,5 +1,5 @@ -//! Methods of `Rng`: `next`, `normal`. Functions: `f16_bits`, `upload`, `download`, `f32s` and 4 more. -//! Split out of `closed_kernels_gpu_smoke` to keep its files under the line limit. +//! Helpers of the closed-kernel GPU smoke tests: a small deterministic Rng (uniform and normal-ish), f32 to f16 bits, +//! device upload / download, opening a program, zeroed KV buffers and JSON-to-vector readers for the reference cases. use super::{ClosedKernels, Context, DeviceBuffer, Program, Rng}; diff --git a/crates/cuda-driver/src/context.rs b/crates/cuda-driver/src/context.rs index dffa6c88..f73096b9 100644 --- a/crates/cuda-driver/src/context.rs +++ b/crates/cuda-driver/src/context.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `poison`, `retain_driver`, `budget_bytes`, `device_ordinal` and 16 more. -//! Split out of `crate` to keep its files under the line limit. +//! Core of Context, the owner of one CUDA context: budget and allocation accounting, the sticky poison flag, entering +//! the context (CurrentGuard), allocate / deferred frees, synchronize, and the MoE-down pack and vector-add launches. use super::{ Context, CurrentGuard, DeviceBuffer, Error, FixedOperation, PhantomData, Rc, Result, combine, ffi, valid_size, diff --git a/crates/cuda-driver/src/context_gate_up_projection_admission.rs b/crates/cuda-driver/src/context_gate_up_projection_admission.rs index 9a3ef115..fe6174d8 100644 --- a/crates/cuda-driver/src/context_gate_up_projection_admission.rs +++ b/crates/cuda-driver/src/context_gate_up_projection_admission.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `project_routed_gate_up_prepared_weight`, `prepared_scratch`, `gate_up_prepared_shape`, `ga... -//! Split out of `crate` to keep its files under the line limit. +//! Admission of projection launches on a Context: owner, shape, alias and temporary-budget checks for the prepared +//! routed gate/up Q8 path, the native-weight projections and the Q5_K / Q6_K matvec before any native mutation. use super::{ Context, DeviceBuffer, Error, NativeWeights, ProjectionKind, ProjectionShape, ProjectionSpec, Q5KProjectionShape, diff --git a/crates/cuda-driver/src/context_matvec_k_quant_projections.rs b/crates/cuda-driver/src/context_matvec_k_quant_projections.rs index aa3586b2..73855bae 100644 --- a/crates/cuda-driver/src/context_matvec_k_quant_projections.rs +++ b/crates/cuda-driver/src/context_matvec_k_quant_projections.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `matvec_f32`, `q5_k_q8_1`, `q5_k_operation`, `q6_k_q8_1` and 4 more. Defines `MatvecDims`. -//! Split out of `crate` to keep its files under the line limit. +//! Context entry points for the f32 matvec and the Q5_K / Q6_K projections (MatvecDims), the shared Q8_1 activation +//! quantization with its scratch and status temporaries, and the closed-format project_q8_1 dispatch. use super::{ Context, DeviceBuffer, Error, FixedOperation, NativeWeights, ProjectionSpec, Q5KProjectionShape, Q5KShape, diff --git a/crates/cuda-driver/src/context_projection_kernel_slots.rs b/crates/cuda-driver/src/context_projection_kernel_slots.rs index 90cba01a..7b1f946c 100644 --- a/crates/cuda-driver/src/context_projection_kernel_slots.rs +++ b/crates/cuda-driver/src/context_projection_kernel_slots.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `matvec_admission`, `kernel_slot`, `kernel_slot_rest`, `fixed_kernel` and 10 more. -//! Split out of `crate` to keep its files under the line limit. +//! Kernel cache of Context: matvec admission, the per-operation FixedKernel slots, the Q5 / Q6 pair kernels and the +//! projection kernel pairs, each loaded lazily with the context current and unloaded on failure by poisoning. use super::{ Cell, Context, DeviceBuffer, Error, FixedKernel, FixedOperation, FixedPairKernels, MatvecShape, ProjectionKernels, diff --git a/crates/cuda-driver/src/context_q8_1_and_gate_up_projection.rs b/crates/cuda-driver/src/context_q8_1_and_gate_up_projection.rs index eecabaa0..58bda301 100644 --- a/crates/cuda-driver/src/context_q8_1_and_gate_up_projection.rs +++ b/crates/cuda-driver/src/context_q8_1_and_gate_up_projection.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `project_q8_1_weight`, `project_q8_1_operation`, `prepare_routed_gate_up_q8`, `gate_up_sour... -//! Split out of `crate` to keep its files under the line limit. +//! Q8_1 weight projection of one activation and the routed gate/up path: quantizing the activation once into a +//! RoutedGateUpQ8 (prepare), then projecting prepared scratch with each expert weight. use super::{ Context, DeviceBuffer, Error, FixedOperation, NativeWeights, ProjectionShape, ProjectionSpec, Result, RoutedFormat, diff --git a/crates/cuda-driver/src/context_unload_close_destroy.rs b/crates/cuda-driver/src/context_unload_close_destroy.rs index cd84a737..a6947538 100644 --- a/crates/cuda-driver/src/context_unload_close_destroy.rs +++ b/crates/cuda-driver/src/context_unload_close_destroy.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `unload_projections`, `unload_projection_slot`, `unload_q5_kernels`, `unload_q6_kernels` an... -//! Methods of `CurrentGuard`: `finish`, `restore`. Implements `Drop for Context`, `Drop for CurrentGuard`. +//! Teardown of Context: unloading every cached kernel module in a fixed order, close / destroy of the CUDA context, +//! and the Drop impls of Context and CurrentGuard that restore the previously current context. use super::{Context, CurrentGuard, Error, FixedOperation, ProjectionKernels, Rc, Result, combine}; diff --git a/crates/cuda-driver/src/device_buffer.rs b/crates/cuda-driver/src/device_buffer.rs index 2c488fc3..c7a173c9 100644 --- a/crates/cuda-driver/src/device_buffer.rs +++ b/crates/cuda-driver/src/device_buffer.rs @@ -1,5 +1,5 @@ -//! Methods of `DeviceBuffer`: `len`, `is_empty`, `staging`, `copy_from` and 12 more. -//! Implements `Drop for DeviceBuffer`. Functions: `chain_selects_mtp`, `chain_selects_mtp`, `set_chain_down_override`. +//! DeviceBuffer host/device copies (whole buffer and ranges, staged through a host Vec, synchronised) and its release +//! and Drop, plus the LELEKA_CHAIN 'mtp' selector chain_selects_mtp with its no-driver stubs. use super::{DeviceBuffer, Error, Result, combine, compute_drain, original_verify, vram_ledger}; #[cfg(all(feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))] diff --git a/crates/cuda-driver/src/device_slab/tests.rs b/crates/cuda-driver/src/device_slab/tests.rs index dc14138a..ca9a6561 100644 --- a/crates/cuda-driver/src/device_slab/tests.rs +++ b/crates/cuda-driver/src/device_slab/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the device slab packer: policy validation, in-order aligned placement, hole reuse, direct allocations +//! above the limit, no overlapping ranges, the device memory saved for dense weights, and byte isolation of slab views. use super::*; use crate::vram_ledger::driver_bytes; diff --git a/crates/cuda-driver/src/experimental/kv_shape.rs b/crates/cuda-driver/src/experimental/kv_shape.rs index 3da6dedf..84504913 100644 --- a/crates/cuda-driver/src/experimental/kv_shape.rs +++ b/crates/cuda-driver/src/experimental/kv_shape.rs @@ -1,5 +1,5 @@ -//! Methods of `KvShape`: `real`, `as_qsa`, `base`, `check_q4` and 8 more. Methods of `Context`: `unload_experimental`. -//! Functions: `fwht_grid`, `fwht_bytes`, `q4_step_grid`, `q4_batch_grid` and 12 more. +//! KvShape of the experimental KV-cache kernels (heads, head_dim, page size) with its validity checks for Q4 / INT8 / +//! attention, the pool byte sizes, and the launch-grid planners for FWHT, Q4/Q8 step and gather, keyless and attention. use super::{ Context, ExperimentalError, Grid, KvShape, MAX_GRID_YZ, QsaShapes, Result, cvec, grid_x, grid_yz, invalid, keyless, diff --git a/crates/cuda-driver/src/experimental/mode.rs b/crates/cuda-driver/src/experimental/mode.rs index 5d686f86..bd0cd7da 100644 --- a/crates/cuda-driver/src/experimental/mode.rs +++ b/crates/cuda-driver/src/experimental/mode.rs @@ -1,5 +1,5 @@ -//! Methods of `Mode`: `name`, `bit`. Methods of `OptIn`: `with`, `is_enabled`, `is_empty`, `modes` and 2 more. -//! Implements `Display for ExperimentalError`, `Error for ExperimentalError` and 1 more. +//! The opt-in model of the experimental kernels: Mode and the OptIn set (all off by default), the Program +//! catalogue and the modes each needs, the pin / seal admission gates (fail closed), ExperimentalError, grid helpers. use super::{ CVEC_ENTRIES, CVEC_PTX, Entry, Error, ExperimentalError, KEYLESS_ENTRIES, KEYLESS_PTX, KV_Q4_ENTRIES, KV_Q4_PTX, diff --git a/crates/cuda-driver/src/experimental/tests.rs b/crates/cuda-driver/src/experimental/tests.rs index b22cb8cb..ad643770 100644 --- a/crates/cuda-driver/src/experimental/tests.rs +++ b/crates/cuda-driver/src/experimental/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the experimental kernel programs: entry signatures match their CUDA source, sealed PTX matches its pin, +//! modes are off by default with ordered admission, and KV grids, byte sizes and stream guards equal the Original's. use super::*; diff --git a/crates/cuda-driver/src/experimental_gpu/context.rs b/crates/cuda-driver/src/experimental_gpu/context.rs index 7899d9c2..3ad0a73f 100644 --- a/crates/cuda-driver/src/experimental_gpu/context.rs +++ b/crates/cuda-driver/src/experimental_gpu/context.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `experimental_program`, `unload_failed`. Functions: `resolve_entries`, `i32_of`, `i64_of`. -//! Split out of `experimental_gpu` to keep its files under the line limit. +//! Loads an experimental Program into a Context: opt-in and pin gates, module load, entry resolution and caching +//! (nothing is published until every entry resolves), plus unload of a failed load and the i32 / i64 argument casts. use super::{ Context, DriverResult, Error, LoadedProgram, OptIn, Program, Rc, Result, admit, combine, failure, ffi, invalid, diff --git a/crates/cuda-driver/src/experimental_gpu/stream_map.rs b/crates/cuda-driver/src/experimental_gpu/stream_map.rs index 74e2b765..05624474 100644 --- a/crates/cuda-driver/src/experimental_gpu/stream_map.rs +++ b/crates/cuda-driver/src/experimental_gpu/stream_map.rs @@ -1,5 +1,5 @@ -//! Methods of `StreamMap`: `bind`. Methods of `Call`: `pointer`, `ro`, `rw`, `ro_at` and 7 more. Functions: `failure`. -//! Split out of `experimental_gpu` to keep its files under the line limit. +//! Argument binding for experimental launches: Call adds checked, context-matched pointer and scalar operands +//! (read-only / read-write, with admitted extents) and StreamMap binds the page-table and slot arrays of the KV stream. use super::{ Admitted, Arg, CTL_INTS, Call, DeviceBuffer, DriverResult, Entry, Error, ExperimentalError, Launch, Result, diff --git a/crates/cuda-driver/src/family_tests.rs b/crates/cuda-driver/src/family_tests.rs index 2905c651..55fff3e2 100644 --- a/crates/cuda-driver/src/family_tests.rs +++ b/crates/cuda-driver/src/family_tests.rs @@ -1,5 +1,5 @@ -//! Functions: `common_checked_geometry_matches_frozen_native_layouts`, `common_invalid_shapes_have_fixed_errors`, `q... -//! Defines `QuantizeBuffers`. +//! Tests of the common projection family: geometry and launch grids equal the frozen native layouts, invalid shapes +//! give fixed errors, misaligned ranges are refused, and quantizer launch / sync / restore errors keep their order. use super::*; const KINDS: [ProjectionKind; 10] = [ diff --git a/crates/cuda-driver/src/ffi/api.rs b/crates/cuda-driver/src/ffi/api.rs index be7e0cf6..053edf2d 100644 --- a/crates/cuda-driver/src/ffi/api.rs +++ b/crates/cuda-driver/src/ffi/api.rs @@ -1,5 +1,5 @@ -//! Methods of `Api`: `memory_info`, `mmq_capabilities`, `load_mmq`, `mmq_function` and 56 more. -//! Split out of `ffi` to keep its files under the line limit. +//! Stub of the whole ffi Api (module loads, launches, memory, contexts) for builds without a usable CUDA driver: +//! every method returns UnsupportedPlatform; the real implementation is in driver_backed. #[cfg(not(all( feature = "cuda-driver", diff --git a/crates/cuda-driver/src/ffi/context_handle.rs b/crates/cuda-driver/src/ffi/context_handle.rs index 125070f1..040f2bb6 100644 --- a/crates/cuda-driver/src/ffi/context_handle.rs +++ b/crates/cuda-driver/src/ffi/context_handle.rs @@ -1,5 +1,5 @@ -//! Methods of `ContextHandle`: `synthetic`. -//! Methods of `BufferHandle`: `registered_bank_alias`, `checked_subspan`, `qwen_address`, `validate_extent` and 7 more. +//! Typed handles of device memory and modules: BufferHandle checks extents, sub-spans, alignment, overlap and MoE down +//! slots before a driver call, and the selection of the PTX image and entry name for each projection kind. use super::{BufferHandle, DenseFormat, Error, ProjectionKind, Result, RoutedFormat}; // used only with some cargo features or targets of this crate diff --git a/crates/cuda-driver/src/ffi/driver_backed/api.rs b/crates/cuda-driver/src/ffi/driver_backed/api.rs index 92aaef4b..1ce881dc 100644 --- a/crates/cuda-driver/src/ffi/driver_backed/api.rs +++ b/crates/cuda-driver/src/ffi/driver_backed/api.rs @@ -1,5 +1,5 @@ -//! Methods of `Api`: `memory_info`, `mmq_capabilities`, `load_mmq`, `mmq_function` and 9 more. -//! Split out of `enabled` to keep its files under the line limit. +//! Api calls of the real driver for the fixed-function kernels of the MMQ family: memory info, MMQ capability and +//! shared-memory limit, IQ3 native integer, resident d4 and head-greedy module loads and launches. use super::{ Api, CuDevice, CuResult, Error, FunctionHandle, HeadGreedyArguments, Iq3NativeIntegerArguments, MemGetInfoV2, diff --git a/crates/cuda-driver/src/ffi/driver_backed/device_context_memory_copies.rs b/crates/cuda-driver/src/ffi/driver_backed/device_context_memory_copies.rs index a78dce8a..a4424db4 100644 --- a/crates/cuda-driver/src/ffi/driver_backed/device_context_memory_copies.rs +++ b/crates/cuda-driver/src/ffi/driver_backed/device_context_memory_copies.rs @@ -1,5 +1,5 @@ -//! Methods of `Api`: `device`, `create`, `destroy`, `push` and 11 more. -//! Split out of `enabled` to keep its files under the line limit. +//! Driver Api calls for devices, contexts and memory: cuDeviceGet, context create / destroy / push / pop, +//! synchronize, allocate / free, host-device copies, zeroing and the device-to-device weight and MoE down copies. use super::{Api, BufferHandle, ContextHandle, CuContext, Error, Result, c_void, check}; diff --git a/crates/cuda-driver/src/ffi/driver_backed/library_drop.rs b/crates/cuda-driver/src/ffi/driver_backed/library_drop.rs index 2b25d9c6..ec9cd468 100644 --- a/crates/cuda-driver/src/ffi/driver_backed/library_drop.rs +++ b/crates/cuda-driver/src/ffi/driver_backed/library_drop.rs @@ -1,5 +1,5 @@ -//! Implements `Drop for Library`. Functions: `check`. -//! Split out of `enabled` to keep its files under the line limit. +//! Ownership of the dlopen'ed driver library (dlclose on Drop) and check(), which maps a non-zero CUDA result +//! code to Error::Driver; kept apart as the two primitives every driver-backed call depends on. use super::{CuResult, Error, Library, Result}; diff --git a/crates/cuda-driver/src/ffi/driver_backed/library_load_fixed_operations.rs b/crates/cuda-driver/src/ffi/driver_backed/library_load_fixed_operations.rs index 40827deb..55d98141 100644 --- a/crates/cuda-driver/src/ffi/driver_backed/library_load_fixed_operations.rs +++ b/crates/cuda-driver/src/ffi/driver_backed/library_load_fixed_operations.rs @@ -1,5 +1,5 @@ -//! Methods of `Api`: `launch_qwen`, `load`, `resolve`, `load_q6_batch_preview` and 4 more. -//! Functions: `is_projection_family`. +//! Loads libcuda.so.1 and resolves the sixteen fixed driver symbols into the Api (dlopen, no CUDA toolkit needed), +//! plus the fixed-operation and Q6 batch module loads, function lookup and the launch_qwen entry point. use super::{ Api, COMMON_QUANTIZER_PTX, ContextCreateV2, ContextDestroyV2, ContextPopCurrentV2, ContextPushCurrentV2, diff --git a/crates/cuda-driver/src/ffi/driver_backed/matvec_projection_launches.rs b/crates/cuda-driver/src/ffi/driver_backed/matvec_projection_launches.rs index 6027f604..c701069d 100644 --- a/crates/cuda-driver/src/ffi/driver_backed/matvec_projection_launches.rs +++ b/crates/cuda-driver/src/ffi/driver_backed/matvec_projection_launches.rs @@ -1,5 +1,5 @@ -//! Methods of `Api`: `unload`, `launch`, `launch_gr_read_guard`, `launch_matvec` and 8 more. -//! Split out of `enabled` to keep its files under the line limit. +//! Real-driver kernel launches of the dense path: module unload, generic launch, matvec, Q8 quantize, Q5 / Q6 and +//! dense / grouped projections, grouped SwiGLU and the GR read guard, each with its grid and arguments checked. use super::{ Api, FunctionHandle, GrReadGuardArguments, LaunchArguments, MatvecArguments, ModuleHandle, ProjectionArguments, diff --git a/crates/cuda-driver/src/ffi/driver_backed/mmq_original_group_launches.rs b/crates/cuda-driver/src/ffi/driver_backed/mmq_original_group_launches.rs index e9bc1bc4..3298704d 100644 --- a/crates/cuda-driver/src/ffi/driver_backed/mmq_original_group_launches.rs +++ b/crates/cuda-driver/src/ffi/driver_backed/mmq_original_group_launches.rs @@ -1,5 +1,5 @@ -//! Methods of `Api`: `mmq_original_group_shared_limit`, `load_mmq_original_group`, `mmq_original_group_function`, `l... -//! Split out of `enabled` to keep its files under the line limit. +//! Real-driver loads and launches of the Original's grouped MMQ path: shared-memory limit query, group module and +//! function lookup, the gather and group-helper launches. use super::{ Api, CuDevice, CuResult, Error, FunctionHandle, MMQ_ORIGINAL_GROUP_SYMBOLS, MmqOriginalGatherArguments, diff --git a/crates/cuda-driver/src/ffi/driver_backed/mmq_resident_qsa_selected_launches.rs b/crates/cuda-driver/src/ffi/driver_backed/mmq_resident_qsa_selected_launches.rs index 8621a956..c7105343 100644 --- a/crates/cuda-driver/src/ffi/driver_backed/mmq_resident_qsa_selected_launches.rs +++ b/crates/cuda-driver/src/ffi/driver_backed/mmq_resident_qsa_selected_launches.rs @@ -1,5 +1,5 @@ -//! Methods of `Api`: `launch_mmq_original_swiglu`, `load_mmq_resident`, `mmq_resident_function`, `launch_mmq_residen... -//! Split out of `enabled` to keep its files under the line limit. +//! Real-driver loads and launches of the resident MMQ pipeline (SwiGLU, quantize, project, fixup), the QSA selected +//! gather kernels and the Qwen asset modules (load_qwen_module, qwen_function). use super::{ Api, Error, FunctionHandle, MmqArguments, MmqFixupArguments, MmqOriginalSwigluArguments, MmqQuantArguments, diff --git a/crates/cuda-driver/src/ffi/function_handle.rs b/crates/cuda-driver/src/ffi/function_handle.rs index c8914d49..95fde86c 100644 --- a/crates/cuda-driver/src/ffi/function_handle.rs +++ b/crates/cuda-driver/src/ffi/function_handle.rs @@ -1,5 +1,5 @@ -//! Methods of `FunctionHandle`: `qwen_success`, `synthetic`. Methods of `LaunchArguments`: `new`. -//! Implements `Drop for LaunchArguments`, `Drop for GrReadGuardArguments` and 3 more. +//! FunctionHandle constructors and the heap-pinned kernel-argument blocks (LaunchArguments, matvec, Q8 quantize, +//! Q5 / Q6 / dense projection, GR read guard): self-referential parameter arrays built once and freed by Drop. use super::{ ArgumentStorage, BufferHandle, GrReadGuardArguments, GrReadGuardStorage, LaunchArguments, MatvecArguments, diff --git a/crates/cuda-driver/src/ffi/mmq_abi/mmq_original_gather_arguments.rs b/crates/cuda-driver/src/ffi/mmq_abi/mmq_original_gather_arguments.rs index e292e5d8..bc5f5c01 100644 --- a/crates/cuda-driver/src/ffi/mmq_abi/mmq_original_gather_arguments.rs +++ b/crates/cuda-driver/src/ffi/mmq_abi/mmq_original_gather_arguments.rs @@ -1,5 +1,5 @@ -//! Methods of `MmqOriginalGatherArguments`: `new`, `parameters`. -//! Split out of `mmq_abi` to keep its files under the line limit. +//! Parameter block of the Original's gather (copy16) kernel launch: the raw, gate-up and down addresses and +//! 16-byte element counts laid out in the kernel's ABI order. use super::{BufferHandle, MmqOriginalGatherArguments, Owned, c_void}; diff --git a/crates/cuda-driver/src/ffi/mmq_abi/mmq_resident_arguments.rs b/crates/cuda-driver/src/ffi/mmq_abi/mmq_resident_arguments.rs index dad15f8e..3adbe962 100644 --- a/crates/cuda-driver/src/ffi/mmq_abi/mmq_resident_arguments.rs +++ b/crates/cuda-driver/src/ffi/mmq_abi/mmq_resident_arguments.rs @@ -1,5 +1,5 @@ -//! Methods of `MmqResidentArguments`: `native_resident_d4`, `zero`, `finite`, `gather` and 1 more. -//! Methods of `Iq3NativeIntegerArguments`: `dot`, `reduce`, `new`, `parameters`. +//! Parameter blocks for the resident MMQ and native IQ3 launches: resident d4, zero, finite check, gather, IQ3 +//! dot / reduce, Original indexed quantize, grouped MMQ, fixup and SwiGLU, each laid out in its kernel's ABI order. use super::{ BufferHandle, Iq3NativeIntegerArguments, Layout, MmqArguments, MmqFixupArguments, MmqGatherShape, MmqGroupBuffers, diff --git a/crates/cuda-driver/src/ffi/mmq_abi/owned.rs b/crates/cuda-driver/src/ffi/mmq_abi/owned.rs index b80469b7..5d27691c 100644 --- a/crates/cuda-driver/src/ffi/mmq_abi/owned.rs +++ b/crates/cuda-driver/src/ffi/mmq_abi/owned.rs @@ -1,5 +1,5 @@ -//! Methods of `Owned`: `new`, `parameters`. Methods of `MmqQuantArguments`: `new`, `parameters`. -//! Implements `Drop for Owned`. Functions: `fastdiv`. +//! Owned: the heap-pinned Storage (addresses, wide, integers, fastdiv divisors, parameter pointers) behind every MMQ +//! argument block, freed once on Drop; also the fast-division constants and the quantize, MMQ and fixup block builders. use super::{BufferHandle, Layout, MmqArguments, MmqFixupArguments, MmqQuantArguments, Owned, Storage, c_void}; diff --git a/crates/cuda-driver/src/ffi/original_file_source/arena.rs b/crates/cuda-driver/src/ffi/original_file_source/arena.rs index 9fc8d5b3..98632576 100644 --- a/crates/cuda-driver/src/ffi/original_file_source/arena.rs +++ b/crates/cuda-driver/src/ffi/original_file_source/arena.rs @@ -1,5 +1,5 @@ -//! Methods of `Arena`: `bytes`, `pin_limit`, `locked`, `lock_offset` and 5 more. -//! Methods of `Copy`: `into_slice`, `run`. +//! Host arena of the file expert source: a malloc / pinned block with partial mlock, checked writes, reads and +//! aliases of byte ranges, the three-part parallel Copy of expert pieces, page warm-up and worker stack sizing. use super::{Arena, Copy, Error, P, Result}; diff --git a/crates/cuda-driver/src/ffi/original_file_source/check.rs b/crates/cuda-driver/src/ffi/original_file_source/check.rs index be9eecae..0a71f756 100644 --- a/crates/cuda-driver/src/ffi/original_file_source/check.rs +++ b/crates/cuda-driver/src/ffi/original_file_source/check.rs @@ -1,5 +1,5 @@ -//! Methods of `Api`: `load`, `allocate`, `try_pinned`, `exchange_allocate` and 3 more. -//! Implements `Drop for Opening`, `Drop for Api`. Functions: `check`, `symbol`. Defines `Opening`. +//! The host-memory Api of the file expert source: dlopen of libcuda for page-locked alloc / register / device alias / +//! async copy, arena allocation (pinned or malloc), exchange copies and close, with the symbol and result checks. use super::{Alias, Alloc, Api, Arc, Arena, ArenaSpan, CStr, DtoH, Error, Free, P, Register, Result}; diff --git a/crates/cuda-driver/src/ffi/original_stager/api.rs b/crates/cuda-driver/src/ffi/original_stager/api.rs index 201a4a30..fc167246 100644 --- a/crates/cuda-driver/src/ffi/original_stager/api.rs +++ b/crates/cuda-driver/src/ffi/original_stager/api.rs @@ -1,5 +1,5 @@ -//! Methods of `Api`: `record`, `wait`, `copy_slot`, `load` and 13 more. Implements `Drop for Opening`. -//! Functions: `symbol`. Defines `Opening`. +//! Driver Api of the expert stager: dlopen of libcuda, pinned host buffers, events (record / wait / timing / +//! query), async slot copies and the worker context enter / leave that let staging threads issue DMA safely. use super::{ Api, BufferHandle, CStr, ContextHandle, Copy, Elapsed, Error, EventCreate, EventRecord, Handle, HandleCall, diff --git a/crates/cuda-driver/src/ffi/original_stager/check.rs b/crates/cuda-driver/src/ffi/original_stager/check.rs index 3214ad0f..33a271c9 100644 --- a/crates/cuda-driver/src/ffi/original_stager/check.rs +++ b/crates/cuda-driver/src/ffi/original_stager/check.rs @@ -1,5 +1,5 @@ -//! Implements `Drop for Api`. Functions: `check`. -//! Split out of `original_stager` to keep its files under the line limit. +//! Result-code check of the stager's driver calls, and the Drop of its Api that dlcloses libcuda only after the +//! last worker holding an Arc of it is gone. use super::{Api, Error, Handle, Result}; diff --git a/crates/cuda-driver/src/ffi/original_stager/host_buffer.rs b/crates/cuda-driver/src/ffi/original_stager/host_buffer.rs index 5e91a1ab..902cb0c5 100644 --- a/crates/cuda-driver/src/ffi/original_stager/host_buffer.rs +++ b/crates/cuda-driver/src/ffi/original_stager/host_buffer.rs @@ -1,5 +1,5 @@ -//! Methods of `HostBuffer`: `pinned`, `capacity`, `slot`. -//! Methods of `CopyJob`: `from_slices`, `bytes`, `copy_to`, `copy_segment` and 1 more. +//! Host side of expert staging: pinned HostBuffer slots, CopyJob (three source slices copied into a slot) and the +//! read-only mmap of the expert file (ExpertFileMap) from which expert byte ranges are read. use super::{CopyJob, Error, ExpertFileMap, HostBuffer, Result, WorkerSlot, c_void}; diff --git a/crates/cuda-driver/src/ffi/projection_tests.rs b/crates/cuda-driver/src/ffi/projection_tests.rs index 5ed16c21..55992694 100644 --- a/crates/cuda-driver/src/ffi/projection_tests.rs +++ b/crates/cuda-driver/src/ffi/projection_tests.rs @@ -1,5 +1,5 @@ -//! Functions: `new_fixed_asset_encoding_refuses_unicode_before_driver_call`, `q4_k_dense_selector_resolves_only_its_... -//! Split out of `ffi` to keep its files under the line limit. +//! Tests of the ffi projection assets: fixed PTX must be ASCII, each format selector (Q4_K, IQ3_S, IQ2_S, Q2_0, +//! IQ4_NL, IQ4_XS) resolves only its own asset and entry, plus handle alignment / overlap and exact parameter widths. use super::*; #[test] diff --git a/crates/cuda-driver/src/ffi/q5_projection_arguments_drop.rs b/crates/cuda-driver/src/ffi/q5_projection_arguments_drop.rs index 4ed5166a..24adc83d 100644 --- a/crates/cuda-driver/src/ffi/q5_projection_arguments_drop.rs +++ b/crates/cuda-driver/src/ffi/q5_projection_arguments_drop.rs @@ -1,5 +1,5 @@ -//! Implements `Drop for Q5ProjectionArguments`, `Drop for MatvecArguments`. -//! Split out of `ffi` to keep its files under the line limit. +//! Drop of the Q5 projection and matvec argument blocks: the boxed storage is freed once, and only when the +//! launch never started or completed; after an uncertain sync the owner is forgotten and the block leaks on purpose. use super::{MatvecArguments, Q5ProjectionArguments}; diff --git a/crates/cuda-driver/src/ffi/qsa_selected_arguments.rs b/crates/cuda-driver/src/ffi/qsa_selected_arguments.rs index 3c0db652..e8f3a36f 100644 --- a/crates/cuda-driver/src/ffi/qsa_selected_arguments.rs +++ b/crates/cuda-driver/src/ffi/qsa_selected_arguments.rs @@ -1,5 +1,5 @@ -//! Methods of `QsaSelectedArguments`: `new`, `parameters`. Methods of `HeadGreedyArguments`: `new`, `parameters`. -//! Implements `Drop for QsaSelectedArguments`, `Drop for HeadGreedyArguments`. +//! Parameter blocks of two small kernels, QSA selected (five buffers, layer, count) and head greedy (source, +//! output): boxed, self-referential pointer arrays freed once by Drop unless completion was uncertain. use super::{BufferHandle, HeadGreedyArguments, HeadGreedyStorage, QsaSelectedArguments, QsaSelectedStorage}; diff --git a/crates/cuda-driver/src/ffi/tests.rs b/crates/cuda-driver/src/ffi/tests.rs index 26ca663a..bea24f0e 100644 --- a/crates/cuda-driver/src/ffi/tests.rs +++ b/crates/cuda-driver/src/ffi/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of `ffi`. +//! Tests of ffi handle arithmetic: checked sub-spans refuse empty, wrapping and out-of-allocation ranges, matvec +//! address extents are validated, and the raw argument storage keeps its address when its owner moves. #[test] fn checked_subspan_refuses_empty_wrap_and_outside_allocation() { diff --git a/crates/cuda-driver/src/gdn_native_batch/tests.rs b/crates/cuda-driver/src/gdn_native_batch/tests.rs index c9022497..da2072c8 100644 --- a/crates/cuda-driver/src/gdn_native_batch/tests.rs +++ b/crates/cuda-driver/src/gdn_native_batch/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of `gdn_native_batch`. +//! Tests of the native GDN batch program: stage slots and sizes, the fixed step order, earliest-status refusal, +//! witness errors, native format geometry, closed kernel table, 256-block launches, bindings, and artifact pin checks. use super::*; diff --git a/crates/cuda-driver/src/kar_decode_levels/tests.rs b/crates/cuda-driver/src/kar_decode_levels/tests.rs index 30532a40..2c2f0b68 100644 --- a/crates/cuda-driver/src/kar_decode_levels/tests.rs +++ b/crates/cuda-driver/src/kar_decode_levels/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the KAR level-decode kernel contract: DecodeGeometry window layouts and bounds, multiply and expert +//! shapes, fail-closed status word, the sealed PTX against its pin, and the Rust constants against the CUDA source. use super::*; diff --git a/crates/cuda-driver/src/kar_decode_levels_gpu/context.rs b/crates/cuda-driver/src/kar_decode_levels_gpu/context.rs index 1cb72921..6e8164f3 100644 --- a/crates/cuda-driver/src/kar_decode_levels_gpu/context.rs +++ b/crates/cuda-driver/src/kar_decode_levels_gpu/context.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `kar_levels_kernels`, `resolve_kar_entries`, `abandon_kar_module`. -//! Split out of `kar_decode_levels_gpu` to keep its files under the line limit. +//! Loads the KAR level-decode PTX into a Context: pin admission, one cached module, resolution of the decode / +//! multiply / SwiGLU entries (nothing published until all resolve) and unloading of a half-resolved module. use super::{ Context, DriverResult, ENTRY_DECODE, ENTRY_MULTIPLY, ENTRY_SWIGLU, Error, KAR_DECODE_LEVELS_PIN, diff --git a/crates/cuda-driver/src/kar_decode_levels_gpu/expert_mlp.rs b/crates/cuda-driver/src/kar_decode_levels_gpu/expert_mlp.rs index 106e0e07..b718cefc 100644 --- a/crates/cuda-driver/src/kar_decode_levels_gpu/expert_mlp.rs +++ b/crates/cuda-driver/src/kar_decode_levels_gpu/expert_mlp.rs @@ -1,4 +1,5 @@ -//! Moved out of kar_decode_levels.rs by the STRA-338 size pass: the single-token routed expert FFN. +//! Single-token routed expert FFN on the GPU from KAR-packed matrices: buffer allocation and admission, the +//! gate / up / SwiGLU / down launch sequence and the host read-back of the checked output (expert_mlp_to_host). use super::{ Admitted, BLOCK_THREADS, Context, DeviceBuffer, ExpertShape, KarDecodeError, KarDecodeLevels, KarMatrix, Launch, diff --git a/crates/cuda-driver/src/kar_decode_levels_gpu/f32_bytes.rs b/crates/cuda-driver/src/kar_decode_levels_gpu/f32_bytes.rs index 183ba00e..2c7bf28b 100644 --- a/crates/cuda-driver/src/kar_decode_levels_gpu/f32_bytes.rs +++ b/crates/cuda-driver/src/kar_decode_levels_gpu/f32_bytes.rs @@ -1,5 +1,5 @@ -//! Functions: `f32_bytes`, `download`, `failure`, `release_all` and 1 more. -//! Split out of `kar_decode_levels_gpu` to keep its files under the line limit. +//! Small host helpers of the KAR GPU owner: f32 to little-endian bytes, device download, finite-only f32 parse, +//! joint release of buffers, and folding a primary failure with the context restore into one KarDecodeError. use super::{DeviceBuffer, DriverResult, Error, KarDecodeError, Result, combine}; diff --git a/crates/cuda-driver/src/kar_decode_levels_gpu/kar_decode_levels.rs b/crates/cuda-driver/src/kar_decode_levels_gpu/kar_decode_levels.rs index 22f4fc70..afb6bd00 100644 --- a/crates/cuda-driver/src/kar_decode_levels_gpu/kar_decode_levels.rs +++ b/crates/cuda-driver/src/kar_decode_levels_gpu/kar_decode_levels.rs @@ -1,5 +1,5 @@ -//! Methods of `KarDecodeLevels`: `open`, `close`, `admit`, `disjoint` and 15 more. Defines `MultiplyBuffers`. -//! Split out of `kar_decode_levels_gpu` to keep its files under the line limit. +//! The KarDecodeLevels owner: opens the module on a context, admits buffers and builds decode / multiply launches, +//! runs them under one drain, and offers decode_to_host / decode_multiply_to_host with status and finite checks. use super::{ Admitted, BLOCK_THREADS, Context, DecodeGeometry, DecodeMultiplyBuffers, DeviceBuffer, Error, KarDecodeError, diff --git a/crates/cuda-driver/src/kv_stream_gpu/rng.rs b/crates/cuda-driver/src/kv_stream_gpu/rng.rs index f9049b96..fb3dca74 100644 --- a/crates/cuda-driver/src/kv_stream_gpu/rng.rs +++ b/crates/cuda-driver/src/kv_stream_gpu/rng.rs @@ -1,5 +1,5 @@ -//! Methods of `Rng`: `next`, `unit`, `below`. Functions: `upload`, `addr`, `f32s`, `i32s` and 6 more. -//! Defines `KernelShape`, `ImageLayout`. +//! Shared fixtures of the KV-stream GPU proofs: an xorshift Rng, device upload / address / byte helpers, a kernel +//! launch and module-load wrapper, random value groups and block selections, and the expected pool image layout. use super::{ Arg, Arguments, Context, DeviceBuffer, HD, Module, NativeBatchWorkspace, PAGE, Result, Rng, combine, kv_q8, diff --git a/crates/cuda-driver/src/mapped_expert_bank/context.rs b/crates/cuda-driver/src/mapped_expert_bank/context.rs index dd6c6446..98d0ab8d 100644 --- a/crates/cuda-driver/src/mapped_expert_bank/context.rs +++ b/crates/cuda-driver/src/mapped_expert_bank/context.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `mapped_expert_bank`, `check_bank_inputs`, `bank_ranges`, `bank_role` and 2 more. -//! Methods of `MappedExpertBank`: `opened`, `load_banks`. Functions: `aligned_copy_enabled`. +//! Opening a MappedExpertBank on a Context: checks the lease and member banks, plans page ranges and the budget +//! charge, loads the mapped driver ABI and registers each bank for a device alias; also the aligned-copy A/B switch. use super::{ BANKS, Context, Error, LayerRole, MappedExpertBank, RegisteredBank, ResidentExpertBankLease, diff --git a/crates/cuda-driver/src/mapped_expert_bank/mapped_expert_bank_drop.rs b/crates/cuda-driver/src/mapped_expert_bank/mapped_expert_bank_drop.rs index 9b1a3184..07ea14d2 100644 --- a/crates/cuda-driver/src/mapped_expert_bank/mapped_expert_bank_drop.rs +++ b/crates/cuda-driver/src/mapped_expert_bank/mapped_expert_bank_drop.rs @@ -1,5 +1,5 @@ -//! Methods of `PendingMappedExpertCopy`: `destination_bytes`, `new`, `observe`, `settle_observation` and 6 more. -//! Methods of `Context`: `mapped_expert_copy_scratch`. +//! Lifetime of an in-flight mapped expert copy: PendingMappedExpertCopy (event poll / wait, cleanup, leaking on +//! uncertain completion), its reusable scratch and completion owners, and the Drop of the bank that unregisters it. use super::{ Context, DeviceBuffer, Error, MappedExpertBank, MappedExpertCopyCompletion, MappedExpertCopyScratch, diff --git a/crates/cuda-driver/src/mapped_expert_bank/mapped_expert_bank_operations/mapped_expert_bank_close.rs b/crates/cuda-driver/src/mapped_expert_bank/mapped_expert_bank_operations/mapped_expert_bank_close.rs index 3f25ce40..f5de0836 100644 --- a/crates/cuda-driver/src/mapped_expert_bank/mapped_expert_bank_operations/mapped_expert_bank_close.rs +++ b/crates/cuda-driver/src/mapped_expert_bank/mapped_expert_bank_operations/mapped_expert_bank_close.rs @@ -1,5 +1,5 @@ -//! Methods of `MappedExpertBank`: `retain_uncertain`, `close`. -//! Split out of `mapped_expert_bank_methods` to keep its files under the line limit. +//! Closing a MappedExpertBank: close() and retain_uncertain(), which poisons the context and leaks the bank's +//! ABI and registrations when completion is uncertain, since the device may still read them. use super::{MappedExpertBank, Result}; diff --git a/crates/cuda-driver/src/mapped_expert_bank/mapped_expert_bank_operations/mapped_expert_bank_pcie_and_triplets.rs b/crates/cuda-driver/src/mapped_expert_bank/mapped_expert_bank_operations/mapped_expert_bank_pcie_and_triplets.rs index 5ff6418e..b202d29e 100644 --- a/crates/cuda-driver/src/mapped_expert_bank/mapped_expert_bank_operations/mapped_expert_bank_pcie_and_triplets.rs +++ b/crates/cuda-driver/src/mapped_expert_bank/mapped_expert_bank_operations/mapped_expert_bank_pcie_and_triplets.rs @@ -1,5 +1,5 @@ -//! Methods of `MappedExpertBank`: `page_locked`, `locked_experts`, `resident_bytes`, `pcie_alias` and 13 more. -//! Functions: `bank_index`, `expert_role_offset`. +//! Device-side use of a MappedExpertBank: PCIe alias lookup, eligibility checks, and copy_triplet, which launches the +//! mapped-copy kernel for one expert's three tensors into device buffers and tracks it as a pending copy. use super::{ DeviceBuffer, Error, LayerRole, MappedExpertBank, MappedExpertCopyScratch, PendingMappedExpertCopy, Rc, diff --git a/crates/cuda-driver/src/mapped_expert_bank/mapped_expert_bank_operations/mapped_expert_bank_pieces_and_pinning.rs b/crates/cuda-driver/src/mapped_expert_bank/mapped_expert_bank_operations/mapped_expert_bank_pieces_and_pinning.rs index e59d5b1b..a19579dc 100644 --- a/crates/cuda-driver/src/mapped_expert_bank/mapped_expert_bank_operations/mapped_expert_bank_pieces_and_pinning.rs +++ b/crates/cuda-driver/src/mapped_expert_bank/mapped_expert_bank_operations/mapped_expert_bank_pieces_and_pinning.rs @@ -1,5 +1,5 @@ -//! Methods of `MappedExpertBank`: `cache_context_matches`, `cache_source`, `cache_source_aligned`, `retained_span_ha... -//! Split out of `mapped_expert_bank_methods` to keep its files under the line limit. +//! Host-side views of a MappedExpertBank: cache sources and page-aligned pieces of an expert, and pin_resident, +//! which page-locks the ranked hot experts within a byte budget (round, merge, register) and unwinds on failure. use super::{ Context, Error, LayerRole, MappedExpertBank, PAGE, RegisteredBank, ResidentExpertBankSpan, Result, TensorRole, api, diff --git a/crates/cuda-driver/src/mmq/asset.rs b/crates/cuda-driver/src/mmq/asset.rs index 30763b5d..601fe449 100644 --- a/crates/cuda-driver/src/mmq/asset.rs +++ b/crates/cuda-driver/src/mmq/asset.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `mmq_experiment`. -//! Functions: `artifacts_valid`, `asset`, `original_formats_asset`, `bytes` and 1 more. +//! Sealed PTX assets of the MMQ kernels: each artifact is checked once for pinned length, NUL-terminated ASCII and +//! SHA-256 before use (the Original-formats pair against its own pin), plus small buffer helpers and mmq_experiment(). use super::{Context, Error, MmqExperiment, ORIGINAL_FORMATS_FIXUP_PIN, ORIGINAL_FORMATS_MUL_PIN, Result}; diff --git a/crates/cuda-driver/src/mmq/context.rs b/crates/cuda-driver/src/mmq/context.rs index 5ea75417..059ff4f7 100644 --- a/crates/cuda-driver/src/mmq/context.rs +++ b/crates/cuda-driver/src/mmq/context.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `mmq_weight_triplet`, `allocate_triplet`, `publish_triplet`, `admit_formats` and 12 more. -//! Functions: `check_weight_blocks`, `buffer_handles`, `check_padded_targets`, `owned_gate_up_layout`. +//! MMQ weight upload on a Context: format and charge admission, then repacking host or device raw weights into +//! padded MMQ layouts (single, gate/up/down triplet, owned gate-up) with checks that block counts and targets fit. use super::{ Context, DeviceBuffer, Error, Layout, MmqFormat, MmqWeights, ProjectionKind, ProjectionSpec, Result, RoutedFormat, diff --git a/crates/cuda-driver/src/mmq/mmq_experiment.rs b/crates/cuda-driver/src/mmq/mmq_experiment.rs index 92fb02f2..50be4ef4 100644 --- a/crates/cuda-driver/src/mmq/mmq_experiment.rs +++ b/crates/cuda-driver/src/mmq/mmq_experiment.rs @@ -1,5 +1,5 @@ -//! Methods of `MmqExperiment`: `new`, `enable_original_formats`, `function`, `weights` and 16 more. -//! Defines `ObservedRun`. +//! The MMQ experiment owner: loads the MMQ kernel modules and runs one observed projection (quantize, MMA, fixup) +//! with full finite readbacks, so the numeric gate tests can compare each stage with the recorded reference. use super::{ Context, DeviceBuffer, Error, Layout, MmqExperiment, MmqFormat, MmqObservation, MmqProfile, MmqRequest, MmqWeights, diff --git a/crates/cuda-driver/src/mmq/mmq_experiment_drop.rs b/crates/cuda-driver/src/mmq/mmq_experiment_drop.rs index 867908d9..7e3c31f5 100644 --- a/crates/cuda-driver/src/mmq/mmq_experiment_drop.rs +++ b/crates/cuda-driver/src/mmq/mmq_experiment_drop.rs @@ -1,5 +1,5 @@ -//! Methods of `MmqWeights`: `allocated_bytes`, `native_buffer`, `native_layout`, `native_spec` and 10 more. -//! Implements `Drop for MmqExperiment`, `Drop for MmqWeights`. +//! Native-path entry points of MmqWeights (Q8_1 quantize, gate/up and down column projections) and the close/Drop +//! implementations of MmqExperiment and MmqWeights, which release the loaded modules and device weight buffers. use super::{ DeviceBuffer, DownColumns, Error, Layout, MmqExperiment, MmqFormat, MmqWeights, NativeWeights, ProjectionKind, diff --git a/crates/cuda-driver/src/mmq/mmq_numeric_gpu_tests/digest.rs b/crates/cuda-driver/src/mmq/mmq_numeric_gpu_tests/digest.rs index 380736e0..a2df0bbc 100644 --- a/crates/cuda-driver/src/mmq/mmq_numeric_gpu_tests/digest.rs +++ b/crates/cuda-driver/src/mmq/mmq_numeric_gpu_tests/digest.rs @@ -1,5 +1,5 @@ -//! Methods of `Receipt`: `load`, `read`. Functions: `digest`, `hex`, `read_regular`, `parse_manifest` and 7 more. -//! Defines `Manifest`. +//! Receipt loader of the MMQ numeric GPU tests: reads the pinned fixture manifest, checks its headers and file list +//! and sha256 pins, and offers the JSON field readers and finite/compare helpers the cases use. use super::{ BTreeMap, CASE_FILES, Component, MetadataExt, OpenOptions, OpenOptionsExt, Path, PathBuf, Pin, Read, Receipt, diff --git a/crates/cuda-driver/src/mmq/mmq_numeric_gpu_tests/format_cases.rs b/crates/cuda-driver/src/mmq/mmq_numeric_gpu_tests/format_cases.rs index 483ec40f..027a88f2 100644 --- a/crates/cuda-driver/src/mmq/mmq_numeric_gpu_tests/format_cases.rs +++ b/crates/cuda-driver/src/mmq/mmq_numeric_gpu_tests/format_cases.rs @@ -1,5 +1,5 @@ -//! Functions: `cases`, `load_case`, `check_metadata`, `check_geometry`. Defines `Shape`. -//! Split out of `mmq_numeric_gpu_tests` to keep its files under the line limit. +//! Per-format test cases of the MMQ numeric GPU tests: loads each case from the receipt and checks that its recorded +//! geometry, grid and provenance flags match what the closed fixture expects before any kernel runs. use super::{Case, Receipt, field, finite, integer}; diff --git a/crates/cuda-driver/src/mmq/release_triplet.rs b/crates/cuda-driver/src/mmq/release_triplet.rs index 2d873c3c..3f9bef5f 100644 --- a/crates/cuda-driver/src/mmq/release_triplet.rs +++ b/crates/cuda-driver/src/mmq/release_triplet.rs @@ -1,5 +1,5 @@ -//! Functions: `release_triplet`. -//! Split out of `mmq` to keep its files under the line limit. +//! Releases the three device buffers of an MMQ projection in reverse order, keeps the first error and +//! poisons the context when any release fails; shared by the experiment and workspace cleanup paths. use super::{Context, DeviceBuffer, Result}; diff --git a/crates/cuda-driver/src/mmq/resident/asset.rs b/crates/cuda-driver/src/mmq/resident/asset.rs index 69a8d950..f78d5d90 100644 --- a/crates/cuda-driver/src/mmq/resident/asset.rs +++ b/crates/cuda-driver/src/mmq/resident/asset.rs @@ -1,5 +1,5 @@ -//! Methods of `QueuedCommand`: `launch`, `launch_projection`. -//! Methods of `Context`: `mmq_workspace`, `native_mmq_workspace`, `native_integer_iq3_mmq_workspace`, `native_intege... +//! The sealed PTX helper artifact of the resident MMQ path (length and sha256 checked), the queued launch commands +//! built from it, and the Context constructors of the MMQ workspace variants (native and original formats). use super::{Context, Error, MmqWorkspace, QueuedCommand, Result, combine, original_formats_asset}; diff --git a/crates/cuda-driver/src/mmq/resident/mmq_native_resident_gpu_tests/digest.rs b/crates/cuda-driver/src/mmq/resident/mmq_native_resident_gpu_tests/digest.rs index 43d68c51..29f47269 100644 --- a/crates/cuda-driver/src/mmq/resident/mmq_native_resident_gpu_tests/digest.rs +++ b/crates/cuda-driver/src/mmq/resident/mmq_native_resident_gpu_tests/digest.rs @@ -1,5 +1,5 @@ -//! Functions: `digest`, `read`, `parse_pins`, `read_pinned` and 10 more. -//! Split out of `mmq_native_resident_gpu_tests` to keep its files under the line limit. +//! Fixture and measurement helpers of the native resident MMQ GPU tests: reads the pinned fixture files by +//! manifest size and sha256, moves buffers to and from the device, and reports error metrics between two outputs. use super::{ BTreeMap, Context, DeviceBuffer, MetadataExt, OpenOptions, OpenOptionsExt, Path, PathBuf, Read, Write, finite_f32, diff --git a/crates/cuda-driver/src/mmq/resident/mmq_native_resident_gpu_tests/native_hidden_q8.rs b/crates/cuda-driver/src/mmq/resident/mmq_native_resident_gpu_tests/native_hidden_q8.rs index aaa08cb5..be2f2088 100644 --- a/crates/cuda-driver/src/mmq/resident/mmq_native_resident_gpu_tests/native_hidden_q8.rs +++ b/crates/cuda-driver/src/mmq/resident/mmq_native_resident_gpu_tests/native_hidden_q8.rs @@ -1,5 +1,5 @@ -//! Implements `Drop for Alias`. Functions: `native_hidden_q8`. -//! Split out of `mmq_native_resident_gpu_tests` to keep its files under the line limit. +//! Independent reference for the native resident tests: runs the original CommonQuantize kernel on a real native +//! hidden row and returns its Q8 bytes. Also owns the Drop of the test Alias buffer view. use super::{Alias, CHUNK, Context, DeviceBuffer, FixedOperation, download, ffi}; diff --git a/crates/cuda-driver/src/mmq/resident/mmq_resident_gpu_tests/digest.rs b/crates/cuda-driver/src/mmq/resident/mmq_resident_gpu_tests/digest.rs index 8d80eb19..9b1e6392 100644 --- a/crates/cuda-driver/src/mmq/resident/mmq_resident_gpu_tests/digest.rs +++ b/crates/cuda-driver/src/mmq/resident/mmq_resident_gpu_tests/digest.rs @@ -1,5 +1,5 @@ -//! Methods of `Receipt`: `load`, `check_pinned_contents`, `read`. -//! Functions: `digest`, `hex`, `read_regular`, `parse_manifest` and 14 more. +//! Receipt loader of the resident MMQ GPU tests: reads the pinned fixture manifest, checks its headers, file list and +//! sha256 pins (incl. pinned contents), and offers the digest, JSON field and finite/compare helpers the cases use. use super::{ BTreeMap, CASE_FILES, Component, Context, DeviceBuffer, MetadataExt, MmqFormat, OpenOptions, OpenOptionsExt, Path, diff --git a/crates/cuda-driver/src/mmq/resident/mmq_resident_gpu_tests/live_packet_alias_drop.rs b/crates/cuda-driver/src/mmq/resident/mmq_resident_gpu_tests/live_packet_alias_drop.rs index 4c27b7a1..d675f30c 100644 --- a/crates/cuda-driver/src/mmq/resident/mmq_resident_gpu_tests/live_packet_alias_drop.rs +++ b/crates/cuda-driver/src/mmq/resident/mmq_resident_gpu_tests/live_packet_alias_drop.rs @@ -1,5 +1,4 @@ -//! Implements `Drop for LivePacketAlias`. -//! Split out of `mmq_resident_gpu_tests` to keep its files under the line limit. +//! Drop of LivePacketAlias: puts back the original buffer handle that the alias test view had swapped out. use super::LivePacketAlias; diff --git a/crates/cuda-driver/src/mmq/resident/mmq_resident_gpu_tests/native_owner.rs b/crates/cuda-driver/src/mmq/resident/mmq_resident_gpu_tests/native_owner.rs index 95a392ce..062e0965 100644 --- a/crates/cuda-driver/src/mmq/resident/mmq_resident_gpu_tests/native_owner.rs +++ b/crates/cuda-driver/src/mmq/resident/mmq_resident_gpu_tests/native_owner.rs @@ -1,5 +1,5 @@ -//! Functions: `native_owner`, `native_gate_up_owner`, `native_down_owner`, `direct` and 2 more. -//! Split out of `mmq_resident_gpu_tests` to keep its files under the line limit. +//! Owner-equivalence checks of the resident MMQ tests: the native dual weights (gate/up prepared and grouped, +//! down columns) must produce the same bytes as the raw routed projections; plus the direct and gather checks. use super::{ CHUNK, Context, DOWN, DeviceBuffer, DownColumns, Error, GATE, GROUP, INPUT, MmqWeights, MmqWorkspace, Receipt, diff --git a/crates/cuda-driver/src/mmq/resident/mmq_resident_gpu_tests/resident_chain.rs b/crates/cuda-driver/src/mmq/resident/mmq_resident_gpu_tests/resident_chain.rs index 0f2abf10..7a7ad4ab 100644 --- a/crates/cuda-driver/src/mmq/resident/mmq_resident_gpu_tests/resident_chain.rs +++ b/crates/cuda-driver/src/mmq/resident/mmq_resident_gpu_tests/resident_chain.rs @@ -1,5 +1,5 @@ -//! Methods of `LivePacketAlias`: `new`, `buffer`. -//! Functions: `chain_baseline`, `chain`, `chain_hidden_checks`, `chain_slot_checks` and 8 more. +//! The resident MMQ chain test: runs gate/up, SwiGLU and down through the workspace against the original-first +//! nonresident baseline, checks hidden rows, slot output, short and foreign packets, and the witness probes. use super::{ Context, DOWN, DeviceBuffer, Error, FiniteMmqOutput, GATE, GROUP, HIDDEN, LivePacketAlias, MmqHidden, MmqProfile, diff --git a/crates/cuda-driver/src/mmq/resident/mmq_workspace.rs b/crates/cuda-driver/src/mmq/resident/mmq_workspace.rs index b8d85a22..c2cd184b 100644 --- a/crates/cuda-driver/src/mmq/resident/mmq_workspace.rs +++ b/crates/cuda-driver/src/mmq/resident/mmq_workspace.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `mmq_workspace_bring_up`, `mmq_workspace_gate_up_chunk_close`, `projection_plan`. -//! Split out of `resident` to keep its files under the line limit. +//! Module root of the resident MmqWorkspace: shared imports for its bring-up, gate/up chunk and projection-plan +//! files, each of which owns one phase of the workspace lifecycle. use super::{ CHUNK, Context, DOWN, DeviceBuffer, Error, GATE, GROUP, HIDDEN, INPUT, Layout, MmqChunkActivation, MmqExperiment, diff --git a/crates/cuda-driver/src/mmq/resident/mmq_workspace/mmq_workspace_bring_up.rs b/crates/cuda-driver/src/mmq/resident/mmq_workspace/mmq_workspace_bring_up.rs index 006b1bc1..aef7515d 100644 --- a/crates/cuda-driver/src/mmq/resident/mmq_workspace/mmq_workspace_bring_up.rs +++ b/crates/cuda-driver/src/mmq/resident/mmq_workspace/mmq_workspace_bring_up.rs @@ -1,5 +1,5 @@ -//! Methods of `MmqWorkspace`: `new`, `check_integer_policy`, `charge`, `bring_up` and 13 more. -//! Split out of `mmq_workspace` to keep its files under the line limit. +//! Construction and bring-up of the resident MmqWorkspace: charges its device budget up front, allocates the +//! eleven fixed buffers, loads the helper kernels and integer/native operators, and runs queued launches. use super::{ Context, DeviceBuffer, Error, MmqWorkspace, QueuedCommand, Result, bytes, combine, ffi, native_activation, diff --git a/crates/cuda-driver/src/mmq/resident/mmq_workspace/mmq_workspace_gate_up_chunk_close.rs b/crates/cuda-driver/src/mmq/resident/mmq_workspace/mmq_workspace_gate_up_chunk_close.rs index 247f5fc8..d1e39e7e 100644 --- a/crates/cuda-driver/src/mmq/resident/mmq_workspace/mmq_workspace_gate_up_chunk_close.rs +++ b/crates/cuda-driver/src/mmq/resident/mmq_workspace/mmq_workspace_gate_up_chunk_close.rs @@ -1,5 +1,5 @@ -//! Methods of `MmqWorkspace`: `prepare_original_gate_up_chunk`, `prepare_gate_up_chunk_with_operator`, `upload_and_q... -//! Split out of `mmq_workspace` to keep its files under the line limit. +//! Original-prompt gate/up chunk activation of the resident MmqWorkspace (affine D4 quantize, independent of the +//! native integer operators), the upload-and-quantize step it uses, and the workspace close. use super::{CHUNK, Error, INPUT, Layout, MmqChunkActivation, MmqFormat, MmqWorkspace, Result, bytes, combine}; diff --git a/crates/cuda-driver/src/mmq/resident/mmq_workspace/projection_plan.rs b/crates/cuda-driver/src/mmq/resident/mmq_workspace/projection_plan.rs index c28a5808..a31fb0d7 100644 --- a/crates/cuda-driver/src/mmq/resident/mmq_workspace/projection_plan.rs +++ b/crates/cuda-driver/src/mmq/resident/mmq_workspace/projection_plan.rs @@ -1,5 +1,5 @@ -//! Methods of `MmqWorkspace`: `finish_finite`, `finite`, `quantize`, `quantize_with_operator` and 15 more. -//! Functions: `finite_extent`, `finite_verdict`, `finite_output_name`. Defines `StreamKLaunch`, `ProjectPlan`. +//! Projection planning of the resident MmqWorkspace: finite-output proofs, activation quantize, plan and alias +//! validation, the native integer and stream-k projection launches, and the gate/up chunk preparation. use super::{ DOWN, Error, GATE, GROUP, HIDDEN, Layout, MmqChunkActivation, MmqExperiment, MmqFormat, MmqProfile, MmqWeights, diff --git a/crates/cuda-driver/src/mmq/resident/mmq_workspace_drop.rs b/crates/cuda-driver/src/mmq/resident/mmq_workspace_drop.rs index 87dfdd5f..74050151 100644 --- a/crates/cuda-driver/src/mmq/resident/mmq_workspace_drop.rs +++ b/crates/cuda-driver/src/mmq/resident/mmq_workspace_drop.rs @@ -1,5 +1,5 @@ -//! Methods of `MmqChunkActivation`: `gather_gate_up`, `gather_group`, `upload_gather_ids`, `gather_handles`. -//! Methods of `MmqGroupActivation`: `admits`, `gate_up`, `project_swiglu`, `swiglu_hidden` and 1 more. +//! Grouped activation flow of the resident MmqWorkspace: gather of expert rows, gate/up with SwiGLU, down +//! projection and bounded copies of finite Down columns into ten-slot packets. Also the Drop of the workspace. use super::{ CHUNK, DOWN, DOWN_Q8, DeviceBuffer, DownCopyHandles, Error, FiniteMmqOutput, FixedOperation, GATE, GROUP, HIDDEN, diff --git a/crates/cuda-driver/src/mmq/resident/original_group/asset.rs b/crates/cuda-driver/src/mmq/resident/original_group/asset.rs index 260d185d..dcd0d8a4 100644 --- a/crates/cuda-driver/src/mmq/resident/original_group/asset.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/asset.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalGroupBank`: `new`, `admit_charge`, `init`, `load_guarded` and 9 more. -//! Implements `Drop for OriginalGroupBank`. Functions: `asset`, `sizes`, `original_mmq_group_bank_bytes`. +//! The OriginalGroupBank: sealed PTX per kernel kind, the eager device-budget charge, module and kernel loading, +//! buffer allocation and bounds-checked buffer/handle access for the original prompt expert groups; Drop frees them. use super::{ Context, DeviceBuffer, Error, FORMATS, MmqFormat, OriginalGroupBank, Result, SEALED, TMP, WIDTHS, combine, ffi, diff --git a/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/chunk_stream/chunk_stream.rs b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/chunk_stream/chunk_stream.rs index 3c56f1c8..93296fd4 100644 --- a/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/chunk_stream/chunk_stream.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/chunk_stream/chunk_stream.rs @@ -1,5 +1,5 @@ -//! Methods of `Stats`: `new`. Methods of `Core`: `new`. Implements `Drop for ChunkStream`. Functions: `env_number`. -//! Defines `CoreParts`. +//! ChunkStream state for the prompt-chunk expert stream: an ordered list of expert copy entries (layer, expert) +//! feeding the ring slots, the shared Core and timing Stats, the issuer-thread setup and issue depth; Drop stops it. use super::{ ACTIVE, Api, Arc, AtomicBool, AtomicU64, AtomicUsize, BufferHandle, ChunkStream, Core, Entry, Error, Ordering, diff --git a/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/host_stage/host_stage.rs b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/host_stage/host_stage.rs index 1bbf10c5..09a2bae1 100644 --- a/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/host_stage/host_stage.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/host_stage/host_stage.rs @@ -1,5 +1,5 @@ -//! Methods of `HostStage`: `new`, `stager_sizes`, `unstarted`, `allocate_ring` and 13 more. -//! Implements `Drop for HostStage`. +//! HostStage: the page-locked ring buffers and helper threads that stage pageable experts on the host ahead of their +//! DMA, plus the STAGE_VERIFY check that a released buffer still equals its source. Drop stops helpers and frees them. use super::{ Arc, AtomicU32, AtomicU64, AtomicUsize, Condvar, Error, HostStage, Job, MAX_JOBS, Mutex, NON_FINITE, Ordering, diff --git a/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/host_stage/verify_enabled.rs b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/host_stage/verify_enabled.rs index 621f3660..5ccdd8b4 100644 --- a/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/host_stage/verify_enabled.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/host_stage/verify_enabled.rs @@ -1,5 +1,5 @@ -//! Methods of `Shared`: `claim`, `finished`, `work`, `await_jobs` and 4 more. -//! Functions: `verify_enabled`, `layer_priority`, `apply_priority`, `block_bytes` and 1 more. +//! Helper-thread side of HostStage: the shared job claim and copy loop, the finite FP16 block-scale check of copied +//! experts, the LELEKA_STAGE_VERIFY switch and the optional Windows page-cache priority for the layers read first. use super::{Arc, Job, NON_FINITE, NORMAL_PRIORITY, Ordering, Shared, thread}; // used only with some cargo features or targets of this crate diff --git a/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/original_mmq_copy_schedule.rs b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/original_mmq_copy_schedule.rs index e6b95973..244d9891 100644 --- a/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/original_mmq_copy_schedule.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/original_mmq_copy_schedule.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMmqCopySchedule`: `retain_host_metadata_charge`, `ring_slots`, `prompt_stream_active`, `begin... -//! Split out of `copy_ring` to keep its files under the line limit. +//! Public control of the OriginalMmqCopySchedule: begin and end the prompt-chunk expert stream, metadata byte +//! accounting, context validation, and the ordered close of host stage, events and streams after a failure. use super::{ ChunkStream, Context, Error, Events, OriginalGpuStream, OriginalMmqCopySchedule, Rc, Result, StreamEntry, diff --git a/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/original_mmq_copy_schedule_drop.rs b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/original_mmq_copy_schedule_drop.rs index ceb06900..ffa2eba5 100644 --- a/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/original_mmq_copy_schedule_drop.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/original_mmq_copy_schedule_drop.rs @@ -1,5 +1,4 @@ -//! Implements `Drop for OriginalMmqCopySchedule`. -//! Split out of `copy_ring` to keep its files under the line limit. +//! Drop of OriginalMmqCopySchedule: closes the schedule so its streams, events and host stage are released. use super::OriginalMmqCopySchedule; diff --git a/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring.rs b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring.rs index e5b806d2..78d57b42 100644 --- a/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring.rs @@ -1,5 +1,4 @@ -//! Groups the submodules `ring_construction`, `ring_gather_and_finish`, `ring_init` and 2 more. -//! Split out of `copy_ring` to keep its files under the line limit. +//! Module root of the copy Ring: shared imports of its construction, init, prefetch, stage and gather files. use super::{ Api, COMMAND_CAP, Command, Context, DeviceBuffer, Drain, Error, FORMATS, GatherDest, GroupArena, HostStage, Job, diff --git a/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring/ring_construction.rs b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring/ring_construction.rs index f5f2ecb9..45e4ce8a 100644 --- a/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring/ring_construction.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring/ring_construction.rs @@ -1,5 +1,5 @@ -//! Methods of `Ring`: `new`, `admitted_slots`. Functions: `schedule_serves_ring`. -//! Split out of `ring` to keep its files under the line limit. +//! Construction of the copy Ring: the rule that a schedule with enough slot events serves a (smaller) arena ring, +//! with its unit tests, and the admission of the arena stage slot count. use super::{Context, Error, OriginalMmqCopySchedule, Result, Ring, RingArena, RingExperts, RingPlan, combine}; diff --git a/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring/ring_gather_and_finish.rs b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring/ring_gather_and_finish.rs index 5c31e8ea..c1b2ff4b 100644 --- a/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring/ring_gather_and_finish.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring/ring_gather_and_finish.rs @@ -1,5 +1,5 @@ -//! Methods of `Ring`: `gather`, `gather_streamed`, `gather_slot`, `check_gather_destination` and 10 more. -//! Split out of `ring` to keep its files under the line limit. +//! Gather and finish side of the copy Ring: gathers a staged expert slot into the group bank on the compute stream, +//! records the slot as used, releases a layer stream entry, and copies status words after both streams drain. use super::{Command, DeviceBuffer, Error, GatherDest, MmqFormat, OriginalGpuStream, Result, Ring, combine, ffi}; use crate::ring_prefetch::RingRefusal; diff --git a/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring/ring_stage_expert_copies.rs b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring/ring_stage_expert_copies.rs index 9eab7ce1..03bd9d40 100644 --- a/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring/ring_stage_expert_copies.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring/ring_stage_expert_copies.rs @@ -1,5 +1,5 @@ -//! Methods of `Ring`: `metadata_bytes`, `enqueue`, `flag`, `stage_one` and 10 more. Functions: `profile_copied`. -//! Split out of `ring` to keep its files under the line limit. +//! Staging side of the copy Ring: copies one expert (gate, up, down) into a ring slot from a registered bank or +//! the host stage, as page-aligned supersets or exact pieces, and records its copied event and PCIe profile. use super::{ Api, COMMAND_CAP, Command, Drain, Error, MmqFormat, OriginalGpuEvent, OriginalGpuStream, ResidentExpertBankSpan, diff --git a/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring_drop.rs b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring_drop.rs index fd81ee7e..a0f76ec9 100644 --- a/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring_drop.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring_drop.rs @@ -1,5 +1,4 @@ -//! Implements `Drop for Ring`. -//! Split out of `copy_ring` to keep its files under the line limit. +//! Drop of the copy Ring: runs the ordered close so the ring slots, events and host stage are released. use super::Ring; diff --git a/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/skip_expert_dma.rs b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/skip_expert_dma.rs index 165a0e48..999dbb31 100644 --- a/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/skip_expert_dma.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/skip_expert_dma.rs @@ -1,5 +1,5 @@ -//! Methods of `ChunkStream`: `entry`, `next_layer_is`, `entry_matches`, `acquire` and 3 more. -//! Methods of `Drain`: `index`. Implements `RingArena for OriginalDeviceGrRead`. +//! Diagnostic switches of the copy ring (skip expert DMA, serialize ring), non-CUDA stubs of ChunkStream, the +//! RingArena view of OriginalDeviceGrRead, and Context::original_mmq_copy_schedule, which opens its streams and events. use super::{ Api, Context, Drain, Error, Events, OriginalEventKind, OriginalMmqCopySchedule, OriginalStreamKind, Rc, Result, diff --git a/crates/cuda-driver/src/mmq/resident/original_group/kind.rs b/crates/cuda-driver/src/mmq/resident/original_group/kind.rs index 7fc7dbdf..4658065e 100644 --- a/crates/cuda-driver/src/mmq/resident/original_group/kind.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/kind.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `native_integer_iq3_mmq_original_grouped_workspace`. -//! Implements `GroupArena for OriginalDeviceGrRead`. Functions: `kind`, `shared`, `format_index`, `layout` and 1 more. +//! Format tables of the original grouped MMQ path (kernel kind, shared memory, format index, layout), the Context +//! constructor of the grouped workspace, and the GroupArena span view of the prompt arena. use super::{ BOUNDS, Context, D, Error, FORMATS, GU, GroupArena, H, HQ, IDENTITY, Layout, MmqFormat, MmqWorkspace, diff --git a/crates/cuda-driver/src/mmq/resident/original_group/mmq_workspace.rs b/crates/cuda-driver/src/mmq/resident/original_group/mmq_workspace.rs index 13d5c18c..7c246e96 100644 --- a/crates/cuda-driver/src/mmq/resident/original_group/mmq_workspace.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/mmq_workspace.rs @@ -1,5 +1,5 @@ -//! Methods of `MmqWorkspace`: `enable_original_expert_groups`, `enable_original_expert_group_arena`, `original_exper... -//! Methods of `RoutePlan`: `new`. +//! Original expert grouping API of MmqWorkspace: enables the group bank or arena-only mode, and prepares a layer by +//! uploading routes (host or device), validating expert counts, and quantizing the Mixed rows into indexed Q8. use super::{ BOUNDS, Error, GroupArena, IDENTITY, MmqWorkspace, OriginalGroupBank, OriginalMmqLayer, QuantizeSlots, ROW_IDS, diff --git a/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_layer.rs b/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_layer.rs index 04955e2a..3f3c0ae1 100644 --- a/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_layer.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_layer.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `finite_and_quantize`, `group_projection`, `original_mmq_layer_stage_experts`. -//! Split out of `original_group` to keep its files under the line limit. +//! Module root of OriginalMmqLayer, one layer of the original grouped MMQ path: its buffer checks, grouped +//! projection and expert staging live in the three files below. use super::{ BOUNDS, D, DeviceBuffer, Error, FORMATS, FiniteScan, GU, H, HQ, IDENTITY, Layout, MmqFormat, OriginalGroupBank, diff --git a/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_layer/finite_and_quantize.rs b/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_layer/finite_and_quantize.rs index 5197a587..93cf5920 100644 --- a/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_layer/finite_and_quantize.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_layer/finite_and_quantize.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMmqLayer`: `bank`, `span`, `handle`, `reject_arena_alias` and 10 more. -//! Split out of `original_mmq_layer` to keep its files under the line limit. +//! OriginalMmqLayer buffer access and safety checks: bank spans and handles, arena alias refusal, the finite-scan +//! status decoding, the activation quantizer lookup, and staging of one expert with source overlap proofs. use super::{ D, DeviceBuffer, Error, FORMATS, FiniteScan, H, MmqFormat, OriginalGroupBank, OriginalMmqLayer, QuantizeSlots, diff --git a/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_layer/group_projection.rs b/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_layer/group_projection.rs index e3b201b4..008e0c5e 100644 --- a/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_layer/group_projection.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_layer/group_projection.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMmqLayer`: `project`, `project_plan`, `project_kernels`, `project_grid` and 11 more. -//! Defines `ProjectPlan`, `ProjectHandles`. +//! Grouped projection of OriginalMmqLayer: plans the gate/up and down launches (kernels, stream-k grid, fixup), +//! builds their arguments, runs the group (projection, SwiGLU, hidden quantize) and arbitrates finite status. use super::{ BOUNDS, D, Error, FiniteScan, GU, H, HQ, IDENTITY, Layout, MmqFormat, OriginalGroupBank, OriginalMmqLayer, diff --git a/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_layer/original_mmq_layer_stage_experts.rs b/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_layer/original_mmq_layer_stage_experts.rs index b144167c..dac87960 100644 --- a/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_layer/original_mmq_layer_stage_experts.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_layer/original_mmq_layer_stage_experts.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMmqLayer`: `stage_raw`, `stage_slots`, `raw_amount`, `check_raw_handles` and 4 more. -//! Split out of `original_mmq_layer` to keep its files under the line limit. +//! Expert staging into OriginalMmqLayer: picks the next gate/up and down slots, proves raw sources disjoint, and +//! stages an expert from retained registered slices or from a completed prompt-cache prefix. use super::{ Error, MmqFormat, OriginalGroupBank, OriginalMmqLayer, QueuedCommand, Result, WD, WG, commands, ffi, kind, diff --git a/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_output.rs b/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_output.rs index 5a3d5ef0..be1e5b69 100644 --- a/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_output.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_output.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMmqOutput`: `copy_group_down_to_prompt`, `check_arena_destination`, `copy_expert_down_columns... -//! Methods of `OriginalMmqLayer`: `group_down_spans`, `down_column_handles`, `check_down_destination`, `reject_down_... +//! Output side of an original grouped MMQ layer: copies the finite Down group, or single expert columns, into the +//! prompt Dm arena or Down slots, after proving shapes, owners, extents and non-overlap. use super::{ Context, D, DeviceBuffer, Error, OriginalGroupBank, OriginalMmqLayer, OriginalMmqOutput, Result, combine, ffi, diff --git a/crates/cuda-driver/src/mmq/resident/original_group/stream_all_mmq/group_producer_gather_project.rs b/crates/cuda-driver/src/mmq/resident/original_group/stream_all_mmq/group_producer_gather_project.rs index 49a97474..37ebc1c6 100644 --- a/crates/cuda-driver/src/mmq/resident/original_group/stream_all_mmq/group_producer_gather_project.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/stream_all_mmq/group_producer_gather_project.rs @@ -1,5 +1,5 @@ -//! Methods of `Producer`: `rejects_context`, `rejects_state`, `check_spans`, `check_formats` and 5 more. -//! Implements `OriginalStreamAllGroupProducer for Producer`. +//! Gather and project steps of the stream-all group Producer: validates the prompt rows, formats and member +//! spans, gathers one expert into the group bank and enqueues its projection, refusing aliased buffers. use super::{ BOUNDS, Command, Context, D, Error, FORMATS, GU, H, HQ, IDENTITY, OriginalGpuStream, diff --git a/crates/cuda-driver/src/mmq/resident/original_group/stream_all_mmq/original_mmq_layer.rs b/crates/cuda-driver/src/mmq/resident/original_group/stream_all_mmq/original_mmq_layer.rs index 4bdc3c6c..5221fb7a 100644 --- a/crates/cuda-driver/src/mmq/resident/original_group/stream_all_mmq/original_mmq_layer.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/stream_all_mmq/original_mmq_layer.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMmqLayer`: `enqueue_global_group`, `enqueue_zeroes`, `enqueue_hidden_checks`, `enqueue_hidden... -//! Split out of `stream_all_mmq` to keep its files under the line limit. +//! Stream-all execution on OriginalMmqLayer: enqueues the per-group zeroing, gate/up, SwiGLU, hidden quantize and +//! down launches with finite scans, then drains the stream and arbitrates the four status words per group. use super::{ Command, D, Error, GU, H, HQ, MmqFormat, OriginalGpuStream, OriginalGroupBank, OriginalMmqLayer, diff --git a/crates/cuda-driver/src/mmq/resident/original_group/stream_all_mmq/transport.rs b/crates/cuda-driver/src/mmq/resident/original_group/stream_all_mmq/transport.rs index bb1ec6a8..7dc5306b 100644 --- a/crates/cuda-driver/src/mmq/resident/original_group/stream_all_mmq/transport.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/stream_all_mmq/transport.rs @@ -1,5 +1,5 @@ -//! Methods of `Transport`: `new`, `reserve_host`, `check_host_budget`, `check_device_budget` and 5 more. -//! Implements `Drop for Transport`, `Drop for Producer`. +//! Transport of the stream-all producer: the command list, flag and status buffers, host and device budget checks, +//! enqueue onto the GPU stream and copy-back of statuses; Drop of Transport and Producer release them. use super::{ Api, COMMAND_CAP, Command, Context, DeviceBuffer, Error, OriginalGpuStream, Producer, Result, Transport, combine, diff --git a/crates/cuda-driver/src/mmq/tile.rs b/crates/cuda-driver/src/mmq/tile.rs index fe4e2c01..bdbc9d3d 100644 --- a/crates/cuda-driver/src/mmq/tile.rs +++ b/crates/cuda-driver/src/mmq/tile.rs @@ -1,5 +1,5 @@ -//! Methods of `Tile`: `width`, `index`, `original`. -//! Methods of `MmqFormat`: `index`, `entry`, `fixup_entry`, `geometry` and 2 more. +//! Tile widths (J8..J64) and MmqFormat tables of the MMQ path: the original mul_mat_q and stream-k fixup kernel +//! entry symbols per format and tile, format geometry, and the (adaptive) Layout of a projection for a token count. use super::{CStr, Error, Layout, MmqFormat, MmqProfile, Result, Tile}; diff --git a/crates/cuda-driver/src/mmq_original_host_stage/tests.rs b/crates/cuda-driver/src/mmq_original_host_stage/tests.rs index a2fd99e4..fe1c4ac9 100644 --- a/crates/cuda-driver/src/mmq_original_host_stage/tests.rs +++ b/crates/cuda-driver/src/mmq_original_host_stage/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the original host stage: the FP16 block-scale finite rule per routed format, and the helper-thread +//! protocol (wait refuses over-long reads, finish cancels waiters and leaves no helper copying from a released bank). use super::*; #[test] diff --git a/crates/cuda-driver/src/moe_group_projection/grouped_gu21_gu23_gpu/grouped_numeric_run.rs b/crates/cuda-driver/src/moe_group_projection/grouped_gu21_gu23_gpu/grouped_numeric_run.rs index 96f7c8e6..a87724b5 100644 --- a/crates/cuda-driver/src/moe_group_projection/grouped_gu21_gu23_gpu/grouped_numeric_run.rs +++ b/crates/cuda-driver/src/moe_group_projection/grouped_gu21_gu23_gpu/grouped_numeric_run.rs @@ -1,5 +1,5 @@ -//! Methods of `GuRig`: `new`, `finish`. Methods of `ScalarBuffers`: `new`, `release`, `column`, `down_columns`. -//! Functions: `scalar_products`, `input_unchanged`, `close_owners`, `release_inputs` and 2 more. +//! Numeric run of the grouped gate/up GPU proof: computes every original scalar product first, then the grouped +//! products from the same device owners, repeats with sentinel outputs, and compares them byte for byte. use super::{ Comparison, Context, DeviceBuffer, DownColumns, ProjectionKind, ProjectionSpec, Result, RoutedFormat, diff --git a/crates/cuda-driver/src/moe_group_projection/grouped_gu21_gu23_gpu/guards.rs b/crates/cuda-driver/src/moe_group_projection/grouped_gu21_gu23_gpu/guards.rs index 87588edb..66bd767d 100644 --- a/crates/cuda-driver/src/moe_group_projection/grouped_gu21_gu23_gpu/guards.rs +++ b/crates/cuda-driver/src/moe_group_projection/grouped_gu21_gu23_gpu/guards.rs @@ -1,5 +1,5 @@ -//! Methods of `GuardRig`: `new`, `shape_refusals`, `short_refusals`, `foreign_refusal` and 5 more. -//! Functions: `is_finite_words`, `budget_refusal`, `budget_run`, `guards`. Defines `GuardRig`. +//! Refusal checks of the grouped gate/up GPU proof: wrong shape, short or foreign buffers, malformed (NaN/Inf) +//! weights, bad activations and an exhausted table budget must fail without publishing a usable product. use super::{ Context, Device, DeviceBuffer, Error, Result, RoutedFormat, RoutedGateUpQ8, gu_weights, input, read, upload, diff --git a/crates/cuda-driver/src/moe_group_projection/grouped_gu21_gu23_nc4_gpu/grouped_upload_run.rs b/crates/cuda-driver/src/moe_group_projection/grouped_gu21_gu23_nc4_gpu/grouped_upload_run.rs index abf613e5..e8f808af 100644 --- a/crates/cuda-driver/src/moe_group_projection/grouped_gu21_gu23_nc4_gpu/grouped_upload_run.rs +++ b/crates/cuda-driver/src/moe_group_projection/grouped_gu21_gu23_nc4_gpu/grouped_upload_run.rs @@ -1,5 +1,5 @@ -//! Methods of `GuRig`: `new`, `finish`. Methods of `ScalarBuffers`: `new`, `release`, `column`, `down_columns`. -//! Functions: `upload`, `read`, `gu_weights`, `down_weights` and 7 more. +//! Upload helpers and numeric run of the NC4 grouped gate/up GPU proof: builds deterministic weights and inputs, +//! computes every scalar product first, then compares the four-column grouped products including the T5 tail. use super::{ Comparison, Context, DeviceBuffer, DownColumns, ProjectionKind, ProjectionSpec, Result, RoutedFormat, diff --git a/crates/cuda-driver/src/moe_group_projection/grouped_gu21_gu23_nc4_gpu/guards.rs b/crates/cuda-driver/src/moe_group_projection/grouped_gu21_gu23_nc4_gpu/guards.rs index 1d9fb169..fe994db4 100644 --- a/crates/cuda-driver/src/moe_group_projection/grouped_gu21_gu23_nc4_gpu/guards.rs +++ b/crates/cuda-driver/src/moe_group_projection/grouped_gu21_gu23_nc4_gpu/guards.rs @@ -1,5 +1,5 @@ -//! Methods of `GuardRig`: `new`, `shape_refusals`, `short_refusals`, `foreign_refusal` and 7 more. -//! Functions: `is_finite_words`, `close_prepared`, `release_inputs`, `budget_refusal` and 2 more. Defines `GuardRig`. +//! Refusal checks of the NC4 grouped gate/up GPU proof: shape, short and foreign owners, malformed outputs, the +//! four-column tile plus live tail after fault and reset, and the 40-byte table budget refusal. use super::{ Context, Device, DeviceBuffer, Error, Result, RoutedFormat, RoutedGateUpQ8, gu_weights, input, read, upload, diff --git a/crates/cuda-driver/src/moe_prefill_batch/tests.rs b/crates/cuda-driver/src/moe_prefill_batch/tests.rs index fa9af278..db18998f 100644 --- a/crates/cuda-driver/src/moe_prefill_batch/tests.rs +++ b/crates/cuda-driver/src/moe_prefill_batch/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of `moe_prefill_batch`. +//! Tests of the MoE prefill batch program: stage slot order and sizes, the fixed program order with combine as the +//! only tail, status arbitration, kernel table and route/combine map checks, binding refusals and the pinned artifact. use super::*; diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/abi/arguments.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/abi/arguments.rs index 38b68978..ff7e7ca8 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/abi/arguments.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/abi/arguments.rs @@ -1,5 +1,5 @@ -//! Methods of `Arguments`: `metadata_bytes`, `new`. Methods of `Module`: `load`, `launch`, `copy`, `close`. -//! Split out of `abi` to keep its files under the line limit. +//! Kernel argument list (Arguments, with its metadata byte count) of the fixed-symbol MTP ABI, plus the Module stubs +//! that refuse with UnsupportedPlatform when the CUDA driver is not built in. use super::{Arg, Arguments, Error, Result, c_void}; diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/abi/host_enabled.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/abi/host_enabled.rs index 3c30b37d..32a05b41 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/abi/host_enabled.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/abi/host_enabled.rs @@ -1,5 +1,5 @@ -//! Methods of `MappedOwner`: `new`, `new_sized`, `new_for_state`, `new_inner` and 9 more. -//! Implements `Drop for Library`, `Drop for MappedOwner`. Functions: `check`, `host_alloc`. +//! MappedOwner of the MTP ABI: a host-allocated block mapped to a device address, zeroed on creation, with bounded +//! write, read and state-zero access. Loads the driver library symbols; Drop frees the block and the library. use super::{Error, HOST_BYTES, Result}; use std::ffi::c_void; diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_int8_owner_id.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_int8_owner_id.rs index 28becec9..ff18bc5b 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_int8_owner_id.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_int8_owner_id.rs @@ -1,5 +1,5 @@ -//! Methods of `MtpInt8OwnerId`: `same_owner`. Methods of `Pages`: `empty`, `from_vec`, `with_tail`, `len` and 2 more. -//! Implements `Clone for MtpOriginalRingResources`. Functions: `snapshot_memo`. +//! Snapshot bookkeeping of the original MTP int8 KV: owner identity, the copy-on-write Pages list shared by +//! snapshots, snapshot size and position accessors, the completed replay rows, and the snapshot memo switch. use super::{ CompletedMtpAttention, CompletedMtpKvReplay, Context, DeviceBuffer, Error, MtpInt8OwnerId, MtpInt8Snapshot, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_attend_split_k.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_attend_split_k.rs index f70e3e2a..91af945b 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_attend_split_k.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_attend_split_k.rs @@ -1,5 +1,5 @@ -//! Methods of `MtpOriginalInt8`: `attend`, `check_attend`, `admit_query`, `addresses` and 6 more. -//! Split out of `mtp_original_int8_methods` to keep its files under the line limit. +//! Dense-window INT8 split-K attention of the original MTP ring: admits the query, enqueues the chunk reset, +//! split-K partials and merge launches with a finite check, and the close of the ring. use super::{ Arg, CHUNKS, Command, CompletedMtpAttention, Error, LaunchDims, MTP_ORIGINAL_WINDOW, MtpInt8Snapshot, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_kv_only_replay.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_kv_only_replay.rs index 7babde8b..e50d1836 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_kv_only_replay.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_kv_only_replay.rs @@ -1,5 +1,5 @@ -//! Methods of `MtpOriginalInt8`: `record_kv_only`, `kv_only_admit`, `kv_only_stage`, `kv_only_run` and 13 more. -//! Split out of `mtp_original_int8_methods` to keep its files under the line limit. +//! KV-only replay of the original MTP int8 ring (record_forward(false) attention tail): quantize, K/V projections, +//! K norm, rope and the per-row int8 append, with finite guards, alias checks and the resulting snapshot. use super::{ Arg, Command, CompletedMtpKvReplay, DeviceBuffer, Error, LaunchDims, MtpInt8Snapshot, MtpOriginalInt8, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_restore.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_restore.rs index 8e5242a3..0a1f89ed 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_restore.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_restore.rs @@ -1,5 +1,5 @@ -//! Methods of `MtpOriginalInt8`: `restore`, `begin_restore`, `restore_resident`, `write_host_pages` and 1 more. -//! Functions: `page_shared`. +//! Snapshot restore of the original MTP int8 ring: invalidates the current witness, writes the host pages the +//! previous witness lacked and rebuilds the modulo ring blocks on the device from the mapped pages. use super::{ Command, Error, HOST_OFFSETS, MtpInt8Snapshot, MtpOriginalInt8, NativeBatchWorkspace, PAGE_BYTES, Page, Rc, Result, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_ring_bring_up.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_ring_bring_up.rs index 2eb0cf78..d6b270c5 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_ring_bring_up.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_ring_bring_up.rs @@ -1,5 +1,5 @@ -//! Methods of `MtpOriginalInt8`: `planned_device_bytes`, `pinned_host_bytes`, `max_snapshot_payload_bytes`, `max_sna... -//! Functions: `kv_assets_sealed`. +//! Bring-up of the original MTP int8 ring: byte budgets, the sealed PTX check, module loading, host mapping, +//! pool initialisation, and the retained physical resources and status queries of an open ring. use super::{ ATTN_ENTRIES, Cell, Context, DeviceBuffer, Error, KV_ENTRIES, MTP_ORIGINAL_PINNED_HOST_BYTES, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_validate_execute.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_validate_execute.rs index 36e9571f..de134a6b 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_validate_execute.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_validate_execute.rs @@ -1,5 +1,5 @@ -//! Methods of `MtpOriginalInt8`: `validate`, `provided`, `validate_pool`, `reject_earlier_overlap` and 12 more. -//! Split out of `mtp_original_int8_methods` to keep its files under the line limit. +//! Admission and execution of the original MTP int8 ring: pool and snapshot validation (overlap and mapped-alias +//! checks), launching command lists on the model stream, and settling their completion or poisoning. use super::{ Arg, Arguments, Command, DeviceBuffer, Error, LaunchDims, MTP_ORIGINAL_MAX_CELLS, MTP_ORIGINAL_PINNED_HOST_BYTES, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_state_adoption.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_state_adoption.rs index 10780a41..602f0cde 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_state_adoption.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_state_adoption.rs @@ -1,5 +1,5 @@ -//! Methods of `MtpOriginalInt8`: `new_original_state`, `bring_up_state`, `load_state_modules`, `adopt_selected` and ... -//! Implements `Drop for MtpOriginalInt8`. Functions: `original_state_sealed`. +//! State adoption of MtpOriginalInt8: seals and loads the state modules, binds the selected ring state or allocates +//! the extra pools, and exposes host addresses and encoded pages; Drop of MtpOriginalInt8 lives here too. use super::{ ATTN_ENTRIES, Context, DeviceBuffer, Error, HOST_OFFSETS, HOST_RUNS, KV_ENTRIES, MappedOwner, Module, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/physical_ring.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/physical_ring.rs index 573a484a..0ac34ee7 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/physical_ring.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/physical_ring.rs @@ -1,5 +1,5 @@ -//! Methods of `PhysicalRing`: `validate_context`, `unavailable`, `close_inner`, `close_modules` and 1 more. -//! Methods of `Context`: `mtp_original_int8`. Implements `Drop for PhysicalRing`. +//! Physical storage of the original MTP int8 ring: context validation, ordered close of modules and host mapping, +//! the pool layout and row-range checks, and the Context::mtp_original_int8 entry point; Drop of PhysicalRing. use super::{ Context, DeviceBuffer, Error, MTP_ORIGINAL_MAX_CELLS, MTP_ORIGINAL_WINDOW, MtpOriginalInt8, PhysicalRing, Result, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/completed_draft_kv.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/completed_draft_kv.rs index 445c70ac..48e31e41 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/completed_draft_kv.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/completed_draft_kv.rs @@ -1,5 +1,5 @@ -//! Methods of `CompletedDraftKv`: `validate_current`, `first_materialized`, `next_position`, `owner_id` and 3 more. -//! Methods of `OriginalMtpEmbedding`: `native`, `compressed`, `vocab`. +//! Accessors of CompletedDraftKv (the finished draft KV of a prefill: snapshots at a position or window, validity +//! against the ring), the native and compressed MTP embedding table layouts, and the original int8 DraftKvPolicy. use super::{ CompletedDraftKv, CompressedEmbedding, DeviceBuffer, DraftKvPolicy, EmbeddingKind, Error, MtpInt8OwnerId, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill.rs index 4c140c96..b4a3866b 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `block_commands`, `kernel_commands`, `original_mtp_prefill_close` and 4 more. -//! Split out of `prefill` to keep its files under the line limit. +//! Root of the MTP prefill recorder: declares the submodules that record block, kernel and projection commands, +//! walk the operands, run and settle the command list, and close the prefill. use super::{ A, Args, BufferHandle, Cmd, CompletedDraftKv, Context, DeviceBuffer, DraftKvFallback, DraftKvOutcome, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/kernel_commands.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/kernel_commands.rs index a18fdaec..f9a11034 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/kernel_commands.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/kernel_commands.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpPrefill`: `new`, `sealed_assets`, `open`, `load_modules` and 10 more. -//! Split out of `original_mtp_prefill` to keep its files under the line limit. +//! Bring-up and kernel-command plumbing of OriginalMtpPrefill: loads the five sealed PTX assets, allocates scratch and +//! status words, and offers the kernel/finite command builders plus the weight and scratch alias checks. use super::{ A, Args, BufferHandle, Cmd, Context, DeviceBuffer, ENTRIES, Error, FLAG_WORDS, KernelAt, KernelShape, Mod, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/original_mtp_prefill_close.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/original_mtp_prefill_close.rs index 0c5ad030..97bdbc10 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/original_mtp_prefill_close.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/original_mtp_prefill_close.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpPrefill`: `close`, `close_inner`, `close_module`, `release_buffer`. -//! Split out of `original_mtp_prefill` to keep its files under the line limit. +//! Close of OriginalMtpPrefill: unloads the kernel modules and releases the status and scratch buffers, keeping the +//! first error. use super::{Context, DeviceBuffer, Error, Mod, OriginalMtpPrefill, Result, combine}; diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/projection_commands.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/projection_commands.rs index 8ef557dd..7c88bd82 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/projection_commands.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/projection_commands.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpPrefill`: `project`, `project_launch`, `project_tile`, `project_grid` and 6 more. -//! Split out of `original_mtp_prefill` to keep its files under the line limit. +//! Projection command builder of OriginalMtpPrefill: picks the tile width and stream-k grid, quantizes and scans the +//! activations, and enqueues the projection kernel and, when needed, the fixup kernel. use super::{ A, Cmd, Error, KernelAt, KernelShape, OriginalMtpPrefill, ProjectionAddresses, ProjectionDims, Region, Result, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/record_walk.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/record_walk.rs index eb941c7d..f57d94bd 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/record_walk.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/record_walk.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpPrefill`: `record`, `record_call`, `admit`, `fallback_for` and 16 more. -//! Functions: `weight_refs`. +//! Entry point of the original MTP prefill: records the draft KV of a row range into the draft ring, admitting the +//! call, staging weights with disjointness proofs, walking the blocks, and reading back the changed pages. use super::{ Admit, AppendBlock, Block, BufferHandle, Call, CompletedDraftKv, DeviceBuffer, DraftKvFallback, DraftKvOutcome, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/run_and_settle.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/run_and_settle.rs index 006662cb..eeb6b2ac 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/run_and_settle.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/run_and_settle.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpPrefill`: `run`, `checked_status`, `mark_run_failed`, `run_error` and 4 more. -//! Methods of `RunJob`: `new`. Functions: `status_word`. Defines `StatusRead`, `RunJob`, `Settled`. +//! Executes one recorded MTP prefill command list on the device and settles it: uploads staging data, launches every +//! kernel/copy/GEMM, waits on stream and device, reads back the status words and poisons the prefill on failure. use super::{ BufferHandle, Cmd, Error, FLAG_WORDS, NativeBatchWorkspace, OriginalMtpPrefill, OriginalPromptRows, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill_drop.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill_drop.rs index c68af9d7..79eb84cc 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill_drop.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill_drop.rs @@ -1,5 +1,4 @@ -//! Implements `Drop for OriginalMtpPrefill`. -//! Split out of `prefill` to keep its files under the line limit. +//! Drop of OriginalMtpPrefill: closes the prefill (releasing its device buffers and modules) on a best-effort basis. use super::OriginalMtpPrefill; diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/region.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/region.rs index 6d43ef26..b8b9297c 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/region.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/region.rs @@ -1,5 +1,5 @@ -//! Methods of `Region`: `new`, `per_row`, `widths`, `handle` and 1 more. Methods of `Context`: `original_mtp_prefill`. -//! Split out of `prefill` to keep its files under the line limit. +//! The scratch Region of the MTP prefill: carves one device buffer into 20 aligned per-row roles for a row batch +//! and hands out bounds-checked sub-handles; also the Context entry point original_mtp_prefill. use super::{BufferHandle, Context, Error, OriginalMtpPrefill, Region, Result, aligned, q8_bytes}; diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/context.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/context.rs index 0cd399b1..b0006624 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/context.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/context.rs @@ -1,5 +1,4 @@ -//! Methods of `Context`: `original_mtp_full_forward`. -//! Split out of `full_forward` to keep its files under the line limit. +//! Context entry point original_mtp_full_forward: builds the full-forward MTP drafter program from retained weights. use super::{Context, OriginalMtpFullForward, OriginalMtpRetainedFullWeights, Rc, Result}; diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/context_original_mtp_shared_layout.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/context_original_mtp_shared_layout.rs index 61f5b759..7a724d1c 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/context_original_mtp_shared_layout.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/context_original_mtp_shared_layout.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `original_mtp_shared_layout`, `admit_layout_charge`, `original_mtp_shared_layout_device_byt... -//! Functions: `shared_layout_charge`, `layout_setup`, `ring_assets_sealed`. +//! Context constructors for the shared Original MTP layout: one device arena used by the scalar prefill and the +//! full forward, with its budget charge, admission and sealed-PTX checks; _with_ring also builds the ring state. use super::{ Context, Error, MtpOriginalInt8, OriginalLayoutSetup, OriginalMtpFullForward, OriginalMtpRetainedFullWeights, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/completed_original_mtp_draft.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/completed_original_mtp_draft.rs index 0943b1f4..f6ff6031 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/completed_original_mtp_draft.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/completed_original_mtp_draft.rs @@ -1,5 +1,5 @@ -//! Methods of `CompletedOriginalMtpDraft`: `ids`, `probabilities`, `count`, `final_snapshot` and 4 more. -//! Split out of `full_drafter` to keep its files under the line limit. +//! Read accessors of a finished MTP draft (ids, probabilities, count, positions, snapshot) and the check that it is +//! still the current snapshot of the ring it was drafted on. use super::{CompletedOriginalMtpDraft, Error, MtpInt8Snapshot, MtpOriginalInt8, Rc, Result}; diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter.rs index 6155f154..beb8adf7 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `original_mtp_drafter_chain_gate`, `original_mtp_drafter_finish_chain`, `original_mtp_draft... -//! Split out of `full_drafter` to keep its files under the line limit. +//! Root of OriginalMtpDrafter: declares its submodules (construction, round launch, chain finishing, pipelined chain, +//! chain gate, keep-bank) and holds their shared imports. use super::{ AcceptedWindow, AdmittedRound, CompletedOriginalMtpDraft, Context, DirectVerifierRows, DraftKvOutcome, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter/original_mtp_drafter_finish_chain.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter/original_mtp_drafter_finish_chain.rs index 2f82f982..fa8502cb 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter/original_mtp_drafter_finish_chain.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter/original_mtp_drafter_finish_chain.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpDrafter`: `finish_inner`, `finish_chain`, `fail_if_poisoned`, `finish_first_step` and 10 m... -//! Functions: `chain_key`. Defines `ChainPlan`, `ChainStepAt`, `ChainGraphs`. +//! Finishing half of an MTP draft: reads back the first round graph, runs the chain steps that follow while the host +//! works, closes the ring mutation, and releases verifier bindings, records the scalar prefill and closes the drafter. use super::{ CompletedOriginalMtpDraft, Context, DraftKvOutcome, Error, InFlightDraft, MTP_ORIGINAL_MAX_CELLS, MtpInt8Snapshot, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter/original_mtp_drafter_launch_rounds.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter/original_mtp_drafter_launch_rounds.rs index 55f8fbd0..23017647 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter/original_mtp_drafter_launch_rounds.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter/original_mtp_drafter_launch_rounds.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpDrafter`: `launch_inner`, `launch_prepare`, `launch_record`, `launch_enqueue` and 9 more. -//! Split out of `original_mtp_drafter` to keep its files under the line limit. +//! Launching half of an MTP draft: admits the request against the ring and prior state, stages the first residual, +//! records the round graph once and enqueues it on the draft stream; launch_inner leaves the draft in flight. use super::{ AcceptedWindow, AdmittedRound, Context, DirectVerifierRows, DraftRoundRequest, DraftSampling, DraftTarget, Error, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter/original_mtp_drafter_new_draft.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter/original_mtp_drafter_new_draft.rs index 184dd67c..98d9540f 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter/original_mtp_drafter_new_draft.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter/original_mtp_drafter_new_draft.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpDrafter`: `new`, `unregistered`, `validate_context`, `metadata_bytes` and 3 more. -//! Split out of `original_mtp_drafter` to keep its files under the line limit. +//! Construction and validation of OriginalMtpDrafter from a full forward plus a scalar prefill, and the blocking +//! draft and draft_first entry points that launch and finish a draft in one call. use super::{ AcceptedWindow, CompletedOriginalMtpDraft, Context, DraftRoundRequest, DraftSampling, DraftTarget, Error, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter_from_verifier.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter_from_verifier.rs index 02690c5b..798aa020 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter_from_verifier.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter_from_verifier.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpFullPolicy`: `for_capture`, `capture_key`, `validate_selected`. -//! Methods of `OriginalMtpDrafter`: `draft_inner`, `launch_from_verifier`, `finish_from_verifier`, `draft_in_flight`... +//! The verifier-coupled drafting API: launch, finish and draft_from_verifier over the verifier window, with Drop +//! of the drafter and the capture-key and validation rules of OriginalMtpFullPolicy that key the cached round graphs. use super::{ AcceptedWindow, CompletedOriginalMtpDraft, DraftKvPolicy, DraftRoundRequest, DraftSampling, DraftTarget, Error, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/round_lifecycle/original_mtp_drafter.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/round_lifecycle/original_mtp_drafter.rs index b5e5214d..539e403e 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/round_lifecycle/original_mtp_drafter.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/round_lifecycle/original_mtp_drafter.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpDrafter`: `loaded_max_t`, `loaded_coupled`, `idle_public`, `plan_public_prefill` and 12 more. -//! Functions: `resume_copies`, `fill_public_records`. +//! Public (crate-level) lifecycle of a loaded OriginalMtpDrafter: idle, public prefill planning, KV resume copies +//! from the host pools, and the array-based draft_public / draft_first_public adapters over the graph executor. use super::{ CompletedOriginalMtpDraft, DraftSettings, Error, FM, HOST_OFFSETS, MTP_ORIGINAL_MAX_CELLS, MTP_ORIGINAL_WINDOW, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/round_lifecycle/original_mtp_prefill_plan.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/round_lifecycle/original_mtp_prefill_plan.rs index c80d797b..0896da56 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/round_lifecycle/original_mtp_prefill_plan.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/round_lifecycle/original_mtp_prefill_plan.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpPrefillPlan`: `residual`, `tokens`, `bulk_records`, `metadata_bytes` and 3 more. -//! Methods of `OriginalMtpPrefillActions`: `group_action`, `bulk_action`, `mapped_action`. +//! The public prefill plan of the MTP drafter: read access to its residual, tokens and bulk records, the per-row +//! step words, and OriginalMtpPrefillActions, the iterator that yields the device actions in order. use super::{ Error, MTP_ORIGINAL_MAX_CELLS, MtpOriginalInt8, OriginalDeviceResidual, OriginalMtpPrefillAction, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/round_lifecycle/public_draft_output_copy.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/round_lifecycle/public_draft_output_copy.rs index b610acc8..0d9f0ccc 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/round_lifecycle/public_draft_output_copy.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/round_lifecycle/public_draft_output_copy.rs @@ -1,5 +1,4 @@ -//! Methods of `OriginalMtpDrafter`: `copy_public_draft_output`. -//! Split out of `round_lifecycle` to keep its files under the line limit. +//! Copies a completed draft into the caller public arrays (ids and optional probabilities), zeroing the unused tail. use super::{CompletedOriginalMtpDraft, Error, OriginalMtpDrafter, Result}; diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_forward_prefix_program.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_forward_prefix_program.rs index 77e310db..564de4d5 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_forward_prefix_program.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_forward_prefix_program.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `full_forward_program_alias_checks`, `original_mtp_full_forward`. -//! Split out of `full_forward` to keep its files under the line limit. +//! Root of the full-forward program builder: separates the alias-checking program assembly from the prefix command +//! recording, and holds their shared imports. use super::{ Arg, Arguments, BufferHandle, Context, DeviceBuffer, DraftKvPolicy, EmbeddingKind, Error, F, FA, ForwardPrefix, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_forward_prefix_program/full_forward_program_alias_checks.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_forward_prefix_program/full_forward_program_alias_checks.rs index 5c7f5e27..b5fc131b 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_forward_prefix_program/full_forward_program_alias_checks.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_forward_prefix_program/full_forward_program_alias_checks.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpFullForward`: `program`, `program_commands`, `program_addrs`, `program_prefix` and 10 more. -//! Split out of `full_forward_prefix_program` to keep its files under the line limit. +//! Builds the OriginalMtpForwardProgram of one draft step (prefix, tail commands, addresses, owners) and refuses any +//! device buffer of the full-forward scratch that aliases a weight, scalar or ring buffer it must not overlap. use super::super::mtp_original_check_batch_program::{CheckBatchModules, merge_prefix, merge_tail}; use super::{ diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_forward_prefix_program/original_mtp_full_forward.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_forward_prefix_program/original_mtp_full_forward.rs index 97e12e07..5cfc4199 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_forward_prefix_program/original_mtp_full_forward.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_forward_prefix_program/original_mtp_full_forward.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpFullForward`: `prefix_commands`. -//! Split out of `full_forward_prefix_program` to keep its files under the line limit. +//! Builds the full=true T1 prefix command list of the draft step from the retained model roles; it only records +//! commands and launches nothing. Its row, part and embedding helpers are the prefix_parts and prefix_rows submodules. use super::{ Arg, BufferHandle, DeviceBuffer, DraftKvPolicy, EmbeddingKind, Error, LaunchShape, MTP_ORIGINAL_MAX_CELLS, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_owned.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_owned.rs index 7ab839ac..f4594285 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_owned.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_owned.rs @@ -1,5 +1,5 @@ -//! Methods of `FullOwned`: `validate`, `validate_original`, `handle`, `original_handle` and 12 more. -//! Implements `Drop for FullOwned`. Functions: `extra_slot`. +//! Resource ownership of FullOwned, the scratch bank of the full forward: validation, role handles and addresses +//! inside the shared or private arena, ordered close of modules, mapped memory, scratch and extra banks, and Drop. use super::{ BufferHandle, CHUNKS, Context, DeviceBuffer, Error, FM, FullOwned, MtpOriginalInt8, OriginalMtpScalarPrefill, Rc, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_round/original_mtp_draft_program.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_round/original_mtp_draft_program.rs index de25e0c4..d52a37e3 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_round/original_mtp_draft_program.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_round/original_mtp_draft_program.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpDraftProgram`: `enqueue_commands`, `capture`, `capture_all`, `capture_catchup` and 17 more. -//! Split out of `full_round` to keep its files under the line limit. +//! Capture and per-round staging of OriginalMtpDraftProgram: replays the coupled stage, catch-up, forward program and +//! post commands into a graph, stages each round or chain step into the mapped records, and reads the step output back. use super::super::mtp_original_check_batch_program::launch_prefix_command; use super::{ diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_round/post_select.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_round/post_select.rs index aadb7817..7b449ad6 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_round/post_select.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_round/post_select.rs @@ -1,5 +1,5 @@ -//! Functions: `post_select`. -//! Split out of `full_round` to keep its files under the line limit. +//! Builds the post-step selection command: wires the residual rows, token ids, row index and mapped readback +//! addresses of a draft step into the selection kernel launch that records the draft token and probability. use super::{ Error, FullCommand, OriginalMtpForwardProgram, Result, SelectionReadback, SelectionSource, SelectionTarget, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_round/put.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_round/put.rs index 293ca488..fc568fb8 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_round/put.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_round/put.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpFullForward`: `stage_first_residual`, `check_staging_window`, `check_first_repeat`, `insta... -//! Methods of `OriginalMtpDraftProgram`: `uses_direct_verifier_window`. +//! Staging of the first-round residual and verifier window for the MTP draft program: writes the mapped cell records, +//! repeats or direct-copies the completed residual rows (cross-stream fence) and rebinds a round to the verifier bank. use super::{ DirectVerifierRows, Error, F, LaunchShape, MTP_ORIGINAL_MAX_CELLS, MtpOriginalInt8, NativeHeadSelection, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_round/staged_source.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_round/staged_source.rs index ad7abda5..e60b6b83 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_round/staged_source.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_round/staged_source.rs @@ -1,5 +1,5 @@ -//! Methods of `StagedSource`: `validate`. -//! Methods of `FullOwned`: `mapped_window_offset`, `validate_staged`, `validate_staged_ahead`. +//! Round and chain-step preparation of the MTP draft program (prepare_round, prepare_step, prepare_chain_step): the +//! before/after command lists, the selection kernel launch, staged-source validation and the graph-resource impl. use super::super::mtp_original_check_batch_program::merge_prefix; use super::{ diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape.rs index 4cce1d9e..dbe51f17 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape.rs @@ -1,5 +1,5 @@ -//! Defines `MatVecBuffers`, `MatVecShape`. -//! Split out of `full_forward` to keep its files under the line limit. +//! Root of the matrix-vector planning helpers of the full forward: the MatVecBuffers and MatVecShape descriptors +//! shared by the final-GR, finite-tail and MoE block planners in its submodules. use super::{ CHUNKS, DeviceBuffer, DraftKvPolicy, Error, F, ForwardPrefix, FullCommand, LaunchShape, NativeHeadDispatch, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape/full_forward_final_gr_stages.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape/full_forward_final_gr_stages.rs index bdd5e3b7..2f7d2168 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape/full_forward_final_gr_stages.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape/full_forward_final_gr_stages.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpFullForward`: `gr_weight`, `final_gr`, `final_gr_native`, `final_gr_native_tail` and 4 more. -//! Split out of `matrix_vector_buffers_and_shape` to keep its files under the line limit. +//! Command recording for the final GR block of the MTP draft step: the native fused path, or the staged path of +//! norm, 320-column projection, 1280-column projection and 4-way reduction kernels. use super::{ Error, F, ForwardPrefix, FullCommand, LaunchShape, MatVecBuffers, MatVecShape, OriginalMtpFullForward, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape/full_forward_finite_tail_mlp_gr.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape/full_forward_finite_tail_mlp_gr.rs index e63ab63a..8b90b795 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape/full_forward_finite_tail_mlp_gr.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape/full_forward_finite_tail_mlp_gr.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpFullForward`: `finite_tail`, `q8_tail`, `quant`, `mmvq` and 3 more. -//! Functions: `second_mlp_entry`. +//! Small command builders of the draft step tail: finiteness and Q8 flag checks, input quantization, the +//! quantized and float matrix-vector launches, and the fused MLP GR kernel launch with its 114 by-value words. use super::{ Error, F, ForwardPrefix, FullCommand, LaunchShape, MatVecBuffers, MatVecShape, NativeHeadDispatch, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape/original_mtp_full_forward.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape/original_mtp_full_forward.rs index 76af732b..45596309 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape/original_mtp_full_forward.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape/original_mtp_full_forward.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpFullForward`: `plan`, `validate_plan`, `slot`, `slots` and 11 more. Defines `PlanBufs`. -//! `plan` records the commands of one draft step in the order of the former single function; the attention block is ... +//! Plans the commands of one draft step of OriginalMtpFullForward in the order of the former single function: +//! validation, then the attention block (Q, RoPE, windowed attention, gate, residual); MoE and tail are a sibling. use super::{ CHUNKS, DraftKvPolicy, Error, F, ForwardPrefix, FullCommand, LaunchShape, MatVecBuffers, MatVecShape, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/original_mtp_forward_program.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/original_mtp_forward_program.rs index fee41622..87186b95 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/original_mtp_forward_program.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/original_mtp_forward_program.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpForwardProgram`: `capture`, `capture_prefix`, `capture_coupled_stage`, `capture_flag_reset... -//! Functions: `history_bytes`. +//! Capture and post-drain checks of OriginalMtpForwardProgram: replays the prefix, coupled stage, flag reset and tail +//! commands into a graph, then validates the status flags, reads the step output and stages coupled sampler state. use super::mtp_original_check_batch_program::{ CheckBatchModules, is_tail_batch, launch_prefix_command, launch_tail_batch, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/original_mtp_forward_program_original_graph.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/original_mtp_forward_program_original_graph.rs index 810646c2..92c2f637 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/original_mtp_forward_program_original_graph.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/original_mtp_forward_program_original_graph.rs @@ -1,5 +1,4 @@ -//! Implements `Sealed for OriginalMtpForwardProgram`, `OriginalGraphResources for OriginalMtpForwardProgram`. -//! Split out of `full_forward` to keep its files under the line limit. +//! Marks OriginalMtpForwardProgram as a graph resource: validates its context, tail, ring, buffers and mapped owner. use super::{Context, Error, OriginalGraphResources, OriginalMtpForwardProgram, Result, checked}; diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/original_mtp_full_forward.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/original_mtp_full_forward.rs index bfa3cf2c..a41a8a78 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/original_mtp_full_forward.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/original_mtp_full_forward.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpFullForward`: `planned_device_bytes`, `new`, `new_internal`, `allocated_bytes` and 4 more. -//! Split out of `full_forward` to keep its files under the line limit. +//! Construction and lifecycle of OriginalMtpFullForward, the tail (head, sampler) half of the MTP draft: device-byte +//! planning, new (private or shared Original layout), size accounting, context validation and close. use super::mtp_original_full_init::FullGeometry; use super::{ diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/original_mtp_retained_prefix.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/original_mtp_retained_prefix.rs index 31f2dc11..fd6ce05f 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/original_mtp_retained_prefix.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/original_mtp_retained_prefix.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpRetainedPrefix`: `from_scalar`, `native`, `validate_context`, `check_roles` and 1 more. -//! Methods of `OriginalMtpRetainedFullWeights`: `retain`, `validate_context`, `metadata_bytes`, `head_rows` and 2 more. +//! Retained model weights of the MTP draft: the prefix roles and embedding (OriginalMtpRetainedPrefix) and the full +//! set with draft head and optional vocab subset (OriginalMtpRetainedFullWeights), with extent and disjointness checks. use super::{ BufferHandle, Context, DeviceBuffer, Error, FULL_EXTENTS, FullForwardHead, OriginalMtpNativeEmbedding, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/session_coupling/original_mtp_session_plan.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/session_coupling/original_mtp_session_plan.rs index c9451841..4197eb45 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/session_coupling/original_mtp_session_plan.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/session_coupling/original_mtp_session_plan.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpSessionPlan`: `from_primary`, `sized`, `max_cells`, `experts_per_token` and 11 more. -//! Split out of `session_coupling` to keep its files under the line limit. +//! OriginalMtpSessionPlan: the pure geometry of the MTP session (ring cells, attention capacity, page counts, rope and +//! canonical host bytes) computed from the primary shape, plus its read accessors; allocates nothing. use super::{Error, MTP_ORIGINAL_MAX_CELLS, MTP_ORIGINAL_WINDOW, OriginalMtpSessionPlan, Result}; diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/session_coupling/original_mtp_session_resources.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/session_coupling/original_mtp_session_resources.rs index 99f994c9..87a8acb5 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/session_coupling/original_mtp_session_resources.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/session_coupling/original_mtp_session_resources.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpSessionResources`: `retain_primary`, `check_primary`, `check_plan`, `check_tables` and 14 ... -//! Methods of `SessionOwned`: `check_live`, `validate`. Functions: `session_native_asset`, `session_legacy_asset`. +//! Session resources of the MTP drafter shared with SessionState: retains and validates the rope tables and module, +//! builds the rope plan (addresses, aliasing checks, kernel arguments), and loads the sealed session assets. use super::{ BufferHandle, Cell, Context, DeviceBuffer, Error, F, FA, FM, OriginalMtpRopeForm, OriginalMtpSessionPlan, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/session_coupling/session_owned_drop.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/session_coupling/session_owned_drop.rs index 298fc04f..bd93496b 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/session_coupling/session_owned_drop.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/session_coupling/session_owned_drop.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpSessionRopePlan`: `capture`. -//! Implements `Drop for SessionOwned`, `Sealed for OriginalMtpSessionRopePlan` and 1 more. +//! Teardown and graph capture of the session rope: Drop of SessionOwned (module close, leak on poison), and the capture +//! of OriginalMtpSessionRopePlan into a graph, with the sealed-asset probe. use super::{ Context, Error, LaunchShape, OriginalCapture, OriginalGraphResources, OriginalMtpRopeForm, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/symbols/assets_types.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/symbols/assets_types.rs index cab1ee37..affd9eb9 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/symbols/assets_types.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/symbols/assets_types.rs @@ -1,5 +1,5 @@ -//! Items of the parent module. -//! Split out of `symbols` to keep its files under the line limit. +//! The ASSETS table of the MTP full forward: each sealed PTX image of the crate with the kernel entry names it exports, +//! indexed by the asset constants (the chain and sm120 daily modules sit last, loaded only when selected). use super::CStr; diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/symbols/chain_asset_types.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/symbols/chain_asset_types.rs index 9c9d9896..42a5c788 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/symbols/chain_asset_types.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/symbols/chain_asset_types.rs @@ -1,5 +1,4 @@ -//! Items of the parent module. -//! CHAIN_ASSET, DAILY_ASSET, DAILY_CHUNK, DAILY_MERGE_V2, CHAIN_QSA_CHUNK, CHAIN_QSA_MERGE_N .... +//! Indices of the chain and sm120 daily modules in ASSETS and of their kernel entries (chunk, merge, sampler). /// Index of the chain module in `ASSETS` (absent from the loaded modules unless `LELEKA_CHAIN` selects `mtp` or /// `head`). diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/validate_scalar_prefix.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/validate_scalar_prefix.rs index 523ca586..f7ef4a66 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/validate_scalar_prefix.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/validate_scalar_prefix.rs @@ -1,5 +1,5 @@ -//! Functions: `validate_scalar_prefix`, `push`, `daily_mtp`, `chain_mtp_assets` and 2 more. -//! Split out of `full_forward` to keep its files under the line limit. +//! Shared helpers of the draft step builders: validation of the scalar prefix owner, the command-push helper, and the +//! switches that select the sm120 daily or chain attention assets and the fixed kernel entries. use super::{ Error, F, FA, FullCommand, LaunchShape, OriginalGpuStream, OriginalMtpScalarPrefill, Result, SCALAR_FLAGS, checked, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/graph_resources_original_graph_resources.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/graph_resources_original_graph_resources.rs index 69b48cb1..37e3db2b 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/graph_resources_original_graph_resources.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/graph_resources_original_graph_resources.rs @@ -1,5 +1,5 @@ -//! Methods of `Scratch`: `new`. Methods of `Context`: `original_mtp_scalar_prefill`. -//! Implements `Sealed for GraphResources`, `OriginalGraphResources for GraphResources`. +//! GraphResources of the scalar prefill as a graph resource (context, ring, weights, buffer and mapped checks), plus +//! the Scratch layout of per-token buffer sizes and offsets, and the Context entry point original_mtp_scalar_prefill. use super::{ Context, Error, GraphResources, OriginalGraphResources, OriginalMtpScalarPrefill, Result, Scratch, aligned, checked, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill.rs index 637539f6..9eb3106c 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `call_admission`, `group_capture`, `group_loop` and 5 more. -//! Split out of `scalar` to keep its files under the line limit. +//! Root of the scalar MTP prefill: declares the submodules for call admission, group capture and loop, kernel commands, +//! operands, GR recording, construction and close, and holds their shared imports. use super::{ Arg, Arguments, BufferHandle, Context, DeviceBuffer, DraftKvOutcome, ENTRIES, EmbeddingKind, Error, GR_ENTRIES, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill/original_mtp_scalar_prefill_admit_new.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill/original_mtp_scalar_prefill_admit_new.rs index ff8dede1..6c75e862 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill/original_mtp_scalar_prefill_admit_new.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill/original_mtp_scalar_prefill_admit_new.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpScalarPrefill`: `assets_ready`, `planned_device_bytes`, `planned_host_bytes`, `host_metada... -//! Split out of `original_mtp_scalar_prefill` to keep its files under the line limit. +//! Construction of OriginalMtpScalarPrefill: byte planning, shape and sealed-asset admission against the budget, then +//! allocation of scratch, records, status, stream, modules and mapped memory (private or shared layout). use super::{ Context, ENTRIES, Error, GR_ENTRIES, KV_ENTRIES, MAX_PROMPT, MTP_ORIGINAL_MAX_CELLS, Module, OriginalGraphRegistry, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill/original_mtp_scalar_prefill_close.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill/original_mtp_scalar_prefill_close.rs index 3216a2e3..54bf87ce 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill/original_mtp_scalar_prefill_close.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill/original_mtp_scalar_prefill_close.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpScalarPrefill`: `close`, `close_inner`, `finish_host`, `close_stream` and 3 more. -//! Split out of `original_mtp_scalar_prefill` to keep its files under the line limit. +//! Ordered teardown of OriginalMtpScalarPrefill: closes graphs, stream, modules, device buffers and mapped memory, +//! poisoning the context and leaking resources the device may still touch when a step fails. use super::{Context, DeviceBuffer, Error, Module, OriginalGpuStream, OriginalMtpScalarPrefill, Rc, Result, combine}; diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill/original_mtp_scalar_prefill_record_gr.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill/original_mtp_scalar_prefill_record_gr.rs index 912b0361..cf20cab6 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill/original_mtp_scalar_prefill_record_gr.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill/original_mtp_scalar_prefill_record_gr.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpScalarPrefill`: `gr`, `gr_chunks`, `gr_chunk_kernel`, `record` and 1 more. -//! Split out of `original_mtp_scalar_prefill` to keep its files under the line limit. +//! Records the GR kernels of the scalar prefill (norm, chunked projection, reduction) per prompt rows, and the public +//! record entry that adds the draft K/V of the rows and drains any pending graphs. use super::{ BufferHandle, DraftKvOutcome, GrRows, LaunchShape, NativeBatchWorkspace, OriginalDeviceResidual, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill_drop.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill_drop.rs index 4559d79b..96f79a41 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill_drop.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill_drop.rs @@ -1,5 +1,4 @@ -//! Implements `Drop for OriginalMtpScalarPrefill`. -//! Split out of `scalar` to keep its files under the line limit. +//! Drop of OriginalMtpScalarPrefill: closes the prefill (releasing device buffers, modules and stream) best-effort. use super::OriginalMtpScalarPrefill; diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/ring_state/a16.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/ring_state/a16.rs index 59395bad..9e03ea5f 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/ring_state/a16.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/ring_state/a16.rs @@ -1,5 +1,5 @@ -//! Methods of `StateLayout`: `new`, `region_sizes`. Functions: `a16`. -//! Split out of `ring_state` to keep its files under the line limit. +//! Layout of the Original ring state buffer: StateLayout sizes and offsets the 12 regions (resident or windowed) +//! for a draft width, with the 16-byte alignment helper a16 and the total byte size. use super::{Error, MTP_ORIGINAL_MAX_CELLS, MTP_ORIGINAL_WINDOW, Result, StateLayout}; diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/ring_state/pin_failure.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/ring_state/pin_failure.rs index 1e2580f7..b2cb78ce 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/ring_state/pin_failure.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/ring_state/pin_failure.rs @@ -1,5 +1,5 @@ -//! Methods of `PreparedState`: `attempt`, `budgeted_layout`, `build`, `pin_hosts` and 6 more. -//! Implements `Drop for PreparedState`. Functions: `pin_failure`, `enter_poisoning`. +//! Preparation of the ring state (PreparedState): budgeted layout, device and pinned host allocation, identity table, +//! zeroing and rollback on failure; pin_failure tells pinned-allocation failures (which allow fallback) from others. use super::cleanup_fns::{close_mapped, release_state}; use super::{ diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/ring_state/selected.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/ring_state/selected.rs index 0b9ab227..cdceb6a3 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/ring_state/selected.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/ring_state/selected.rs @@ -1,5 +1,5 @@ -//! Methods of `Selected`: `from_prepared`, `provides`, `span`, `locate` and 10 more. Implements `Drop for Selected`. -//! Functions: `main_span_index`. +//! Selected, the chosen state of the ring: the prepared state paired with the shared main-bank spans, with span lookup, +//! alias and overlap checks, page reads, transfer and close. use super::cleanup_fns::{close_mapped, release_state}; use super::{ diff --git a/crates/cuda-driver/src/mtp_original_full_ffi/tests.rs b/crates/cuda-driver/src/mtp_original_full_ffi/tests.rs index 7df6ca7a..1d0847b7 100644 --- a/crates/cuda-driver/src/mtp_original_full_ffi/tests.rs +++ b/crates/cuda-driver/src/mtp_original_full_ffi/tests.rs @@ -1,4 +1,4 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests that pin the q-split copy2d descriptor: it stays inside both tail owners for every T, device-to-device only. use super::*; /// `copy2d` hands the driver a raw descriptor of fixed extents; the two owners it names (`TailLayout` roles diff --git a/crates/cuda-driver/src/native_head/alias_tests.rs b/crates/cuda-driver/src/native_head/alias_tests.rs index 8e543328..98f9e10e 100644 --- a/crates/cuda-driver/src/native_head/alias_tests.rs +++ b/crates/cuda-driver/src/native_head/alias_tests.rs @@ -1,5 +1,5 @@ -//! Functions: `payload`, `map_payload`, `alias_over`, `read_through_the_first_alias` and 3 more. -//! Split out of `native_head` to keep its files under the line limit. +//! Tests that a device alias of a mapped host table reads the host bytes, costs no device memory, is not freed when +//! dropped, and works for both the mapped table and the native embed table. use super::*; diff --git a/crates/cuda-driver/src/native_head/dispatch.rs b/crates/cuda-driver/src/native_head/dispatch.rs index 54f498dd..16ef3a87 100644 --- a/crates/cuda-driver/src/native_head/dispatch.rs +++ b/crates/cuda-driver/src/native_head/dispatch.rs @@ -1,5 +1,5 @@ -//! Functions: `dispatch`, `head_launch_shape`, `iq_columns`, `kind_geometry` and 3 more. -//! Split out of `native_head` to keep its files under the line limit. +//! Kernel dispatch of the native head projection: from the weight kind, token count and dispatch options picks the +//! kernel name, grid and block shape of the plain or IQ head kernels (column counts, rows divisor, mode). use super::{Error, NativeHeadDispatch, Result}; pub(super) fn dispatch( diff --git a/crates/cuda-driver/src/native_head/head_owned.rs b/crates/cuda-driver/src/native_head/head_owned.rs index f141902c..f466fc6d 100644 --- a/crates/cuda-driver/src/native_head/head_owned.rs +++ b/crates/cuda-driver/src/native_head/head_owned.rs @@ -1,5 +1,5 @@ -//! Methods of `HeadOwned`: `validate`, `close`, `is_released`, `leak_all` and 4 more. -//! Methods of `Context`: `original_native_head`. Implements `Drop for HeadOwned`. +//! HeadOwned, the owner of the native head weights, scalar Q8 scratch and kernels: validation, upload, ordered release +//! or leak on an uncertain context, plus the Context entry point original_native_head and the OriginalNativeHead API. use super::{ Cell, Command, Context, DeviceBuffer, Error, HeadOwned, Kernels, NativeHeadDispatch, NativeHeadPayload, diff --git a/crates/cuda-driver/src/native_head/iq_entries_types.rs b/crates/cuda-driver/src/native_head/iq_entries_types.rs index 82758dcb..96bb69e5 100644 --- a/crates/cuda-driver/src/native_head/iq_entries_types.rs +++ b/crates/cuda-driver/src/native_head/iq_entries_types.rs @@ -1,5 +1,5 @@ -//! Defines `OriginalNativeHeadGraphResources`, `NativeHeadProjectionFlight`. -//! IQ_ENTRIES, SAMPLER_ENTRIES, OriginalNativeHeadGraphResources, NativeHeadProjectionFlight. +//! Kernel entry-name tables of the IQ head kernels and the samplers, the OriginalNativeHeadGraphResources trait that +//! exposes a verifier resource head bank, and the NativeHeadProjectionFlight state of an in-flight projection. use super::{ Command, DeviceBuffer, OriginalGpuStream, OriginalGraphResources, OriginalNativeHead, OriginalNativeHeadRows, diff --git a/crates/cuda-driver/src/native_head/native_asset.rs b/crates/cuda-driver/src/native_head/native_asset.rs index 5b99f1e2..890d0656 100644 --- a/crates/cuda-driver/src/native_head/native_asset.rs +++ b/crates/cuda-driver/src/native_head/native_asset.rs @@ -1,5 +1,5 @@ -//! Methods of `NativeHeadDispatch`: `from_original_environment`. -//! Methods of `Kernels`: `load`, `load_modules`, `module`, `close`. Implements `Default for NativeHeadDispatch`. +//! Sealed PTX loading of the native head (pinned native, IQ and sampler images), the Kernels loader, supported kinds, +//! row sizes, geometry and admission checks, and the NativeHeadDispatch defaults with its environment switch. use super::{ Arg, Command, Context, DeviceBuffer, Error, IQ_ASSET_PIN, IQ_ENTRIES, Kernels, Module, NATIVE_ASSET_PIN, diff --git a/crates/cuda-driver/src/native_head/native_asset_pin_types.rs b/crates/cuda-driver/src/native_head/native_asset_pin_types.rs index fc73d156..0786a36e 100644 --- a/crates/cuda-driver/src/native_head/native_asset_pin_types.rs +++ b/crates/cuda-driver/src/native_head/native_asset_pin_types.rs @@ -1,5 +1,5 @@ -//! Defines `NativeHeadSampling`, `NativeHeadPayload`, `NativeHeadDispatch` and 11 more. -//! NATIVE_ASSET_PIN, IQ_ASSET_PIN, SAMPLER_ASSET_PIN, RESERVE, NativeHeadSampling, NativeHeadDispatch .... +//! Data types of the native head (sampling inputs, payload, dispatch options, kernels, owners, rows, flights, +//! selection) with the size and digest pins of the three sealed PTX assets and the device reserve. use super::{ Cell, Command, Context, DeviceBuffer, MappedAllocation, Module, OriginalGpuStream, Rc, RefCell, SamplerParams, diff --git a/crates/cuda-driver/src/native_head/native_entries_types.rs b/crates/cuda-driver/src/native_head/native_entries_types.rs index ecc08cbe..d8a4e4df 100644 --- a/crates/cuda-driver/src/native_head/native_entries_types.rs +++ b/crates/cuda-driver/src/native_head/native_entries_types.rs @@ -1,5 +1,4 @@ -//! Items of the parent module. -//! NATIVE_ENTRIES. +//! NATIVE_ENTRIES: kernel entry names of the native head PTX module, in module index order. pub(super) const NATIVE_ENTRIES: &[&str] = &[ "head_quant", diff --git a/crates/cuda-driver/src/native_head/original_native_embed.rs b/crates/cuda-driver/src/native_head/original_native_embed.rs index 2a3cce94..a4c59676 100644 --- a/crates/cuda-driver/src/native_head/original_native_embed.rs +++ b/crates/cuda-driver/src/native_head/original_native_embed.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalNativeEmbed`: `validate_context`, `kind`, `bytes`, `is_mapped` and 6 more. -//! Methods of `NativeEmbedFlight`: `wait`. +//! OriginalNativeEmbed, the native token embedding table: single-token gather, per-T row gathers for graphs +//! (OriginalNativeEmbedRows), a non-owning table alias, and the in-flight NativeEmbedFlight with close and drop. use super::{ Arg, Command, Context, DeviceBuffer, Error, NativeEmbedFlight, OriginalCapture, OriginalGpuStream, diff --git a/crates/cuda-driver/src/native_head/original_native_embed_rows_original_graph.rs b/crates/cuda-driver/src/native_head/original_native_embed_rows_original_graph.rs index ad400d94..e3eb5f0d 100644 --- a/crates/cuda-driver/src/native_head/original_native_embed_rows_original_graph.rs +++ b/crates/cuda-driver/src/native_head/original_native_embed_rows_original_graph.rs @@ -1,5 +1,4 @@ -//! Implements `OriginalGraphResources for OriginalNativeEmbedRows`. -//! Split out of `native_head` to keep its files under the line limit. +//! Marks OriginalNativeEmbedRows as a graph resource by delegating context validation to it. use super::{Context, OriginalGraphResources, OriginalNativeEmbedRows, Result}; diff --git a/crates/cuda-driver/src/native_head/original_native_head_rows.rs b/crates/cuda-driver/src/native_head/original_native_head_rows.rs index 3fd3d754..72b6e5cb 100644 --- a/crates/cuda-driver/src/native_head/original_native_head_rows.rs +++ b/crates/cuda-driver/src/native_head/original_native_head_rows.rs @@ -1,5 +1,4 @@ -//! Groups the submodules `original_native_head_rows_greedy_submit`, `original_native_head_rows_sampling`. -//! Split out of `native_head` to keep its files under the line limit. +//! Root of OriginalNativeHeadRows: declares the greedy/submit and sampling submodules and holds their shared imports. use super::{ Arg, Cell, Command, Context, DeviceBuffer, Error, HeadOwned, MappedAllocation, NativeHeadFlight, diff --git a/crates/cuda-driver/src/native_head/original_native_head_rows/original_native_head_rows_greedy_submit.rs b/crates/cuda-driver/src/native_head/original_native_head_rows/original_native_head_rows_greedy_submit.rs index b752b2df..5e8a44b1 100644 --- a/crates/cuda-driver/src/native_head/original_native_head_rows/original_native_head_rows_greedy_submit.rs +++ b/crates/cuda-driver/src/native_head/original_native_head_rows/original_native_head_rows_greedy_submit.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalNativeHeadRows`: `new`, `allocate_buffers`, `set_finite_verdict_in_graph`, `finite_verdict_in... -//! Functions: `sampling_needed`. +//! Construction and execution of OriginalNativeHeadRows (the per-T head of the verifier): buffer allocation, finite- +//! logit verdict word, projection and greedy command build, graph capture, stream submit and selection read-back. use super::{ Arg, Cell, Command, Context, DeviceBuffer, Error, HeadOwned, MappedAllocation, NativeHeadFlight, diff --git a/crates/cuda-driver/src/native_head/original_native_head_rows/original_native_head_rows_sampling.rs b/crates/cuda-driver/src/native_head/original_native_head_rows/original_native_head_rows_sampling.rs index 302ef68b..344fb49e 100644 --- a/crates/cuda-driver/src/native_head/original_native_head_rows/original_native_head_rows_sampling.rs +++ b/crates/cuda-driver/src/native_head/original_native_head_rows/original_native_head_rows_sampling.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalNativeHeadRows`: `sample_commands`, `sample_args`, `history_shared_bytes`, `greedy_sample` an... -//! Defines `SampleArgs`. +//! Sampler launches of OriginalNativeHeadRows (greedy, one-block, split and merge kernels) with per-stream scratch +//! and penalty-history shared memory, plus completed-logits access and the ordered close or leak of the rows. use super::{ Arg, Command, DeviceBuffer, Error, NativeHeadSampling, OriginalNativeHeadRows, Result, SamplerParams, SamplerPath, diff --git a/crates/cuda-driver/src/native_head/original_native_head_rows_drop_original_graph.rs b/crates/cuda-driver/src/native_head/original_native_head_rows_drop_original_graph.rs index 05449365..bd17b488 100644 --- a/crates/cuda-driver/src/native_head/original_native_head_rows_drop_original_graph.rs +++ b/crates/cuda-driver/src/native_head/original_native_head_rows_drop_original_graph.rs @@ -1,5 +1,5 @@ -//! Methods of `NativeHeadFlight`: `finish`. -//! Methods of `NativeHeadSelection`: `ids`, `position`, `vocabulary`, `into_ids`. +//! Lifecycle of the head results: Drop and graph-resource impls of OriginalNativeHeadRows, NativeHeadFlight finish and +//! drop, NativeHeadSelection accessors, and EmbedOwned (the embedding table owner) with original_native_embed. use super::{ Cell, Context, DeviceBuffer, EmbedOwned, Error, IQ_ENTRIES, MappedAllocation, Module, NativeHeadFlight, diff --git a/crates/cuda-driver/src/native_head/original_native_head_rows_original_native.rs b/crates/cuda-driver/src/native_head/original_native_head_rows_original_native.rs index 8647add7..4fb26902 100644 --- a/crates/cuda-driver/src/native_head/original_native_head_rows_original_native.rs +++ b/crates/cuda-driver/src/native_head/original_native_head_rows_original_native.rs @@ -1,5 +1,5 @@ -//! Methods of `NativeHeadProjectionFlight`: `wait`. -//! Implements `OriginalNativeHeadGraphResources for OriginalNativeHeadRows`, `Drop for NativeHeadProjectionFlight`. +//! Graph-resource access to the head rows (OriginalNativeHeadGraphResources), NativeHeadProjectionFlight wait/drop +//! that poison the head on a failed drain, and a probe of whether the three native head PTX assets are sealed. use super::{ NativeHeadProjectionFlight, OriginalNativeHeadGraphResources, OriginalNativeHeadRows, Result, iq_asset, diff --git a/crates/cuda-driver/src/native_head/projection_commands.rs b/crates/cuda-driver/src/native_head/projection_commands.rs index 5254da6d..af1a7f25 100644 --- a/crates/cuda-driver/src/native_head/projection_commands.rs +++ b/crates/cuda-driver/src/native_head/projection_commands.rs @@ -1,5 +1,5 @@ -//! Functions: `projection_commands`, `admit_projection`, `quant_command`, `head_command`. Defines `ProjectionBuffers`. -//! Split out of `native_head` to keep its files under the line limit. +//! Command list of one output-head projection: Q8 quantisation of the mixed hidden state, then the head matmul +//! to logits. Checks buffer sizes and pairwise disjointness first, so the dispatcher only sees admitted launches. use super::{ Arg, Command, DeviceBuffer, Error, HeadOwned, Result, address, admit, cmd, disjoint, dispatch, diff --git a/crates/cuda-driver/src/native_parity/native_parity_expert.rs b/crates/cuda-driver/src/native_parity/native_parity_expert.rs index 979cd24a..f674b0f0 100644 --- a/crates/cuda-driver/src/native_parity/native_parity_expert.rs +++ b/crates/cuda-driver/src/native_parity/native_parity_expert.rs @@ -1,5 +1,5 @@ -//! Methods of `NativeParityExpert`: `diagnostics`, `release`, `release_inner`. -//! Methods of `Temporary`: `new`, `release`, `release_inner`. +//! Lifetime of one parity-harness expert: lazily allocated diagnostic buffers (dequant targets, reversed rows), +//! release/Drop that drain the stream and free every buffer, the blocking readback, and the gate/up/down kernel tables. use super::{ BenchResult, DeviceBuffer, Error, FF, H, NativeParityExpert, Rc, State, Temporary, bytes_i32, first, message, diff --git a/crates/cuda-driver/src/native_parity/native_parity_operations/native_parity_dequantize_diagnostics.rs b/crates/cuda-driver/src/native_parity/native_parity_operations/native_parity_dequantize_diagnostics.rs index 4ee5c541..88392b44 100644 --- a/crates/cuda-driver/src/native_parity/native_parity_operations/native_parity_dequantize_diagnostics.rs +++ b/crates/cuda-driver/src/native_parity/native_parity_operations/native_parity_dequantize_diagnostics.rs @@ -1,5 +1,5 @@ -//! Methods of `NativeParity`: `dequantize_expert_role`, `read_dequantized`, `embed_expert_gate`, `release_expert` an... -//! Functions: `check_gate_rows`, `gate_embed_command`, `dequant_commands`, `q5_commands` and 1 more. +//! Diagnostic operations of the native parity harness: per-role expert dequantisation, gate embedding, the Q5_1 and +//! BF16 embedding checks, and expert release. They exist to compare device output with the Original, not to serve. use super::{ Arg, BenchResult, Command, DeviceBuffer, FF, H, NativeParity, NativeParityExpert, Rc, Temporary, address, diff --git a/crates/cuda-driver/src/native_parity/native_parity_operations/native_parity_expert_enqueue.rs b/crates/cuda-driver/src/native_parity/native_parity_operations/native_parity_expert_enqueue.rs index e8105ad5..b7ba0220 100644 --- a/crates/cuda-driver/src/native_parity/native_parity_operations/native_parity_expert_enqueue.rs +++ b/crates/cuda-driver/src/native_parity/native_parity_operations/native_parity_expert_enqueue.rs @@ -1,5 +1,5 @@ -//! Methods of `NativeParity`: `new`, `idle`, `expert`, `old_kernels` and 9 more. -//! Functions: `expert_head_args`, `old_iq_mmvq`, `scratch_slots`, `gate_up_args` and 1 more. +//! Setup and run of one parity expert: harness construction (sealed PTX, stream, module), staging weights and routing, +//! launching the gate/up and down kernels (old or split IQ MMVQ variant) and reading the f32 result back. use super::{ Api, Arg, BenchResult, Cell, Command, Context, DeviceBuffer, H, Layout, NT, NativeParity, NativeParityExpert, Rc, diff --git a/crates/cuda-driver/src/native_parity/sealed_ptx.rs b/crates/cuda-driver/src/native_parity/sealed_ptx.rs index aece3cb8..3fe371b3 100644 --- a/crates/cuda-driver/src/native_parity/sealed_ptx.rs +++ b/crates/cuda-driver/src/native_parity/sealed_ptx.rs @@ -1,5 +1,5 @@ -//! Functions: `sealed_ptx`, `message`, `first`, `native_parity_iq_supported` and 9 more. -//! Split out of `native_parity` to keep its files under the line limit. +//! Shared plumbing of the native parity harness: the pinned sealed PTX, error-to-message adapters, and the tables of +//! block-quantised formats the harness supports with their elements and bytes per block (row byte sizes). use super::{Arg, BenchResult, Command, DeviceBuffer, FF, H, Layout, Result, SEALED_PTX_PIN}; diff --git a/crates/cuda-driver/src/native_prompt_device/original_device_block.rs b/crates/cuda-driver/src/native_prompt_device/original_device_block.rs index dbeb7f9d..7e1bcbcd 100644 --- a/crates/cuda-driver/src/native_prompt_device/original_device_block.rs +++ b/crates/cuda-driver/src/native_prompt_device/original_device_block.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalDeviceBlock`: `lease_identity`. -//! Methods of `Context`: `original_prompt_device`, `original_ple_history`, `check_history_budget`. +//! Handles that carry prompt rows on the device between stages: the residual, the GR-read lease and the finished +//! block, with final-row readback and finite checks; plus Context entry points for the prompt device and PLE history. use super::{ Context, Error, GrNativeProfile, OriginalDeviceBlock, OriginalDeviceGrRead, OriginalDeviceResidual, diff --git a/crates/cuda-driver/src/native_prompt_device/original_ple_history.rs b/crates/cuda-driver/src/native_prompt_device/original_ple_history.rs index 39b9d909..1c216eee 100644 --- a/crates/cuda-driver/src/native_prompt_device/original_ple_history.rs +++ b/crates/cuda-driver/src/native_prompt_device/original_ple_history.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalPleHistory`: `device`, `final_values`, `allocated_bytes`, `close` and 1 more. -//! Methods of `LaunchGeometry`: `new`. Implements `Drop for OriginalPleHistory`. +//! Device-resident PLE history buffer (read-back at commit, close/Drop) plus the small launch and guard value types +//! (LaunchGeometry, ScanExtent, PhaseGuards, WeightExtent) and kernel/scan helpers shared by the prompt-device phases. use super::{A, BufferHandle, C, DeviceBuffer, Error, KernelArguments, OriginalPleHistory, Result}; diff --git a/crates/cuda-driver/src/native_prompt_device/original_prompt_device.rs b/crates/cuda-driver/src/native_prompt_device/original_prompt_device.rs index 4241598c..4e47de4b 100644 --- a/crates/cuda-driver/src/native_prompt_device/original_prompt_device.rs +++ b/crates/cuda-driver/src/native_prompt_device/original_prompt_device.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `gr_read_phases`, `inject_phases`, `original_prompt_device_apply_ple` and 8 more. -//! Split out of `native_prompt_device` to keep its files under the line limit. +//! Parent module of the prompt device's phases: one child per phase (bring-up, initialize, GR read, inject, PLE, +//! close), each adding methods to OriginalPromptDevice, plus the phase command builders; shares their imports. use super::{ A, BufferHandle, C, Context, DeviceBuffer, Error, GR_ENTRIES, GR_PTX, GR_SHA, GrNativeProfile, GrNormRequest, diff --git a/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_apply_ple.rs b/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_apply_ple.rs index eb269c85..594bd7a6 100644 --- a/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_apply_ple.rs +++ b/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_apply_ple.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalPromptDevice`: `apply_ple`. -//! Split out of `original_prompt_device` to keep its files under the line limit. +//! Applies PLE (per-layer embedding) to the prompt residual in sub-batches: builds each chunk's commands, runs them, +//! and marks the history failed if a chunk errors. The command lists themselves live in ple_apply_phases. use super::ple_apply_phases::ple_commands; use super::{ diff --git a/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_bring_up.rs b/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_bring_up.rs index 5dd99b92..36c1dd94 100644 --- a/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_bring_up.rs +++ b/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_bring_up.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalPromptDevice`: `device_bytes`, `new`, `blank`, `init_resources` and 12 more. -//! Functions: `check_sealed_assets`. +//! Construction and validation of the prompt device: checks the pinned PLE/GR PTX, allocates status words, loads the +//! four kernel modules, and checks that leases, spans and weights are live, disjoint and sized before any phase runs. use super::{ BufferHandle, Context, DeviceBuffer, Error, GR_ENTRIES, GR_PTX, GR_SHA, GrNativeProfile, KernelModule, diff --git a/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_close_modules.rs b/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_close_modules.rs index 43660c39..9b29339a 100644 --- a/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_close_modules.rs +++ b/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_close_modules.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalPromptDevice`: `close_inner`. Functions: `poison_on_error`, `close_module`, `release_owner`. -//! Split out of `original_prompt_device` to keep its files under the line limit. +//! Teardown of the prompt device: closes kernel modules and releases buffers under the context guard, leaking them +//! (and poisoning the context) when the context is already unusable, so a failed close cannot free live GPU memory. use super::{Context, DeviceBuffer, Error, KernelModule, OriginalPromptDevice, Result, combine}; diff --git a/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_gr_read_plan.rs b/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_gr_read_plan.rs index 7c9c4ccb..07874b52 100644 --- a/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_gr_read_plan.rs +++ b/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_gr_read_plan.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalPromptDevice`: `read_gr_impl`, `gr_read_plan`, `gr_read_spans`. -//! Split out of `original_prompt_device` to keep its files under the line limit. +//! GR read phase of the prompt device: validates the epsilon and weights, builds the plan of spans and weight extents, +//! and runs it under the finite guards, turning a residual into a GR-read lease. use super::gr_read_phases::{GR_READ_NAMES, GR_READ_ORDER, GrReadPlan}; use super::{ diff --git a/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_initialize_rows.rs b/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_initialize_rows.rs index 5e7021da..42d2dd77 100644 --- a/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_initialize_rows.rs +++ b/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_initialize_rows.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalPromptDevice`: `initialize_rows`, `upload_initial`, `settle_upload`, `run`. -//! Functions: `stage_rows`. +//! Uploads the initial prompt rows (residual-stream and PLE embedding values) to the device in one staged pass, +//! and the shared run helper that executes a phase command list under finite guards and settles the result. use super::run_phases::RunBuffers; use super::{ diff --git a/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_inject_gr.rs b/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_inject_gr.rs index 8334c9d3..448e8590 100644 --- a/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_inject_gr.rs +++ b/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_inject_gr.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalPromptDevice`: `inject_gr`, `inject_gr_fused`, `close`. -//! Split out of `original_prompt_device` to keep its files under the line limit. +//! GR injection phase: rechecks the finished block, then writes the GR output back into the residual rows, plain or +//! fused with the following RMS norm (inject_gr_fused), under the finite guards; also the explicit close. use super::inject_phases::{inject_commands, inject_fused_commands}; use super::{ diff --git a/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_read_gr.rs b/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_read_gr.rs index 7fd1d414..6dca67ff 100644 --- a/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_read_gr.rs +++ b/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_read_gr.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalPromptDevice`: `read_gr`, `read_gr_normed`. -//! Split out of `original_prompt_device` to keep its files under the line limit. +//! Public entry points of the GR read phase for a plain residual and for an already normed one; they check the +//! gamma/epsilon pairing and delegate to read_gr_impl, which owns the plan and launch. use super::{ DeviceBuffer, Error, GrNormRequest, NativeBatchWorkspace, OriginalDeviceGrRead, OriginalDeviceNormedResidual, diff --git a/crates/cuda-driver/src/native_prompt_device/original_prompt_device_drop.rs b/crates/cuda-driver/src/native_prompt_device/original_prompt_device_drop.rs index 04a3245c..bb09555f 100644 --- a/crates/cuda-driver/src/native_prompt_device/original_prompt_device_drop.rs +++ b/crates/cuda-driver/src/native_prompt_device/original_prompt_device_drop.rs @@ -1,5 +1,4 @@ -//! Implements `Drop for OriginalPromptDevice`. -//! Split out of `native_prompt_device` to keep its files under the line limit. +//! Drop for OriginalPromptDevice: closes the device's modules and buffers if the owner did not call close. use super::OriginalPromptDevice; diff --git a/crates/cuda-driver/src/native_prompt_device/stage_impl/gr_gpu_tests/enable_types.rs b/crates/cuda-driver/src/native_prompt_device/stage_impl/gr_gpu_tests/enable_types.rs index eb0280d7..fbce4362 100644 --- a/crates/cuda-driver/src/native_prompt_device/stage_impl/gr_gpu_tests/enable_types.rs +++ b/crates/cuda-driver/src/native_prompt_device/stage_impl/gr_gpu_tests/enable_types.rs @@ -1,5 +1,5 @@ -//! Defines `Rng`, `Launch`. -//! ENABLE, Rng, Launch. +//! Shared test types of the GR GPU proofs: the LELEKA_PREFILL_STAGE_GPU switch that enables them, the xorshift +//! random generator (Rng) that makes their inputs reproducible, and the Launch tuple describing one kernel launch. use super::{A, KernelModule}; diff --git a/crates/cuda-driver/src/native_prompt_device/stage_impl/gr_gpu_tests/rng.rs b/crates/cuda-driver/src/native_prompt_device/stage_impl/gr_gpu_tests/rng.rs index 14ee023f..60e95f96 100644 --- a/crates/cuda-driver/src/native_prompt_device/stage_impl/gr_gpu_tests/rng.rs +++ b/crates/cuda-driver/src/native_prompt_device/stage_impl/gr_gpu_tests/rng.rs @@ -1,5 +1,5 @@ -//! Methods of `Rng`: `next`. Functions: `f32_bytes`, `upload`, `h`, `download` and 1 more. -//! Split out of `gr_gpu_tests` to keep its files under the line limit. +//! Test helpers of the GR GPU proofs: the xorshift step of Rng, f32 byte encoding, buffer upload/download wrappers, +//! and run_all, which launches kernels in order on the workspace stream and drains it. use super::{BufferHandle, Context, DeviceBuffer, KernelArguments, Launch, NativeBatchWorkspace, Rng}; use crate::ple_batch_ffi::LinearLaunch; diff --git a/crates/cuda-driver/src/original_conversation_state/tests.rs b/crates/cuda-driver/src/original_conversation_state/tests.rs index 772a91fe..809bd486 100644 --- a/crates/cuda-driver/src/original_conversation_state/tests.rs +++ b/crates/cuda-driver/src/original_conversation_state/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests that pin the conversation-state layout against the Original: running-state region sizes (golden C++ values), +//! the KV pool spans per state format and streaming mode, the draft KV staying outside the arena, and span bounds. use super::super::{OriginalLayerBounds, OriginalSessionGeometry, OriginalSessionKvPolicy, OriginalSessionLayout}; use super::*; diff --git a/crates/cuda-driver/src/original_expert_cache/original_cache_prefix.rs b/crates/cuda-driver/src/original_expert_cache/original_cache_prefix.rs index fb1f213b..96ba205e 100644 --- a/crates/cuda-driver/src/original_expert_cache/original_cache_prefix.rs +++ b/crates/cuda-driver/src/original_expert_cache/original_cache_prefix.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalCachePrefix`: `completed_slot_span`. -//! Methods of `Context`: `original_expert_cache_uniform`, `original_expert_cache_sized`. +//! Cache prefix view: finding the completed (Filled) slot span of one layer/expert, and the Context constructors that +//! open an expert cache with uniform slots or with per-slot sizes. use super::{Context, OriginalCachePrefix, OriginalExpertCache, OriginalExpertSlots, Result, State}; diff --git a/crates/cuda-driver/src/original_expert_cache/original_expert_cache_drop.rs b/crates/cuda-driver/src/original_expert_cache/original_expert_cache_drop.rs index 63f2d2c2..4754d88b 100644 --- a/crates/cuda-driver/src/original_expert_cache/original_expert_cache_drop.rs +++ b/crates/cuda-driver/src/original_expert_cache/original_expert_cache_drop.rs @@ -1,5 +1,4 @@ -//! Implements `Drop for OriginalExpertCache`. -//! Split out of `original_expert_cache` to keep its files under the line limit. +//! Drop for OriginalExpertCache: closes the cache (drains copies, releases the arena) if the owner did not close it. use super::OriginalExpertCache; diff --git a/crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations/original_expert_cache_adaptive_swaps.rs b/crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations/original_expert_cache_adaptive_swaps.rs index 81fe90a8..7864529b 100644 --- a/crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations/original_expert_cache_adaptive_swaps.rs +++ b/crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations/original_expert_cache_adaptive_swaps.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalExpertCache`: `arm_swaps`, `record_swap_event`, `swaps_pending`, `swap_copies_running` and 15... -//! Split out of `original_expert_cache_methods` to keep its files under the line limit. +//! Expert cache: the adaptive swap batch (arm event, poll/wait, publish swapped slots) and the queued fills from a +//! mapped bank or probe bytes, with admission checks, the copy stream choice and the liveness guard. use super::original_expert_cache_open_and_slots::{check_total, span_layer}; use super::{ diff --git a/crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations/original_expert_cache_file_slot_fill.rs b/crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations/original_expert_cache_file_slot_fill.rs index 5e9dc6a8..b34dbf84 100644 --- a/crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations/original_expert_cache_file_slot_fill.rs +++ b/crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations/original_expert_cache_file_slot_fill.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalExpertCache`: `fill_file_slot_queued`, `check_file_queue`, `digest_conflict`, `owner_mismatch... -//! Split out of `original_expert_cache_methods` to keep its files under the line limit. +//! Expert cache: fills of a slot from a file-backed expert blob, queued or blocking, with the source-digest and +//! owner checks, host-byte accounting of pending fills, read-back verification of a slot and the queue sync. use super::{ Error, MappedExpertBank, OriginalExpertCache, Rc, ResidentExpertBankSpan, Result, RetainedFill, State, api, diff --git a/crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations/original_expert_cache_open_and_slots.rs b/crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations/original_expert_cache_open_and_slots.rs index c812c7bb..5167ea63 100644 --- a/crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations/original_expert_cache_open_and_slots.rs +++ b/crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations/original_expert_cache_open_and_slots.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalExpertCache`: `validate_file_source_context`, `completed_file_source_member`, `open`, `unopen... -//! Functions: `span_layer`, `check_total`, `queue_span_copies`. Defines `SwapPlan`, `SlotRegion`. +//! Expert cache opening and slot bookkeeping: the free-VRAM and budget check before the single arena allocation, +//! zeroing, slot/owner/layer-range queries and counters, and the planning and copy of queued slot swaps. use super::{ Context, Error, MappedExpertBank, OriginalExpertCache, OriginalExpertSlots, Rc, ResidentExpertBankSpan, Result, diff --git a/crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations/original_expert_cache_verify_and_lend.rs b/crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations/original_expert_cache_verify_and_lend.rs index b776f767..eb62a26b 100644 --- a/crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations/original_expert_cache_verify_and_lend.rs +++ b/crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations/original_expert_cache_verify_and_lend.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalExpertCache`: `verify_slot`, `check_verify`, `compare_spans`, `completed_slot` and 9 more. -//! Split out of `original_expert_cache_methods` to keep its files under the line limit. +//! Expert cache audits and loans: read-back byte verification of a filled slot against its source, lending the cache +//! tail slots to a prefill (choose_loan, lend_prefill_tail, needs_refill), plus poison, close and leak-all teardown. use super::original_expert_cache_open_and_slots::span_layer; use super::{ diff --git a/crates/cuda-driver/src/original_expert_stager/context.rs b/crates/cuda-driver/src/original_expert_stager/context.rs index abb40859..1c5b431c 100644 --- a/crates/cuda-driver/src/original_expert_stager/context.rs +++ b/crates/cuda-driver/src/original_expert_stager/context.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `original_expert_stager`, `original_file_expert_stager`, `open_original_stager`, `abandon_s... -//! Methods of `OriginalExpertStager`: `spawn_workers`. Functions: `shared_state`. Defines `StagerPlan`, `StagerTables`. +//! Opening of the expert stager: the Context entry points for a bank-backed or file-backed source, the ring and thread +//! plan with its host-byte admission, the pinned slot buffers and events, the shared worker state and the worker spawn. use super::{ Arc, AtomicBool, AtomicU8, AtomicU64, AtomicUsize, Condvar, Context, Error, FileExpertSourceLease, FileSource, diff --git a/crates/cuda-driver/src/original_expert_stager/original_stager_batch.rs b/crates/cuda-driver/src/original_expert_stager/original_stager_batch.rs index 483855f8..27ab6f8c 100644 --- a/crates/cuda-driver/src/original_expert_stager/original_stager_batch.rs +++ b/crates/cuda-driver/src/original_expert_stager/original_stager_batch.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalStagerBatch`: `len`, `is_empty`, `issue`, `issue_target` and 3 more. -//! Methods of `OriginalStagerCompleted`: `into_parts`. Implements `Drop for OriginalStagerBatch`. +//! One in-flight batch of the expert stager: ordered issue of staged jobs to device destinations, finish and Drop of +//! the batch, the assembled file blob accessors, and the stager's file-source blob and job construction. use super::{ Context, DeviceBuffer, Error, FileExpertSourceLease, HEADROOM, LayerRole, Ordering, OriginalExpertStager, diff --git a/crates/cuda-driver/src/original_expert_stager/original_stager_options.rs b/crates/cuda-driver/src/original_expert_stager/original_stager_options.rs index 9c527e8a..fb90629a 100644 --- a/crates/cuda-driver/src/original_expert_stager/original_stager_options.rs +++ b/crates/cuda-driver/src/original_expert_stager/original_stager_options.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalStagerOptions`: `from_environment`, `dimensions`. -//! Methods of `OriginalStagerJob`: `new`, `layer`, `expert`. +//! Stager configuration and its source: ring/thread sizing from STRATA_STAGER_* settings, the job type naming one +//! layer and expert, and how a bank or file source validates itself and turns a job into a raw copy job. use super::{ Error, FileSource, LayerRole, OriginalStagerJob, OriginalStagerOptions, ResidentExpertBankLease, diff --git a/crates/cuda-driver/src/original_expert_stager/stream_all/original_expert_stager.rs b/crates/cuda-driver/src/original_expert_stager/stream_all/original_expert_stager.rs index a2903ebc..f387f772 100644 --- a/crates/cuda-driver/src/original_expert_stager/stream_all/original_expert_stager.rs +++ b/crates/cuda-driver/src/original_expert_stager/stream_all/original_expert_stager.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalExpertStager`: `run_stream_all_forward`, `admit_forward`, `check_forward_caps`. -//! Methods of `OriginalStreamAllForward`: `settle`, `validate_rows`, `with_compute`, `consume_layer` and 1 more. +//! Forward variant of the stream-all transport: run_stream_all_forward admits host and cache costs for layers +//! first..end, gives a consumer the forward scope and settles its rows; also consume_layer and its grouped form. use super::{ BufferHandle, Entry, Error, GPU_RING_MAX, HEADROOM, Issuer, JoinHandle, MAX_JOBS, META_CAP, OriginalExpertStager, diff --git a/crates/cuda-driver/src/original_expert_stager/stream_all/original_stream_all_options.rs b/crates/cuda-driver/src/original_expert_stager/stream_all/original_stream_all_options.rs index 19f156c8..3de99efc 100644 --- a/crates/cuda-driver/src/original_expert_stager/stream_all/original_stream_all_options.rs +++ b/crates/cuda-driver/src/original_expert_stager/stream_all/original_stream_all_options.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `original_stream_all_options_issuer`, `original_expert_stager`, `original_stream_all` and 1... -//! Split out of `stream_all` to keep its files under the line limit. +//! Parent module of the stream-all scope: its issuer, run_stream_all, the live scope and the scope phases; +//! shares their imports and re-exports issuer_thread for the stager's worker setup. use super::{ Arc, AtomicBool, AtomicUsize, BufferHandle, Entry, Error, EventBank, GPU_RING_MAX, HEADROOM, Issuer, JoinHandle, diff --git a/crates/cuda-driver/src/original_expert_stager/stream_all/original_stream_all_options/original_expert_stager.rs b/crates/cuda-driver/src/original_expert_stager/stream_all/original_stream_all_options/original_expert_stager.rs index 86bb8d03..955953ad 100644 --- a/crates/cuda-driver/src/original_expert_stager/stream_all/original_stream_all_options/original_expert_stager.rs +++ b/crates/cuda-driver/src/original_expert_stager/stream_all/original_stream_all_options/original_expert_stager.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalExpertStager`: `run_stream_all`. -//! Split out of `original_stream_all_options` to keep its files under the line limit. +//! run_stream_all: opens one all-expert stream scope over the prompt rows (preflight, budget, targets, queued jobs, +//! issuer), runs the consumer inside it and finishes the scope, which guarantees join and drain even on panic. use super::stream_phases::{arm_scope, finish_scope, open_scope, start_or_cleanup}; use super::{ diff --git a/crates/cuda-driver/src/original_expert_stager/stream_all/original_stream_all_options/original_stream_all.rs b/crates/cuda-driver/src/original_expert_stager/stream_all/original_stream_all_options/original_stream_all.rs index ef921aee..032005b4 100644 --- a/crates/cuda-driver/src/original_expert_stager/stream_all/original_stream_all_options/original_stream_all.rs +++ b/crates/cuda-driver/src/original_expert_stager/stream_all/original_stream_all_options/original_stream_all.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalStreamAll`: `issue_inline`, `healthy`, `give_back`, `release_unused` and 5 more. -//! Implements `Drop for OriginalStreamAll`. +//! The live stream-all scope: inline or threaded issue of copy jobs, health checks, releasing unused experts to the +//! copy/used event ring, consume_layer for producers, issuer join, cleanup, and a Drop that retains owners on failure. use super::{ BufferHandle, Entry, Error, ORIGINAL_MMQ_GROUP, Ordering, OriginalGpuStream, OriginalStreamAll, diff --git a/crates/cuda-driver/src/original_expert_stager/stream_all/original_stream_all_options/original_stream_all_options_issuer.rs b/crates/cuda-driver/src/original_expert_stager/stream_all/original_stream_all_options/original_stream_all_options_issuer.rs index bdb9d094..e8109530 100644 --- a/crates/cuda-driver/src/original_expert_stager/stream_all/original_stream_all_options/original_stream_all_options_issuer.rs +++ b/crates/cuda-driver/src/original_expert_stager/stream_all/original_stream_all_options/original_stream_all_options_issuer.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalStreamAllOptions`: `from_environment`, `eligible`. Methods of `EventBank`: `retire`. -//! Functions: `issuer_thread`, `issue_all`. +//! Issuer side of stream-all: options read from STRATA_PREFILL_* settings (minimum rows, issuer thread on/off), +//! event bank retirement, and the issuer thread that issues every copy job in ascending order. use super::{ Arc, Error, EventBank, Issuer, Ordering, OriginalGpuStream, OriginalPromptRows, OriginalStreamAllCompleted, diff --git a/crates/cuda-driver/src/original_expert_stager/tests.rs b/crates/cuda-driver/src/original_expert_stager/tests.rs index cf258b03..5070efe9 100644 --- a/crates/cuda-driver/src/original_expert_stager/tests.rs +++ b/crates/cuda-driver/src/original_expert_stager/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests that pin the expert stager's stop fence: after stop returns, no worker may still be claiming a job that +//! would copy from a released source (helpers run the real claim prologue against a shared state and flag late claims). use super::*; diff --git a/crates/cuda-driver/src/original_expert_stager_ffi/tests.rs b/crates/cuda-driver/src/original_expert_stager_ffi/tests.rs index c8366693..d917ad28 100644 --- a/crates/cuda-driver/src/original_expert_stager_ffi/tests.rs +++ b/crates/cuda-driver/src/original_expert_stager_ffi/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the stager's raw copy boundary: a CopyJob refuses empty, oversized or overlapping parts and writes nothing +//! on refusal, and an expert file map hands out only parts inside the mapping (Windows and Unix test mappings). use super::*; diff --git a/crates/cuda-driver/src/original_file_expert_source/available_memory.rs b/crates/cuda-driver/src/original_file_expert_source/available_memory.rs index 6c1de3fd..b85f4e19 100644 --- a/crates/cuda-driver/src/original_file_expert_source/available_memory.rs +++ b/crates/cuda-driver/src/original_file_expert_source/available_memory.rs @@ -1,5 +1,5 @@ -//! Functions: `available_memory`, `text`, `value`, `meminfo_available` and 6 more. -//! Split out of `original_file_expert_source` to keep its files under the line limit. +//! Host memory available to the file expert source on Unix: MemAvailable from /proc/meminfo, lowered by the cgroup +//! memory limits of the process and its ancestors, so budget checks respect containers; any parse failure is an error. use super::{Error, Result}; diff --git a/crates/cuda-driver/src/original_file_expert_source/file_expert_source_swap_exchanges.rs b/crates/cuda-driver/src/original_file_expert_source/file_expert_source_swap_exchanges.rs index ad134c52..b5d68d5c 100644 --- a/crates/cuda-driver/src/original_file_expert_source/file_expert_source_swap_exchanges.rs +++ b/crates/cuda-driver/src/original_file_expert_source/file_expert_source_swap_exchanges.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalFileExpertSource`: `reserve_exchanges`, `admit_exchanges`, `replace_exchange`, `stage_swaps` ... -//! Implements `Drop for OriginalFileExpertSource`. Functions: `available_memory`. Defines `Candidate`. +//! File expert source exchange arena: reserving it, staging swaps by copying outgoing cache slots into exchange +//! entries, and committing them once the cache fills are complete; also Drop and the Windows available_memory. use super::{ EXPERTS, Error, Exchange, N, NONE, OriginalExpertCache, OriginalFileExpertSource, OriginalSourceSwap, Result, abi, diff --git a/crates/cuda-driver/src/original_file_expert_source/original_file_expert_source_operations/file_expert_source_cache_complement.rs b/crates/cuda-driver/src/original_file_expert_source/original_file_expert_source_operations/file_expert_source_cache_complement.rs index c5e5b0c1..672cf64a 100644 --- a/crates/cuda-driver/src/original_file_expert_source/original_file_expert_source_operations/file_expert_source_cache_complement.rs +++ b/crates/cuda-driver/src/original_file_expert_source/original_file_expert_source_operations/file_expert_source_cache_complement.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalFileExpertSource`: `build_cache_complement`. -//! Split out of `original_file_expert_source_methods` to keep its files under the line limit. +//! Builds the cache complement: after the primary cache is complete and fenced, plans and fills one host arena +//! (pinned if asked) with every expert the cache does not hold, cleaning up or leaking the arena by failure kind. use super::build_phases::{ArenaFillPlan, alloc_failed, discard_arena, leak_arena, poison_parts}; use super::{Error, OriginalExpertCache, OriginalFileExpertSource, OriginalResidentOptions, Result, combine}; diff --git a/crates/cuda-driver/src/original_file_expert_source/original_file_expert_source_operations/file_expert_source_prefetch.rs b/crates/cuda-driver/src/original_file_expert_source/original_file_expert_source_operations/file_expert_source_prefetch.rs index 525f61db..5d41ea00 100644 --- a/crates/cuda-driver/src/original_file_expert_source/original_file_expert_source_operations/file_expert_source_prefetch.rs +++ b/crates/cuda-driver/src/original_file_expert_source/original_file_expert_source_operations/file_expert_source_prefetch.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalFileExpertSource`: `prefetch_impl`, `prefetch_jobs`, `claim_prefetch`, `note_warm_hit` and 7 ... -//! Functions: `fetch_worker`, `scoped_fetch`. Defines `FetchOutcomes`. +//! File expert source prefetch and teardown: claims stages for wanted experts, copies them in parallel worker +//! threads, accounts hits and fetches, and closes or retains the source's arenas and stages. use super::{ AtomicUsize, EXPERTS, Error, Instant, LAYERS, Mutex, N, NONE, Ordering, OriginalFileExpertSource, Result, abi, diff --git a/crates/cuda-driver/src/original_file_expert_source/original_file_expert_source_operations/file_expert_source_stages_and_blobs.rs b/crates/cuda-driver/src/original_file_expert_source/original_file_expert_source_operations/file_expert_source_stages_and_blobs.rs index d35bb7a1..1003f5d8 100644 --- a/crates/cuda-driver/src/original_file_expert_source/original_file_expert_source_operations/file_expert_source_stages_and_blobs.rs +++ b/crates/cuda-driver/src/original_file_expert_source/original_file_expert_source_operations/file_expert_source_stages_and_blobs.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalFileExpertSource`: `plan`, `claim_stage`, `stage_victim`, `grow_stage` and 13 more. -//! Functions: `omit_table`. +//! File expert source stages and blobs: the layout plan, an LRU of staged experts, and blob reads from arena, +//! exchange, stage or the file itself (blob, copy_blob, warm, prefetch), with read counters. use super::{ EXPERTS, Error, Instant, LAYERS, N, NONE, OriginalFileExpertSource, OriginalFileSourceBlob, Result, Stage, abi, diff --git a/crates/cuda-driver/src/original_file_expert_source/original_file_expert_source_operations/file_expert_source_status_counters.rs b/crates/cuda-driver/src/original_file_expert_source/original_file_expert_source_operations/file_expert_source_status_counters.rs index f9503201..57cdc19e 100644 --- a/crates/cuda-driver/src/original_file_expert_source/original_file_expert_source_operations/file_expert_source_status_counters.rs +++ b/crates/cuda-driver/src/original_file_expert_source/original_file_expert_source_operations/file_expert_source_status_counters.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalFileExpertSource`: `live`, `validate_context`, `parts`, `source_digest` and 15 more. -//! Split out of `original_file_expert_source_methods` to keep its files under the line limit. +//! File expert source status and accounting: liveness and context checks, expert part views from the mapped file, +//! residency and pinned-byte counters, per-layer begin, and the host metadata charge and admission of extra bytes. use super::{ Context, Error, Exchange, GIB, LAYERS, LayerRole, META_CAP, NONE, OriginalFileExpertSource, diff --git a/crates/cuda-driver/src/original_file_expert_source/original_resident_options_and_blob.rs b/crates/cuda-driver/src/original_file_expert_source/original_resident_options_and_blob.rs index 0241d9e2..5da701fc 100644 --- a/crates/cuda-driver/src/original_file_expert_source/original_resident_options_and_blob.rs +++ b/crates/cuda-driver/src/original_file_expert_source/original_resident_options_and_blob.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalResidentOptions`: `from_environment`. -//! Methods of `OriginalFileSourceBlob`: `bytes`, `layer`, `expert`, `source_digest` and 6 more. +//! Resident-source options (defaults, STRATA_PARTIAL_PIN settings), accessors of a file source blob (bytes, parts, +//! role sizes, pinned state, device alias), and the Context constructor that assembles a file expert source. use super::{ Cell, Context, EXPERTS, Error, ExpertFileMap, FileExpertSourceLease, GIB, HashMap, LAYERS, LayerRole, N, diff --git a/crates/cuda-driver/src/original_file_expert_source_ffi/tests.rs b/crates/cuda-driver/src/original_file_expert_source_ffi/tests.rs index ea4bc9dd..2b2c875c 100644 --- a/crates/cuda-driver/src/original_file_expert_source_ffi/tests.rs +++ b/crates/cuda-driver/src/original_file_expert_source_ffi/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the pinned/host arena boundary: write, part and overwrite stay inside the block, copy records refuse +//! overlap, empty, null or oversize pieces, and the partial-pin cap parses a positive prefix or falls back to 24 GiB. use super::*; diff --git a/crates/cuda-driver/src/original_gpu_schedule/abi/api.rs b/crates/cuda-driver/src/original_gpu_schedule/abi/api.rs index 53e9707b..1f368af0 100644 --- a/crates/cuda-driver/src/original_gpu_schedule/abi/api.rs +++ b/crates/cuda-driver/src/original_gpu_schedule/abi/api.rs @@ -1,5 +1,5 @@ -//! Methods of `Api`: `load`, `stream_create`, `stream_destroy`, `stream_sync` and 23 more. -//! Split out of `abi` to keep its files under the line limit. +//! Api stand-in for platforms without the CUDA driver (feature off, or not 64-bit Linux/Windows): every +//! call returns UnsupportedPlatform, so the GPU schedule compiles everywhere and fails cleanly at load. #[cfg(not(all( feature = "cuda-driver", diff --git a/crates/cuda-driver/src/original_gpu_schedule/abi/platform.rs b/crates/cuda-driver/src/original_gpu_schedule/abi/platform.rs index 3c773a2b..0763ddac 100644 --- a/crates/cuda-driver/src/original_gpu_schedule/abi/platform.rs +++ b/crates/cuda-driver/src/original_gpu_schedule/abi/platform.rs @@ -1,5 +1,5 @@ -//! Defines `Handle`, `Library`, `StreamCreate` and 21 more. -//! Split out of `abi` to keep its files under the line limit. +//! Declarations of the GPU schedule's driver table: the C signatures of the CUDA driver calls it binds, the Api +//! struct holding them with the refused-call latches, and the children that load and call them. use super::{Error, Result}; use std::ffi::{CStr, c_void}; diff --git a/crates/cuda-driver/src/original_gpu_schedule/abi/platform/api.rs b/crates/cuda-driver/src/original_gpu_schedule/abi/platform/api.rs index d579ee40..92d28fa8 100644 --- a/crates/cuda-driver/src/original_gpu_schedule/abi/platform/api.rs +++ b/crates/cuda-driver/src/original_gpu_schedule/abi/platform/api.rs @@ -1,5 +1,5 @@ -//! Methods of `Api`: `load`, `stream_create`, `warm_callback_thread`, `warm_callback_thread` and 19 more. -//! Functions: `symbol`. +//! Driver table of the GPU schedule: dlopen of the CUDA driver and binding of every symbol (plus the optional batch +//! copy and stream-write ones), then the stream, event, graph capture and launch calls and callback-thread warm-up. use super::{ Api, Begin, CStr, CopyBatch, CopyH2d, End, Error, EventCall, EventCreate, EventElapsed, EventRecord, GraphCall, diff --git a/crates/cuda-driver/src/original_gpu_schedule/abi/platform/async_copies_and_flag_writes.rs b/crates/cuda-driver/src/original_gpu_schedule/abi/platform/async_copies_and_flag_writes.rs index 0b9954fb..0a54018a 100644 --- a/crates/cuda-driver/src/original_gpu_schedule/abi/platform/async_copies_and_flag_writes.rs +++ b/crates/cuda-driver/src/original_gpu_schedule/abi/platform/async_copies_and_flag_writes.rs @@ -1,5 +1,5 @@ -//! Methods of `Api`: `copy_h2d`, `copy_h2d_many`, `copy_h2d_batched`, `can_write_u32` and 3 more. -//! Split out of `platform` to keep its files under the line limit. +//! Asynchronous host-to-device copies of the GPU schedule (single, grouped or one cuMemcpyBatchAsync) and the stream +//! writes or host callbacks that raise a ring flag after the copies, with fallback once the driver refuses a call. use super::{Api, BatchAttributes, CopyBatch, Error, Handle, Raise, Result, check, raise_after_copies}; diff --git a/crates/cuda-driver/src/original_gpu_schedule/abi/platform/library_drop.rs b/crates/cuda-driver/src/original_gpu_schedule/abi/platform/library_drop.rs index 70ce463e..659a95c7 100644 --- a/crates/cuda-driver/src/original_gpu_schedule/abi/platform/library_drop.rs +++ b/crates/cuda-driver/src/original_gpu_schedule/abi/platform/library_drop.rs @@ -1,5 +1,5 @@ -//! Implements `Drop for Library`. Functions: `check`, `raise_after_copies`, `noop_host_fn`, `callback_warmup_enabled`. -//! Split out of `platform` to keep its files under the line limit. +//! Small helpers of the driver table: dlclose on Drop, mapping a driver return code to an error, the host function +//! that raises a flag word, and the no-op callback and LELEKA_CB_WARMUP switch used to warm the callback thread. use super::{Error, Library, Raise, Result, c_void}; diff --git a/crates/cuda-driver/src/original_gpu_schedule/original_gpu_graph.rs b/crates/cuda-driver/src/original_gpu_schedule/original_gpu_graph.rs index 68e200fb..f647e168 100644 --- a/crates/cuda-driver/src/original_gpu_schedule/original_gpu_graph.rs +++ b/crates/cuda-driver/src/original_gpu_schedule/original_gpu_graph.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalGpuGraph`: `validate`, `nodes`, `policy`, `validate_context` and 14 more. -//! Methods of `OriginalGraphFlight`: `query`, `wait`, `wait_ms`. +//! A captured CUDA graph executable of the GPU schedule: enqueue or launch on a stream, the in-flight handle with +//! query/wait/timeout, the receipts (stream drain, event, wait) that allow its resources to be reused, and close/Drop. use super::{ Context, Duration, Error, Instant, OriginalCapturePolicy, OriginalGpuEvent, OriginalGpuGraph, OriginalGpuStream, diff --git a/crates/cuda-driver/src/original_gpu_schedule/original_gpu_stream.rs b/crates/cuda-driver/src/original_gpu_schedule/original_gpu_stream.rs index 5ef95ac0..75638180 100644 --- a/crates/cuda-driver/src/original_gpu_schedule/original_gpu_stream.rs +++ b/crates/cuda-driver/src/original_gpu_schedule/original_gpu_stream.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalGpuStream`: `validate_context`, `is_failed`, `priority`, `query` and 9 more. -//! Split out of `original_gpu_schedule` to keep its files under the line limit. +//! The GPU schedule's stream handle: context and failure checks, observational priority, query and synchronize, +//! enqueue of host-to-device copies and flag raises, graph capture on the stream, and the drain receipt. use super::{ CUDA_ERROR_OUT_OF_MEMORY, Cell, Context, Error, Instant, OriginalCapture, OriginalCapturePolicy, OriginalGpuGraph, diff --git a/crates/cuda-driver/src/original_gpu_schedule/original_graph_key.rs b/crates/cuda-driver/src/original_gpu_schedule/original_graph_key.rs index abe3260f..fd8b616f 100644 --- a/crates/cuda-driver/src/original_gpu_schedule/original_graph_key.rs +++ b/crates/cuda-driver/src/original_gpu_schedule/original_graph_key.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalGraphKey`: `validate`, `policy`. -//! Methods of `OriginalGraphRegistry`: `new`, `planned_metadata_bytes`, `metadata_bytes`, `captures` and 7 more. +//! Graph identity and cache: OriginalGraphKey names a capturable graph (layer pre/post, token, verify window, MTP +//! steps) with range check and capture policy; OriginalGraphRegistry records, looks up and clears cached graphs. use super::{ Context, Error, OriginalCapture, OriginalCapturePolicy, OriginalGpuGraph, OriginalGpuStream, OriginalGraphKey, diff --git a/crates/cuda-driver/src/original_gpu_schedule/set_side_streams_wanted.rs b/crates/cuda-driver/src/original_gpu_schedule/set_side_streams_wanted.rs index 108a45f8..61265544 100644 --- a/crates/cuda-driver/src/original_gpu_schedule/set_side_streams_wanted.rs +++ b/crates/cuda-driver/src/original_gpu_schedule/set_side_streams_wanted.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalCapture`: `has_side`, `side_fork`, `side_end`, `side_join` and 2 more. -//! Methods of `OriginalGpuEvent`: `handle`, `validate_context`, `record`, `wait_on` and 6 more. +//! Side streams and events of the GPU schedule: the switch for a verifier-window capture to fork two side streams, +//! their creation/teardown, fork/end/join in a capture, and the OriginalGpuEvent record, wait, query, timing and close. use super::{ Context, Error, OriginalCapture, OriginalEventKind, OriginalGpuEvent, OriginalGpuStream, Rc, Result, diff --git a/crates/cuda-driver/src/original_gpu_schedule/transport.rs b/crates/cuda-driver/src/original_gpu_schedule/transport.rs index a674eadc..a6366a24 100644 --- a/crates/cuda-driver/src/original_gpu_schedule/transport.rs +++ b/crates/cuda-driver/src/original_gpu_schedule/transport.rs @@ -1,5 +1,5 @@ -//! Methods of `Stream`: `bump`, `validate`, `run`, `close` and 1 more. -//! Methods of `Context`: `original_default_gpu_stream`, `original_gpu_stream`, `original_gpu_event`. +//! Driver-call plumbing of the GPU schedule: error classification (transport, recoverable out-of-memory), poisoning of +//! the context on failure, the per-stream run/close guard, and the Context constructors for streams and events. use super::{ CUDA_ERROR_OUT_OF_MEMORY, Cell, Context, Error, OriginalCapturePolicy, OriginalEventKind, OriginalGpuEvent, diff --git a/crates/cuda-driver/src/original_moe_prompt_device/blank.rs b/crates/cuda-driver/src/original_moe_prompt_device/blank.rs index c94da085..5d06526d 100644 --- a/crates/cuda-driver/src/original_moe_prompt_device/blank.rs +++ b/crates/cuda-driver/src/original_moe_prompt_device/blank.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `original_moe_prompt_device`. Functions: `blank`, `kernel`, `gemm`, `phase` and 2 more. -//! Split out of `original_moe_prompt_device` to keep its files under the line limit. +//! Shared builders of the MoE prompt device: zeroed host buffers, kernel and GEMM command constructors, span +//! lookups for phase and common prompt-row roles, the dequant kernel index per GDN format, and the Context entry point. use super::{ A, BufferHandle, Command, Context, Error, GdnNativeFormat, GemmOperands, GemmSize, KernelArguments, diff --git a/crates/cuda-driver/src/original_moe_prompt_device/original_moe_prompt_device_drop.rs b/crates/cuda-driver/src/original_moe_prompt_device/original_moe_prompt_device_drop.rs index 295a5020..44563657 100644 --- a/crates/cuda-driver/src/original_moe_prompt_device/original_moe_prompt_device_drop.rs +++ b/crates/cuda-driver/src/original_moe_prompt_device/original_moe_prompt_device_drop.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMoePromptLayer`: `experts`, `counts`, `metadata_bytes`, `execute_original_copy_ring` and 8 more. -//! Implements `Drop for OriginalMoePromptDevice`. Functions: `source_in_layer`. +//! Per-layer MoE prompt execution (OriginalMoePromptLayer): route order and counts, the copy-ring, MMQ and stream-all +//! expert executions, the slot-table upload and weighted combine finish; also Drop for OriginalMoePromptDevice. use super::{ A, BufferHandle, Command, Error, ExpertStreamLayer, MappedExpertBank, MmqWorkspace, NativeBatchWorkspace, diff --git a/crates/cuda-driver/src/original_moe_prompt_device/original_moe_prompt_device_operations/original_moe_prompt_device_new_run.rs b/crates/cuda-driver/src/original_moe_prompt_device/original_moe_prompt_device_operations/original_moe_prompt_device_new_run.rs index 87c6dfee..4d9fb06b 100644 --- a/crates/cuda-driver/src/original_moe_prompt_device/original_moe_prompt_device_operations/original_moe_prompt_device_new_run.rs +++ b/crates/cuda-driver/src/original_moe_prompt_device/original_moe_prompt_device_operations/original_moe_prompt_device_new_run.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMoePromptDevice`: `new`, `allocate_and_load`, `allocated_bytes`, `handle` and 9 more. -//! Split out of `original_moe_prompt_device_methods` to keep its files under the line limit. +//! Construction and command runner of the MoE prompt device: budget check, status and scratch allocation, kernel +//! module loading, weight and span admission, and run, which issues commands and checks the finite-status words. use super::{ A, BufferHandle, Command, Context, DQ_ENTRIES, DeviceBuffer, Error, KernelModule, MOE_ENTRIES, diff --git a/crates/cuda-driver/src/original_moe_prompt_device/original_moe_prompt_device_operations/original_moe_prompt_device_prepare.rs b/crates/cuda-driver/src/original_moe_prompt_device/original_moe_prompt_device_operations/original_moe_prompt_device_prepare.rs index 0b1cd43b..c324864d 100644 --- a/crates/cuda-driver/src/original_moe_prompt_device/original_moe_prompt_device_operations/original_moe_prompt_device_prepare.rs +++ b/crates/cuda-driver/src/original_moe_prompt_device/original_moe_prompt_device_operations/original_moe_prompt_device_prepare.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMoePromptDevice`: `prepare`, `close`. -//! Split out of `original_moe_prompt_device_methods` to keep its files under the line limit. +//! MoE prepare phase: validates the GR-read rows against the device, runs the router and grouping commands and builds +//! the per-layer route plan (expert order and counts) that the layer then executes; also the explicit close. use super::prepare_phases::{MOE_NAMES, route_plan}; use super::{ diff --git a/crates/cuda-driver/src/original_moe_prompt_device/original_moe_prompt_device_operations/original_moe_prompt_device_release.rs b/crates/cuda-driver/src/original_moe_prompt_device/original_moe_prompt_device_operations/original_moe_prompt_device_release.rs index 9f29ad81..0fb26b0a 100644 --- a/crates/cuda-driver/src/original_moe_prompt_device/original_moe_prompt_device_operations/original_moe_prompt_device_release.rs +++ b/crates/cuda-driver/src/original_moe_prompt_device/original_moe_prompt_device_operations/original_moe_prompt_device_release.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMoePromptDevice`: `close_inner`, `is_released`, `retain_poisoned`. -//! Split out of `original_moe_prompt_device_methods` to keep its files under the line limit. +//! Teardown of the MoE prompt device: closes kernel modules and releases buffers under the context guard, or leaks +//! them when the context is poisoned so a failed close never frees GPU memory a stuck stream may still touch. use super::{Error, OriginalMoePromptDevice, Result, combine}; diff --git a/crates/cuda-driver/src/original_mtp_actor/loaded/inconsistent.rs b/crates/cuda-driver/src/original_mtp_actor/loaded/inconsistent.rs index e2688a35..abcc659f 100644 --- a/crates/cuda-driver/src/original_mtp_actor/loaded/inconsistent.rs +++ b/crates/cuda-driver/src/original_mtp_actor/loaded/inconsistent.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpLoadMeter`: `start`, `finish`. Functions: `inconsistent`, `mismatch`. -//! Split out of `loaded` to keep its files under the line limit. +//! Load accounting of the MTP draft actor: OriginalMtpLoadMeter measures the VRAM a load added (monotonic, same +//! device) and the helpers that build the load-failure errors for inconsistent owners or mismatched facts. use super::{ Context, Error, OriginalMtpDraftHead, OriginalMtpLoadEvidence, OriginalMtpLoadFailure, OriginalMtpLoadMeter, diff --git a/crates/cuda-driver/src/original_mtp_actor/loaded/original_mtp_actor.rs b/crates/cuda-driver/src/original_mtp_actor/loaded/original_mtp_actor.rs index 5b811546..23620f29 100644 --- a/crates/cuda-driver/src/original_mtp_actor/loaded/original_mtp_actor.rs +++ b/crates/cuda-driver/src/original_mtp_actor/loaded/original_mtp_actor.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `draft_rounds`, `original_mtp_actor_adopt_loaded`. -//! Split out of `loaded` to keep its files under the line limit. +//! Parent module of the MTP draft actor: one child for adopting loaded owners and one for draft rounds, +//! both adding methods to OriginalMtpActor; shares their imports. use super::{ AcceptedWindow, ActorRefusal, CompletedOriginalMtpDraft, Context, CoupledDraftHost, CoupledPlan, CoupledPreference, diff --git a/crates/cuda-driver/src/original_mtp_actor/loaded/original_mtp_actor/original_mtp_actor_adopt_loaded.rs b/crates/cuda-driver/src/original_mtp_actor/loaded/original_mtp_actor/original_mtp_actor_adopt_loaded.rs index aa3f2858..ed5c3d0d 100644 --- a/crates/cuda-driver/src/original_mtp_actor/loaded/original_mtp_actor/original_mtp_actor_adopt_loaded.rs +++ b/crates/cuda-driver/src/original_mtp_actor/loaded/original_mtp_actor/original_mtp_actor_adopt_loaded.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpActor`: `adopt`, `admit`, `check_loaded`, `coupled_setup` and 22 more. -//! Split out of `original_mtp_actor` to keep its files under the line limit. +//! Adoption and accessors of the MTP draft actor: takes the loaded drafter, ring and weights, verifies them against the +//! plan and load evidence, sets up coupled drafting, and exposes the settings, restore and end-of-request calls. use super::{ ActorRefusal, Context, CoupledDraftHost, CoupledPlan, CoupledPreference, CoupledSetupReceipt, DraftSettings, Error, diff --git a/crates/cuda-driver/src/original_mtp_actor/loaded/original_mtp_actor_drop.rs b/crates/cuda-driver/src/original_mtp_actor/loaded/original_mtp_actor_drop.rs index 15c47de1..97faa2ec 100644 --- a/crates/cuda-driver/src/original_mtp_actor/loaded/original_mtp_actor_drop.rs +++ b/crates/cuda-driver/src/original_mtp_actor/loaded/original_mtp_actor_drop.rs @@ -1,5 +1,4 @@ -//! Implements `Drop for OriginalMtpActor`. -//! Split out of `loaded` to keep its files under the line limit. +//! Drop glue of the loaded MTP actor: dropping it closes the device resources it still holds, ignoring close errors. use super::OriginalMtpActor; diff --git a/crates/cuda-driver/src/original_mtp_draft_vocab/tests.rs b/crates/cuda-driver/src/original_mtp_draft_vocab/tests.rs index 0f877da1..d322d04a 100644 --- a/crates/cuda-driver/src/original_mtp_draft_vocab/tests.rs +++ b/crates/cuda-driver/src/original_mtp_draft_vocab/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the draft-vocabulary selection: setting spellings, the recorded digest table, refusal of wrong digests, +//! malformed files and symlinks, and the round trip from draft tokens to full vocabulary ids. use super::*; use crate::original_mtp_coupled::subset_inverse; diff --git a/crates/cuda-driver/src/original_mtp_rt/read_index.rs b/crates/cuda-driver/src/original_mtp_rt/read_index.rs index ae975026..c02e58d6 100644 --- a/crates/cuda-driver/src/original_mtp_rt/read_index.rs +++ b/crates/cuda-driver/src/original_mtp_rt/read_index.rs @@ -1,5 +1,5 @@ -//! Functions: `read_index`, `read_dense`, `expert_bank_bytes`, `expert_scales_finite` and 10 more. -//! Split out of `original_mtp_rt` to keep its files under the line limit. +//! File readers of the MTP runtime pack: dense.txt index, dense blob, experts.bin chunk streaming with the Inf/NaN +//! scale scan, and the draft vocabulary selection. Each mirrors the Original mtp.cpp read semantics and size limits. use super::{ DENSE_LIMIT, DRAFT_VOCAB_MAX_IDS, DenseIndex, DraftVocab, EXPERT_SCALE_OFFSET, INDEX_LIMIT, Path, PathBuf, Read, diff --git a/crates/cuda-driver/src/original_mtp_rt/rt_error.rs b/crates/cuda-driver/src/original_mtp_rt/rt_error.rs index d4e0a955..a655fbf9 100644 --- a/crates/cuda-driver/src/original_mtp_rt/rt_error.rs +++ b/crates/cuda-driver/src/original_mtp_rt/rt_error.rs @@ -1,5 +1,5 @@ -//! Methods of `RtError`: `message`, `index_message`, `pack_message`, `limit_message`. -//! Methods of `OriginalMtpTensorKind`: `parse`, `index_name`, `row_bytes`. +//! Parsing and error text of the MTP runtime pack index: RtError messages in the Original mtp.cpp wording, tensor kind +//! parsing and row sizes, the dense.txt parser with extent, required-name and finiteness checks, regular-file opening. use super::{DenseIndex, File, MAX_TENSORS, OriginalMtpTensorKind, Path, RtError, RtResult, TensorEntry, fs}; diff --git a/crates/cuda-driver/src/original_mtp_rt/tests.rs b/crates/cuda-driver/src/original_mtp_rt/tests.rs index 012e1b49..2bd09591 100644 --- a/crates/cuda-driver/src/original_mtp_rt/tests.rs +++ b/crates/cuda-driver/src/original_mtp_rt/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the MTP runtime pack readers: index parsing, extent and finiteness checks, expert streaming error order, +//! and refusal of symlinked files; submodules hold the cases. use super::fixtures::*; use super::*; diff --git a/crates/cuda-driver/src/original_sampler/asset.rs b/crates/cuda-driver/src/original_sampler/asset.rs index a4039aa8..9e525396 100644 --- a/crates/cuda-driver/src/original_sampler/asset.rs +++ b/crates/cuda-driver/src/original_sampler/asset.rs @@ -1,5 +1,5 @@ -//! Methods of `Launch`: `new`. Methods of `Context`: `original_sampler`. Functions: `asset`. -//! Split out of `original_sampler` to keep its files under the line limit. +//! Loads the sealed PTX asset of the Original sampler, builds a kernel Launch description, and opens the sampler +//! from a Context. use super::{ASSET_PIN, Arg, Command, Context, Launch, OriginalSampler, Result}; diff --git a/crates/cuda-driver/src/original_sampler/original_sampler_drop.rs b/crates/cuda-driver/src/original_sampler/original_sampler_drop.rs index 7601d557..80df25e4 100644 --- a/crates/cuda-driver/src/original_sampler/original_sampler_drop.rs +++ b/crates/cuda-driver/src/original_sampler/original_sampler_drop.rs @@ -1,5 +1,4 @@ -//! Implements `Drop for OriginalSampler`. Functions: `sampler_asset_sealed`. -//! Split out of `original_sampler` to keep its files under the line limit. +//! Drop glue of the Original sampler (closes its device resources) and the probe for a sealed PTX asset. use super::{OriginalSampler, asset}; diff --git a/crates/cuda-driver/src/original_sampler/original_sampler_operations/original_sampler_bring_up.rs b/crates/cuda-driver/src/original_sampler/original_sampler_operations/original_sampler_bring_up.rs index 87d9881c..f137ecb2 100644 --- a/crates/cuda-driver/src/original_sampler/original_sampler_operations/original_sampler_bring_up.rs +++ b/crates/cuda-driver/src/original_sampler/original_sampler_operations/original_sampler_bring_up.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalSampler`: `new`, `unloaded`, `check_budget`, `allocate_and_load` and 11 more. -//! Split out of `original_sampler_methods` to keep its files under the line limit. +//! Bring-up of the Original sampler: budget check, device buffer and kernel module allocation, buffer admission checks, +//! scratch growth for the split path, and uploads. Everything done before the first launch. use super::{ Context, DRAFTS, DeviceBuffer, ENTRIES, Error, HIST, KernelModule, MappedAllocation, OriginalSampler, RESERVE, diff --git a/crates/cuda-driver/src/original_sampler/original_sampler_operations/original_sampler_close_resources.rs b/crates/cuda-driver/src/original_sampler/original_sampler_operations/original_sampler_close_resources.rs index e165ef6b..652587c7 100644 --- a/crates/cuda-driver/src/original_sampler/original_sampler_operations/original_sampler_close_resources.rs +++ b/crates/cuda-driver/src/original_sampler/original_sampler_operations/original_sampler_close_resources.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalSampler`: `close_inner`, `is_released`, `close_module_and_mapped`, `retain_module_and_mapped`. -//! Functions: `release_buffer`. +//! Teardown of the Original sampler: releases buffers, kernel module and mapped staging inside an entered context, +//! or retains them when the context is poisoned. use super::{Context, DeviceBuffer, Error, KernelModule, OriginalSampler, Result, combine}; diff --git a/crates/cuda-driver/src/original_sampler/original_sampler_operations/original_sampler_coupled_draft.rs b/crates/cuda-driver/src/original_sampler/original_sampler_operations/original_sampler_coupled_draft.rs index 1a0418a9..f6e25e1d 100644 --- a/crates/cuda-driver/src/original_sampler/original_sampler_operations/original_sampler_coupled_draft.rs +++ b/crates/cuda-driver/src/original_sampler/original_sampler_operations/original_sampler_coupled_draft.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalSampler`: `set_subset`, `stage_coupled_round`, `write_round_staging`, `launch_stage` and 11 m... -//! Split out of `original_sampler_methods` to keep its files under the line limit. +//! Coupled draft sampling of the Original sampler: installs the draft-head vocabulary subset, stages a round's +//! parameters and history, and runs penalties, widest split and coupled merge for one draft logits row. use super::{Arg, DRAFTS, DeviceBuffer, Error, HIST, Launch, OriginalSampler, Result, SamplerParams, combine}; diff --git a/crates/cuda-driver/src/original_sampler/original_sampler_operations/original_sampler_run_verify_window.rs b/crates/cuda-driver/src/original_sampler/original_sampler_operations/original_sampler_run_verify_window.rs index 07fa1fcf..07a6a955 100644 --- a/crates/cuda-driver/src/original_sampler/original_sampler_operations/original_sampler_run_verify_window.rs +++ b/crates/cuda-driver/src/original_sampler/original_sampler_operations/original_sampler_run_verify_window.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalSampler`: `run`, `issue_guarded`, `launch_all`, `read_outputs` and 10 more. -//! Methods of `SampleArgs`: `split_partial`, `greedy`, `old`, `fused`. Functions: `zeroed`, `split_merge`. +//! Verify-window sampling of the Original sampler: uploads row histories, launches the greedy, fused or split-merge +//! kernels, reads the sampled ids back and settles the drain. Launch arguments are built here. use super::{ Arg, Error, Launch, OriginalSampler, Result, SampleRequest, SampleWindow, SamplerLaunchShape, SamplerParams, diff --git a/crates/cuda-driver/src/original_session_state/add.rs b/crates/cuda-driver/src/original_session_state/add.rs index 4f889d7b..0aadfb63 100644 --- a/crates/cuda-driver/src/original_session_state/add.rs +++ b/crates/cuda-driver/src/original_session_state/add.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalSessionGeometry`: `original`, `dimensions`, `validate`, `recurrence_bytes` and 14 more. -//! Methods of `OriginalSessionSpan`: `end`, `at`. Functions: `add`, `mul`, `product`, `align` and 6 more. +//! Byte-size model of an Original session: checked arithmetic helpers, the OriginalSessionGeometry dimensions and +//! the sizes of the GDN, GR, MoE, block and QSA scratch regions, plus the span and cursor helpers that carve an arena. use super::{Cursor, Error, OriginalSessionGeometry, OriginalSessionQsaLayout, OriginalSessionSpan, Result}; diff --git a/crates/cuda-driver/src/original_session_state/original_session_layout.rs b/crates/cuda-driver/src/original_session_state/original_session_layout.rs index aa72834b..c30295db 100644 --- a/crates/cuda-driver/src/original_session_state/original_session_layout.rs +++ b/crates/cuda-driver/src/original_session_state/original_session_layout.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalSessionLayout`: `new`, `gdn_point_at`, `gdn_local_index`, `gdn_point_spans` and 1 more. -//! Methods of `OriginalSessionState`: `session_init_carve`, `validate_context`, `layout`, `with_carved_arena` and 3 ... +//! Layout and lifecycle of a session state: finds the GDN point spans and the primary QSA layout, carves the arena, +//! registers and releases the primary RoPE tables, and closes the state. use super::{ ALIGN, Context, Cursor, DeviceBuffer, Error, OriginalLayerBounds, OriginalSessionGeometry, OriginalSessionKvPolicy, diff --git a/crates/cuda-driver/src/original_session_state/qsa_price.rs b/crates/cuda-driver/src/original_session_state/qsa_price.rs index d5868ad1..861b2b6a 100644 --- a/crates/cuda-driver/src/original_session_state/qsa_price.rs +++ b/crates/cuda-driver/src/original_session_state/qsa_price.rs @@ -1,5 +1,5 @@ -//! Methods of `PoolSizes`: `new`, `select`, `without_key`, `hybrid`. Methods of `KvSizes`: `new`. -//! Functions: `qsa_price`, `kv_placement`, `tier_off`, `smaller_tier` and 11 more. +//! Pricing and carving of QSA session state: K/V placement tier (drafter ring, clock-resident, full), pool and table +//! sizes, the region-by-region carve of one state, and the pure total session_bytes of the Original sequence. use super::{ ALIGN, Cursor, Error, OriginalSessionGeometry, OriginalSessionKvPolicy, OriginalSessionQsaLayout, diff --git a/crates/cuda-driver/src/original_verify/gpu_plan/cpu_sink_publish_gpu_plan.rs b/crates/cuda-driver/src/original_verify/gpu_plan/cpu_sink_publish_gpu_plan.rs index 181354a5..cec52903 100644 --- a/crates/cuda-driver/src/original_verify/gpu_plan/cpu_sink_publish_gpu_plan.rs +++ b/crates/cuda-driver/src/original_verify/gpu_plan/cpu_sink_publish_gpu_plan.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalVerifyCpuSink`: `plan_capacity`, `staging_capacity`, `copies_landed`, `group_ids` and 1 more. -//! Functions: `dma_options`. +//! Publishing of a group's GPU plan from the CPU sink: capacity and group-id accessors, publish_gpu_plan (flag A, PCIe +//! share staged by DMA, flag B), and the DMA option switches with their platform defaults. use super::{ Error, OriginalExpertCache, OriginalGpuStream, OriginalVerifyGpuPlan, OriginalVerifyPcieSource, Result, diff --git a/crates/cuda-driver/src/original_verify/gpu_plan/dma_options_for.rs b/crates/cuda-driver/src/original_verify/gpu_plan/dma_options_for.rs index 6479ae08..d1e21fba 100644 --- a/crates/cuda-driver/src/original_verify/gpu_plan/dma_options_for.rs +++ b/crates/cuda-driver/src/original_verify/gpu_plan/dma_options_for.rs @@ -1,5 +1,5 @@ -//! Functions: `dma_options_for`. -//! Split out of `gpu_plan` to keep its files under the line limit. +//! Pure platform and environment rule behind the DMA staging options: WSL2 and native Windows make the batch copy +//! and the stream write opt-in. Separate from dma_options so it can be tested with a fake environment. /// `dma_options` for a platform and an environment: `wsl` (WSL2 passthrough) makes the batch copy and the stream /// write opt-in, `windows` (native) the batch copy only. diff --git a/crates/cuda-driver/src/original_verify/gr/assets.rs b/crates/cuda-driver/src/original_verify/gr/assets.rs index 06205ba2..236d45ef 100644 --- a/crates/cuda-driver/src/original_verify/gr/assets.rs +++ b/crates/cuda-driver/src/original_verify/gr/assets.rs @@ -1,5 +1,5 @@ -//! Methods of `GrVariant`: `from_env_value`. Methods of `GrConfig`: `from_device`, `query`, `down_entry`. -//! Functions: `assets`, `cap_to_optin`, `shared_attributes`, `tiled_down_geometry` and 6 more. +//! Assets and per-device configuration of the GR (hyper-connection read/write) kernel family: variant choice from the +//! environment, shared-memory attributes, tiled down geometry, row checks and the argument-word helpers. use super::{ ARGS_WORDS, ATTR_COMPUTE_CAPABILITY_MAJOR, ATTR_COMPUTE_CAPABILITY_MINOR, ATTR_MAX_SHARED_PER_BLOCK, diff --git a/crates/cuda-driver/src/original_verify/gr/plan_hc_read.rs b/crates/cuda-driver/src/original_verify/gr/plan_hc_read.rs index 93c88527..49fe47f5 100644 --- a/crates/cuda-driver/src/original_verify/gr/plan_hc_read.rs +++ b/crates/cuda-driver/src/original_verify/gr/plan_hc_read.rs @@ -1,5 +1,5 @@ -//! Functions: `plan_hc_read`, `hc_read_of_rows`, `hc_read_rows`, `hc_read_norm` and 9 more. -//! Split out of `gr` to keep its files under the line limit. +//! Planner of the GR read launches (norm, down, up) per window half, the final residual write of the last layer +//! and the per-token head mix. Picks tiled, buffered or fused down kernels by card limits. use super::{ A, ArenaMap, Bf16GemvExtents, D, DOWN_BLOCKS, E_NORM, E_SPLIT, E_UP, EPS, Error, GR_FUSED, GR_NORM, GR_POST, diff --git a/crates/cuda-driver/src/original_verify/gr/plan_ple_row.rs b/crates/cuda-driver/src/original_verify/gr/plan_ple_row.rs index 08a7707e..1069c8aa 100644 --- a/crates/cuda-driver/src/original_verify/gr/plan_ple_row.rs +++ b/crates/cuda-driver/src/original_verify/gr/plan_ple_row.rs @@ -1,5 +1,5 @@ -//! Methods of `PleScratch`: `at`. -//! Methods of `OriginalVerifyGrBinding`: `new`, `half`, `half_addrs`, `head_addrs` and 4 more. +//! Planner of the layer-1 PLE (per-layer embedding) block, one launch list per window row, and the GR binding that +//! validates and hands out the device addresses of the hyper-connection halves, the head and the PLE buffers. use super::{ A, ArenaMap, Bf16GemvExtents, Context, D, DeviceBuffer, Error, GrWindow, HC, HC_DOWN_BYTES, HC_INJECT_BYTES, diff --git a/crates/cuda-driver/src/original_verify/moe/pcie_fast_kernel.rs b/crates/cuda-driver/src/original_verify/moe/pcie_fast_kernel.rs index 92dc69cf..aea2b2fa 100644 --- a/crates/cuda-driver/src/original_verify/moe/pcie_fast_kernel.rs +++ b/crates/cuda-driver/src/original_verify/moe/pcie_fast_kernel.rs @@ -1,5 +1,5 @@ -//! Methods of `MoeKnobs`: `mode17`. Methods of `ExpertBlob`: `words`. -//! Functions: `pcie_fast_kernel`, `pcie_kernel_name`, `pcie_grid`, `assets` and 13 more. +//! MoE family setup: assets, knobs and PCIe staging copy kernel choice, the expert blob formats a window supports, +//! the MoE buffer binding with its address checks, and the small arena helpers shared by the MoE planners. use super::{ ArenaMap, AssetSpec, COMBINE, Context, DeviceBuffer, ELEMENT, EXPERTS, Error, ExpertBlob, HEAD_IQ_EXPERT, MoeKnobs, diff --git a/crates/cuda-driver/src/original_verify/moe/plan_expert_groups.rs b/crates/cuda-driver/src/original_verify/moe/plan_expert_groups.rs index 6170e2a7..2ed7aa16 100644 --- a/crates/cuda-driver/src/original_verify/moe/plan_expert_groups.rs +++ b/crates/cuda-driver/src/original_verify/moe/plan_expert_groups.rs @@ -1,5 +1,5 @@ -//! Methods of `GroupPlan`: `new`, `launches`, `upstream_layout`, `swiglu_quant` and 4 more. -//! Functions: `plan_expert_groups`, `group_kernels`, `fused_gate_up_entry`, `plan_hit_add` and 5 more. +//! Planner of the routed-expert launches of a window group: gate/up, SwiGLU with q8_1 quantization and down projection +//! per tier, then the hit add and the MoE combine (batched, native per row, or legacy). use super::super::down; use super::{ diff --git a/crates/cuda-driver/src/original_verify/moe/plan_f32_to_bf16.rs b/crates/cuda-driver/src/original_verify/moe/plan_f32_to_bf16.rs index d5f2a149..e2c64495 100644 --- a/crates/cuda-driver/src/original_verify/moe/plan_f32_to_bf16.rs +++ b/crates/cuda-driver/src/original_verify/moe/plan_f32_to_bf16.rs @@ -1,5 +1,5 @@ -//! Methods of `BatchedRows`: `new`. Methods of `RouterSpans`: `mixed`, `logits`, `ids`, `weights`. -//! Functions: `plan_f32_to_bf16`, `plan_route`, `plan_router`, `router_batched` and 5 more. +//! Planner of the MoE front end: f32 to bf16 conversion, router logits with top-10 selection (batched or per row), +//! and the shared expert (conversion, projections, SwiGLU, gate scalar). use super::{ A, ArenaMap, Bf16GemvExtents, E_NATIVE_SWIGLU, E_QUANTIZE_Q8_1, E_ROUTE, E_ROUTER_TOP10, E_SCALAR_GATE, diff --git a/crates/cuda-driver/src/original_verify/original_verify_gdn_journal.rs b/crates/cuda-driver/src/original_verify/original_verify_gdn_journal.rs index aaa686fc..ceb53f7e 100644 --- a/crates/cuda-driver/src/original_verify/original_verify_gdn_journal.rs +++ b/crates/cuda-driver/src/original_verify/original_verify_gdn_journal.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `original_verify_window`, `verify_gdn_fused_step`, `verify_gdn_journal_ladder_logits_scan` ... -//! Split out of `original_verify` to keep its files under the line limit. +//! Parent of the GDN journal of the verify window: shares the imports of its submodules (window geometry, fused step, +//! logits scan, stage and commit, launch plumbing) so each one stays a single responsibility. use super::{ ASSET, ASSET_SHA, Arg, Command, Context, DeviceBuffer, EPS, Error, LAYER_BYTES, Module, OriginalCapture, diff --git a/crates/cuda-driver/src/original_verify/original_verify_gdn_journal/original_verify_window.rs b/crates/cuda-driver/src/original_verify/original_verify_gdn_journal/original_verify_window.rs index 282c94d4..5a75b907 100644 --- a/crates/cuda-driver/src/original_verify/original_verify_gdn_journal/original_verify_window.rs +++ b/crates/cuda-driver/src/original_verify/original_verify_gdn_journal/original_verify_window.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalVerifyWindow`: `validate_mtp_geometry`, `retained_residual_address_for_mtp`, `actual_mtp_resi... -//! Functions: `verify_assets_sealed`. +//! Geometry admission and residual-bank access of OriginalVerifyWindow for the MTP drafter, plus the probe that tells +//! whether the two verifier PTX assets are sealed. use super::{ASSET, ASSET_SHA, Error, OriginalVerifyWindow, QSA_ASSET, QSA_ASSET_SHA, Result, handle, sealed_asset}; diff --git a/crates/cuda-driver/src/original_verify/original_verify_gdn_journal/verify_gdn_journal_ladder_logits_scan.rs b/crates/cuda-driver/src/original_verify/original_verify_gdn_journal/verify_gdn_journal_ladder_logits_scan.rs index f38438f3..de6a6b3d 100644 --- a/crates/cuda-driver/src/original_verify/original_verify_gdn_journal/verify_gdn_journal_ladder_logits_scan.rs +++ b/crates/cuda-driver/src/original_verify/original_verify_gdn_journal/verify_gdn_journal_ladder_logits_scan.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalVerifyGdnJournal`: `capture_ladder`, `capture_ple_snapshot`, `validate_completed_logits`, `lo... -//! Methods of `OriginalVerifyResources`: `new`. +//! Journal captures of the verify window: the ladder diagnostic, PLE history snapshots, and the finite scan over the +//! head logits (post-drain or as graph nodes); also the verify resource bundle and the journal accessors. use super::{ Arg, Command, Context, DeviceBuffer, Error, OriginalCapture, OriginalGraphResources, OriginalVerifyBank, diff --git a/crates/cuda-driver/src/original_verify/original_verify_gdn_journal/verify_gdn_journal_stage_and_commit.rs b/crates/cuda-driver/src/original_verify/original_verify_gdn_journal/verify_gdn_journal_stage_and_commit.rs index 812d175d..deccfa88 100644 --- a/crates/cuda-driver/src/original_verify/original_verify_gdn_journal/verify_gdn_journal_stage_and_commit.rs +++ b/crates/cuda-driver/src/original_verify/original_verify_gdn_journal/verify_gdn_journal_stage_and_commit.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalVerifyGdnJournal`: `capture_layer_stage`, `stage_operands`, `stage_commands`, `stage_conv_com... -//! Methods of `FusedSpans`: `launch`. Functions: `single_command`. Defines `StageOperands`, `FusedSpans`. +//! GDN layer stage (convolution, alpha/beta, recurrence) and the commit graph of the journal: per-layer commit and +//! the fused 36-layer commit launch, with the affine-span checks the fused form relies on. use super::{ Arg, Command, EPS, Error, LAYER_BYTES, OriginalCapture, OriginalGraphResources, OriginalVerifyGdnJournal, diff --git a/crates/cuda-driver/src/original_verify/original_verify_gdn_journal/verify_gdn_journal_window_launches.rs b/crates/cuda-driver/src/original_verify/original_verify_gdn_journal/verify_gdn_journal_window_launches.rs index ce3c4645..22e14570 100644 --- a/crates/cuda-driver/src/original_verify/original_verify_gdn_journal/verify_gdn_journal_window_launches.rs +++ b/crates/cuda-driver/src/original_verify/original_verify_gdn_journal/verify_gdn_journal_window_launches.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalVerifyGdnJournal`: `ple_buffer`, `submit`, `submit_qsa`, `submit_with` and 16 more. -//! Functions: `launch_commands`, `admit_window_launches`, `window_module`. +//! Launch plumbing of the GDN journal: admits and submits window commands and launches on the capture stream, loads +//! window assets, and records the graph inputs, profile stamps and the group doorbell. use super::{ Arg, Command, Context, DeviceBuffer, Error, Module, OriginalCapture, OriginalVerifyGdnJournal, Rc, Result, chain, diff --git a/crates/cuda-driver/src/original_verify/proj/admit_matrix.rs b/crates/cuda-driver/src/original_verify/proj/admit_matrix.rs index b3ee4320..547d2866 100644 --- a/crates/cuda-driver/src/original_verify/proj/admit_matrix.rs +++ b/crates/cuda-driver/src/original_verify/proj/admit_matrix.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalVerifyProjBinding`: `new`, `gdn_addrs`, `qsa_addrs`, `assets`. Functions: `admit_matrix`. -//! Split out of `proj` to keep its files under the line limit. +//! Binding of the native projection matrices of the verifier window: admits each GDN and QSA matrix by exact byte size +//! and hands out per-layer device addresses and the sealed assets those weight types need. use super::{ AssetSpec, Context, Error, GdnProjectionAddrs, HEAD_IQ, HEAD_NATIVE, NativeWeight, OriginalVerifyGdnProjections, diff --git a/crates/cuda-driver/src/original_verify/proj/head_iq_entries_types.rs b/crates/cuda-driver/src/original_verify/proj/head_iq_entries_types.rs index 8f2cd43f..03f7cc54 100644 --- a/crates/cuda-driver/src/original_verify/proj/head_iq_entries_types.rs +++ b/crates/cuda-driver/src/original_verify/proj/head_iq_entries_types.rs @@ -1,5 +1,5 @@ -//! Defines `NativeWeight`, `OriginalVerifyNativeMatrix`, `OriginalVerifyGdnProjections` and 4 more. -//! HEAD_IQ_ENTRIES, BF16_ENTRIES, HEAD_NATIVE, HEAD_IQ, BF16, NativeWeight .... +//! Sealed PTX asset specs of the projection family (native MMVQ, IQ-type MMVQ, BF16 GEMV) with their entry-name tables, +//! and the native weight, projection matrix and address types shared by the projection planners. use super::{AssetSpec, DeviceRef, HEAD_NATIVE_ENTRIES}; diff --git a/crates/cuda-driver/src/original_verify/proj/head_native_entries_types.rs b/crates/cuda-driver/src/original_verify/proj/head_native_entries_types.rs index 99bd4c56..d786d79c 100644 --- a/crates/cuda-driver/src/original_verify/proj/head_native_entries_types.rs +++ b/crates/cuda-driver/src/original_verify/proj/head_native_entries_types.rs @@ -1,5 +1,5 @@ -//! Items of the parent module. -//! HEAD_NATIVE_ENTRIES. +//! Entry-point name table of the sealed native head PTX asset (q8_1 quantize and the MMVQ kernel variants), +//! kept apart because it is a long literal list checked against the PTX. pub(super) const HEAD_NATIVE_ENTRIES: &[&str] = &[ "head_quant", diff --git a/crates/cuda-driver/src/original_verify/proj/q8_1_row_bytes.rs b/crates/cuda-driver/src/original_verify/proj/q8_1_row_bytes.rs index 54f53021..89803530 100644 --- a/crates/cuda-driver/src/original_verify/proj/q8_1_row_bytes.rs +++ b/crates/cuda-driver/src/original_verify/proj/q8_1_row_bytes.rs @@ -1,5 +1,5 @@ -//! Methods of `StridedRows`: `new`. Methods of `Bf16GemvExtents`: `new`. -//! Functions: `q8_1_row_bytes`, `is_iq_kind`, `mmvq_assets`, `mmvq_asset` and 17 more. +//! Launch planners of the projection family: q8_1 quantization, native MMVQ and BF16 GEMV (extents, strides, kernel +//! entry choice), and the window projection producers. Pure addresses in, Launch out. use super::{ A, ArenaMap, AssetSpec, BF16, BF16_ENTRIES, Error, GdnProjectionAddrs, HEAD_IQ, HEAD_NATIVE, Launch, LaunchExtent, diff --git a/crates/cuda-driver/src/original_verify/qsa/assets.rs b/crates/cuda-driver/src/original_verify/qsa/assets.rs index 82c85dd3..d5321190 100644 --- a/crates/cuda-driver/src/original_verify/qsa/assets.rs +++ b/crates/cuda-driver/src/original_verify/qsa/assets.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalVerifyQsaPolicy`: `mode17`, `validate`. Methods of `QsaRope`: `new`, `from_rope`, `is_identity`. -//! Functions: `assets`, `cluster_assets`, `daily_assets`, `shared_attributes` and 4 more. +//! QSA (quantized sparse attention) setup of the verifier window: sealed assets and shared-memory attributes, the +//! mode17 policy and its validation, RoPE constants, and the KV and weight bindings with their admission checks. use super::{ ATTENTION, ATTN_CHUNK, AssetSpec, CLUSTER, CLUSTER_ENTRIES, Context, DECODE_POSTOPS, Error, GATE, KV_APPEND, diff --git a/crates/cuda-driver/src/original_verify/qsa/qsa_window.rs b/crates/cuda-driver/src/original_verify/qsa/qsa_window.rs index 39d1eeed..ae08106f 100644 --- a/crates/cuda-driver/src/original_verify/qsa/qsa_window.rs +++ b/crates/cuda-driver/src/original_verify/qsa/qsa_window.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `qsa_window_prelude_rows`, `qsa_window_query_key_paths`, `qsa_window_select_and_attend`. -//! Split out of `qsa` to keep its files under the line limit. +//! Parent of QsaWindow, the launch planner of one QSA layer in the verifier window; its submodules split the prelude +//! rows, the query/key paths and the select-and-attend steps while sharing these imports. use super::{ A, ATTENTION, ATTN_CHUNK, ArenaMap, Bf16GemvExtents, CLUSTER, CLUSTER_ENTRIES, CLUSTER_MAX_QUERIES, DECODE_POSTOPS, diff --git a/crates/cuda-driver/src/original_verify/qsa/qsa_window/qsa_window_query_key_paths.rs b/crates/cuda-driver/src/original_verify/qsa/qsa_window/qsa_window_query_key_paths.rs index 0459ec45..85d5d571 100644 --- a/crates/cuda-driver/src/original_verify/qsa/qsa_window/qsa_window_query_key_paths.rs +++ b/crates/cuda-driver/src/original_verify/qsa/qsa_window/qsa_window_query_key_paths.rs @@ -1,5 +1,5 @@ -//! Methods of `QsaWindow`: `new`, `span`, `rows`, `rms` and 12 more. Functions: `append_launch`. -//! Split out of `qsa_window` to keep its files under the line limit. +//! QsaWindow launch planners for the query, key and index paths: RMS norm and RoPE, indexer k and q projections, +//! k norm with RoPE, q/gate split, and the KV append into the resident pool and host copy. use super::{ A, ArenaMap, Bf16GemvExtents, DECODE_POSTOPS, EPS, Error, KV_APPEND, Launch, LaunchExtent, OriginalVerifyGeometry, diff --git a/crates/cuda-driver/src/original_verify/qsa/qsa_window/qsa_window_select_and_attend.rs b/crates/cuda-driver/src/original_verify/qsa/qsa_window/qsa_window_select_and_attend.rs index 7013d241..f2f8030e 100644 --- a/crates/cuda-driver/src/original_verify/qsa/qsa_window/qsa_window_select_and_attend.rs +++ b/crates/cuda-driver/src/original_verify/qsa/qsa_window/qsa_window_select_and_attend.rs @@ -1,5 +1,5 @@ -//! Methods of `QsaWindow`: `block_scores_topk`, `scores_launch`, `topk_launch`, `kv_resolve` and 5 more. -//! Defines `AttnDims`, `AttnSpans`. +//! QsaWindow launch planners for block selection and attention: block scores and top-k, KV streaming resolve, +//! split decode attention (chunk and merge) and the output gate. use super::{ A, ATTENTION, ATTN_CHUNK, CLUSTER, CLUSTER_ENTRIES, CLUSTER_MAX_QUERIES, Error, GATE, Launch, LaunchExtent, diff --git a/crates/cuda-driver/src/original_verify/schedule/commit_sync_forced.rs b/crates/cuda-driver/src/original_verify/schedule/commit_sync_forced.rs index cf50a6f0..df488b80 100644 --- a/crates/cuda-driver/src/original_verify/schedule/commit_sync_forced.rs +++ b/crates/cuda-driver/src/original_verify/schedule/commit_sync_forced.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalVerifyCpuSink`: `with_output`. -//! Methods of `OriginalVerifier`: `new`, `open`, `unopened`, `bank` and 9 more. +//! Construction and window recording of OriginalVerifier: opens the bank, records the window and commit graphs (fused +//! or per-layer commit), sets the PCIe mode and split, plus the CPU sink output accessor. use super::{ Context, Error, OriginalCapture, OriginalCapturePolicy, OriginalEventKind, OriginalNativeHeadGraphResources, diff --git a/crates/cuda-driver/src/original_verify/schedule/original_verifier.rs b/crates/cuda-driver/src/original_verify/schedule/original_verifier.rs index 7fc00a37..ae8a90ba 100644 --- a/crates/cuda-driver/src/original_verify/schedule/original_verifier.rs +++ b/crates/cuda-driver/src/original_verify/schedule/original_verifier.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalVerifier`: `run`, `commit`, `commit_after_stage`, `complete_commit_sync`. -//! Split out of `schedule` to keep its files under the line limit. +//! Run and commit entry points of OriginalVerifier: run executes the cached window graph with the CPU/GPU split, +//! commit stages the accepted rows and launches the commit graph, asynchronously or drained. use super::{ Error, NativeHeadSampling, OriginalGpuStream, OriginalNativeHeadGraphResources, OriginalVerifier, diff --git a/crates/cuda-driver/src/original_verify/schedule/verifier_commit_window_lifecycle.rs b/crates/cuda-driver/src/original_verify/schedule/verifier_commit_window_lifecycle.rs index 21d63c85..dd04915f 100644 --- a/crates/cuda-driver/src/original_verify/schedule/verifier_commit_window_lifecycle.rs +++ b/crates/cuda-driver/src/original_verify/schedule/verifier_commit_window_lifecycle.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalVerifier`: `pending_commit_event`, `wait_commit`, `complete_pending_commit`, `discard_window`... -//! Split out of `schedule` to keep its files under the line limit. +//! Post-run lifecycle of OriginalVerifier: pending commit wait, discarding a window for a retry, access to the +//! completed window, committed GDN and QSA state, diagnostics, and the watchdog release of the GPU waits. use super::{ DeviceBuffer, Duration, Error, Instant, OriginalGpuEvent, OriginalNativeHeadGraphResources, OriginalVerifier, diff --git a/crates/cuda-driver/src/original_verify/schedule/verifier_logits_diagnostics_close.rs b/crates/cuda-driver/src/original_verify/schedule/verifier_logits_diagnostics_close.rs index f443dc7d..f09ebd14 100644 --- a/crates/cuda-driver/src/original_verify/schedule/verifier_logits_diagnostics_close.rs +++ b/crates/cuda-driver/src/original_verify/schedule/verifier_logits_diagnostics_close.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalVerifier`: `read_logit_rows`, `copy_logits`, `window_logprobs`, `window_logprobs_topk` and 7 ... -//! Implements `Drop for OriginalVerifier`. +//! Read-back side of OriginalVerifier: logits and logprob rows, bring-up residual and ladder dumps, the bounded +//! stream drain that aborts GPU waits, and the close and Drop teardown. use super::{ Context, DeviceBuffer, Duration, Error, Instant, LogitRows, LogprobReadout, OriginalGpuStream, diff --git a/crates/cuda-driver/src/original_verify/share_window_modules.rs b/crates/cuda-driver/src/original_verify/share_window_modules.rs index 47a365c8..82e1b5b3 100644 --- a/crates/cuda-driver/src/original_verify/share_window_modules.rs +++ b/crates/cuda-driver/src/original_verify/share_window_modules.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `verify_bank_and_canonical_gdn_open`, `original_verify_bank`, `physical` and 1 more. -//! Split out of `original_verify` to keep its files under the line limit. +//! Parent of the verify bank files: opening the bank and canonical GDN, the bank staging, its physical resources and +//! the plan and window row accessors, with the imports they share. use super::{ ASSET, ASSET_SHA, Arg, CANONICAL_BYTES, Canonical, Cell, Command, Context, DeviceBuffer, DeviceRef, ENTRIES, Error, diff --git a/crates/cuda-driver/src/original_verify/share_window_modules/original_verify_bank.rs b/crates/cuda-driver/src/original_verify/share_window_modules/original_verify_bank.rs index da0a506e..fabcc860 100644 --- a/crates/cuda-driver/src/original_verify/share_window_modules/original_verify_bank.rs +++ b/crates/cuda-driver/src/original_verify/share_window_modules/original_verify_bank.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalVerifyBank`: `new`, `staged_window`, `staged_keep`, `completed_row` and 14 more. -//! Split out of `share_window_modules` to keep its files under the line limit. +//! Host-side staging of OriginalVerifyBank: creation, staging of tokens, positions, PLE values and the commit keep +//! count into the mapped words, completed-row access, and the release of the GPU waits. use super::{ ASSET, ASSET_SHA, Context, Error, OriginalVerifyBank, OriginalVerifyGeometry, OriginalVerifyLayout, diff --git a/crates/cuda-driver/src/original_verify/share_window_modules/physical.rs b/crates/cuda-driver/src/original_verify/share_window_modules/physical.rs index 844716f7..ff32cce0 100644 --- a/crates/cuda-driver/src/original_verify/share_window_modules/physical.rs +++ b/crates/cuda-driver/src/original_verify/share_window_modules/physical.rs @@ -1,5 +1,5 @@ -//! Methods of `Physical`: `validate`, `span`, `ensure_window_assets`, `select_ready` and 15 more. -//! Implements `Drop for Physical`. Functions: `group_specs`, `reuse_loaded`. Defines `WindowGroup`, `ReadyModule`. +//! Physical: the device resources behind a verify bank (kernel modules, mapped staging, arena, profile stamps), its +//! window-module loading with sharing across banks of a context, shared-memory configuration, and teardown. use super::{ Cell, Context, DeviceBuffer, ENTRIES, Error, MappedAllocation, Module, OriginalVerifyLayout, Physical, QSA_ENTRIES, diff --git a/crates/cuda-driver/src/original_verify/share_window_modules/verify_bank_and_canonical_gdn_open.rs b/crates/cuda-driver/src/original_verify/share_window_modules/verify_bank_and_canonical_gdn_open.rs index e9c57ef3..7b4bff6a 100644 --- a/crates/cuda-driver/src/original_verify/share_window_modules/verify_bank_and_canonical_gdn_open.rs +++ b/crates/cuda-driver/src/original_verify/share_window_modules/verify_bank_and_canonical_gdn_open.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `original_verify_canonical_gdn`, `original_verify_bank`. -//! Methods of `Canonical`: `upload_layers`, `reseed`, `allocated_bytes`, `validate_context` and 4 more. +//! Entry points that open a verify bank and the canonical GDN image on a Context, the checked helpers shared by the +//! bank files (admit, poison, sealed asset), and the canonical state upload, reseed, read and close. use super::{ ASSET, ASSET_SHA, Arg, CANONICAL_BYTES, Canonical, Cell, Command, Context, DeviceBuffer, ENTRIES, Error, diff --git a/crates/cuda-driver/src/original_verify/share_window_modules/verify_bank_plan_and_window_rows.rs b/crates/cuda-driver/src/original_verify/share_window_modules/verify_bank_plan_and_window_rows.rs index 7c1b10b5..e3337dc4 100644 --- a/crates/cuda-driver/src/original_verify/share_window_modules/verify_bank_plan_and_window_rows.rs +++ b/crates/cuda-driver/src/original_verify/share_window_modules/verify_bank_plan_and_window_rows.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalVerifyBank`: `read_profile`, `doorbell_sequence`, `publish_empty_plan`, `zero_plan_header` an... -//! Methods of `OriginalVerifyRow`: `position`, `validate_context`, `residual`. +//! Bank-side plan and journal access: profile read, doorbell sequence, empty plan publication, PCIe source retention, +//! GDN journal construction with operand checks, and the accessors of completed rows and windows. use super::{ Context, DeviceBuffer, DeviceRef, Error, MappedAllocation, OriginalGraphResources, OriginalVerifyBank, diff --git a/crates/cuda-driver/src/original_verify/window_ops/all_window_assets.rs b/crates/cuda-driver/src/original_verify/window_ops/all_window_assets.rs index 7d9be575..b1c95a89 100644 --- a/crates/cuda-driver/src/original_verify/window_ops/all_window_assets.rs +++ b/crates/cuda-driver/src/original_verify/window_ops/all_window_assets.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalVerifyExpertLayout`: `new`, `with_role_bytes`, `blob_bytes`, `role_bytes`. -//! Methods of `OriginalVerifyWindowResources`: `new`, `rows`, `with_projections`, `with_gr` and 4 more. +//! Resources of a recorded verify window: the list of every sealed kernel asset, the expert layout, and the window +//! resource bundle that attaches projections, GR, QSA and MoE bindings, loads assets before capture and serves weights. use super::{ AssetSpec, Context, Error, GdnProjectionAddrs, GrConfig, HcHalf, MoeLayerAddrs, OriginalGraphResources, diff --git a/crates/cuda-driver/src/original_verify/window_ops/original_verifier.rs b/crates/cuda-driver/src/original_verify/window_ops/original_verifier.rs index f9fdc60c..b787c3c8 100644 --- a/crates/cuda-driver/src/original_verify/window_ops/original_verifier.rs +++ b/crates/cuda-driver/src/original_verify/window_ops/original_verifier.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalVerifier`: `record_literal_window`, `record_all`. -//! Functions: `resolve_cluster_topk`, `resolve_sm120_switches`, `pcie_role_bytes`, `graph_oom_at`. +//! Recording of all verify window graphs (T = 1..max_t) and the commit graph by OriginalVerifier, with the +//! per-recording resolution of cluster top-k and sm_120 switches, PCIe role bytes, and graph out-of-memory naming. use super::{ Error, OriginalVerifier, OriginalVerifyGraphResources, OriginalVerifyWindowOps, OriginalVerifyWindowResources, diff --git a/crates/cuda-driver/src/original_verify/window_ops/window_ops_kernels_and_pcie_plan.rs b/crates/cuda-driver/src/original_verify/window_ops/window_ops_kernels_and_pcie_plan.rs index e4e15ee6..eeab0dc1 100644 --- a/crates/cuda-driver/src/original_verify/window_ops/window_ops_kernels_and_pcie_plan.rs +++ b/crates/cuda-driver/src/original_verify/window_ops/window_ops_kernels_and_pcie_plan.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalVerifyWindowOps`: `capture_finite_verdict`, `plan_copy_addresses`, `wait_plan_glue`, `copy_hi... -//! Implements `WindowOps for OriginalVerifyWindowOps`. Functions: `pcie_fetch_launch`, `pcie_rebase_command`. +//! The WindowOps implementation that turns each window step (embed, GR, projections, GDN, QSA, router, experts, PCIe +//! staging, combine, head) into recorded launches, plus the finite-verdict capture and PCIe fetch helpers. use super::side_qsa_branches::QsaSideLayer; use super::{ diff --git a/crates/cuda-driver/src/original_verify_gpu_plan/tests.rs b/crates/cuda-driver/src/original_verify_gpu_plan/tests.rs index 6af32b33..7fed2165 100644 --- a/crates/cuda-driver/src/original_verify_gpu_plan/tests.rs +++ b/crates/cuda-driver/src/original_verify_gpu_plan/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the GPU plan sink: DMA option defaults per platform, the plan block carve, empty and corrupt plans, +//! and when flag B waits for the PCIe staging copies. use super::*; diff --git a/crates/cuda-driver/src/original_verify_window_gr/tests.rs b/crates/cuda-driver/src/original_verify_window_gr/tests.rs index 22c6cd31..24ac948e 100644 --- a/crates/cuda-driver/src/original_verify_window_gr/tests.rs +++ b/crates/cuda-driver/src/original_verify_window_gr/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the GR window planner: launch words, variant choice from card limits, fused and tiled down kernels, +//! head chain and head mix, against a fake arena layout; submodules hold the per-kernel cases. use super::super::kernels::{LayoutMap, test_geometry}; use super::*; diff --git a/crates/cuda-driver/src/original_verify_window_moe/tests.rs b/crates/cuda-driver/src/original_verify_window_moe/tests.rs index a40b5bed..48a3dd22 100644 --- a/crates/cuda-driver/src/original_verify_window_moe/tests.rs +++ b/crates/cuda-driver/src/original_verify_window_moe/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the MoE window planner against a fake arena: launch ABI against the PTX entries, plus the PCIe staging copy +//! kernel, down sub16 plan, hit add and shared gate cases in the submodules. use super::super::kernels::{LayoutMap, test_geometry}; use super::*; diff --git a/crates/cuda-driver/src/original_verify_window_ops/tests.rs b/crates/cuda-driver/src/original_verify_window_ops/tests.rs index fa2d0633..317c9682 100644 --- a/crates/cuda-driver/src/original_verify_window_ops/tests.rs +++ b/crates/cuda-driver/src/original_verify_window_ops/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the window asset and layout bookkeeping: graph out-of-memory naming, sealed and unique window assets, +//! and the expert layout bounds. use super::*; diff --git a/crates/cuda-driver/src/original_verify_window_planner/tests.rs b/crates/cuda-driver/src/original_verify_window_planner/tests.rs index 0bc5d7b1..bd115e29 100644 --- a/crates/cuda-driver/src/original_verify_window_planner/tests.rs +++ b/crates/cuda-driver/src/original_verify_window_planner/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the whole window recorder with a fake WindowOps and weights: the planned launch order for every window +//! size and group, with submodules for the fused GR down, QSA prelude, head chain and combine switches. use super::super::kernels::{LayoutMap, test_geometry}; use super::super::moe::MoeLayerAddrs; diff --git a/crates/cuda-driver/src/original_verify_window_proj/tests.rs b/crates/cuda-driver/src/original_verify_window_proj/tests.rs index a1523298..5376dd99 100644 --- a/crates/cuda-driver/src/original_verify_window_proj/tests.rs +++ b/crates/cuda-driver/src/original_verify_window_proj/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the projection planners: pinned assets and entries, q8_1 quantize and MMVQ dispatch, BF16 GEMV single or +//! multi choice, IQ kinds, and the window projection addresses and matrix sizes. use super::*; diff --git a/crates/cuda-driver/src/original_verify_window_qsa/tests.rs b/crates/cuda-driver/src/original_verify_window_qsa/tests.rs index 66b53468..156683d0 100644 --- a/crates/cuda-driver/src/original_verify_window_qsa/tests.rs +++ b/crates/cuda-driver/src/original_verify_window_qsa/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the QsaWindow planners against a fake arena: launch ABI against the PTX entries; submodules cover the +//! q path splits, sealed asset pins and the Original weight sizes. use super::super::kernels::{LayoutMap, test_geometry}; use super::*; diff --git a/crates/cuda-driver/src/original_verify_window_record/tests.rs b/crates/cuda-driver/src/original_verify_window_record/tests.rs index 5bb69f12..78723db4 100644 --- a/crates/cuda-driver/src/original_verify_window_record/tests.rs +++ b/crates/cuda-driver/src/original_verify_window_record/tests.rs @@ -1,4 +1,4 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the window recorder call order with a logging WindowOps: layer sequences, rings, flags and split windows. use super::*; diff --git a/crates/cuda-driver/src/ple_batch_ffi/driver_backed/blas.rs b/crates/cuda-driver/src/ple_batch_ffi/driver_backed/blas.rs index ae7371a4..280e261f 100644 --- a/crates/cuda-driver/src/ple_batch_ffi/driver_backed/blas.rs +++ b/crates/cuda-driver/src/ple_batch_ffi/driver_backed/blas.rs @@ -1,5 +1,5 @@ -//! Methods of `Blas`: `load`, `init_handle`, `stream`, `gemm` and 7 more. -//! Functions: `gemm_shape_admitted`, `gdn_shape_admitted`, `gdn_bf16_shape_admitted`, `gdn_f16_shape_admitted`. +//! cuBLAS wrapper of the batch FFI: loads the library with a private stream and workspace, the single GemmEx call and +//! its BF16 and F16 entry points, and the admission of the closed Original GEMM and GDN shapes. use super::{ Blas, BufferHandle, Create, Destroy, Error, GdnGemmLayout, Gemm, GemmDims, GemmOperands, GemmScalars, InputType, diff --git a/crates/cuda-driver/src/ple_batch_ffi/driver_backed/kernel_module_launch_and_close.rs b/crates/cuda-driver/src/ple_batch_ffi/driver_backed/kernel_module_launch_and_close.rs index b00bce01..cc1176a4 100644 --- a/crates/cuda-driver/src/ple_batch_ffi/driver_backed/kernel_module_launch_and_close.rs +++ b/crates/cuda-driver/src/ple_batch_ffi/driver_backed/kernel_module_launch_and_close.rs @@ -1,5 +1,5 @@ -//! Methods of `Blas`: `close_inner`. -//! Methods of `KernelModule`: `load`, `init_functions`, `launch`, `launch_dynamic` and 5 more. +//! Closing of the cuBLAS wrapper, and the KernelModule that loads a PTX image and launches its entries (plain, dynamic +//! shared memory, cluster), reports the device geometry, and closes. use super::{ BatchArg, Blas, CStr, ClusterShape, Destroy, Error, FuncSetAttribute, KernelArguments, KernelModule, Launch, diff --git a/crates/cuda-driver/src/ple_batch_ffi/driver_backed/library.rs b/crates/cuda-driver/src/ple_batch_ffi/driver_backed/library.rs index 2dbc80b2..b48f9d0c 100644 --- a/crates/cuda-driver/src/ple_batch_ffi/driver_backed/library.rs +++ b/crates/cuda-driver/src/ple_batch_ffi/driver_backed/library.rs @@ -1,5 +1,5 @@ -//! Methods of `Library`: `open`. Implements `Drop for Library`. Functions: `check`. -//! Split out of `enabled` to keep its files under the line limit. +//! Owned dlopen handle of the private driver library used by the PLE batch FFI (open, dlclose on drop) and the +//! check helper that turns a nonzero driver return code into Error::Driver. use super::{CStr, Error, Library, Result, c_int}; diff --git a/crates/cuda-driver/src/ple_batch_ffi/kernel_arguments.rs b/crates/cuda-driver/src/ple_batch_ffi/kernel_arguments.rs index 49a96990..7f8d816a 100644 --- a/crates/cuda-driver/src/ple_batch_ffi/kernel_arguments.rs +++ b/crates/cuda-driver/src/ple_batch_ffi/kernel_arguments.rs @@ -1,5 +1,5 @@ -//! Methods of `KernelArguments`: `new`. Methods of `Blas`: `load`, `stream`, `gemm_bf16`, `gemm_f16` and 4 more. -//! Split out of `ple_batch_ffi` to keep its files under the line limit. +//! Argument pack for PLE batch kernel launches, plus the stub Blas and KernelModule used on builds without a 64-bit +//! Linux/Windows CUDA driver: every operation there answers Error::UnsupportedPlatform. use super::{BatchArg, KernelArguments}; diff --git a/crates/cuda-driver/src/ple_batch_queue/assets.rs b/crates/cuda-driver/src/ple_batch_queue/assets.rs index 5df09b44..a447fa5d 100644 --- a/crates/cuda-driver/src/ple_batch_queue/assets.rs +++ b/crates/cuda-driver/src/ple_batch_queue/assets.rs @@ -1,5 +1,6 @@ -//! Methods of `PleBatchCompletion`: `rows`, `numerical_refusal`, `take_row`. -//! Methods of `PleBatchQueue`: `read_row`, `settle_row`. Functions: `assets`, `check_ptx`. +//! Sealed PTX assets and row read-back of the PLE batch queue: verifies pinned PTX digest and length, and reads +//! one completed row (streams and history) to the host, poisoning the context if the drain is uncertain. +//! Also holds the Context constructors of the queue and the completion that reports numerical refusals. use super::{ BufferHandle, Context, Error, PACK_PTX, PACK_PTX_BYTES, PACK_PTX_SHA256, PTX, PTX_BYTES, PTX_SHA256, diff --git a/crates/cuda-driver/src/ple_batch_queue/ple_batch_queue_drop.rs b/crates/cuda-driver/src/ple_batch_queue/ple_batch_queue_drop.rs index bfc3a540..e31d8223 100644 --- a/crates/cuda-driver/src/ple_batch_queue/ple_batch_queue_drop.rs +++ b/crates/cuda-driver/src/ple_batch_queue/ple_batch_queue_drop.rs @@ -1,5 +1,5 @@ -//! Methods of `Command`: `launch`. Methods of `ScanExtent`: `new`. Implements `Drop for PleBatchQueue`. -//! Functions: `push`, `scan`, `staging`, `float_staging` and 2 more. Defines `ScanExtent`. +//! Command list primitives of the PLE batch queue: how a recorded Kernel or Gemm command is launched, helpers that +//! append kernel and finite-scan commands, host staging/decode of f32 buffers, and the queue Drop (best-effort close). use super::{A, Blas, BufferHandle, Command, Error, KernelArguments, KernelModule, PleBatchQueue, Result}; use crate::ple_batch_ffi::{GemmDims, GemmOperands, GemmScalars, LinearLaunch}; diff --git a/crates/cuda-driver/src/ple_batch_queue/ple_batch_queue_operations/ple_batch_queue_bring_up.rs b/crates/cuda-driver/src/ple_batch_queue/ple_batch_queue_operations/ple_batch_queue_bring_up.rs index 7ca3ab91..89e5c30a 100644 --- a/crates/cuda-driver/src/ple_batch_queue/ple_batch_queue_operations/ple_batch_queue_bring_up.rs +++ b/crates/cuda-driver/src/ple_batch_queue/ple_batch_queue_operations/ple_batch_queue_bring_up.rs @@ -1,5 +1,6 @@ -//! Methods of `PleBatchQueue`: `new`, `new_capacity`, `init_resources`, `load_modules` and 9 more. -//! Functions: `batch_sizes`, `check_required`. +//! Bring-up and invariants of the PLE batch queue: sizes its 15 device buffers for a row capacity, checks the memory +//! budget, loads the pack and batch kernel modules, and validates that buffers and weights belong to the context, have +//! the right size and do not overlap. use super::{ BufferHandle, Context, DeviceBuffer, ENTRIES, Error, KernelModule, PACK_ENTRIES, PLE_BATCH_QUEUE_BYTES, diff --git a/crates/cuda-driver/src/ple_batch_queue/ple_batch_queue_operations/ple_batch_queue_close.rs b/crates/cuda-driver/src/ple_batch_queue/ple_batch_queue_operations/ple_batch_queue_close.rs index 095c1c2f..837b4bec 100644 --- a/crates/cuda-driver/src/ple_batch_queue/ple_batch_queue_operations/ple_batch_queue_close.rs +++ b/crates/cuda-driver/src/ple_batch_queue/ple_batch_queue_operations/ple_batch_queue_close.rs @@ -1,5 +1,5 @@ -//! Methods of `PleBatchQueue`: `close`, `close_inner`, `close_guard`. Functions: `close_or_leak`, `poison_on_error`. -//! Split out of `ple_batch_queue_methods` to keep its files under the line limit. +//! Teardown of the PLE batch queue: closes kernel modules and releases device buffers under the context guard, and +//! leaks them instead of freeing when the context is poisoned, so a failed close never double-frees. use super::{Context, Error, PleBatchQueue, Result, combine}; use crate::CurrentGuard; diff --git a/crates/cuda-driver/src/ple_batch_queue/ple_batch_queue_operations/ple_batch_queue_compose.rs b/crates/cuda-driver/src/ple_batch_queue/ple_batch_queue_operations/ple_batch_queue_compose.rs index a60cac91..4c5f9ce3 100644 --- a/crates/cuda-driver/src/ple_batch_queue/ple_batch_queue_operations/ple_batch_queue_compose.rs +++ b/crates/cuda-driver/src/ple_batch_queue/ple_batch_queue_operations/ple_batch_queue_compose.rs @@ -1,5 +1,5 @@ -//! Methods of `PleBatchQueue`: `compose`. -//! Split out of `ple_batch_queue_methods` to keep its files under the line limit. +//! The public compose entry of the PLE batch queue: stages a batch, uploads, launches the kernels and GEMMs, reads +//! the numerical statuses back and settles the result; the phase helpers it calls live in compose_phases. use super::{NativeBatchWorkspace, PleBatchCompletion, PleBatchQueue, PleBatchSources, PleClosedWeights, Result}; diff --git a/crates/cuda-driver/src/projection_grids_and_bounds.rs b/crates/cuda-driver/src/projection_grids_and_bounds.rs index efab9b9a..f280237a 100644 --- a/crates/cuda-driver/src/projection_grids_and_bounds.rs +++ b/crates/cuda-driver/src/projection_grids_and_bounds.rs @@ -1,5 +1,5 @@ -//! Functions: `q4_k_native_indices_fit`, `q4_k_last_signed_byte_offset`, `bounded_projection_size`, `check_projectio... -//! Split out of `crate` to keep its files under the line limit. +//! Host-side shape admission of dense Q4_K and generic projections and of Q5_K: byte sizes, quantizer and projection +//! grids, the signed 32-bit offset limit of the Q4_K PTX, and the alias/extent checks of the three buffers. use super::{DenseFormat, Error, ProjectionKind, ProjectionShape, ProjectionSpec, Q5KShape, Result, ffi, valid_size}; diff --git a/crates/cuda-driver/src/prompt_sync_trace_types.rs b/crates/cuda-driver/src/prompt_sync_trace_types.rs index ab682ac9..11d42a23 100644 --- a/crates/cuda-driver/src/prompt_sync_trace_types.rs +++ b/crates/cuda-driver/src/prompt_sync_trace_types.rs @@ -1,5 +1,5 @@ -//! Defines `PromptSyncTrace`, `Driver`, `Device` and 8 more. -//! PromptSyncTrace, Error, Result, Bf16ProjectionShape, Driver, Device .... +//! Core handle types of the CUDA driver crate: Driver, Device, Context (budget, poison flag, per-context kernel slots), +//! the fixed-kernel selectors, the projection shape record and the PromptSyncTrace bring-up guard. use super::{Cell, DeviceBuffer, Rc, RefCell, experimental, ffi, kar_decode_levels, original_verify, qwen_dispatch}; #[cfg(all(feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))] diff --git a/crates/cuda-driver/src/q5_kshape_types.rs b/crates/cuda-driver/src/q5_kshape_types.rs index 638b5f60..5da4b6f1 100644 --- a/crates/cuda-driver/src/q5_kshape_types.rs +++ b/crates/cuda-driver/src/q5_kshape_types.rs @@ -1,5 +1,5 @@ -//! Defines `Q5KShape`, `Q6KShape`, `MatvecShape` and 2 more. -//! Q5KShape, Q6KShape, MatvecShape, CurrentGuard, DeviceBuffer. +//! Plain records shared by the projection code: Q5_K, Q6_K and matvec shapes (byte sizes and launch grids), the +//! CurrentGuard push/pop context guard and DeviceBuffer, the exact byte allocation borrowed from a Context. use super::{Context, PhantomData, Rc, ffi}; diff --git a/crates/cuda-driver/src/q6_k_shape.rs b/crates/cuda-driver/src/q6_k_shape.rs index dfd983e3..55234643 100644 --- a/crates/cuda-driver/src/q6_k_shape.rs +++ b/crates/cuda-driver/src/q6_k_shape.rs @@ -1,5 +1,5 @@ -//! Functions: `q6_k_shape`, `q6_abi_extents`, `q6_checked_bytes`, `q6_grids` and 4 more. -//! Split out of `crate` to keep its files under the line limit. +//! Shape admission for Q6_K projections, the f32 matvec and the vector add: checked byte sizes, ABI extents and launch +//! grids, plus the allocation checks that keep the matvec output from aliasing its inputs. use super::{Error, MatvecShape, Q6KShape, Result, ffi, valid_size}; diff --git a/crates/cuda-driver/src/qsa_late/gpu_tests/rng.rs b/crates/cuda-driver/src/qsa_late/gpu_tests/rng.rs index 3941d94a..f6e73761 100644 --- a/crates/cuda-driver/src/qsa_late/gpu_tests/rng.rs +++ b/crates/cuda-driver/src/qsa_late/gpu_tests/rng.rs @@ -1,5 +1,5 @@ -//! Methods of `Rng`: `next`. Functions: `upload`, `download`, `with_gpu`, `handle` and 8 more. -//! Split out of `gpu_tests` to keep its files under the line limit. +//! Shared fixtures of the QSA late-kernel GPU tests: a xorshift Rng, device upload/download, with_gpu setup, +//! synthetic block scores and step words, and the checks of the fast top-k and score scan against the Original kernels. use super::{A, CAP, Context, DeviceBuffer, Driver, ENABLE, KernelArguments, Rng, SelectionRig, TOPK_FAST, scan_both}; use crate::ple_batch_ffi::LinearLaunch; diff --git a/crates/cuda-driver/src/qsa_late/gpu_tests/scan_both.rs b/crates/cuda-driver/src/qsa_late/gpu_tests/scan_both.rs index 306771e3..2dacf89b 100644 --- a/crates/cuda-driver/src/qsa_late/gpu_tests/scan_both.rs +++ b/crates/cuda-driver/src/qsa_late/gpu_tests/scan_both.rs @@ -1,5 +1,5 @@ -//! Functions: `scan_both`, `bench_cases`, `bench_scores`, `topk_variants` and 4 more. -//! Split out of `gpu_tests` to keep its files under the line limit. +//! GPU test helpers that run the Original score scan and the late fast scan on the same scores, the benchmark case +//! table with its synthetic score generator, and the top-k variants (ref, fast, wide, sample, cluster) that are timed. use super::{ A, BenchRig, CAP, Context, DeviceBuffer, KernelArguments, Rng, Run, SCORE_SCAN_FAST, SelectionRig, TOPK_FAST, diff --git a/crates/cuda-driver/src/qsa_late/gpu_tests/time_scores_and_topk.rs b/crates/cuda-driver/src/qsa_late/gpu_tests/time_scores_and_topk.rs index d2ad47ab..ab55c2fc 100644 --- a/crates/cuda-driver/src/qsa_late/gpu_tests/time_scores_and_topk.rs +++ b/crates/cuda-driver/src/qsa_late/gpu_tests/time_scores_and_topk.rs @@ -1,5 +1,5 @@ -//! Functions: `time_scores_and_topk`, `time_warm`. -//! Split out of `gpu_tests` to keep its files under the line limit. +//! GPU timing helper of the QSA late tests: launches the decode scores kernel and the reference top-k at one +//! (position, query count) shape and reports warm microseconds per launch. use super::{ A, CAP, Context, DeviceBuffer, KernelArguments, KernelModule, Rng, decode_inputs, handle, topk_args, upload, diff --git a/crates/cuda-driver/src/qsa_native_batch/native_projections.rs b/crates/cuda-driver/src/qsa_native_batch/native_projections.rs index 75aec2f5..ea836fd1 100644 --- a/crates/cuda-driver/src/qsa_native_batch/native_projections.rs +++ b/crates/cuda-driver/src/qsa_native_batch/native_projections.rs @@ -1,5 +1,6 @@ -//! Methods of `QsaNativeBatchWorkspace`: `project`, `project_io`, `launch_project`, `reset_status` and 10 more. -//! Methods of `ProjectionShape`: `new`, `inputs`. Implements `Drop for QsaNativeBatchWorkspace`. +//! The projection stage of the QSA native batch workspace: packs activations, scans inputs and weights for non-finite +//! values, dequantizes quantized weights to F16 and runs the vendor GEMMs for the five input projections and the gated +//! Out projection, then settles the status words, with its close and Drop. use super::{ A, DeviceBuffer, Error, KernelArguments, KernelModule, NativeBatchWorkspace, QsaGatedAttention, QsaInputWeights, diff --git a/crates/cuda-driver/src/qsa_native_batch/qsa_native_kind.rs b/crates/cuda-driver/src/qsa_native_batch/qsa_native_kind.rs index 5ef24352..31fbad64 100644 --- a/crates/cuda-driver/src/qsa_native_batch/qsa_native_kind.rs +++ b/crates/cuda-driver/src/qsa_native_batch/qsa_native_kind.rs @@ -1,5 +1,5 @@ -//! Methods of `QsaNativeKind`: `entry`, `block`. -//! Methods of `Context`: `qsa_native_batch_workspace`, `qsa_native_batch_workspace_for_prompt`. +//! Construction and buffer handling of the QSA native batch workspace: weight format table (Q4_K, Q5_K, Q6_K, +//! IQ4_XS), capacity and budget admission, module loading, span checks, host upload and readback, Context hooks. use super::{ Context, DEQUANT_PTX, DeviceBuffer, Error, KernelModule, NativeBatchWorkspace, PTX, QsaNativeBatchWorkspace, diff --git a/crates/cuda-driver/src/qsa_prompt_attention/attention_kernel_plan_and_passes.rs b/crates/cuda-driver/src/qsa_prompt_attention/attention_kernel_plan_and_passes.rs index 9270213a..565f926b 100644 --- a/crates/cuda-driver/src/qsa_prompt_attention/attention_kernel_plan_and_passes.rs +++ b/crates/cuda-driver/src/qsa_prompt_attention/attention_kernel_plan_and_passes.rs @@ -1,5 +1,5 @@ -//! Methods of `KernelPlan`: `entry`. Defines `KernelPlan`, `KernelEntry`, `AttnPasses` and 1 more. -//! Split out of `qsa_prompt_attention` to keep its files under the line limit. +//! Plain types that describe one QSA prompt attention launch: the kernel plan (module, entries, shared bytes), the +//! launch target, the device addresses the three passes use, and the Runner signature; the logic lives in submodules. use super::{ Arg, Arguments, Context, DeviceBuffer, DeviceCaps, Error, LaunchGeometry, Module, NativeBatchWorkspace, diff --git a/crates/cuda-driver/src/qsa_prompt_attention/attention_kernel_plan_and_passes/attention_passes.rs b/crates/cuda-driver/src/qsa_prompt_attention/attention_kernel_plan_and_passes/attention_passes.rs index ce58130e..ef144870 100644 --- a/crates/cuda-driver/src/qsa_prompt_attention/attention_kernel_plan_and_passes/attention_passes.rs +++ b/crates/cuda-driver/src/qsa_prompt_attention/attention_kernel_plan_and_passes/attention_passes.rs @@ -1,5 +1,5 @@ -//! Methods of `QsaPromptAttention`: `attend_kernel`, `ensure_plan`, `validate_stage`, `output_address` and 10 more. -//! Methods of `KernelPlan`: `of`. +//! The launch sequence of QSA prompt attention: chooses the kernel plan, admits the Q/IDs/steps inputs (exact sizes, no +//! aliasing with the stage, workspace or own buffers), then runs guard scan, attention and output scan; also closes it. use super::{ Arg, Arguments, AttnPasses, DeviceBuffer, Error, KernelPlan, LaunchGeometry, Module, NativeBatchWorkspace, diff --git a/crates/cuda-driver/src/qsa_prompt_attention/attention_kernel_plan_and_passes/prompt_attention_owner.rs b/crates/cuda-driver/src/qsa_prompt_attention/attention_kernel_plan_and_passes/prompt_attention_owner.rs index 689506f3..92e8a927 100644 --- a/crates/cuda-driver/src/qsa_prompt_attention/attention_kernel_plan_and_passes/prompt_attention_owner.rs +++ b/crates/cuda-driver/src/qsa_prompt_attention/attention_kernel_plan_and_passes/prompt_attention_owner.rs @@ -1,5 +1,5 @@ -//! Methods of `QsaPromptAttention`: `new`, `new_capacity`, `with_module`, `allocate_buffers` and 13 more. -//! Split out of `attention_kernel_plan_and_passes` to keep its files under the line limit. +//! The QsaPromptAttention owner: allocation of its output bank and status word under the memory budget, module loading, +//! state accessors and the public attend entries that select the attention kernel for the device. use super::{ Arguments, Context, DeviceBuffer, DeviceCaps, Error, KernelEntry, LaunchGeometry, Module, NativeBatchWorkspace, diff --git a/crates/cuda-driver/src/qsa_prompt_attention/attention_kernel_plan_and_passes/reject_mutual_alias.rs b/crates/cuda-driver/src/qsa_prompt_attention/attention_kernel_plan_and_passes/reject_mutual_alias.rs index ab6e1b71..1ea6e113 100644 --- a/crates/cuda-driver/src/qsa_prompt_attention/attention_kernel_plan_and_passes/reject_mutual_alias.rs +++ b/crates/cuda-driver/src/qsa_prompt_attention/attention_kernel_plan_and_passes/reject_mutual_alias.rs @@ -1,5 +1,5 @@ -//! Functions: `reject_mutual_alias`, `admit_budget`. -//! Split out of `attention_kernel_plan_and_passes` to keep its files under the line limit. +//! Admission checks of QSA prompt attention: no two input buffers may overlap, and the output bank plus status word +//! and a 128 MiB reserve must fit the context budget and the free device memory. use super::{Context, DeviceBuffer, Error, Result}; diff --git a/crates/cuda-driver/src/qsa_prompt_attention/qsa_attention_inputs.rs b/crates/cuda-driver/src/qsa_prompt_attention/qsa_attention_inputs.rs index 7d7c60f4..a6eedcfd 100644 --- a/crates/cuda-driver/src/qsa_prompt_attention/qsa_attention_inputs.rs +++ b/crates/cuda-driver/src/qsa_prompt_attention/qsa_attention_inputs.rs @@ -1,5 +1,5 @@ -//! Methods of `QsaAttentionInputs`: `new`. -//! Methods of `Context`: `qsa_prompt_attention`, `qsa_prompt_attention_for_capacity`. +//! Validated inputs of QSA prompt attention (Q, selected IDs and steps buffers with exact sizes for t rows) and the +//! Context constructors of QsaPromptAttention. use super::{Context, DeviceBuffer, Error, QsaAttentionInputs, QsaPromptAttention, Result, checked}; diff --git a/crates/cuda-driver/src/qsa_prompt_attention/qsa_prompt_attention_drop.rs b/crates/cuda-driver/src/qsa_prompt_attention/qsa_prompt_attention_drop.rs index 15db6b8a..755436a0 100644 --- a/crates/cuda-driver/src/qsa_prompt_attention/qsa_prompt_attention_drop.rs +++ b/crates/cuda-driver/src/qsa_prompt_attention/qsa_prompt_attention_drop.rs @@ -1,5 +1,5 @@ -//! Methods of `QsaPromptAttentionCompletion`: `rows`, `with_output`, `into_values`. -//! Implements `Drop for QsaPromptAttention`. Functions: `guard_grid`. +//! Result side of QSA prompt attention: the completion view of the output bank (rows, borrowed output, host copy +//! of the values), the Drop of the owner and the launch grid of the guard kernels. use super::{DeviceBuffer, Error, QsaPromptAttention, QsaPromptAttentionCompletion, Result}; diff --git a/crates/cuda-driver/src/qsa_prompt_index/append_select.rs b/crates/cuda-driver/src/qsa_prompt_index/append_select.rs index 458eefc5..596e9360 100644 --- a/crates/cuda-driver/src/qsa_prompt_index/append_select.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/append_select.rs @@ -1,5 +1,5 @@ -//! Methods of `QsaPromptIndexWorkspace`: `append_select_inner`, `check_select_inputs`, `select_bounds_ok`, `admit_ou... -//! Functions: `release_outputs`, `select_lengths_ok`. Defines `Outputs`. +//! Append-and-select entry of the QSA prompt index workspace: validates the prior image and row inputs, allocates and +//! alias-checks the five per-call output buffers, runs the index program and reads back the selection state. use super::{ CAP, DeviceBuffer, Error, IndexProgramSpans, NativeBatchWorkspace, QsaPromptIndexWorkspace, QsaPromptSelection, diff --git a/crates/cuda-driver/src/qsa_prompt_index/index_run.rs b/crates/cuda-driver/src/qsa_prompt_index/index_run.rs index 75b21c95..22163aa3 100644 --- a/crates/cuda-driver/src/qsa_prompt_index/index_run.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/index_run.rs @@ -1,5 +1,5 @@ -//! Methods of `QsaPromptIndexWorkspace`: `run`, `execute_run`. -//! Split out of `qsa_prompt_index` to keep its files under the line limit. +//! Non-resident run of the QSA prompt index program: uploads the prior image and rows, stages the commands and +//! executes them under the context guard, then checks the status words and the selected IDs. use super::run_phases::{HostStaging, RunPlan}; use super::{ diff --git a/crates/cuda-driver/src/qsa_prompt_index/max_blocks.rs b/crates/cuda-driver/src/qsa_prompt_index/max_blocks.rs index b009dce6..52a69af9 100644 --- a/crates/cuda-driver/src/qsa_prompt_index/max_blocks.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/max_blocks.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `qsa_prompt_index_workspace`, `qsa_prompt_index_workspace_for_capacity`. -//! Functions: `max_blocks`, `sizes`, `encode`. +//! Size constants of the QSA prompt index workspace derived from the serving context (score row stride, the eleven +//! buffer sizes), the f32 little-endian encoder for uploads and the Context constructors. use super::{Context, Error, QsaPromptIndexWorkspace, Result}; diff --git a/crates/cuda-driver/src/qsa_prompt_index/prompt_device/context.rs b/crates/cuda-driver/src/qsa_prompt_index/prompt_device/context.rs index 2232faf6..c4bc5cbf 100644 --- a/crates/cuda-driver/src/qsa_prompt_index/prompt_device/context.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/prompt_device/context.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `original_qsa_prompt_device`. -//! Functions: `native_block`, `native_entry`, `arena_span`, `common`. +//! Context entry point of the Original QSA prompt device, plus lookup of native weight block sizes and entries per +//! quantization kind and of the arena and common spans a chunk read exposes. use super::{ Context, OriginalDeviceGrRead, OriginalQsaPromptDevice, PrefillPhase, QsaNativeKind, QsaNativePacking, Result, S, diff --git a/crates/cuda-driver/src/qsa_prompt_index/prompt_device/device_prepare.rs b/crates/cuda-driver/src/qsa_prompt_index/prompt_device/device_prepare.rs index fa131b98..f19a6140 100644 --- a/crates/cuda-driver/src/qsa_prompt_index/prompt_device/device_prepare.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/prompt_device/device_prepare.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalQsaPromptDevice`: `project`, `prepare`, `close`. -//! Split out of `prompt_device` to keep its files under the line limit. +//! Prepare step of the Original QSA prompt device: projects the chunk rows with native weights, runs the prompt index +//! program after the prior image, and returns the pending selection that complete() later finishes. use super::project_phases::{ProjectArgs, Projection}; use super::{ diff --git a/crates/cuda-driver/src/qsa_prompt_index/prompt_device/original_qsa_prompt_device.rs b/crates/cuda-driver/src/qsa_prompt_index/prompt_device/original_qsa_prompt_device.rs index c2c08673..1eb1120c 100644 --- a/crates/cuda-driver/src/qsa_prompt_index/prompt_device/original_qsa_prompt_device.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/prompt_device/original_qsa_prompt_device.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalQsaPromptDevice`: `device_bytes`, `new`, `is_failed`, `allocated_bytes` and 2 more. -//! Split out of `prompt_device` to keep its files under the line limit. +//! Construction and admission of the Original QSA prompt device: device byte budget for a capacity, resource +//! allocation, ownership checks of weight buffers, and the admission that all spans are disjoint. use super::device_phases::{check_assets, index_for}; use super::{ diff --git a/crates/cuda-driver/src/qsa_prompt_index/prompt_device/resident_device/original_qsa_prompt_device.rs b/crates/cuda-driver/src/qsa_prompt_index/prompt_device/resident_device/original_qsa_prompt_device.rs index 1bb8e191..922f3179 100644 --- a/crates/cuda-driver/src/qsa_prompt_index/prompt_device/resident_device/original_qsa_prompt_device.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/prompt_device/resident_device/original_qsa_prompt_device.rs @@ -1,5 +1,5 @@ -//! Methods of `ResidentJob`: `run_index`. -//! Methods of `OriginalQsaPromptDevice`: `prepare_resident`, `resident_bounds`, `check_resident_idle`, `admit_budget... +//! Resident-mode prepare of the Original QSA prompt device: admits a chunk, projects it, runs the index program in the +//! private resident image and rolls it back to the checkpoint on failure; also the resident selection accessors. use super::{ ArenaRows, CAP, Context, DeviceBuffer, Error, IndexProgramSpans, NativeBatchWorkspace, OriginalDeviceGrRead, diff --git a/crates/cuda-driver/src/qsa_prompt_index/prompt_device/resident_device/qsa_prompt_device_resident_bring_up.rs b/crates/cuda-driver/src/qsa_prompt_index/prompt_device/resident_device/qsa_prompt_device_resident_bring_up.rs index b0db41c3..75fdebe0 100644 --- a/crates/cuda-driver/src/qsa_prompt_index/prompt_device/resident_device/qsa_prompt_device_resident_bring_up.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/prompt_device/resident_device/qsa_prompt_device_resident_bring_up.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalQsaPromptDevice`: `new_resident`, `unloaded`, `init_resident`, `allocate_resident` and 2 more. -//! Functions: `check_sealed`, `resident_sizes`. +//! Bring-up of the resident Original QSA prompt device: checks the sealed kernels, sizes the placeholder index image, +//! checks the budget, allocates the buffers and loads the kernel modules. use super::{ Context, DECODE_POSTOPS, Error, GATE_PTX, GATE_SHA, INDEX, KernelModule, Module, OriginalQsaPromptDevice, diff --git a/crates/cuda-driver/src/qsa_prompt_index/prompt_device/resident_device/qsa_resident_prompt_device_prepare.rs b/crates/cuda-driver/src/qsa_prompt_index/prompt_device/resident_device/qsa_resident_prompt_device_prepare.rs index 8280411d..b41e243b 100644 --- a/crates/cuda-driver/src/qsa_prompt_index/prompt_device/resident_device/qsa_resident_prompt_device_prepare.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/prompt_device/resident_device/qsa_resident_prompt_device_prepare.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalQsaResidentSelection`: `abort`, `complete`, `complete_inner`, `reject_weight_overlap` and 3 m... -//! Methods of `Context`: `original_qsa_resident_prompt_device`. +//! Public face of the resident Original QSA prompt device: the pending resident selection (abort, complete with KV +//! append, attention, Qf gate and native Out projection), the Out weight overlap check, and device byte accounting. use super::original_qsa_prompt_device::lap; use super::{ diff --git a/crates/cuda-driver/src/qsa_prompt_index/prompt_device/selection_completion.rs b/crates/cuda-driver/src/qsa_prompt_index/prompt_device/selection_completion.rs index 5a44c48f..bbe78064 100644 --- a/crates/cuda-driver/src/qsa_prompt_index/prompt_device/selection_completion.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/prompt_device/selection_completion.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalQsaPromptDevice`: `close_inner`. -//! Methods of `OriginalQsaDeviceSelection`: `rows`, `first_position`, `final_index`, `validate` and 3 more. +//! The pending selection of the Original QSA prompt device and its completion (INT8 KV append, attention, gate and +//! native Out projection), plus the Drop of the device. use super::{ CAP, CompletedQsaKvAppend, Context, Error, NativeBatchWorkspace, OriginalDeviceBlock, OriginalQsaDeviceSelection, diff --git a/crates/cuda-driver/src/qsa_prompt_index/qsa_prompt_index_read_and_close.rs b/crates/cuda-driver/src/qsa_prompt_index/qsa_prompt_index_read_and_close.rs index 5d1c6d7f..cbb9bedf 100644 --- a/crates/cuda-driver/src/qsa_prompt_index/qsa_prompt_index_read_and_close.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/qsa_prompt_index_read_and_close.rs @@ -1,5 +1,5 @@ -//! Methods of `QsaPromptIndexWorkspace`: `read`, `final_state`, `final_state_with`, `read_finite` and 3 more. -//! Methods of `QsaPromptIndexPrefix`: `end_position`, `pooled`, `tail`, `dead`. +//! Result side of the QSA prompt index workspace: device-to-host readback of the final index state (pooled, tail, +//! dead rows, finite-checked), the accessors of states, prefixes and selections, and the close/Drop paths. use super::{ Context, DeviceBuffer, Error, QsaPromptIndexPrefix, QsaPromptIndexState, QsaPromptIndexWorkspace, diff --git a/crates/cuda-driver/src/qsa_prompt_index/qsa_prompt_index_workspace.rs b/crates/cuda-driver/src/qsa_prompt_index/qsa_prompt_index_workspace.rs index 63954029..5ad47d57 100644 --- a/crates/cuda-driver/src/qsa_prompt_index/qsa_prompt_index_workspace.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/qsa_prompt_index_workspace.rs @@ -1,5 +1,5 @@ -//! Methods of `QsaPromptIndexWorkspace`: `new`, `new_capacity`, `init_resources`, `prompt_device_bytes` and 11 more. -//! Functions: `capacity_sizes`, `check_assets_sealed`, `check_peak_budget`. +//! The QSA prompt index workspace owner: sizes, budget and sealed-asset admission, buffer allocation, weight and +//! overlap checks, input upload, and the public append_select entries for prompt rows and a single decode row. use super::{ CAP, Context, DECODE_POSTOPS, DeviceBuffer, Error, INDEX, Module, NativeBatchWorkspace, POSTOPS, QsaChunkRows, diff --git a/crates/cuda-driver/src/qsa_prompt_index/resident_index/image_bytes.rs b/crates/cuda-driver/src/qsa_prompt_index/resident_index/image_bytes.rs index f41b5adc..288a94e0 100644 --- a/crates/cuda-driver/src/qsa_prompt_index/resident_index/image_bytes.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/resident_index/image_bytes.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalQsaIndexCheckpoint`: `next_position`, `device_bytes`, `validate_retained`. -//! Methods of `Context`: `original_qsa_resident_index`. Implements `Drop for Saved`. Functions: `image_bytes`. +//! Checkpoint side of the resident QSA index: the byte size of an index image, the pooled checkpoint buffer that +//! returns to its pool on drop, checkpoint accessors and validation, and the Context constructor of the index. use super::{ CHECKPOINT_BYTES, Context, DeviceBuffer, Error, OriginalQsaIndexCheckpoint, OriginalQsaResidentIndex, POOLED, diff --git a/crates/cuda-driver/src/qsa_prompt_index/resident_index/original_qsa_index_batch.rs b/crates/cuda-driver/src/qsa_prompt_index/resident_index/original_qsa_index_batch.rs index afb3d7a5..bf117029 100644 --- a/crates/cuda-driver/src/qsa_prompt_index/resident_index/original_qsa_index_batch.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/resident_index/original_qsa_index_batch.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalQsaIndexBatch`: `first_position`, `rows`, `commit_prefix`, `publish` and 2 more. -//! Implements `Drop for OriginalQsaIndexBatch`. +//! One in-flight batch of the resident QSA index: after a verification run, commit_prefix publishes the accepted rows +//! (restoring the start checkpoint and replaying the prefix when only some are accepted) or aborts the batch. use super::{ Error, NativeBatchWorkspace, OriginalQsaIndexBatch, OriginalQsaIndexCheckpoint, QsaPromptIndexWorkspace, Result, diff --git a/crates/cuda-driver/src/qsa_prompt_index/resident_index/original_qsa_resident_index.rs b/crates/cuda-driver/src/qsa_prompt_index/resident_index/original_qsa_resident_index.rs index 5276a421..5b60cb1e 100644 --- a/crates/cuda-driver/src/qsa_prompt_index/resident_index/original_qsa_resident_index.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/resident_index/original_qsa_resident_index.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalQsaResidentIndex`: `device_bytes`, `new`, `empty`, `init_image` and 19 more. -//! Functions: `poison_unless_host_allocation`. +//! The OriginalQsaResidentIndex owner: allocates and zero-fills its device image, validates context and checkpoints, +//! takes checkpoints (also several fenced at once) from a pooled buffer, and restores one. use super::{ CHECKPOINT_BYTES, Cell, Context, Coverage, DeviceBuffer, Error, NativeBatchWorkspace, Origin, diff --git a/crates/cuda-driver/src/qsa_prompt_index/resident_index/qsa_resident_index_checkpoint_restore.rs b/crates/cuda-driver/src/qsa_prompt_index/resident_index/qsa_resident_index_checkpoint_restore.rs index 9377a905..53039661 100644 --- a/crates/cuda-driver/src/qsa_prompt_index/resident_index/qsa_resident_index_checkpoint_restore.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/resident_index/qsa_resident_index_checkpoint_restore.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalQsaResidentIndex`: `restore_private`, `checkpoint_ranges`, `placed`, `reset` and 16 more. -//! Implements `Drop for Placement`, `Drop for OriginalQsaResidentIndex`. Defines `Placement`. +//! Restore, reset and close of the resident QSA index, the window-state read/write used to undo a verifier window, +//! and the prefix-cache export/import of pooled key rows plus a checkpoint tail (Placement swaps in the image). use super::original_qsa_resident_index::poison_unless_host_allocation; use super::{ diff --git a/crates/cuda-driver/src/qsa_prompt_index/resident_index/verification_commit/original_verify_qsa_journal.rs b/crates/cuda-driver/src/qsa_prompt_index/resident_index/verification_commit/original_verify_qsa_journal.rs index 486a90ce..6d8de783 100644 --- a/crates/cuda-driver/src/qsa_prompt_index/resident_index/verification_commit/original_verify_qsa_journal.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/resident_index/verification_commit/original_verify_qsa_journal.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalVerifyQsaJournal`: `new`, `validate_context`, `identity`, `with_image` and 10 more. -//! Functions: `check_armed_window`, `image_addresses`, `image_clear`, `check_gamma` and 2 more. Defines `Indices`. +//! The OriginalVerifyQsaJournal owner: twelve per-layer resident QSA indices plus their mapped K/V journals for the +//! verifier window; validates that images, norm weights and RoPE tables are disjoint and idle, and begins a window. use super::verify_qsa_journal_loan::print_of; use super::{ diff --git a/crates/cuda-driver/src/qsa_prompt_index/resident_index/verification_commit/original_verify_rope.rs b/crates/cuda-driver/src/qsa_prompt_index/resident_index/verification_commit/original_verify_rope.rs index cfbf4ed1..1106b3a9 100644 --- a/crates/cuda-driver/src/qsa_prompt_index/resident_index/verification_commit/original_verify_rope.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/resident_index/verification_commit/original_verify_rope.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalVerifyRope`: `validate`, `validate_scalars`. Functions: `validate_angles`, `whole`, `overlaps`. -//! Split out of `verification_commit` to keep its files under the line limit. +//! Validation of the retained RoPE constants and tables of the verifier: scalars finite and in range, the angle +//! tables and position buffer whole and sized for the capacity, and the buffer overlap tests. use super::{Context, DeviceBuffer, DeviceRef, Error, OriginalVerifyRope, Result}; diff --git a/crates/cuda-driver/src/qsa_prompt_index/resident_index/verification_commit/verify_qsa_journal_capture_commit.rs b/crates/cuda-driver/src/qsa_prompt_index/resident_index/verification_commit/verify_qsa_journal_capture_commit.rs index 58fe22fe..0acfb90d 100644 --- a/crates/cuda-driver/src/qsa_prompt_index/resident_index/verification_commit/verify_qsa_journal_capture_commit.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/resident_index/verification_commit/verify_qsa_journal_capture_commit.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalVerifyQsaJournal`: `capture_commit_layer`, `capture_commit_fused`, `fused_layers`, `fused_wor... -//! Functions: `fused_io`. Defines `AppendPlan`, `LayerRows`, `AppendAddresses`. +//! Capture of the QSA index appends of a verifier window (row by row, or fused over the twelve layers for the commit) +//! and the host-side publish of mapped K/V prefixes from the append receipts. use super::original_verify_qsa_journal::{check_armed_window, image_addresses}; use super::{ diff --git a/crates/cuda-driver/src/qsa_prompt_index/resident_index/verification_commit/verify_qsa_journal_publish_discard.rs b/crates/cuda-driver/src/qsa_prompt_index/resident_index/verification_commit/verify_qsa_journal_publish_discard.rs index 1f85ed17..9f3723fc 100644 --- a/crates/cuda-driver/src/qsa_prompt_index/resident_index/verification_commit/verify_qsa_journal_publish_discard.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/resident_index/verification_commit/verify_qsa_journal_publish_discard.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalVerifyQsaJournal`: `complete_commit`, `check_all_in_flight`, `publish_window_indices`, `publi... -//! Split out of `verification_commit` to keep its files under the line limit. +//! End of a verifier window for the QSA journal: complete_commit publishes the K/V and index halves together, +//! discard_window undoes a refused window from the begin snapshots (index images, PLE history), and ownership return. use super::original_verify_qsa_journal::check_armed_window; use super::{ diff --git a/crates/cuda-driver/src/qsa_prompt_index/resident_program/prefix_replay.rs b/crates/cuda-driver/src/qsa_prompt_index/resident_program/prefix_replay.rs index 301ef25b..d91ed4c2 100644 --- a/crates/cuda-driver/src/qsa_prompt_index/resident_program/prefix_replay.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/resident_program/prefix_replay.rs @@ -1,5 +1,5 @@ -//! Methods of `QsaPromptIndexWorkspace`: `replay_resident_prefix`, `replay_handles`, `upload_steps`, `check_replay` ... -//! Functions: `replay_steps`, `replay_commands`, `replay_append`, `launch_label` and 1 more. +//! Accepted-prefix replay of the resident QSA index: after a verifier window keeps only some rows, re-appends them +//! from the raw keys to the resident image with the decode-append kernel and finite scans, and labels the launches. use super::{ A, Arguments, CAP, DeviceBuffer, Error, Launch, NativeBatchWorkspace, QsaPromptIndexWorkspace, Result, combine, ffi, diff --git a/crates/cuda-driver/src/qsa_prompt_index/resident_program/qsa_prompt_index_workspace.rs b/crates/cuda-driver/src/qsa_prompt_index/resident_program/qsa_prompt_index_workspace.rs index 46a62e85..ed7b87c2 100644 --- a/crates/cuda-driver/src/qsa_prompt_index/resident_program/qsa_prompt_index_workspace.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/resident_program/qsa_prompt_index_workspace.rs @@ -1,5 +1,5 @@ -//! Methods of `QsaPromptIndexWorkspace`: `run_resident_arena`, `run_arena`, `submit_arena`, `arena_steps` and 7 more. -//! Functions: `late_label`. +//! Resident-arena run of the QSA prompt index program: uploads step words and positions, submits the recorded plan +//! (with the late kernels when due) on the batch stream, and checks the status words. use super::{ ArenaCall, ArenaIo, ArenaPlan, ArenaRows, CAP, CurrentGuard, Error, IndexProgramSpans, LateQueue, diff --git a/crates/cuda-driver/src/qsa_prompt_index/resident_transfer/enabled.rs b/crates/cuda-driver/src/qsa_prompt_index/resident_transfer/enabled.rs index bf474157..507c860d 100644 --- a/crates/cuda-driver/src/qsa_prompt_index/resident_transfer/enabled.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/resident_transfer/enabled.rs @@ -1,5 +1,5 @@ -//! Methods of `Transfer`: `new`, `can_overlap`, `is_pending`, `begin` and 8 more. Implements `Drop for Transfer`. -//! Functions: `driver_code`, `poison_failed`, `check_ranges`, `load_side`. +//! Device-to-device copy engine of the resident QSA index (libcuda via dlopen): synchronous and fenced copies of +//! checkpoint ranges, and an optional side stream that overlaps the prior-KV prefix copy with the layer compute. use super::{Context, Error, NativeBatchWorkspace, Result, combine}; use std::ffi::c_void; diff --git a/crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_journal.rs b/crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_journal.rs index 79d9a4db..d1c14349 100644 --- a/crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_journal.rs +++ b/crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_journal.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalQsaMappedJournal`: `append_resident_decode`, `completed_kv_handles`, `admit_append`, `reject_... -//! Defines `AppendPlan`. +//! Resident append of the Original QSA mapped K/V journal for decode: admits new cells, guards, quantizes and writes +//! them to the resident pools and host copy; also the prefix-cache export/import of whole host pages. use super::{ Arg, Arguments, Cell, Context, Coverage, Error, LaunchGeometry, NativeBatchWorkspace, OriginalQsaMappedAppend, diff --git a/crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_prefix.rs b/crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_prefix.rs index a0564a20..69c31d14 100644 --- a/crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_prefix.rs +++ b/crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_prefix.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `qsa_mapped_journal_append_and_resolve`, `qsa_mapped_journal_prefix_and_prefetch`. -//! Split out of `mapped_journal` to keep its files under the line limit. +//! Module root of the mapped K/V journal pieces that deal with arena appends and with prefix tracking; it only +//! imports the shared names and declares the two submodules. use super::{ Cell, Context, Coverage, DeviceBuffer, Error, NativeBatchWorkspace, OriginalDeviceGrRead, OriginalQsaMappedAppend, diff --git a/crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_prefix/qsa_mapped_journal_append_and_resolve.rs b/crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_prefix/qsa_mapped_journal_append_and_resolve.rs index 97d17853..89f85f54 100644 --- a/crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_prefix/qsa_mapped_journal_append_and_resolve.rs +++ b/crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_prefix/qsa_mapped_journal_append_and_resolve.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalQsaMappedJournal`: `append_resident_arena`, `arena_plan`, `stage_arena`, `stage_prefix_from_h... -//! Split out of `original_qsa_mapped_prefix` to keep its files under the line limit. +//! Arena-chunk side of the mapped K/V journal: prompt append with the host-to-stage prefix copy, the streamed-KV +//! resolver (reset, resolve, window addresses) and alias checks. use super::super::original_qsa_mapped_journal::AppendPlan; use super::{ diff --git a/crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_prefix/qsa_mapped_journal_prefix_and_prefetch.rs b/crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_prefix/qsa_mapped_journal_prefix_and_prefetch.rs index 75d572a0..9041c681 100644 --- a/crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_prefix/qsa_mapped_journal_prefix_and_prefetch.rs +++ b/crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_prefix/qsa_mapped_journal_prefix_and_prefetch.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalQsaMappedPrefix`: `next_position`, `owner_id`, `validate_retained`. -//! Methods of `OriginalQsaMappedAppend`: `rows`, `first_position`, `prefix_after`, `final_prefix`. +//! Prefix lineage of the mapped K/V journal: prefix and append receipts, rollback, accept, reset, window publication, +//! conversion from QsaPromptKv, close, and the side-stream prefetch of the layer prefix copy. use super::{ Cell, Context, Coverage, Error, NativeBatchWorkspace, OriginalDeviceGrRead, OriginalQsaMappedAppend, diff --git a/crates/cuda-driver/src/qsa_prompt_kv/offsets.rs b/crates/cuda-driver/src/qsa_prompt_kv/offsets.rs index 22c0b2f4..3f594c39 100644 --- a/crates/cuda-driver/src/qsa_prompt_kv/offsets.rs +++ b/crates/cuda-driver/src/qsa_prompt_kv/offsets.rs @@ -1,5 +1,5 @@ -//! Methods of `QsaKvInputs`: `new`. Methods of `QsaKvOwnerId`: `same_owner`. -//! Functions: `offsets`, `stage_runs`, `resident_runs`, `page_payload_eq` and 3 more. +//! Layout and identity helpers of QSA prompt K/V: run offsets and sizes of the mapped pools, the validated K/V inputs, +//! snapshot and owner-id accessors, the device Pools owner, size admission and the Context constructors. use super::{ CompletedQsaKvAppend, Context, DeviceBuffer, Error, Origin, Page, Pools, QSA_PROMPT_HOST_PAGE_BYTES, QsaKvInputs, diff --git a/crates/cuda-driver/src/qsa_prompt_kv/qsa_prompt_kv_drop.rs b/crates/cuda-driver/src/qsa_prompt_kv/qsa_prompt_kv_drop.rs index e9bd652b..1b78aa19 100644 --- a/crates/cuda-driver/src/qsa_prompt_kv/qsa_prompt_kv_drop.rs +++ b/crates/cuda-driver/src/qsa_prompt_kv/qsa_prompt_kv_drop.rs @@ -1,5 +1,5 @@ -//! Methods of `QsaPromptStage`: `new`, `allocate_all`, `allocated_bytes`, `is_failed` and 11 more. -//! Implements `Drop for QsaPromptKv`, `Drop for QsaPromptStage`. Functions: `read_range`. +//! The QsaPromptStage owner: pools, status word and page table of the staging area, snapshot restore, kernel runs on +//! the workspace stream and close; also the Drop of the QSA K/V owner and its range readback. use super::{ Arguments, Context, DeviceBuffer, Error, LaunchGeometry, NativeBatchWorkspace, PAGE, Pools, QsaKvSnapshot, diff --git a/crates/cuda-driver/src/qsa_prompt_kv/staged_append.rs b/crates/cuda-driver/src/qsa_prompt_kv/staged_append.rs index a9e7b739..b592f85f 100644 --- a/crates/cuda-driver/src/qsa_prompt_kv/staged_append.rs +++ b/crates/cuda-driver/src/qsa_prompt_kv/staged_append.rs @@ -1,5 +1,5 @@ -//! Defines `StagedAppend`. -//! Split out of `qsa_prompt_kv` to keep its files under the line limit. +//! Small carrier type of an append: the stage one bounded K/V append runs on and the prior snapshot it extends; +//! the append logic is in the submodules. use super::{ Arg, Arguments, CompletedQsaKvAppend, Context, DeviceBuffer, Error, LaunchGeometry, MappedAllocation, diff --git a/crates/cuda-driver/src/qsa_prompt_kv/staged_append/qsa_prompt_kv_append_bounded_close.rs b/crates/cuda-driver/src/qsa_prompt_kv/staged_append/qsa_prompt_kv_append_bounded_close.rs index 6e500c56..0e72c0da 100644 --- a/crates/cuda-driver/src/qsa_prompt_kv/staged_append/qsa_prompt_kv_append_bounded_close.rs +++ b/crates/cuda-driver/src/qsa_prompt_kv/staged_append/qsa_prompt_kv_append_bounded_close.rs @@ -1,5 +1,5 @@ -//! Methods of `QsaPromptKv`: `append_bounded`, `close`, `close_inner`, `close_mapped` and 1 more. -//! Split out of `staged_append` to keep its files under the line limit. +//! Bounded append of QSA K/V through a stage, and the close of the owner including the pinned host mapping, which is +//! retained instead of freed when a poisoned context cannot prove DMA completion. use super::{ CompletedQsaKvAppend, Error, MappedAllocation, NativeBatchWorkspace, QsaKvInputs, QsaPromptKv, Result, diff --git a/crates/cuda-driver/src/qsa_prompt_kv/staged_append/qsa_prompt_kv_bring_up.rs b/crates/cuda-driver/src/qsa_prompt_kv/staged_append/qsa_prompt_kv_bring_up.rs index 2f84694f..dfb3cece 100644 --- a/crates/cuda-driver/src/qsa_prompt_kv/staged_append/qsa_prompt_kv_bring_up.rs +++ b/crates/cuda-driver/src/qsa_prompt_kv/staged_append/qsa_prompt_kv_bring_up.rs @@ -1,5 +1,5 @@ -//! Methods of `QsaPromptKv`: `new`, `init_resources`, `map_host`, `empty_snapshot` and 16 more. -//! Functions: `check_host_memory`. +//! Bring-up of the QsaPromptKv owner: host memory check, pinned mapped host area, snapshot validation and restore, +//! selection admission and the append entries. use super::{ CompletedQsaKvAppend, Context, DeviceBuffer, Error, MappedAllocation, NativeBatchWorkspace, Origin, PAGE, diff --git a/crates/cuda-driver/src/qsa_selected_kv/asset.rs b/crates/cuda-driver/src/qsa_selected_kv/asset.rs index 70ad36a6..fdd94dd6 100644 --- a/crates/cuda-driver/src/qsa_selected_kv/asset.rs +++ b/crates/cuda-driver/src/qsa_selected_kv/asset.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `qsa_selected_kv_workspace`. Functions: `asset`. -//! Split out of `qsa_selected_kv` to keep its files under the line limit. +//! Sealed PTX asset check of the QSA selected-K/V workspace (pinned length, digest, NUL-terminated ASCII) and the +//! Context constructor of the workspace. use super::{Context, Error, PTX, PTX_BYTES, PTX_SHA, QsaSelectedKvWorkspace, Result, qwen_ffi}; diff --git a/crates/cuda-driver/src/qsa_selected_kv/qsa_selected_kv_attend_io.rs b/crates/cuda-driver/src/qsa_selected_kv/qsa_selected_kv_attend_io.rs index b3223efd..df496f9d 100644 --- a/crates/cuda-driver/src/qsa_selected_kv/qsa_selected_kv_attend_io.rs +++ b/crates/cuda-driver/src/qsa_selected_kv/qsa_selected_kv_attend_io.rs @@ -1,5 +1,5 @@ -//! Methods of `QsaSelectedKvProducts`: `width`, `generation`, `attend`. -//! Methods of `QsaSelectedKvWorkspace`: `attend_io`, `check_attend_buffers`, `launch_attend`. +//! Attend side of the QSA selected-K/V workspace: the products handle that attends one query over the gathered +//! selected cells, the alias and size checks of its query/output buffers, the launch, and the workspace Drop. use super::{ CELL, DeviceBuffer, Error, Operation, PACKED, QsaSelectedKvProducts, QsaSelectedKvWorkspace, Result, SIZES, diff --git a/crates/cuda-driver/src/qsa_selected_kv/qsa_selected_kv_workspace.rs b/crates/cuda-driver/src/qsa_selected_kv/qsa_selected_kv_workspace.rs index b70987e8..5fbdac48 100644 --- a/crates/cuda-driver/src/qsa_selected_kv/qsa_selected_kv_workspace.rs +++ b/crates/cuda-driver/src/qsa_selected_kv/qsa_selected_kv_workspace.rs @@ -1,5 +1,5 @@ -//! Methods of `QsaSelectedKvWorkspace`: `new`, `admit_new`, `load`, `load_modules` and 12 more. -//! Functions: `check_shapes`, `check_finite`, `release_buffer`, `unload_module`. Defines `SelectedLaunch`. +//! The QsaSelectedKvWorkspace owner: sealed asset admission, buffers and modules, validation of miss and selection +//! slots, the prepare step that scatters missed rows into cells and gathers the selection, and close. use super::{ CELL, CELLS, Cell, Context, DeviceBuffer, Error, LAYERS, MAP, Operation, PACKED, QsaKvMisses, diff --git a/crates/cuda-driver/src/qwen_dispatch/admission.rs b/crates/cuda-driver/src/qwen_dispatch/admission.rs index 8b99b939..76e8f432 100644 --- a/crates/cuda-driver/src/qwen_dispatch/admission.rs +++ b/crates/cuda-driver/src/qwen_dispatch/admission.rs @@ -1,5 +1,5 @@ -//! Functions: `admission`, `check_owned`, `admitted_layout`, `buffer_handles` and 1 more. -//! Split out of `qwen_dispatch` to keep its files under the line limit. +//! Request admission of the Qwen closed-kernel dispatch: checks that every operand belongs to the context and is live, +//! validates operand count, epsilon and layout against the sealed asset, and allocates the owned MTP scratch buffers. use super::{ Admission, Asset, Backend, Context, DeviceBuffer, Error, Operation, Result, combine, ffi, qwen_ffi, ranges_layout, diff --git a/crates/cuda-driver/src/qwen_dispatch/cache.rs b/crates/cuda-driver/src/qwen_dispatch/cache.rs index a1efdfc5..74c26727 100644 --- a/crates/cuda-driver/src/qwen_dispatch/cache.rs +++ b/crates/cuda-driver/src/qwen_dispatch/cache.rs @@ -1,5 +1,5 @@ -//! Methods of `Cache`: `new`. Implements `Backend for Context`. -//! Functions: `restore`, `registered`, `execute`, `prepare_pair` and 3 more. +//! The kernel cache of the Qwen dispatch and its Backend implementation for Context: lazy load and resolve of fixed +//! kernels, single and paired registration with unload on failure, and execution under the context guard. use super::{Arguments, Asset, Backend, Cache, Cell, Context, Error, FixedKernel, Operation, Rc, Result, combine, ffi}; diff --git a/crates/cuda-driver/src/qwen_dispatch/context.rs b/crates/cuda-driver/src/qwen_dispatch/context.rs index bd155605..1c56787b 100644 --- a/crates/cuda-driver/src/qwen_dispatch/context.rs +++ b/crates/cuda-driver/src/qwen_dispatch/context.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `context_gr_gate_mean_inject`, `gdn_ple_fixed_kernels`, `gdn_step_kernels` and 4 more. -//! Split out of `qwen_dispatch` to keep its files under the line limit. +//! The Context side of qwen_dispatch: groups the fixed-kernel call families (GDN/PLE, GDN step, GR read chain, +//! MTP dense attention, MTP fixed kernels, QSA kernels) and re-uses the dispatch types of the parent. use super::{ Admission, Arguments, Asset, Backend, Context, DeviceBuffer, Error, FixedKernel, Operation, Result, admission, diff --git a/crates/cuda-driver/src/qwen_dispatch/context/context_gr_gate_mean_inject.rs b/crates/cuda-driver/src/qwen_dispatch/context/context_gr_gate_mean_inject.rs index 96568806..9f8ddc6c 100644 --- a/crates/cuda-driver/src/qwen_dispatch/context/context_gr_gate_mean_inject.rs +++ b/crates/cuda-driver/src/qwen_dispatch/context/context_gr_gate_mean_inject.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `gr_gate_mean_layer_fused_f32`, `gr_gate_mean_final_unfused_f32`, `gr_inject_residual_f32`,... -//! Split out of `context` to keep its files under the line limit. +//! Context entry points for the GR gate-mean (layer fused, final unfused) and residual-inject Qwen kernels; each +//! validates its F32 operands and dispatches through qwen_call. use super::{Context, DeviceBuffer, Operation, Result}; diff --git a/crates/cuda-driver/src/qwen_dispatch/context/gdn_ple_fixed_kernels.rs b/crates/cuda-driver/src/qwen_dispatch/context/gdn_ple_fixed_kernels.rs index 92381e23..382b8ace 100644 --- a/crates/cuda-driver/src/qwen_dispatch/context/gdn_ple_fixed_kernels.rs +++ b/crates/cuda-driver/src/qwen_dispatch/context/gdn_ple_fixed_kernels.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `qsa_block_topk`, `qsa_attend`, `qsa_gate_f32`, `moe_swiglu_f32` and 15 more. -//! Split out of `context` to keep its files under the line limit. +//! Context entry points for the fixed Qwen kernels of QSA (block top-k, attend, gate), MoE (SwiGLU, shared scalar, +//! combine), PLE and GDN steps; thin typed wrappers that hand their buffers to qwen_call. use super::fixed_operands::{GdnConvResult, GdnGates, GdnQkv, GdnStepResult, PleConvResult, QsaPackedKv}; use super::{Context, DeviceBuffer, Operation, Result}; diff --git a/crates/cuda-driver/src/qwen_dispatch/context/gdn_step_kernels.rs b/crates/cuda-driver/src/qwen_dispatch/context/gdn_step_kernels.rs index cf11276b..fd716833 100644 --- a/crates/cuda-driver/src/qwen_dispatch/context/gdn_step_kernels.rs +++ b/crates/cuda-driver/src/qwen_dispatch/context/gdn_step_kernels.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `gdn_step_from_products_f32`, `admit_gdn_step`, `gdn_out_norm_f32`, `qwen_route_top10` and ... -//! Split out of `context` to keep its files under the line limit. +//! Context entry points for the fixed GDN step, GDN output norm, top-10 expert router and BF16 projection kernels. +//! Also holds the shared qwen_call admission-and-launch helper and the unload of the Qwen kernel set. use super::fixed_operands::{GdnGates, GdnOutNormInput, GdnStepProducts, GdnStepResult}; use super::{ diff --git a/crates/cuda-driver/src/qwen_dispatch/context/gr_read_chain.rs b/crates/cuda-driver/src/qwen_dispatch/context/gr_read_chain.rs index b15705cc..ebc85799 100644 --- a/crates/cuda-driver/src/qwen_dispatch/context/gr_read_chain.rs +++ b/crates/cuda-driver/src/qwen_dispatch/context/gr_read_chain.rs @@ -1,5 +1,5 @@ -//! Methods of `GrChain`: `new`. -//! Methods of `Context`: `gr_read_chain_queued`, `admit_gr_read`, `gr_stage`, `gr_run_chain` and 8 more. +//! The GR read chain: five fixed stages (norm, down, down-silu, up, layer gate) plus a finite guard, run on one stream +//! with a single completion fence; cross-stage alias checks live here. Also the single-stage GR projection/norm calls. use super::fixed_operands::{GrReadInputs, GrReadOutputs}; use super::{ diff --git a/crates/cuda-driver/src/qwen_dispatch/context/mtp_dense_attention.rs b/crates/cuda-driver/src/qwen_dispatch/context/mtp_dense_attention.rs index 9dd77502..c670e124 100644 --- a/crates/cuda-driver/src/qwen_dispatch/context/mtp_dense_attention.rs +++ b/crates/cuda-driver/src/qwen_dispatch/context/mtp_dense_attention.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `mtp_dense_attend_f16`, `mtp_dense_attend_ring_f16`, `dense_plan`, `check_dense_buffer` and... -//! Functions: `dense_admission`, `dense_clear`, `ring_active`. Defines `DensePlan`. +//! Closed causal dense attention of the MTP head over FP16 K/V (plain or ring window): input sizing and alias checks, +//! accumulator/max/sum scratch, and the chunk-then-merge launch pair. use super::fixed_operands::{MtpDenseKv, MtpRingWindow}; use super::{ diff --git a/crates/cuda-driver/src/qwen_dispatch/context/mtp_fixed_kernels.rs b/crates/cuda-driver/src/qwen_dispatch/context/mtp_fixed_kernels.rs index 33e1e330..3618fa22 100644 --- a/crates/cuda-driver/src/qwen_dispatch/context/mtp_fixed_kernels.rs +++ b/crates/cuda-driver/src/qwen_dispatch/context/mtp_fixed_kernels.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `mtp_gr_attention_down`, `mtp_gr_attention_up`, `mtp_gr_mlp_down`, `mtp_gr_mlp_up` and 11 m... -//! Split out of `context` to keep its files under the line limit. +//! Context entry points for the fixed MTP kernels: GR attention/MLP down and up passes, scaled quantization, +//! S2 expert tiles and full banks, SwiGLU, embedding and hidden norms, broadcast. No caller geometry is exposed. use super::fixed_operands::{ MtpGrMlpOutputs, MtpGrMlpResidual, MtpGrProducts, MtpGrWeights, MtpQuantizedInput, MtpS2SelectedExpert, diff --git a/crates/cuda-driver/src/qwen_dispatch/context/qsa_fixed_kernels.rs b/crates/cuda-driver/src/qwen_dispatch/context/qsa_fixed_kernels.rs index c6eee457..64b2eb65 100644 --- a/crates/cuda-driver/src/qwen_dispatch/context/qsa_fixed_kernels.rs +++ b/crates/cuda-driver/src/qwen_dispatch/context/qsa_fixed_kernels.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `kar_ple_call`, `kar_ple_scatter`, `kar_ple_decode`, `qsa_call` and 11 more. -//! Split out of `context` to keep its files under the line limit. +//! Context entry points for the closed QSA attention kernels (q gate split, norms, ropes, index append, kv pack, +//! block scores) and the experimental PLE row-cache scatter and decode; unqualified assets refuse before mutation. use super::fixed_operands::{QsaIndexAppendSource, QsaPooledImage}; use super::{Admission, Arguments, Context, DeviceBuffer, Error, Operation, Result, admission, execute, qwen_ffi}; diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_queue_stage.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_queue_stage.rs index 98d5d939..39547bc1 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_queue_stage.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_queue_stage.rs @@ -1,5 +1,5 @@ -//! Methods of `GdnQueueStage`: `words`, `slot`. Methods of `Step`: `next`. -//! Functions: `decode_statuses`, `column_row_offset`. +//! Vocabulary and lifecycle of the GDN row queue: finite-scan stage sizes, program step order, status-word decoding, +//! batched QKV row offsets, the completion result, and opening the queue (status buffer, six kernels). use super::{ Context, Error, GdnQueueStage, GdnRowCompletion, GdnRowPrefix, GdnRowQueue, Kernels, MAX_COLUMN_ROWS, OPS, diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_prefix.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_prefix.rs index 9c1210b6..b3a4669f 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_prefix.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_prefix.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `convolution_stages`, `gdn_row_prefix_fenced_drain`, `recurrence_stages`. -//! Split out of `gdn_closed_queue` to keep its files under the line limit. +//! The GDN row prefix: an owned, ordered program of kernel launches and finite scans for one GDN row, built from +//! convolution/recurrence stages and executed by the fenced drain; the submodules split it by program phase. use super::{ Admission, Arguments, BETA, CONV, Command, DeviceBuffer, Drained, Error, GATE, GdnConvBuffers, GdnOutNormBuffers, diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_prefix/convolution_stages.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_prefix/convolution_stages.rs index 23604733..378bcf15 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_prefix/convolution_stages.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_prefix/convolution_stages.rs @@ -1,5 +1,5 @@ -//! Methods of `GdnRowPrefix`: `ready`, `latch`, `handle_of`, `same` and 11 more. -//! Split out of `gdn_row_prefix` to keep its files under the line limit. +//! First stages of the GDN row program: step-order and operand-identity checks, the push_stage/push_scan helpers, +//! the QKV, alpha and raw-beta scans, and the convolution plus SiLU (own QKV row or a row of a retained columns owner). use super::{ Admission, Arguments, CONV, Command, DeviceBuffer, Error, GdnConvBuffers, GdnQueueStage, GdnRowPrefix, OPS, diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_prefix/gdn_row_prefix_fenced_drain.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_prefix/gdn_row_prefix_fenced_drain.rs index fae50168..aaded3f8 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_prefix/gdn_row_prefix_fenced_drain.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_prefix/gdn_row_prefix_fenced_drain.rs @@ -1,5 +1,5 @@ -//! Methods of `GdnRowPrefix`: `drain`, `drain_buffers`, `decoded_refusal`, `fenced` and 2 more. -//! Functions: `fetched_history`, `history_words`. Defines `Fenced`. +//! Final drain of a GDN row program: reset the status words, launch every queued command, read statuses and optional +//! next history back and synchronize in one fence; failures latch the queue and poison the context. use super::{ Drained, Error, GdnQueueStage, GdnRowPrefix, HISTORY_BYTES, Result, SLOTS, STATUS_BYTES, combine, decode_statuses, diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_prefix/recurrence_stages.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_prefix/recurrence_stages.rs index f14deb43..0f91ff6a 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_prefix/recurrence_stages.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_prefix/recurrence_stages.rs @@ -1,5 +1,5 @@ -//! Methods of `GdnRowPrefix`: `qk_l2`, `beta_sigmoid`, `gate_softplus`, `recurrence` and 7 more. -//! Split out of `gdn_row_prefix` to keep its files under the line limit. +//! Later stages of the GDN row program: Q/K L2, beta sigmoid, gate softplus, the recurrence over fixed Q/K/V ranges, +//! the Z scan, output norm, selecting the history to fetch, and finish, which drains the whole prefix once. use super::{ Admission, Arguments, BETA, Command, DeviceBuffer, Error, GATE, GdnOutNormBuffers, GdnQueueStage, diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_queue.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_queue.rs index 39c2249f..32deaef8 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_queue.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_queue.rs @@ -1,5 +1,5 @@ -//! Methods of `GdnRowQueue`: `close_inner`, `release_status`, `release_module`. Methods of `Command`: `launch`. -//! Implements `Drop for GdnRowQueue`. Functions: `staging`. +//! Teardown and plumbing of the GDN row queue: closing it releases the status buffer and helper module (poisoning the +//! context on failure), Drop closes it, plus host staging allocation and the launch of one queued command. use super::{Command, Context, DeviceBuffer, Error, GdnRowQueue, Result, combine, ffi}; diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gpu/bytes.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gpu/bytes.rs index 0f1bace4..a7b0241c 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gpu/bytes.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gpu/bytes.rs @@ -1,5 +1,5 @@ -//! Methods of `Row`: `conv_buffers`, `recurrence_buffers`, `out_norm_buffers`, `new` and 7 more. -//! Functions: `bytes`, `upload`, `blank`, `read` and 6 more. +//! GPU test fixtures of the GDN row queue: a Row of whole device owners with deterministic (optionally NaN-tailed) +//! inputs, the scalar reference sequence, the queued programs (own or retained QKV row) and upload/readback helpers. use super::{ CHANNELS, Context, DeviceBuffer, EPSILON, GdnConvBuffers, GdnOutNormBuffers, GdnRecurrenceBuffers, diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gpu/columns_pair_cases.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gpu/columns_pair_cases.rs index 482c1fb9..e45d1f41 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gpu/columns_pair_cases.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gpu/columns_pair_cases.rs @@ -1,5 +1,5 @@ -//! Functions: `columns_pair`, `poisoned_image`, `compare_columns`, `note_qkv_refusal` and 4 more. -//! Defines `ColumnsCase`, `ColumnsPoison`, `RetainedColumns`. +//! GPU test cases of the GDN row queue: queued results must match the scalar sequence bit for bit, including retained +//! batched QKV rows (non-finite words in other rows are ignored, in the used row they refuse at the first stage). use super::{ CHANNELS, Context, DeviceBuffer, Error, GdnQueueStage, GdnRowCompletion, GdnRowQueue, Poison, Report, Result, Row, diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/gdn_fused_prefix.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/gdn_fused_prefix.rs index dfb723a8..0ca867b6 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/gdn_fused_prefix.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/gdn_fused_prefix.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `fused_stage_binding`, `gdn_fused_prefix_step_norm_drain`. -//! Split out of `gdn_fused_t1` to keep its files under the line limit. +//! The fused GDN T1 prefix: one owned program of fused kernels and finite scans for a single token step; the +//! submodules split it into the binding/early stages and the step-norm stage with its fenced drain. use super::{ C, Command, DeviceBuffer, Drained, Error, F16, F32, FusedKernel, GDN_FUSED_T1_STATE_BYTES, GdnAbBuffers, diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/gdn_fused_prefix/fused_stage_binding.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/gdn_fused_prefix/fused_stage_binding.rs index a4160750..d6ada148 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/gdn_fused_prefix/fused_stage_binding.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/gdn_fused_prefix/fused_stage_binding.rs @@ -1,5 +1,5 @@ -//! Methods of `GdnFusedPrefix`: `ready`, `latch`, `bind`, `push` and 10 more. -//! Split out of `gdn_fused_prefix` to keep its files under the line limit. +//! First half of the fused GDN T1 program: step order, role-bound buffer admission, ordered finite scans, and the +//! input scan, state seeding, conv+L2 and gate/beta (ab) kernels. The step norm and the drain are in the sibling file. use super::{ C, Command, DeviceBuffer, Error, F16, F32, FusedKernel, GDN_FUSED_T1_STATE_BYTES, GdnAbBuffers, GdnFusedPrefix, diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/gdn_fused_prefix/gdn_fused_prefix_step_norm_drain.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/gdn_fused_prefix/gdn_fused_prefix_step_norm_drain.rs index f21921aa..69e10d1c 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/gdn_fused_prefix/gdn_fused_prefix_step_norm_drain.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/gdn_fused_prefix/gdn_fused_prefix_step_norm_drain.rs @@ -1,5 +1,5 @@ -//! Methods of `GdnFusedPrefix`: `step_norm`, `step_norm_handles`, `push_step_norm`, `fetch_candidate` and 8 more. -//! Functions: `fetched_candidate`, `candidate_words`. Defines `DrainBuffers`, `Fenced`. +//! Second half of the fused GDN T1 program: the step-norm kernel, the request for the candidate state/history, and +//! finish, which drains the whole prefix in one fence (statuses and candidate read back, failures poison the context). use super::{ DeviceBuffer, Drained, Error, F32, FusedKernel, GDN_FUSED_T1_STATE_BYTES, GdnFusedCompletion, GdnFusedPrefix, diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/pinned.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/pinned.rs index bc4c530f..51fa1f86 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/pinned.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/pinned.rs @@ -1,5 +1,5 @@ -//! Methods of `FusedKernel`: `entry`, `index`. Methods of `GdnFusedStage`: `slot`, `elements`, `bytes`. -//! Functions: `pinned`, `fused_asset`, `linear`, `decode_statuses`. +//! Pinned sealed PTX of the fused GDN T1 kernels (digest-checked), kernel entry names and indices, the finite-scan +//! stage table (slot, element count, bytes), status decoding in source order, launch geometry and the role bindings. use super::{ Bindings, C, Context, Error, F32, FUSED_PTX_LEN, FUSED_PTX_SHA256, FusedKernel, GdnFusedStage, GdnFusedT1, diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/words.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/words.rs index a9bf6b17..04fb5340 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/words.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/words.rs @@ -1,5 +1,5 @@ -//! Methods of `GdnFusedT1`: `close_inner`, `release_status`, `release_module`, `replay_state_from_products`. -//! Methods of `GdnFusedPrefix`: `bind_replay`, `finish_device`. Implements `Drop for GdnFusedT1`. +//! Teardown of the fused GDN T1 owner (status buffer and module release, Drop), host word/staging conversion, and the +//! device-only replay of the state update from completed journal products. use super::{ C, DeviceBuffer, Error, F32, FusedKernel, GdnFusedPrefix, GdnFusedStage, GdnFusedT1, GdnReplayBuffers, HV, Result, diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/context.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/context.rs index 608901b1..8039008a 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/context.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/context.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `gdn_prefill_batch`, `gdn_prefill_batch_for_prompt`. -//! Methods of `GdnPrefillBatch`: `new`, `new_capacity`, `open`, `load_functions` and 6 more. Functions: `reserved`. +//! Opening and running the batched native GDN prefill: Context constructors, the GdnPrefillBatch owner (status buffer, +//! prefill and dequantization kernels), starting a prefix on a GEMM adapter, launching commands, the completion result. use super::{ Bindings, Command, Context, Error, Functions, GDN_BATCH_MAX_TOKENS, GdnBatchCompletion, GdnBatchPrefix, diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix.rs index 7ad89e31..a629a0fa 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `native_projection`, `qkv_and_z_projections`, `recurrence_and_output`. -//! Split out of `gdn_native_batch` to keep its files under the line limit. +//! The batched GDN prefill prefix: an owned program of kernels, GEMMs and finite scans over a token chunk; the +//! submodules split it into the shared base/projection, the early stages, and the recurrence with its drain. use super::{ C, CONV_TILE, Command, DeviceBuffer, Drained, Error, F16, F32, GDN_BATCH_EPSILON, GdnBatchCompletion, diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix/native_projection.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix/native_projection.rs index 518f6484..9a26d70b 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix/native_projection.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix/native_projection.rs @@ -1,5 +1,5 @@ -//! Methods of `GdnBatchPrefix`: `tokens`, `ready`, `latch`, `function` and 12 more. Functions: `size_admitted`. -//! Defines `NativeProjection`, `ProjectionOperands`. +//! Shared base of the batched GDN prefill program: step order, role-bound buffer admission, ordered finite scans, +//! the mixed-activation image packing, and the native quantized projection (dequantize to FP16, then GEMM). use super::{ Command, DeviceBuffer, Error, F16, F32, GdnBatchPrefix, GdnBatchStage, GdnNativeFormat, GemmShape, Kernel, N, diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix/qkv_and_z_projections.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix/qkv_and_z_projections.rs index 16f37947..7ea97ee6 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix/qkv_and_z_projections.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix/qkv_and_z_projections.rs @@ -1,5 +1,5 @@ -//! Methods of `GdnBatchPrefix`: `project_qkv`, `project_z`, `project_alpha_beta`, `push_ab_gemm` and 7 more. -//! Split out of `gdn_batch_prefix` to keep its files under the line limit. +//! Early stages of the batched GDN prefill program: the QKV, Z and alpha/beta projections, the gates kernel, +//! the causal convolution plus SiLU (serial or tiled by chunk length) and the Q/K L2 normalization. use super::native_projection::{NativeProjection, ProjectionOperands}; use super::{ diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix/recurrence_and_output.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix/recurrence_and_output.rs index d9e48a8c..82632db8 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix/recurrence_and_output.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix/recurrence_and_output.rs @@ -1,5 +1,5 @@ -//! Methods of `GdnBatchPrefix`: `recurrence`, `recurrence_arguments`, `out_norm`, `project_out` and 7 more. -//! Functions: `fetched_history`, `history_words`. Defines `Fenced`. +//! Late stages of the batched GDN prefill program: the whole-chunk recurrence, output norm and output projection, +//! then finish, which drains the program in one fence (status words and history read back; failures poison it). use super::native_projection::{NativeProjection, ProjectionOperands}; use super::{ diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gpu/bytes_of.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gpu/bytes_of.rs index 30368f75..cb766c6c 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gpu/bytes_of.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gpu/bytes_of.rs @@ -1,5 +1,5 @@ -//! Functions: `bytes_of`, `words_of`, `halves_of`, `f16_bits` and 15 more. Defines `Projections`. -//! Split out of `gpu` to keep its files under the line limit. +//! Host-side numerics of the GDN prefill GPU smoke test: byte/word/half conversions, FP16/BF16 rounding, Q8_0 blocks, +//! deterministic input patterns, and the host reference of every original kernel (gates, conv, L2, recurrence, norm). use super::{C, EPS, HISTORY_WORDS, HV, HostInputs, Q8_0_BLOCK, Reference, S, ZV}; diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gpu/host_gemm_adapter.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gpu/host_gemm_adapter.rs index 95d6d0ba..8b9942c4 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gpu/host_gemm_adapter.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gpu/host_gemm_adapter.rs @@ -1,5 +1,5 @@ -//! Methods of `HostGemm`: `run`, `poison_output`, `capture`. Methods of `Fixture`: `new`, `release`. -//! Implements `GdnGemm for HostGemm`. Functions: `host_gemm`, `upload`, `read`, `mismatch`. +//! Host stand-in for the closed cuBLAS GEMM adapter in the GDN prefill GPU smoke test (it records every call and can +//! poison an output word), plus the Fixture of uploaded inputs and blank outputs and the buffer upload/read helpers. use super::{ C, Context, DeviceBuffer, Error, Fixture, FixtureInputs, FixtureOutputs, GdnGemm, GdnStream, GemmShape, diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gpu/run_case.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gpu/run_case.rs index 8b765471..6432fafe 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gpu/run_case.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gpu/run_case.rs @@ -1,5 +1,5 @@ -//! Functions: `run_case`, `check_case`, `push_program`, `inputs_untouched` and 8 more. -//! Split out of `gpu` to keep its files under the line limit. +//! Runs one complete GDN prefill program over the fixture and checks the completion, untouched inputs, the GEMM call +//! sequence, exact dequantization, image packing and every device output against the host reference. use super::{ C, Captured, Cell, Context, Error, Fixture, GdnBatchPrefix, GdnBatchStage, GdnNativeFormat, GdnPrefillBatch, HV, diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/pinned.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/pinned.rs index a95ae75c..b384cad3 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/pinned.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/pinned.rs @@ -1,5 +1,5 @@ -//! Methods of `Kernel`: `entry`, `is_dequant`, `index`. -//! Methods of `GdnNativeFormat`: `ggml_type`, `block`, `kernel`, `matrix_bytes`. +//! Pinned sealed PTX of the batched GDN prefill and dequantization kernels (digest-checked), kernel entry names, the +//! GGUF weight formats, the stage table (slot, elements, bytes), status decoding, step order and role bindings. use super::{ Bindings, C, DEQUANT_PTX_LEN, DEQUANT_PTX_SHA256, Error, F16, F32, Functions, GdnBatchStage, GdnNativeFormat, diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/context.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/context.rs index 7bc47b29..424937a0 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/context.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/context.rs @@ -1,5 +1,4 @@ -//! Methods of `Context`: `original_gdn_prompt_device`, `original_gdn_prompt_device_with`. -//! Split out of `prompt_device` to keep its files under the line limit. +//! Context constructors of the original GDN prompt device: default options or operator-supplied GdnPromptOptions. use super::{Context, GdnPromptOptions, OriginalGdnPromptDevice, Result}; diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device.rs index 36ce7ad0..f6d9e415 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `gdn_prompt_run_buffer_binder`, `original_gdn_prompt_device_admit_open`, `original_gdn_prom... -//! Split out of `prompt_device` to keep its files under the line limit. +//! The original GDN prompt device: a device-resident program of the GDN layer over a prompt block, split into +//! construction, close, buffer binding, command-list building, tensor-core scan, drain and the produce entry point. use super::{ A, Bindings, C, Context, DeviceBuffer, DeviceCommand, Error, Functions, GDN_BATCH_EPSILON, GdnBatchStage, diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device/original_gdn_prompt_device_admit_open.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device/original_gdn_prompt_device_admit_open.rs index 3407b25b..e46cc840 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device/original_gdn_prompt_device_admit_open.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device/original_gdn_prompt_device_admit_open.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalGdnPromptDevice`: `device_bytes`, `new`, `admit_budget`, `open` and 2 more. -//! Split out of `original_gdn_prompt_device` to keep its files under the line limit. +//! Construction of the original GDN prompt device: device-byte sizing, budget and free-memory admission, and opening +//! the batch owner, scratch and the two history buffers. use super::{ Context, DeviceBuffer, Error, GdnPrefillBatch, GdnPromptOptions, HISTORY, OriginalGdnPromptDevice, RESERVE, Result, diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device/original_gdn_prompt_device_close.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device/original_gdn_prompt_device_close.rs index 1c943728..c09733d8 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device/original_gdn_prompt_device_close.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device/original_gdn_prompt_device_close.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalGdnPromptDevice`: `close`, `close_inner`, `release_stage`, `release_batch`. -//! Functions: `release_buffer`. +//! Teardown of the original GDN prompt device: releases history, scratch, stage module, tensor-core state and batch +//! owner; on a poisoned context buffers are leaked instead of freed, and a failed close poisons the context. use super::{Context, DeviceBuffer, Error, GdnPrefillBatch, KernelModule, OriginalGdnPromptDevice, Result, combine}; diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device/prompt_block_produce.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device/prompt_block_produce.rs index f766b5a3..ce161678 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device/prompt_block_produce.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device/prompt_block_produce.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalGdnPromptDevice`: `produce`, `admit`, `admit_handles`, `admit_state` and 4 more. -//! `produce` admits the buffers, records the command list (`prompt_command_list.rs`) and drains it (`original_gdn_pr... +//! Entry point of the prompt GDN block: produce admits the GR read, workspace, weights and prior state (owners, +//! aliases, shapes, finite history), builds the command list and drains it, returning the completed block and history. use super::{ Binder, Bindings, C, Carve, Carved, DeviceBuffer, Error, HISTORY, HISTORY_WORDS, HV, Handles, N, diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device_drop.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device_drop.rs index 58acda75..3f6d8415 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device_drop.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device_drop.rs @@ -1,5 +1,4 @@ -//! Implements `Drop for OriginalGdnPromptDevice`. -//! Split out of `prompt_device` to keep its files under the line limit. +//! Drop of the original GDN prompt device: closes it and ignores the result. use super::OriginalGdnPromptDevice; diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/stage_gpu_tests/enable_types.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/stage_gpu_tests/enable_types.rs index c1943853..4eb78d95 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/stage_gpu_tests/enable_types.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/stage_gpu_tests/enable_types.rs @@ -1,5 +1,4 @@ -//! Defines `Rng`, `Old`. -//! ENABLE, Rng, Old. +//! Shared test types of the stage GPU proofs: the environment switch, a xorshift Rng and the Old launcher context. use super::{Context, Functions}; diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/stage_gpu_tests/rng.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/stage_gpu_tests/rng.rs index 81c9bcab..05bc467c 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/stage_gpu_tests/rng.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/stage_gpu_tests/rng.rs @@ -1,5 +1,5 @@ -//! Methods of `Rng`: `next`, `f`, `f16`. Methods of `Old`: `run`. -//! Functions: `f32_bytes`, `upload`, `hd`, `download` and 2 more. +//! Helpers of the stage GPU proofs: a deterministic xorshift generator (finite f32/f16 values), buffer upload/download +//! helpers, and Old, which launches the existing GDN kernels on a stream as the reference side. use super::{A, Context, DeviceBuffer, GdnStream, Kernel, KernelArguments, KernelModule, Old, Rng, ffi}; use crate::ple_batch_ffi::LinearLaunch; diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/staging.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/staging.rs index 95eb88a9..8252cad5 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/staging.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/staging.rs @@ -1,5 +1,5 @@ -//! Methods of `GdnPrefillBatch`: `close_inner`, `release_status`, `release_module`. -//! Implements `Drop for GdnPrefillBatch`. Functions: `staging`. +//! Teardown of the batched GDN prefill owner: releasing the status buffer and kernel modules (poisoning the context +//! on failure), Drop, and the host staging buffer allocation. use super::{DeviceBuffer, Error, GdnPrefillBatch, Result, combine, ffi}; diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_products_installed.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_products_installed.rs index a83147b6..4b5e867f 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_products_installed.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_products_installed.rs @@ -1,5 +1,5 @@ -//! Methods of `Host`: `pattern`. Methods of `Rig`: `allocate`, `old_expected`, `products_step`, `candidate` and 8 more. -//! Functions: `encode`, `read_pair`, `count_difference`, `allocate_all` and 4 more. Defines `Host`, `Rig`. +//! Root-only GPU test of the whole-product GDN step boundary: the candidate step over whole Q/K/H/gate/beta +//! owners must equal the old marshalled step bit for bit, keep unused tails intact and refuse bad shapes and aliases. use super::*; use crate::{Device, Driver, GdnGates, GdnQkv, GdnStepProducts, GdnStepResult}; diff --git a/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/context.rs b/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/context.rs index eccf3342..6ee11b92 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/context.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/context.rs @@ -1,5 +1,4 @@ -//! Methods of `Context`: `gr_microbatch_read`. Functions: `checked_row`, `encode`. -//! Split out of `gr_batch_read` to keep its files under the line limit. +//! Context constructor of the GR micro-batch read, with the row-range check and the f32 byte encoding it uses. use super::{Context, Error, GrMicrobatchRead, Result}; diff --git a/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read.rs b/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read.rs index 06529b7d..c169c2b6 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `gr_microbatch_read_inject`, `gr_microbatch_read_open`, `micro_stage_launch`. -//! Split out of `gr_batch_read` to keep its files under the line limit. +//! The GR micro-batch read: retained row banks and a program of GR kernels with finite scans; the submodules split +//! it into opening, the per-row read launch and the residual inject. use super::{ Arguments, Context, DeviceBuffer, Error, FixedKernel, GrMicroValues, GrMicrobatchRead, OPS, Operation, RESERVE, diff --git a/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read/gr_microbatch_read_inject.rs b/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read/gr_microbatch_read_inject.rs index ad94c917..c1885db9 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read/gr_microbatch_read_inject.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read/gr_microbatch_read_inject.rs @@ -1,5 +1,5 @@ -//! Methods of `GrMicrobatchRead`: `inject`, `inject_handles`, `inject_admit`, `inject_arguments` and 11 more. -//! Split out of `gr_microbatch_read` to keep its files under the line limit. +//! Residual inject of the GR micro-batch read: uploads the blocks, runs the inject kernel and finite scan per row, +//! publishes the candidate as the next input bank, and closes the owner (buffers and helper module). use super::{ Arguments, Error, FixedKernel, GrMicrobatchRead, Operation, Result, combine, decode, encode, ffi, qwen_ffi, diff --git a/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read/gr_microbatch_read_open.rs b/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read/gr_microbatch_read_open.rs index b00dce61..faa6aa82 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read/gr_microbatch_read_open.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read/gr_microbatch_read_open.rs @@ -1,5 +1,5 @@ -//! Methods of `GrMicrobatchRead`: `new`, `admit_inputs`, `open`, `load_finite` and 10 more. -//! Split out of `gr_microbatch_read` to keep its files under the line limit. +//! Opening the GR micro-batch read: input and budget admission, bank allocation, finite-scan helper loading, +//! accessors, alias checks against the weights, and the per-row kernel argument assembly. use super::{ Arguments, Context, DeviceBuffer, Error, GrMicrobatchRead, OPS, Operation, RESERVE, Result, SIZES, checked_row, diff --git a/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read/micro_stage_launch.rs b/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read/micro_stage_launch.rs index 80b09420..9aeff621 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read/micro_stage_launch.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read/micro_stage_launch.rs @@ -1,5 +1,5 @@ -//! Methods of `GrMicrobatchRead`: `read`, `micro_kernels_guarded`, `micro_enqueue`, `micro_complete` and 6 more. -//! Defines `MicroKernels`. +//! The read of the GR micro-batch: per row the six GR kernels each followed by a finite scan, enqueued, fenced and +//! settled so an earlier numerical refusal wins over a later enqueue failure; products are decoded on success. use super::{ Arguments, DeviceBuffer, Error, FixedKernel, GrMicroValues, GrMicrobatchRead, OPS, Result, SIZES, STAGES, combine, diff --git a/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read_drop.rs b/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read_drop.rs index 6ee6d183..c1050240 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read_drop.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read_drop.rs @@ -1,5 +1,4 @@ -//! Implements `Drop for GrMicrobatchRead`. Functions: `decode`. -//! Split out of `gr_batch_read` to keep its files under the line limit. +//! Drop of the GR micro-batch read (closes it) and the decoding of a device buffer to finite canonical f32 values. use super::{DeviceBuffer, Error, GrMicrobatchRead, Result}; diff --git a/crates/cuda-driver/src/qwen_dispatch/gr_native_batch/context.rs b/crates/cuda-driver/src/qwen_dispatch/gr_native_batch/context.rs index a4245dcd..daa5ae8b 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gr_native_batch/context.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gr_native_batch/context.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `gr_native_batch`, `gr_native_prompt_batch`. Functions: `encode`, `decode`. -//! Split out of `gr_native_batch` to keep its files under the line limit. +//! Context constructors of the native GR batch (decode and prompt-sized variants) and the f32 byte encode and +//! finite-checked decode helpers. use super::{Context, DeviceBuffer, Error, GrNativeBatch, GrNativeProfile, Result}; diff --git a/crates/cuda-driver/src/qwen_dispatch/gr_native_batch/gr_native_batch_drop.rs b/crates/cuda-driver/src/qwen_dispatch/gr_native_batch/gr_native_batch_drop.rs index f76b3277..c5920c72 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gr_native_batch/gr_native_batch_drop.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gr_native_batch/gr_native_batch_drop.rs @@ -1,5 +1,4 @@ -//! Implements `Drop for GrNativeBatch`. -//! Split out of `gr_native_batch` to keep its files under the line limit. +//! Drop of the native GR batch: closes it and ignores the result. use super::GrNativeBatch; diff --git a/crates/cuda-driver/src/qwen_dispatch/gr_native_batch/gr_native_batch_operations/native_command_drain.rs b/crates/cuda-driver/src/qwen_dispatch/gr_native_batch/gr_native_batch_operations/native_command_drain.rs index c0993ded..f3035ab6 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gr_native_batch/gr_native_batch_operations/native_command_drain.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gr_native_batch/gr_native_batch_operations/native_command_drain.rs @@ -1,5 +1,5 @@ -//! Methods of `GrNativeBatch`: `finish`, `native_status`, `native_settle`, `native_fail` and 13 more. -//! Defines `NativeDrain`. +//! Native GR read: builds the kernel arguments and command list in the literal Original order, drains the vendor +//! stream, reads the finite status words back and settles them (a failed drain or pop poisons the context). use super::native_gemm_launch::GemmRoles; use super::{ diff --git a/crates/cuda-driver/src/qwen_dispatch/gr_native_batch/gr_native_batch_operations/native_gemm_launch.rs b/crates/cuda-driver/src/qwen_dispatch/gr_native_batch/gr_native_batch_operations/native_gemm_launch.rs index 4b4d1274..9f42f75b 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gr_native_batch/gr_native_batch_operations/native_gemm_launch.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gr_native_batch/gr_native_batch_operations/native_gemm_launch.rs @@ -1,5 +1,5 @@ -//! Methods of `GrNativeBatch`: `prompt_device_bytes`, `new`, `new_bounded`, `check_new_inputs` and 15 more. -//! Defines `GemmRoles`. +//! Construction and plumbing of the native GR batch: sizing, admission, buffer and module setup, alias checks, +//! kernel argument helpers, and the Original GEMM over the high (and low) image. use super::{ A, BYTES, Blas, Context, DeviceBuffer, ENTRIES, Error, GrNativeBatch, GrNativeProfile, KernelArguments, diff --git a/crates/cuda-driver/src/qwen_dispatch/gr_native_batch/gr_native_batch_operations/native_inject.rs b/crates/cuda-driver/src/qwen_dispatch/gr_native_batch/gr_native_batch_operations/native_inject.rs index 908906e8..6c551e67 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gr_native_batch/gr_native_batch_operations/native_inject.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gr_native_batch/gr_native_batch_operations/native_inject.rs @@ -1,5 +1,5 @@ -//! Methods of `GrNativeBatch`: `inject`, `check_inject`, `stage_blocks`, `inject_args` and 6 more. -//! Defines `StatusReset`. +//! Residual inject of the native GR batch: stages the blocks, enqueues the inject kernel and scans, and takes the +//! injected result; also closing the batch (module and buffer retirement). use super::native_command_drain::NativeDrain; use super::{ diff --git a/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/gpu/bytes_of.rs b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/gpu/bytes_of.rs index d232f7d4..5f5ff615 100644 --- a/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/gpu/bytes_of.rs +++ b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/gpu/bytes_of.rs @@ -1,5 +1,5 @@ -//! Methods of `HostGemm`: `run`, `poison_output`. Implements `GdnGemm for HostGemm`. -//! Functions: `bytes_of`, `words_of`, `halves_of`, `f16_bits` and 13 more. +//! Host-side helpers of the MoE prefill GPU smoke test: FP16/BF16 conversions, Q8_0 blocks, deterministic patterns, +//! and HostGemm, the host stand-in for the closed cuBLAS GEMM adapter (it records calls and can poison an output word). use super::{ Context, DeviceBuffer, EXPERTS, Error, GdnGemm, GdnStream, GemmShape, HostGemm, Q8_0_BLOCK, Result, combine, diff --git a/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/gpu/clean_window_check.rs b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/gpu/clean_window_check.rs index d17a28ee..491e3885 100644 --- a/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/gpu/clean_window_check.rs +++ b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/gpu/clean_window_check.rs @@ -1,5 +1,5 @@ -//! Functions: `check_clean`, `check_down_reads_h`, `check_dequantized_scratch`, `check_mixed_images` and 5 more. -//! Split out of `gpu` to keep its files under the line limit. +//! Checks of a clean MoE prefill window in the GPU smoke test: GEMM call sequence, dequantization, image packing, +//! route against a host softmax/top-10, shared SwiGLU and the combine, all against host references. use super::{ Captured, EXPERTS, Error, FF, Fixture, HostGemm, MoeRouteBatch, N, Result, SELECTED, Window, bf_bits, bf_value, diff --git a/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/gpu/fixture.rs b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/gpu/fixture.rs index 09a00613..e67d0424 100644 --- a/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/gpu/fixture.rs +++ b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/gpu/fixture.rs @@ -1,5 +1,5 @@ -//! Methods of `Fixture`: `new`, `release`. Methods of `Images`: `new`. -//! Functions: `blank`, `bf16_matrix`, `run_case`, `run_window` and 1 more. Defines `Window`. +//! Fixture of the MoE prefill GPU smoke test: uploaded inputs and blank outputs (images, routing, experts, +//! products), the Window describing one program run, and run_case/run_window which enqueue the full program. use super::{ Captured, Cell, Context, DeviceBuffer, EXPERTS, Error, Experts, FF, Fixture, GdnNativeFormat, HostGemm, Images, diff --git a/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/moe_batch_prefix.rs b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/moe_batch_prefix.rs index ca07b439..4daf2a9a 100644 --- a/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/moe_batch_prefix.rs +++ b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/moe_batch_prefix.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `combine_stage`, `moe_batch_prefix_router_pack`, `shared_expert_projections`. -//! Split out of `moe_prefill_batch` to keep its files under the line limit. +//! The MoE batch prefix: an owned program of router, shared-expert and optional combine stages over a token window; +//! the submodules split it into router/binding base, shared-expert projections, and the combine plus drain. use super::{ Command, Context, DeviceBuffer, Drained, EXPERTS, Error, F16, F32, FF, GdnNativeFormat, GemmShape, diff --git a/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/moe_batch_prefix/combine_stage.rs b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/moe_batch_prefix/combine_stage.rs index e27f5118..d425a928 100644 --- a/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/moe_batch_prefix/combine_stage.rs +++ b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/moe_batch_prefix/combine_stage.rs @@ -1,5 +1,5 @@ -//! Methods of `MoeBatchPrefix`: `combine_from`, `combine_body`, `combine_inputs`, `upload_slot_map` and 8 more. -//! Methods of `DrainStaging`: `new`. Defines `DrainStaging`. +//! Tail of the MoE batch prefix: the combine-only program and combine body (row-map upload), finish, and the fenced +//! drain that reads the status words and optional route back after one completion fence (failures poison the context). use super::{ Context, DeviceBuffer, Drained, EXPERTS, Error, F32, MoeBatchCompletion, MoeBatchPrefix, MoeBatchStage, diff --git a/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/moe_batch_prefix/moe_batch_prefix_router_pack.rs b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/moe_batch_prefix/moe_batch_prefix_router_pack.rs index f5927882..bac7ceb5 100644 --- a/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/moe_batch_prefix/moe_batch_prefix_router_pack.rs +++ b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/moe_batch_prefix/moe_batch_prefix_router_pack.rs @@ -1,5 +1,5 @@ -//! Methods of `MoeBatchPrefix`: `tokens`, `ready`, `latch`, `moe_function` and 13 more. -//! Functions: `bind_size_admitted`. +//! Base and router head of the MoE batch prefix: step order, role-bound buffer admission, kernel pushes, ordered finite +//! scans, packing of the mixed activation images, and the BF16 router with its top-10 route kernel. use super::{ Command, DeviceBuffer, EXPERTS, Error, F16, F32, GemmShape, MoeBatchPrefix, MoeBatchStage, MoeKernel, N, Result, diff --git a/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/moe_batch_prefix/shared_expert_projections.rs b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/moe_batch_prefix/shared_expert_projections.rs index 4926988d..3b75ff50 100644 --- a/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/moe_batch_prefix/shared_expert_projections.rs +++ b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/moe_batch_prefix/shared_expert_projections.rs @@ -1,5 +1,5 @@ -//! Methods of `MoeBatchPrefix`: `project_native`, `push_dequant`, `shared_gate`, `shared_up` and 4 more. -//! Defines `NativeProjection`, `ProjectionOperands`. +//! Shared-expert stages of the MoE batch prefix: native dequantize-then-GEMM projections (gate, up, down), the SwiGLU +//! pair, the shared scalar gate, and the optional combine kernel, each followed by its finite scan. use super::{ Command, DeviceBuffer, Error, F16, F32, FF, GdnNativeFormat, GemmShape, MoeBatchPrefix, MoeBatchStage, MoeKernel, diff --git a/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/pinned.rs b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/pinned.rs index b53833f2..b0c73640 100644 --- a/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/pinned.rs +++ b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/pinned.rs @@ -1,5 +1,5 @@ -//! Methods of `MoeKernel`: `entry`, `index`. Methods of `MoeBatchStage`: `slot`, `elements`, `is_half`, `bytes`. -//! Functions: `pinned`, `prefill_asset`, `format_index`, `linear` and 1 more. +//! Pinned sealed PTX of the MoE prefill kernels (digest-checked), kernel entry names, weight format indices, the stage +//! table (slot, elements, bytes), status decoding, step order, role bindings and the Context constructor. use super::{ Bindings, Context, EXPERTS, Error, F16, F32, FF, GdnNativeFormat, MOE_PTX_LEN, MOE_PTX_SHA256, MoeBatchStage, diff --git a/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/words.rs b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/words.rs index ebeb807d..bb324af2 100644 --- a/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/words.rs +++ b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/words.rs @@ -1,5 +1,5 @@ -//! Methods of `MoePrefillBatch`: `close_inner`, `retire_buffer`, `retire_module`. -//! Implements `Drop for MoePrefillBatch`. Functions: `words`, `check_slot_map`, `staging`. +//! Teardown of the MoE prefill batch owner (buffer and module retirement, Drop), host word and staging helpers, +//! and the check that the routed-row map is a permutation of all routed rows. use super::{DeviceBuffer, Error, MOE_BATCH_MAX_TOKENS, MoePrefillBatch, Result, SELECTED, combine, ffi}; diff --git a/crates/cuda-driver/src/qwen_dispatch/mtp_input_workspace/gpu/bytes.rs b/crates/cuda-driver/src/qwen_dispatch/mtp_input_workspace/gpu/bytes.rs index f89112d9..ab453fbf 100644 --- a/crates/cuda-driver/src/qwen_dispatch/mtp_input_workspace/gpu/bytes.rs +++ b/crates/cuda-driver/src/qwen_dispatch/mtp_input_workspace/gpu/bytes.rs @@ -1,5 +1,5 @@ -//! Functions: `bytes`, `upload`, `read`, `full_finite` and 13 more. Defines `Step`. -//! Split out of `gpu` to keep its files under the line limit. +//! Fixtures and the original reference of the MTP input GPU test: byte helpers, inputs, comparison and refusal +//! checks, the independent scalar sequence of norms, projections and broadcast, and the queued candidate readback. use super::{ Context, DenseFormat, DeviceBuffer, Error, MtpInputCompletion, MtpInputRefusal, MtpInputWorkspace, Numeric, diff --git a/crates/cuda-driver/src/qwen_dispatch/mtp_input_workspace/gpu/numeric_case.rs b/crates/cuda-driver/src/qwen_dispatch/mtp_input_workspace/gpu/numeric_case.rs index fc6fdb12..066345a9 100644 --- a/crates/cuda-driver/src/qwen_dispatch/mtp_input_workspace/gpu/numeric_case.rs +++ b/crates/cuda-driver/src/qwen_dispatch/mtp_input_workspace/gpu/numeric_case.rs @@ -1,5 +1,5 @@ -//! Functions: `numeric_case`, `run`, `run_cases`, `upload_corpus` and 5 more. -//! Split out of `gpu` to keep its files under the line limit. +//! Numeric and refusal cases of the MTP input GPU test: non-finite inputs must refuse at the same stage as the +//! original sequence, malformed sources and weights are refused, and the prefix stays drainable. use super::{ Context, DeviceBuffer, Error, MtpInputRefusal, MtpInputWorkspace, Numeric, Report, Result, STAGES, TOTAL, bytes, diff --git a/crates/cuda-driver/src/qwen_dispatch/mtp_input_workspace/mtp_input_completion.rs b/crates/cuda-driver/src/qwen_dispatch/mtp_input_workspace/mtp_input_completion.rs index d688b093..e910b685 100644 --- a/crates/cuda-driver/src/qwen_dispatch/mtp_input_workspace/mtp_input_completion.rs +++ b/crates/cuda-driver/src/qwen_dispatch/mtp_input_workspace/mtp_input_completion.rs @@ -1,5 +1,5 @@ -//! Methods of `MtpInputCompletion`: `numerical_refusal`, `refusal_stage`, `into_streams`. -//! Methods of `Context`: `mtp_input_workspace`. Functions: `qwen_functions`, `stage_inputs`. +//! The MTP input workspace owner and its completion: Context constructor, admission, bring-up (kernels and nine +//! private owners), begin, close, and the completion that reports a numerical refusal or hands out the streams. use super::{ Context, DenseFormat, DeviceBuffer, Error, Kernels, MtpInputCompletion, MtpInputPrefix, MtpInputRefusal, diff --git a/crates/cuda-driver/src/qwen_dispatch/mtp_input_workspace/mtp_input_prefix.rs b/crates/cuda-driver/src/qwen_dispatch/mtp_input_workspace/mtp_input_prefix.rs index de912931..19e2b9c3 100644 --- a/crates/cuda-driver/src/qwen_dispatch/mtp_input_workspace/mtp_input_prefix.rs +++ b/crates/cuda-driver/src/qwen_dispatch/mtp_input_workspace/mtp_input_prefix.rs @@ -1,5 +1,5 @@ -//! Methods of `MtpInputPrefix`: `weight`, `ready`, `latch`, `status` and 14 more. Methods of `DrainStaging`: `new`. -//! Functions: `first_refusal`, `queue_qwen`, `square_shape`. Defines `DrainStaging`. +//! Builder of the MTP input prefix: queues the embedding norm, projections and broadcast one admitted phase at a time. +//! Its drain uploads inputs, runs the queue, reads the status words and turns the first nonzero one into a refusal. use super::{ Admission, Arguments, Command, Context, DenseFormat, DeviceBuffer, Drained, Error, MtpInputCompletion, diff --git a/crates/cuda-driver/src/qwen_dispatch/ple_closed_queue/float_owner.rs b/crates/cuda-driver/src/qwen_dispatch/ple_closed_queue/float_owner.rs index c3cbd70b..6bf5f1f6 100644 --- a/crates/cuda-driver/src/qwen_dispatch/ple_closed_queue/float_owner.rs +++ b/crates/cuda-driver/src/qwen_dispatch/ple_closed_queue/float_owner.rs @@ -1,5 +1,5 @@ -//! Methods of `Command`: `launch`. Functions: `float_owner`. -//! Split out of `ple_closed_queue` to keep its files under the line limit. +//! Host f32 allocation helper and the launch of one queued PLE command (a Qwen operator or a finite-guard kernel). +//! Kept apart so the queue files share one place that turns a command into a driver launch. use super::{Command, Context, Error, Result}; diff --git a/crates/cuda-driver/src/qwen_dispatch/ple_closed_queue/ple_closed_completion.rs b/crates/cuda-driver/src/qwen_dispatch/ple_closed_queue/ple_closed_completion.rs index bc830ba6..16ff6b06 100644 --- a/crates/cuda-driver/src/qwen_dispatch/ple_closed_queue/ple_closed_completion.rs +++ b/crates/cuda-driver/src/qwen_dispatch/ple_closed_queue/ple_closed_completion.rs @@ -1,5 +1,5 @@ -//! Methods of `PleClosedCompletion`: `numerical_refusal`, `into_parts`. Methods of `Context`: `ple_closed_queue`. -//! Functions: `check_charge`. +//! Result of a completed closed PLE queue (numeric refusal or the final streams) and construction of the queue. +//! Construction validates the operator assets and checks the charge plus reserve against budget and free memory. use super::{ Admission, Arguments, CHARGE, Command, Context, DeviceBuffer, Error, OPS, OUTPUTS, Operation, PleClosedCompletion, diff --git a/crates/cuda-driver/src/qwen_dispatch/ple_closed_queue/ple_closed_queue_compose_close.rs b/crates/cuda-driver/src/qwen_dispatch/ple_closed_queue/ple_closed_queue_compose_close.rs index a0a33a38..419a2d37 100644 --- a/crates/cuda-driver/src/qwen_dispatch/ple_closed_queue/ple_closed_queue_compose_close.rs +++ b/crates/cuda-driver/src/qwen_dispatch/ple_closed_queue/ple_closed_queue_compose_close.rs @@ -1,5 +1,5 @@ -//! Methods of `PleClosedQueue`: `compose`, `close`, `close_inner`. Implements `Drop for PleClosedQueue`. -//! Functions: `staging`, `float_staging`, `release_buffer`. +//! Runs one closed PLE composition: checks inputs, drains the queued kernels, reads results back under the guard. +//! Also owns closing the queue: frees the buffers and unloads the kernel module, or leaks them on a poisoned context. use super::compose_phases::ComposeHost; use super::{ diff --git a/crates/cuda-driver/src/qwen_dispatch/prepare_gr_read_set.rs b/crates/cuda-driver/src/qwen_dispatch/prepare_gr_read_set.rs index 0f40cb46..bf103350 100644 --- a/crates/cuda-driver/src/qwen_dispatch/prepare_gr_read_set.rs +++ b/crates/cuda-driver/src/qwen_dispatch/prepare_gr_read_set.rs @@ -1,5 +1,6 @@ -//! Functions: `prepare_gr_read_set`, `load_gr_missing`, `load_gr_entry`, `unload_gr_pending` and 12 more. -//! Split out of `qwen_dispatch` to keep its files under the line limit. +//! Kernel-set preparation and operand checks of the GR read path. +//! Loads the six fixed GR read kernels all-or-nothing (published only after every entry resolves), unloads the cache, +//! and validates operand ranges, launch geometry and output aliasing of a Qwen operation. use super::{Backend, Cache, Error, OPERATIONS, Operation, Result, combine, ffi, qwen_ffi, restore}; // used only with some cargo features or targets of this crate diff --git a/crates/cuda-driver/src/qwen_dispatch/queued_gr_installed.rs b/crates/cuda-driver/src/qwen_dispatch/queued_gr_installed.rs index ce910b5a..48d83da9 100644 --- a/crates/cuda-driver/src/qwen_dispatch/queued_gr_installed.rs +++ b/crates/cuda-driver/src/qwen_dispatch/queued_gr_installed.rs @@ -1,5 +1,5 @@ -//! Functions: `execute_read`, `read_outputs`, `residual_bytes`, `allocate_all` and 10 more. -//! Split out of `qwen_dispatch` to keep its files under the line limit. +//! GPU-only ignored test: runs the original GR read chain and the queued single-completion chain on the same inputs. +//! It requires identical output words, the injected-guard refusals and a clean status reset, with all buffers freed. use super::*; use crate::{Driver, GrReadInputs, GrReadOutputs}; diff --git a/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace.rs b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace.rs index 78a443bf..69aa082e 100644 --- a/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace.rs +++ b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `shared_expert_workspace_append_close`, `shared_expert_workspace_bring_up`, `shared_expert_... -//! Split out of `qwen_shared_tail` to keep its files under the line limit. +//! Shared-expert workspace: groups bring-up, composition, and append/teardown, which share the workspace struct. +//! Each part keeps one lifecycle responsibility. use super::{ Admission, Arguments, Command, Context, DenseFormat, DeviceBuffer, Error, Kernels, OPERATIONS, Operation, Pair, diff --git a/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace/shared_expert_workspace_append_close.rs b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace/shared_expert_workspace_append_close.rs index 2174fc99..885f2906 100644 --- a/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace/shared_expert_workspace_append_close.rs +++ b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace/shared_expert_workspace_append_close.rs @@ -1,5 +1,5 @@ -//! Methods of `SharedExpertWorkspace`: `append_qwen`, `close`, `close_inner`, `unload_module`. -//! Functions: `release_buffer`. +//! Shared-expert workspace: validated queuing of one Qwen operator, and teardown. +//! Teardown frees every buffer and unloads the kernel module under the guard, or leaks them on a poisoned context. use super::{ Admission, Arguments, Command, Context, DeviceBuffer, Error, Operation, Result, SharedExpertWorkspace, admission, diff --git a/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace/shared_expert_workspace_bring_up.rs b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace/shared_expert_workspace_bring_up.rs index d79c4ec2..2fc3d49f 100644 --- a/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace/shared_expert_workspace_bring_up.rs +++ b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace/shared_expert_workspace_bring_up.rs @@ -1,5 +1,5 @@ -//! Methods of `SharedExpertWorkspace`: `new`, `init_resources`, `load_kernels`, `allocated_bytes` and 6 more. -//! Functions: `check_new`, `common_pair`, `projection_pairs`. +//! Bring-up of the shared-expert workspace: asset and budget checks, buffer allocation, kernel loading, accessors. +//! Also the admission of caller inputs: right size, same context, and no overlap with the workspace-owned buffers. use super::{ Context, DenseFormat, DeviceBuffer, Error, Kernels, OPERATIONS, Pair, ProjectionKind, ProjectionStyle, RESERVE, diff --git a/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace/shared_expert_workspace_compose.rs b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace/shared_expert_workspace_compose.rs index 197723bc..2826a316 100644 --- a/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace/shared_expert_workspace_compose.rs +++ b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace/shared_expert_workspace_compose.rs @@ -1,5 +1,5 @@ -//! Methods of `SharedExpertWorkspace`: `compose`. -//! Split out of `shared_expert_workspace` to keep its files under the line limit. +//! Entry point of one shared-expert tail run: admits the inputs, drains the queue under the context guard. +//! Numeric flags are arbitrated after the final drain, so the workspace stays a bounded queue, not an operator API. use super::shared_phases::SharedStaging; use super::{DeviceBuffer, Error, Result, SharedExpertWeights, SharedExpertWorkspace, SharedTailCompletion}; diff --git a/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace_drop.rs b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace_drop.rs index eb503d59..15e2fc33 100644 --- a/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace_drop.rs +++ b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace_drop.rs @@ -1,5 +1,5 @@ -//! Methods of `Command`: `launch`. Implements `Drop for SharedExpertWorkspace`. -//! Functions: `staging`, `status_spans`, `first_refusal`, `append_finite` and 3 more. +//! Drop of the shared-expert workspace plus the helpers that queue its work: status-word spans, finite guards, +//! quantize-and-project commands and the stage arbitration that maps a status word to a refusal. use super::{ Command, Context, Error, Pair, ProjectionSpec, ProjectionStyle, Result, STAGES, SharedExpertWorkspace, diff --git a/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_gu_kind.rs b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_gu_kind.rs index 8da85b14..48e04ad4 100644 --- a/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_gu_kind.rs +++ b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_gu_kind.rs @@ -1,5 +1,5 @@ -//! Methods of `SharedGuKind`: `index`, `weight_bytes`. Methods of `SharedDownKind`: `index`, `weight_bytes`. -//! Split out of `qwen_shared_tail` to keep its files under the line limit. +//! Per-kind constants of the shared-expert weights (index and byte size of each gate/up and down format), +//! the accessors of a finished shared-tail run, and the context method that creates the workspace. use super::{ Context, Result, SharedDownKind, SharedExpertWorkspace, SharedGuKind, SharedTailCompletion, SharedTailRefusal, diff --git a/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_tail_gpu/guard_probe.rs b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_tail_gpu/guard_probe.rs index 5ea71dc0..0bc983a7 100644 --- a/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_tail_gpu/guard_probe.rs +++ b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_tail_gpu/guard_probe.rs @@ -1,5 +1,5 @@ -//! Functions: `refused`, `probe_inputs`, `probe_weights`, `probe_alias` and 12 more. -//! Split out of `shared_tail_gpu` to keep its files under the line limit. +//! Shared-tail GPU test: per-kind compose cases, fault injection and the admission-guard probes. +//! Compares the workspace with the old per-role path and checks that short, foreign or aliasing operands are refused. use super::{ ComposeCase, Context, DOWN, DeviceBuffer, Error, GU, Oracle, ProjectionKinds, Report, RestoreHandle, Result, diff --git a/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_tail_gpu/original.rs b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_tail_gpu/original.rs index ad4f16a5..ed03249e 100644 --- a/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_tail_gpu/original.rs +++ b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_tail_gpu/original.rs @@ -1,5 +1,5 @@ -//! Methods of `OldPath`: `stage`, `product`, `gate`, `up` and 6 more. Methods of `RestoreHandle`: `new`. -//! Implements `Drop for RestoreHandle`. Functions: `refused`, `chain`, `original`, `compare` and 1 more. +//! Shared-tail GPU test oracle: replays the old multi-call path stage by stage for the expected products and refusal. +//! It then composes the same case on the workspace and compares every product, status and refusal word by word. use super::{ Context, DenseFormat, DeviceBuffer, Error, Oracle, ProjectionKind, ProjectionSpec, Report, RestoreHandle, Result, diff --git a/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_tail_gpu/read.rs b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_tail_gpu/read.rs index 96db614f..dc1a2a57 100644 --- a/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_tail_gpu/read.rs +++ b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_tail_gpu/read.rs @@ -1,5 +1,5 @@ -//! Functions: `read`, `f32_bytes`, `finite`, `input` and 7 more. -//! Split out of `shared_tail_gpu` to keep its files under the line limit. +//! Shared-tail GPU test fixtures: deterministic activations, routed packet, scalar weights and packed payloads +//! with finite scales, plus device read-back and the old-path projection call used as the oracle. use super::{ Context, DenseFormat, DeviceBuffer, ProjectionKind, ProjectionSpec, Q5KProjectionShape, Q6KProjectionShape, Result, diff --git a/crates/cuda-driver/src/qwen_dispatch/tests.rs b/crates/cuda-driver/src/qwen_dispatch/tests.rs index 21f92af4..0f2db625 100644 --- a/crates/cuda-driver/src/qwen_dispatch/tests.rs +++ b/crates/cuda-driver/src/qwen_dispatch/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of `qwen_dispatch`. +//! Host-only tests of the Qwen dispatch layer on a mock backend that records driver calls and injects faults. +//! Submodules pin the cache and slot publication, poison handling, atomic registration and that a launch always syncs. use super::*; use std::cell::RefCell; diff --git a/crates/cuda-driver/src/qwen_ffi/asset.rs b/crates/cuda-driver/src/qwen_ffi/asset.rs index da68ecf2..73feaa2b 100644 --- a/crates/cuda-driver/src/qwen_ffi/asset.rs +++ b/crates/cuda-driver/src/qwen_ffi/asset.rs @@ -1,5 +1,5 @@ -//! Methods of `Arguments`: `new`, `with_layout`, `layout`, `operation` and 2 more. Implements `Drop for Arguments`. -//! Functions: `asset`, `asset_group_0`, `asset_group_1`, `asset_group_2` and 10 more. +//! Sealed PTX asset lookup per Qwen operation, the launch-argument block handed to the driver, and a SHA-256. +//! Arguments owns heap storage whose parameter array points at its own fields; the digest pins the PTX in receipts. use super::{ Arguments, Asset, BF16_ASSETS, GDN_ASSETS, GR_ASSETS, KAR_PLE_ASSETS, Layout, MOE_ASSETS, MTP_DENSE_ASSETS, diff --git a/crates/cuda-driver/src/qwen_ffi/asset_validation_and_bf16_layout.rs b/crates/cuda-driver/src/qwen_ffi/asset_validation_and_bf16_layout.rs index 9521794e..261951ac 100644 --- a/crates/cuda-driver/src/qwen_ffi/asset_validation_and_bf16_layout.rs +++ b/crates/cuda-driver/src/qwen_ffi/asset_validation_and_bf16_layout.rs @@ -1,5 +1,5 @@ -//! Methods of `Operation`: `has_epsilon`. -//! Methods of `Asset`: `validate`, `identity_admitted`, `receipt_complete`, `validate_with_memo`. +//! Admission checks of a PTX asset (identity, pin equals receipt, complete provenance, memoized content digest) +//! and the launch layouts of the KAR PLE and BF16 projection kernels, plus the constructors of pinned assets. use super::{ Asset, Error, GDN_RECEIPT, GR_RECEIPT, H, HC, Layout, MOE_RECEIPT, N, OnceLock, Operation, PLE_RECEIPT, PTX_PROOFS, diff --git a/crates/cuda-driver/src/qwen_ffi/bf16_receipt_types.rs b/crates/cuda-driver/src/qwen_ffi/bf16_receipt_types.rs index 336e4fe2..454cb4cd 100644 --- a/crates/cuda-driver/src/qwen_ffi/bf16_receipt_types.rs +++ b/crates/cuda-driver/src/qwen_ffi/bf16_receipt_types.rs @@ -1,5 +1,5 @@ -//! Items of the parent module. -//! BF16_RECEIPT, BF16_ASSETS, PLE_RECEIPT, PLE_ASSETS, PLE_VALUE_FULL_RECEIPT, PLE_VALUE_FULL_ASSET .... +//! Frozen producer receipts and sealed assets for the BF16 projection, PLE, GR, GDN, MoE and QSA native/select kernels. +//! Constant tables only: each receipt pins the source, PTX and oracle hashes and records how the kernel was qualified. use super::{Asset, H, HC, N, Operation, Receipt, gdn_asset, gr_asset, moe_asset, ple_asset}; diff --git a/crates/cuda-driver/src/qwen_ffi/mock_asset.rs b/crates/cuda-driver/src/qwen_ffi/mock_asset.rs index 2412819a..53626da6 100644 --- a/crates/cuda-driver/src/qwen_ffi/mock_asset.rs +++ b/crates/cuda-driver/src/qwen_ffi/mock_asset.rs @@ -1,5 +1,5 @@ -//! Functions: `mock_asset`, `q6_batch_preview_ptx`, `gr_batch_preview_ptx`. -//! Split out of `qwen_ffi` to keep its files under the line limit. +//! Test-only mock asset for CPU-side dispatch tests (never reaches CUDA) and the pinned PTX of the Q6/GR previews. +//! The preview entry points check the PTX digest and are kept out of the production asset map. use super::{Error, Result, inspect_ptx}; #[cfg(test)] diff --git a/crates/cuda-driver/src/qwen_ffi/mtp_extended_assets_types.rs b/crates/cuda-driver/src/qwen_ffi/mtp_extended_assets_types.rs index 1040f3ae..1b30c50c 100644 --- a/crates/cuda-driver/src/qwen_ffi/mtp_extended_assets_types.rs +++ b/crates/cuda-driver/src/qwen_ffi/mtp_extended_assets_types.rs @@ -1,5 +1,5 @@ -//! Defines `Storage`, `Arguments`. -//! MTP_EXTENDED_ASSETS, MTP_S2_FULL_RECEIPT, MTP_S2_FULL_ASSETS, Storage, Arguments. +//! Receipt-pinned assets of the extended MTP kernels and of the full S2 expert kernels. +//! Also the launch-argument records: Storage is the raw parameter block and Arguments is its owning handle. use super::{Asset, Layout, MTP_GR_RECEIPT, MTP_S2_RECEIPT, NonNull, Operation, Receipt, c_void}; diff --git a/crates/cuda-driver/src/qwen_ffi/mtp_s2_full_layout.rs b/crates/cuda-driver/src/qwen_ffi/mtp_s2_full_layout.rs index 8557b485..f2391a80 100644 --- a/crates/cuda-driver/src/qwen_ffi/mtp_s2_full_layout.rs +++ b/crates/cuda-driver/src/qwen_ffi/mtp_s2_full_layout.rs @@ -1,5 +1,5 @@ -//! Methods of `Layout`: `flat`. -//! Functions: `mtp_s2_full_layout`, `mtp_extended_layout`, `mtp_gr_geometry`, `mtp_tile_geometry` and 2 more. +//! Fixed launch layouts of the MTP kernels: full S2 expert gate/up and down, extended GR and tile ops, input, dense. +//! Geometry comes only from constants, the expert index or the position, never from caller extents; also Layout::flat. use super::{Error, Layout, Operation, Result}; diff --git a/crates/cuda-driver/src/qwen_ffi/n_types.rs b/crates/cuda-driver/src/qwen_ffi/n_types.rs index 59056ad3..d191827e 100644 --- a/crates/cuda-driver/src/qwen_ffi/n_types.rs +++ b/crates/cuda-driver/src/qwen_ffi/n_types.rs @@ -1,5 +1,5 @@ -//! Defines `Operation`, `Layout`, `Receipt` and 2 more. -//! N, HC, H, Operation, OPERATIONS, QSA_OPERATIONS .... +//! Core types of the Qwen FFI layer: model dimensions N, HC and H, the Operation enum with its lists, +//! the launch Layout, the producer Receipt, the PTX Asset and PTX proof memo, and the router receipt and asset. use super::OnceLock; diff --git a/crates/cuda-driver/src/qwen_ffi/operation.rs b/crates/cuda-driver/src/qwen_ffi/operation.rs index e4aafc87..0b810b76 100644 --- a/crates/cuda-driver/src/qwen_ffi/operation.rs +++ b/crates/cuda-driver/src/qwen_ffi/operation.rs @@ -1,5 +1,5 @@ -//! Methods of `Operation`: `entry`, `entry_group_0`, `entry_group_1`, `entry_group_2` and 10 more. -//! Functions: `router_layout`. +//! Per-operation data of the Qwen kernels: the entry point name and the launch Layout of each Operation. +//! Layout selection delegates to the MTP, dense, KAR, QSA, MoE, PLE, GDN, router and elementwise families. use super::{ CStr, H, HC, Layout, N, Operation, QSA_OPERATIONS, bf16_layout, gdn_layout, kar_ple_layout, moe_layout, diff --git a/crates/cuda-driver/src/qwen_ffi/qsa_attention_receipt_types.rs b/crates/cuda-driver/src/qwen_ffi/qsa_attention_receipt_types.rs index 24fa6f56..d47a582c 100644 --- a/crates/cuda-driver/src/qwen_ffi/qsa_attention_receipt_types.rs +++ b/crates/cuda-driver/src/qwen_ffi/qsa_attention_receipt_types.rs @@ -1,5 +1,5 @@ -//! Items of the parent module. -//! QSA_ATTENTION_RECEIPT, QSA_GATE_RECEIPT, QSA_ASSETS, KAR_PLE_RECEIPT, KAR_PLE_ASSETS, MTP_INPUT_RECEIPT .... +//! Frozen receipts and sealed assets for the QSA attention and gate kernels, KAR PLE, and the MTP kernels. +//! Constant tables only: each receipt pins source, PTX and oracle hashes and records how the kernel was qualified. use super::{Asset, H, HC, N, Operation, Receipt, qsa_asset}; diff --git a/crates/cuda-driver/src/qwen_ffi/qsa_layout.rs b/crates/cuda-driver/src/qwen_ffi/qsa_layout.rs index 27e5f5f8..af62cdc6 100644 --- a/crates/cuda-driver/src/qwen_ffi/qsa_layout.rs +++ b/crates/cuda-driver/src/qwen_ffi/qsa_layout.rs @@ -1,5 +1,5 @@ -//! Functions: `qsa_layout`, `check_qsa_value`, `qsa_geometry`, `qsa_plain_geometry` and 5 more. Defines `QsaGeometry`. -//! Split out of `qwen_ffi` to keep its files under the line limit. +//! Fixed launch layouts of the QSA kernels (extents set by position or selected width) and of the PLE, MoE, GDN ones. +//! Every size and grid is a closed constant or a bounded function of one scalar, never a caller-supplied geometry. use super::{Error, Layout, Operation, QSA_OPERATIONS, Result}; diff --git a/crates/cuda-driver/src/qwen_ffi/tests.rs b/crates/cuda-driver/src/qwen_ffi/tests.rs index ea6aed40..d07c9506 100644 --- a/crates/cuda-driver/src/qwen_ffi/tests.rs +++ b/crates/cuda-driver/src/qwen_ffi/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of `qwen_ffi`. +//! Host tests of the Qwen FFI layer: layouts, ABI sizes, pointer order, receipts and the qualified assets. +//! Submodules are grouped by operation family (full S2, MoE, MTP, QSA). use super::*; diff --git a/crates/cuda-driver/src/routed_group_workspace/context.rs b/crates/cuda-driver/src/routed_group_workspace/context.rs index ec197dd6..be9f6a42 100644 --- a/crates/cuda-driver/src/routed_group_workspace/context.rs +++ b/crates/cuda-driver/src/routed_group_workspace/context.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `routed_group_workspace`. -//! Methods of `RoutedGroupWorkspace`: `allocated_bytes`, `is_failed`, `validate`, `disjoint` and 12 more. +//! Routed grouped-projection workspace: creation under the context budget, ownership and validation of its table, +//! Q8 and status buffers, the gate/up and down column projections with their admission checks, and release. use super::{ ALLOCATED_BYTES, Context, DeviceBuffer, Error, FixedKernel, FixedOperation, NativeWeights, ProjectionKind, diff --git a/crates/cuda-driver/src/routed_resident_queue/gpu/queue_cases.rs b/crates/cuda-driver/src/routed_resident_queue/gpu/queue_cases.rs index 4dc5bb0d..5c00626c 100644 --- a/crates/cuda-driver/src/routed_resident_queue/gpu/queue_cases.rs +++ b/crates/cuda-driver/src/routed_resident_queue/gpu/queue_cases.rs @@ -1,5 +1,5 @@ -//! Methods of `CaseRig`: `allocate`, `run`, `pair_over_inputs`, `refusal_pass` and 3 more. -//! Functions: `with_columns`, `block_width`, `case`, `refusal_step` and 2 more. +//! GPU proof cases of the routed resident queue: for each gate/up and down format and column count, it runs the +//! original path first, then the queue, and pins identical products, bad-count and foreign-weight refusals. use super::{ Context, DeviceBuffer, Error, Report, Result, RoutedFormat, RoutedGateUpQ8, RoutedResidentOutputs, diff --git a/crates/cuda-driver/src/routed_resident_queue/gpu/run.rs b/crates/cuda-driver/src/routed_resident_queue/gpu/run.rs index 8fa12fd1..ff7d4390 100644 --- a/crates/cuda-driver/src/routed_resident_queue/gpu/run.rs +++ b/crates/cuda-driver/src/routed_resident_queue/gpu/run.rs @@ -1,5 +1,5 @@ -//! Functions: `run`. -//! Split out of `gpu` to keep its files under the line limit. +//! Driver of the routed resident queue GPU proof: runs every gate/up and down format pair at 1 and 64 columns +//! plus one fault case on a single queue, then checks the allocation charge and closes the queue. use super::{CHARGE, CaseSpec, Context, Error, Report, Result, RoutedFormat, RoutedResidentQueue, case, combine}; diff --git a/crates/cuda-driver/src/routed_resident_queue/gpu/upload.rs b/crates/cuda-driver/src/routed_resident_queue/gpu/upload.rs index 9c2a4176..f2bd5cf5 100644 --- a/crates/cuda-driver/src/routed_resident_queue/gpu/upload.rs +++ b/crates/cuda-driver/src/routed_resident_queue/gpu/upload.rs @@ -1,5 +1,5 @@ -//! Functions: `upload`, `read`, `weights`, `activation` and 9 more. Defines `Refusal`. -//! Split out of `gpu` to keep its files under the line limit. +//! Fixtures and the original-path oracle of the routed resident queue GPU proof: uploads, deterministic weights and +//! activations, the original per-stage products with their refusal, and the comparison of the queue's completion. use super::{ Context, DeviceBuffer, DownColumns, Error, QueueProof, Report, Result, RoutedFormat, RoutedGateUpQ8, diff --git a/crates/cuda-driver/src/routed_resident_queue/routed_resident_completion.rs b/crates/cuda-driver/src/routed_resident_queue/routed_resident_completion.rs index da16ad00..b7dd8bb6 100644 --- a/crates/cuda-driver/src/routed_resident_queue/routed_resident_completion.rs +++ b/crates/cuda-driver/src/routed_resident_queue/routed_resident_completion.rs @@ -1,5 +1,5 @@ -//! Methods of `RoutedResidentCompletion`: `numerical_refusal`, `completed_hidden`, `completed_down`. -//! Methods of `Context`: `routed_resident_queue`. +//! Completion view of a routed resident queue run (which stage refused, the usable hidden and down products) +//! and bring-up of the queue: budget check, buffer allocation and warming of the grouped and finite kernels. use super::{ CHARGE, Context, DeviceBuffer, Error, FixedOperation, Q8, RESERVE, Result, RoutedResidentCompletion, diff --git a/crates/cuda-driver/src/routed_resident_queue/routed_resident_queue_drop.rs b/crates/cuda-driver/src/routed_resident_queue/routed_resident_queue_drop.rs index 95057b5f..00d1920b 100644 --- a/crates/cuda-driver/src/routed_resident_queue/routed_resident_queue_drop.rs +++ b/crates/cuda-driver/src/routed_resident_queue/routed_resident_queue_drop.rs @@ -1,5 +1,5 @@ -//! Methods of `Command`: `launch`. Implements `Drop for RoutedResidentQueue`. Functions: `gu_operation`, `scan`. -//! Split out of `routed_resident_queue` to keep its files under the line limit. +//! Drop of the routed resident queue, the mapping of a gate/up format to its grouped kernel, the finite scan command, +//! and the launch of each queued command kind through the driver. use super::{Command, Context, Error, FixedOperation, Result, RoutedFormat, RoutedResidentQueue, ffi}; diff --git a/crates/cuda-driver/src/tests.rs b/crates/cuda-driver/src/tests.rs index fd82d1f7..c9ed593e 100644 --- a/crates/cuda-driver/src/tests.rs +++ b/crates/cuda-driver/src/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of `crate`. +//! Tests of the CUDA driver crate root: GPU-only owned read-back (original first, raw words kept), checked subspans, +//! size and error composition, vector and matvec shape boundaries, and refusals that need no CUDA. #[cfg(all(feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] fn readback_source(size: usize, round: u32) -> Vec { diff --git a/crates/cuda-model/src/original_mtp_loader/loader_error.rs b/crates/cuda-model/src/original_mtp_loader/loader_error.rs index 7ea27db1..d59e71e2 100644 --- a/crates/cuda-model/src/original_mtp_loader/loader_error.rs +++ b/crates/cuda-model/src/original_mtp_loader/loader_error.rs @@ -1,5 +1,5 @@ -//! Methods of `LoaderError`: `message`. Methods of `WeightBankPlan`: `new`, `expert_reads`. -//! Implements `Iterator for ExpertReads`. Functions: `add`, `mul`, `ceil`, `aligned` and 10 more. Defines `Placement`. +//! Sizing arithmetic of the original MTP draft loader: loader error messages, overflow-checked helpers, +//! weight-bank expert read ranges, the draft K/V placement and byte plan, the coupled-sampler plan, the bind reserve. use super::{ BindInputs, COUPLED_HISTORY, CoupledPlan, EXPERT_BLOB_BYTES, EXPERT_READ_BYTES, ExpertReads, KvFormat, KvInputs, diff --git a/crates/cuda-model/src/original_mtp_loader/original_mtp_load_plan.rs b/crates/cuda-model/src/original_mtp_loader/original_mtp_load_plan.rs index 89134258..e8fa45d3 100644 --- a/crates/cuda-model/src/original_mtp_loader/original_mtp_load_plan.rs +++ b/crates/cuda-model/src/original_mtp_loader/original_mtp_load_plan.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpLoadPlan`: `new`, `kv_inputs`, `check_profile`, `check_session` and 9 more. -//! Split out of `original_mtp_loader` to keep its files under the line limit. +//! The whole load plan of the original MTP draft: validates a startup capture against the one closed profile, +//! then derives the weight bank, K/V plan, mapped staging, bind reserve and coupled layout from it. use super::{ CLOSED_MAX_CELLS, CLOSED_WINDOW, CoupledPlan, KvInputs, KvMode, KvPlan, LoaderError, OriginalMtpCapture, diff --git a/crates/cuda-model/src/original_mtp_loader/tests.rs b/crates/cuda-model/src/original_mtp_loader/tests.rs index 73d047e5..4601297a 100644 --- a/crates/cuda-model/src/original_mtp_loader/tests.rs +++ b/crates/cuda-model/src/original_mtp_loader/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests that pin the MTP load plan: the shipped profile gives the retained ring layout byte for byte, +//! profiles outside the closed set are refused with a reason, and bank, reserve, coupled plan, staging match. use super::*; diff --git a/crates/cuda-model/src/original_prefill_schedule/planner.rs b/crates/cuda-model/src/original_prefill_schedule/planner.rs index d78213e2..bbe42a1c 100644 --- a/crates/cuda-model/src/original_prefill_schedule/planner.rs +++ b/crates/cuda-model/src/original_prefill_schedule/planner.rs @@ -1,5 +1,5 @@ -//! Methods of `Planner`: `new`, `push`, `issue_until`, `plan_chunk` and 5 more. -//! Functions: `is_stream_all`, `check_config`, `chunk_sequence`, `staging_jobs` and 5 more. +//! Planner of the original prefill expert streaming: builds the per-chunk schedule of copies, waits and computes +//! for the stream_all and staged walks, and a ring/event checker that rejects unsafe slot reuse in a planned trace. use super::{ ChunkStreaming, CopySource, IssueState, JobKind, PlanError, Planner, RING_MAX, STAGE, SchedOp, Slot, SourceView, diff --git a/crates/cuda-model/src/original_prefill_schedule/tests.rs b/crates/cuda-model/src/original_prefill_schedule/tests.rs index 84ef1771..6d7e461b 100644 --- a/crates/cuda-model/src/original_prefill_schedule/tests.rs +++ b/crates/cuda-model/src/original_prefill_schedule/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests that pin the prefill schedule: the traces, PLE read-ahead and fuse rule match golden values from the original; +//! ring slot sizing and chunk hand-off follow its rules, and the checker rejects unsafe or malformed schedules. use super::*; use serde_json::Value; diff --git a/crates/cuda-model/src/qsa_prompt_attention_select/pool_presence.rs b/crates/cuda-model/src/qsa_prompt_attention_select/pool_presence.rs index 1bc5a2ce..162760a7 100644 --- a/crates/cuda-model/src/qsa_prompt_attention_select/pool_presence.rs +++ b/crates/cuda-model/src/qsa_prompt_attention_select/pool_presence.rs @@ -1,5 +1,5 @@ -//! Methods of `PoolPresence`: `int8`, `fp16`, `hybrid_k8v4`, `q4`. `impl Shapes`. -//! Functions: `align_up`, `smem_bytes`, `smem2_bytes`, `pools_admitted` and 9 more. +//! Kernel selection of the QSA prompt attention: which K/V pools are present, admission of pools and shapes, +//! the port of the original decision tree for CUDA, shared-memory sizes, launch slicing and an FP64 reference. use super::{ CH, CH2, CStr, DEFAULT_SHARED_LIMIT, DeviceCaps, ENTRY_FP16, ENTRY_K8V4, ENTRY_V1_INT8, ENTRY_V2_INT8, G, HD, diff --git a/crates/cuda-model/src/qsa_prompt_attention_select/q_prescale.rs b/crates/cuda-model/src/qsa_prompt_attention_select/q_prescale.rs index 0ac6025c..dd08ddf5 100644 --- a/crates/cuda-model/src/qsa_prompt_attention_select/q_prescale.rs +++ b/crates/cuda-model/src/qsa_prompt_attention_select/q_prescale.rs @@ -1,5 +1,5 @@ -//! Functions: `q_prescale`, `pow2f`, `f16_hi_lo`, `f16_round` and 4 more. -//! Split out of `qsa_prompt_attention_select` to keep its files under the line limit. +//! Host model of the q pre-scale and FP16 hi/lo split the prompt attention kernels apply, with exact +//! binary16 rounding and conversion helpers (round to nearest even), so tests can reproduce the kernel numerics. /// The q pre-scale the kernels apply before the hi/lo FP16 split (exact, power of two): returns `(qe, qup, diff --git a/crates/cuda-model/src/qsa_prompt_attention_select/tests.rs b/crates/cuda-model/src/qsa_prompt_attention_select/tests.rs index 46020b0e..626ae88d 100644 --- a/crates/cuda-model/src/qsa_prompt_attention_select/tests.rs +++ b/crates/cuda-model/src/qsa_prompt_attention_select/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests that pin the prompt attention selection: smem sizes match the compiled structs, the decision tree per +//! architecture, pool and geometry, env switches, launch slicing, page-table rows, the entry table and FP16 rounding. use super::*; diff --git a/crates/cuda-model/src/s_gemv_legacy/tests.rs b/crates/cuda-model/src/s_gemv_legacy/tests.rs index 146a3015..e51b5e8f 100644 --- a/crates/cuda-model/src/s_gemv_legacy/tests.rs +++ b/crates/cuda-model/src/s_gemv_legacy/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests that pin the legacy S-GEMV model: golden cases match the shim-executed kernels bit for bit, +//! pack/unpack and FP16 round-trips, kernel entry names against the CUDA source, and launch plans with refusals. use super::*; use serde_json::Value; diff --git a/crates/experimental-ref/src/cache/tests.rs b/crates/experimental-ref/src/cache/tests.rs index 47ab8fae..22e6a047 100644 --- a/crates/experimental-ref/src/cache/tests.rs +++ b/crates/experimental-ref/src/cache/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the KV cache CPU twin: Q4 round trip within half a step in the rotated domain, the streaming write rule +//! (host always, VRAM only when resident), K8V4 composition, and refusal of fp16 and bad geometry. use super::*; use crate::fwht; diff --git a/crates/experimental-ref/src/cvec/load_control_vectors.rs b/crates/experimental-ref/src/cvec/load_control_vectors.rs index 28808825..bcfdfef4 100644 --- a/crates/experimental-ref/src/cvec/load_control_vectors.rs +++ b/crates/experimental-ref/src/cvec/load_control_vectors.rs @@ -1,5 +1,5 @@ -//! Functions: `direction_layer`, `add_scaled`, `add_file`, `steer_row` and 13 more. Defines `CvecRows`. -//! Split out of `cvec` to keep its files under the line limit. +//! Control-vector loading and application: sums the scaled per-layer directions of GGUF files into project/add tables, +//! and a literal twin of the cvec_apply kernel on the residual rows (warp butterfly sums, pending FFN write, steering). use super::{CvecError, CvecMode, CvecOptions, CvecTables, MAXK, THREADS, parse_gguf}; diff --git a/crates/experimental-ref/src/cvec/tests.rs b/crates/experimental-ref/src/cvec/tests.rs index 08d81e76..29e6edae 100644 --- a/crates/experimental-ref/src/cvec/tests.rs +++ b/crates/experimental-ref/src/cvec/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of control vectors: GGUF parsing (layer 0 and layers past the model ignored), project and add modes, single- +//! layer sources, rejections, steering of the residual streams, the pending FFN write and the warp reduction tree. use super::*; diff --git a/crates/experimental-ref/src/keyless/tests.rs b/crates/experimental-ref/src/keyless/tests.rs index 6a41c414..6af337c7 100644 --- a/crates/experimental-ref/src/keyless/tests.rs +++ b/crates/experimental-ref/src/keyless/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of keyless V-only QSA: query routing, output-major routing matrix, position handling, key reconstruction +//! of the first 64 dims, the routing artifact round trip with each admission failure, and block geometry. use super::*; diff --git a/crates/experimental-ref/src/kv_stream/map_bytes.rs b/crates/experimental-ref/src/kv_stream/map_bytes.rs index 1ea1d51f..77cf5a67 100644 --- a/crates/experimental-ref/src/kv_stream/map_bytes.rs +++ b/crates/experimental-ref/src/kv_stream/map_bytes.rs @@ -1,5 +1,5 @@ -//! Functions: `map_bytes`, `kv_plan`, `align16`, `qsa_state_bytes` and 2 more. Defines `StateCells`. -//! Split out of `kv_stream` to keep its files under the line limit. +//! KV streaming planner arithmetic: size of the residency map, the kv_plan mode choice (resident, ring, streamed), +//! QSA state and host-copy byte sizes, and the guards of a resolve call. use super::{ CTL_INTS, KV_RESIDENT_MIN, KvFormat, KvPlan, PlanSwitches, QsaShapes, RT, STEP_BYTES, StreamError, StreamFormat, diff --git a/crates/experimental-ref/src/kv_stream/residency_map.rs b/crates/experimental-ref/src/kv_stream/residency_map.rs index a6109cdb..47990a13 100644 --- a/crates/experimental-ref/src/kv_stream/residency_map.rs +++ b/crates/experimental-ref/src/kv_stream/residency_map.rs @@ -1,5 +1,5 @@ -//! Methods of `StreamMap`: `new`, `n_slots`, `reset`, `counters` and 11 more. -//! Functions: `ring_table`, `ring_restore`, `stage_from_host`, `observed_order` and 2 more. +//! The KV residency map (StreamMap): CPU model of the CLOCK resolver that claims slots for missed blocks, plus the +//! ring table, the ring restore and the staging copy from the host pool. use super::{ CTL_INTS, Counters, MissOrder, PoolSet, QsaShapes, RT, ResolveBatch, ResolveReport, RingSpan, StreamError, diff --git a/crates/experimental-ref/src/kv_stream/tests.rs b/crates/experimental-ref/src/kv_stream/tests.rs index 6b9ddab3..50293756 100644 --- a/crates/experimental-ref/src/kv_stream/tests.rs +++ b/crates/experimental-ref/src/kv_stream/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of KV streaming: plan modes, resolve guards, map consistency and counters after eviction, slots used by +//! the call never being victims, miss-order effects, refusal of too many blocks, ring table and state size. use super::*; diff --git a/crates/experimental-ref/src/layout/tests.rs b/crates/experimental-ref/src/layout/tests.rs index d6b29640..739c9741 100644 --- a/crates/experimental-ref/src/layout/tests.rs +++ b/crates/experimental-ref/src/layout/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of KV layouts: per-cell byte figures per format, pool arrays summing to them, 16-byte alignment, array +//! order, block bytes, uint4 copy run lengths, and the format selection rules of the Original. use super::*; diff --git a/crates/experimental-ref/src/remote_experts/tests.rs b/crates/experimental-ref/src/remote_experts/tests.rs index a34e8fe9..47258de5 100644 --- a/crates/experimental-ref/src/remote_experts/tests.rs +++ b/crates/experimental-ref/src/remote_experts/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the second-GPU expert tier: device meta layout, expert selection and open failures, slot rounding, +//! dispatch grouping and validation, the meta image with scatter, and the device buffer budget. use super::*; diff --git a/crates/gptoss/src/ops/tests.rs b/crates/gptoss/src/ops/tests.rs index dcebff7b..7b5b22f5 100644 --- a/crates/gptoss/src/ops/tests.rs +++ b/crates/gptoss/src/ops/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the gpt-oss CPU ops against f64 references: RMS norm, YaRN RoPE (range, rotation, norm), attention with +//! sinks and head groups across kernel levels, expert routing softmax, and the clamped SwiGLU. use super::*; diff --git a/crates/harmony/src/parse/tests.rs b/crates/harmony/src/parse/tests.rs index e0e97300..71851fb1 100644 --- a/crates/harmony/src/parse/tests.rs +++ b/crates/harmony/src/parse/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the Harmony stream parser: analysis, final and return turns, tool calls with the recipient in the channel +//! or the start header, several calls in one generation, dropped unknown channels, and a cut-off call closed at finish. use super::*; use Piece::{Special as S, Text as T}; diff --git a/crates/harmony/src/render/render_namespace.rs b/crates/harmony/src/render/render_namespace.rs index c644e664..f4f51735 100644 --- a/crates/harmony/src/render/render_namespace.rs +++ b/crates/harmony/src/render/render_namespace.rs @@ -1,5 +1,5 @@ -//! Methods of `Out`: `new`, `lit`, `text`. -//! Functions: `render_namespace`, `render_tool_definition`, `render_tool_parameter`, `render_parameter_default` and ... +//! Harmony prompt renderer: assembles system, developer, user, assistant and tool messages into the gpt-oss prompt, +//! and renders the tool namespace (TypeScript-like definitions of tools and their parameters) with an output buffer. use super::{ HarmonyError, Message, Out, RenderOptions, Role, SENTINELS, Tool, ToolCall, Value, as_concat_str, err, render_type, diff --git a/crates/harmony/src/render/render_options.rs b/crates/harmony/src/render/render_options.rs index 8723dced..e7cf5705 100644 --- a/crates/harmony/src/render/render_options.rs +++ b/crates/harmony/src/render/render_options.rs @@ -1,5 +1,5 @@ -//! Methods of `RenderOptions`: `new`. Functions: `err`, `truthy`, `to_json`, `write_json_string` and 13 more. -//! Split out of `render` to keep its files under the line limit. +//! Render options and Jinja-compatible helpers of the Harmony chat template: truthiness, tojson output, string +//! concatenation, and rendering of JSON-schema types and required names as TypeScript-like text. use super::{HarmonyError, Map, NESTED_INDENT, ONE_OF_DEFAULT_INDENT, RenderOptions, Value}; diff --git a/crates/igpu/src/shaders/gemm.rs b/crates/igpu/src/shaders/gemm.rs index 71482f7f..1059b6e7 100644 --- a/crates/igpu/src/shaders/gemm.rs +++ b/crates/igpu/src/shaders/gemm.rs @@ -1,5 +1,5 @@ -//! Methods of `Unrolled`: `new`, `cell`, `operands_and_scales`, `holes`. -//! Functions: `gemm`, `store_cell`, `weight_holes`, `row_source_holes` and 3 more. Defines `Unrolled`. +//! WGSL source generator for the tiled Q8_0 / MXFP4 integer GEMM (plain and mixture-of-experts row source): fills the +//! shared template with tile sizes, unrolled accumulators, weight-format and row-source parts. use super::{F16_ROUND, WeightKind}; use super::gemm_template::TEMPLATE; diff --git a/crates/leleka-memory/src/governor/governor_config.rs b/crates/leleka-memory/src/governor/governor_config.rs index 942eac5c..f873d5b2 100644 --- a/crates/leleka-memory/src/governor/governor_config.rs +++ b/crates/leleka-memory/src/governor/governor_config.rs @@ -1,5 +1,5 @@ -//! Methods of `Policy`: `apply_env_floors`, `apply_env_psi`. -//! Methods of `GovernorConfig`: `new`, `apply_env_runtime`, `from_env`. Implements `EnvLookup for F`. +//! Governor configuration: GovernorConfig defaults, the LELEKA_MEMORY_* environment overrides (validated, a typo is an +//! error rather than a silent default) and the Policy floors/PSI overrides; also the published report and lock helpers. use super::{GIB, GovernorConfig, LockMode, MIB, Mutex, MutexGuard, PUBLISHED, Policy}; diff --git a/crates/leleka-memory/src/governor/tests.rs b/crates/leleka-memory/src/governor/tests.rs index dbbc80cb..b0906615 100644 --- a/crates/leleka-memory/src/governor/tests.rs +++ b/crates/leleka-memory/src/governor/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the governor over a fake host: admission, shedding order, hard-floor refusal and recovery, counters and +//! report JSON, validated env overrides, a dead sampler not leaving the gate closed, and the sampler thread. use super::*; use crate::host::FakeProc; diff --git a/crates/leleka-memory/src/lock/lock_mode.rs b/crates/leleka-memory/src/lock/lock_mode.rs index ef6af070..974db8d0 100644 --- a/crates/leleka-memory/src/lock/lock_mode.rs +++ b/crates/leleka-memory/src/lock/lock_mode.rs @@ -1,5 +1,5 @@ -//! Methods of `LockMode`: `parse`. Methods of `LockOutcome`: `locked_bytes`. -//! Functions: `memlock_advice`, `plan_lock`, `residency_from_smaps`, `spans_bytes` and 2 more. +//! Memory-lock policy for the model archive: parsing of the lock mode, the pure decision whether RLIMIT_MEMLOCK and +//! capabilities allow locking, with operator advice, and span helpers (checks, compact space walk, smaps residency). use super::{CAP_IPC_LOCK_BIT, LockDecision, LockMode, LockOutcome, PAGE, ProcStatus, Residency, Span, procfs}; diff --git a/crates/leleka-memory/src/lock/tests.rs b/crates/leleka-memory/src/lock/tests.rs index f0446d5c..2f289f8a 100644 --- a/crates/leleka-memory/src/lock/tests.rs +++ b/crates/leleka-memory/src/lock/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the lock decision and span helpers: limit and capability cases with operator advice, off mode, pages +//! already locked, span validation and compact-space walking, and residency read from the smaps mapping. use super::*; diff --git a/crates/leleka-memory/src/plan/auto_prefix_budget.rs b/crates/leleka-memory/src/plan/auto_prefix_budget.rs index ba50df29..1e4d9ceb 100644 --- a/crates/leleka-memory/src/plan/auto_prefix_budget.rs +++ b/crates/leleka-memory/src/plan/auto_prefix_budget.rs @@ -1,5 +1,5 @@ -//! Functions: `auto_prefix_budget`, `explicit_prefix_budget`. -//! Split out of `plan` to keep its files under the line limit. +//! Prefix-cache budget at stack open, recomputed from the memory then available: the auto rule (share of the elastic +//! memory, capped) and the explicit one (the wish clamped to the host, never above the wish). use super::{MIB, Policy}; diff --git a/crates/leleka-memory/src/plan/policy.rs b/crates/leleka-memory/src/plan/policy.rs index 02393ec9..c44ea8f5 100644 --- a/crates/leleka-memory/src/plan/policy.rs +++ b/crates/leleka-memory/src/plan/policy.rs @@ -1,5 +1,5 @@ -//! Methods of `Policy`: `admit_floor`, `for_host`. Methods of `FixedItem`: `new`. -//! Implements `Display for Refusal`, `Error for Refusal`. +//! Plan policy defaults and errors: host-scaled floors, reserve and cache shares (Policy::for_host), the admit +//! floor, FixedItem constructor, the Refusal error type and its text, and the memory plan itself (plan, VRAM check). use super::{ CacheWish, FixedItem, GIB, KarForm, MIB, Plan, PlanInput, Policy, Refusal, Space, VramFacts, VramPlan, wsl_advice, diff --git a/crates/leleka-memory/src/plan/tests.rs b/crates/leleka-memory/src/plan/tests.rs index 845029bf..31895fcb 100644 --- a/crates/leleka-memory/src/plan/tests.rs +++ b/crates/leleka-memory/src/plan/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the memory plan: auto and explicit cache sizing, refusals with numbers and advice (also WSL), blind +//! hosts without telemetry, VRAM fit, enforcement off, and caps that never grow while auto budgets do. use super::*; use crate::host::FakeProc; diff --git a/crates/leleka-memory/src/pressure/tests.rs b/crates/leleka-memory/src/pressure/tests.rs index 898ef059..ca930795 100644 --- a/crates/leleka-memory/src/pressure/tests.rs +++ b/crates/leleka-memory/src/pressure/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of `pressure`. +//! Tests of the pressure monitor: escalation at once below the floors, stepping down only after calm samples +//! and the hysteresis margin, unknown memory holding shed, PSI stalls, cgroup OOM events and swap-out storms. use super::*; use crate::plan::GIB; diff --git a/crates/leleka-memory/src/procfs/tests.rs b/crates/leleka-memory/src/procfs/tests.rs index 138df8b3..9248411b 100644 --- a/crates/leleka-memory/src/procfs/tests.rs +++ b/crates/leleka-memory/src/procfs/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the procfs parsers: meminfo, status (pinned, locked, swap), memlock limit, PSI, cgroup files and smaps, +//! including refusal of malformed, duplicated or trailing-field input. use super::*; diff --git a/crates/leleka-memory/src/telemetry/lock.rs b/crates/leleka-memory/src/telemetry/lock.rs index a8ee46b1..9729dcb9 100644 --- a/crates/leleka-memory/src/telemetry/lock.rs +++ b/crates/leleka-memory/src/telemetry/lock.rs @@ -1,5 +1,5 @@ -//! Methods of `State`: `fold_prefill`, `fold_decode`. -//! Functions: `lock`, `with_state`, `published_telemetry`, `set_settings` and 20 more. +//! Recording side of telemetry: the global state and published document behind locks, entry points the engine calls +//! as a request starts, delivers tokens, finishes or hits the NaN guard, and the /proc CPU readers and rate helpers. use super::{ Clock, CpuReading, Duration, EMA_ALPHA, Instant, LastRequest, Mutex, MutexGuard, PUBLISHED, Phase, ProcSource, diff --git a/crates/leleka-memory/src/telemetry/render.rs b/crates/leleka-memory/src/telemetry/render.rs index 30d745f7..dbb02047 100644 --- a/crates/leleka-memory/src/telemetry/render.rs +++ b/crates/leleka-memory/src/telemetry/render.rs @@ -1,5 +1,5 @@ -//! Methods of `Sampler`: `stop`. Implements `Drop for Sampler`. -//! Functions: `ram_of`, `live_rate_of`, `live_request_of`, `rates_of` and 12 more. +//! Rendering and sampling side of telemetry: turns the recorded state and one measurement into the JSON document +//! and runs the Sampler thread that measures the host once a period and publishes it; stops on drop. use super::{ Arc, AtomicBool, Cache, Clock, Context, Cpu, CpuReading, Document, Duration, GpuProbe, Instant, LiveRequest, diff --git a/crates/leleka-memory/src/telemetry/tests.rs b/crates/leleka-memory/src/telemetry/tests.rs index efac2ea4..7b54ee2b 100644 --- a/crates/leleka-memory/src/telemetry/tests.rs +++ b/crates/leleka-memory/src/telemetry/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of telemetry: /proc parsing, the NaN guard counters, the per-request engine line, tier shares, folding +//! of requests into rates, cache and context, in-flight progress, and nulls for unmeasured rates. use super::*; diff --git a/crates/libc-shim/src/cuda_trace/tests.rs b/crates/libc-shim/src/cuda_trace/tests.rs index 501530b5..f330af28 100644 --- a/crates/libc-shim/src/cuda_trace/tests.rs +++ b/crates/libc-shim/src/cuda_trace/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the CUDA Driver trace: untouched symbols and foreign handles pass through, a batched copy is described +//! by its count and stream, and the ring names a kernel. use super::*; diff --git a/crates/model-format/src/bulk_read/for_each_chunk.rs b/crates/model-format/src/bulk_read/for_each_chunk.rs index 56ec82ee..9975b944 100644 --- a/crates/model-format/src/bulk_read/for_each_chunk.rs +++ b/crates/model-format/src/bulk_read/for_each_chunk.rs @@ -1,5 +1,5 @@ -//! Methods of `Shared`: `new`, `begin`. -//! Functions: `for_each_chunk`, `span_file_len`, `run_readers`, `open_strategy` and 2 more. +//! Public entry points of the cold bulk read: for_each_chunk (reader threads over aligned blocks, first error stops +//! all, sink gets each block) and read_into (fills a buffer); also strategy opening and the shared reader state. use super::{ ALIGN, Aligned, AtomicU64, File, Instant, Mutex, Plan, Report, Shared, Strategy, evict, io, open_direct, read_full, diff --git a/crates/model-format/src/bulk_read/strategy.rs b/crates/model-format/src/bulk_read/strategy.rs index cf5f0f47..dbf34eec 100644 --- a/crates/model-format/src/bulk_read/strategy.rs +++ b/crates/model-format/src/bulk_read/strategy.rs @@ -1,5 +1,5 @@ -//! Methods of `Strategy`: `as_str`. Methods of `Plan`: `from_env`, `with_overrides`. Implements `Default for Plan`. -//! Functions: `open_direct`, `open_direct`, `read_at`, `read_at` and 3 more. +//! Read configuration and low-level IO of the bulk reader: Strategy and Plan (defaults plus LELEKA_LOAD_* env +//! overrides), aligned bounce buffers, O_DIRECT reopen, pread, fadvise and eviction, and the per-block worker loop. use super::{ALIGN, Aligned, File, Ordering, Plan, Report, Shared, Strategy, io}; diff --git a/crates/model-format/src/bulk_read/tests.rs b/crates/model-format/src/bulk_read/tests.rs index 8d3a6bd8..4fddd876 100644 --- a/crates/model-format/src/bulk_read/tests.rs +++ b/crates/model-format/src/bulk_read/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Pins the bulk reader: every strategy returns identical bytes for aligned and ragged spans, blocks cover the span +//! exactly once, bad spans and sink errors fail, a short file is UnexpectedEof, and env overrides apply. use super::*; use std::io::Write; diff --git a/crates/model-format/src/gguf/cursor.rs b/crates/model-format/src/gguf/cursor.rs index d17cb0e8..cd2085c5 100644 --- a/crates/model-format/src/gguf/cursor.rs +++ b/crates/model-format/src/gguf/cursor.rs @@ -1,5 +1,5 @@ -//! Methods of `Cursor`: `new`, `with_test_capacity`, `position`, `skip` and 23 more. -//! Split out of `gguf` to keep its files under the line limit. +//! Cursor: the bounded, buffered GGUF header reader. Reads little-endian scalars, strings, arrays and metadata values +//! with truncation, overflow and duplicate-key checks, and skips values without reading them. use super::{ BufRead, BufReader, Cursor, HashSet, MetadataValue, Read, Result, STREAM_BUFFER_BYTES, Seek, SeekFrom, value_width, diff --git a/crates/model-format/src/gguf/parse_artifact_digest.rs b/crates/model-format/src/gguf/parse_artifact_digest.rs index e6700b83..765ad095 100644 --- a/crates/model-format/src/gguf/parse_artifact_digest.rs +++ b/crates/model-format/src/gguf/parse_artifact_digest.rs @@ -1,5 +1,5 @@ -//! Functions: `parse_artifact_digest`, `sha256_pipelined`, `stream_file_span`, `read_file_span_owned` and 8 more. -//! Split out of `gguf` to keep its files under the line limit. +//! GGUF file-level reads: parsing the sha256 artifact digest, pipelined whole-file hashing, span streaming into a +//! sink or owned buffer, the flash-next profile admission, and metadata_entries / tokenizer_metadata / snapshots. use super::{ BTreeMap, Cursor, Digest, FLASH_NEXT_PROFILE_KEYS, File, HashSet, MetadataSnapshot, MetadataValue, Path, Read, diff --git a/crates/model-format/src/gguf/read_index_file.rs b/crates/model-format/src/gguf/read_index_file.rs index fe2be0b6..e0dcbfef 100644 --- a/crates/model-format/src/gguf/read_index_file.rs +++ b/crates/model-format/src/gguf/read_index_file.rs @@ -1,5 +1,5 @@ -//! Functions: `read_index_file`, `block_geometry`. -//! Split out of `gguf` to keep its files under the line limit. +//! Strict tensor-index read of a GGUF file (count limits, no wide alignment) and the table of values-per-block and +//! bytes-per-block of each tensor kind (block_geometry), kept in step with the pinned Strata reader. use super::{Cursor, File, IndexRules, Result, Seek, SeekFrom, TensorIndex, parse_index}; diff --git a/crates/model-format/src/gguf/read_metadata_snapshot_with_architecture.rs b/crates/model-format/src/gguf/read_metadata_snapshot_with_architecture.rs index 31acac62..043f829f 100644 --- a/crates/model-format/src/gguf/read_metadata_snapshot_with_architecture.rs +++ b/crates/model-format/src/gguf/read_metadata_snapshot_with_architecture.rs @@ -1,5 +1,5 @@ -//! Methods of `SnapshotBuilder`: `read_entry`, `try_architecture`, `try_split`, `try_tokenizer` and 4 more. -//! Functions: `read_metadata_snapshot_with_architecture`, `validate_tokenizer_metadata`, `check_tokenizer_shape`, `c... +//! Metadata snapshot reader: walks the GGUF key/value entries and keeps only the wanted groups (architecture, split, +//! profile, tokenizer), validates tokenizer shape and merges; also inspect, tensor_index and tensor_sha256. use super::{ BTreeMap, Cursor, Digest, File, HashSet, MetadataSnapshot, MetadataValue, Path, Read, Result, Seek, SeekFrom, diff --git a/crates/model-format/src/gguf/resident/next_source_id.rs b/crates/model-format/src/gguf/resident/next_source_id.rs index 92182381..19df18c5 100644 --- a/crates/model-format/src/gguf/resident/next_source_id.rs +++ b/crates/model-format/src/gguf/resident/next_source_id.rs @@ -1,5 +1,5 @@ -//! Methods of `ResidentTensor`: `charged_bytes`, `len`, `file_mapped`, `backing`. -//! Methods of `ResidentStorage`: `backing`, `as_slice`, `len`. +//! Backing storage of a resident tensor (owned heap, mapped file span, huge pages): the unique source-id counter, +//! ResidentTensor accessors, and FileSpan, the read-only file mapping that unmaps itself on drop. use super::{FileSpan, NEXT_SOURCE_ID, Ordering, ResidentStorage, ResidentTensor, Result}; diff --git a/crates/model-format/src/gguf/resident/verified_gguf_capture_retention.rs b/crates/model-format/src/gguf/resident/verified_gguf_capture_retention.rs index 4f443847..7d80fe3b 100644 --- a/crates/model-format/src/gguf/resident/verified_gguf_capture_retention.rs +++ b/crates/model-format/src/gguf/resident/verified_gguf_capture_retention.rs @@ -1,5 +1,5 @@ -//! Methods of `VerifiedGgufFile`: `capture_source_identity`, `admit_captured_tensor`, `validate_capture_identity`, `... -//! Methods of `ResidentTensor`: `into_retained`, `retained_bytes`, `retention_metadata_bytes`. +//! Source identity and admission of captured tensors: VerifiedGgufFile hands out a resident source id, checks that +//! captured or retained bytes match the indexed tensor, and ResidentTensor is retained (Rc) with its metadata size. use super::{ResidentStorage, ResidentTensor, Result, VerifiedGgufFile, next_source_id}; diff --git a/crates/model-format/src/gguf/resident/verified_gguf_file.rs b/crates/model-format/src/gguf/resident/verified_gguf_file.rs index 7f241af7..c5073725 100644 --- a/crates/model-format/src/gguf/resident/verified_gguf_file.rs +++ b/crates/model-format/src/gguf/resident/verified_gguf_file.rs @@ -1,5 +1,5 @@ -//! Methods of `VerifiedGgufFile`: `load_resident_tensor`, `resident_extent`, `load_huge`, `load_heap` and 7 more. -//! Methods of `GgufSourceFence`: `copy_resident_tensor`. Functions: `mapping_granularity`, `mapping_granularity`. +//! Resident tensor loading from the verified GGUF file: heap or huge-page copies, read-only file mappings (Linux and +//! Windows), and copy-out of a resident span, all under the indexed bounds and same-descriptor size checks. use super::{ FileSpan, GgufSourceFence, ResidentLoadError, ResidentStorage, ResidentTensor, Result, VerifiedGgufFile, diff --git a/crates/model-format/src/gguf/stream_buffer_bytes.rs b/crates/model-format/src/gguf/stream_buffer_bytes.rs index 37844bc7..89d4de41 100644 --- a/crates/model-format/src/gguf/stream_buffer_bytes.rs +++ b/crates/model-format/src/gguf/stream_buffer_bytes.rs @@ -1,5 +1,5 @@ -//! Functions: `stream_buffer_bytes`, `stream_buffer_bytes`, `with_test_stream_buffer`. -//! Split out of `gguf` to keep its files under the line limit. +//! The stream buffer size for tensor span reads: fixed in production, with a thread-local test override +//! (with_test_stream_buffer) so small fixtures can exercise multi-chunk streaming. use super::STREAM_BUFFER_BYTES; #[cfg(test)] diff --git a/crates/model-format/src/gguf/tests.rs b/crates/model-format/src/gguf/tests.rs index 31c5d997..a3dd3c11 100644 --- a/crates/model-format/src/gguf/tests.rs +++ b/crates/model-format/src/gguf/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of `gguf`. +//! Shared fixture of the gguf tests: OwnedFixture writes a tiny two-tensor GGUF in a temp directory (with its +//! sha256 digest and field offsets) and removes it on drop; the test cases live in the tests/ submodules. use super::*; diff --git a/crates/model-format/src/gguf/value_width.rs b/crates/model-format/src/gguf/value_width.rs index 63e9b350..af705c08 100644 --- a/crates/model-format/src/gguf/value_width.rs +++ b/crates/model-format/src/gguf/value_width.rs @@ -1,5 +1,5 @@ -//! Methods of `GgufSourceFence`: `validate_tensor`, `stream_tensor`, `read_tensor_owned`, `finish`. -//! Methods of `VerifiedGgufFile`: `validate_empty_tensor_source`, `validate_empty_tensor_span`, `begin_source_fence`. +//! Element width of GGUF array types, and the source fence: a guard over one verified file that validates empty-tensor +//! spans, streams or reads tensors with the original size checks, and finishes with a last size check. use super::{GgufSourceFence, Result, VerifiedGgufFile}; diff --git a/crates/model-format/src/gguf/verified_gguf_file.rs b/crates/model-format/src/gguf/verified_gguf_file.rs index fecfb3a8..aff38499 100644 --- a/crates/model-format/src/gguf/verified_gguf_file.rs +++ b/crates/model-format/src/gguf/verified_gguf_file.rs @@ -1,5 +1,5 @@ -//! Methods of `VerifiedGgufFile`: `open`, `index`, `duplicate_descriptor`, `artifact_sha256` and 10 more. -//! Functions: `verify_digest`, `record_stamp`. +//! VerifiedGgufFile: opens a GGUF against its expected sha256 (with a verification stamp shortcut), keeps the +//! descriptor and strict index, and serves metadata snapshots, bounded tensor streams, owned reads and tensor hashes. use super::{ Digest, File, MetadataSnapshot, Path, QWEN4EXP_BINDING_KEYS, Result, Sha256, TensorIndex, TokenizerMetadata, diff --git a/crates/model-format/src/kar/decode_record_range.rs b/crates/model-format/src/kar/decode_record_range.rs index d3c3c3c6..39c97728 100644 --- a/crates/model-format/src/kar/decode_record_range.rs +++ b/crates/model-format/src/kar/decode_record_range.rs @@ -1,5 +1,5 @@ -//! Functions: `decode_record_range`, `decode_raw`, `decode_window`, `decode_nested` and 3 more. Defines `Window`. -//! Split out of `kar` to keep its files under the line limit. +//! CPU quality-oracle decoder of a KAR tensor record: decodes a bounded element range of a RAW F32 tensor or of a +//! nested multi-level tensor, reading only the group scales, level book and bit planes that cover the range. use super::{DecodeSource, ElementRange, File, RECORD_BYTES, ScalarDecoder, read_region, u16_at, u32_at, u64_at}; diff --git a/crates/model-format/src/kar/extents/extent.rs b/crates/model-format/src/kar/extents/extent.rs index cedf1b41..b70b2f5d 100644 --- a/crates/model-format/src/kar/extents/extent.rs +++ b/crates/model-format/src/kar/extents/extent.rs @@ -1,5 +1,5 @@ -//! Methods of `Extent`: `new`, `end`. Methods of `VerifiedPart`: `reads`. -//! Functions: `extents_bytes`, `normalize_extents`, `extents_cover`, `extents_overlap` and 5 more. +//! Extent arithmetic of the serve read set: page-align and merge, cover and overlap tests, the pinned sparse-copy +//! SHA-256 over an extent list, and the exact byte ranges the serve path reads per PLE partition. use super::{ DOMAIN, Digest, EXTENT_ALIGN, Extent, HASH_CHUNK, KarError, KarNestedRecord, PLE_ROW_PLANE_BYTES, diff --git a/crates/model-format/src/kar/extents/kar_inspection.rs b/crates/model-format/src/kar/extents/kar_inspection.rs index 4cbde859..ae6b4c2c 100644 --- a/crates/model-format/src/kar/extents/kar_inspection.rs +++ b/crates/model-format/src/kar/extents/kar_inspection.rs @@ -1,5 +1,5 @@ -//! Methods of `KarInspection`: `payload_offset`, `serve_reads`, `census`. Methods of `RecordClass`: `label`. -//! Functions: `census_record`, `gib`, `pct`. +//! Read-only reports on a KAR archive directory: what the serve path reads (serve_reads), and the census that +//! classifies every record, totals the read and unread bytes and renders the text report. use std::fmt::Write as _; use super::{ diff --git a/crates/model-format/src/kar/independent_handles.rs b/crates/model-format/src/kar/independent_handles.rs index 01f429c3..25686001 100644 --- a/crates/model-format/src/kar/independent_handles.rs +++ b/crates/model-format/src/kar/independent_handles.rs @@ -1,5 +1,5 @@ -//! Methods of `KarPleRowReader`: `read_rows`. -//! Functions: `independent_handles`, `reopen_independent`, `reopen_independent`, `read_rows_parallel` and 11 more. +//! Parallel positional reads of PLE rows: independent file handles, fan-out over threads with a warm-cache probe, +//! the per-read guard that refuses an archive changed since verification, and the three reads of one row. use super::{ COLD_SKIP, COLD_SKIP_CALLS, File, KarError, KarPleRowPacket, KarPleRowReader, PLE_ROWS, VerifiedPart, WARM_ROW_NS, diff --git a/crates/model-format/src/kar/inspect_file.rs b/crates/model-format/src/kar/inspect_file.rs index 31007bfe..17bee5af 100644 --- a/crates/model-format/src/kar/inspect_file.rs +++ b/crates/model-format/src/kar/inspect_file.rs @@ -1,5 +1,5 @@ -//! Functions: `inspect_file`, `read_tables`, `check_directory_digest`. -//! Split out of `kar` to keep its files under the line limit. +//! Metadata inspection of a KAR file: parses the header, reads the name table and directory, checks their digest +//! against the header, and scans every record into the sections, sources and summary of a Parsed archive. use super::{ Digest, File, HEADER_BYTES, HashSet, KarSummary, KarTensorSource, MAX_NAMES, MAX_TENSORS, Parsed, RECORD_BYTES, diff --git a/crates/model-format/src/kar/kar_ple_profile.rs b/crates/model-format/src/kar/kar_ple_profile.rs index 31dc1562..adc6a355 100644 --- a/crates/model-format/src/kar/kar_ple_profile.rs +++ b/crates/model-format/src/kar/kar_ple_profile.rs @@ -1,5 +1,5 @@ -//! Methods of `KarPleProfile`: `new`, `with_total_rows`, `native_shard_sha256`. -//! Methods of `KarPleRowPacket`: `payload`, `partition`. +//! KarPleProfile construction and validation (unique contiguous partitions with row counts and source digests), +//! plus small accessors: row packet payload, trust labels, startup-read total, and the unlinked-file check. use super::{ File, HashSet, KarError, KarPlePartProvenance, KarPleProfile, KarPleProfileSpec, KarPleRowPacket, KarStartupRead, diff --git a/crates/model-format/src/kar/read_region.rs b/crates/model-format/src/kar/read_region.rs index 60a8ed6e..f7d8e317 100644 --- a/crates/model-format/src/kar/read_region.rs +++ b/crates/model-format/src/kar/read_region.rs @@ -1,5 +1,5 @@ -//! Methods of `SectionCrc`: `new`, `feed`. Functions: `read_region`, `u16_at`, `u32_at`, `u64_at` and 9 more. -//! Defines `SectionCrc`, `ChunkReceiver`. +//! Low-level KAR reads and integrity: bounded region reads, little-endian field readers, CRC-32, the per-section +//! SectionCrc, and the pipelined and reference SHA-256 plus CRC verification of a whole archive. use super::{CRC32_SLICES, CRC32_TABLE, Digest, File, KarError, Read, Section, Seek, SeekFrom, Sha256}; diff --git a/crates/model-format/src/kar/verified_kar_ple_artifact.rs b/crates/model-format/src/kar/verified_kar_ple_artifact.rs index 73ebfba0..faf4b0ff 100644 --- a/crates/model-format/src/kar/verified_kar_ple_artifact.rs +++ b/crates/model-format/src/kar/verified_kar_ple_artifact.rs @@ -1,5 +1,5 @@ -//! Methods of `VerifiedKarPleArtifact`: `verify`, `verify_sparse`, `verify_with`, `serve_extents` and 14 more. -//! Split out of `kar` to keep its files under the line limit. +//! VerifiedKarPleArtifact: an archive verified against its pins (full pass or sparse extents) that serves PLE row +//! reads (16-row, batched or via an owned reader) and exposes digests, extents and startup-read accounting. use super::{ ArchiveView, Extent, FanOut, File, KarError, KarImmutableSource, KarInspection, KarPlePartProvenance, diff --git a/crates/model-format/src/kar_kernel_model/decode_params_valid.rs b/crates/model-format/src/kar_kernel_model/decode_params_valid.rs index 5e166154..65de60f6 100644 --- a/crates/model-format/src/kar_kernel_model/decode_params_valid.rs +++ b/crates/model-format/src/kar_kernel_model/decode_params_valid.rs @@ -1,5 +1,5 @@ -//! Methods of `MultiplyDims`: `new`. -//! Functions: `decode_params_valid`, `level_and_count_ok`, `group_ok`, `layout_ok` and 12 more. Defines `MultiplyDims`. +//! Host model of the KAR CUDA kernels: the decode argument guard, bit-literal models of the decode, multiply and +//! SwiGLU kernels (MultiplyDims is the multiply launch shape), and the reference stager that fills a packet. use super::{ BLOCK_THREADS, BOOK_REGION_BYTES, DecodeParams, MAX_COLUMNS, MAX_LEVEL, MAX_RANGE_ELEMENTS, MAX_SWIGLU_VALUES, diff --git a/crates/model-format/src/kar_levels/expert_scratch.rs b/crates/model-format/src/kar_levels/expert_scratch.rs index 179d00c3..9be4eb84 100644 --- a/crates/model-format/src/kar_levels/expert_scratch.rs +++ b/crates/model-format/src/kar_levels/expert_scratch.rs @@ -1,5 +1,5 @@ -//! Functions: `expert_scratch`, `cpu_reference_mlp`. -//! Split out of `kar_levels` to keep its files under the line limit. +//! Device scratch size of one expert FFN (three packets, one F32 matrix and intermediates) and the CPU reference +//! of the same gate/up/SwiGLU/down pipeline that GPU smokes compare against. use super::{GpuRows, KarLevelsError, Result, STATUS_BYTES, ScratchBytes, model}; diff --git a/crates/model-format/src/kar_levels/selection.rs b/crates/model-format/src/kar_levels/selection.rs index 126a3f8c..d227c537 100644 --- a/crates/model-format/src/kar_levels/selection.rs +++ b/crates/model-format/src/kar_levels/selection.rs @@ -1,5 +1,5 @@ -//! Methods of `Selection`: `window_error`, `resident_prefix_bytes`, `window`, `rows` and 1 more. -//! Methods of `GpuWindow`: `new`, `staged_source_bytes`, `scratch`. +//! Selection methods and GPU plan sizes of KAR level selection: resident prefix bytes, element windows, row and +//! expert matrices, per-plan scratch bytes, the ScratchBudget, and the routed-expert tensor name. use super::{ ArchiveSlot, EXPERT_ROLES, GpuRows, GpuWindow, KarError, KarInspection, KarLevelSelector, KarLevelsError, diff --git a/crates/model-format/src/native_dense_plan/tests.rs b/crates/model-format/src/native_dense_plan/tests.rs index 6bf37700..f3baddc8 100644 --- a/crates/model-format/src/native_dense_plan/tests.rs +++ b/crates/model-format/src/native_dense_plan/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Pins the native dense plan: weight bytes follow the Original tables, tensor eligibility by name and type, the +//! two-shard upload plan, the Original's refusal messages, and that an unquantized PLE key is skipped, not refused. use super::*; diff --git a/crates/model-format/src/pinned_arena_plan/expert_parallel_load.rs b/crates/model-format/src/pinned_arena_plan/expert_parallel_load.rs index 664a2783..cf00c50a 100644 --- a/crates/model-format/src/pinned_arena_plan/expert_parallel_load.rs +++ b/crates/model-format/src/pinned_arena_plan/expert_parallel_load.rs @@ -1,5 +1,5 @@ -//! Methods of `LoadShared`: `fill`. -//! Functions: `load_experts`, `load_experts_ranges`, `load_failure`, `carve_windows` and 4 more. +//! Parallel expert load into a destination buffer: disjoint per-layer windows carved from the caller's ranges, +//! worker threads reading chunks by positional reads, and a per-layer FNV-1a checksum; a short read is an error. use super::{ExpertLayout, FNV_SEED, LoadStats, ReadPlan, fnv1a64}; diff --git a/crates/model-format/src/pinned_arena_plan/fnv1a64.rs b/crates/model-format/src/pinned_arena_plan/fnv1a64.rs index b53e1c59..dd1b8a2a 100644 --- a/crates/model-format/src/pinned_arena_plan/fnv1a64.rs +++ b/crates/model-format/src/pinned_arena_plan/fnv1a64.rs @@ -1,5 +1,5 @@ -//! Methods of `SharedArenaHeader`: `new`, `describes`, `encode`, `decode`. -//! Methods of `LoadStats`: `gib_per_second`, `read_gib_per_second`. +//! FNV-1a hash, the shared arena file header and its create-or-reuse admission, the pin-registration plan (env +//! cap, uniform slices, sliced registration notes, lock switch) and LoadStats throughput accessors. use std::fmt::Write as _; use super::{ diff --git a/crates/model-format/src/pinned_arena_plan/tests.rs b/crates/model-format/src/pinned_arena_plan/tests.rs index 1968e899..0784d1ad 100644 --- a/crates/model-format/src/pinned_arena_plan/tests.rs +++ b/crates/model-format/src/pinned_arena_plan/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Pins the pinned-arena plan: FNV recurrence, shared header layout and file admission, pin cap and sliced +//! registration decisions with their notes, and that the parallel load equals a serial read with layer checksums. use super::*; diff --git a/crates/model-format/src/ple_reader/file_page_source.rs b/crates/model-format/src/ple_reader/file_page_source.rs index 75edaf71..defe389f 100644 --- a/crates/model-format/src/ple_reader/file_page_source.rs +++ b/crates/model-format/src/ple_reader/file_page_source.rs @@ -1,5 +1,5 @@ -//! Methods of `PleReaderConfig`: `new`. Methods of `ReaderStats`: `percentile`. -//! Implements `PageSource for File`, `Display for PleError` and 1 more. +//! Plumbing of the PLE row reader: the File page source, error display, config and statistics helpers, the row +//! cache, read planning (cache hits and out-of-range rows resolved, the rest grouped by page), aligned buffers. use super::{ AlignedBuf, EMPTY, File, HashMap, Mutex, MutexGuard, PAGE, PageSource, PlannedRead, PleError, PleReaderConfig, diff --git a/crates/model-format/src/ple_reader/ple_reader_debug_drop.rs b/crates/model-format/src/ple_reader/ple_reader_debug_drop.rs index 50143204..c6b1982a 100644 --- a/crates/model-format/src/ple_reader/ple_reader_debug_drop.rs +++ b/crates/model-format/src/ple_reader/ple_reader_debug_drop.rs @@ -1,5 +1,5 @@ -//! Implements `Debug for PleReader`, `Drop for PleReader`. -//! Split out of `ple_reader` to keep its files under the line limit. +//! Debug output and shutdown of PleReader: Debug shows rows and worker count, and Drop closes the reader +//! (stops its workers). use super::{PleReader, fmt}; diff --git a/crates/model-format/src/qwen4exp/expected_inventory.rs b/crates/model-format/src/qwen4exp/expected_inventory.rs index bc7e0fd6..f6bdcc23 100644 --- a/crates/model-format/src/qwen4exp/expected_inventory.rs +++ b/crates/model-format/src/qwen4exp/expected_inventory.rs @@ -1,5 +1,5 @@ -//! Functions: `expert_roles`, `expected_tensor`, `expected_inventory`, `push_layer`. Defines `LayerEntry`. -//! Split out of `qwen4exp` to keep its files under the line limit. +//! The closed inventory of tensors a Qwen4Exp artifact must hold: per-layer common, full-attention, linear-attention +//! and layer-1 PLE tensors with their names, dimensions and pinned GGUF kinds, plus the routed-expert roles. use super::{ExpectedTensor, GlobalRole, LayerRole, TensorRole}; diff --git a/crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/capture_admit.rs b/crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/capture_admit.rs index 64c84e8f..dd5b5122 100644 --- a/crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/capture_admit.rs +++ b/crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/capture_admit.rs @@ -1,5 +1,5 @@ -//! Functions: `capture_admit`, `expert_tensor_name`, `provisional_descriptor`. -//! Split out of `digest_capture` to keep its files under the line limit. +//! Admission and naming for provisional expert capture: the memory check against the source cap and headroom, +//! the GGUF name of a routed-expert tensor per role, and the checked bank descriptor built from the tensor index. use super::{ BankDescriptor, FUTURE_HEADROOM, LayerRole, ResidentExpertSourceError, ResolvedTensor, SOURCE_CAP, TensorIndex, diff --git a/crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/provisional_expert_source.rs b/crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/provisional_expert_source.rs index c9019177..9c43db05 100644 --- a/crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/provisional_expert_source.rs +++ b/crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/provisional_expert_source.rs @@ -1,5 +1,5 @@ -//! Methods of `ProvisionalExpertSource`: `empty`, `fail`, `geometry_failure`, `prepare` and 12 more. -//! Functions: `check_retained_kar`. +//! ProvisionalExpertSource: a non-readable capture of the routed-expert tensors while shard 0 is digested. Plans +//! cells under memory admission, copies observed chunks in file order, binds the verified file, checks retained KAR. use super::{ BANKS, Bank, BankDescriptor, BindingError, CapturedTensor, FUTURE_OWNERS, File, PINNED_IDENTITIES, diff --git a/crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/provisional_expert_source_incremental.rs b/crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/provisional_expert_source_incremental.rs index 12d524bb..eb0f116f 100644 --- a/crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/provisional_expert_source_incremental.rs +++ b/crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/provisional_expert_source_incremental.rs @@ -1,5 +1,5 @@ -//! Methods of `ProvisionalExpertSource`: `prepare_incremental`, `prepare_incremental_inner`, `reserve_incremental_ce... -//! Methods of `Qwen4ExpArtifact`: `open_shard0_with_expert_capture_incremental`. +//! Incremental variant of the provisional expert capture: reserves cells and tables up front and lets them grow +//! as chunks arrive; also Qwen4ExpArtifact::open_shard0_with_expert_capture_incremental. use super::{ BANKS, Bank, BankDescriptor, CapturedTensor, FUTURE_OWNERS, File, IncrementalCapture, IncrementalTensor, diff --git a/crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/provisional_expert_source_test_hooks.rs b/crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/provisional_expert_source_test_hooks.rs index ca6cf52f..3a05d293 100644 --- a/crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/provisional_expert_source_test_hooks.rs +++ b/crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/provisional_expert_source_test_hooks.rs @@ -1,5 +1,5 @@ -//! Methods of `ProvisionalExpertSource`: `test_incremental_cells`, `test_remaining_commitment`, `test_observe_inner`... -//! Split out of `digest_capture` to keep its files under the line limit. +//! Test-only constructors and probes of ProvisionalExpertSource for the incremental capture (cell setup, remaining +//! commitment, observe), so the capture tests can drive it without a full model. #[cfg(test)] use super::{ diff --git a/crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/qwen4_exp_artifact.rs b/crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/qwen4_exp_artifact.rs index 7a80b74e..449c88d6 100644 --- a/crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/qwen4_exp_artifact.rs +++ b/crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/qwen4_exp_artifact.rs @@ -1,5 +1,5 @@ -//! Methods of `Qwen4ExpArtifact`: `open_shard0_with_expert_capture`, `adopt_resident_expert_capture`, `check_capture... -//! Methods of `ProvisionalExpertSource`: `test_cells`, `test_bytes`, `test_discarded`, `test_memory` and 1 more. +//! Artifact-side capture: open shard 0 with expert capture, revalidate every descriptor and adopt the capture as +//! retained resident banks at the bank boundary; also IncrementalCapture chunk appends and test-only helpers. use super::{ BANKS, Bank, BindingError, CapturedTensor, Cell, FUTURE_HEADROOM, FUTURE_OWNERS, File, IncrementalCapture, diff --git a/crates/model-format/src/qwen4exp/expert_source_bank/qwen4_exp_artifact.rs b/crates/model-format/src/qwen4exp/expert_source_bank/qwen4_exp_artifact.rs index 79286493..a2eaf8dc 100644 --- a/crates/model-format/src/qwen4exp/expert_source_bank/qwen4_exp_artifact.rs +++ b/crates/model-format/src/qwen4exp/expert_source_bank/qwen4_exp_artifact.rs @@ -1,5 +1,5 @@ -//! Methods of `Qwen4ExpArtifact`: `load_resident_expert_source`, `check_expert_layout`, `plan_banks`, `load_banks` a... -//! Methods of `ResidentExpertBankLease`: `bank_count`, `source_bytes`, `charged_source_bytes`, `file_mapped` and 1 m... +//! Loading the resident expert source onto Qwen4ExpArtifact: layout check, bank plan, memory-admitted reads of all +//! 144 expert banks, report and publish, plus the low-RAM variant mapping banks read-only from shard 0. use super::{ BANKS, Bank, BankDescriptor, BindingError, Cell, FUTURE_HEADROOM, Qwen4ExpArtifact, Rc, ResidentExpertBank, diff --git a/crates/model-format/src/qwen4exp/expert_source_bank/resident_expert_bank_lease.rs b/crates/model-format/src/qwen4exp/expert_source_bank/resident_expert_bank_lease.rs index ba3428cc..4d2f4447 100644 --- a/crates/model-format/src/qwen4exp/expert_source_bank/resident_expert_bank_lease.rs +++ b/crates/model-format/src/qwen4exp/expert_source_bank/resident_expert_bank_lease.rs @@ -1,5 +1,5 @@ -//! Methods of `Qwen4ExpArtifact`: `resident_expert_bank_lease`, `resident_expert_bank_member`. -//! Methods of `ResidentExpertBankSpan`: `bytes`, `offset`, `expert`, `role` and 3 more. Functions: `bank_directory_ok`. +//! Read-only lease on the resident expert banks: Qwen4ExpArtifact hands out a ResidentExpertBankLease or member +//! after rechecking the catalog and source, and ResidentExpertBankSpan exposes one expert's bytes and role. use super::{ BANKS, BindingError, LayerRole, Qwen4ExpArtifact, Rc, ResidentExpertBank, ResidentExpertBankLease, diff --git a/crates/model-format/src/qwen4exp/expert_source_bank/retention_metadata_bytes.rs b/crates/model-format/src/qwen4exp/expert_source_bank/retention_metadata_bytes.rs index f473c1e2..14aa9090 100644 --- a/crates/model-format/src/qwen4exp/expert_source_bank/retention_metadata_bytes.rs +++ b/crates/model-format/src/qwen4exp/expert_source_bank/retention_metadata_bytes.rs @@ -1,5 +1,5 @@ -//! Methods of `ResidentExpertBank`: `note_copy`, `report`, `tensor`. -//! Implements `Display for ResidentExpertSourceError`, `Error for ResidentExpertSourceError`. +//! Support for resident expert banks: retention metadata size, error Display, checked bank descriptors and expert +//! shape/stride checks, the MemAvailable reading and admission, and the ResidentExpertBank report and tensor access. use super::{ BANKS, Bank, BankDescriptor, BindingError, Error, FUTURE_HEADROOM, File, LayerRole, Read, ResidentExpertBank, diff --git a/crates/model-format/src/qwen4exp/plan_stream_rows.rs b/crates/model-format/src/qwen4exp/plan_stream_rows.rs index aa4eb501..8a3a63f3 100644 --- a/crates/model-format/src/qwen4exp/plan_stream_rows.rs +++ b/crates/model-format/src/qwen4exp/plan_stream_rows.rs @@ -1,5 +1,5 @@ -//! Methods of `RoutedMoeSourceScope`: `retarget`, `role`, `tensor`, `validate_descriptor` and 4 more. -//! Functions: `matrix_shape`, `layer_matrix_shape`, `global_matrix_shape`, `plan_stream_rows` and 1 more. +//! Whole-matrix streaming plan: a span of more than 64 rows is admitted only as one complete, known matrix +//! shape (table of role shapes), plus the byte-span arithmetic; also the scoped routed-MoE source loan for one expert. use super::{ BindingError, GlobalRole, LayerRole, ResidentExpertBankSpan, ResolvedTensor, RoutedMoeSourceScope, TensorRole, io, diff --git a/crates/model-format/src/qwen4exp/qwen4_exp_artifact.rs b/crates/model-format/src/qwen4exp/qwen4_exp_artifact.rs index 0be42dc2..3e98a2ba 100644 --- a/crates/model-format/src/qwen4exp/qwen4_exp_artifact.rs +++ b/crates/model-format/src/qwen4exp/qwen4_exp_artifact.rs @@ -1,5 +1,5 @@ -//! Methods of `Qwen4ExpArtifact`: `bind`, `bind_after_identity`, `topology`, `tokenizer` and 9 more. -//! Functions: `check_owner_split`, `read_profile_snapshots`. +//! Binding of the two pinned GGUF shards into a Qwen4ExpArtifact (identity, split and metadata checks), and its +//! read API: tensor lookup and streaming of rows, expert rows, whole matrices and the token embedding table. use super::{ BindingError, GlobalRole, LogicalShardView, MetadataSnapshot, PINNED_IDENTITIES, Qwen4ExpArtifact, diff --git a/crates/model-format/src/qwen4exp/routed_moe_source_opening.rs b/crates/model-format/src/qwen4exp/routed_moe_source_opening.rs index 25fa6119..ad3d9d29 100644 --- a/crates/model-format/src/qwen4exp/routed_moe_source_opening.rs +++ b/crates/model-format/src/qwen4exp/routed_moe_source_opening.rs @@ -1,5 +1,5 @@ -//! Methods of `Qwen4ExpArtifact`: `begin_routed_moe_source`. -//! Split out of `qwen4exp` to keep its files under the line limit. +//! Opens a scoped source loan (RoutedMoeSourceScope) for one routed expert of one layer, taken from shard 0 +//! with its source fence, so the expert matrices can be read under a single fence. use super::{BindingError, LayerRole, Qwen4ExpArtifact, RoutedMoeSourceScope, TensorRole}; diff --git a/crates/model-format/src/qwen4exp/validate_logical_views.rs b/crates/model-format/src/qwen4exp/validate_logical_views.rs index ee835ec5..21335667 100644 --- a/crates/model-format/src/qwen4exp/validate_logical_views.rs +++ b/crates/model-format/src/qwen4exp/validate_logical_views.rs @@ -1,5 +1,5 @@ -//! Functions: `validate_logical_views`, `check_split_numbers`, `check_tensor_counts`. -//! Split out of `qwen4exp` to keep its files under the line limit. +//! Cross-shard validation of the two logical shard views: split numbers and tensor counts, architecture, +//! topology, tokenizer and the tensor role inventory; yields the validated binding view. use super::{ BindingError, LogicalShardView, ValidatedBindingView, gguf, topology, validate_role_inventory, validate_tokenizer, diff --git a/crates/model-format/src/qwen4exp/validate_owner_index_split.rs b/crates/model-format/src/qwen4exp/validate_owner_index_split.rs index b3ee8267..33007200 100644 --- a/crates/model-format/src/qwen4exp/validate_owner_index_split.rs +++ b/crates/model-format/src/qwen4exp/validate_owner_index_split.rs @@ -1,5 +1,5 @@ -//! Functions: `validate_owner_index_split`, `validate_owner_metadata_split`, `required_uint`, `required_u32` and 11 ... -//! Split out of `qwen4exp` to keep its files under the line limit. +//! Pinned-profile metadata checks for the two shards: split numbers in index and metadata, required key readers, +//! the model topology read from metadata, and the special token ids of the tokenizer. use super::{BindingError, MetadataSnapshot, MetadataValue, Qwen4ExpTopology, TokenizerMetadata, VerifiedGgufFile}; diff --git a/crates/model-format/src/qwen4exp/validate_role_inventory.rs b/crates/model-format/src/qwen4exp/validate_role_inventory.rs index 612a5d52..36fa0033 100644 --- a/crates/model-format/src/qwen4exp/validate_role_inventory.rs +++ b/crates/model-format/src/qwen4exp/validate_role_inventory.rs @@ -1,5 +1,5 @@ -//! Functions: `validate_role_inventory`, `index_actual`, `resolve_tensor`, `check_tensor_geometry` and 8 more. -//! Defines `IndexedTensors`. +//! Matches the indexed tensors of both shards to the expected role inventory (shape, kind, byte size, file range, +//! no overlap) and plans exact single-row and row-tile byte spans inside a resolved tensor. use super::{ BTreeMap, BTreeSet, BindingError, ExpectedTensor, LogicalShardView, ResolvedTensor, TensorRole, expected_inventory, diff --git a/crates/model-format/src/qwen4exp/whole_dense_matrix_transport_tests.rs b/crates/model-format/src/qwen4exp/whole_dense_matrix_transport_tests.rs index cf9e58ec..c4def33f 100644 --- a/crates/model-format/src/qwen4exp/whole_dense_matrix_transport_tests.rs +++ b/crates/model-format/src/qwen4exp/whole_dense_matrix_transport_tests.rs @@ -1,5 +1,5 @@ -//! Functions: `two_byte_tensor`, `assert_partial_matrices_are_refused`, `assert_edited_tensor_is_refused`, `assert_p... -//! Split out of `qwen4exp` to keep its files under the line limit. +//! Tests that plan_stream_rows admits closed dense matrices (PLE tiles, whole matrices) with exact offsets and +//! refuses partial, expert-addressed or edited tensors. use super::*; diff --git a/crates/model-format/src/qwen4exp/whole_moe_matrix_sdet.rs b/crates/model-format/src/qwen4exp/whole_moe_matrix_sdet.rs index 85abc3f6..8a3597ad 100644 --- a/crates/model-format/src/qwen4exp/whole_moe_matrix_sdet.rs +++ b/crates/model-format/src/qwen4exp/whole_moe_matrix_sdet.rs @@ -1,5 +1,5 @@ -//! Functions: `complete_moe_spans_match_literal_legacy_tiles_and_refuse_boundary_crossing`, `check_layout`, `check_e... -//! Defines `Expected`. +//! Tests that complete MoE matrix spans equal the literal legacy 64-row tiles for every quantization layout +//! (routed and shared, gate/up and down), and that spans crossing a matrix boundary are refused. use super::*; diff --git a/crates/native-cpu-expert/src/cpu_pool.rs b/crates/native-cpu-expert/src/cpu_pool.rs index 806387cc..b647cdba 100644 --- a/crates/native-cpu-expert/src/cpu_pool.rs +++ b/crates/native-cpu-expert/src/cpu_pool.rs @@ -1,5 +1,5 @@ -//! Methods of `CpuPool`: `new`, `workers`, `charged_bytes`, `admit` and 1 more. Methods of `PendingBatch`: `join`. -//! Implements `Drop for PendingBatch`, `Drop for CpuPool`. Functions: `actor_main`, `serve`. +//! CpuPool: a single actor thread that owns the native expert pool and serves one batch of prepared jobs at a time +//! over channels; PendingBatch joins the result, and either type's drop drains or stops the native workers safely. use super::{ CompletedJob, CpuPool, Error, MAX_BATCH_BYTES, MAX_JOBS, PendingBatch, PhantomData, PreparedJob, Result, ffi, mpsc, diff --git a/crates/native-cpu-expert/src/gate_up_format.rs b/crates/native-cpu-expert/src/gate_up_format.rs index 9dcd172e..3334fd62 100644 --- a/crates/native-cpu-expert/src/gate_up_format.rs +++ b/crates/native-cpu-expert/src/gate_up_format.rs @@ -1,5 +1,5 @@ -//! Methods of `GateUpFormat`: `kind`, `matrix_bytes`, `block`. -//! Methods of `DownFormat`: `kind`, `matrix_bytes`, `block`. Implements `Drop for DirectCpuPool`. +//! Expert job data for the CPU pool: gate/up and down format codes with block sizes, input and header checks, the +//! concatenated G|U|D blob in PreparedJob, and DirectCpuPool, which computes or prefetches a group of experts directly. use super::{ BorrowedExpert, BorrowedGroup, CompletedJob, DirectCpuPool, DownFormat, Error, ExpertBytes, ExpertFormats, FF, diff --git a/crates/native-cpu-expert/src/rust_bench_frontend/cpu_blob.rs b/crates/native-cpu-expert/src/rust_bench_frontend/cpu_blob.rs index e468135c..51a5b705 100644 --- a/crates/native-cpu-expert/src/rust_bench_frontend/cpu_blob.rs +++ b/crates/native-cpu-expert/src/rust_bench_frontend/cpu_blob.rs @@ -1,5 +1,5 @@ -//! Methods of `Case`: `new`, `gate_up`, `down`. -//! Functions: `quantize_acts`, `cpu_blob`, `iq_gate_up`, `time_ggml_gu` and 15 more. Defines `Fail`, `Case`, `KqCase`. +//! CPU side of the expert benchmark on one blob: quantizes the activations, runs gate/up and down, and checks the +//! native kernels against the ggml reference for width invariance and K-quant/IQ routes, timing both for the report. use super::{ FF, H, Instant, Kind, NT, NativeActivation, NativeFormat, bench, bits, c_int, cpu, dot, elapsed, ggml_rows, diff --git a/crates/native-cpu-expert/src/rust_bench_frontend/float_reference.rs b/crates/native-cpu-expert/src/rust_bench_frontend/float_reference.rs index fdd44937..10df2ae8 100644 --- a/crates/native-cpu-expert/src/rust_bench_frontend/float_reference.rs +++ b/crates/native-cpu-expert/src/rust_bench_frontend/float_reference.rs @@ -1,5 +1,5 @@ -//! Functions: `float_reference`, `reference_shapes_ok`, `swiglu_hidden`, `project_down` and 21 more. Defines `Fail`. -//! Split out of `rust_bench_frontend` to keep its files under the line limit. +//! Reference and parity checks of the expert benchmark: an f64 float reference of one expert, the CPU-vs-GPU checks +//! of a blob (dequantizers, old kernels, embedding rows), plus the Q5_1 stored-sum case and the BF16 gather case. use super::{ CString, Error, FF, H, Kind, NT, NativeFormat, ParityGpu, Q81Owner, Result, bench, bits, cpu, cpu_blob, name, diff --git a/crates/native-cpu-expert/src/rust_bench_frontend/numerical.rs b/crates/native-cpu-expert/src/rust_bench_frontend/numerical.rs index c4a04d1c..87b6d5f0 100644 --- a/crates/native-cpu-expert/src/rust_bench_frontend/numerical.rs +++ b/crates/native-cpu-expert/src/rust_bench_frontend/numerical.rs @@ -1,5 +1,5 @@ -//! Functions: `numerical`, `zeros`, `refs`, `outputs` and 11 more. -//! Split out of `rust_bench_frontend` to keep its files under the line limit. +//! Small shared helpers of the expert benchmark: error mapping, zeroed allocations, relative and bit-level +//! comparisons, format and kernel-name lookup, the ggml and IQ4_NL row dots, and elapsed-time per iteration. use super::{CString, Error, FF, H, Instant, Kind, NAMES, NT, NativeActivation, NativeFormat, Result, bench, cpu}; diff --git a/crates/native-cpu-expert/src/rust_dequant/iq.rs b/crates/native-cpu-expert/src/rust_dequant/iq.rs index 33e98548..5d373fbe 100644 --- a/crates/native-cpu-expert/src/rust_dequant/iq.rs +++ b/crates/native-cpu-expert/src/rust_dequant/iq.rs @@ -1,5 +1,5 @@ -//! Methods of `Iq2Group`: `lane`. Methods of `Iq3Group`: `sign`, `grid`. -//! Functions: `block`, `iq2_group`, `iq2`, `iq3_group` and 6 more. Defines `Iq2Group`, `Iq3Group`. +//! Scalar block dequantizers of the IQ family (IQ1, IQ2, IQ3, IQ4_NL, IQ4_XS), used as the exact float oracle +//! of the benchmark; each follows the pinned GGML to_float code, separate from the quantized dot accumulation. use super::{h, u16at, u32at}; use crate::rust_codebooks::*; use crate::rust_ggml::Kind; diff --git a/crates/native-cpu-expert/src/rust_dequant/kquant.rs b/crates/native-cpu-expert/src/rust_dequant/kquant.rs index bd28ba9b..924f130e 100644 --- a/crates/native-cpu-expert/src/rust_dequant/kquant.rs +++ b/crates/native-cpu-expert/src/rust_dequant/kquant.rs @@ -1,5 +1,5 @@ -//! Functions: `block`, `q2k`, `q3k`, `q45k` and 4 more. -//! the K-quant and ternary block formats. +//! Scalar block dequantizers of the K-quant (Q2_K to Q6_K) and ternary (TQ1, TQ2) formats, used as the exact +//! float oracle of the benchmark; each follows the pinned GGML to_float code, apart from quantized dot accumulation. use super::{h, k4, six}; use crate::rust_ggml::Kind; pub(super) fn block(kind: Kind, x: &[u8], y: &mut [f32]) { diff --git a/crates/native-cpu-expert/src/rust_dequant/plain.rs b/crates/native-cpu-expert/src/rust_dequant/plain.rs index 40f811bb..f05eeb17 100644 --- a/crates/native-cpu-expert/src/rust_dequant/plain.rs +++ b/crates/native-cpu-expert/src/rust_dequant/plain.rs @@ -1,5 +1,5 @@ -//! Functions: `block`, `q1_zero`, `q2_zero`, `q458` and 3 more. -//! the legacy, 4/5/8-bit and FP4 block formats. +//! Scalar block dequantizers of the plain formats (F32, F16, BF16, the 1/2/4/5/8-bit legacy blocks and MXFP4/NVFP4), +//! used as the exact float oracle of the benchmark; each follows the pinned GGML to_float code. use super::{FP4, e8_half, h, u16at, u32at, ue4}; use crate::rust_ggml::Kind; pub(super) fn block(kind: Kind, x: &[u8], y: &mut [f32]) { diff --git a/crates/native-cpu-expert/src/rust_general_pool/expert_pool.rs b/crates/native-cpu-expert/src/rust_general_pool/expert_pool.rs index 02e1d39f..e12e2b4f 100644 --- a/crates/native-cpu-expert/src/rust_general_pool/expert_pool.rs +++ b/crates/native-cpu-expert/src/rust_general_pool/expert_pool.rs @@ -1,5 +1,5 @@ -//! Methods of `ExpertPool`: `new`, `assemble`, `worker_count`, `new_shared` and 14 more. -//! Split out of `rust_general_pool` to keep its files under the line limit. +//! Construction and bookkeeping of the general expert pool: CPU topology and worker count, shared state, worker threads +//! with optional core pinning, byte and timing diagnostics, the phase barrier, and whole-expert and planar run entries. use super::{ Arc, AtomicBool, AtomicI32, AtomicI64, AtomicU32, AtomicU64, Batch, Condvar, CpuTopology, Diagnostic, Duration, diff --git a/crates/native-cpu-expert/src/rust_general_pool/expert_pool_split_multi_run.rs b/crates/native-cpu-expert/src/rust_general_pool/expert_pool_split_multi_run.rs index e34b585b..34f0a040 100644 --- a/crates/native-cpu-expert/src/rust_general_pool/expert_pool_split_multi_run.rs +++ b/crates/native-cpu-expert/src/rust_general_pool/expert_pool_split_multi_run.rs @@ -1,5 +1,5 @@ -//! Methods of `ExpertPool`: `split_headers`, `split_run`, `quantize_single`, `planar_multi_header` and 8 more. -//! Implements `Drop for ExpertPool`. +//! Two-phase split runs of the general expert pool: gate/up, requantize, then down, for single- and multi-token +//! planar and native-format experts, built from validated job headers; also stops and joins the workers on drop. use super::{Error, ExpertPool, FF, H, Instant, Job, NativeFormat, NativeJobMulti, Ordering, PlanarJobMulti, Result}; diff --git a/crates/native-cpu-expert/src/rust_general_pool/job_default.rs b/crates/native-cpu-expert/src/rust_general_pool/job_default.rs index 9634293e..afa731eb 100644 --- a/crates/native-cpu-expert/src/rust_general_pool/job_default.rs +++ b/crates/native-cpu-expert/src/rust_general_pool/job_default.rs @@ -1,5 +1,5 @@ -//! Implements `Default for Job`, `Default for Split` and 3 more. -//! Functions: `alloc_with`, `cells`, `install_release_gpu_waits`, `now_ms`. +//! Defaults of the pool's raw job and scratch types, the Send/Sync claim for Shared with its safety argument, +//! and small helpers: fallible zeroed allocation, the GPU-wait release hook and a process-relative millisecond clock. use super::{ Error, FF, Instant, Job, OnceLock, PlanarActivation, RELEASE_GPU_WAITS, Result, Shared, SingleSplit, Split, diff --git a/crates/native-cpu-expert/src/rust_general_pool/shared_wait_done_and_quantize_lanes.rs b/crates/native-cpu-expert/src/rust_general_pool/shared_wait_done_and_quantize_lanes.rs index 3dcd0d98..17b4e064 100644 --- a/crates/native-cpu-expert/src/rust_general_pool/shared_wait_done_and_quantize_lanes.rs +++ b/crates/native-cpu-expert/src/rust_general_pool/shared_wait_done_and_quantize_lanes.rs @@ -1,5 +1,5 @@ -//! Methods of `Shared`: `wait_done`, `quantize_lanes`. Functions: `quantize_native_lane`. -//! Split out of `rust_general_pool` to keep its files under the line limit. +//! Shared pool state helpers: a spin wait for workers to finish (with a stall report after 60 s) and the requantization +//! of every lane's gate/up output into the down-phase activation, for native and planar formats. use super::{Duration, Instant, Job, NativeFormat, Ordering, Result, Shared, Split}; diff --git a/crates/native-cpu-expert/src/rust_ggml/kind.rs b/crates/native-cpu-expert/src/rust_ggml/kind.rs index 58610978..39f89de4 100644 --- a/crates/native-cpu-expert/src/rust_ggml/kind.rs +++ b/crates/native-cpu-expert/src/rust_ggml/kind.rs @@ -1,5 +1,5 @@ -//! Methods of `Kind`: `from_original`, `original_id`, `block`, `row_bytes` and 3 more. Methods of `ActKind`: `bytes`. -//! Functions: `alloc`, `store_f16`, `bf16_bits`, `store_bf16` and 1 more. +//! Quantization kinds of the GGML-compatible CPU path: ids, block geometry and row sizes of each Kind, its activation +//! encoding, and the owned f32/f16/bf16 activation storage built from float input by Activation::quantize. use super::{ActKind, Activation, Error, Kind, Result, Storage, to_half}; diff --git a/crates/native-cpu-expert/src/rust_ggml/native_format.rs b/crates/native-cpu-expert/src/rust_ggml/native_format.rs index 0c203d04..4fa0edb2 100644 --- a/crates/native-cpu-expert/src/rust_ggml/native_format.rs +++ b/crates/native-cpu-expert/src/rust_ggml/native_format.rs @@ -1,5 +1,5 @@ -//! Methods of `NativeFormat`: `offsets`, `new`, `validate`. -//! Functions: `iq4nl_dot`, `dot_zero`, `dot_k`, `dot` and 8 more. +//! NativeFormat (a gate/up plus down kind pair with its blob layout and shape checks) and the AVX2 row dot +//! kernels against Q8_0-style, Q8_K and float activations (IQ4_NL, Q1, Q2 too), with the dispatching dot entry point. use super::{ __m256, _mm_loadu_si128, _mm256_add_ps, _mm256_castsi256_ps, _mm256_cvtepi32_ps, _mm256_cvtepu16_epi32, diff --git a/crates/native-cpu-expert/src/rust_ggml/quantize_raw.rs b/crates/native-cpu-expert/src/rust_ggml/quantize_raw.rs index 28c10431..71bbc688 100644 --- a/crates/native-cpu-expert/src/rust_ggml/quantize_raw.rs +++ b/crates/native-cpu-expert/src/rust_ggml/quantize_raw.rs @@ -1,5 +1,5 @@ -//! Functions: `raw_align`, `quantize_half_raw`, `quantize_raw`, `dot_raw_zero` and 2 more. -//! Split out of `rust_ggml` to keep its files under the line limit. +//! Raw-buffer entry points of the GGML CPU path: quantize a float row into a caller-provided encoded activation +//! buffer, and compute a weight-row dot against an already encoded one, with the alignment and extent checks. use super::{ActKind, Kind, Q8K, Q8One, Q8Zero, bf16_bits, float_dot, iq4nl_dot, q1_dot, q2_generic, to_half}; diff --git a/crates/native-cpu-expert/src/rust_iq/iq4nl_n.rs b/crates/native-cpu-expert/src/rust_iq/iq4nl_n.rs index d0e72ada..abd6eaaf 100644 --- a/crates/native-cpu-expert/src/rust_iq/iq4nl_n.rs +++ b/crates/native-cpu-expert/src/rust_iq/iq4nl_n.rs @@ -1,5 +1,5 @@ -//! Functions: `iq4nl_values`, `iq4nl_block`, `iq4nl_alternating`, `iq4nl_n`. -//! Split out of `rust_iq` to keep its files under the line limit. +//! AVX2 IQ4_NL row kernel for one to N tokens: decodes each block's codebook values once and accumulates per token, +//! in the exact GGML single-token or the original multi-token order, so results match the reference bit for bit. use super::{ __m128i, __m256, __m256i, _mm_and_si128, _mm_loadu_si128, _mm_set1_epi8, _mm_shuffle_epi8, _mm_srli_epi16, diff --git a/crates/native-cpu-expert/src/rust_iq/tests.rs b/crates/native-cpu-expert/src/rust_iq/tests.rs index 787476c5..6188edd6 100644 --- a/crates/native-cpu-expert/src/rust_iq/tests.rs +++ b/crates/native-cpu-expert/src/rust_iq/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of `rust_iq`. +//! Tests that pin the IQ kernels: IQ3 single- and multi-token summation trees are bitwise equal, the AVX2 IQ4_XS +//! multi-token kernel matches a scalar model of the original row_dot bit for bit, plus a timing bench for IQ3. use super::super::rust_quant::q8_k; use super::*; diff --git a/crates/native-cpu-expert/src/rust_iq/u16.rs b/crates/native-cpu-expert/src/rust_iq/u16.rs index e064d7b9..de895a1e 100644 --- a/crates/native-cpu-expert/src/rust_iq/u16.rs +++ b/crates/native-cpu-expert/src/rust_iq/u16.rs @@ -1,5 +1,5 @@ -//! Functions: `u16`, `u32`, `format_bytes`, `factor` and 17 more. -//! Split out of `rust_iq` to keep its files under the line limit. +//! Shared decoding of IQ-format weight blocks for the AVX2/AVX-512 IQ dot kernels: byte readers, block sizes, +//! per-format sign/grid/scale decode, and the multi-token IQ kernel specialised per format and token count. use super::{ __m256i, _mm_loadl_epi64, _mm256_add_epi32, _mm256_and_si256, _mm256_cvtepi32_ps, _mm256_cvtepu8_epi32, diff --git a/crates/native-cpu-expert/src/rust_legacy/admit.rs b/crates/native-cpu-expert/src/rust_legacy/admit.rs index 064d0472..8be3c190 100644 --- a/crates/native-cpu-expert/src/rust_legacy/admit.rs +++ b/crates/native-cpu-expert/src/rust_legacy/admit.rs @@ -1,5 +1,5 @@ -//! Functions: `admit`, `gate_up_rows`, `down_rows`, `admit_expert` and 9 more. Defines `RowSpace`. -//! Split out of `rust_legacy` to keep its files under the line limit. +//! Legacy planar expert entry points: row-range gate/up and down passes, the whole multi-token expert call, and +//! the scalar benchmark; each first admits blob size, row bounds, activation chunk count and CPU support. use super::{ ActQ, BLOB, D_CODES, D_SCALES, Error, FF, GU_SCALES, GateUpOut, H, MAX_ROWS, PlanarActivation, PlanarScratch, diff --git a/crates/native-cpu-expert/src/rust_legacy/gate_each.rs b/crates/native-cpu-expert/src/rust_legacy/gate_each.rs index 0b004880..afd06934 100644 --- a/crates/native-cpu-expert/src/rust_legacy/gate_each.rs +++ b/crates/native-cpu-expert/src/rust_legacy/gate_each.rs @@ -1,5 +1,5 @@ -//! Implements `Default for SingleScratch`. Functions: `gate_each`, `down_each`, `whole_single`. -//! Split out of `rust_legacy` to keep its files under the line limit. +//! Per-row callbacks of the legacy planar path (gate_each, down_each) that hand each result to a pool writer, plus +//! whole_single, the one-token whole-expert fallback with its scratch. use super::{ ActQ, FF, GateUpOut, MAX_ROWS, PlanarActivation, SingleScratch, act_refs, down_row, gate_up_pair, diff --git a/crates/native-cpu-expert/src/rust_legacy/set_oracle_q8_zero.rs b/crates/native-cpu-expert/src/rust_legacy/set_oracle_q8_zero.rs index 2a21a21d..a1f30b0b 100644 --- a/crates/native-cpu-expert/src/rust_legacy/set_oracle_q8_zero.rs +++ b/crates/native-cpu-expert/src/rust_legacy/set_oracle_q8_zero.rs @@ -1,5 +1,5 @@ -//! Methods of `PlanarActivation`: `quantize`, `quantize_oracle`, `quantize_native`. -//! Implements `Default for PlanarActivation`, `Default for PlanarScratch`. +//! Legacy planar CPU kernels: the oracle Q8 switch, CPUID/XCR0 admission, half-float decode, PlanarActivation +//! quantization and the AVX2/AVX-512 VNNI row dot leaves (row256, row512, oracle) over ternary expert rows. use super::{ __cpuid, __cpuid_count, __m256, __m256i, __m512, _mm_add_epi32, _mm_cvtsi128_si32, _mm_hadd_epi32, _mm_loadl_epi64, diff --git a/crates/native-cpu-expert/src/rust_legacy/tests.rs b/crates/native-cpu-expert/src/rust_legacy/tests.rs index 35f6b518..4f472d22 100644 --- a/crates/native-cpu-expert/src/rust_legacy/tests.rs +++ b/crates/native-cpu-expert/src/rust_legacy/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of `rust_legacy`. +//! Pins the legacy row leaves: rows longer than the 40-block activation are refused before any load, and the +//! row256 correction is one fused multiply-add, as in the pinned C++ reference. use super::*; use std::panic::{AssertUnwindSafe, catch_unwind}; diff --git a/crates/native-cpu-expert/src/rust_native_general/group_dot_bytes_policy.rs b/crates/native-cpu-expert/src/rust_native_general/group_dot_bytes_policy.rs index 5059b0fd..98726ee0 100644 --- a/crates/native-cpu-expert/src/rust_native_general/group_dot_bytes_policy.rs +++ b/crates/native-cpu-expert/src/rust_native_general/group_dot_bytes_policy.rs @@ -1,5 +1,5 @@ -//! Functions: `typed_bytes`, `typed`, `kq_dot`, `kq256_enabled` and 16 more. -//! Defines `EncodedRow`, `DotRoute`, `DotPolicy` and 2 more. +//! Kernel routing of a native expert row against up to eight activations (K-quant 256-bit env policy, IQ multi-token, +//! IQ4_NL, generic dot) plus the explicit kq_rows, iq_rows and iq_gu_rows benchmark entries and their admission checks. use super::{Error, Kind, NativeActivation, NativeFormat, Q8K, Q8One, Q8Zero, Result, gu_multi_route}; diff --git a/crates/native-cpu-expert/src/rust_native_general/iq4nl_rows.rs b/crates/native-cpu-expert/src/rust_native_general/iq4nl_rows.rs index 8cf7ae24..f5265ac6 100644 --- a/crates/native-cpu-expert/src/rust_native_general/iq4nl_rows.rs +++ b/crates/native-cpu-expert/src/rust_native_general/iq4nl_rows.rs @@ -1,5 +1,5 @@ -//! Functions: `admit_iq4nl`, `iq4nl_rows`, `native_experts_available`, `kq_supported` and 10 more. -//! Split out of `rust_native_general` to keep its files under the line limit. +//! Explicit row-range entry points for the IQ4_NL, K-quant gate/up and Q2 formats, the kind-support predicates and +//! the shape/CPU admission each performs before dispatching to the 256-bit or 512-bit leaves. use super::{ Error, Kind, NativeActivation, NativeFormat, Q8Zero, Result, check_gu, check_rows, check_weights, kq_dot, store, diff --git a/crates/native-cpu-expert/src/rust_native_general/native_activation_quantize.rs b/crates/native-cpu-expert/src/rust_native_general/native_activation_quantize.rs index a1613e89..5e197de8 100644 --- a/crates/native-cpu-expert/src/rust_native_general/native_activation_quantize.rs +++ b/crates/native-cpu-expert/src/rust_native_general/native_activation_quantize.rs @@ -1,5 +1,5 @@ -//! Methods of `NativeActivation`: `quantize`, `encoded_bytes`, `check`, `raw`. -//! Implements `Default for NativeActivation`. +//! NativeActivation quantization and shape check, the multi-token gate/up kernel choice (gu_multi_route), and the +//! native_gu_rows / native_down_rows entry points that run an expert row by row in groups of eight tokens. use super::{ DotPolicy, DotRoute, EncodedRow, Error, Kind, NativeActivation, NativeFormat, Result, check_gu, check_rows, diff --git a/crates/native-cpu-expert/src/rust_native_general/tests.rs b/crates/native-cpu-expert/src/rust_native_general/tests.rs index 5a07b2f5..1f6b2e89 100644 --- a/crates/native-cpu-expert/src/rust_native_general/tests.rs +++ b/crates/native-cpu-expert/src/rust_native_general/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of `rust_native_general`. +//! Pins the multi-token gate/up kernel choice (gu_multi_route follows native_expert.cpp) and that IQ4_XS gate/up on +//! the AVX2 tree matches the multi-token kernel row by row, re-running itself under forced AVX2 on AVX-512 CPUs. use super::super::rust_simd::{Dispatch, avx2_ok, avx512_ok}; use super::*; diff --git a/crates/native-cpu-expert/src/rust_pool/native_act_default.rs b/crates/native-cpu-expert/src/rust_pool/native_act_default.rs index d1f14617..ca6895b0 100644 --- a/crates/native-cpu-expert/src/rust_pool/native_act_default.rs +++ b/crates/native-cpu-expert/src/rust_pool/native_act_default.rs @@ -1,5 +1,5 @@ -//! Implements `Default for NativeAct`, `Default for Scratch` and 4 more. Functions: `all_finite`, `allocated`. -//! Split out of `rust_pool` to keep its files under the line limit. +//! Default values of the native pool's plain data (activation, scratch, job, split buffers), the unsafe Send/Sync +//! contract of the shared epoch state, the finite-float scan all_finite and the fallible Vec allocator. use super::{ActQ, Error, FF, Job, MAX_ROWS, NativeAct, Q8K, Result, Scratch, Shared, SingleSplit}; diff --git a/crates/native-cpu-expert/src/rust_pool/native_pool.rs b/crates/native-cpu-expert/src/rust_pool/native_pool.rs index 68d228bc..1ce0c37d 100644 --- a/crates/native-cpu-expert/src/rust_pool/native_pool.rs +++ b/crates/native-cpu-expert/src/rust_pool/native_pool.rs @@ -1,5 +1,5 @@ -//! Methods of `NativePool`: `plan`, `new`, `new_shared`, `empty_batch` and 13 more. -//! Split out of `rust_pool` to keep its files under the line limit. +//! NativePool construction and two-phase dispatch: worker planning and spawn, publishing a phase epoch, batch +//! compute with host requantization between gate/up and down, timing/trace readout, and borrowed-matrix prefetch. use super::{ Arc, AtomicBool, AtomicU32, AtomicU64, Batch, Condvar, Duration, Error, FF, H, Instant, Job, Line, MAX_JOBS, diff --git a/crates/native-cpu-expert/src/rust_pool/native_pool_group_compute.rs b/crates/native-cpu-expert/src/rust_pool/native_pool_group_compute.rs index 47297c2b..25d149e2 100644 --- a/crates/native-cpu-expert/src/rust_pool/native_pool_group_compute.rs +++ b/crates/native-cpu-expert/src/rust_pool/native_pool_group_compute.rs @@ -1,5 +1,5 @@ -//! Methods of `NativePool`: `validate_group`, `group_shape`, `check_expert`, `claim_row` and 2 more. -//! Implements `Drop for NativePool`. +//! NativePool::compute_borrowed: runs a whole borrowed expert group straight into the caller's output rows after +//! validating shapes, extents and distinct output rows, and checking outputs finite; also stops workers on Drop. use super::{Error, H, Instant, MAX_JOBS, MAX_ROWS, NativeFmt, NativePool, Ordering, Result, all_finite}; diff --git a/crates/native-cpu-expert/src/rust_weight_iq/alloc.rs b/crates/native-cpu-expert/src/rust_weight_iq/alloc.rs index 9d23e767..d8aed3b5 100644 --- a/crates/native-cpu-expert/src/rust_weight_iq/alloc.rs +++ b/crates/native-cpu-expert/src/rust_weight_iq/alloc.rs @@ -1,5 +1,5 @@ -//! Methods of `Grid`: `new`, `index_points`, `neighbor_counts`, `distances` and 4 more. -//! Functions: `alloc`, `grid_kind`, `grid`, `init` and 6 more. Defines `QuantTarget`, `CandidateStep`. +//! Codebook Grid of the IQ quantizers: builds each grid's point table and nearest-neighbour lists for off-grid codes, +//! caches one Grid per quant kind (init/free), and holds the sign-split and candidate-resolve helpers they share. use super::{ Arc, CACHE, Error, Grid, KGRID_1BIT_2048, KGRID_2BIT_256, KGRID_2BIT_512, KGRID_2BIT_1024, KGRID_256, KGRID_512, diff --git a/crates/native-cpu-expert/src/rust_weight_iq/grid.rs b/crates/native-cpu-expert/src/rust_weight_iq/grid.rs index d83c13f0..fb4496de 100644 --- a/crates/native-cpu-expert/src/rust_weight_iq/grid.rs +++ b/crates/native-cpu-expert/src/rust_weight_iq/grid.rs @@ -1,5 +1,5 @@ -//! Methods of `Grid`: `resolve_one`, `best_neighbor`. -//! Functions: `point_error`, `abs_max`, `split_levels`, `flip_levels` and 8 more. Defines `Iq1Fit`. +//! IQ1_S block quantizer (split search over sorted values, scale refit, packed scales and group heads) with the +//! Grid point resolution (resolve_one, best_neighbor) and the level helpers it shares with IQ1_M. use super::alloc::{sum_sq, weights}; use super::{Error, Grid, Pair, Result, XM, XP, nearest, pairs, put_h}; diff --git a/crates/native-cpu-expert/src/rust_weight_iq/iq1_m.rs b/crates/native-cpu-expert/src/rust_weight_iq/iq1_m.rs index a503b3fe..6b3e1781 100644 --- a/crates/native-cpu-expert/src/rust_weight_iq/iq1_m.rs +++ b/crates/native-cpu-expert/src/rust_weight_iq/iq1_m.rs @@ -1,5 +1,5 @@ -//! Functions: `iq1_m`, `half_values`, `iq1_m_block`, `iq1_m_search` and 7 more. Defines `Iq1MFit`. -//! Split out of `rust_weight_iq` to keep its files under the line limit. +//! IQ1_M quantizer: per 16-value block split search and scale refit over the shift patterns, packed super-block +//! scales, and row(), the per-kind 256-value block dispatch for the IQ1/IQ2/IQ3 quantizers. use super::alloc::{sum_sq, weights}; use super::grid::{abs_max, flip_levels, split_levels}; diff --git a/crates/native-cpu-expert/src/rust_weight_iq/iq2_xxs.rs b/crates/native-cpu-expert/src/rust_weight_iq/iq2_xxs.rs index 3e8c6036..bd3bad46 100644 --- a/crates/native-cpu-expert/src/rust_weight_iq/iq2_xxs.rs +++ b/crates/native-cpu-expert/src/rust_weight_iq/iq2_xxs.rs @@ -1,5 +1,5 @@ -//! Functions: `iq2_xxs`, `iq2_xxs_finish`, `iq2_xxs_block`, `iq2_xxs_search` and 3 more. -//! Split out of `rust_weight_iq` to keep its files under the line limit. +//! IQ2_XXS and IQ2_XS quantizers: per-block scale search over candidate scales with sign bytes, then packing of +//! the scale levels and grid indices into the super-block. use super::alloc::{Block, Trial, fix_groups, flip, search_scale, sum_sq, vmax, weights}; use super::{CandidateStep, Grid, QuantTarget, Result, nearest, put_h, qp, quant_candidates, totals}; diff --git a/crates/native-cpu-expert/src/rust_weight_iq/iq3.rs b/crates/native-cpu-expert/src/rust_weight_iq/iq3.rs index ae09a9be..3730c0f8 100644 --- a/crates/native-cpu-expert/src/rust_weight_iq/iq3.rs +++ b/crates/native-cpu-expert/src/rust_weight_iq/iq3.rs @@ -1,5 +1,5 @@ -//! Methods of `Iq3Out`: `store`, `finish`. Functions: `iq3`, `iq3_block`, `iq2_s`, `iq2_s_finish` and 3 more. -//! Defines `Iq3Out`, `BlockFit`. +//! IQ3 (XXS/S) and IQ2_S quantizers sharing the Iq3Out packer, plus the value/index pair sort helpers (pairs, +//! compare_pair) used by the sorted-split searches. use super::alloc::{Block, Trial, fix_groups, flip, search_scale, sum_sq, vmax, weights}; use super::{Grid, Kind, Pair, Result, nearest, put_h, qsort}; diff --git a/crates/native-cpu-expert/src/rust_weight_quant/best_fp4.rs b/crates/native-cpu-expert/src/rust_weight_quant/best_fp4.rs index 8b91d798..9a8b10cd 100644 --- a/crates/native-cpu-expert/src/rust_weight_quant/best_fp4.rs +++ b/crates/native-cpu-expert/src/rust_weight_quant/best_fp4.rs @@ -1,5 +1,5 @@ -//! Functions: `best_fp4`, `fp4`, `ternary`, `tq2_levels` and 15 more. -//! Split out of `rust_weight_quant` to keep its files under the line limit. +//! Scalar quantizers for the 4-bit float, ternary (TQ1/TQ2), Q2_K and Q3_K formats, with the packing and +//! unpacking of their 3-bit and 4-bit block scales. use super::nearest::{Qkx, Search, sum_sq}; use super::{FP4, Kind, e8_half, h, max_signed, nearest, pack_ue4, put_h, q3, qkx, qp, qx, ue4}; diff --git a/crates/native-cpu-expert/src/rust_weight_quant/iq4.rs b/crates/native-cpu-expert/src/rust_weight_quant/iq4.rs index 1015c4a0..08d3029c 100644 --- a/crates/native-cpu-expert/src/rust_weight_quant/iq4.rs +++ b/crates/native-cpu-expert/src/rust_weight_quant/iq4.rs @@ -1,5 +1,5 @@ -//! Functions: `iq4`, `iq4_search`, `iq4_block`, `iq4_sums` and 5 more. -//! Split out of `rust_weight_quant` to keep its files under the line limit. +//! IQ4_XS and IQ4_NL quantizers (nonlinear 4-bit codebook, per-block scale search, packed 6-bit scales), and the +//! row driver that quantizes every non-IQ-grid kind, leaving the grid kinds to rust_weight_iq. use super::nearest::sum_sq; use super::{ diff --git a/crates/native-cpu-expert/src/rust_weight_quant/nearest.rs b/crates/native-cpu-expert/src/rust_weight_quant/nearest.rs index 14796bcc..178450d3 100644 --- a/crates/native-cpu-expert/src/rust_weight_quant/nearest.rs +++ b/crates/native-cpu-expert/src/rust_weight_quant/nearest.rs @@ -1,5 +1,5 @@ -//! Methods of `Search`: `new`, `record`, `factors`, `steps`. `impl Qkx`. -//! Functions: `nearest`, `put_h`, `h`, `sum_sq` and 15 more. Defines `Search`, `QxStart`, `Qkx` and 2 more. +//! Shared numeric core of the K-quant searches: round-to-nearest, half-float store/load, the per-block Search +//! record, and the least-squares scale searches qx, q3 and qkx (with its parameter set) used by all quantizers. use super::{EPS, half, half_rn}; diff --git a/crates/native-cpu-expert/src/rust_weight_quant/q45k.rs b/crates/native-cpu-expert/src/rust_weight_quant/q45k.rs index 6cb1529d..c0b296d0 100644 --- a/crates/native-cpu-expert/src/rust_weight_quant/q45k.rs +++ b/crates/native-cpu-expert/src/rust_weight_quant/q45k.rs @@ -1,5 +1,5 @@ -//! Functions: `q45k`, `q45k_search`, `q45k_weights`, `q45k_scales` and 7 more. -//! Split out of `rust_weight_quant` to keep its files under the line limit. +//! Q4_K, Q5_K and Q6_K quantizers: importance-weighted per-block scale/minimum search, super-block scale packing, +//! requantization against the stored scales and bit packing; also best_iq4, the nearest IQ4 codebook level. use super::nearest::{Qkx, Search, sum_sq}; use super::{EPS, h, nearest, pack_scale4, put_h, qkx, qp, qx, unpack_scale4}; diff --git a/crates/native-cpu-expert/src/rust_weight_quant/qp.rs b/crates/native-cpu-expert/src/rust_weight_quant/qp.rs index ab80c31d..a980682a 100644 --- a/crates/native-cpu-expert/src/rust_weight_quant/qp.rs +++ b/crates/native-cpu-expert/src/rust_weight_quant/qp.rs @@ -1,5 +1,5 @@ -//! Functions: `qp`, `qp_scale`, `qp_error`, `qp_refine` and 15 more. Defines `Shape`. -//! Split out of `rust_weight_quant` to keep its files under the line limit. +//! Weighted scale search (qp) and the small-block formats of 32 or fewer values per block (F32/F16/BF16, Q1, Q2, Q4/Q5 +//! with and without minimum, Q8), plus the e8/ue4 scale helpers and nibble packing they use. use super::nearest::Qkx; use super::{EPS, Kind, max_signed, nearest, put_h, qkx, qx}; diff --git a/crates/obs/src/level.rs b/crates/obs/src/level.rs index ac896a16..0fc9d66d 100644 --- a/crates/obs/src/level.rs +++ b/crates/obs/src/level.rs @@ -1,5 +1,5 @@ -//! Methods of `Level`: `as_str`, `parse`. Methods of `Settings`: `from_env`. -//! Implements `From for V`, `From for V` and 8 more. +//! Log levels and settings (LELEKA_LOG_* environment), conversion of values into log fields, and the pure line +//! formatter: redaction and capping of fields, then one JSON or text event line. use std::fmt::Write as _; use super::{ diff --git a/crates/obs/src/redact/tests.rs b/crates/obs/src/redact/tests.rs index 85a0f202..9dada0b3 100644 --- a/crates/obs/src/redact/tests.rs +++ b/crates/obs/src/redact/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of `redact`. +//! Tests of log redaction: key classification, registered secrets, bearer and token shapes, query parameters, +//! that ordinary text, digests and paths pass through, and clipping at character boundaries. use super::*; diff --git a/crates/obs/src/write_stderr.rs b/crates/obs/src/write_stderr.rs index 157ce4a8..3c3a567b 100644 --- a/crates/obs/src/write_stderr.rs +++ b/crates/obs/src/write_stderr.rs @@ -1,5 +1,5 @@ -//! Methods of `FileSink`: `new`, `path`, `write_line`. -//! Functions: `write_stderr`, `request_sink`, `emit`, `emit_keyed` and 10 more. +//! Log output: writes lines to stderr or the request log file, with the rate-limited emit family (emit, emit_always, +//! record for per-request lines, level shortcuts) and request id generation. use std::io::Write as _; use super::{ diff --git a/crates/sampler-ref/src/chain/tests.rs b/crates/sampler-ref/src/chain/tests.rs index 47c36a21..0626548c 100644 --- a/crates/sampler-ref/src/chain/tests.rs +++ b/crates/sampler-ref/src/chain/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the sampler chain: top-k rules, repeat penalty on negative and positive logits, greedy and ordering ties +//! by lowest id, penalty window and history, shape checks, per-row counters, temperature zero and min-p. use super::*; diff --git a/crates/sampler-ref/src/params/tests.rs b/crates/sampler-ref/src/params/tests.rs index 43650c49..1e9c91de 100644 --- a/crates/sampler-ref/src/params/tests.rs +++ b/crates/sampler-ref/src/params/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of request sampling parameters: Python repr, the Original defaults, top-k and penalty-window normalisation, +//! engine parameters, rejection of invalid fields, config ranges, request overlay and decimal wire floats. use super::*; diff --git a/crates/sampler-ref/src/serve/tests.rs b/crates/sampler-ref/src/serve/tests.rs index 24c4d691..39474365 100644 --- a/crates/sampler-ref/src/serve/tests.rs +++ b/crates/sampler-ref/src/serve/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the serve-loop sampling helpers: request parameters, coupled drafting setup, per-window draw counters over +//! literal histories, draft history staging, window rows by confidence floor, and settling a window. use super::*; diff --git a/crates/serving-policy/src/cvec/build_tables.rs b/crates/serving-policy/src/cvec/build_tables.rs index ddd90f93..c4220efb 100644 --- a/crates/serving-policy/src/cvec/build_tables.rs +++ b/crates/serving-policy/src/cvec/build_tables.rs @@ -1,5 +1,5 @@ -//! Methods of `Sums`: `new`, `add_file`, `add_tensor`, `steer_layers`. Methods of `Steering`: `new`, `steer`. -//! Functions: `build_tables`, `layer_bounds`, `single_layer`, `tables_summary` and 4 more. Defines `Sums`, `Steering`. +//! Builds the control-vector direction and scale tables from parsed vector files (summing scaled directions per +//! layer, project or add mode, single-layer source) and parses the control-vector command-line values. use super::{Mode, Options, Tables, VectorFile, VectorTensor, strtol}; diff --git a/crates/serving-policy/src/cvec/cursor.rs b/crates/serving-policy/src/cvec/cursor.rs index e8d51788..25a9bb54 100644 --- a/crates/serving-policy/src/cvec/cursor.rs +++ b/crates/serving-policy/src/cvec/cursor.rs @@ -1,5 +1,5 @@ -//! Methods of `Cursor`: `take`, `u32`, `u64`, `string`. Implements `Default for Options`. -//! Functions: `value`, `skip_array`, `parse_gguf`, `read_header` and 4 more. Defines `Info`. +//! Reads control-vector GGUF files: the byte Cursor, header, metadata and tensor-info parsing (v2/v3, little endian), +//! f32 tensor values, the default Options, and the C strtol helper the engine parses numbers with. use super::{Cursor, Mode, Options, VectorFile, VectorTensor}; diff --git a/crates/serving-policy/src/cvec/tests.rs b/crates/serving-policy/src/cvec/tests.rs index 5cac83dd..c84f1111 100644 --- a/crates/serving-policy/src/cvec/tests.rs +++ b/crates/serving-policy/src/cvec/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of control-vector tables: add mode sums scaled files, project mode stores unit vector and norm, loader +//! error wording, command-line value parsing, and GGUF files round-tripping through the parser. use super::*; diff --git a/crates/serving-policy/src/shared/shared_defaults.rs b/crates/serving-policy/src/shared/shared_defaults.rs index 8c7ad455..f1932b34 100644 --- a/crates/serving-policy/src/shared/shared_defaults.rs +++ b/crates/serving-policy/src/shared/shared_defaults.rs @@ -1,5 +1,5 @@ -//! Methods of `SharedDefaults`: `is_empty`, `to_json`, `sampling`. -//! Functions: `float_value`, `py_repr`, `push_escaped`, `py_str_repr` and 10 more. +//! Validation and JSON form of the server-wide shared defaults (POST /settings): clean_shared_defaults with the +//! Original error texts, SharedDefaults JSON and sampling conversion, and Python repr helpers for those messages. use super::{Map, Number, RequestSampling, SharedDefaults, Value, py_float_repr}; diff --git a/crates/serving-policy/src/shared/tests.rs b/crates/serving-policy/src/shared/tests.rs index dd413943..111187e0 100644 --- a/crates/serving-policy/src/shared/tests.rs +++ b/crates/serving-policy/src/shared/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of shared defaults: unknown and empty keys, normalisation like the Original, config range checks, the +//! precedence request over shared over config, llama-server names in props, aliases, and Python repr of values. use super::*; use serde_json::json; diff --git a/crates/serving-policy/src/vision/tests.rs b/crates/serving-policy/src/vision/tests.rs index 7b1e291a..ce69842d 100644 --- a/crates/serving-policy/src/vision/tests.rs +++ b/crates/serving-policy/src/vision/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the host-side image path: M-RoPE positions for text and images, failure wording, image sources, +//! image markers after vision start only, native formats passing through, and lenient base64 decoding. use super::*; use serde_json::json; diff --git a/crates/tokenizer/src/fast/unicode_ranges.rs b/crates/tokenizer/src/fast/unicode_ranges.rs index 56327871..e304423f 100644 --- a/crates/tokenizer/src/fast/unicode_ranges.rs +++ b/crates/tokenizer/src/fast/unicode_ranges.rs @@ -1,5 +1,5 @@ -//! Methods of `Classes`: `new`, `flags_of`, `at`, `letters_end` and 4 more. -//! Methods of `PairTable`: `with_capacity`, `slot`, `insert`, `get`. +//! Character classes of the fast pre-tokenizer: Unicode letter, mark, number and space ranges flattened into an ASCII +//! table plus sorted boundaries, the pre-token splitting rules built on them, and the open-addressing merge-pair table. use super::{Class, Classes, EMPTY, HirKind, LETTER, LETTER_OR_MARK, MARK, NUMBER, PairTable, ParserBuilder, SPACE}; diff --git a/crates/tokenizer/src/gguf_bpe/tests.rs b/crates/tokenizer/src/gguf_bpe/tests.rs index b53e5ae5..b8b35e68 100644 --- a/crates/tokenizer/src/gguf_bpe/tests.rs +++ b/crates/tokenizer/src/gguf_bpe/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the GGUF BPE tokenizer: GPT-2 byte map, merges in rank order, special tokens on request, byte round trip, +//! o200k-style pre-tokenizer splitting, long pieces, the UTF-8 streaming decoder and refusal of bad vocabularies. use super::*; diff --git a/crates/tokenizer/src/gguf_bpe/utf8_stream.rs b/crates/tokenizer/src/gguf_bpe/utf8_stream.rs index cfdfb5ba..ee173dfc 100644 --- a/crates/tokenizer/src/gguf_bpe/utf8_stream.rs +++ b/crates/tokenizer/src/gguf_bpe/utf8_stream.rs @@ -1,5 +1,5 @@ -//! Methods of `Utf8Stream`: `push`, `finish`. -//! Split out of `gguf_bpe` to keep its files under the line limit. +//! Streaming UTF-8 decoder for token bytes: returns the longest valid text so far (bad bytes become U+FFFD) and holds +//! back an incomplete trailing character until the next push, so a character is never split across tokens. use super::Utf8Stream; From f2bc8884596ad759236f32e53e24ee16edd91499 Mon Sep 17 00:00:00 2001 From: Pavlo Ratushnyi Date: Sat, 14 Nov 2026 20:57:34 +0100 Subject: [PATCH 04/10] engine-qwen35-cuda: no #[allow(unused_imports)] left (re-exports nobody used are gone, names only the test build needs are cfg(test), names only another platform needs sit under their cfg) Co-Authored-By: Claude Sonnet 5.5 --- .../combined_changed_boundary_proof.rs | 17 ++------ .../src/backend/native_down_candidate_only.rs | 20 +++------- .../adaptive_slots.rs | 22 +++-------- .../src/backend/native_down_public_pair.rs | 22 +++-------- .../src/backend/original_serve.rs | 7 ---- .../src/backend/original_serve/runner.rs | 16 -------- .../original_serve/runner/owner_run_steps.rs | 13 +++---- .../src/backend/original_serve_laptop.rs | 18 +-------- .../src/backend/original_serve_laptop/soak.rs | 19 +-------- .../backend/original_serve_memory_smoke.rs | 17 +------- .../original_serve_memory_smoke/inventory.rs | 20 +--------- .../backend/original_serve_prefix_smoke.rs | 17 +------- .../original_serve_prefix_smoke/workload.rs | 19 +-------- .../src/backend/original_serve_replay.rs | 19 +-------- .../src/backend/original_serve_replay/load.rs | 17 +------- .../src/backend/original_serve_replay/pass.rs | 19 +-------- .../original_serve_replay/required_path.rs | 19 +-------- .../src/backend/original_serve_replay/run.rs | 17 +------- .../src/backend/original_serve_smoke.rs | 17 +------- .../original_serve_smoke/smoke_main.rs | 18 +-------- .../src/backend/original_serve_ttft.rs | 18 +-------- .../src/conversation/memory.rs | 1 - .../src/conversation/mod.rs | 2 - .../src/memory_governor/page_cache.rs | 5 +-- .../src/model_binding/qwen4exp_input.rs | 6 --- .../qwen4exp_input/moe_expert.rs | 8 +--- .../src/model_binding/qwen4exp_input/mtp.rs | 34 +--------------- .../qwen4exp_input/mtp/backing.rs | 8 ++-- .../qwen4exp_input/mtp/mtp_weight_reads.rs | 7 ++-- .../qwen4exp_input/mtp/read_expert_rows.rs | 8 ++-- .../src/model_binding/qwen4exp_kar_ple.rs | 31 ++------------- .../qwen4exp_kar_ple/inherited_kar_archive.rs | 5 +-- .../qwen4exp_kar_ple/inherited_kar_tests.rs | 6 +-- .../load_pinned_inherited_archive.rs | 7 ++-- .../qwen4exp_kar_ple/pinned_profile.rs | 7 ++-- .../qwen4exp_kar_ple/pinned_profile_tests.rs | 5 +-- .../qwen4exp_kar_ple/private_copy.rs | 16 ++------ .../private_copy/checked_reader.rs | 7 ++-- .../qwen4exp_kar_ple/private_copy/inode.rs | 6 ++- .../src/qwen_forward/dense_weight_cache.rs | 2 - .../src/qwen_forward/executor.rs | 7 +--- .../qwen_forward/executor/original_prompt.rs | 5 --- .../qwen_forward/executor/prefill_chunk.rs | 17 +++----- .../executor/prefill_chunk/qwen_forward.rs | 14 +++---- .../prefill_chunk/qwen_forward/joint_chunk.rs | 1 + .../qwen_forward/prefill_chunk_planned.rs | 14 +++---- .../prefill_chunk_planned/window_ffn_flow.rs | 1 - .../executor/prefill_chunk/window_numeric.rs | 9 ++--- .../src/qwen_forward/gdn.rs | 36 +++-------------- .../src/qwen_forward/gdn/chain.rs | 3 +- .../src/qwen_forward/gdn/chunk_device.rs | 16 ++------ .../chunk_device/gdn_chunk_device_methods.rs | 15 ++----- .../gdn/chunk_device/numeric_gpu.rs | 24 ++---------- .../gdn/chunk_device/numeric_gpu/operands.rs | 13 ++----- .../src/qwen_forward/gdn/mirror.rs | 1 - .../src/qwen_forward/gdn/prefill_batch.rs | 8 +--- .../gdn/prefill_batch/gdn_stage.rs | 1 - .../src/qwen_forward/gdn/verification.rs | 1 - .../gdn/verification/compute_row.rs | 1 - .../engine-qwen35-cuda/src/qwen_forward/gr.rs | 20 +--------- .../src/qwen_forward/gr/batch_chunk.rs | 2 - .../qwen_forward/gr/batch_chunk/gr_stage.rs | 1 - .../batch_chunk/gr_stage_prepare_injection.rs | 1 - .../src/qwen_forward/gr/gr_stage.rs | 1 - .../qwen_forward/gr/output_workspace_gpu.rs | 15 ++----- .../gr/output_workspace_gpu/check_handoff.rs | 8 ---- .../gr/output_workspace_gpu/fresh_read.rs | 8 ---- .../src/qwen_forward/input.rs | 21 +--------- .../src/qwen_forward/input/ple_transport.rs | 6 --- .../ple_transport/ple_key_retained_gpu.rs | 12 +----- .../ple_key_retained_gpu/bf16.rs | 5 +-- .../src/qwen_forward/kar_ple_cache.rs | 6 --- .../src/qwen_forward/moe_expert.rs | 39 ++----------------- .../moe_expert/cached_expert_run.rs | 1 - .../src/qwen_forward/moe_expert/grouped.rs | 19 --------- .../moe_expert/grouped/adaptive_packets.rs | 2 - .../moe_expert/grouped/direct_gpu.rs | 35 ++--------------- .../packet_run_project_group_direct.rs | 1 - .../moe_expert/grouped/project_group.rs | 1 - .../grouped/resident/original_adaptive.rs | 2 +- .../moe_expert/moe_activation_reuse_gpu.rs | 13 ------- .../moe_expert/moe_down/moe_down_reuse_gpu.rs | 7 ---- .../down_reuse_refusal_rig.rs | 1 - .../src/qwen_forward/moe_prefill_batch.rs | 8 ---- .../src/qwen_forward/moe_route.rs | 16 +------- .../src/qwen_forward/moe_weight_cache.rs | 12 ++---- .../cache_ephemeral_routed.rs | 6 --- .../moe_weight_cache/cache_lru_index.rs | 1 - .../moe_weight_cache/cache_original_prompt.rs | 5 +-- .../moe_weights_original_prompt.rs | 1 - .../moe_weight_cache/cache_profile.rs | 2 - .../moe_weight_cache/cache_profile_fill.rs | 14 ++----- .../learned_main_lru_profile.rs | 1 - .../cache_profile_fill/moe_weight_cache.rs | 12 ++---- .../shared_quartet_preload.rs | 2 +- .../strata_adaptive_shared_pool.rs | 1 - .../moe_weight_cache/cache_strata_adaptive.rs | 4 -- .../moe_weight_cache/original_mtp_weights.rs | 4 +- .../moe_weight_cache/window_pins.rs | 10 +---- .../src/qwen_forward/mtp.rs | 16 -------- .../src/qwen_forward/mtp/state.rs | 2 - .../src/qwen_forward/mtp/state/chunk.rs | 4 +- .../src/qwen_forward/mtp_attention.rs | 22 ----------- .../mtp_attention/reuse_gpu_tests.rs | 6 +-- .../mtp_attention/reuse_gpu_tests/phases.rs | 6 --- .../src/qwen_forward/mtp_decode.rs | 6 --- .../src/qwen_forward/mtp_decode/batch_gpu.rs | 15 +------ .../mtp_decode/batch_gpu/check_loaded.rs | 18 ++------- .../mtp_decode/batch_gpu/check_loaded/flow.rs | 8 ---- .../flow_decode_edge_scenarios.rs | 8 ---- .../batch_gpu/check_loaded/position_at.rs | 8 ---- .../mtp_decode/batch_gpu/collection.rs | 8 ---- .../qwen_forward/mtp_decode/mtp_decoder.rs | 10 ++--- .../src/qwen_forward/mtp_experts.rs | 32 +-------------- .../mtp_experts/fixed_workspace.rs | 10 +---- .../fixed_workspace/fixed_workspace_gpu.rs | 5 +-- .../mtp_experts/mtp_expert_transport.rs | 11 +----- .../mtp_expert_transport_gpu.rs | 11 ------ .../src/qwen_forward/mtp_gr.rs | 15 ------- .../qwen_forward/original_mtp_full_owner.rs | 3 -- .../original_mtp_verified_adapter.rs | 1 - .../src/qwen_forward/original_serve_engine.rs | 3 -- .../original_serve_engine/round_tally.rs | 6 --- .../original_serve_engine/tests.rs | 8 ++-- .../tests/constructor_validates_dimensions.rs | 7 ---- .../tests/restore_attempts_do_not_depend.rs | 6 --- .../src/qwen_forward/original_serve_host.rs | 12 ++---- .../src/qwen_forward/original_serve_native.rs | 11 ------ .../src/qwen_forward/original_serve_pool.rs | 14 +------ .../qwen_forward/original_serve_request.rs | 5 ++- .../qwen_forward/original_serve_residency.rs | 27 ++----------- .../original_serve_residency/open_tier.rs | 11 +++--- .../src/qwen_forward/original_serve_stack.rs | 11 ------ .../original_serve_stack/lifecycle_fake.rs | 2 +- .../decode_phase_steps.rs | 2 - .../decode_steps.rs | 1 - .../original_serve_stack_open/assemble.rs | 1 - .../original_serve_stack/prefix.rs | 2 - .../original_serve_stack/prefix/tests.rs | 6 +-- .../prefix/tests/one_token_prompt_reads.rs | 7 ---- .../prefix/tests/second_session.rs | 6 --- .../qwen_forward/original_spec_controller.rs | 2 - .../original_spec_controller/tests.rs | 6 +-- .../adaptation_join_failure_is_reported.rs | 7 ---- .../tests/config_rejects_out_of_range.rs | 12 +----- .../tests/non_finite_window.rs | 7 ---- .../src/qwen_forward/original_spec_draft.rs | 2 +- .../src/qwen_forward/output.rs | 8 ---- .../src/qwen_forward/prompt_device_rows.rs | 5 --- .../prompt_device_rows/prompt_device_read.rs | 2 - .../src/qwen_forward/q6_attention_columns.rs | 6 --- .../src/qwen_forward/qsa_attention.rs | 12 ------ .../qsa_attention/attention_scratch/gpu.rs | 2 +- .../qsa_attention/retained_gpu_tests.rs | 6 +-- .../src/qwen_forward/qsa_index.rs | 37 +----------------- .../qwen_forward/qsa_index/index_resident.rs | 22 +++++------ .../qwen_forward/qsa_index/prompt_device.rs | 10 ++--- .../prompt_device/resident_device.rs | 17 +++----- .../resident_device/resident_qsa_completed.rs | 1 - .../resident_qsa_span_export_and_seal.rs | 1 - .../prompt_device/resident_device/scalar.rs | 16 -------- .../src/qwen_forward/qsa_prefill_batch.rs | 26 ------------- .../src/qwen_forward/router_scratch/gpu.rs | 22 +---------- .../qwen_forward/router_scratch/gpu/report.rs | 3 -- .../src/qwen_forward/session/chunk.rs | 12 ++---- .../session/chunk/qwen_chunk_txn.rs | 14 +++---- .../src/qwen_forward/session/chunk/verify.rs | 2 - .../qwen_forward/session/original_prompt.rs | 7 ++-- .../session/original_prompt/draft.rs | 2 - .../src/qwen_forward/session/tests.rs | 5 +-- .../tests/gdn_session_commit_advances_all.rs | 6 --- .../tests/retained_gr_handoff_identity.rs | 6 --- 172 files changed, 244 insertions(+), 1470 deletions(-) diff --git a/crates/engine-qwen35-cuda/src/backend/combined_changed_boundary_proof.rs b/crates/engine-qwen35-cuda/src/backend/combined_changed_boundary_proof.rs index b51e95ba..b9ca28c8 100644 --- a/crates/engine-qwen35-cuda/src/backend/combined_changed_boundary_proof.rs +++ b/crates/engine-qwen35-cuda/src/backend/combined_changed_boundary_proof.rs @@ -1,21 +1,10 @@ //! Private sole new changed-path model gate; actual source identity/load preserved. use super::{ - Arc, AtomicBool, AtomicU64, BACKEND_API_VERSION, Backend, BackendCapabilities, BackendError, BackendIdentity, - CacheCounts, Clock, ContractError, DeferredTail, Digest, Driver, Duration, ErrorCode, EvaluationExecution, - EvaluationMeasurement, EvaluationObserver, ExperimentalConfig, ExpertSource, FinishReason, GenerationEvent, - GenerationRequest, GenerationSink, GenerationStream, GenerationTerminal, InferenceMode, InheritedKarArchive, - InputBindingError, KarArchiveRef, KarExpertLevels, KarExpertSource, KarExpertSourceConfig, LOAD_CONFIG_VERSION, - LoadedModel, MeasurementFailure, ModelBinding, ModelDescriptor, Mutex, Ordering, OriginalServeChoice, - OriginalServeMode, OriginalServeOptions, PathBuf, PrefixCacheOptions, PrefixTail, Qwen4ExpArtifact, Qwen35Cuda, - Qwen35CudaStart, Rc, Receiver, RecentIds, RuntimeConfig, SHARD0, SHARD1, Sha256, SupportedModelTuple, SyncSender, - SystemClock, Tokenizer, Usage, VerifiedGgufFile, WindowWitness, close_context, load, thread, + Driver, EvaluationExecution, InheritedKarArchive, ModelBinding, PathBuf, Qwen4ExpArtifact, Rc, SHARD0, SHARD1, + Tokenizer, VerifiedGgufFile, }; #[cfg(feature = "preview-path")] -use super::{ - DenseWeightCache, Dimension, InputConstants, Instant, KarPleCache, MoeWeightCache, MtpDecoder, MtpWindowError, - MtpWindowSpec, OutputStage, Position, QwenForward, QwenSession, ResidentConversations, ResidentPolicy, - TargetStepProduct, TokenId, -}; +use super::{DenseWeightCache, KarPleCache, MoeWeightCache, OutputStage, QwenForward, QwenSession}; use crate::qwen_forward::loaded_target_owners::LoadedTargetOwners as LoadedTarget; use std::env; pub(super) mod rig; diff --git a/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only.rs b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only.rs index cb8f8217..d9c3d79b 100644 --- a/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only.rs +++ b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only.rs @@ -1,20 +1,12 @@ //! Candidate-only PUBLIC quality proof against one retained actual Native arm. //! Historical wall time is never used as an A/B measurement. use super::{ - Arc, AtomicBool, AtomicU64, BACKEND_API_VERSION, Backend, BackendCapabilities, BackendError, BackendIdentity, - CacheCounts, Clock, ContractError, DeferredTail, DenseWeightCache, Digest, Dimension, Driver, Duration, ErrorCode, - EvaluationExecution, EvaluationMeasurement, EvaluationObserver, ExperimentalConfig, ExpertSource, FRAME_LIMIT, - FinishReason, Generation, GenerationEvent, GenerationFailure, GenerationRequest, GenerationSink, GenerationStream, - GenerationTerminal, InferenceMode, InheritedKarArchive, InputBindingError, InputConstants, Instant, - KAR_MTP_PROFILE, KarArchiveRef, KarExpertLevels, KarExpertSource, KarExpertSourceConfig, KarPleCache, - LOAD_CONFIG_VERSION, LoadedModel, MODEL_DIGEST, MeasurementFailure, ModelBinding, ModelDescriptor, MoeWeightCache, - MtpContinuation, MtpDecoder, MtpWindowError, MtpWindowSpec, Mutex, Ordering, OriginalServeChoice, - OriginalServeMode, OriginalServeOptions, OutputStage, PathBuf, Position, PrefixCacheOptions, PrefixTail, QUEUE, - Qwen4ExpArtifact, Qwen35Cuda, Qwen35CudaStart, QwenForward, QwenSession, Rc, Receiver, RecentIds, - ResidentConversations, ResidentPolicy, RuntimeConfig, SHARD0, SHARD1, Sha256, Shared, SupportedModelTuple, - SyncSender, SystemClock, TargetStepProduct, TokenId, Tokenizer, Usage, VerifiedGgufFile, WindowWitness, - combined_changed_boundary_proof, emit_terminal, error, generate, generate_mtp_resume, load, measurement, owner, - prepare_prompt, request, session, spawn, thread, + AtomicBool, CacheCounts, DenseWeightCache, Digest, Driver, Duration, EvaluationExecution, EvaluationMeasurement, + FRAME_LIMIT, FinishReason, Generation, GenerationEvent, GenerationFailure, GenerationRequest, GenerationSink, + GenerationStream, GenerationTerminal, InheritedKarArchive, Instant, KAR_MTP_PROFILE, KarPleCache, MODEL_DIGEST, + ModelBinding, MoeWeightCache, MtpContinuation, Mutex, Ordering, OutputStage, PathBuf, QUEUE, Qwen4ExpArtifact, + QwenForward, QwenSession, Rc, SHARD0, SHARD1, Sha256, Shared, SystemClock, Tokenizer, Usage, VerifiedGgufFile, + WindowWitness, emit_terminal, generate_mtp_resume, measurement, prepare_prompt, request, thread, }; use serde_json::{Value, json}; use std::{ diff --git a/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/adaptive_slots.rs b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/adaptive_slots.rs index 97fa3cfb..6adda8f2 100644 --- a/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/adaptive_slots.rs +++ b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/adaptive_slots.rs @@ -2,25 +2,13 @@ //! No Native inference replay; original paired quality/timing remains separately required. use super::super::combined_changed_boundary_proof::rig::close_context_flags; use super::{ - Arc, AssertUnwindSafe, AtomicBool, AtomicU64, BACKEND_API_VERSION, BASELINE_SHA, Backend, BackendCapabilities, - BackendError, BackendIdentity, Baseline, CAP, CacheCounts, Clock, ContractError, DEVICE_BUDGET, DeferredTail, - Digest, Driver, Duration, ErrorCode, EvaluationMeasurement, EvaluationObserver, ExperimentalConfig, ExpertSource, - FinishReason, GenerationEvent, GenerationRequest, GenerationSink, GenerationStream, GenerationTerminal, - InferenceMode, InheritedKarArchive, InputBindingError, Inputs, KAR_MTP_PROFILE, KarArchiveRef, KarExpertLevels, - KarExpertSource, KarExpertSourceConfig, LOAD_CONFIG_VERSION, LoadedModel, MODEL_DIGEST, MeasurementFailure, - ModelBinding, ModelDescriptor, Mutex, OpenOptions, OpenOptionsExt, Ordering, OriginalServeChoice, - OriginalServeMode, OriginalServeOptions, PathBuf, PrefixCacheOptions, PrefixTail, Proof, Qwen4ExpArtifact, - Qwen35Cuda, Qwen35CudaStart, Rc, Read, Receiver, RecentIds, RuntimeConfig, SHARD0, SHARD1, Sha256, Shared, - SupportedModelTuple, SyncSender, SystemClock, Tokenizer, Usage, Value, VerifiedGgufFile, WindowWitness, Write, - baseline, catch_unwind, env, error, fivecase_runtime, json, metadata, path, request, resume_unwind, save, sha, - thread, token_ids, + AssertUnwindSafe, AtomicBool, BASELINE_SHA, Baseline, CAP, DEVICE_BUDGET, Driver, InheritedKarArchive, Inputs, + KAR_MTP_PROFILE, MODEL_DIGEST, ModelBinding, Mutex, OpenOptions, OpenOptionsExt, PathBuf, Qwen4ExpArtifact, Rc, + Read, SHARD0, SHARD1, Shared, Tokenizer, Value, VerifiedGgufFile, baseline, catch_unwind, env, fivecase_runtime, + json, metadata, path, request, resume_unwind, save, sha, token_ids, }; #[cfg(feature = "preview-path")] -use super::{ - DenseWeightCache, Dimension, InputConstants, Instant, KarPleCache, MoeWeightCache, MtpDecoder, MtpWindowError, - MtpWindowSpec, OutputStage, Position, QwenForward, QwenSession, ResidentConversations, ResidentPolicy, - TargetStepProduct, TokenId, -}; +use super::{DenseWeightCache, Instant, KarPleCache, MoeWeightCache, OutputStage}; use leleka_model_format::qwen4exp::{ProvisionalExpertSource, ResidentExpertSourceReport}; use std::path::Path; diff --git a/crates/engine-qwen35-cuda/src/backend/native_down_public_pair.rs b/crates/engine-qwen35-cuda/src/backend/native_down_public_pair.rs index 7bb955cc..94be2c58 100644 --- a/crates/engine-qwen35-cuda/src/backend/native_down_public_pair.rs +++ b/crates/engine-qwen35-cuda/src/backend/native_down_public_pair.rs @@ -1,23 +1,13 @@ //! One-load private PUBLIC generation pair; actual owner timings, never HTTP timings. use super::{ - Arc, AtomicBool, AtomicU64, BACKEND_API_VERSION, Backend, BackendCapabilities, BackendError, BackendIdentity, - CacheCounts, Clock, ContractError, DeferredTail, Digest, Driver, Duration, ErrorCode, EvaluationExecution, - EvaluationMeasurement, EvaluationObserver, ExperimentalConfig, ExpertSource, FRAME_LIMIT, FinishReason, Generation, - GenerationEvent, GenerationFailure, GenerationRequest, GenerationSink, GenerationStream, GenerationTerminal, - InferenceMode, InheritedKarArchive, InputBindingError, KAR_MTP_PROFILE, KarArchiveRef, KarExpertLevels, - KarExpertSource, KarExpertSourceConfig, LOAD_CONFIG_VERSION, LoadedModel, MODEL_DIGEST, MeasurementFailure, - ModelBinding, ModelDescriptor, MtpContinuation, Mutex, Ordering, OriginalServeChoice, OriginalServeMode, - OriginalServeOptions, PathBuf, PrefixCacheOptions, PrefixTail, QUEUE, Qwen4ExpArtifact, Qwen35Cuda, - Qwen35CudaStart, Rc, Receiver, RecentIds, RuntimeConfig, SHARD0, SHARD1, Sha256, Shared, SupportedModelTuple, - SyncSender, SystemClock, Tokenizer, Usage, VerifiedGgufFile, WindowWitness, emit_terminal, error, - generate_mtp_resume, load, measurement, owner, request, spawn, thread, + AtomicBool, CacheCounts, Digest, Driver, Duration, EvaluationExecution, EvaluationMeasurement, FRAME_LIMIT, + FinishReason, Generation, GenerationEvent, GenerationFailure, GenerationRequest, GenerationSink, GenerationStream, + GenerationTerminal, InheritedKarArchive, KAR_MTP_PROFILE, MODEL_DIGEST, ModelBinding, MtpContinuation, Mutex, + Ordering, PathBuf, QUEUE, Qwen4ExpArtifact, Rc, SHARD0, SHARD1, Sha256, Shared, SystemClock, Tokenizer, Usage, + VerifiedGgufFile, WindowWitness, emit_terminal, generate_mtp_resume, measurement, request, thread, }; #[cfg(feature = "preview-path")] -use super::{ - DenseWeightCache, Dimension, InputConstants, Instant, KarPleCache, MoeWeightCache, MtpDecoder, MtpWindowError, - MtpWindowSpec, OutputStage, Position, QwenForward, QwenSession, ResidentConversations, ResidentPolicy, - TargetStepProduct, TokenId, session, -}; +use super::{DenseWeightCache, KarPleCache, MoeWeightCache, OutputStage, QwenSession}; #[cfg(test)] use super::prepare_prompt; use serde_json::{Value, json}; diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve.rs b/crates/engine-qwen35-cuda/src/backend/original_serve.rs index 11748ae4..e3b2cd26 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve.rs @@ -134,17 +134,10 @@ pub(super) mod runner; mod tests; mod original_serve_mode; -#[allow(unused_imports)] pub(super) use original_serve_mode::choose; -#[allow(unused_imports)] pub(super) use original_serve_mode::context_fits; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -#[allow(unused_imports)] pub(super) use original_serve_mode::current_unsealed; #[cfg(not(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64")))] -#[allow(unused_imports)] pub(super) use original_serve_mode::current_unsealed; -#[allow(unused_imports)] -use original_serve_mode::ineligible; -#[allow(unused_imports)] pub(super) use original_serve_mode::published_prefix_summary; diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve/runner.rs b/crates/engine-qwen35-cuda/src/backend/original_serve/runner.rs index 5d67cd7c..0b4a6c61 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve/runner.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve/runner.rs @@ -94,43 +94,27 @@ mod capture_tests { } mod stack_config_and_reports; -#[allow(unused_imports)] use stack_config_and_reports::CapturedIds; -#[allow(unused_imports)] use stack_config_and_reports::PhaseDurations; -#[allow(unused_imports)] use stack_config_and_reports::admission_error; -#[allow(unused_imports)] use stack_config_and_reports::capture_request; -#[allow(unused_imports)] use stack_config_and_reports::gpu_probe; -#[allow(unused_imports)] use stack_config_and_reports::log_request_end; -#[allow(unused_imports)] use stack_config_and_reports::meta_facts; -#[allow(unused_imports)] use stack_config_and_reports::open_error; -#[allow(unused_imports)] use stack_config_and_reports::publish_prefix_summary; -#[allow(unused_imports)] use stack_config_and_reports::stack_config; mod request_generation; -#[allow(unused_imports)] pub(in super::super) use request_generation::generate; -#[allow(unused_imports)] pub(in super::super) use request_generation::{ClientLink, RequestToServe, TokenVocabulary}; mod owner_run_steps; -#[allow(unused_imports)] use owner_run_steps::{ GenerateEnv, RecordedModel, abandon_stack, close_context, close_stack, open_run_stack, publish_open, serve_generate, sweep_idle, }; mod command_loop; -#[allow(unused_imports)] use command_loop::{LoopCtx, announce, answer_unload, command_loop}; mod reconfigure_command; -#[allow(unused_imports)] use reconfigure_command::{Live, ReopenEnv, reconfigure}; mod owner_run; -#[allow(unused_imports)] pub(in super::super) use owner_run::run; diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve/runner/owner_run_steps.rs b/crates/engine-qwen35-cuda/src/backend/original_serve/runner/owner_run_steps.rs index 1bb36299..f740d369 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve/runner/owner_run_steps.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve/runner/owner_run_steps.rs @@ -2,14 +2,11 @@ //! sweep idle sessions and close everything; early exits stay in `run`. use super::{ - ActiveGuard, Admission, AtomicBool, BackendError, CapturedIds, ClientLink, Clock, Command, DeferredTail, Duration, - ErrorCode, FinishReason, ForwardError, GENERATION_TIMEOUT, GenerationEvent, GenerationFailure, GenerationRequest, - GenerationSink, GenerationTerminal, IdleSweep, Live, LoadPhase, LoadedModel, LoopCtx, ModelBinding, Ordering, - OriginalServeOptions, OriginalServeStack, PREFIX_SUMMARY, PathBuf, PhaseDurations, PrefixTail, QUEUE, Rc, Receiver, - ReopenEnv, Reply, RequestToServe, ServeDevice, ServeError, ServeFailure, ServeRequest, ServeStop, Shared, - StackConfig, SystemClock, TokenVocabulary, Tokenizer, Usage, Utf8Pending, context_fits, emit_terminal, exhausted, - generate, invalid, load_failure, meta_facts, open_error, prepare_prompt, publish_prefix_summary, stack_config, - unavailable, + QUEUE, ActiveGuard, AtomicBool, BackendError, ClientLink, DeferredTail, ErrorCode, GenerationFailure, + GenerationRequest, GenerationSink, GenerationTerminal, IdleSweep, LoadedModel, LoadPhase, ModelBinding, Ordering, + OriginalServeOptions, OriginalServeStack, PathBuf, Rc, Reply, RequestToServe, Shared, SystemClock, Tokenizer, + TokenVocabulary, context_fits, emit_terminal, exhausted, generate, invalid, load_failure, meta_facts, open_error, + prepare_prompt, publish_prefix_summary, stack_config, unavailable, }; use leleka_backend_api::GenerationStream; use leleka_cuda_driver::Context; diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_laptop.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_laptop.rs index 2fc42d56..3b521e32 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_laptop.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_laptop.rs @@ -27,23 +27,7 @@ //! //! Run: `cargo test -p leleka-engine-qwen35-cuda --features cuda-driver[,sm86] --release -- --ignored --nocapture //! original_serve_laptop_bench`. -use super::{ - Arc, AtomicBool, AtomicU64, BACKEND_API_VERSION, Backend, BackendCapabilities, BackendError, BackendIdentity, - CacheCounts, Clock, ContractError, DeferredTail, Digest, Driver, Duration, ErrorCode, EvaluationMeasurement, - EvaluationObserver, ExperimentalConfig, ExpertSource, FinishReason, GenerationEvent, GenerationRequest, - GenerationSink, GenerationStream, GenerationTerminal, InferenceMode, InheritedKarArchive, InputBindingError, - KarArchiveRef, KarExpertLevels, KarExpertSource, KarExpertSourceConfig, LOAD_CONFIG_VERSION, LoadedModel, - MeasurementFailure, ModelBinding, ModelDescriptor, Mutex, Ordering, OriginalServeChoice, OriginalServeMode, - OriginalServeOptions, PathBuf, PrefixCacheOptions, PrefixTail, Qwen4ExpArtifact, Qwen35Cuda, Qwen35CudaStart, Rc, - Receiver, RecentIds, RuntimeConfig, SHARD0, SHARD1, Sha256, SupportedModelTuple, SyncSender, SystemClock, - Tokenizer, Usage, VerifiedGgufFile, WindowWitness, config, load, request, -}; -#[cfg(feature = "preview-path")] -use super::{ - DenseWeightCache, Dimension, InputConstants, Instant, KarPleCache, MoeWeightCache, MtpDecoder, MtpWindowError, - MtpWindowSpec, OutputStage, Position, QwenForward, QwenSession, ResidentConversations, ResidentPolicy, - TargetStepProduct, TokenId, -}; +use super::{Driver, InheritedKarArchive, ModelBinding, PathBuf, Qwen4ExpArtifact, Rc, SHARD0, SHARD1, VerifiedGgufFile}; use crate::qwen_forward::{ original_serve_engine::ServeOutcome, original_serve_request::{ServeError, ServeRequest}, diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_laptop/soak.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_laptop/soak.rs index 6fe1fdf3..50bf5b10 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_laptop/soak.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_laptop/soak.rs @@ -1,22 +1,5 @@ //! The serving passes of the laptop bench: the sequence, the soak limits and the per-request reports. -use super::{ - Arc, AtomicBool, AtomicU64, BACKEND_API_VERSION, Backend, BackendCapabilities, BackendError, BackendIdentity, - CacheCounts, Clock, ContractError, DeferredTail, Digest, Driver, Duration, ErrorCode, EvaluationMeasurement, - EvaluationObserver, ExperimentalConfig, ExpertSource, FinishReason, GenerationEvent, GenerationRequest, - GenerationSink, GenerationStream, GenerationTerminal, InferenceMode, InheritedKarArchive, InputBindingError, - KarArchiveRef, KarExpertLevels, KarExpertSource, KarExpertSourceConfig, LOAD_CONFIG_VERSION, LoadedModel, - MeasurementFailure, ModelBinding, ModelDescriptor, Mutex, Ordering, OriginalServeChoice, OriginalServeMode, - OriginalServeOptions, OriginalServeStack, PathBuf, Plan, PrefixCacheOptions, PrefixTail, Qwen4ExpArtifact, - Qwen35Cuda, Qwen35CudaStart, Rc, Receiver, RecentIds, RuntimeConfig, ServeError, ServeOutcome, ServeRequest, - Sha256, StackConfig, SupportedModelTuple, SyncSender, SystemClock, Tokenizer, Usage, VerifiedGgufFile, - WindowWitness, elapsed, env, laptop_request, memory_line, request, soak, -}; -#[cfg(feature = "preview-path")] -use super::{ - DenseWeightCache, Dimension, InputConstants, Instant, KarPleCache, MoeWeightCache, MtpDecoder, MtpWindowError, - MtpWindowSpec, OutputStage, Position, QwenForward, QwenSession, ResidentConversations, ResidentPolicy, - TargetStepProduct, TokenId, -}; +use super::{OriginalServeStack, Plan, ServeError, ServeOutcome, ServeRequest, env, laptop_request, memory_line}; /// The serving sequence and the soak limits. pub(super) struct Soak { diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke.rs index 6c37b5c1..e4077511 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke.rs @@ -24,21 +24,8 @@ //! Output lines: `MEM-REPORT ` (the governor's full report), `MEM-CENSUS `, `MEM-SOAK ...`, `MEM-SHED //! ...`, `MEM-RESULT`. use super::{ - Arc, AtomicBool, AtomicU64, BACKEND_API_VERSION, Backend, BackendCapabilities, BackendError, BackendIdentity, - CacheCounts, Clock, ContractError, DeferredTail, Digest, Driver, Duration, ErrorCode, EvaluationMeasurement, - EvaluationObserver, ExperimentalConfig, ExpertSource, FinishReason, GenerationEvent, GenerationRequest, - GenerationSink, GenerationStream, GenerationTerminal, InferenceMode, InheritedKarArchive, InputBindingError, - KarArchiveRef, KarExpertLevels, KarExpertSource, KarExpertSourceConfig, LOAD_CONFIG_VERSION, LoadedModel, - MeasurementFailure, ModelBinding, ModelDescriptor, Mutex, Ordering, OriginalServeChoice, OriginalServeMode, - OriginalServeOptions, PathBuf, PrefixCacheOptions, PrefixTail, Qwen4ExpArtifact, Qwen35Cuda, Qwen35CudaStart, Rc, - Receiver, RecentIds, RuntimeConfig, SHARD0, SHARD1, Sha256, SupportedModelTuple, SyncSender, SystemClock, - Tokenizer, Usage, VerifiedGgufFile, WindowWitness, config, probes, spawn, thread, -}; -#[cfg(feature = "preview-path")] -use super::{ - DenseWeightCache, Dimension, InputConstants, Instant, KarPleCache, MoeWeightCache, MtpDecoder, MtpWindowError, - MtpWindowSpec, OutputStage, Position, QwenForward, QwenSession, ResidentConversations, ResidentPolicy, - TargetStepProduct, TokenId, session, + Driver, InheritedKarArchive, ModelBinding, PathBuf, Qwen4ExpArtifact, Rc, SHARD0, SHARD1, Tokenizer, + VerifiedGgufFile, }; use crate::qwen_forward::original_serve_stack::dbg_el; use crate::qwen_forward::{ diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/inventory.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/inventory.rs index ff162c1e..d6862d4e 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/inventory.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/inventory.rs @@ -1,24 +1,6 @@ //! The inventory scenario: the allocation inventory and the load ledger at idle, after a long request and with the //! prefix cache full. -use super::{ - Admission, Arc, AtomicBool, AtomicU64, BACKEND_API_VERSION, Backend, BackendCapabilities, BackendError, - BackendIdentity, CacheCounts, Census, Clock, ContractError, DeferredTail, Digest, Driver, Duration, ErrorCode, - EvaluationMeasurement, EvaluationObserver, ExperimentalConfig, ExpertSource, FinishReason, GenerationEvent, - GenerationRequest, GenerationSink, GenerationStream, GenerationTerminal, Governor, HostProc, InferenceMode, - InheritedKarArchive, InputBindingError, KarArchiveRef, KarExpertLevels, KarExpertSource, KarExpertSourceConfig, - LOAD_CONFIG_VERSION, Level, LoadedModel, MeasurementFailure, Mem, ModelBinding, ModelDescriptor, Mutex, Ordering, - OriginalServeChoice, OriginalServeMode, OriginalServeOptions, OriginalServeStack, PathBuf, PrefixBudget, - PrefixCacheOptions, PrefixConfig, PrefixTail, Qwen4ExpArtifact, Qwen35Cuda, Qwen35CudaStart, Rc, Receiver, - RecentIds, RequestShape, RuntimeConfig, ServeError, ServeRequest, Sha256, StackConfig, SupportedModelTuple, - SyncSender, SystemClock, Tokenizer, Tolerances, Usage, VerifiedGgufFile, WindowWitness, guard, inventory, list, - number, print_report, -}; -#[cfg(feature = "preview-path")] -use super::{ - DenseWeightCache, Dimension, InputConstants, Instant, KarPleCache, MoeWeightCache, MtpDecoder, MtpWindowError, - MtpWindowSpec, OutputStage, Position, QwenForward, QwenSession, ResidentConversations, ResidentPolicy, - TargetStepProduct, TokenId, -}; +use super::{Mem, list, number, print_report}; /// The number after `key` in a prefix metrics line. fn metric(line: &str, key: &str) -> Option { diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_prefix_smoke.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_prefix_smoke.rs index c706a7de..5203f790 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_prefix_smoke.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_prefix_smoke.rs @@ -34,21 +34,8 @@ //! Run: `cargo test -p leleka-engine-qwen35-cuda -- --ignored --exact //! backend::original_serve_prefix_smoke::original_serve_prefix_cache_smoke`. use super::{ - Arc, AtomicBool, AtomicU64, BACKEND_API_VERSION, Backend, BackendCapabilities, BackendError, BackendIdentity, - CacheCounts, Clock, ContractError, DeferredTail, Digest, Driver, Duration, ErrorCode, EvaluationMeasurement, - EvaluationObserver, ExperimentalConfig, ExpertSource, FinishReason, GenerationEvent, GenerationRequest, - GenerationSink, GenerationStream, GenerationTerminal, InferenceMode, InheritedKarArchive, InputBindingError, - KarArchiveRef, KarExpertLevels, KarExpertSource, KarExpertSourceConfig, LOAD_CONFIG_VERSION, LoadedModel, - MeasurementFailure, ModelBinding, ModelDescriptor, Mutex, Ordering, OriginalServeChoice, OriginalServeMode, - OriginalServeOptions, PathBuf, PrefixCacheOptions, PrefixTail, Qwen4ExpArtifact, Qwen35Cuda, Qwen35CudaStart, Rc, - Receiver, RecentIds, RuntimeConfig, SHARD0, SHARD1, Sha256, SupportedModelTuple, SyncSender, SystemClock, - Tokenizer, Usage, VerifiedGgufFile, WindowWitness, config, probes, request, -}; -#[cfg(feature = "preview-path")] -use super::{ - DenseWeightCache, Dimension, InputConstants, Instant, KarPleCache, MoeWeightCache, MtpDecoder, MtpWindowError, - MtpWindowSpec, OutputStage, Position, QwenForward, QwenSession, ResidentConversations, ResidentPolicy, - TargetStepProduct, TokenId, session, + Driver, InheritedKarArchive, ModelBinding, PathBuf, Qwen4ExpArtifact, Rc, SHARD0, SHARD1, Tokenizer, + VerifiedGgufFile, }; use crate::qwen_forward::original_serve_stack::dbg_el; use crate::qwen_forward::{ diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_prefix_smoke/workload.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_prefix_smoke/workload.rs index 52fc8ff5..37033324 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_prefix_smoke/workload.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_prefix_smoke/workload.rs @@ -1,22 +1,5 @@ //! The knobs and the scripted workload of the prefix-cache smoke (identical for every mode). -use super::{ - Arc, AtomicBool, AtomicU64, BACKEND_API_VERSION, Backend, BackendCapabilities, BackendError, BackendIdentity, - CacheCounts, Clock, ContractError, DeferredTail, Digest, Driver, Duration, ErrorCode, EvaluationMeasurement, - EvaluationObserver, ExperimentalConfig, ExpertSource, FinishReason, GenerationEvent, GenerationRequest, - GenerationSink, GenerationStream, GenerationTerminal, InferenceMode, InheritedKarArchive, InputBindingError, - KarArchiveRef, KarExpertLevels, KarExpertSource, KarExpertSourceConfig, LOAD_CONFIG_VERSION, LoadedModel, - MeasurementFailure, ModelBinding, ModelDescriptor, Mutex, Ordering, OriginalServeChoice, OriginalServeMode, - OriginalServeOptions, OriginalServeStack, PathBuf, PrefixBudget, PrefixCacheOptions, PrefixConfig, PrefixTail, - Qwen4ExpArtifact, Qwen35Cuda, Qwen35CudaStart, Rc, Receiver, RecentIds, Rng, RuntimeConfig, ServeError, - ServeRequest, Session, Sha256, StackConfig, SupportedModelTuple, SyncSender, SystemClock, Tokenizer, Usage, - VerifiedGgufFile, WindowWitness, env, filler, number, text, -}; -#[cfg(feature = "preview-path")] -use super::{ - DenseWeightCache, Dimension, InputConstants, Instant, KarPleCache, MoeWeightCache, MtpDecoder, MtpWindowError, - MtpWindowSpec, OutputStage, Position, QwenForward, QwenSession, ResidentConversations, ResidentPolicy, - TargetStepProduct, TokenId, -}; +use super::{Rng, Session, Tokenizer, env, filler, number, text}; /// What the operator asked for. pub(super) struct Plan { diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_replay.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_replay.rs index d677b729..42ab06d4 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_replay.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_replay.rs @@ -30,23 +30,7 @@ //! //! Run (inside a holder job): ` --ignored --nocapture original_serve_replay_smoke`. use super::super::qwen_forward::original_serve_stack::dbg_el; -use super::{ - Arc, AtomicBool, AtomicU64, BACKEND_API_VERSION, Backend, BackendCapabilities, BackendError, BackendIdentity, - CacheCounts, Clock, ContractError, DeferredTail, Digest, Driver, Duration, ErrorCode, EvaluationMeasurement, - EvaluationObserver, ExperimentalConfig, ExpertSource, FinishReason, GenerationEvent, GenerationRequest, - GenerationSink, GenerationStream, GenerationTerminal, InferenceMode, InheritedKarArchive, InputBindingError, - KarArchiveRef, KarExpertLevels, KarExpertSource, KarExpertSourceConfig, LOAD_CONFIG_VERSION, LoadedModel, - MeasurementFailure, ModelBinding, ModelDescriptor, Mutex, Ordering, OriginalServeChoice, OriginalServeMode, - OriginalServeOptions, PathBuf, PrefixCacheOptions, PrefixTail, Qwen4ExpArtifact, Qwen35Cuda, Qwen35CudaStart, Rc, - Receiver, RecentIds, Reply, RuntimeConfig, SHARD0, SHARD1, Sha256, SupportedModelTuple, SyncSender, SystemClock, - Tokenizer, Usage, VerifiedGgufFile, WindowWitness, config, request, -}; -#[cfg(feature = "preview-path")] -use super::{ - DenseWeightCache, Dimension, InputConstants, Instant, KarPleCache, MoeWeightCache, MtpDecoder, MtpWindowError, - MtpWindowSpec, OutputStage, Position, QwenForward, QwenSession, ResidentConversations, ResidentPolicy, - TargetStepProduct, TokenId, -}; +use super::{Driver, InheritedKarArchive, ModelBinding, PathBuf, Qwen4ExpArtifact, Rc, SHARD0, SHARD1, VerifiedGgufFile}; use crate::qwen_forward::{ original_serve_request::{ServeError, ServeRequest}, original_serve_stack::{OriginalServeStack, PrefixBudget, PrefixConfig, StackConfig}, @@ -65,5 +49,4 @@ fn original_serve_replay_smoke() { } mod required_path; -#[allow(unused_imports)] use required_path::required_path; diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_replay/load.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_replay/load.rs index 7bb3f6a1..3a09f647 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_replay/load.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_replay/load.rs @@ -1,21 +1,6 @@ //! The captured requests and the pinned model of the replay. use super::{ - Arc, AtomicBool, AtomicU64, BACKEND_API_VERSION, Backend, BackendCapabilities, BackendError, BackendIdentity, - CacheCounts, Clock, ContractError, DeferredTail, Digest, Driver, Duration, ErrorCode, EvaluationMeasurement, - EvaluationObserver, ExperimentalConfig, ExpertSource, FinishReason, GenerationEvent, GenerationRequest, - GenerationSink, GenerationStream, GenerationTerminal, InferenceMode, InheritedKarArchive, InputBindingError, - KarArchiveRef, KarExpertLevels, KarExpertSource, KarExpertSourceConfig, LOAD_CONFIG_VERSION, LoadedModel, - MeasurementFailure, ModelBinding, ModelDescriptor, Mutex, Ordering, OriginalServeChoice, OriginalServeMode, - OriginalServeOptions, OriginalServeStack, PathBuf, PrefixBudget, PrefixCacheOptions, PrefixConfig, PrefixTail, - Qwen4ExpArtifact, Qwen35Cuda, Qwen35CudaStart, Rc, Receiver, RecentIds, RuntimeConfig, SHARD0, SHARD1, ServeError, - ServeRequest, Sha256, StackConfig, SupportedModelTuple, SyncSender, SystemClock, Tokenizer, Usage, - VerifiedGgufFile, WindowWitness, env, required_path, -}; -#[cfg(feature = "preview-path")] -use super::{ - DenseWeightCache, Dimension, InputConstants, Instant, KarPleCache, MoeWeightCache, MtpDecoder, MtpWindowError, - MtpWindowSpec, OutputStage, Position, QwenForward, QwenSession, ResidentConversations, ResidentPolicy, - TargetStepProduct, TokenId, + InheritedKarArchive, ModelBinding, PathBuf, Qwen4ExpArtifact, SHARD0, SHARD1, VerifiedGgufFile, env, required_path, }; pub(super) fn number(name: &str, default: usize) -> usize { diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_replay/pass.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_replay/pass.rs index a5cc8693..f18a2d10 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_replay/pass.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_replay/pass.rs @@ -1,24 +1,7 @@ //! One pass of an arm over the captured requests: every recorded prompt served greedily with the recorded output //! length as the budget, and what it printed. use super::load::number; -use super::{ - Arc, AtomicBool, AtomicU64, BACKEND_API_VERSION, Backend, BackendCapabilities, BackendError, BackendIdentity, - CacheCounts, Clock, ContractError, DeferredTail, Digest, Driver, ErrorCode, EvaluationMeasurement, - EvaluationObserver, ExperimentalConfig, ExpertSource, FinishReason, GenerationEvent, GenerationRequest, - GenerationSink, GenerationStream, GenerationTerminal, InferenceMode, InheritedKarArchive, InputBindingError, - KarArchiveRef, KarExpertLevels, KarExpertSource, KarExpertSourceConfig, LOAD_CONFIG_VERSION, LoadedModel, - MeasurementFailure, ModelBinding, ModelDescriptor, Mutex, Ordering, OriginalServeChoice, OriginalServeMode, - OriginalServeOptions, OriginalServeStack, PathBuf, PrefixBudget, PrefixCacheOptions, PrefixConfig, PrefixTail, - Qwen4ExpArtifact, Qwen35Cuda, Qwen35CudaStart, Rc, Receiver, RecentIds, RuntimeConfig, ServeError, ServeRequest, - Sha256, StackConfig, SupportedModelTuple, SyncSender, SystemClock, Tokenizer, Usage, VerifiedGgufFile, - WindowWitness, env, load, pass, request, -}; -#[cfg(feature = "preview-path")] -use super::{ - DenseWeightCache, Dimension, InputConstants, Instant, KarPleCache, MoeWeightCache, MtpDecoder, MtpWindowError, - MtpWindowSpec, OutputStage, Position, QwenForward, QwenSession, ResidentConversations, ResidentPolicy, - TargetStepProduct, TokenId, -}; +use super::{OriginalServeStack, PathBuf, ServeError, ServeRequest, env}; use crate::qwen_forward::original_serve_engine::ServeOutcome; use std::time::Duration; diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_replay/required_path.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_replay/required_path.rs index cec55230..77c86354 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_replay/required_path.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_replay/required_path.rs @@ -1,24 +1,7 @@ //! Functions: `required_path`. //! Split out of `original_serve_replay` to keep its files under the line limit. -use super::{ - Arc, AtomicBool, AtomicU64, BACKEND_API_VERSION, Backend, BackendCapabilities, BackendError, BackendIdentity, - CacheCounts, Clock, ContractError, DeferredTail, Digest, Driver, Duration, ErrorCode, EvaluationMeasurement, - EvaluationObserver, ExperimentalConfig, ExpertSource, FinishReason, GenerationEvent, GenerationRequest, - GenerationSink, GenerationStream, GenerationTerminal, InferenceMode, InheritedKarArchive, InputBindingError, - KarArchiveRef, KarExpertLevels, KarExpertSource, KarExpertSourceConfig, LOAD_CONFIG_VERSION, LoadedModel, - MeasurementFailure, ModelBinding, ModelDescriptor, Mutex, Ordering, OriginalServeChoice, OriginalServeMode, - OriginalServeOptions, OriginalServeStack, PathBuf, PrefixBudget, PrefixCacheOptions, PrefixConfig, PrefixTail, - Qwen4ExpArtifact, Qwen35Cuda, Qwen35CudaStart, Rc, Receiver, RecentIds, RuntimeConfig, ServeError, ServeRequest, - Sha256, StackConfig, SupportedModelTuple, SyncSender, SystemClock, Tokenizer, Usage, VerifiedGgufFile, - WindowWitness, env, -}; -#[cfg(feature = "preview-path")] -use super::{ - DenseWeightCache, Dimension, InputConstants, Instant, KarPleCache, MoeWeightCache, MtpDecoder, MtpWindowError, - MtpWindowSpec, OutputStage, Position, QwenForward, QwenSession, ResidentConversations, ResidentPolicy, - TargetStepProduct, TokenId, -}; +use super::{PathBuf, env}; pub(super) fn required_path(name: &str) -> PathBuf { env::var_os(name).map(PathBuf::from).unwrap_or_else(|| panic!("missing operator-owned input {name}")) diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_replay/run.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_replay/run.rs index a5295269..a8fe7d78 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_replay/run.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_replay/run.rs @@ -3,22 +3,7 @@ use super::arm_flags::{self, ArmShape}; use super::load::{self, number}; use super::pass::Replay; use super::{ - Arc, AtomicBool, AtomicU64, BACKEND_API_VERSION, Backend, BackendCapabilities, BackendError, BackendIdentity, - CacheCounts, Clock, ContractError, DeferredTail, Digest, Driver, Duration, ErrorCode, EvaluationMeasurement, - EvaluationObserver, ExperimentalConfig, ExpertSource, FinishReason, GenerationEvent, GenerationRequest, - GenerationSink, GenerationStream, GenerationTerminal, InferenceMode, InheritedKarArchive, InputBindingError, - KarArchiveRef, KarExpertLevels, KarExpertSource, KarExpertSourceConfig, LOAD_CONFIG_VERSION, LoadedModel, - MeasurementFailure, ModelBinding, ModelDescriptor, Mutex, Ordering, OriginalServeChoice, OriginalServeMode, - OriginalServeOptions, OriginalServeStack, PathBuf, PrefixBudget, PrefixCacheOptions, PrefixConfig, PrefixTail, - Qwen4ExpArtifact, Qwen35Cuda, Qwen35CudaStart, Rc, Receiver, RecentIds, Reply, RuntimeConfig, ServeError, - ServeRequest, Sha256, StackConfig, SupportedModelTuple, SyncSender, SystemClock, Tokenizer, Usage, - VerifiedGgufFile, WindowWitness, config, dbg_el, env, pass, -}; -#[cfg(feature = "preview-path")] -use super::{ - DenseWeightCache, Dimension, InputConstants, Instant, KarPleCache, MoeWeightCache, MtpDecoder, MtpWindowError, - MtpWindowSpec, OutputStage, Position, QwenForward, QwenSession, ResidentConversations, ResidentPolicy, - TargetStepProduct, TokenId, + Driver, ModelBinding, OriginalServeStack, PathBuf, PrefixBudget, PrefixConfig, Rc, StackConfig, dbg_el, env, }; use crate::qwen_forward::original_serve_stack::TailMode; diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_smoke.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_smoke.rs index c46585b2..1db20934 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_smoke.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_smoke.rs @@ -26,24 +26,11 @@ //! with the first missing producer's name; that refusal is the expected result of this smoke until they land. use super::super::qwen_forward::original_serve_stack::dbg_el; use super::{ - Arc, AtomicBool, AtomicU64, BACKEND_API_VERSION, Backend, BackendCapabilities, BackendError, BackendIdentity, - CacheCounts, Clock, ContractError, DeferredTail, Digest, Driver, Duration, ErrorCode, EvaluationMeasurement, - EvaluationObserver, ExperimentalConfig, ExpertSource, FinishReason, GenerationEvent, GenerationRequest, - GenerationSink, GenerationStream, GenerationTerminal, InferenceMode, InheritedKarArchive, InputBindingError, - KarArchiveRef, KarExpertLevels, KarExpertSource, KarExpertSourceConfig, LOAD_CONFIG_VERSION, LoadedModel, - MeasurementFailure, ModelBinding, ModelDescriptor, Mutex, Ordering, OriginalServeChoice, OriginalServeMode, - OriginalServeOptions, PathBuf, PrefixCacheOptions, PrefixTail, Qwen4ExpArtifact, Qwen35Cuda, Qwen35CudaStart, Rc, - Receiver, RecentIds, RuntimeConfig, SHARD0, SHARD1, Sha256, SupportedModelTuple, SyncSender, SystemClock, - Tokenizer, Usage, VerifiedGgufFile, WindowWitness, config, load, original_prompt, probes, + Driver, InheritedKarArchive, ModelBinding, PathBuf, Qwen4ExpArtifact, Rc, SHARD0, SHARD1, Tokenizer, + VerifiedGgufFile, }; #[cfg(all(test, target_arch = "x86_64"))] use super::original_serve_arms; -#[cfg(feature = "preview-path")] -use super::{ - DenseWeightCache, Dimension, InputConstants, Instant, KarPleCache, MoeWeightCache, MtpDecoder, MtpWindowError, - MtpWindowSpec, OutputStage, Position, QwenForward, QwenSession, ResidentConversations, ResidentPolicy, - TargetStepProduct, TokenId, -}; use crate::qwen_forward::{ original_serve_request::{RequestSampling, ServeError, ServeRequest}, original_serve_stack::{OriginalServeStack, StackConfig}, diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_main.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_main.rs index 8c067990..017e513c 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_main.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_main.rs @@ -1,25 +1,11 @@ //! The main smoke: greedy twice across a reset, a sampled request, a cancellation, the optional parity corpus //! and a short prompt on the scalar draft-KV path. use super::{ - Arc, AtomicBool, AtomicU64, BACKEND_API_VERSION, Backend, BackendCapabilities, BackendError, BackendIdentity, - CacheCounts, Clock, ContractError, DeferredTail, Digest, Driver, Duration, ErrorCode, EvaluationMeasurement, - EvaluationObserver, ExperimentalConfig, ExpertSource, FinishReason, GenerationEvent, GenerationRequest, - GenerationSink, GenerationStream, GenerationTerminal, InferenceMode, InheritedKarArchive, InputBindingError, - KarArchiveRef, KarExpertLevels, KarExpertSource, KarExpertSourceConfig, LOAD_CONFIG_VERSION, LoadedModel, - MeasurementFailure, ModelBinding, ModelDescriptor, Mutex, Ordering, OriginalServeChoice, OriginalServeMode, - OriginalServeOptions, OriginalServeStack, PROMPT, PathBuf, PrefixCacheOptions, PrefixTail, Qwen4ExpArtifact, - Qwen35Cuda, Qwen35CudaStart, Rc, Receiver, RecentIds, RuntimeConfig, ServeError, ServeRequest, Sha256, StackConfig, - SupportedModelTuple, SyncSender, SystemClock, Tokenizer, Usage, VerifiedGgufFile, WindowWitness, agent_sampler, - collect, dbg_el, env, env_or, ids, open_pinned, open_stack, optin, report_timing, request, with_context, + OriginalServeStack, PROMPT, PathBuf, ServeError, ServeRequest, StackConfig, Tokenizer, agent_sampler, collect, + dbg_el, env, env_or, open_pinned, open_stack, optin, report_timing, request, with_context, }; #[cfg(all(test, target_arch = "x86_64"))] use super::original_serve_arms; -#[cfg(feature = "preview-path")] -use super::{ - DenseWeightCache, Dimension, InputConstants, Instant, KarPleCache, MoeWeightCache, MtpDecoder, MtpWindowError, - MtpWindowSpec, OutputStage, Position, QwenForward, QwenSession, ResidentConversations, ResidentPolicy, - TargetStepProduct, TokenId, -}; mod corpus; diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_ttft.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_ttft.rs index d901c80a..cd760f86 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_ttft.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_ttft.rs @@ -11,23 +11,7 @@ //! Inputs: those of the replay (`LELEKA_ORIGINAL_SERVE_REPLAY=yes`, model, expert tier, `LELEKA_REPLAY_CAPACITY`, //! `LELEKA_REPLAY_PREFIX_MIB`, `LELEKA_ORIGINAL_SERVE_RT_DIR`), `LELEKA_SWEEP_MAX_NEW` (4). use super::super::qwen_forward::original_serve_stack::dbg_el; -use super::{ - Arc, AtomicBool, AtomicU64, BACKEND_API_VERSION, Backend, BackendCapabilities, BackendError, BackendIdentity, - CacheCounts, Clock, ContractError, DeferredTail, Digest, Driver, Duration, ErrorCode, EvaluationMeasurement, - EvaluationObserver, ExperimentalConfig, ExpertSource, FinishReason, GenerationEvent, GenerationRequest, - GenerationSink, GenerationStream, GenerationTerminal, InferenceMode, InheritedKarArchive, InputBindingError, - KarArchiveRef, KarExpertLevels, KarExpertSource, KarExpertSourceConfig, LOAD_CONFIG_VERSION, LoadedModel, - MeasurementFailure, ModelBinding, ModelDescriptor, Mutex, Ordering, OriginalServeChoice, OriginalServeMode, - OriginalServeOptions, PathBuf, PrefixCacheOptions, PrefixTail, Qwen4ExpArtifact, Qwen35Cuda, Qwen35CudaStart, Rc, - Receiver, RecentIds, RuntimeConfig, SHARD0, SHARD1, Sha256, SupportedModelTuple, SyncSender, SystemClock, - Tokenizer, Usage, VerifiedGgufFile, WindowWitness, config, load, -}; -#[cfg(feature = "preview-path")] -use super::{ - DenseWeightCache, Dimension, InputConstants, Instant, KarPleCache, MoeWeightCache, MtpDecoder, MtpWindowError, - MtpWindowSpec, OutputStage, Position, QwenForward, QwenSession, ResidentConversations, ResidentPolicy, - TargetStepProduct, TokenId, -}; +use super::{Driver, InheritedKarArchive, ModelBinding, PathBuf, Qwen4ExpArtifact, Rc, SHARD0, SHARD1, VerifiedGgufFile}; use crate::qwen_forward::{ original_serve_request::ServeRequest, original_serve_stack::{OriginalServeStack, PrefixBudget, PrefixConfig, StackConfig}, diff --git a/crates/engine-qwen35-cuda/src/conversation/memory.rs b/crates/engine-qwen35-cuda/src/conversation/memory.rs index cf3c5e0e..d56a4d7a 100644 --- a/crates/engine-qwen35-cuda/src/conversation/memory.rs +++ b/crates/engine-qwen35-cuda/src/conversation/memory.rs @@ -5,7 +5,6 @@ //! every ambiguity (malformed, duplicated, wrongly-united, I/O failure) //! reads as unknown so admission fails closed. -use std::io::BufRead; pub use leleka_engine_core::memory::{mem_available, memory_admit}; diff --git a/crates/engine-qwen35-cuda/src/conversation/mod.rs b/crates/engine-qwen35-cuda/src/conversation/mod.rs index d87df263..297daaaa 100644 --- a/crates/engine-qwen35-cuda/src/conversation/mod.rs +++ b/crates/engine-qwen35-cuda/src/conversation/mod.rs @@ -4,8 +4,6 @@ //! The pure policy modules live in `leleka-engine-core::conversation` and are re-exported here under their old paths; //! the CUDA-owner bindings live next to the session owners. -#[cfg(test)] -pub(crate) use leleka_engine_core::conversation::testing; pub use leleka_engine_core::conversation::{ binding, buffer, cache, checked, kv, manager, model, retention, snapshot, state, }; diff --git a/crates/engine-qwen35-cuda/src/memory_governor/page_cache.rs b/crates/engine-qwen35-cuda/src/memory_governor/page_cache.rs index bbe73443..02f599a6 100644 --- a/crates/engine-qwen35-cuda/src/memory_governor/page_cache.rs +++ b/crates/engine-qwen35-cuda/src/memory_governor/page_cache.rs @@ -1,9 +1,6 @@ //! Page-cache release after the load (`drop_file_cache`), moved out of `memory_governor` by STRA-338 (size). -use super::{ - BackendError, CacheWish, DeviceSample, Entry, EnvSource, FixedItem, Governor, GovernorConfig, HostFacts, HostProc, - KarForm, Mutex, OpenStage, PlanInput, SamplerGuard, Settings, Space, VramFacts, When, -}; +use super::{Governor, HostFacts, HostProc}; /// Give back the page cache the load created: the shards were read once to verify and to copy the resident bank, and /// nothing reads those pages again (the bank is a RAM copy). Left in place they are the cache pressure that pushed the diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input.rs index 944971c6..ed680078 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input.rs @@ -147,12 +147,6 @@ pub(crate) use native_output::NativeOutputRole; mod binding_identity_and_input_binding_error; mod model_binding; -#[allow(unused_imports)] -use model_binding::bind_expert_counts; mod validate_ple_descriptor; -#[allow(unused_imports)] -use validate_ple_descriptor::bind_layer; -#[allow(unused_imports)] use validate_ple_descriptor::bind_layers; -#[allow(unused_imports)] use validate_ple_descriptor::validate_ple_descriptor; diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/moe_expert.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/moe_expert.rs index 8850b1e8..a4896dcf 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/moe_expert.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/moe_expert.rs @@ -150,22 +150,16 @@ pub(crate) struct MoeRoutedSourceScope<'source, 'group> { } mod moe_expert_weights; -#[allow(unused_imports)] use moe_expert_weights::descriptor; -#[allow(unused_imports)] use moe_expert_weights::index; -#[allow(unused_imports)] +#[cfg(test)] use moe_expert_weights::matrix_kind; -#[allow(unused_imports)] use moe_expert_weights::validate_range; -#[allow(unused_imports)] use moe_expert_weights::validate_selected; mod model_binding; mod routed_source_descriptor; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -#[allow(unused_imports)] use routed_source_descriptor::routed_source_descriptor; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -#[allow(unused_imports)] use routed_source_descriptor::routed_source_role; mod moe_routed_source_scope; diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp.rs index dfae1f25..70a0b676 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp.rs @@ -20,71 +20,41 @@ mod backing; mod tests; mod pack_identity; -#[allow(unused_imports)] use pack_identity::descriptor; -#[allow(unused_imports)] pub(super) use pack_identity::pack_identity; -#[allow(unused_imports)] pub(crate) use pack_identity::pinned_dense_bytes; -#[allow(unused_imports)] pub(crate) use pack_identity::rt_dense_name; -#[allow(unused_imports)] pub(crate) use pack_identity::rt_dense_roles; -#[allow(unused_imports)] pub(crate) use pack_identity::rt_dense_shape; mod mtp_weight_reads; -#[allow(unused_imports)] +#[cfg(test)] use mtp_weight_reads::validate_identity; mod read_expert_rows; -#[allow(unused_imports)] -use read_expert_rows::allocate; -#[allow(unused_imports)] +#[cfg(test)] use read_expert_rows::interleave_q2; -#[allow(unused_imports)] use read_expert_rows::read_exact_range; -#[allow(unused_imports)] use read_expert_rows::read_expert_rows; -#[allow(unused_imports)] use read_expert_rows::row_range; -#[allow(unused_imports)] use read_expert_rows::validate_numeric; mod mtp_kind_types; -#[allow(unused_imports)] use mtp_kind_types::Dense; -#[allow(unused_imports)] use mtp_kind_types::Descriptor; -#[allow(unused_imports)] pub(crate) use mtp_kind_types::MtpExpertMatrix; -#[allow(unused_imports)] pub(crate) use mtp_kind_types::MtpExpertRef; -#[allow(unused_imports)] pub(crate) use mtp_kind_types::MtpKind; -#[allow(unused_imports)] pub(crate) use mtp_kind_types::MtpRole; mod descriptors_types; -#[allow(unused_imports)] use descriptors_types::DESCRIPTORS; mod dense_bytes_types; -#[allow(unused_imports)] use dense_bytes_types::DENSE_BYTES; -#[allow(unused_imports)] use dense_bytes_types::EXPERT_BLOB; -#[allow(unused_imports)] use dense_bytes_types::EXPERT_BYTES; -#[allow(unused_imports)] use dense_bytes_types::FILE_PINS; -#[allow(unused_imports)] use dense_bytes_types::INDEX_BYTES; -#[allow(unused_imports)] use dense_bytes_types::INDEX_LIMIT; -#[allow(unused_imports)] use dense_bytes_types::MAX_READ; -#[allow(unused_imports)] use dense_bytes_types::MAX_ROWS; -#[allow(unused_imports)] use dense_bytes_types::MtpIndex; -#[allow(unused_imports)] pub(crate) use dense_bytes_types::MtpRows; -#[allow(unused_imports)] pub(crate) use dense_bytes_types::MtpWeights; diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/backing.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/backing.rs index 628f694c..8708bb4b 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/backing.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/backing.rs @@ -1,11 +1,9 @@ //! Methods of `OwnedCopy`: `create`, `writer`, `owns_directory`, `owns_file` and 1 more. //! Implements `Drop for OwnedCopy`. Functions: `inode`, `regular`, `root`, `copy_exact` and 8 more. -use super::{ - BindingIdentity, DENSE_BYTES, DESCRIPTORS, Dense, Descriptor, EXPERT_BLOB, EXPERT_BYTES, FILE_PINS, File, - INDEX_BYTES, INDEX_LIMIT, InputBindingError, InputResult, MAX_READ, MAX_ROWS, ModelBinding, MtpExpertMatrix, - MtpExpertRef, MtpIndex, MtpKind, MtpRole, MtpRows, MtpWeights, Path, read_exact_range, read_expert_rows, -}; +use super::{File, InputBindingError, InputResult, Path}; +#[cfg(test)] +use super::{EXPERT_BLOB, MtpExpertMatrix, MtpKind, read_exact_range, read_expert_rows}; use sha2::{Digest, Sha256}; use std::io::Read; use std::os::unix::fs::{DirBuilderExt, MetadataExt, OpenOptionsExt, PermissionsExt}; diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/mtp_weight_reads.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/mtp_weight_reads.rs index fe25a4b9..e356776b 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/mtp_weight_reads.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/mtp_weight_reads.rs @@ -1,10 +1,9 @@ //! The reads of the MTP weights: dense rows, expert rows and the binding identity check. use super::{ - BindingIdentity, DENSE_BYTES, DESCRIPTORS, Dense, Descriptor, EXPERT_BLOB, EXPERT_BYTES, FILE_PINS, File, - INDEX_BYTES, INDEX_LIMIT, InputBindingError, InputResult, MAX_READ, MAX_ROWS, ModelBinding, MtpExpertMatrix, - MtpExpertRef, MtpIndex, MtpKind, MtpRole, MtpRows, MtpWeights, Path, backing, descriptor, read_exact_range, - read_expert_rows, row_range, validate_numeric, + DENSE_BYTES, DESCRIPTORS, EXPERT_BLOB, EXPERT_BYTES, FILE_PINS, INDEX_BYTES, MAX_ROWS, BindingIdentity, + InputBindingError, InputResult, ModelBinding, MtpExpertRef, MtpIndex, MtpKind, MtpRole, MtpRows, MtpWeights, + Path, backing, descriptor, read_exact_range, read_expert_rows, row_range, validate_numeric, }; impl MtpWeights { diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/read_expert_rows.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/read_expert_rows.rs index 74665dbd..bc32d4a8 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/read_expert_rows.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/read_expert_rows.rs @@ -1,11 +1,9 @@ //! Functions: `read_expert_rows`, `read_expert_row`, `row_range`, `allocate` and 3 more. //! Split out of `mtp` to keep its files under the line limit. -use super::{ - BindingIdentity, DENSE_BYTES, DESCRIPTORS, Dense, Descriptor, EXPERT_BLOB, EXPERT_BYTES, FILE_PINS, File, - INDEX_BYTES, INDEX_LIMIT, InputBindingError, InputResult, MAX_READ, MAX_ROWS, ModelBinding, MtpExpertMatrix, - MtpExpertRef, MtpIndex, MtpKind, MtpRole, MtpRows, MtpWeights, Path, backing, -}; +use super::{EXPERT_BLOB, MAX_READ, MAX_ROWS, File, InputBindingError, InputResult, MtpExpertMatrix, MtpKind, MtpRows}; +#[cfg(not(target_os = "linux"))] +use super::backing; pub(super) fn read_expert_rows( experts: &File, diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple.rs index 5d72a7a1..081eea89 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple.rs @@ -123,55 +123,30 @@ mod private_copy; mod inherited_kar_archive; #[cfg(target_os = "linux")] -#[allow(unused_imports)] -use inherited_kar_archive::check_read_only_archive; -#[cfg(target_os = "linux")] -#[allow(unused_imports)] -use inherited_kar_archive::open_read_only_archive; -#[cfg(target_os = "linux")] -#[allow(unused_imports)] use inherited_kar_archive::open_sealed_archive_fd; #[cfg(target_os = "linux")] -#[allow(unused_imports)] use inherited_kar_archive::reopen_read_only_archive; #[cfg(target_os = "linux")] -#[allow(unused_imports)] use inherited_kar_archive::verify_open_provenance; mod load_pinned_inherited_archive; -#[allow(unused_imports)] use load_pinned_inherited_archive::error; -#[allow(unused_imports)] +#[cfg(test)] use load_pinned_inherited_archive::input_diagnostic; -#[allow(unused_imports)] use load_pinned_inherited_archive::input_failure; -#[allow(unused_imports)] +#[cfg(test)] use load_pinned_inherited_archive::kar_diagnostic; -#[allow(unused_imports)] use load_pinned_inherited_archive::kar_failure; #[cfg(target_os = "linux")] -#[allow(unused_imports)] pub(crate) use load_pinned_inherited_archive::load_pinned_inherited_archive; #[cfg(target_os = "windows")] -#[allow(unused_imports)] pub(crate) use load_pinned_inherited_archive::load_pinned_inherited_archive; #[cfg(not(any(target_os = "linux", target_os = "windows")))] -#[allow(unused_imports)] pub(crate) use load_pinned_inherited_archive::load_pinned_inherited_archive; -#[allow(unused_imports)] -use load_pinned_inherited_archive::log_startup_read; mod pinned_profile; #[cfg(target_os = "linux")] -#[allow(unused_imports)] pub(crate) use pinned_profile::load_pinned_archive; #[cfg(not(target_os = "linux"))] -#[allow(unused_imports)] pub(crate) use pinned_profile::load_pinned_archive; -#[allow(unused_imports)] -use pinned_profile::pinned_parts; -#[allow(unused_imports)] pub(crate) use pinned_profile::pinned_profile; -#[allow(unused_imports)] +#[cfg(test)] use pinned_profile::pinned_profile_spec; -#[cfg(target_os = "linux")] -#[allow(unused_imports)] -use pinned_profile::verify_pinned_provenance; diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/inherited_kar_archive.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/inherited_kar_archive.rs index 16ee32f6..a320d75d 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/inherited_kar_archive.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/inherited_kar_archive.rs @@ -2,9 +2,8 @@ //! Functions: `open_sealed_archive_fd`, `open_read_only_archive`, `check_read_only_archive`, `reopen_read_only_archi... use super::{ - ARCHIVE_DIGEST, BindingIdentity, File, InheritedKarArchive, InputBindingError, InputResult, KarError, - KarPlePartProvenance, KarPleProfile, KarPleProfileSpec, PINNED_ARCHIVE_BYTES, PLE_ROWS, PROVENANCE_DIGEST, Path, - PathBuf, RefCell, SparseArchive, VerifiedKarPleArtifact, private_copy, + ARCHIVE_DIGEST, PINNED_ARCHIVE_BYTES, PROVENANCE_DIGEST, File, InheritedKarArchive, InputBindingError, + InputResult, Path, PathBuf, SparseArchive, private_copy, }; use leleka_model_format::weight_source::{BackingKind, FileWeightSource, Verification, WeightIdentity}; diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/inherited_kar_tests.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/inherited_kar_tests.rs index 64bd0485..36892039 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/inherited_kar_tests.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/inherited_kar_tests.rs @@ -1,10 +1,6 @@ //! New real Linux seal/FD gate; tiny metadata fixture, no CUDA/model capability. #![cfg(target_os = "linux")] -use super::{ - BindingIdentity, File, InheritedKarArchive, InputBindingError, InputResult, KarError, KarPlePartProvenance, - KarPleProfile, KarPleProfileSpec, PINNED_ARCHIVE_BYTES, PLE_ROWS, PROVENANCE_DIGEST, Path, PathBuf, RefCell, - VerifiedKarPleArtifact, -}; +use super::{File, InheritedKarArchive, InputBindingError, PINNED_ARCHIVE_BYTES, PROVENANCE_DIGEST, PathBuf}; #[cfg(target_os = "linux")] use super::{open_sealed_archive_fd, verify_open_provenance}; use rustix::fs::{MemfdFlags, SealFlags, fcntl_add_seals, fcntl_get_seals, memfd_create}; diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/load_pinned_inherited_archive.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/load_pinned_inherited_archive.rs index 5be59a2a..8f8bcde2 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/load_pinned_inherited_archive.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/load_pinned_inherited_archive.rs @@ -2,10 +2,9 @@ //! Functions: `open_archive_reader`, `load_pinned_inherited_archive`, `log_startup_read`, `load_pinned_inherited_arc... use super::{ - BindingIdentity, File, InheritedKarArchive, InputBindingError, InputResult, KarError, KarPleBinding, - KarPlePartProvenance, KarPleProfile, KarPleProfileSpec, KarRowPacket, KarRowReader, LoadPhase, NATIVE_DIGESTS, - PINNED_ARCHIVE_BYTES, PLE_ROWS, PROVENANCE_DIGEST, Path, PathBuf, RefCell, VerifiedKarPleArtifact, - open_sealed_archive_fd, pinned_profile, reopen_read_only_archive, verify_open_provenance, + NATIVE_DIGESTS, PINNED_ARCHIVE_BYTES, PLE_ROWS, PROVENANCE_DIGEST, BindingIdentity, File, InheritedKarArchive, + InputBindingError, InputResult, KarError, KarPleBinding, KarRowPacket, KarRowReader, LoadPhase, RefCell, + VerifiedKarPleArtifact, open_sealed_archive_fd, pinned_profile, reopen_read_only_archive, verify_open_provenance, }; /// The read handle of the inherited archive: a read-only reopen of the file, or the sealed memfd itself. diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/pinned_profile.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/pinned_profile.rs index eb2263ce..b3588b0d 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/pinned_profile.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/pinned_profile.rs @@ -2,10 +2,9 @@ //! Functions: `pinned_profile`, `pinned_parts`, `pinned_profile_spec`, `load_pinned_archive` and 3 more. use super::{ - ARCHIVE_DIGEST, BindingIdentity, File, InheritedKarArchive, InputBindingError, InputResult, KarError, - KarPlePartProvenance, KarPleProfile, KarPleProfileSpec, LoadPhase, NATIVE_DIGESTS, PART0_F32_DIGEST, - PART1_F32_DIGEST, PLE_ROWS, PROVENANCE_DIGEST, Path, PathBuf, RefCell, VIRTUAL_F32_DIGEST, VerifiedKarPleArtifact, - error, input_failure, kar_failure, private_copy, + ARCHIVE_DIGEST, NATIVE_DIGESTS, PART0_F32_DIGEST, PART1_F32_DIGEST, PROVENANCE_DIGEST, VIRTUAL_F32_DIGEST, File, + InheritedKarArchive, InputBindingError, InputResult, KarPlePartProvenance, KarPleProfile, KarPleProfileSpec, + LoadPhase, Path, VerifiedKarPleArtifact, error, input_failure, kar_failure, private_copy, }; /// Candidate expectations from independently verified v4 conversion receipts diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/pinned_profile_tests.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/pinned_profile_tests.rs index 765a889f..fb64dc2c 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/pinned_profile_tests.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/pinned_profile_tests.rs @@ -2,9 +2,8 @@ //! Functions: `diagnostic_cases`, `assert_kar_diagnostic_redacts`, `assert_input_diagnostic_survives_broken_sink`, `... use super::{ - BindingIdentity, File, InputBindingError, InputResult, KarError, KarPlePartProvenance, KarPleProfile, - KarPleProfileSpec, LoadPhase, NATIVE_DIGESTS, PLE_ROWS, Path, PathBuf, RefCell, VerifiedKarPleArtifact, error, - input_diagnostic, kar_diagnostic, pinned_profile, pinned_profile_spec, + NATIVE_DIGESTS, PLE_ROWS, InputBindingError, KarError, LoadPhase, error, input_diagnostic, kar_diagnostic, + pinned_profile, pinned_profile_spec, }; #[cfg(not(target_os = "windows"))] diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/private_copy.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/private_copy.rs index 192da567..0d39f35c 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/private_copy.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/private_copy.rs @@ -283,32 +283,24 @@ mod private_loader_tests { } mod inode; -#[allow(unused_imports)] +#[cfg(test)] use inode::diagnostic; #[cfg(target_os = "linux")] -#[allow(unused_imports)] pub(super) use inode::freeze; #[cfg(target_os = "macos")] -#[allow(unused_imports)] pub(super) use inode::freeze; -#[allow(unused_imports)] +#[cfg(target_os = "macos")] use inode::inode; -#[allow(unused_imports)] pub(super) use inode::open_regular; -#[allow(unused_imports)] +#[cfg(target_os = "macos")] use inode::phase_error; #[cfg(target_os = "macos")] -#[allow(unused_imports)] use inode::protected_root; -#[allow(unused_imports)] pub(super) use inode::provenance_error; -#[allow(unused_imports)] use inode::report_io; mod checked_reader; #[cfg(target_os = "macos")] -#[allow(unused_imports)] use checked_reader::checked_reader; -#[allow(unused_imports)] use checked_reader::copy_exact; -#[allow(unused_imports)] +#[cfg(test)] use checked_reader::copy_exact_reporting; diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/private_copy/checked_reader.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/private_copy/checked_reader.rs index c38b579c..f3886295 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/private_copy/checked_reader.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/private_copy/checked_reader.rs @@ -1,10 +1,9 @@ //! Functions: `checked_reader`, `copy_exact`, `copy_exact_reporting`, `copy_buffer` and 1 more. //! Split out of `private_copy` to keep its files under the line limit. -use super::{ - COPY_BUFFER, File, InputBindingError, InputResult, IoPhase, LoadPhase, Metadata, MetadataExt, OpenOptions, - OpenOptionsExt, Path, Read, SOURCE_FLAGS, Seek, Write, inode, input_failure, phase_error, report_io, -}; +use super::{COPY_BUFFER, InputBindingError, InputResult, IoPhase, LoadPhase, Read, Write, input_failure, report_io}; +#[cfg(not(target_os = "linux"))] +use super::{SOURCE_FLAGS, File, Metadata, MetadataExt, OpenOptions, OpenOptionsExt, Seek, inode, phase_error}; #[cfg(target_os = "macos")] pub(super) fn checked_reader(own: &OwnedCopy, bytes: u64) -> InputResult { diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/private_copy/inode.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/private_copy/inode.rs index 2a04e19b..b6afbfbe 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/private_copy/inode.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/private_copy/inode.rs @@ -2,9 +2,11 @@ //! Functions: `inode`, `diagnostic`, `report_io`, `phase_error` and 8 more. use super::{ - File, Inode, InputBindingError, InputResult, IoPhase, LoadPhase, Metadata, MetadataExt, OpenOptions, - OpenOptionsExt, Path, Read, SOURCE_FLAGS, Seek, Write, checked_reader, copy_exact, input_failure, + SOURCE_FLAGS, File, Inode, InputBindingError, InputResult, IoPhase, LoadPhase, Metadata, MetadataExt, + OpenOptions, OpenOptionsExt, Path, Seek, Write, copy_exact, input_failure, }; +#[cfg(not(target_os = "linux"))] +use super::{Read, checked_reader}; pub(super) fn inode(meta: &Metadata) -> Inode { (meta.dev(), meta.ino()) diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache.rs b/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache.rs index efe08320..72ba859c 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache.rs @@ -97,8 +97,6 @@ mod dense_slab_policy; mod workspaces; use workspaces::Workspaces; mod dense_weight_cache_methods; -#[allow(unused_imports)] use dense_slab_policy::dense_slab_policy; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -#[allow(unused_imports)] use dense_slab_policy::startup_step; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor.rs index dbe18fd8..54d43a73 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor.rs @@ -77,7 +77,6 @@ pub(crate) struct QwenForward; mod tests; mod prefill_step_product; -#[allow(unused_imports)] use prefill_step_product::diagnose; mod qwen_forward; mod read_layer_attention; @@ -85,15 +84,11 @@ mod step_layers; mod step_request; mod step_residual_capture; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -#[allow(unused_imports)] use read_layer_attention::LayerEntry; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -#[allow(unused_imports)] use read_layer_attention::prepare_layer_attention_micro; -#[allow(unused_imports)] use read_layer_attention::read_layer_attention; -#[allow(unused_imports)] +#[cfg(test)] use read_layer_attention::validate_descriptors; -#[allow(unused_imports)] use read_layer_attention::validate_layer_plan; pub(crate) use step_request::{StepCaches, StepPurpose, StepRequest}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt.rs index 031f1752..7908febc 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt.rs @@ -151,14 +151,9 @@ mod prompt_chunk_operands; pub(in crate::qwen_forward) use prompt_chunk_operands::{ ChunkCaches, ChunkDraft, PromptChunkSource, PromptChunkTarget, }; -#[allow(unused_imports)] use prompt_chunk_operands::{ChunkInFlight, ChunkRollback, ChunkWork, OpenChunk}; mod staged_input_enabled; -#[allow(unused_imports)] use staged_input_enabled::staged_input_enabled; mod original_prompt_executor; mod original_prompt_executor_drop; -#[allow(unused_imports)] use original_prompt_executor_drop::driver_error; -#[allow(unused_imports)] -pub(in crate::qwen_forward) use original_prompt_executor_drop::run_original_prompt; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk.rs index 095553e6..c19701ab 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk.rs @@ -4,13 +4,13 @@ #![allow(dead_code)] use super::super::session::chunk::QwenChunkTxn; use super::{ - BindingIdentity, BoundLayerKind, DenseWeightCache, Dimension, Error, ForwardPhase, GdnStage, GrRead, GrStage, - InjectedResidual, InputStage, KarPleCache, LayerEntry, LayerId, ModelBinding, MoeExpertStage, MoeRouteStage, - MoeWeightCache, OutputStage, Position, QsaAttentionStage, QsaIndexStage, QsaPrepareRequest, QwenForward, - QwenSession, QwenStepTxn, Result, Stage, StepCaches, StepPurpose, StepRequest, TargetStepOrigin, TargetStepProduct, - TokenId, VerificationChunk, VerificationSource, WindowCaches, diagnose, prefill_chunk, - prepare_layer_attention_micro, read_layer_attention, validate_layer_plan, + BoundLayerKind, DenseWeightCache, Dimension, Error, ForwardPhase, GdnStage, GrStage, InjectedResidual, InputStage, + KarPleCache, LayerEntry, LayerId, ModelBinding, MoeExpertStage, MoeRouteStage, MoeWeightCache, OutputStage, + Position, QsaAttentionStage, QsaIndexStage, QwenForward, QwenSession, QwenStepTxn, Result, Stage, TargetStepProduct, + TokenId, diagnose, prepare_layer_attention_micro, read_layer_attention, validate_layer_plan, }; +#[cfg(test)] +use super::{StepCaches, StepRequest}; #[derive(Clone, Copy)] enum ChunkMoePolicy { Native, @@ -32,22 +32,17 @@ mod window_numeric; mod native_mmq_evaluation; mod target_step_product; -#[allow(unused_imports)] use target_step_product::chunk_diagnostic; mod qwen_forward; pub(crate) use qwen_forward::PrefillChunkInputs; use qwen_forward::PrefillChunkPlan; mod prepare_micro_ffn_rows; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -#[allow(unused_imports)] use prepare_micro_ffn_rows::{MicroEnv, prepare_micro_ffn_rows}; mod prepare_q6_layer_columns; -#[allow(unused_imports)] use prepare_q6_layer_columns::prepare_q6_layer_columns; mod check_chunk_on_loaded; #[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -#[allow(unused_imports)] pub(in crate::qwen_forward) use check_chunk_on_loaded::check_chunk_on_loaded; mod read_chunk_attention_ffn; -#[allow(unused_imports)] use read_chunk_attention_ffn::{AttentionHandoff, read_chunk_attention_ffn}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward.rs index be175d50..0642643c 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward.rs @@ -2,19 +2,17 @@ //! Split out of `prefill_chunk` to keep its files under the line limit. use super::{ - AttentionHandoff, BindingIdentity, BoundLayerKind, ChunkMoePolicy, DenseWeightCache, Dimension, Error, - ForwardPhase, GdnStage, GrRead, GrStage, InjectedResidual, InputStage, KarPleCache, LayerEntry, LayerId, MicroEnv, - ModelBinding, MoeExpertStage, MoeRouteStage, MoeWeightCache, OutputStage, Position, QsaAttentionStage, - QsaIndexStage, QsaPrepareRequest, QwenChunkTxn, QwenForward, QwenSession, QwenStepTxn, Result, Stage, StepCaches, - StepPurpose, StepRequest, TargetStepOrigin, TargetStepProduct, TokenId, VerificationChunk, VerificationSource, - WindowCaches, chunk_diagnostic, diagnose, prefill_chunk, prepare_layer_attention_micro, prepare_micro_ffn_rows, - prepare_q6_layer_columns, qwen_forward, read_chunk_attention_ffn, read_layer_attention, validate_layer_plan, + AttentionHandoff, BoundLayerKind, ChunkMoePolicy, DenseWeightCache, Dimension, Error, ForwardPhase, GdnStage, + GrStage, InjectedResidual, InputStage, KarPleCache, LayerEntry, LayerId, MicroEnv, ModelBinding, MoeExpertStage, + MoeRouteStage, MoeWeightCache, OutputStage, Position, QsaAttentionStage, QsaIndexStage, QwenChunkTxn, QwenForward, + QwenSession, QwenStepTxn, Result, Stage, TargetStepProduct, TokenId, chunk_diagnostic, diagnose, + prepare_layer_attention_micro, prepare_micro_ffn_rows, prepare_q6_layer_columns, read_chunk_attention_ffn, + read_layer_attention, validate_layer_plan, }; #[cfg(all(test, target_arch = "x86_64"))] use super::{check_chunk_on_loaded, window_numeric}; mod joint_chunk; -#[allow(unused_imports)] use joint_chunk::AllocationTrace; pub(crate) use joint_chunk::PrefillChunkInputs; pub(super) use joint_chunk::PrefillChunkPlan; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/joint_chunk.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/joint_chunk.rs index 2c67420a..c431cae6 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/joint_chunk.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/joint_chunk.rs @@ -7,6 +7,7 @@ use super::{ #[cfg(all(test, target_arch = "x86_64"))] use super::window_numeric; use crate::qwen_forward::mtp_decode::MtpDecoder; +#[cfg(test)] use leleka_cuda_driver::Context; /// The borrowed inputs of one prefill chunk (the session and the MoE cache travel beside them). diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned.rs index 4db0ebcc..858c0c53 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned.rs @@ -2,14 +2,12 @@ //! Defines `MicroBank`, `MicroBank`, `NativeMoe` and 6 more. use super::{ - AllocationTrace, AttentionHandoff, BindingIdentity, BoundLayerKind, ChunkMoePolicy, DenseWeightCache, Dimension, - Error, ForwardPhase, GdnStage, GrRead, GrStage, InjectedResidual, InputStage, KarPleCache, LayerEntry, LayerId, - MicroEnv, ModelBinding, MoeExpertStage, MoeRouteStage, MoeWeightCache, OutputStage, Position, PrefillChunkInputs, - PrefillChunkPlan, QsaAttentionStage, QsaIndexStage, QsaPrepareRequest, QwenChunkTxn, QwenForward, QwenSession, - QwenStepTxn, Result, Stage, StepCaches, StepPurpose, StepRequest, TargetStepOrigin, TokenId, VerificationChunk, - VerificationSource, WindowCaches, chunk_diagnostic, diagnose, prepare_layer_attention_micro, - prepare_micro_ffn_rows, prepare_q6_layer_columns, qwen_forward, read_chunk_attention_ffn, read_layer_attention, - validate_layer_plan, + AttentionHandoff, BoundLayerKind, ChunkMoePolicy, DenseWeightCache, Dimension, Error, ForwardPhase, GdnStage, + GrStage, InjectedResidual, InputStage, KarPleCache, LayerEntry, LayerId, MicroEnv, ModelBinding, MoeExpertStage, + MoeRouteStage, MoeWeightCache, OutputStage, Position, PrefillChunkInputs, PrefillChunkPlan, QsaAttentionStage, + QsaIndexStage, QwenChunkTxn, QwenForward, QwenSession, QwenStepTxn, Result, Stage, TokenId, chunk_diagnostic, + diagnose, prepare_layer_attention_micro, prepare_micro_ffn_rows, prepare_q6_layer_columns, read_chunk_attention_ffn, + read_layer_attention, validate_layer_plan, }; #[cfg(all(test, target_arch = "x86_64"))] use super::window_numeric; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/window_ffn_flow.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/window_ffn_flow.rs index ad336e50..e920ac5d 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/window_ffn_flow.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/window_ffn_flow.rs @@ -9,7 +9,6 @@ use crate::qwen_forward::contract::TokenLayer; use crate::qwen_forward::gr::{DetachedGrRead, GrRead}; use crate::qwen_forward::moe_expert::PreparedMoeRow; use crate::qwen_forward::q6_attention_columns::ProjectionRow; -use crate::qwen_forward::qsa_attention::QsaReady; impl QwenForward { /// Attention, FFN read and routing of one row on the host stages; the policy selects the retained GR flow or the diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/window_numeric.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/window_numeric.rs index 6f76e6a6..7d7a2612 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/window_numeric.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/window_numeric.rs @@ -2,12 +2,9 @@ //! The returned report owns only counts/booleans; its assertions belong AFTER //! the caller has closed all actual GPU owners and checked allocated_bytes=0. use super::{ - AttentionHandoff, BindingIdentity, BoundLayerKind, ChunkMoePolicy, DenseWeightCache, Dimension, Error, GdnStage, - GrRead, GrStage, InjectedResidual, InputStage, KarPleCache, LayerEntry, LayerId, MicroEnv, ModelBinding, - MoeExpertStage, MoeRouteStage, MoeWeightCache, OutputStage, Position, PrefillChunkInputs, PrefillChunkPlan, - QsaAttentionStage, QsaIndexStage, QsaPrepareRequest, QwenChunkTxn, QwenForward, QwenSession, QwenStepTxn, Result, - Stage, StepCaches, StepPurpose, StepRequest, TargetStepOrigin, TargetStepProduct, TokenId, VerificationChunk, - VerificationSource, WindowCaches, qwen_forward, + ChunkMoePolicy, DenseWeightCache, Dimension, Error, KarPleCache, ModelBinding, MoeWeightCache, OutputStage, + Position, PrefillChunkInputs, PrefillChunkPlan, QwenChunkTxn, QwenForward, QwenSession, Result, Stage, StepCaches, + StepRequest, TargetStepProduct, TokenId, }; use crate::qwen_forward::loaded_target_owners::LoadedTargetOwners; use crate::qwen_forward::mtp_decode::MtpDecoder; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn.rs index 9e21b4fd..6783fc0e 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn.rs @@ -196,8 +196,6 @@ mod tests { } } -#[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -pub(crate) use chunk_device::numeric_gpu::run_gdn_chunk_numeric; #[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] mod four_borrow_gpu; @@ -211,69 +209,45 @@ pub(in crate::qwen_forward) use prompt_device::{PromptLayer, PromptProgram, Prom mod cached_step; mod gdn_ready; mod stage_steps; -#[allow(unused_imports)] use cached_step::preflight_budget; -#[allow(unused_imports)] use cached_step::project_chain_input; -#[allow(unused_imports)] use cached_step::step_cached; mod projection; -#[allow(unused_imports)] use projection::convolve; -#[allow(unused_imports)] use projection::dispatch_projection; -#[allow(unused_imports)] use projection::normalize_qk; -#[allow(unused_imports)] +#[cfg(test)] use projection::project_retained; -#[allow(unused_imports)] use projection::{ProjectionOperands, project}; mod gates; -#[allow(unused_imports)] use gates::{GateHostOperands, OutNormScale}; mod step_operands; -#[allow(unused_imports)] +#[cfg(test)] use gates::all_finite; -#[allow(unused_imports)] use gates::allocate; -#[allow(unused_imports)] use gates::binding_error; -#[allow(unused_imports)] use gates::download; -#[allow(unused_imports)] use gates::download_unchecked; -#[allow(unused_imports)] use gates::gates; -#[allow(unused_imports)] use gates::out_norm; -#[allow(unused_imports)] pub(super) use gates::pool_enabled; -#[allow(unused_imports)] use gates::recur; -#[allow(unused_imports)] use gates::release; -#[allow(unused_imports)] +#[cfg(test)] pub(crate) use gates::set_pool_override; -#[allow(unused_imports)] use gates::upload; -#[allow(unused_imports)] use gates::validate_values; -#[allow(unused_imports)] use gates::zeros; -#[allow(unused_imports)] use step_operands::MirrorStep; -#[allow(unused_imports)] pub(in crate::qwen_forward) use step_operands::{ DeviceChunkRow, GdnLayerInput, GdnMatrixLayout, LeaseClaim, LeasedProjection, MirrorAuthority, ProjectedQkvSource, ReadoutClaim, RecurrenceOperands, }; mod driver_error; -#[allow(unused_imports)] pub(super) use driver_error::driver_error; -#[allow(unused_imports)] +#[cfg(test)] use driver_error::key_head; -#[allow(unused_imports)] +#[cfg(test)] use driver_error::state_index; #[cfg(test)] -#[allow(unused_imports)] use driver_error::validate_candidates; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chain.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chain.rs index e2e53cdb..a7ddb479 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chain.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chain.rs @@ -331,9 +331,8 @@ mod retained_qk_gpu { } mod allocate_qk_slot; -#[allow(unused_imports)] +#[cfg(test)] use allocate_qk_slot::allocate_qk_slot; -#[allow(unused_imports)] use allocate_qk_slot::normalize_retained_qk; mod chain; mod chain_drop; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device.rs index 757f9fa4..953c6c11 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device.rs @@ -3,18 +3,10 @@ use super::super::session::chunk::GdnChunkMicro; use super::super::session::chunk::{GdnChunkRow, GdnChunkSeal, GdnChunkStart}; use super::{ - ALL_MIRROR_BYTES, Bf16ProjectionShape, BindingIdentity, BoundLayerKind, Context, DenseFormat, DenseWeightCache, - DeviceBuffer, DeviceChunkRow, Dimension, DriverError, Error, GateHostOperands, GdnInputLease, GdnInputScratch, - GdnLayerInput, GdnMatrixKind, GdnMatrixLayout, GdnMatrixRole, GdnOwner, GdnPending, GdnPrior, GdnStateKey, - GdnStateMirror, GdnWeights, GrRole, HISTORY_ELEMENTS, InputBindingError, LayerId, LeaseClaim, LeasedProjection, - MirrorAuthority, MirrorStep, ModelBinding, OutNormScale, ProjectedQkvSource, ProjectionKind, ProjectionOperands, - ProjectionSpec, PromptLayer, PromptProgram, PromptSource, Q5KProjectionShape, Q6KProjectionShape, QkScratch, - QwenStepTxn, ReadoutClaim, RecurrenceOperands, ResidualReady, Result, STATE_ELEMENTS, Stage, TokenLayer, VALUES, - allocate, chain, download, download_unchecked, driver_error, pool_enabled, preflight_budget, release, state, - upload, validate_values, verification, + BindingIdentity, Context, DenseWeightCache, DeviceBuffer, Error, GdnPrior, HISTORY_ELEMENTS, ModelBinding, Result, + STATE_ELEMENTS, TokenLayer, VALUES, allocate, download, download_unchecked, driver_error, pool_enabled, + preflight_budget, upload, validate_values, }; -#[cfg(test)] -use super::CHANNELS; use leleka_cuda_driver::{GdnRowQueue, GdnStateFiniteGuard}; use std::{cell::Cell, rc::Rc}; pub(in crate::qwen_forward) const CHUNK_DEVICE_CHARGE: usize = 2 * STATE_ELEMENTS * 4 + 4; @@ -66,9 +58,7 @@ pub(in crate::qwen_forward) mod numeric_gpu; mod mirror_reuse_enabled; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -#[allow(unused_imports)] use mirror_reuse_enabled::micro_rows; -#[allow(unused_imports)] use mirror_reuse_enabled::mirror_reuse_enabled; mod gdn_chunk_device_methods; mod native_fused_step; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/gdn_chunk_device_methods.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/gdn_chunk_device_methods.rs index ebcd590f..abb0f45f 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/gdn_chunk_device_methods.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/gdn_chunk_device_methods.rs @@ -2,17 +2,10 @@ //! Split out of `chunk_device` to keep its files under the line limit. use super::{ - ALL_MIRROR_BYTES, Bf16ProjectionShape, BindingIdentity, BoundLayerKind, CHUNK_DEVICE_CHARGE, Cell, ChunkEdge, - ChunkReadout, Context, DenseFormat, DenseWeightCache, DeviceBuffer, DeviceChunkRow, Dimension, DriverError, Error, - GateHostOperands, GdnChunkDevice, GdnChunkMicro, GdnChunkRow, GdnChunkSeal, GdnChunkStart, GdnInputLease, - GdnInputScratch, GdnLayerInput, GdnMatrixKind, GdnMatrixLayout, GdnMatrixRole, GdnOwner, GdnPending, GdnPrior, - GdnRowQueue, GdnStateFiniteGuard, GdnStateKey, GdnStateMirror, GdnWeights, GrRole, HISTORY_ELEMENTS, - InputBindingError, LayerId, LeaseClaim, LeasedProjection, MirrorAuthority, MirrorStep, ModelBinding, OutNormScale, - ProjectedQkvSource, ProjectionKind, ProjectionOperands, ProjectionSpec, PromptLayer, PromptProgram, PromptSource, - Q5KProjectionShape, Q6KProjectionShape, QkScratch, QwenStepTxn, Rc, ReadoutClaim, ReadoutDownload, - RecurrenceOperands, ResidualReady, Result, STATE_ELEMENTS, Stage, TokenLayer, VALUES, allocate, chain, download, - download_unchecked, driver_error, micro_rows, mirror_reuse_enabled, pool_enabled, preflight_budget, release, state, - upload, validate_values, verification, + BindingIdentity, CHUNK_DEVICE_CHARGE, Cell, ChunkEdge, ChunkReadout, Context, DenseWeightCache, DeviceBuffer, Error, + GdnChunkDevice, GdnChunkMicro, GdnChunkRow, GdnChunkSeal, GdnChunkStart, GdnPrior, GdnRowQueue, HISTORY_ELEMENTS, + ModelBinding, Rc, ReadoutDownload, Result, STATE_ELEMENTS, VALUES, allocate, download, download_unchecked, + driver_error, micro_rows, mirror_reuse_enabled, pool_enabled, preflight_budget, upload, validate_values, }; mod chunk_device_batch_compute; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/numeric_gpu.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/numeric_gpu.rs index 346878c5..0f8a3a3e 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/numeric_gpu.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/numeric_gpu.rs @@ -4,16 +4,9 @@ use super::super::super::contract::{Dimension, LayerId}; use super::super::super::session::chunk::TestGdnComponentRows; use super::super::{RecurrenceOperands, convolve, recur}; use super::{ - ALL_MIRROR_BYTES, Bf16ProjectionShape, BindingIdentity, BoundLayerKind, CHANNELS, CHUNK_DEVICE_CHARGE, Cell, - ChunkReadout, Context, DenseFormat, DenseWeightCache, DeviceBuffer, DeviceChunkRow, DriverError, Error, - GateHostOperands, GdnChunkDevice, GdnChunkMicro, GdnChunkRow, GdnChunkSeal, GdnChunkStart, GdnInputLease, - GdnInputScratch, GdnLayerInput, GdnMatrixKind, GdnMatrixLayout, GdnMatrixRole, GdnOwner, GdnPending, GdnPrior, - GdnRowQueue, GdnStateFiniteGuard, GdnStateKey, GdnStateMirror, GdnWeights, GrRole, HISTORY_ELEMENTS, - InputBindingError, LeaseClaim, LeasedProjection, MirrorAuthority, MirrorStep, ModelBinding, OutNormScale, - ProjectedQkvSource, ProjectionKind, ProjectionOperands, ProjectionSpec, PromptLayer, PromptProgram, PromptSource, - Q5KProjectionShape, Q6KProjectionShape, QkScratch, QwenStepTxn, Rc, ReadoutClaim, ResidualReady, Result, - STATE_ELEMENTS, Stage, TokenLayer, allocate, chain, download, driver_error, preflight_budget, release, state, - upload, validate_values, + BindingIdentity, CHUNK_DEVICE_CHARGE, Cell, ChunkReadout, Context, DeviceBuffer, Error, GdnChunkDevice, GdnChunkRow, + GdnChunkSeal, GdnChunkStart, GdnPrior, GdnStateFiniteGuard, HISTORY_ELEMENTS, Rc, Result, STATE_ELEMENTS, allocate, + download, driver_error, preflight_budget, upload, validate_values, }; use leleka_cuda_driver::Driver; @@ -65,25 +58,14 @@ fn batch_adoption_is_consecutive_atomic_and_swaps_the_final_state_once() { } mod operands; -#[allow(unused_imports)] use operands::component_owner; -#[allow(unused_imports)] use operands::convolution_input; -#[allow(unused_imports)] use operands::convolution_weights; -#[allow(unused_imports)] use operands::difference; -#[allow(unused_imports)] use operands::operands; -#[allow(unused_imports)] use operands::reference; -#[allow(unused_imports)] use operands::require; mod exercise; -#[allow(unused_imports)] -use exercise::exercise; -#[allow(unused_imports)] pub(crate) use exercise::run_gdn_chunk_numeric; mod batch_adoption; -#[allow(unused_imports)] use batch_adoption::batch_adoption; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/numeric_gpu/operands.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/numeric_gpu/operands.rs index 63023748..e67ac3d2 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/numeric_gpu/operands.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/numeric_gpu/operands.rs @@ -2,16 +2,9 @@ //! Functions: `operands`, `convolution_input`, `convolution_weights`, `difference` and 3 more. use super::{ - ALL_MIRROR_BYTES, Bf16ProjectionShape, BindingIdentity, BoundLayerKind, CHANNELS, CHUNK_DEVICE_CHARGE, Cell, - Context, DenseFormat, DenseWeightCache, DeviceBuffer, DeviceChunkRow, Dimension, Driver, DriverError, Error, - GateHostOperands, GdnChunkDevice, GdnChunkMicro, GdnChunkRow, GdnChunkSeal, GdnChunkStart, GdnInputLease, - GdnInputScratch, GdnLayerInput, GdnMatrixKind, GdnMatrixLayout, GdnMatrixRole, GdnOwner, GdnPending, GdnPrior, - GdnRowQueue, GdnStateFiniteGuard, GdnStateKey, GdnStateMirror, GdnWeights, GrRole, InputBindingError, LayerId, - LeaseClaim, LeasedProjection, MirrorAuthority, MirrorStep, ModelBinding, Operands, OutNormScale, - ProjectedQkvSource, ProjectionKind, ProjectionOperands, ProjectionSpec, PromptLayer, PromptProgram, PromptSource, - Q5KProjectionShape, Q6KProjectionShape, QkScratch, QwenStepTxn, ROWS, Rc, ReadoutClaim, RecurrenceOperands, - Reference, ResidualReady, Result, STATE_ELEMENTS, Stage, TestGdnComponentRows, TokenLayer, allocate, chain, - convolve, driver_error, preflight_budget, recur, state, upload, validate_values, + CHUNK_DEVICE_CHARGE, Cell, Context, Error, GdnChunkDevice, GdnChunkStart, GdnPrior, Operands, ROWS, Rc, + RecurrenceOperands, Reference, Result, STATE_ELEMENTS, allocate, convolve, driver_error, preflight_budget, recur, + upload, validate_values, }; impl Operands { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/mirror.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/mirror.rs index 4ad5b0d4..8f928b7d 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/mirror.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/mirror.rs @@ -74,5 +74,4 @@ mod gpu_tests; mod gdn_state_mirror_methods; mod mirror_readout; mod upload_checked; -#[allow(unused_imports)] use upload_checked::upload_checked; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/prefill_batch.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/prefill_batch.rs index a2bac559..0a986ef5 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/prefill_batch.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/prefill_batch.rs @@ -132,16 +132,10 @@ mod tests { mod gpu; mod gdn_batch_resources; -#[allow(unused_imports)] -use gdn_batch_resources::admit_batch_bytes; -#[allow(unused_imports)] +#[cfg(test)] pub(in crate::qwen_forward) use gdn_batch_resources::batch_device_bytes; -#[allow(unused_imports)] use gdn_batch_resources::f32_bytes; -#[allow(unused_imports)] use gdn_batch_resources::native_format; mod buffers; -#[allow(unused_imports)] -use buffers::release_pool; mod gdn_stage; mod step_batch; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/prefill_batch/gdn_stage.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/prefill_batch/gdn_stage.rs index ecd8e9e8..7b8ba09e 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/prefill_batch/gdn_stage.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/prefill_batch/gdn_stage.rs @@ -1,7 +1,6 @@ //! Methods of `GdnStage`: `step_chunk_batch`. //! Split out of `prefill_batch` to keep its files under the line limit. -#[allow(unused_imports)] use super::step_batch::{ check_gdn_window, gather_gdn_rows, gdn_operands, latch_cuda_failure, prepare_or_refuse, run_gdn_program, settle_gdn, window_bytes, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/verification.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/verification.rs index 42607b35..5df07186 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/verification.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/verification.rs @@ -79,6 +79,5 @@ pub(super) struct PoolRow<'ctx> { mod numeric_gpu; mod compute_row; -#[allow(unused_imports)] pub(super) use compute_row::compute_row; mod workspace; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/verification/compute_row.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/verification/compute_row.rs index ab502315..8e5c7a15 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/verification/compute_row.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/verification/compute_row.rs @@ -9,7 +9,6 @@ use super::{ }; mod verified_row_compute_and_lease; -#[allow(unused_imports)] pub(in super::super) use verified_row_compute_and_lease::compute_row; mod workspace; mod workspace_replay; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gr.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gr.rs index 2656cbc2..014e2fde 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gr.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gr.rs @@ -93,9 +93,8 @@ mod gr_residual_reuse_gpu; mod batch_chunk; pub(in crate::qwen_forward) use batch_chunk::GrBatchRow; -pub(in crate::qwen_forward) use batch_chunk::GrMicroAttentionBlock as GrMicroBlock; pub(in crate::qwen_forward) use batch_chunk::{ - GrMicroAttention, GrMicroAttentionBank, GrMicroAttentionBlock, GrMicroInput, MicroBlockRequest, + GrMicroAttentionBank, GrMicroAttentionBlock, GrMicroInput, MicroBlockRequest, }; mod attention_chunk; @@ -108,42 +107,25 @@ pub(in crate::qwen_forward) use retained_handoff::AttentionBlockOutput; mod output_workspace_gpu; mod diagnose; -#[allow(unused_imports)] use diagnose::diagnose; -#[allow(unused_imports)] use diagnose::diagnose_extrema; mod gr_stage; mod read_cuda; mod residual_ready; -#[allow(unused_imports)] use read_cuda::read_cuda; mod read_cached_cuda; -#[allow(unused_imports)] use read_cached_cuda::admit_budget; -#[allow(unused_imports)] use read_cached_cuda::copy_cached_f32; -#[allow(unused_imports)] use read_cached_cuda::inject_cached_cuda; -#[allow(unused_imports)] use read_cached_cuda::read_cached_cuda; -#[allow(unused_imports)] use read_cached_cuda::release_all; -#[allow(unused_imports)] use read_cached_cuda::upload_bf16; -#[allow(unused_imports)] use read_cached_cuda::upload_cached_f32; -#[allow(unused_imports)] use read_cached_cuda::upload_f32; mod download_f32; -#[allow(unused_imports)] use download_f32::binding_error; -#[allow(unused_imports)] use download_f32::download_f32; -#[allow(unused_imports)] use download_f32::driver_error; -#[allow(unused_imports)] use download_f32::validate_layer; -#[allow(unused_imports)] use download_f32::validate_streams; -#[allow(unused_imports)] use download_f32::validate_values; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gr/batch_chunk.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gr/batch_chunk.rs index ab536c17..888b0908 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gr/batch_chunk.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gr/batch_chunk.rs @@ -52,9 +52,7 @@ pub(in crate::qwen_forward) struct GrBatchRow { } mod gr_micro_input; -#[allow(unused_imports)] pub(super) use gr_micro_input::micro_driver_error; -#[allow(unused_imports)] pub(super) use gr_micro_input::save_micro_values; mod batch_inject; mod gr_stage; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gr/batch_chunk/gr_stage.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gr/batch_chunk/gr_stage.rs index bcc85bf3..cf618a93 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gr/batch_chunk/gr_stage.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gr/batch_chunk/gr_stage.rs @@ -1,7 +1,6 @@ //! Methods of `GrStage`: `mint_micro_input`, `prepare_micro_initial`, `prepare_micro_after_ple`, `prepare_micro_afte... //! Methods of `GrBatchScope`: `detach_rows`, `refuse_device`, `seal`. -#[allow(unused_imports)] use super::super::super::dense_weight_cache::GrResident; use super::{ Cell, Context, DenseWeightCache, DetachedGrRead, DeviceBuffer, Dimension, Error, GrBatchScope, GrMicroAttention, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gr/batch_chunk/gr_stage_prepare_injection.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gr/batch_chunk/gr_stage_prepare_injection.rs index 55f4351c..5c7830db 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gr/batch_chunk/gr_stage_prepare_injection.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gr/batch_chunk/gr_stage_prepare_injection.rs @@ -1,7 +1,6 @@ //! Methods of `GrStage`: `prepare_detached_batch_injection`, `prepare_batch_injection`, `inject_batch`. //! Functions: `check_batch_read`. -#[allow(unused_imports)] use super::batch_inject::{device_inject, gather_batch}; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] use super::batch_inject::{finish_queued, queued_inject}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gr/gr_stage.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gr/gr_stage.rs index 3221a3c5..6675062c 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gr/gr_stage.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gr/gr_stage.rs @@ -1,7 +1,6 @@ //! Methods of `GrStage`: `apply`, `read_ffn`, `read_attention`, `read_attention_after_ple` and 6 more. //! Functions: `copy_streams`, `resolve_gr_weights`, `read_candidate`, `check_injection_origin` and 2 more. -#[allow(unused_imports)] use super::super::dense_weight_cache::GrResident; use super::{ Context, DenseWeightCache, DeviceBuffer, Dimension, Error, GrPhase, GrRead, GrRole, GrScratch, GrStage, GrWeights, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gr/output_workspace_gpu.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gr/output_workspace_gpu.rs index 407ea719..5b327d43 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gr/output_workspace_gpu.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gr/output_workspace_gpu.rs @@ -2,11 +2,9 @@ //! Defines `Tally`. use super::{ - AttentionBlockOutput, BindingIdentity, Cell, Context, DenseWeightCache, DetachedGrRead, DeviceBuffer, Dimension, - DriverError, Error, GR_OUTPUT_BYTES, GR_OUTPUT_DEVICE_BYTES, GrBatchRow, GrMicroAttention, GrMicroAttentionBank, - GrMicroAttentionBlock, GrMicroBlock, GrMicroInput, GrRole, GrScratch, GrWeights, InputBindingError, LayerId, - MicroBlockRequest, ModelBinding, PleReady, QwenStepTxn, Rc, ReadCandidate, RefCell, RefMut, Result, TokenLayer, - download_f32, driver_error, inject_cached_cuda, read_cached_cuda, retained_handoff, upload_bf16, upload_f32, + BindingIdentity, Cell, Context, DeviceBuffer, Error, GR_OUTPUT_BYTES, GR_OUTPUT_DEVICE_BYTES, GrScratch, Rc, + ReadCandidate, RefCell, Result, download_f32, driver_error, inject_cached_cuda, read_cached_cuda, retained_handoff, + upload_bf16, upload_f32, }; use leleka_cuda_driver::Driver; @@ -99,18 +97,11 @@ fn original_first_fixed_outputs_repeat_overwrite_abort_and_cleanup() { } mod fresh_read; -#[allow(unused_imports)] use fresh_read::block; -#[allow(unused_imports)] use fresh_read::coefficients; -#[allow(unused_imports)] use fresh_read::fresh_inject; -#[allow(unused_imports)] use fresh_read::fresh_read; -#[allow(unused_imports)] use fresh_read::poison_all; -#[allow(unused_imports)] use fresh_read::streams; mod check_handoff; -#[allow(unused_imports)] use check_handoff::check_handoff; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gr/output_workspace_gpu/check_handoff.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gr/output_workspace_gpu/check_handoff.rs index 9b430423..f9a28ce3 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gr/output_workspace_gpu/check_handoff.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gr/output_workspace_gpu/check_handoff.rs @@ -5,14 +5,6 @@ use super::{ BindingIdentity, Context, DeviceBuffer, Error, GR_OUTPUT_DEVICE_BYTES, GrScratch, ReadCandidate, Result, block, download_f32, driver_error, fresh_inject, fresh_read, poison_all, read_cached_cuda, retained_handoff, streams, }; -// used only with some cargo features of this crate -#[allow(unused_imports)] -use super::{ - AttentionBlockOutput, Cell, DenseWeightCache, DetachedGrRead, Dimension, Driver, DriverError, GrBatchRow, - GrMicroAttention, GrMicroAttentionBank, GrMicroAttentionBlock, GrMicroBlock, GrMicroInput, GrRole, GrWeights, - InputBindingError, LayerId, MicroBlockRequest, ModelBinding, PleReady, QwenStepTxn, Rc, RefCell, RefMut, Stage, - TokenLayer, coefficients, -}; pub(super) fn check_handoff<'ctx>( scratch: &mut GrScratch<'ctx>, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gr/output_workspace_gpu/fresh_read.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gr/output_workspace_gpu/fresh_read.rs index 769e3688..c4772494 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gr/output_workspace_gpu/fresh_read.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gr/output_workspace_gpu/fresh_read.rs @@ -2,14 +2,6 @@ //! Split out of `output_workspace_gpu` to keep its files under the line limit. use super::{Context, DeviceBuffer, Error, GR_OUTPUT_BYTES, GrScratch, Result, download_f32, driver_error, upload_f32}; -// used only with some cargo features of this crate -#[allow(unused_imports)] -use super::{ - AttentionBlockOutput, BindingIdentity, Cell, DenseWeightCache, DetachedGrRead, Dimension, Driver, DriverError, - GrBatchRow, GrMicroAttention, GrMicroAttentionBank, GrMicroAttentionBlock, GrMicroBlock, GrMicroInput, GrRole, - GrWeights, InputBindingError, LayerId, MicroBlockRequest, ModelBinding, PleReady, QwenStepTxn, Rc, RefCell, RefMut, - Stage, TokenLayer, -}; pub(super) fn fresh_read( context: &Context<'_>, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/input.rs b/crates/engine-qwen35-cuda/src/qwen_forward/input.rs index 047c6bfd..71314d89 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/input.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/input.rs @@ -220,39 +220,20 @@ mod ple_tests { mod input_stage; mod residual_streams; pub(super) use input_stage::PositionedToken; -#[allow(unused_imports)] -use input_stage::gather_ple; -#[allow(unused_imports)] -use input_stage::trace_ple; -#[allow(unused_imports)] +#[cfg(test)] use input_stage::validate_ids; mod gather_rows; -#[allow(unused_imports)] pub(super) use gather_rows::binding_error; -#[allow(unused_imports)] use gather_rows::gather_rows; mod input_stage_ple_micro; -#[allow(unused_imports)] -use input_stage_ple_micro::ple_cuda_cached; mod ple_cuda; -#[allow(unused_imports)] use ple_cuda::ple_budget; -#[allow(unused_imports)] use ple_cuda::ple_cuda; -#[allow(unused_imports)] -use ple_cuda::ple_project; -#[allow(unused_imports)] use ple_cuda::ple_upload; -#[allow(unused_imports)] use ple_cuda::ple_values; -#[allow(unused_imports)] use ple_cuda::ple_zeros; mod ple_upload_f32; -#[allow(unused_imports)] use ple_upload_f32::ple_download; -#[allow(unused_imports)] use ple_upload_f32::ple_driver_error; -#[allow(unused_imports)] use ple_upload_f32::ple_upload_f32; -#[allow(unused_imports)] use ple_upload_f32::ple_upload_u16; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/input/ple_transport.rs b/crates/engine-qwen35-cuda/src/qwen_forward/input/ple_transport.rs index e21ae1da..82819a08 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/input/ple_transport.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/input/ple_transport.rs @@ -50,17 +50,11 @@ struct Transport<'ctx> { mod ple_key_retained_gpu; mod role; -#[allow(unused_imports)] use role::admit; -#[allow(unused_imports)] use role::at; -#[allow(unused_imports)] pub(super) use role::compose; mod ple_inner_composition; -#[allow(unused_imports)] use ple_inner_composition::compose_inner; #[cfg(test)] -#[allow(unused_imports)] use ple_inner_composition::compose_observed; -#[allow(unused_imports)] pub(super) use ple_inner_composition::compose_queued; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/input/ple_transport/ple_key_retained_gpu.rs b/crates/engine-qwen35-cuda/src/qwen_forward/input/ple_transport/ple_key_retained_gpu.rs index 17ef3095..0abad6b0 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/input/ple_transport/ple_key_retained_gpu.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/input/ple_transport/ple_key_retained_gpu.rs @@ -2,8 +2,8 @@ #![cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] use super::super::{ple_upload, ple_upload_f32}; use super::{ - Bf16ProjectionShape, Cell, Context, DeviceBuffer, Error, Finite, PLE_HC, PLE_HISTORY, PleCandidate, PleRows, Rc, - Result, Role, Transport, at, compose, ple_download, ple_driver_error, role, + Bf16ProjectionShape, Cell, Context, DeviceBuffer, Error, Finite, PleCandidate, PleRows, Rc, Result, Role, Transport, + at, compose, ple_download, ple_driver_error, }; #[cfg(test)] use super::{Observations, compose_observed}; @@ -216,17 +216,9 @@ fn prove_sticky_policy(ctx: &Context<'_>, device: &leleka_cuda_driver::Device<'_ } mod bf16; -#[allow(unused_imports)] use bf16::bf16; -#[allow(unused_imports)] use bf16::exact; -#[allow(unused_imports)] use bf16::original; -#[allow(unused_imports)] use bf16::owned_key; -#[allow(unused_imports)] -use bf16::run; -#[allow(unused_imports)] use bf16::source; -#[allow(unused_imports)] use bf16::value_bytes; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/input/ple_transport/ple_key_retained_gpu/bf16.rs b/crates/engine-qwen35-cuda/src/qwen_forward/input/ple_transport/ple_key_retained_gpu/bf16.rs index 6228f678..bc48ddeb 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/input/ple_transport/ple_key_retained_gpu/bf16.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/input/ple_transport/ple_key_retained_gpu/bf16.rs @@ -2,9 +2,8 @@ //! Methods of `Chain`: `key_value`, `norms`, `gate`, `gated` and 2 more. use super::{ - Bf16ProjectionShape, Cell, Context, DeviceBuffer, Driver, Error, Finite, Matrices, PLE_HC, PLE_HISTORY, - PleCandidate, PleClosedWeights, Rc, Result, Role, Transport, at, ple_download, ple_driver_error, ple_upload, - ple_upload_f32, + Bf16ProjectionShape, Context, DeviceBuffer, Finite, Matrices, Role, Transport, at, ple_download, ple_driver_error, + ple_upload, ple_upload_f32, }; #[cfg(test)] use super::Observations; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache.rs b/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache.rs index 85221281..85a14fca 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache.rs @@ -134,18 +134,12 @@ mod slot_tests; mod lru_tests; mod scratch_bytes; -#[allow(unused_imports)] use scratch_bytes::assign_slots; -#[allow(unused_imports)] use scratch_bytes::lookup_rows; -#[allow(unused_imports)] use scratch_bytes::plan_gather; -#[allow(unused_imports)] use scratch_bytes::scratch_bytes; mod publish_gather; -#[allow(unused_imports)] use publish_gather::ahead_enabled; -#[allow(unused_imports)] use publish_gather::publish_gather; mod ahead_rows; mod kar_ple_cache_methods; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert.rs index fe53fb98..45246230 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert.rs @@ -5,10 +5,8 @@ use super::contract::{Error, LayerId, Result, Stage, TokenLayer}; use super::gr::ResidualReady; use super::moe_route::RoutedExperts; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -#[allow(unused_imports)] use super::moe_weight_cache::SourceMatrix; use super::moe_weight_cache::{CachedMoeMatrix, MoeWeightCache}; -#[allow(unused_imports)] use super::moe_weight_cache::{MmqChunkRequest, SharedTailRow}; use super::session::QwenStepTxn; use crate::model_binding::kar_expert_source::{KarExpertSource, KarSourceError}; @@ -70,65 +68,34 @@ mod tests; mod expert_step; pub(in crate::qwen_forward) use expert_step::ExpertRowRequest; -#[allow(unused_imports)] use expert_step::StepCuda; -#[allow(unused_imports)] -use expert_step::execute_cuda; -#[allow(unused_imports)] -use expert_step::execute_cuda_kar; -#[allow(unused_imports)] -use expert_step::kar_error; mod cached_expert_run; -#[allow(unused_imports)] use cached_expert_run::execute_cuda_cached; -#[allow(unused_imports)] use cached_expert_run::finish_with_parts; mod scoped_expert_mlp; -#[allow(unused_imports)] use scoped_expert_mlp::DownProvenance; -#[allow(unused_imports)] -use scoped_expert_mlp::cached_gate_up_scoped; -#[allow(unused_imports)] use scoped_expert_mlp::cached_mlp_down; mod expert_mlp_values; -#[allow(unused_imports)] use expert_mlp_values::expert_mlp; -#[allow(unused_imports)] +#[cfg(test)] use expert_mlp_values::finish_cached_mlp; -#[allow(unused_imports)] -use expert_mlp_values::project_cached_gate_up; -#[allow(unused_imports)] +#[cfg(test)] use expert_mlp_values::project_retained_gate_up; mod expert_matrix_projection; -#[allow(unused_imports)] use expert_matrix_projection::admit_budget; #[cfg(test)] -#[allow(unused_imports)] use expert_matrix_projection::collect_rows; -#[allow(unused_imports)] -use expert_matrix_projection::dual_format_kind; -#[allow(unused_imports)] use expert_matrix_projection::dual_routed_format; -#[allow(unused_imports)] use expert_matrix_projection::launch_cached_prepared; -#[allow(unused_imports)] use expert_matrix_projection::launch_cached_projection; -#[allow(unused_imports)] +#[cfg(test)] use expert_matrix_projection::launch_projection; -#[allow(unused_imports)] use expert_matrix_projection::project_matrix; -#[allow(unused_imports)] use expert_matrix_projection::{DeclaredMatrix, ExpertActivation, ExpertMatrix, MatrixDims}; mod validate_values; -#[allow(unused_imports)] use validate_values::binding_error; -#[allow(unused_imports)] use validate_values::download_f32; -#[allow(unused_imports)] use validate_values::driver_error; -#[allow(unused_imports)] use validate_values::upload_bytes; -#[allow(unused_imports)] use validate_values::upload_f32; -#[allow(unused_imports)] use validate_values::validate_values; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/cached_expert_run.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/cached_expert_run.rs index e6236395..575f6e91 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/cached_expert_run.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/cached_expert_run.rs @@ -1,7 +1,6 @@ //! Methods of `ActualSlotPacket`: `validate`. Methods of `ActualDown`: `take`. //! Functions: `shared_scalar_buffers`, `release_shared_inputs`, `scaled_shared`, `finish_with_parts` and 1 more. -#[allow(unused_imports)] use super::moe_down::{RetainedScalar, ScaledDown}; use super::{ ActualDown, ActualSlotPacket, BoundExpert, Cell, Context, DeviceBuffer, DownOrigin, DownProvenance, DownScope, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped.rs index 02a2cccb..aac33f1b 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped.rs @@ -11,11 +11,6 @@ use super::{ Stage, StepCuda, TokenLayer, TransportBuffer, admit_budget, binding_error, cached_mlp_down, download_f32, driver_error, dual_routed_format, execute_cuda_cached, launch_cached_projection, moe_down, validate_values, }; -#[cfg(test)] -use super::{ - DeclaredMatrix, DenseFormat, ExpertMatrix, ExpertRowRequest, InputBindingError, KarExpertSource, KarSourceError, - MoeExpertBlock, ProjectionKind, ProjectionSpec, Q5KProjectionShape, Q6KProjectionShape, ResidualReady, -}; use leleka_cuda_driver::DownColumns; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] mod adaptive_packets; @@ -78,42 +73,28 @@ mod adaptive; mod prepared_moe_row; pub(in crate::qwen_forward) use prepared_moe_row::ChunkFfnLayer; -#[allow(unused_imports)] use prepared_moe_row::grouped_pairs; mod bound_rows; mod execute_bound; -#[allow(unused_imports)] use execute_bound::execute_bound; mod project_group; -#[allow(unused_imports)] use project_group::{ExpertGroup, project_group}; mod packet_run_project_group_direct; mod project_group_shared_fns; mod project_group_source_consumers; mod project_group_source_fenced; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -#[allow(unused_imports)] use project_group_source_consumers::project_group_source_consumers; mod direct_packets_fns; mod ordered_down_refusal; -#[allow(unused_imports)] use ordered_down_refusal::PacketGroupMembers; -#[allow(unused_imports)] use ordered_down_refusal::finish_shared; -#[allow(unused_imports)] use ordered_down_refusal::finish_shared_queued; -#[allow(unused_imports)] use ordered_down_refusal::ordered_down_refusal; -#[allow(unused_imports)] use ordered_down_refusal::use_direct_packets; -#[allow(unused_imports)] use ordered_down_refusal::use_shared_tail; -#[allow(unused_imports)] use ordered_down_refusal::validate_packet_pairs; mod finish_shared_with; -#[allow(unused_imports)] use finish_shared_with::RowTail; -#[allow(unused_imports)] use finish_shared_with::finish_shared_with; -#[allow(unused_imports)] use finish_shared_with::uses_adaptive; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/adaptive_packets.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/adaptive_packets.rs index 0b0d40e6..a2c12a09 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/adaptive_packets.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/adaptive_packets.rs @@ -8,12 +8,10 @@ use super::{ use crate::qwen_forward::cpu_expert_miss::runtime_error; mod adaptive_packet_projection; -#[allow(unused_imports)] pub(super) use adaptive_packet_projection::project_adaptive_packets; mod packet_plan; mod packet_wave; pub(super) use packet_wave::PacketWave; mod packet_wave_projection; -#[allow(unused_imports)] use packet_wave_projection::project_inner; mod gpu_wave_staging; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu.rs index 7adfe339..082188af 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu.rs @@ -1,15 +1,9 @@ //! ONE loaded actual-row transport proof. No source admission, ModelBinding, //! session advancement, standalone Load or full-model qualification is minted. use super::{ - BindingIdentity, BoundExpert, CachedMoeMatrix, ChunkFfnLayer, ChunkFfnRow, CompletedCpuRow, Context, DEVICE_PEAK, - DeclaredMatrix, DenseFormat, DeviceBuffer, DownColumns, DownProvenance, DownScope, DownSelection, DriverError, - Error, ExpertActivation, ExpertGroup, ExpertMatrix, ExpertReady, ExpertRowRequest, FF, GrRole, GrStage, - InputBindingError, K, KarExpertSource, KarSourceError, LayerId, MatrixDims, MmqChunkRequest, ModelBinding, - MoeExpertBlock, MoeExpertSelection, MoeExpertStage, MoeExpertWeights, MoeMatrixKind, MoeMatrixRole, MoeWeightCache, - N, NativePromptFinish, PackedDown, PacketGroupMembers, PreparedMoeRow, ProjectionKind, ProjectionSpec, - Q5KProjectionShape, Q6KProjectionShape, QwenChunkTxn, Rc, ResidualReady, Result, RetainedDown, RoutedExperts, - RoutedFormat, RoutedGateUpQ8, RowTail, SharedTailRow, SourceMatrix, Stage, StepCuda, TokenLayer, TransportBuffer, - download_f32, driver_error, moe_down, validate_values, + ChunkFfnLayer, ChunkFfnRow, Context, DEVICE_PEAK, DeviceBuffer, DownScope, DownSelection, DriverError, Error, + ExpertReady, FF, GrStage, K, LayerId, ModelBinding, MoeExpertStage, MoeWeightCache, N, PreparedMoeRow, QwenChunkTxn, + Rc, Result, Stage, TransportBuffer, download_f32, driver_error, validate_values, }; use crate::qwen_forward::gr::DetachedGrRead; use crate::qwen_forward::session::{QwenStepTxn, ResetReplaySnapshot, chunk::ChunkAttentionRow}; @@ -70,44 +64,21 @@ pub(crate) struct LoadedArms<'a, 'k, 'ctx> { } mod policy; -#[allow(unused_imports)] -use policy::arm_attention_reads; -#[allow(unused_imports)] use policy::arm_chunk_rows; -#[allow(unused_imports)] -use policy::arm_consume_inputs; -#[allow(unused_imports)] -use policy::arm_ffn_rows; -#[allow(unused_imports)] -use policy::arm_prepare_row; -#[allow(unused_imports)] use policy::arm_tokens; -#[allow(unused_imports)] use policy::cancel_probe; -#[allow(unused_imports)] use policy::compare; -#[allow(unused_imports)] pub(super) use policy::copy_completed; -#[allow(unused_imports)] pub(super) use policy::observe_packet; -#[allow(unused_imports)] pub(super) use policy::policy; mod arm; -#[allow(unused_imports)] use arm::arm; -#[allow(unused_imports)] use arm::corrupted_bytes; -#[allow(unused_imports)] use arm::preflight_copy; -#[allow(unused_imports)] use arm::probe_payload; -#[allow(unused_imports)] use arm::refuse_alien_scope; mod probe; -#[allow(unused_imports)] use probe::output_differences; -#[allow(unused_imports)] use probe::same_outputs; -#[allow(unused_imports)] use probe::transport_probe; mod loaded_arms; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/packet_run_project_group_direct.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/packet_run_project_group_direct.rs index ba0e14ad..bf5454de 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/packet_run_project_group_direct.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/packet_run_project_group_direct.rs @@ -2,7 +2,6 @@ //! Methods of `DirectGroup`: `check_descriptors`, `run`, `project_gate_up`, `project_gate_up_role` and 6 more. use super::direct_packets_fns::PacketRun; -#[allow(unused_imports)] use super::project_group_shared_fns::*; use super::{ ActualSlotPacket, CachedMoeMatrix, ChunkFfnRow, Context, DeviceBuffer, DownColumns, DownOrigin, DownScope, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/project_group.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/project_group.rs index ec7e21fb..215642b1 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/project_group.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/project_group.rs @@ -2,7 +2,6 @@ //! Methods of `DownArgs`: `refusal_values`. Functions: `project_group`. use super::packet_run_project_group_direct::{DownProjection, GroupBuffers, RefusalReplay}; -#[allow(unused_imports)] use super::project_group_shared_fns::{ GateUpColumns, check_group_descriptors, close_group_buffers, down_kind_format, down_outcome, gate_up_format, gate_up_plain, hidden_buffer, launch_down_in_workspace, launch_down_plain, prepared_refs, swiglu_into_hidden, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/resident/original_adaptive.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/resident/original_adaptive.rs index 2ecbf600..9f4e03f6 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/resident/original_adaptive.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/resident/original_adaptive.rs @@ -11,7 +11,7 @@ use leleka_cuda_driver::{MmqWorkspace, OriginalMmqLayer}; mod expert_gather; mod layer_walk; use super::resident_layer::{LayerResources, Resident, RoutedGroups}; -use layer_walk::{SlotState, StagingPlan, Walk, WalkOwners}; +use layer_walk::{StagingPlan, Walk, WalkOwners}; pub(super) fn execute_adaptive_groups<'ctx>( resident: &Resident<'_, '_, 'ctx>, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/moe_activation_reuse_gpu.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/moe_activation_reuse_gpu.rs index 037141f6..a738d842 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/moe_activation_reuse_gpu.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/moe_activation_reuse_gpu.rs @@ -62,24 +62,11 @@ fn small_context_refusals(device: &leleka_cuda_driver::Device<'_>) { } mod encoded; -#[allow(unused_imports)] -use encoded::bounded_gate_up; -#[allow(unused_imports)] use encoded::compare_mlp; -#[allow(unused_imports)] -use encoded::down; -#[allow(unused_imports)] use encoded::down_projection; -#[allow(unused_imports)] use encoded::encoded; -#[allow(unused_imports)] -use encoded::exact; -#[allow(unused_imports)] use encoded::format_case; -#[allow(unused_imports)] use encoded::raw; mod former_fixture_domain_refusal; -#[allow(unused_imports)] use former_fixture_domain_refusal::former_fixture_domain_refusal; -#[allow(unused_imports)] use former_fixture_domain_refusal::saturation_and_refusals; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/moe_down/moe_down_reuse_gpu.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/moe_down/moe_down_reuse_gpu.rs index d6d9bb40..66773818 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/moe_down/moe_down_reuse_gpu.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/moe_down/moe_down_reuse_gpu.rs @@ -44,17 +44,10 @@ mod pair; use down_reuse_refusal_rig::Rig; use pair::Env; mod exact; -#[allow(unused_imports)] use exact::down_weights; -#[allow(unused_imports)] use exact::exact; -#[allow(unused_imports)] use exact::original_down; -#[allow(unused_imports)] use exact::project; -#[allow(unused_imports)] use exact::refused; -#[allow(unused_imports)] use exact::retained; -#[allow(unused_imports)] use exact::scalar_weights; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/moe_down/moe_down_reuse_gpu/down_reuse_refusal_rig.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/moe_down/moe_down_reuse_gpu/down_reuse_refusal_rig.rs index e62afd84..a776f6e2 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/moe_down/moe_down_reuse_gpu/down_reuse_refusal_rig.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/moe_down/moe_down_reuse_gpu/down_reuse_refusal_rig.rs @@ -1,6 +1,5 @@ //! The refusal and abort phases of the retained Down proof (one body per phase, STRA-338). -#[allow(unused_imports)] use super::pair::{Env, le_bytes}; use super::{ Cell, Context, DeviceBuffer, DownScope, DownSelection, Error, K, N, PackedDown, Rc, RetainedScalar, ScaledDown, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_prefill_batch.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_prefill_batch.rs index f1626a3a..042fdf14 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_prefill_batch.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_prefill_batch.rs @@ -145,19 +145,11 @@ use route_micro::{ validate_micro, }; mod moe_prefill_resources; -#[allow(unused_imports)] use moe_prefill_resources::admit; -#[allow(unused_imports)] use moe_prefill_resources::down_format; -#[allow(unused_imports)] use moe_prefill_resources::f32_bytes; -#[allow(unused_imports)] use moe_prefill_resources::gate_up_format; -#[allow(unused_imports)] pub(in crate::qwen_forward) use moe_prefill_resources::validate_route_row; mod device_bytes; -#[allow(unused_imports)] use device_bytes::device_bytes; -#[allow(unused_imports)] -use device_bytes::release_pool; mod moe_prefill_stage; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_route.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_route.rs index 627993b3..3a33ab2c 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_route.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_route.rs @@ -93,32 +93,20 @@ mod projection_tests { } mod router_logits; -#[allow(unused_imports)] +#[cfg(test)] use router_logits::admit_projection_budget; -#[allow(unused_imports)] pub(super) use router_logits::validate_activation; mod project_logits; -#[allow(unused_imports)] use project_logits::RouterInput; -#[allow(unused_imports)] use project_logits::binding_error; -#[allow(unused_imports)] +#[cfg(test)] use project_logits::collect_logits; -#[allow(unused_imports)] use project_logits::project_logits; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -#[allow(unused_imports)] pub(super) use project_logits::route_batch_row; -#[allow(unused_imports)] use project_logits::route_with; -#[allow(unused_imports)] -use project_logits::routed_from_raw; -#[allow(unused_imports)] pub(super) use project_logits::validate_logits; -#[allow(unused_imports)] use project_logits::validate_request; mod run_cuda; -#[allow(unused_imports)] pub(super) use run_cuda::map_driver_error; -#[allow(unused_imports)] use run_cuda::run_cuda; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache.rs index 935abee0..b01ff389 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache.rs @@ -36,7 +36,10 @@ mod cache_strata_adaptive; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] pub(in crate::qwen_forward) use cache_original_prompt::PromptWeightOwners; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -pub(crate) use cache_original_prompt::{PREFILL_STREAM_OVERRIDE, set_span_cache_override}; +#[cfg(test)] +pub(crate) use cache_original_prompt::PREFILL_STREAM_OVERRIDE; +#[cfg(test)] +pub(crate) use cache_original_prompt::set_span_cache_override; pub(crate) use cache_profile::{LearnedMainWitness, SharedPermanentWitness}; pub(crate) use cache_strata_adaptive::AdaptiveWitness; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] @@ -344,23 +347,16 @@ mod original_mtp_weights; pub(in crate::qwen_forward) use original_mtp_weights::{MtpHeadSources, RetainedOriginalMtpWeights}; mod validate_ranked_profile; -#[allow(unused_imports)] // pinning and the epoch are read by the decode graph reuse, which the stack does not wire yet #[allow(dead_code)] mod window_pins; use validate_ranked_profile::dual_layout; -#[allow(unused_imports)] use validate_ranked_profile::integer_iq3_triplet; -#[allow(unused_imports)] pub(super) use validate_ranked_profile::oldest_weight; -#[allow(unused_imports)] pub(in crate::qwen_forward) use validate_ranked_profile::original_dual_layout; -#[allow(unused_imports)] use validate_ranked_profile::original_mmq_triplet; -#[allow(unused_imports)] pub(super) use validate_ranked_profile::room_fits; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -#[allow(unused_imports)] pub(crate) use validate_ranked_profile::validate_ranked_profile; mod moe_cache_routed_owners; mod moe_weight_cache_methods; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_ephemeral_routed.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_ephemeral_routed.rs index 320f3e75..7d388dda 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_ephemeral_routed.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_ephemeral_routed.rs @@ -116,17 +116,11 @@ struct MappedStage<'ctx> { } mod healthy_cancel; -#[allow(unused_imports)] use healthy_cancel::close_buffers; -#[allow(unused_imports)] use healthy_cancel::close_slot; -#[allow(unused_imports)] use healthy_cancel::combine; -#[allow(unused_imports)] use healthy_cancel::empty_slot; -#[allow(unused_imports)] use healthy_cancel::healthy_cancel; -#[allow(unused_imports)] pub(in crate::qwen_forward) use healthy_cancel::observe_cancel; mod ephemeral_mapped_stage; mod ephemeral_routed_owner; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_lru_index.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_lru_index.rs index 9fbce35c..42cbba7b 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_lru_index.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_lru_index.rs @@ -33,7 +33,6 @@ pub(super) struct PreparedUpdates { mod tests; mod slot; -#[allow(unused_imports)] use slot::slot; mod lru_index; mod lru_index_seeding; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_original_prompt.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_original_prompt.rs index 113f1bd9..3b405012 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_original_prompt.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_original_prompt.rs @@ -16,13 +16,10 @@ pub static PREFILL_STREAM_OVERRIDE: std::sync::atomic::AtomicI8 = std::sync::ato static SPAN_CACHE_OVERRIDE: std::sync::atomic::AtomicI8 = std::sync::atomic::AtomicI8::new(-1); mod prompt_stream_settings; -#[allow(unused_imports)] use prompt_stream_settings::native_format; -#[allow(unused_imports)] use prompt_stream_settings::prompt_stream_settings; -#[allow(unused_imports)] +#[cfg(test)] pub(crate) use prompt_stream_settings::set_span_cache_override; -#[allow(unused_imports)] pub(crate) use prompt_stream_settings::span_cache_enabled; mod moe_weight_cache; mod moe_weights_original_prompt; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_original_prompt/moe_weights_original_prompt.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_original_prompt/moe_weights_original_prompt.rs index 5375eaef..2986fa32 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_original_prompt/moe_weights_original_prompt.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_original_prompt/moe_weights_original_prompt.rs @@ -1,7 +1,6 @@ //! Methods of `MoeWeightCache`: `original_prompt_moe`, `original_prompt_parts`, `original_prompt_precheck`. //! Functions: `raw_weight`, `shared_formats`, `shared_weights`. -#[allow(unused_imports)] use super::prompt_layer_fns::{PromptIo, PromptParts, PromptWeightOwners, SpanScan, run_prompt_layer}; use super::{ DenseWeightCache, DeviceBuffer, EncodedWeight, Entry, Error, GdnNativeFormat, HashMap, LayerId, ModelBinding, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile.rs index 8ba38ed7..fe770862 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile.rs @@ -126,7 +126,5 @@ mod learned_main_sdet; mod ranked_profile; mod shared_permanent_pool; -#[allow(unused_imports)] pub(super) use shared_permanent_pool::learned_main_slot_bound; -#[allow(unused_imports)] pub(super) use shared_permanent_pool::remaining_shared_main; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill.rs index 644c1ba9..dcf4b789 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill.rs @@ -1,13 +1,8 @@ //! Binding-authenticated constructor; metadata alone cannot produce weights. use super::{ - AdaptiveWitness, BindingIdentity, BoundExpert, Cell, Context, DeviceBuffer, DeviceRef, EncodedWeight, Entry, Error, - FixedMtpWeights, HashMap, LearnedMainWitness, LruIndex, MAIN_LIMIT, MmqChunkRequest, MmqFormat, MmqWeights, - MmqWorkspace, ModelBinding, MoeExpertSelection, MoeExpertWeights, MoeMatrixRole, MoeWeightCache, - MoeWeightDescriptor, MtpExpertPicks, MtpHeadSources, MtpInputWorkspace, MtpKind, MtpKvClaim, MtpKvResident, - MtpRole, MtpStepSite, PREFILL_STREAM_OVERRIDE, PendingMtpKv, PreparedUpdates, PromptWeightOwners, Rc, RefCell, - Result, RetainedOriginalMtpWeights, RoutedFiniteStage, RoutedGroupWorkspace, RoutedStageFiniteGuard, SharedKeys, - SharedPermanentWitness, SharedTailRow, SharedWeightsRequest, SourceMatrix, TripletLoanRequest, WORKING_RESERVE, - WeightCacheCounters, binding_error, cache_profile, cache_strata_adaptive, driver_error, + Context, DeviceBuffer, DeviceRef, EncodedWeight, Entry, Error, HashMap, MAIN_LIMIT, ModelBinding, MoeMatrixRole, + MoeWeightCache, MoeWeightDescriptor, Rc, RefCell, Result, WORKING_RESERVE, WeightCacheCounters, binding_error, + cache_profile, cache_strata_adaptive, driver_error, }; #[cfg(test)] use super::room_fits; @@ -181,9 +176,8 @@ mod reusable_spill_floor_planning { mod moe_weight_cache; mod profile_window_spill; -#[allow(unused_imports)] +#[cfg(test)] use profile_window_spill::profile_window_spill; -#[allow(unused_imports)] use profile_window_spill::profile_window_spill_with_floor; mod learned_main_lru_profile; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/learned_main_lru_profile.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/learned_main_lru_profile.rs index c290e0d0..8181c72a 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/learned_main_lru_profile.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/learned_main_lru_profile.rs @@ -1,7 +1,6 @@ //! Methods of `MoeWeightCache`: `new_profile_shared_permanent_learned_main_lru`, `learned_main_totals`, `check_learn... //! Split out of `cache_profile_fill` to keep its files under the line limit. -#[allow(unused_imports)] #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] use super::profile_build::{ProfileFile, ProfileKind, ProfileRequest}; use super::{ diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/moe_weight_cache.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/moe_weight_cache.rs index 7786e9cd..e6164ae8 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/moe_weight_cache.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/moe_weight_cache.rs @@ -2,15 +2,9 @@ //! Split out of `cache_profile_fill` to keep its files under the line limit. use super::{ - AdaptiveWitness, BindingIdentity, BoundExpert, Cell, Context, DeviceBuffer, DeviceRef, EncodedWeight, Entry, Error, - FixedMtpWeights, HOST_CAP, HashMap, LearnedMainWitness, LruIndex, MAIN_LIMIT, MmqChunkRequest, MmqFormat, - MmqWeights, MmqWorkspace, ModelBinding, MoeExpertSelection, MoeExpertWeights, MoeMatrixRole, MoeWeightCache, - MoeWeightDescriptor, MtpExpertPicks, MtpHeadSources, MtpInputWorkspace, MtpKind, MtpKvClaim, MtpKvResident, - MtpRole, MtpStepSite, PREFILL_STREAM_OVERRIDE, PROFILE_SHA, PendingMtpKv, PinnedPool, PrefixPlan, PreparedUpdates, - ProfileLimits, PromptWeightOwners, RankedProfile, Rc, RefCell, Result, RetainedOriginalMtpWeights, - RoutedFiniteStage, RoutedGroupWorkspace, RoutedStageFiniteGuard, SharedKeys, SharedPermanentWitness, SharedTailRow, - SharedWeightsRequest, SourceMatrix, TripletLoanRequest, WORKING_RESERVE, binding_error, driver_error, - profile_window_spill_with_floor, + Context, DeviceRef, EncodedWeight, Entry, Error, HOST_CAP, HashMap, MAIN_LIMIT, ModelBinding, MoeMatrixRole, + MoeWeightCache, MoeWeightDescriptor, PROFILE_SHA, PinnedPool, PrefixPlan, ProfileLimits, RankedProfile, Result, + WORKING_RESERVE, binding_error, driver_error, profile_window_spill_with_floor, }; #[cfg(test)] use super::ProfileWitness; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/shared_quartet_preload.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/shared_quartet_preload.rs index 9120d462..ce98641a 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/shared_quartet_preload.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/shared_quartet_preload.rs @@ -1,8 +1,8 @@ //! Methods of `MoeWeightCache`: `new_native_integer_iq3_mmq_retained_mtp_kv_shared_tail_profile_mtp_input_spill_floo... //! Defines `QuartetRoom`. -#[allow(unused_imports)] #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] +#[cfg(test)] use super::profile_build::{ProfileFile, ProfileKind, ProfileRequest}; use super::{ DeviceRef, EncodedWeight, Entry, Error, MAIN_LIMIT, ModelBinding, MoeWeightCache, MoeWeightDescriptor, Result, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/strata_adaptive_shared_pool.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/strata_adaptive_shared_pool.rs index ef7b0b56..0a850b46 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/strata_adaptive_shared_pool.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/strata_adaptive_shared_pool.rs @@ -1,7 +1,6 @@ //! Methods of `MoeWeightCache`: `new_native_strata_adaptive_shared_permanent`, `new_native_strata_adaptive_shared_pe... //! Functions: `adaptive_template`. Defines `AdaptivePlan`, `SharedKeys`. -#[allow(unused_imports)] use super::profile_build::ProfileFile; use super::{ Context, DeviceBuffer, Entry, Error, HOST_CAP, HashMap, MAIN_LIMIT, ModelBinding, MoeMatrixRole, MoeWeightCache, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_strata_adaptive.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_strata_adaptive.rs index 1dba08b1..fe0e91c5 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_strata_adaptive.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_strata_adaptive.rs @@ -94,13 +94,9 @@ pub(crate) struct AdaptiveWitness { } mod reserve; -#[allow(unused_imports)] use reserve::blob_bytes; -#[allow(unused_imports)] use reserve::cell; -#[allow(unused_imports)] use reserve::reserve; mod adaptive_cache; mod transfer_metadata_bound; -#[allow(unused_imports)] pub(super) use transfer_metadata_bound::transfer_metadata_bound; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/original_mtp_weights.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/original_mtp_weights.rs index ead074b1..e374c61c 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/original_mtp_weights.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/original_mtp_weights.rs @@ -161,8 +161,8 @@ mod share_tests { } mod dense_copies_equal; -#[allow(unused_imports)] +#[cfg(test)] use dense_copies_equal::dense_copies_equal; mod retained_original_mtp_weights; -#[allow(unused_imports)] +#[cfg(test)] use retained_original_mtp_weights::rt_kind; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/window_pins.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/window_pins.rs index 641d4d0b..0ed355a2 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/window_pins.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/window_pins.rs @@ -7,15 +7,7 @@ //! `window_keys` remembers which entries a window reads; freeing one of them (only possible while unpinned) and //! releasing the pins both bump `weights_epoch`, which is part of the graph key, so a set recorded before is retired. //! Everything is `&self` (cells): the assembly holds the cache by shared reference while a request runs. -use super::{ - AdaptiveWitness, BindingIdentity, BoundExpert, Cell, Context, DeviceBuffer, DeviceRef, Error, FixedMtpWeights, - HashMap, LearnedMainWitness, LruIndex, MmqChunkRequest, MmqFormat, MmqWeights, MmqWorkspace, ModelBinding, - MoeExpertSelection, MoeExpertWeights, MoeMatrixRole, MoeWeightCache, MoeWeightDescriptor, MtpExpertPicks, - MtpHeadSources, MtpInputWorkspace, MtpKind, MtpKvClaim, MtpKvResident, MtpRole, MtpStepSite, - PREFILL_STREAM_OVERRIDE, PendingMtpKv, PreparedUpdates, PromptWeightOwners, Rc, RefCell, Result, - RetainedOriginalMtpWeights, RoutedFiniteStage, RoutedGroupWorkspace, RoutedStageFiniteGuard, SharedKeys, - SharedPermanentWitness, SharedTailRow, SharedWeightsRequest, SourceMatrix, TripletLoanRequest, window_pins, -}; +use super::{Error, MoeWeightCache, MoeWeightDescriptor, Result}; /// The entries a window reads, and whether the cache currently protects them. #[derive(Default)] diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp.rs index 8c558b12..edc56c6f 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp.rs @@ -61,31 +61,15 @@ pub(super) struct MtpFinalMixed { } mod mtp_frame; -#[allow(unused_imports)] -use mtp_frame::input_refusal; -#[allow(unused_imports)] -use mtp_frame::queued_fc_shape; mod step; -#[allow(unused_imports)] pub(super) use step::f32_weights; -#[allow(unused_imports)] use step::norm; -#[allow(unused_imports)] pub(super) use step::preflight; -#[allow(unused_imports)] pub(super) use step::project; -#[allow(unused_imports)] pub(super) use step::project_attention_output; -#[allow(unused_imports)] pub(super) use step::reserve; -#[allow(unused_imports)] pub(super) use step::step; -#[allow(unused_imports)] -use step::step_core; -#[allow(unused_imports)] pub(super) use step::warm_chunk_row; -#[allow(unused_imports)] pub(super) use step::warm_step; mod project_attention_out_numeric; -#[allow(unused_imports)] pub(super) use project_attention_out_numeric::project_attention_out_numeric; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state.rs index 4851c332..f93f0683 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state.rs @@ -72,9 +72,7 @@ pub(in crate::qwen_forward) struct RetainedFirstSeed { mod tests; mod dense_kv; -#[allow(unused_imports)] use dense_kv::validate_half; mod mtp_session; mod prefix_draft_snapshot; -#[allow(unused_imports)] use prefix_draft_snapshot::first_seed_retained_charge; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/chunk.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/chunk.rs index 3d08bed3..f9eea1af 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/chunk.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/chunk.rs @@ -4,7 +4,7 @@ use super::{Error, MtpSession, Rc, Result, TargetStepOrigin}; use crate::model_binding::qwen4exp_input::ModelBinding; use crate::qwen_forward::{ - contract::{Dimension, Position}, + contract::Position, session::{QwenSession, chunk::QwenChunkTxn}, }; @@ -219,6 +219,6 @@ mod branch_refusal { } mod checked_chunk_end; -#[allow(unused_imports)] +#[cfg(test)] use checked_chunk_end::checked_chunk_end; mod mtp_session; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_attention.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_attention.rs index e1fcfec6..62e74d52 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_attention.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_attention.rs @@ -90,39 +90,17 @@ mod reuse_gpu_tests; mod tests; mod attention_stage; -#[allow(unused_imports)] pub(super) use attention_stage::produce_kv_cell; mod attention_transport; -#[allow(unused_imports)] use attention_transport::attend_retained; -#[allow(unused_imports)] use attention_transport::attend_ring_retained; -#[allow(unused_imports)] use attention_transport::attention_driver_error; -#[allow(unused_imports)] use attention_transport::close_transport; -#[allow(unused_imports)] use attention_transport::gate_retained; -#[allow(unused_imports)] -use attention_transport::note_transport; -#[allow(unused_imports)] use attention_transport::release_transport; -#[allow(unused_imports)] -use attention_transport::upload_transport; -#[allow(unused_imports)] -use attention_transport::upload_transport_f32; mod dense_geometry; -#[allow(unused_imports)] -use dense_geometry::apply_gate; -#[allow(unused_imports)] -use dense_geometry::attend; -#[allow(unused_imports)] use dense_geometry::geometry; -#[allow(unused_imports)] use dense_geometry::norm_rope; -#[allow(unused_imports)] use dense_geometry::pack_kv; -#[allow(unused_imports)] use dense_geometry::split; -#[allow(unused_imports)] use dense_geometry::validate_window; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_attention/reuse_gpu_tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_attention/reuse_gpu_tests.rs index 5aea608e..58a07d22 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_attention/reuse_gpu_tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_attention/reuse_gpu_tests.rs @@ -1,10 +1,8 @@ //! New retained attention transport proof; no model/provider capability fixture. #![cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] use super::{ - Cell, Context, DenseGeometry, DenseKv, DeviceBuffer, Error, KvWindow, ModelBinding, MoeWeightCache, - MtpAttentionRead, MtpFrame, MtpKind, MtpRole, MtpSession, Q, QwenSession, Rc, Result, RetainedAttended, - RetainedGated, Stage, allocate, attend, attend_retained, download, gate_retained, geometry, release, upload, - upload_bytes, + Cell, Context, DenseGeometry, DeviceBuffer, Error, KvWindow, Q, Rc, RetainedAttended, RetainedGated, allocate, + attend_retained, download, gate_retained, geometry, release, upload, upload_bytes, }; use leleka_cuda_driver::{DenseFormat, Driver, ProjectionKind, ProjectionSpec}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_attention/reuse_gpu_tests/phases.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_attention/reuse_gpu_tests/phases.rs index ce1f9e04..4ba4a4d3 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_attention/reuse_gpu_tests/phases.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_attention/reuse_gpu_tests/phases.rs @@ -4,12 +4,6 @@ use super::{ AttendInput, Cell, Context, DenseGeometry, DeviceBuffer, Error, KvWindow, Q, Rc, RetainedAttended, RetainedGated, attend_retained, exact, gate_retained, geometry, half_kv, original_transfer_chain, out_weights, upload_bytes, }; -// used only with some cargo features of this crate -#[allow(unused_imports)] -use super::{ - DenseFormat, DenseKv, Driver, ModelBinding, MoeWeightCache, MtpAttentionRead, MtpFrame, MtpKind, MtpRole, - MtpSession, ProjectionKind, ProjectionSpec, QwenSession, Result, Stage, attend, release, -}; /// One context and the shared failure bit every phase works against. pub(super) struct Env<'c> { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode.rs index 563a790b..6ca94e7f 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode.rs @@ -40,7 +40,6 @@ pub(crate) struct MtpDecoder { kv_prefill_host_charge: usize, } mod chunk; -pub(in crate::qwen_forward) use chunk::ReadyMtpChunk; #[cfg(test)] mod tests { @@ -179,17 +178,12 @@ mod batched_caller_tests { pub(in crate::qwen_forward) mod batch_gpu; mod mtp_window_spec; -#[allow(unused_imports)] use mtp_window_spec::kv_prefill_host_charge; mod first_seed_reuse_enabled; mod mtp_decoder; mod window_request; -#[allow(unused_imports)] use first_seed_reuse_enabled::first_seed_reuse_enabled; -#[allow(unused_imports)] use first_seed_reuse_enabled::needed_draft_predictions; -#[allow(unused_imports)] use first_seed_reuse_enabled::window_limit; -#[allow(unused_imports)] use first_seed_reuse_enabled::window_stage_error; pub(crate) use window_request::{DraftHeadOwners, MtpWindowRequest, WindowOwners}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu.rs index 14c39eb8..6d4005a3 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu.rs @@ -1,10 +1,8 @@ //! ONE authentic changed MTP boundary. Root schedules this ignored entry only. //! Full heads/state stay private; output contains counts and predicates only. use super::{ - DenseWeightCache, Dimension, DraftHeadOwners, Error, KarPleCache, KnownNext, ModelBinding, MoeWeightCache, - MtpDecoder, MtpInput, MtpSession, MtpWindowError, MtpWindowRequest, MtpWindowSpec, OutputStage, Position, - PrefillStepProduct, QwenForward, QwenSession, ReadyMtpChunk, Result, StepSessions, TargetStepProduct, TokenId, - VerificationChunk, VerificationSource, WindowCaches, WindowOwners, mtp, + DenseWeightCache, Dimension, Error, KarPleCache, ModelBinding, MoeWeightCache, MtpDecoder, MtpWindowError, + MtpWindowSpec, OutputStage, Position, QwenForward, QwenSession, Result, TargetStepProduct, TokenId, mtp, }; use crate::model_binding::qwen4exp_kar_ple::InheritedKarArchive; use crate::qwen_forward::contract::Stage; @@ -160,22 +158,13 @@ fn authentic_scalar_first_mtp_batch_prefix_rejection_cancel_and_cleanup() { print_report(&report); } mod collection; -#[allow(unused_imports)] pub(in crate::qwen_forward) use collection::after_joint_publish; -#[allow(unused_imports)] pub(in crate::qwen_forward) use collection::collect_head; -#[allow(unused_imports)] pub(in crate::qwen_forward) use collection::collect_row; -#[allow(unused_imports)] pub(in crate::qwen_forward) use collection::collecting; -#[allow(unused_imports)] use collection::different_token; -#[allow(unused_imports)] use collection::observe; -#[allow(unused_imports)] use collection::path; -#[allow(unused_imports)] use collection::row_matches; mod check_loaded; -#[allow(unused_imports)] use check_loaded::{Shared, check_loaded}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu/check_loaded.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu/check_loaded.rs index 166de95f..745ca460 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu/check_loaded.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu/check_loaded.rs @@ -2,17 +2,11 @@ //! Split out of `batch_gpu` to keep its files under the line limit. use super::{ - AssertUnwindSafe, Collection, DenseWeightCache, Dimension, DraftHeadOwners, Driver, Error, Expected, - InheritedKarArchive, KarPleCache, KnownNext, ModelBinding, MoeWeightCache, MtpDecoder, MtpInput, MtpSession, - MtpWindowError, MtpWindowRequest, MtpWindowSpec, OutputStage, PathBuf, Position, PostcommitCancellation, - PrefillStepProduct, Qwen4ExpArtifact, QwenForward, QwenSession, ROW_CAP, Rc, ReadyMtpChunk, RefCell, Report, - ResetReplaySnapshot, Result, SNAPSHOT_CAP, Stage, StepSessions, TRANSACTION_CAP, TargetStepProduct, TokenId, VOCAB, - VerificationChunk, VerificationSource, VerifiedGgufFile, WindowCaches, WindowOwners, collection, different_token, - mtp, observe, row_matches, + Collection, DenseWeightCache, Dimension, Error, Expected, KarPleCache, ModelBinding, MoeWeightCache, MtpDecoder, + MtpWindowError, MtpWindowSpec, OutputStage, Position, PostcommitCancellation, QwenForward, QwenSession, ROW_CAP, Rc, + Report, ResetReplaySnapshot, Result, SNAPSHOT_CAP, Stage, TRANSACTION_CAP, TargetStepProduct, TokenId, VOCAB, + different_token, mtp, observe, row_matches, }; -// used only with some cargo features of this crate -#[allow(unused_imports)] -use super::path; use crate::qwen_forward::mtp_decode::MtpVerifiedWindow; /// The window preparation of one flow against the candidate cache. The prepared window borrows the target session @@ -85,11 +79,7 @@ struct Flow<'a, 'ctx, 'o, 'p, 'k, 'd> { } mod position_at; -#[allow(unused_imports)] use position_at::admit_binding; -#[allow(unused_imports)] -use position_at::position_at; mod flow; mod flow_decode_edge_scenarios; -#[allow(unused_imports)] pub(super) use flow_decode_edge_scenarios::check_loaded; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu/check_loaded/flow.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu/check_loaded/flow.rs index 63835492..91589bdb 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu/check_loaded/flow.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu/check_loaded/flow.rs @@ -6,14 +6,6 @@ use super::{ PostcommitCancellation, Prefix, QwenForward, Refs, ResetReplaySnapshot, Result, Stage, TRANSACTION_CAP, TargetStepProduct, TokenId, VOCAB, different_token, mtp, observe, row_matches, }; -// used only with some cargo features of this crate -#[allow(unused_imports)] -use super::{ - AssertUnwindSafe, DenseWeightCache, Dimension, DraftHeadOwners, Driver, InheritedKarArchive, KarPleCache, - ModelBinding, MtpInput, MtpSession, MtpVerifiedWindow, MtpWindowRequest, OutputStage, PathBuf, Position, - PrefillStepProduct, Qwen4ExpArtifact, QwenSession, Rc, ReadyMtpChunk, RefCell, Shared, StepSessions, - VerificationChunk, VerificationSource, VerifiedGgufFile, WindowCaches, WindowOwners, collection, flow, -}; use crate::qwen_forward::mtp::KnownNext; /// What the cancelled T3 window is compared with: the reference tokens, the two accepted row expectations and the tail diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu/check_loaded/flow_decode_edge_scenarios.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu/check_loaded/flow_decode_edge_scenarios.rs index 1552af05..afa75bc8 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu/check_loaded/flow_decode_edge_scenarios.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu/check_loaded/flow_decode_edge_scenarios.rs @@ -5,14 +5,6 @@ use super::{ Chain, Collection, Expected, Flow, MoeWeightCache, MtpDecoder, MtpWindowSpec, QwenForward, Rc, Refs, Report, ResetReplaySnapshot, Shared, TRANSACTION_CAP, TargetStepProduct, TokenId, VOCAB, admit_binding, mtp, row_matches, }; -// used only with some cargo features of this crate -#[allow(unused_imports)] -use super::{ - AssertUnwindSafe, DenseWeightCache, Dimension, DraftHeadOwners, Driver, Error, InheritedKarArchive, KarPleCache, - KnownNext, ModelBinding, MtpInput, MtpSession, MtpVerifiedWindow, MtpWindowRequest, OutputStage, PathBuf, Position, - PrefillStepProduct, Qwen4ExpArtifact, QwenSession, ReadyMtpChunk, RefCell, Result, Stage, StepSessions, - VerificationChunk, VerificationSource, VerifiedGgufFile, WindowCaches, WindowOwners, collection, flow, -}; impl<'ctx> Flow<'_, 'ctx, '_, '_, '_, '_> { /// Automatic full restore invalidates the consumed source. Recover via diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu/check_loaded/position_at.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu/check_loaded/position_at.rs index b8cc98e0..240090a4 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu/check_loaded/position_at.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu/check_loaded/position_at.rs @@ -6,14 +6,6 @@ use super::{ Position, QwenForward, QwenSession, ROW_CAP, Rc, Report, Result, SNAPSHOT_CAP, Shared, TRANSACTION_CAP, TargetStepProduct, TokenId, VOCAB, }; -// used only with some cargo features of this crate -#[allow(unused_imports)] -use super::{ - AssertUnwindSafe, DenseWeightCache, DraftHeadOwners, Driver, Error, InheritedKarArchive, KarPleCache, KnownNext, - MtpInput, MtpSession, OutputStage, PathBuf, PrefillStepProduct, Qwen4ExpArtifact, ReadyMtpChunk, RefCell, - ResetReplaySnapshot, Stage, StepSessions, VerificationChunk, VerificationSource, VerifiedGgufFile, WindowCaches, - flow, -}; use crate::qwen_forward::executor::{StepCaches, StepRequest}; use crate::qwen_forward::mtp_decode::{MtpWindowRequest, WindowOwners}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu/collection.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu/collection.rs index c76cd619..a7e11f07 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu/collection.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu/collection.rs @@ -6,14 +6,6 @@ use super::{ PathBuf, Position, PostcommitCancellation, QwenSession, ROW_CAP, Rc, Report, ResetReplaySnapshot, Result, RowObservation, TargetStepProduct, TokenId, VOCAB, env, }; -// used only with some cargo features of this crate -#[allow(unused_imports)] -use super::{ - AssertUnwindSafe, DenseWeightCache, DraftHeadOwners, Driver, InheritedKarArchive, KarPleCache, KnownNext, - MoeWeightCache, MtpInput, MtpSession, MtpWindowRequest, PrefillStepProduct, Qwen4ExpArtifact, QwenForward, - ReadyMtpChunk, RefCell, Shared, Stage, StepSessions, VerificationChunk, VerificationSource, VerifiedGgufFile, - WindowCaches, WindowOwners, -}; impl Collection { pub(super) fn begin(count: usize) -> Result { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/mtp_decoder.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/mtp_decoder.rs index 26821682..e7f5b514 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/mtp_decoder.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/mtp_decoder.rs @@ -2,11 +2,11 @@ //! draft warm-up. Separate from `mtp_decode`, which holds the decoder itself. use super::{ - DenseWeightCache, Dimension, DraftHeadOwners, Error, KarPleCache, KnownNext, ModelBinding, MoeWeightCache, - MtpDecoder, MtpInput, MtpSession, MtpVerifiedWindow, MtpWindowError, MtpWindowRequest, MtpWindowSpec, OutputStage, - Position, PrefillStepProduct, QwenForward, QwenSession, ReadyMtpChunk, Result, StepSessions, TargetStepProduct, - TokenId, VerificationChunk, VerificationSource, WindowCaches, WindowOwners, first_seed_reuse_enabled, - kv_prefill_host_charge, mtp, needed_draft_predictions, reserve, window_limit, window_stage_error, + DenseWeightCache, Dimension, DraftHeadOwners, Error, KnownNext, ModelBinding, MoeWeightCache, MtpDecoder, MtpInput, + MtpSession, MtpVerifiedWindow, MtpWindowError, MtpWindowRequest, MtpWindowSpec, OutputStage, Position, + PrefillStepProduct, QwenForward, QwenSession, Result, StepSessions, TargetStepProduct, TokenId, VerificationChunk, + VerificationSource, WindowCaches, WindowOwners, first_seed_reuse_enabled, kv_prefill_host_charge, mtp, + needed_draft_predictions, reserve, window_limit, window_stage_error, }; #[cfg(all(test, target_arch = "x86_64"))] use super::batch_gpu; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts.rs index f67cecca..30b7654c 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts.rs @@ -42,41 +42,13 @@ struct S2Tile { mod tests; mod mtp_block; -#[allow(unused_imports)] -use mtp_block::admit_input; -#[allow(unused_imports)] -use mtp_block::compose_bound; -#[allow(unused_imports)] use mtp_block::moe_driver_error; -#[allow(unused_imports)] -use mtp_block::route_mixed; -#[allow(unused_imports)] use mtp_block::validate_route; mod routed_and_shared_experts; -#[allow(unused_imports)] -use routed_and_shared_experts::combine_uploaded; -#[allow(unused_imports)] -use routed_and_shared_experts::compose; -#[allow(unused_imports)] +#[cfg(test)] use routed_and_shared_experts::down_tile; -#[allow(unused_imports)] +#[cfg(test)] use routed_and_shared_experts::gate_up_tile; -#[allow(unused_imports)] use routed_and_shared_experts::route; -#[allow(unused_imports)] -use routed_and_shared_experts::routed; -#[allow(unused_imports)] -use routed_and_shared_experts::routed_down; -#[allow(unused_imports)] -use routed_and_shared_experts::routed_hidden; -#[allow(unused_imports)] -use routed_and_shared_experts::routed_parts; -#[allow(unused_imports)] -use routed_and_shared_experts::scale_shared; -#[allow(unused_imports)] -use routed_and_shared_experts::shared; -#[allow(unused_imports)] -use routed_and_shared_experts::shared_hidden; mod append_row; -#[allow(unused_imports)] use append_row::append_row; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace.rs index ad77714f..0dcaef85 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace.rs @@ -130,16 +130,8 @@ mod fixed_workspace_gpu; mod role; mod transport_drop; -#[allow(unused_imports)] use transport_drop::at; -#[allow(unused_imports)] use transport_drop::compose; -#[allow(unused_imports)] +#[cfg(test)] use transport_drop::compose_inner; -#[allow(unused_imports)] -use transport_drop::routed; -#[allow(unused_imports)] -use transport_drop::shared; -#[allow(unused_imports)] -use transport_drop::shared_project; mod fixed_buffers; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace/fixed_workspace_gpu.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace/fixed_workspace_gpu.rs index 1fcbda9f..08e23edf 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace/fixed_workspace_gpu.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace/fixed_workspace_gpu.rs @@ -2,9 +2,8 @@ use super::super::mtp_expert_transport::{ExpertWeights, FixedReference, SelectedRoute, fixed_reference}; use super::{ - ALLOCATED_BYTES, BindingIdentity, CHARGES, Cell, Context, DEVICE_PEAK, DenseFormat, DeviceBuffer, Error, - ExpertInputs, FF, FixedBuffers, K, ModelBinding, MtpFrame, N, ProjectionKind, ProjectionSpec, QwenSession, Rc, - Result, Role, Slot, Transport, at, compose, compose_inner, download, moe_driver_error, role, shared, + ALLOCATED_BYTES, CHARGES, Cell, Context, DeviceBuffer, Error, ExpertInputs, FF, FixedBuffers, K, N, Rc, Result, + Role, Slot, Transport, at, compose, compose_inner, download, moe_driver_error, }; #[cfg(all(test, target_arch = "x86_64"))] use super::ObservedOutput; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/mtp_expert_transport.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/mtp_expert_transport.rs index 609bc5a5..1bc66791 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/mtp_expert_transport.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/mtp_expert_transport.rs @@ -55,22 +55,15 @@ mod mtp_expert_transport_gpu; pub(super) type FixedReference = (Box<[f32]>, Vec<(String, Box<[f32]>)>); mod role; -#[allow(unused_imports)] use role::at; -#[allow(unused_imports)] use role::{RoutedExpert, routed}; mod shared_project; -#[allow(unused_imports)] -use shared_project::compose_inner; #[cfg(test)] -#[allow(unused_imports)] use shared_project::compose_observed; #[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -#[allow(unused_imports)] pub(super) use shared_project::fixed_reference; -#[allow(unused_imports)] +#[cfg(test)] use shared_project::shared; -#[allow(unused_imports)] +#[cfg(test)] use shared_project::shared_project; -#[allow(unused_imports)] pub(super) use shared_project::{ExpertWeights, SelectedRoute, compose}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/mtp_expert_transport/mtp_expert_transport_gpu.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/mtp_expert_transport/mtp_expert_transport_gpu.rs index 6f6fd5d8..c02d7bfb 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/mtp_expert_transport/mtp_expert_transport_gpu.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/mtp_expert_transport/mtp_expert_transport_gpu.rs @@ -80,22 +80,11 @@ impl<'c> Fixture<'c> { mod phases; use phases::Env; mod exact; -#[allow(unused_imports)] use exact::bank_fixture; -#[allow(unused_imports)] use exact::bytes; -#[allow(unused_imports)] -use exact::exact; -#[allow(unused_imports)] use exact::matrix; -#[allow(unused_imports)] use exact::original; -#[allow(unused_imports)] -use exact::original_project; -#[allow(unused_imports)] use exact::refusal; -#[allow(unused_imports)] use exact::scalar_matrix; -#[allow(unused_imports)] use exact::unchanged; mod owner_guards; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_gr.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_gr.rs index 884ab4ce..d570d6cd 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_gr.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_gr.rs @@ -58,24 +58,9 @@ struct Candidate { } mod driver_error; -#[allow(unused_imports)] use driver_error::admit_role; -#[allow(unused_imports)] pub(super) use driver_error::attention_read; -#[allow(unused_imports)] use driver_error::driver_error; -#[allow(unused_imports)] -use driver_error::fused; -#[allow(unused_imports)] pub(super) use driver_error::mlp_read; mod finalize; -#[allow(unused_imports)] -use finalize::down_silu; -#[allow(unused_imports)] -use finalize::final_gate; -#[allow(unused_imports)] pub(super) use finalize::finalize; -#[allow(unused_imports)] -use finalize::finalize_legacy; -#[allow(unused_imports)] -use finalize::inject_residual; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_mtp_full_owner.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_mtp_full_owner.rs index e22db6e9..a6da3fbe 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_mtp_full_owner.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_mtp_full_owner.rs @@ -126,11 +126,8 @@ mod tests { } mod original_mtp_request; -#[allow(unused_imports)] use original_mtp_request::capture_of; -#[allow(unused_imports)] use original_mtp_request::plan_error; mod mtp_full_owner_actor_close; mod original_mtp_full_owner_methods; -#[allow(unused_imports)] use mtp_full_owner_actor_close::driver_error; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_mtp_verified_adapter.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_mtp_verified_adapter.rs index 9e1d3ea3..024f2d3d 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_mtp_verified_adapter.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_mtp_verified_adapter.rs @@ -90,5 +90,4 @@ pub(in crate::qwen_forward) struct DraftLaunch<'a, 'ctx> { mod driver_error; mod original_mtp_draft_receipt; mod original_prompt_executor; -#[allow(unused_imports)] use driver_error::driver_error; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine.rs index e94cad2b..77022ece 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine.rs @@ -199,7 +199,4 @@ mod tests; mod draft_completion; mod round_tally; -#[allow(unused_imports)] -use round_tally::tr_port; -#[allow(unused_imports)] pub(crate) use round_tally::{ServeCallbacks, SpeculativeRequest, serve_request}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/round_tally.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/round_tally.rs index 70e0382d..5e5b0d8a 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/round_tally.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/round_tally.rs @@ -17,12 +17,6 @@ struct RoundTally { mod first_draft_engine_for_serve_engine; mod original_serve_settings; -#[allow(unused_imports)] pub(crate) use original_serve_settings::{ServeCallbacks, SpeculativeRequest, serve_request}; mod serve_rounds; -#[allow(unused_imports)] -use serve_rounds::serve_round; -#[allow(unused_imports)] use serve_rounds::serve_rounds; -#[allow(unused_imports)] -pub(super) use serve_rounds::tr_port; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/tests.rs index 4763a638..6494bad2 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/tests.rs @@ -3,10 +3,10 @@ use super::super::original_spec_controller::{NanGuard, OriginalSpecController, SpecConfig, SpecError, SpecWindow}; use super::super::original_spec_draft::{DraftPreparation, DraftSampling, VerifiedWindow}; use super::{ - ADAPTIVE_DEFAULT, AdaptiveConfig, CommittedWindow, DraftCompletion, DraftLimits, DraftPick, EnvSource, Error, - FirstDraftSeed, MAX_T, OriginalDraftEngine, OriginalFirstDraftEngine, OriginalServeEngine, OriginalServePort, - OriginalServeSettings, OriginalSpecEngine, Rc, Result, ServeCallbacks, ServeOutcome, ServeStop, ServedWindow, - SpeculativeRequest, TargetSeedRow, serve_request, + ADAPTIVE_DEFAULT, AdaptiveConfig, CommittedWindow, DraftCompletion, DraftLimits, Error, FirstDraftSeed, + OriginalDraftEngine, OriginalFirstDraftEngine, OriginalServeEngine, OriginalServePort, OriginalServeSettings, + OriginalSpecEngine, Rc, Result, ServeCallbacks, ServeOutcome, ServeStop, ServedWindow, SpeculativeRequest, + TargetSeedRow, serve_request, }; use std::cell::RefCell; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/tests/constructor_validates_dimensions.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/tests/constructor_validates_dimensions.rs index fa1fbea8..7db09501 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/tests/constructor_validates_dimensions.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/tests/constructor_validates_dimensions.rs @@ -6,13 +6,6 @@ use super::{ Error, Fake, OriginalDraftEngine, OriginalServeEngine, OriginalSpecEngine, VOCAB, engine, events, idx, model, prompt, seed_row, verify_commit, }; -// used only with some cargo features of this crate -#[allow(unused_imports)] -use super::{ - AdaptiveConfig, DraftPick, DraftPreparation, DraftSampling, EnvSource, MAX_T, NanGuard, OriginalFirstDraftEngine, - OriginalServePort, OriginalSpecController, Rc, RefCell, Result, ServeCallbacks, SpecConfig, SpecError, SpecWindow, - SpeculativeRequest, TargetSeedRow, VerifiedWindow, -}; #[test] fn constructor_validates_dimensions() { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/tests/restore_attempts_do_not_depend.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/tests/restore_attempts_do_not_depend.rs index 94500fb0..a2834156 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/tests/restore_attempts_do_not_depend.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/tests/restore_attempts_do_not_depend.rs @@ -9,12 +9,6 @@ use super::{ ServeStop, SpecConfig, SpecError, SpecWindow, SpeculativeRequest, VOCAB, VerifiedWindow, engine, events, idx, model, prompt, prompt_long, run_request, seed_row, serve, serve_in, }; -// used only with some cargo features of this crate -#[allow(unused_imports)] -use super::{ - DraftPick, EnvSource, MAX_T, NanGuard, OriginalServePort, Rc, RefCell, Result, ServeCallbacks, TargetSeedRow, - verify_commit, -}; #[test] fn restore_attempts_do_not_depend_on_engine_health_and_reset_draft_state() { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_host.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_host.rs index 6b4f4948..56c0b7b7 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_host.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_host.rs @@ -39,9 +39,9 @@ use super::{ }; use crate::model_binding::qwen4exp_input::{BoundLayerKind, ModelBinding}; use leleka_cuda_driver::{ - AcceptedWindow, Context, DeviceBuffer, NativeHeadSelection, OriginalGpuEvent, OriginalMtpFullPolicy, - OriginalNativeHeadGraphResources, OriginalVerifier, OriginalVerifyGraphResources, OriginalVerifyQsaJournal, - OriginalVerifyWindow, OriginalVerifyWindowResult, SamplerParams, SamplerPath, + AcceptedWindow, Context, DeviceBuffer, OriginalGpuEvent, OriginalMtpFullPolicy, OriginalNativeHeadGraphResources, + OriginalVerifier, OriginalVerifyGraphResources, OriginalVerifyQsaJournal, OriginalVerifyWindowResult, SamplerParams, + SamplerPath, }; use std::rc::Rc; @@ -117,13 +117,9 @@ pub(in crate::qwen_forward) struct HostOwners<'a, 'ctx> { mod tests; mod request_sampling; -#[allow(unused_imports)] use request_sampling::adapt_defer; -#[allow(unused_imports)] use request_sampling::operator_line; -#[allow(unused_imports)] -use request_sampling::serial_publish; mod ple_on_chain; mod run_window_steps; -use run_window_steps::{report_window, run_pool_group}; +use run_window_steps::report_window; mod original_serve_host_native_serve_host; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_native.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_native.rs index 112d032f..afd1396a 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_native.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_native.rs @@ -137,19 +137,8 @@ mod tests { } mod native_window; -#[allow(unused_imports)] -use native_window::draft_waits_for_commit; #[cfg(test)] -#[allow(unused_imports)] use native_window::draft_waits_for_commit_from; -#[allow(unused_imports)] use native_window::overlap; -#[allow(unused_imports)] -use native_window::trace_draft; -#[allow(unused_imports)] use native_window::trace_draft_line; -#[allow(unused_imports)] -use native_window::trace_logprobs; -#[allow(unused_imports)] -use native_window::trace_residual; mod native_serve_port_original_serve_port; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_pool.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_pool.rs index 70bd383e..a408da2e 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_pool.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_pool.rs @@ -193,35 +193,23 @@ struct CrosscheckCounts { mod tests; mod prefetch_off_file_exists; -#[allow(unused_imports)] use prefetch_off_file_exists::admit_job; -#[allow(unused_imports)] use prefetch_off_file_exists::open_job; -#[allow(unused_imports)] pub(in crate::qwen_forward) use prefetch_off_file_exists::output_offset; #[cfg(test)] -#[allow(unused_imports)] pub(in crate::qwen_forward) use prefetch_off_file_exists::plan_experts; -#[allow(unused_imports)] pub(in crate::qwen_forward) use prefetch_off_file_exists::plan_experts_where; -#[allow(unused_imports)] use prefetch_off_file_exists::prefetch_off_file_exists; -#[allow(unused_imports)] use prefetch_off_file_exists::same_spans; -#[allow(unused_imports)] pub(in crate::qwen_forward) use prefetch_off_file_exists::scatter; mod direct_group_steps; -use direct_group_steps::{GroupWork, borrow_experts, compute_into_sink, group_formats, plan_expert_ids, prefetch_group}; +use direct_group_steps::{GroupWork, borrow_experts, compute_into_sink, group_formats}; mod cpu_expert_pool; mod pool_layer_trace; use pool_layer_trace::GroupTraceInfo; mod direct_tier; mod direct_tier_drop; -#[allow(unused_imports)] use direct_tier_drop::admit_eager; -#[allow(unused_imports)] use direct_tier_drop::native_cpu_error; -#[allow(unused_imports)] use direct_tier_drop::selection; -#[allow(unused_imports)] use direct_tier_drop::sink_result; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_request.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_request.rs index b04c13d7..48ec360a 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_request.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_request.rs @@ -10,8 +10,9 @@ use super::{contract::Error, original_serve_engine::ServeOutcome, original_spec_controller::SpecError}; use leleka_cuda_driver::{SamplerParams, SamplerPath}; -pub(in crate::qwen_forward) use leleka_engine_core::request::CONTEXT_SLACK; -pub(crate) use leleka_engine_core::request::{Admission, ENDOFTEXT_TOKEN, original_stop_tokens}; +pub(crate) use leleka_engine_core::request::{Admission, original_stop_tokens}; +#[cfg(test)] +pub(crate) use leleka_engine_core::request::ENDOFTEXT_TOKEN; /// How a request ended when it did not complete, over this stack's forward error. pub(crate) type ServeError = leleka_engine_core::request::ServeError; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency.rs index b493031c..0f01bbbd 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency.rs @@ -275,32 +275,22 @@ mod tests; mod tier_env_tests; mod tail_skip_rank; -#[allow(unused_imports)] pub(crate) use tail_skip_rank::effective_tail_rank; -#[allow(unused_imports)] +#[cfg(test)] pub(crate) use tail_skip_rank::set_tail_skip_arm; #[cfg(test)] -#[allow(unused_imports)] pub(in crate::qwen_forward) use tail_skip_rank::split_group; -#[allow(unused_imports)] +#[cfg(test)] pub(in crate::qwen_forward) use tail_skip_rank::split_group_tail; -#[allow(unused_imports)] -pub(crate) use tail_skip_rank::tail_skip_rank; mod split_group_pcie; -#[allow(unused_imports)] +#[cfg(test)] use split_group_pcie::adapt_decay; -#[allow(unused_imports)] use split_group_pcie::adapt_tuning; -#[allow(unused_imports)] pub(in crate::qwen_forward) use split_group_pcie::{choose_swaps, choose_swaps_by}; #[cfg(test)] -#[allow(unused_imports)] use split_group_pcie::choose_swaps_reference; -#[allow(unused_imports)] pub(in crate::qwen_forward) use split_group_pcie::pcie_locked_only; -#[allow(unused_imports)] pub(in crate::qwen_forward) use split_group_pcie::split_group_pcie; -#[allow(unused_imports)] pub(in crate::qwen_forward) use split_group_pcie::{PcieSplitPolicy, RoutedGroup}; mod cross_layer_potential; mod swap_tie_order; @@ -311,23 +301,12 @@ mod pcie_auto_on_window_pool; #[cfg(test)] mod strata_pcie_auto_tests; mod span_cache_and_pcie_lag; -#[allow(unused_imports)] use span_cache_and_pcie_lag::span_cache_enabled; mod source_spans; -#[allow(unused_imports)] pub(super) use source_spans::source_spans; -#[allow(unused_imports)] -use source_spans::swap_wait; mod open_tier; -#[allow(unused_imports)] pub(in crate::qwen_forward) use open_tier::loan_slots; -#[allow(unused_imports)] pub(in crate::qwen_forward) use open_tier::open_tier; -#[allow(unused_imports)] -use open_tier::pin_resident_complement; -#[allow(unused_imports)] pub(in crate::qwen_forward) use open_tier::refill_defer_enabled; -#[allow(unused_imports)] pub(in crate::qwen_forward) use open_tier::refill_lent; -#[allow(unused_imports)] pub(in crate::qwen_forward) use open_tier::settle_refill; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/open_tier.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/open_tier.rs index 04c4d0bf..4c659764 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/open_tier.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/open_tier.rs @@ -2,13 +2,12 @@ //! Split out of `original_serve_residency` to keep its files under the line limit. use super::{ - AtomicU32, Context, CpuExpertPool, EnvSource, Error, ExpertTierConfig, LOAN_FLOOR, MappedExpertBank, ModelBinding, - MoeWeightCache, ORIGINAL_VERIFY_MAX_PCIE_FETCHES, Ordering, OriginalCacheOptions, OriginalExpertCache, - OriginalGpuStream, OriginalRankedExperts, OriginalServePool, OriginalVerifyCpuRows, OriginalVerifyCpuSink, - OriginalVerifyGpuPlan, OriginalVerifyPcieSource, PathBuf, PcieSplitPolicy, Rc, ResidentExpertBankSpan, Result, - RoutedGroup, SpanCache, StrataPcieAuto, SwapSources, TieOrder, VANILLA_FREE_FLOOR_MIB, VERIFIER_ASSEMBLY_MIB, - driver_error, original_cache_startup, span_cache_enabled, + LOAN_FLOOR, VANILLA_FREE_FLOOR_MIB, VERIFIER_ASSEMBLY_MIB, Context, Error, ExpertTierConfig, ModelBinding, + MoeWeightCache, OriginalCacheOptions, OriginalExpertCache, OriginalRankedExperts, Rc, ResidentExpertBankSpan, + Result, SpanCache, driver_error, original_cache_startup, span_cache_enabled, }; +#[cfg(not(target_os = "linux"))] +use super::MappedExpertBank; use leleka_cuda_driver::RefillBatchOptions; /// generate.cpp startup of the tier for the serve stack: size and open the cache after every other owner, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack.rs index 4dcf5d8a..13d245e7 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack.rs @@ -242,28 +242,17 @@ use decode_graph_reuse::{Began, DecodeGraphKey, Ended, GraphReuse, Why}; mod stack_groups; use stack_groups::{RequestState, ServePolicy, TierState}; mod stack_config_and_ttft_marks; -#[allow(unused_imports)] use stack_config_and_ttft_marks::at; -#[allow(unused_imports)] use stack_config_and_ttft_marks::failure; -#[allow(unused_imports)] use stack_config_and_ttft_marks::plan_error; -#[allow(unused_imports)] use stack_config_and_ttft_marks::prefill_bytes; -#[allow(unused_imports)] use stack_config_and_ttft_marks::tier_for; mod original_serve_stack_methods; mod prompt_chunk; -#[allow(unused_imports)] pub(crate) use prompt_chunk::dbg_el; -#[allow(unused_imports)] use prompt_chunk::operator_line; -#[allow(unused_imports)] use prompt_chunk::operator_note; -#[allow(unused_imports)] use prompt_chunk::operator_text; -#[allow(unused_imports)] use prompt_chunk::report_kernel_selection; -#[allow(unused_imports)] use prompt_chunk::vram_note; mod original_serve_stack_device_ports; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/lifecycle_fake.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/lifecycle_fake.rs index 1db86781..eb7d1a11 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/lifecycle_fake.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/lifecycle_fake.rs @@ -26,7 +26,7 @@ mod port; mod prefix; mod stack; -pub(crate) use graphs::{Bank, GraphBook, Refusals}; +pub(crate) use graphs::GraphBook; pub(crate) use prefix::{FakeBlock, FakeState}; pub(crate) use stack::FakeStack; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/decode_phase_steps.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/decode_phase_steps.rs index 538565b0..5f733c27 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/decode_phase_steps.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/decode_phase_steps.rs @@ -8,8 +8,6 @@ use super::{ StackConfig, assemble_with_window_fallback, disassemble, failure, operator_line, operator_text, original_serve_residency, profile, }; -use crate::qwen_forward::moe_weight_cache::SharedKeys; -use crate::qwen_forward::original_serve_host::HostOutcome; use leleka_cuda_driver::{OriginalQsaMappedJournal, OriginalQsaResidentIndex}; pub(super) type QsaOwners<'ctx> = [Option<(OriginalQsaResidentIndex<'ctx>, OriginalQsaMappedJournal<'ctx>)>; 48]; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_decode_phase/decode_steps.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_decode_phase/decode_steps.rs index bfc31855..e31a0eb7 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_decode_phase/decode_steps.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_decode_phase/decode_steps.rs @@ -2,7 +2,6 @@ //! window, the settlement of its outcome and the serve step. The order of the operations, the error paths and the //! log lines are those of the single function they were taken from. -#[allow(unused_imports)] use super::decode_view::{Book, DecodeView, Extra, Ids, Owners, Policy, Reads, Refill, Tier}; use super::{ AssembleFailure, AssembleInputs, Began, DecodeGraphKey, DecodeResources, DeviceBuffer, Ending, Error, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_open/assemble.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_open/assemble.rs index 69a49aa6..5804f06a 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_open/assemble.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_open/assemble.rs @@ -1,7 +1,6 @@ //! The start and the end of `OriginalServeStack::open`, moved out of it by STRA-338 (size): the config-derived values //! computed before any allocation and the final assembly of the stack from the opened parts. -#[allow(unused_imports)] use super::open_phases::{Buffers, Core, TierParts}; use super::{ Context, Error, ExpertBlobSizes, GraphReuse, ModelBinding, OriginalServeStack, OriginalVerifyExpertFormats, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix.rs index 01dc9ece..64674f5e 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix.rs @@ -189,8 +189,6 @@ mod tests; mod clock_tests; mod prefix_config; -#[allow(unused_imports)] use prefix_config::admission_reading; -#[allow(unused_imports)] use prefix_config::lcp; mod prefix_serve; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/tests.rs index e0fd1b35..bc5792ca 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/tests.rs @@ -1,10 +1,6 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). -use super::{ - AnyClock, ByteSize, ChunkOutcome, Clock, Consider, Error, PolicyParams, PrefixBudget, PrefixConfig, PrefixDevice, - PrefixMatch, PrefixServe, PrefixStore, PrefixSummary, Reject, Start, Stats, Stopwatch, StoreConfig, TailMode, - budget, -}; +use super::{ByteSize, ChunkOutcome, Error, PrefixBudget, PrefixConfig, PrefixDevice, PrefixServe, Start, TailMode}; use crate::backend::original_prompt::{PlanLimits, PromptOptions, PromptPath, PromptPlan, ResumePoint}; pub(super) const G: usize = 256; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/tests/one_token_prompt_reads.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/tests/one_token_prompt_reads.rs index aac693e0..d3a8198e 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/tests/one_token_prompt_reads.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/tests/one_token_prompt_reads.rs @@ -8,13 +8,6 @@ use super::{ Block, ChunkOutcome, Fake, G, PrefixBudget, PrefixConfig, PrefixServe, State, cfg, doc, full_digest, governor, request, serve, session, }; -// used only with some cargo features of this crate -#[allow(unused_imports)] -use super::{ - AnyClock, ByteSize, Bytes, Clock, Consider, Error, PlanLimits, PolicyParams, PrefixDevice, PrefixMatch, - PrefixStore, PrefixSummary, PromptOptions, PromptPath, PromptPlan, Reject, ResumePoint, Stats, Stopwatch, - StoreConfig, budget, turn, -}; /// Upstream 41cf05a0 `aece46db` (a 1-token prompt with `--spec`): the prompt has no token to read (the single token is /// the first diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/tests/second_session.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/tests/second_session.rs index df0c7671..c1c82681 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/tests/second_session.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/tests/second_session.rs @@ -7,12 +7,6 @@ use super::{ Block, Fake, G, PrefixServe, State, TailMode, cfg, doc, full_digest, request, serve, session, tail_serve, turn, }; -// used only with some cargo features of this crate -#[allow(unused_imports)] -use super::{ - AnyClock, ByteSize, Clock, Consider, Error, PlanLimits, PolicyParams, PrefixDevice, PrefixMatch, PrefixStore, - PrefixSummary, PromptOptions, PromptPath, PromptPlan, Reject, ResumePoint, Stats, Stopwatch, StoreConfig, -}; #[test] fn a_second_session_with_the_same_system_prompt_resumes_from_the_shared_blocks_and_ends_in_the_full_reads_state() { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller.rs index 47e20a9b..086cd7cb 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller.rs @@ -152,9 +152,7 @@ mod tests; mod finish_round_steps; use finish_round_steps::{RoundFacts, combine_round}; mod trace_enabled; -#[allow(unused_imports)] pub(crate) use trace_enabled::stats_enabled; -#[allow(unused_imports)] pub(crate) use trace_enabled::trace_enabled; mod original_spec_controller_finish; mod original_spec_controller_methods; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/tests.rs index 354051af..d1b8c306 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/tests.rs @@ -2,9 +2,8 @@ use super::super::original_spec_draft::{DraftPick, FirstSeedPoint, OriginalFirstDraftEngine, TargetSeedRow}; use super::{ - AdaptiveConfig, AdaptivePolicy, Choice, DraftBatch, DraftPlan, DraftPolicy, DraftPreparation, DraftSampling, Error, - MAX_T, NanGuard, Offer, Origin, OriginalDraftEngine, OriginalSpecController, OriginalSpecEngine, PrefixMemo, Rc, - Result, RoundFacts, SpecConfig, SpecError, SpecStats, SpecWindow, SuffixDrafter, VerifiedWindow, + AdaptiveConfig, DraftPreparation, DraftSampling, Error, NanGuard, OriginalDraftEngine, OriginalSpecController, OriginalSpecEngine, + Result, SpecConfig, SpecError, SpecWindow, }; mod golden; @@ -244,7 +243,6 @@ fn run_to_the_end( setup: EndRunSetup, min_p: f32, ) -> (Fake, Vec, OriginalSpecController) { - use super::super::original_spec_adaptive::AdaptiveConfig; let EndRunSetup { max_t, mtp, suffix, adaptive } = setup; let p = prompt(prompt_len); let mut e = Fake::new(&p[..prompt_len - 1]); diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/tests/adaptation_join_failure_is_reported.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/tests/adaptation_join_failure_is_reported.rs index 09855f9d..85ce291a 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/tests/adaptation_join_failure_is_reported.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/tests/adaptation_join_failure_is_reported.rs @@ -8,13 +8,6 @@ use super::{ OriginalSpecController, Result, SpecConfig, SpecError, SpecWindow, VOCAB, begin, config, drive, expected, next, prompt, }; -// used only with some cargo features of this crate -#[allow(unused_imports)] -use super::{ - AdaptiveConfig, AdaptivePolicy, Choice, DraftBatch, DraftPlan, DraftPolicy, MAX_T, Offer, Origin, - OriginalDraftEngine, OriginalSpecEngine, PrefixMemo, Rc, RoundFacts, SpecStats, SuffixDrafter, TargetSeedRow, - VerifiedWindow, -}; #[test] fn adaptation_join_failure_is_reported_even_after_a_good_draft() { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/tests/config_rejects_out_of_range.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/tests/config_rejects_out_of_range.rs index 2354ef51..59862f8f 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/tests/config_rejects_out_of_range.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/tests/config_rejects_out_of_range.rs @@ -4,16 +4,9 @@ //! the_adaptive_window_emits_the_same_text_as_a_fixed_one_under_any_drafter .... use super::{ - EndRunSetup, Error, Fake, NanGuard, OriginalSpecController, SpecConfig, SpecWindow, VOCAB, begin, config, drive, + AdaptiveConfig, EndRunSetup, Error, Fake, NanGuard, OriginalSpecController, SpecConfig, SpecWindow, VOCAB, begin, config, drive, expected, prompt, run_to_the_end, }; -// used only with some cargo features of this crate -#[allow(unused_imports)] -use super::{ - AdaptiveConfig, AdaptivePolicy, Choice, DraftBatch, DraftPick, DraftPlan, DraftPolicy, DraftPreparation, - DraftSampling, FirstSeedPoint, MAX_T, Offer, Origin, OriginalDraftEngine, OriginalFirstDraftEngine, - OriginalSpecEngine, PrefixMemo, Rc, Result, RoundFacts, SpecStats, SuffixDrafter, TargetSeedRow, VerifiedWindow, -}; #[test] fn config_rejects_out_of_range_and_mtp_zero_means_max_t() { @@ -53,7 +46,6 @@ fn begin_request_validates_tokens_and_rejects_a_live_request() { #[test] fn the_adaptive_window_emits_the_same_text_as_a_fixed_one_under_any_drafter() { - use super::super::super::original_spec_adaptive::AdaptiveConfig; for bad in [None, Some(0), Some(1), Some(3)] { for probs in [vec![0.95; 8], vec![0.3; 8], vec![0.9, 0.8, 0.6, 0.5, 0.4, 0.9, 0.9, 0.9]] { for suffix in [0usize, 3] { @@ -78,7 +70,6 @@ fn the_adaptive_window_emits_the_same_text_as_a_fixed_one_under_any_drafter() { #[test] fn the_adaptive_window_learns_to_verify_wide_when_the_drafter_is_perfect() { - use super::super::super::original_spec_adaptive::AdaptiveConfig; let p = prompt(6); let mut e = Fake::new(&p[..5]); let mut c = OriginalSpecController::new(config(6, 6, 0).with_adaptive(Some(AdaptiveConfig::new(6, 5)))).unwrap(); @@ -277,7 +268,6 @@ fn a_one_token_prompt_speculates_from_position_zero() { } fn assert_one_token_prompt_speculates(suffix: usize, adaptive: bool) { - use super::super::super::original_spec_adaptive::AdaptiveConfig; let p = prompt(1); let mut e = Fake::new(&[]); let mut cfg = config(4, 4, suffix); diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/tests/non_finite_window.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/tests/non_finite_window.rs index 7f81e87c..39e23214 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/tests/non_finite_window.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/tests/non_finite_window.rs @@ -7,13 +7,6 @@ use super::{ Error, Fake, NanGuard, OriginalSpecController, OriginalSpecEngine, SpecError, VOCAB, begin, config, drive, expected, guarded, prompt, }; -// used only with some cargo features of this crate -#[allow(unused_imports)] -use super::{ - AdaptiveConfig, AdaptivePolicy, Choice, DraftBatch, DraftPick, DraftPlan, DraftPolicy, DraftPreparation, - DraftSampling, FirstSeedPoint, MAX_T, Offer, Origin, OriginalDraftEngine, OriginalFirstDraftEngine, PrefixMemo, Rc, - Result, RoundFacts, SpecStats, SuffixDrafter, TargetSeedRow, VerifiedWindow, -}; #[test] fn a_non_finite_window_is_run_again_from_its_checkpoint_and_the_request_completes() { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_draft.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_draft.rs index 302a3453..ac65cb46 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_draft.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_draft.rs @@ -216,7 +216,7 @@ fn drain_after(result: Result, drain: Result<()>) -> Result { } mod projection_row; -#[allow(unused_imports)] pub(super) use projection_row::project; -#[allow(unused_imports)] pub(super) use projection_row::project_retained; mod column_projection; -#[allow(unused_imports)] use column_projection::project_impl; mod q6_numeric; -#[allow(unused_imports)] use q6_numeric::Q6Job; -#[allow(unused_imports)] use q6_numeric::numeric; -#[allow(unused_imports)] use q6_numeric::numeric_retained; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_attention.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_attention.rs index f6b7ece8..90e5ec92 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_attention.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_attention.rs @@ -101,25 +101,13 @@ pub(super) struct NativePromptAttentionBatch<'source, 'lease, 'ctx> { } mod qsa_ready; -#[allow(unused_imports)] -use qsa_ready::decode_cached; mod decode_selected_cached; -#[allow(unused_imports)] use decode_selected_cached::SelectedKvBytes; -#[allow(unused_imports)] use decode_selected_cached::attend_retained; -#[allow(unused_imports)] use decode_selected_cached::attention_driver_error; -#[allow(unused_imports)] use decode_selected_cached::decode_selected_cached; -#[allow(unused_imports)] use decode_selected_cached::gate_retained; -#[allow(unused_imports)] use decode_selected_cached::release_retained; -#[allow(unused_imports)] -use decode_selected_cached::upload_retained_bytes; -#[allow(unused_imports)] -use decode_selected_cached::upload_retained_f32; mod native_attended; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] pub(super) use native_attended::PromptDevices; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_attention/attention_scratch/gpu.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_attention/attention_scratch/gpu.rs index c8354765..bfef4f74 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_attention/attention_scratch/gpu.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_attention/attention_scratch/gpu.rs @@ -4,7 +4,7 @@ use super::{ attend_retained, attention_driver_error, gate_retained, release, upload_bytes, validate_values, }; use crate::model_binding::qwen4exp_input::QsaMatrixKind; -use leleka_cuda_driver::{Bf16ProjectionShape, Driver}; +use leleka_cuda_driver::Driver; use std::panic::{AssertUnwindSafe, catch_unwind, resume_unwind}; fn bits(a: &[f32], b: &[f32]) { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_attention/retained_gpu_tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_attention/retained_gpu_tests.rs index 5545ae82..39812674 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_attention/retained_gpu_tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_attention/retained_gpu_tests.rs @@ -1,10 +1,8 @@ //! New retained attention transport proof; no model/provider capability fixture. #![cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] use super::{ - BindingIdentity, Cell, ChunkLayer, Context, DenseWeightCache, DeviceBuffer, Error, LayerId, ModelBinding, - PromptDevices, ProvenRow, Q, QsaAttendBuffers, QsaAttended, QsaGated, QsaMatrixRole, QsaPrepared, QsaSelectedCache, - QwenStepTxn, Rc, Result, SelectedKvBytes, Stage, TokenLayer, allocate, attend_retained, download, gate_retained, - release, upload, upload_bytes, + Cell, Context, DeviceBuffer, Error, Q, QsaAttended, QsaGated, Rc, Result, SelectedKvBytes, allocate, + attend_retained, download, gate_retained, release, upload, upload_bytes, }; use crate::model_binding::qwen4exp_input::QsaMatrixKind; use leleka_cuda_driver::{Bf16ProjectionShape, Driver}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index.rs index ede545c1..7860c6b6 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index.rs @@ -248,76 +248,43 @@ mod native_state; pub(in crate::qwen_forward) mod prompt_device; mod context; -#[allow(unused_imports)] use context::context; -#[allow(unused_imports)] use context::device_peak; mod index_kernels; mod qsa_index_stage; mod qsa_pending; -#[allow(unused_imports)] use index_kernels::BlockQuery; -#[allow(unused_imports)] use index_kernels::append; -#[allow(unused_imports)] use index_kernels::norm; -#[allow(unused_imports)] use index_kernels::pack; -#[allow(unused_imports)] pub(super) use index_kernels::project; -#[allow(unused_imports)] use index_kernels::rope; -#[allow(unused_imports)] use index_kernels::select; -#[allow(unused_imports)] use index_kernels::select_with_keys; -#[allow(unused_imports)] use index_kernels::split; mod qsa_projection; -#[allow(unused_imports)] pub(super) use qsa_projection::QsaLayerProjection; -#[allow(unused_imports)] pub(super) use qsa_projection::admit_budget; -#[allow(unused_imports)] use qsa_projection::dispatch_projection; -#[allow(unused_imports)] pub(super) use qsa_projection::project_cached_out; -#[allow(unused_imports)] -use qsa_projection::project_device; -#[allow(unused_imports)] use qsa_projection::project_input; -#[allow(unused_imports)] +#[cfg(test)] use qsa_projection::project_input_numeric; -#[allow(unused_imports)] +#[cfg(test)] pub(super) use qsa_projection::project_out_numeric; -#[allow(unused_imports)] use qsa_projection::{ProjectionSources, QsaMatrixLayout}; mod validate_ids; -#[allow(unused_imports)] pub(super) use validate_ids::allocate; -#[allow(unused_imports)] pub(super) use validate_ids::binding_error; -#[allow(unused_imports)] pub(super) use validate_ids::download; -#[allow(unused_imports)] pub(super) use validate_ids::download_bytes; -#[allow(unused_imports)] pub(super) use validate_ids::driver_error; -#[allow(unused_imports)] pub(in crate::qwen_forward) use validate_ids::project_cached_out_scratch; -#[allow(unused_imports)] pub(super) use validate_ids::project_scratch_out_numeric; -#[allow(unused_imports)] pub(super) use validate_ids::release; -#[allow(unused_imports)] use validate_ids::reserve; -#[allow(unused_imports)] pub(super) use validate_ids::upload; -#[allow(unused_imports)] pub(super) use validate_ids::upload_bytes; -#[allow(unused_imports)] use validate_ids::validate_half; -#[allow(unused_imports)] pub(super) use validate_ids::validate_ids; -#[allow(unused_imports)] pub(super) use validate_ids::validate_values; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/index_resident.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/index_resident.rs index f0a66c49..e49029f6 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/index_resident.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/index_resident.rs @@ -1,13 +1,11 @@ //! Actor-owned bounded index-key mirror; host QsaPrior remains canonical. //! Only exact immutable parent identity permits incremental device publication. use super::{ - Bf16ProjectionShape, BindingIdentity, BlockQuery, Context, DenseFormat, DenseWeightCache, DeviceBuffer, Directory, - DriverError, Error, GrRole, InputBindingError, KvPage, LayerId, ModelBinding, PAGE, Position, ProjectionKind, - ProjectionSources, ProjectionSpec, Q5KProjectionShape, Q6KProjectionShape, QsaAttendBuffers, QsaGated, - QsaInputLease, QsaInputScratch, QsaLayerProjection, QsaMatrixKind, QsaMatrixLayout, QsaMatrixRole, QsaOwner, - QsaPrior, QsaSelectedCache, QsaSelectionRequest, QsaWeights, QwenStepTxn, Rc, ResidualReady, Result, Stage, State, - TokenLayer, admit_budget, context, device_peak, driver_error, reserve, select_with_keys, validate_values, + BindingIdentity, BlockQuery, Context, DeviceBuffer, Error, QsaPrior, QsaSelectionRequest, Rc, Result, admit_budget, + context, device_peak, driver_error, reserve, select_with_keys, validate_values, }; +#[cfg(test)] +use super::{Directory, KvPage, LayerId, PAGE, Position, QsaOwner, State, TokenLayer}; #[cfg(all(test, target_arch = "x86_64"))] use super::combined_qsa_observer; #[cfg(test)] @@ -247,20 +245,18 @@ mod gpu { } mod max_rows; -#[allow(unused_imports)] +#[cfg(test)] use max_rows::capacity; -#[allow(unused_imports)] +#[cfg(test)] use max_rows::delta; -#[allow(unused_imports)] +#[cfg(test)] use max_rows::max_rows; -#[allow(unused_imports)] +#[cfg(test)] use max_rows::update; -#[allow(unused_imports)] +#[cfg(test)] use max_rows::upload_words; mod synthetic_late_prior; #[cfg(test)] -#[allow(unused_imports)] use synthetic_late_prior::synthetic_late_prior; #[cfg(test)] -#[allow(unused_imports)] use synthetic_late_prior::synthetic_late_prior_for; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device.rs index 1ba96826..19438c9e 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device.rs @@ -6,13 +6,9 @@ use super::super::qsa_attention::PromptDevices; use super::super::qsa_prompt_index::PromptChunkOwners; use super::super::session::{TargetStepOrigin, chunk::QwenChunkTxn}; use super::{ - Bf16ProjectionShape, BindingIdentity, BlockQuery, Cell, Context, DenseFormat, DenseWeightCache, DeviceBuffer, - Directory, DriverError, Error, GrRole, InputBindingError, LayerId, ModelBinding, Position, ProjectionKind, - ProjectionSources, ProjectionSpec, Q5KProjectionShape, Q6KProjectionShape, QsaAttendBuffers, QsaGated, - QsaIndexKeyCache, QsaInputLease, QsaInputScratch, QsaLayerProjection, QsaMatrixKind, QsaMatrixLayout, - QsaMatrixRole, QsaOwner, QsaPending, QsaPrior, QsaSelectedCache, QsaSelectionRequest, QsaWeights, QwenStepTxn, Rc, - ResidualReady, Result, Stage, TokenLayer, allocate, context, download, driver_error, project, - project_scratch_out_numeric, upload, validate_values, + BindingIdentity, Context, DenseWeightCache, DeviceBuffer, DriverError, Error, GrRole, LayerId, ModelBinding, + QsaMatrixKind, QsaMatrixRole, QsaOwner, QsaPending, QsaPrior, QsaWeights, QwenStepTxn, Rc, ResidualReady, Result, + Stage, TokenLayer, allocate, download, driver_error, project, project_scratch_out_numeric, upload, validate_values, }; use crate::qwen_forward::prompt_device_rows::PromptWeights; use leleka_cuda_driver::{ diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device.rs index 61b07083..f5788a65 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device.rs @@ -4,17 +4,11 @@ //! stores all twelve actual seals before joint target/draft publication. use super::super::super::{input::InputReady, session::QwenSession}; use super::{ - Bf16ProjectionShape, BindingIdentity, BlockQuery, CompletedQsaKvAppend, Context, DenseFormat, DenseWeightCache, - DeviceBuffer, Directory, DriverError, Error, GrRole, InputBindingError, LayerId, ModelBinding, - NativeBatchWorkspace, OriginalDeviceBlock, OriginalDeviceGrRead, OriginalQsaDeviceSelection, - OriginalQsaPromptDevice, OriginalQsaPromptWeights, Position, ProjectionKind, ProjectionSources, ProjectionSpec, - PromptChunkOwners, PromptDevices, PromptWeights, Q5KProjectionShape, Q6KProjectionShape, QsaAttendBuffers, - QsaChunkPrior, QsaGated, QsaIndexKeyCache, QsaIndexPrior, QsaInputLease, QsaInputScratch, QsaKvAppendTarget, - QsaLayerProjection, QsaMatrixKind, QsaMatrixLayout, QsaMatrixRole, QsaNativeKind, QsaOwner, QsaPrior, - QsaPromptIndexState, QsaPromptKv, QsaResident, QsaSelectedCache, QsaSelectionRequest, QsaWeights, QwenChunkTxn, - QwenStepTxn, Rc, ResidualReady, Result, Stage, TargetStepOrigin, TokenLayer, allocate, check_prompt_shapes, - context, device_error, download, native, project, project_scratch_out_numeric, prompt_projections, upload, - validate_values, + BindingIdentity, Context, DenseWeightCache, DeviceBuffer, Error, GrRole, LayerId, ModelBinding, + NativeBatchWorkspace, OriginalDeviceBlock, OriginalDeviceGrRead, OriginalQsaPromptWeights, QsaMatrixKind, + QsaMatrixRole, QsaNativeKind, QsaOwner, QsaPrior, QsaResident, QsaWeights, QwenStepTxn, Rc, ResidualReady, Result, + Stage, TargetStepOrigin, TokenLayer, allocate, check_prompt_shapes, device_error, download, native, project, + project_scratch_out_numeric, prompt_projections, upload, validate_values, }; use leleka_cuda_driver::{ OriginalQsaIndexBatch, OriginalQsaIndexCheckpoint, OriginalQsaResidentAppendTarget, OriginalQsaResidentIndex, @@ -132,7 +126,6 @@ pub(in crate::qwen_forward) struct ResidentQsaRow<'row, 'ctx> { } mod scalar; -pub(in crate::qwen_forward) use scalar::{ResidentQsaScalar, ResidentQsaScalarReady}; mod resident_qsa_completed; pub(in crate::qwen_forward) use resident_qsa_completed::ResidentSealOwners; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/resident_qsa_completed.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/resident_qsa_completed.rs index 4c61cc80..38fbfce0 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/resident_qsa_completed.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/resident_qsa_completed.rs @@ -1,7 +1,6 @@ //! Methods of `ResidentQsaCompleted`: `first`, `rows`, `layer`, `validate_rows` and 7 more. //! Defines `ResidentSealOwners`. -#[allow(unused_imports)] use super::resident_qsa_layer::mint; use super::{ Context, DenseWeightCache, Error, InputReady, LayerId, ModelBinding, NativeBatchWorkspace, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/resident_qsa_span_export_and_seal.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/resident_qsa_span_export_and_seal.rs index 21cb35c3..7147ada6 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/resident_qsa_span_export_and_seal.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/resident_qsa_span_export_and_seal.rs @@ -1,7 +1,6 @@ //! Methods of `ResidentQsaLayer`: `export_span`, `export_kv`, `export_index`, `export_tail` and 5 more. //! Methods of `ResidentQsaPublication`: `publish_validated`. Functions: `span_views`. Defines `SpanViews`. -#[allow(unused_imports)] use super::resident_qsa_layer::rehome; use super::{ Context, DenseWeightCache, DeviceBuffer, Error, LayerId, ModelBinding, NativeBatchWorkspace, OriginalDeviceBlock, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/scalar.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/scalar.rs index c179be2c..b157eadd 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/scalar.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/scalar.rs @@ -87,25 +87,9 @@ struct ScalarHost { type GateBuffers<'ctx> = [Option>; 4]; mod scalar_row_admission; -#[allow(unused_imports)] -use scalar_row_admission::check_scalar_shapes; -#[allow(unused_imports)] -use scalar_row_admission::check_scalar_txn; -#[allow(unused_imports)] -use scalar_row_admission::check_txn_input; -#[allow(unused_imports)] use scalar_row_admission::driver; -#[allow(unused_imports)] -use scalar_row_admission::scalar_gate; mod scalar_row_run; -#[allow(unused_imports)] use scalar_row_run::apply_gate; -#[allow(unused_imports)] use scalar_row_run::upload_gate_inputs; mod gated_out_projection; -#[allow(unused_imports)] use gated_out_projection::gate_and_out; -#[allow(unused_imports)] -use gated_out_projection::project_gated_out; -#[allow(unused_imports)] -use gated_out_projection::release_gate_buffers; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_prefill_batch.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_prefill_batch.rs index 7ba734de..2b21587f 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_prefill_batch.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_prefill_batch.rs @@ -39,40 +39,14 @@ pub(super) struct NativeOutRow<'ctx> { mod projection_operands; pub(super) use projection_operands::{AttendedRows, AttentionRow, ChunkAttentionSlot, NativeQsaDevices}; mod native_projection_row; -#[allow(unused_imports)] use native_projection_row::check_batch; -#[allow(unused_imports)] -use native_projection_row::check_input; -#[allow(unused_imports)] -use native_projection_row::check_inputs; -#[allow(unused_imports)] -use native_projection_row::chunk_owners; -#[allow(unused_imports)] use native_projection_row::native; -#[allow(unused_imports)] use native_projection_row::native_error; -#[allow(unused_imports)] pub(super) use native_projection_row::project; -#[allow(unused_imports)] -use native_projection_row::project_batches; mod projection_rows; -#[allow(unused_imports)] use projection_rows::check_batches; -#[allow(unused_imports)] use projection_rows::check_shapes; -#[allow(unused_imports)] use projection_rows::concat_mixed; -#[allow(unused_imports)] -use projection_rows::gather_rows; -#[allow(unused_imports)] pub(super) use projection_rows::project_out; -#[allow(unused_imports)] -use projection_rows::project_rows; -#[allow(unused_imports)] -use projection_rows::ready_rows; -#[allow(unused_imports)] use projection_rows::retained_matrices; -#[allow(unused_imports)] -use projection_rows::row_values; -#[allow(unused_imports)] use projection_rows::split_rows; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/router_scratch/gpu.rs b/crates/engine-qwen35-cuda/src/qwen_forward/router_scratch/gpu.rs index c8a54803..fb8df9ba 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/router_scratch/gpu.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/router_scratch/gpu.rs @@ -1,9 +1,8 @@ //! Synthetic numerical storage proof only; no model binding or source product is fabricated. #![cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] use super::{ - Bf16ProjectionShape, BindingIdentity, Cell, Context, DeviceBuffer, EXTENTS, Error, GrRole, MATRIX_BYTES, RESERVE, - ROUTER_BYTES, Rc, RefMut, ResidualReady, Result, RouterBuffers, TokenLayer, map_driver_error, validate_activation, - validate_logits, + Bf16ProjectionShape, Cell, Context, DeviceBuffer, EXTENTS, Error, MATRIX_BYTES, RESERVE, ROUTER_BYTES, Rc, Result, + RouterBuffers, map_driver_error, validate_activation, validate_logits, }; use leleka_cuda_driver::Driver; use std::panic::{AssertUnwindSafe, catch_unwind, resume_unwind}; @@ -101,32 +100,15 @@ fn original_first_fixed_router_all_logits_routes_repeat_reset_and_cleanup() { } mod report; -#[allow(unused_imports)] use report::activation; -#[allow(unused_imports)] use report::candidate; -#[allow(unused_imports)] use report::close_all; -#[allow(unused_imports)] use report::finish; -#[allow(unused_imports)] -use report::float_bytes; -#[allow(unused_imports)] use report::healthy; -#[allow(unused_imports)] use report::matrix_bytes; -#[allow(unused_imports)] use report::original; -#[allow(unused_imports)] use report::original_project; -#[allow(unused_imports)] use report::original_route; -#[allow(unused_imports)] use report::snapshot; -#[allow(unused_imports)] -use report::valid_product; mod valid_reset; -#[allow(unused_imports)] use valid_reset::numeric; -#[allow(unused_imports)] -use valid_reset::valid_reset; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/router_scratch/gpu/report.rs b/crates/engine-qwen35-cuda/src/qwen_forward/router_scratch/gpu/report.rs index 3275ad14..d1a886c0 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/router_scratch/gpu/report.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/router_scratch/gpu/report.rs @@ -5,9 +5,6 @@ use super::{ Bf16ProjectionShape, Context, DeviceBuffer, Error, MATRIX_BYTES, Report, Result, RouterBuffers, map_driver_error, validate_activation, validate_logits, }; -// used only with some cargo features of this crate -#[allow(unused_imports)] -use super::{AssertUnwindSafe, BindingIdentity, Cell, Driver, GrRole, Rc, RefMut, ResidualReady, TokenLayer, report}; impl Report { pub(super) fn guard(&mut self, passed: bool) { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk.rs index 29121f58..461e4fd9 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk.rs @@ -1,10 +1,9 @@ //! Private layer-major staging. Original committed owner never advances here. #![allow(dead_code)] use super::{ - BindingIdentity, BoundLayerKind, Context, Dimension, Error, FiniteLogits, GdnOwner, GdnPending, GdnPrior, GrRole, - InjectedResidual, InputReady, LayerId, ModelBinding, PleOwner, PlePending, PlePrior, Position, QsaIndexPrior, - QsaOwner, QsaPending, QwenSession, QwenStepTxn, Rc, Result, STATE_CAPACITY, Stage, TargetStepOrigin, ThreadId, - TokenId, TokenLayer, chunk, + BindingIdentity, Context, Dimension, Error, GdnPrior, GrRole, InjectedResidual, InputReady, LayerId, ModelBinding, + PlePrior, Position, QsaIndexPrior, QwenSession, QwenStepTxn, Rc, Result, STATE_CAPACITY, Stage, TargetStepOrigin, + TokenId, TokenLayer, }; mod txn_groups; @@ -308,13 +307,8 @@ pub(in crate::qwen_forward) struct TestGdnComponentRows { } mod gdn_chunk_start; -#[allow(unused_imports)] use gdn_chunk_start::host_charge; -#[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -#[allow(unused_imports)] -use gdn_chunk_start::same_window_proof; mod host_charge_bounded; -#[allow(unused_imports)] use host_charge_bounded::host_charge_bounded; mod qwen_chunk_txn; mod test_gdn_component_rows; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn.rs index 9ccf55b9..4a368b2b 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn.rs @@ -2,14 +2,12 @@ //! Split out of `chunk` to keep its files under the line limit. use super::{ - ActiveMicroWindow, AttentionProgress, AttentionSource, BatchProgress, BindingIdentity, BoundLayerKind, - ChunkAttentionRow, ChunkCommit, ChunkDraftPublication, ChunkFfnRow, ChunkMicroWindow, ChunkRowResidual, Context, - Dimension, Error, FfnInjectionRow, FiniteLogits, GdnChunkAnchor, GdnChunkJournal, GdnChunkMicro, GdnChunkRow, - GdnChunkSeal, GdnChunkStart, GdnOwner, GdnPending, GdnPrior, GrRole, InjectedResidual, InputReady, LayerId, - MicroProgress, ModelBinding, PleOwner, PlePending, PlePrior, Position, PreparedLayerRow, PromptInit, QsaIndexPrior, - QsaOwner, QsaPending, QwenChunkTxn, QwenSession, QwenStepTxn, Rc, Result, Row, STATE_CAPACITY, Stage, - TargetStepOrigin, ThreadId, TokenId, TokenLayer, VerifiedDraftPublication, VerifiedTargetPrefix, chunk, - host_charge, host_charge_bounded, + ActiveMicroWindow, AttentionProgress, AttentionSource, BatchProgress, ChunkAttentionRow, ChunkCommit, + ChunkDraftPublication, ChunkFfnRow, ChunkMicroWindow, ChunkRowResidual, Context, Dimension, Error, FfnInjectionRow, + GdnChunkAnchor, GdnChunkJournal, GdnChunkMicro, GdnChunkRow, GdnChunkSeal, GdnChunkStart, GdnPrior, GrRole, + InjectedResidual, InputReady, LayerId, MicroProgress, ModelBinding, PlePrior, Position, PreparedLayerRow, + PromptInit, QsaIndexPrior, QwenChunkTxn, QwenSession, QwenStepTxn, Rc, Result, Row, STATE_CAPACITY, Stage, + TargetStepOrigin, TokenId, TokenLayer, host_charge, host_charge_bounded, }; mod qwen_chunk_txn_attention_sources; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/verify.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/verify.rs index ed07c9db..fb63e905 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/verify.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/verify.rs @@ -40,8 +40,6 @@ pub(in crate::qwen_forward) trait VerifiedDraftPublication { mod tests; mod verified_target_prefix; -#[allow(unused_imports)] use verified_target_prefix::greedy_prefix; -#[allow(unused_imports)] use verified_target_prefix::verification_extra_charge; mod qwen_chunk_txn; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt.rs index 222fe1a9..2718068b 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt.rs @@ -7,10 +7,9 @@ use super::super::qsa_index::prompt_device::resident_device::{ ParkedLayerSpan, ParkedPrefix, ResidentQsaLayer, ResidentQsaOwners, ResidentQsaPrior, ResidentQsaSeal, SpanExport, }; use super::{ - BindingIdentity, BoundLayerKind, Context, Dimension, Error, FiniteLogits, GdnOwner, GdnPending, GdnPrior, GrRole, - InjectedResidual, InputReady, LayerId, ModelBinding, PleOwner, PlePending, PlePrior, Position, QsaIndexPrior, - QsaOwner, QsaPending, QwenSession, QwenStepTxn, Rc, Result, STATE_CAPACITY, Stage, TargetStepOrigin, ThreadId, - TokenId, TokenLayer, chunk, + BindingIdentity, Context, Dimension, Error, GdnPrior, GrRole, InputReady, LayerId, ModelBinding, PlePrior, Position, + QsaIndexPrior, QsaOwner, QwenSession, QwenStepTxn, Rc, Result, STATE_CAPACITY, Stage, TargetStepOrigin, TokenId, + TokenLayer, }; use std::cell::{Cell, RefCell}; pub(in crate::qwen_forward) mod draft; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/draft.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/draft.rs index f02c4e78..bc99f804 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/draft.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/draft.rs @@ -81,7 +81,5 @@ pub(in crate::qwen_forward) use window_origins::WindowOrigins; mod original_draft_checkpoint; mod original_draft_session_ring_restore; mod published_first_materialized; -#[allow(unused_imports)] use published_first_materialized::draft_driver_error; -#[allow(unused_imports)] use published_first_materialized::published_first_materialized; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/tests.rs index 000eec53..bcd7ac97 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/tests.rs @@ -1,9 +1,8 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). use super::{ - BoundLayerKind, Context, Error, FiniteLogits, GdnOwner, GdnPending, GdnPrior, GrRole, InjectedResidual, InputReady, - LayerId, ModelBinding, PleOwner, PlePending, PlePrior, Position, QsaIndexPrior, QsaOwner, QsaPending, QwenSession, - Rc, Result, Stage, TargetStepOrigin, ThreadId, TokenId, TokenLayer, + Error, GdnOwner, GdnPending, GdnPrior, InputReady, LayerId, PleOwner, PlePending, PlePrior, Position, QsaIndexPrior, + QsaOwner, QwenSession, Rc, Stage, TokenId, TokenLayer, }; use crate::model_binding::qwen4exp_input::BindingIdentity; use crate::qwen_forward::contract::Dimension; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/tests/gdn_session_commit_advances_all.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/tests/gdn_session_commit_advances_all.rs index 135b8a9f..4a8ea199 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/tests/gdn_session_commit_advances_all.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/tests/gdn_session_commit_advances_all.rs @@ -8,12 +8,6 @@ use super::{ BindingIdentity, Dimension, Error, GdnPending, InputReady, LayerId, QwenSession, Rc, Stage, TokenId, TokenLayer, position, token, }; -// used only with some cargo features of this crate -#[allow(unused_imports)] -use super::{ - BoundLayerKind, Context, FiniteLogits, GdnOwner, GdnPrior, GrRole, InjectedResidual, ModelBinding, PleOwner, - PlePending, PlePrior, Position, QsaIndexPrior, QsaOwner, QsaPending, Result, TargetStepOrigin, ThreadId, -}; #[test] fn gdn_session_commit_advances_all_state_once_and_failed_reset_preserves_owner() { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/tests/retained_gr_handoff_identity.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/tests/retained_gr_handoff_identity.rs index 2a813873..f35ba114 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/tests/retained_gr_handoff_identity.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/tests/retained_gr_handoff_identity.rs @@ -8,12 +8,6 @@ use super::{ BindingIdentity, Dimension, Error, GdnOwner, GdnPending, GdnPrior, InputReady, LayerId, PleOwner, PlePending, PlePrior, QsaIndexPrior, QsaOwner, QwenSession, Rc, Stage, TokenLayer, position, token, }; -// used only with some cargo features of this crate -#[allow(unused_imports)] -use super::{ - BoundLayerKind, Context, FiniteLogits, GrRole, InjectedResidual, ModelBinding, Position, QsaPending, Result, - TargetStepOrigin, ThreadId, TokenId, -}; #[test] fn retained_gr_handoff_identity_is_lazy_and_refuses_same_position_rebegin() { From 8b5e94fce9c273ed0545787ebe2c931ccd97313e Mon Sep 17 00:00:00 2001 From: Pavlo Ratushnyi Date: Sat, 14 Nov 2026 20:59:50 +0100 Subject: [PATCH 05/10] engine-qwen35-cuda: no #[allow(unused_imports)] left (re-exports nobody used are gone, names only the test build needs are cfg(test), names only another platform needs sit under their cfg) Co-Authored-By: Claude Sonnet 5.5 --- .../src/model_binding/qwen4exp_kar_ple/private_copy.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/private_copy.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/private_copy.rs index 0d39f35c..0b4b73ee 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/private_copy.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/private_copy.rs @@ -289,7 +289,7 @@ use inode::diagnostic; pub(super) use inode::freeze; #[cfg(target_os = "macos")] pub(super) use inode::freeze; -#[cfg(target_os = "macos")] +#[cfg(any(test, target_os = "macos"))] use inode::inode; pub(super) use inode::open_regular; #[cfg(target_os = "macos")] From e45e4d7aa08652ee24932cb17717419e1aa23ce6 Mon Sep 17 00:00:00 2001 From: Pavlo Ratushnyi Date: Sat, 14 Nov 2026 21:04:47 +0100 Subject: [PATCH 06/10] engine crates: the generated doc headers (Methods of ..., Functions: ..., Split out of ...) are real descriptions of what the file is and why it is a file of its own (438 files, comment lines only) Co-Authored-By: Claude Sonnet 5.5 --- .../src/conversation/cache/conversation_cache.rs | 5 +++-- .../src/conversation/cache/conversation_checkpoint.rs | 4 ++-- .../cache/tests/retained_buffers_count_against_bytes.rs | 6 +++--- .../conversation/cache/tests/what_is_not_superseded.rs | 5 ++--- .../engine-core/src/conversation/kv/kv_image_readback.rs | 4 ++-- .../src/conversation/kv/kv_image_save_restore.rs | 5 +++-- crates/engine-core/src/conversation/kv/layout.rs | 4 ++-- .../src/conversation/manager/conversation_manager.rs | 4 ++-- .../conversation_resume_checkpoints.rs | 5 +++-- .../conversation_manager/conversation_state_events.rs | 4 ++-- .../conversation/manager/conversation_options_default.rs | 4 ++-- .../conversation/manager_tests/byte_budget_and_slot.rs | 9 ++++----- .../conversation/manager_tests/continuing_chat_reuses.rs | 7 +++---- .../engine-core/src/conversation/manager_tests/hash.rs | 4 ++-- .../manager_tests/sim_device_session_device.rs | 4 ++-- .../src/conversation/snapshot_tests/fixture.rs | 4 ++-- .../src/conversation/snapshot_tests/full_session.rs | 4 ++-- .../src/conversation/snapshot_tests/golden_state.rs | 4 ++-- .../src/conversation/snapshot_tests/kv_level.rs | 4 ++-- .../src/conversation/snapshot_tests/kv_region.rs | 4 ++-- .../snapshot_tests/layer_snapshots_are_byte_exact.rs | 7 +++---- .../engine-core/src/conversation/snapshot_tests/pools.rs | 4 ++-- crates/engine-core/src/prefix_cache/store/decayed.rs | 3 +-- .../src/prefix_cache/store/policy_params_default.rs | 3 +-- .../engine-core/src/prefix_cache/store/prefix_store.rs | 4 ++-- .../store/prefix_store/prefix_store_consider_commit.rs | 4 ++-- .../store/prefix_store/prefix_store_evict_and_budget.rs | 4 ++-- .../store/prefix_store/prefix_store_stats_and_clock.rs | 4 ++-- .../prefix_cache/store/tests/hit_by_another_session.rs | 8 +++----- .../src/prefix_cache/store/tests/request_resumes_from.rs | 7 +++---- crates/engine-core/src/prompt/prompt_options.rs | 4 ++-- crates/engine-core/src/spec/adaptive/adaptive_config.rs | 4 ++-- crates/engine-core/src/spec/adaptive/adaptive_policy.rs | 4 ++-- crates/engine-core/src/spec/adaptive/spec_stats.rs | 4 ++-- .../src/spec/adaptive/tests/default_ceiling.rs | 5 ++--- .../adaptive/tests/stationary_regimes_reach_the_best.rs | 6 +++--- .../src/backend/original_serve/original_serve_mode.rs | 4 ++-- .../src/backend/original_serve/runner/command_loop.rs | 4 ++-- .../src/backend/original_serve/tests.rs | 4 +++- .../src/backend/original_serve_replay/required_path.rs | 4 ++-- crates/engine-qwen35-cuda/src/backend/tests.rs | 4 ++++ .../src/conversation/resident/tests.rs | 4 +++- crates/engine-qwen35-cuda/src/experimental/tests.rs | 4 +++- crates/engine-qwen35-cuda/src/model_binding/mod.rs | 3 +++ .../binding_identity_and_input_binding_error.rs | 5 +++-- .../src/model_binding/qwen4exp_input/gdn/tests.rs | 3 ++- .../src/model_binding/qwen4exp_input/gr/tests.rs | 3 ++- .../src/model_binding/qwen4exp_input/model_binding.rs | 4 ++-- .../qwen4exp_input/moe_expert/model_binding.rs | 4 ++-- .../model_binding/model_binding_moe_descriptors.rs | 4 ++-- .../qwen4exp_input/moe_expert/moe_expert_weights.rs | 4 ++-- .../qwen4exp_input/moe_expert/moe_routed_source_scope.rs | 4 ++-- .../moe_expert/routed_source_descriptor.rs | 4 ++-- .../qwen4exp_input/mtp/dense_bytes_types.rs | 4 ++-- .../qwen4exp_input/mtp/descriptors_types.rs | 4 ++-- .../model_binding/qwen4exp_input/mtp/mtp_kind_types.rs | 4 ++-- .../model_binding/qwen4exp_input/mtp/pack_identity.rs | 4 ++-- .../src/model_binding/qwen4exp_input/mtp/tests.rs | 4 +++- .../qwen4exp_input/validate_ple_descriptor.rs | 4 ++-- .../qwen_forward/dense_weight_cache/dense_slab_policy.rs | 4 ++-- .../dense_weight_cache/dense_weight_cache_methods.rs | 4 ++-- .../dense_cache_buffers_and_close.rs | 4 ++-- .../dense_cache_eager_layer_load.rs | 4 ++-- .../dense_cache_gdn_qsa_workspaces.rs | 5 +++-- .../dense_cache_matrix_registration.rs | 4 ++-- .../dense_cache_ple_and_verify_weights.rs | 5 +++-- .../dense_cache_prompt_and_gdn_scratch.rs | 5 +++-- .../dense_weight_cache_constructors.rs | 4 ++-- .../src/qwen_forward/dense_weight_cache/workspaces.rs | 5 +++-- .../executor/original_prompt/original_prompt_executor.rs | 5 +++-- .../original_prompt_executor/construction_and_parking.rs | 4 ++-- .../construction_and_parking/executor_construction.rs | 5 +++-- .../session_park_and_qsa_owners.rs | 4 ++-- .../prompt_executor_forward_and_close.rs | 3 +-- .../prompt_chunk_forward.rs | 5 +++-- .../prompt_chunk_forward/forward_draft.rs | 2 +- .../prompt_chunk_forward/forward_final.rs | 2 +- .../prompt_chunk_forward/forward_input.rs | 2 +- .../prompt_chunk_forward/forward_layers.rs | 2 +- .../prompt_executor_close.rs | 3 +-- .../prompt_executor_retire_owners.rs | 4 ++-- .../original_prompt/original_prompt_executor_drop.rs | 5 +++-- .../executor/original_prompt/staged_input_enabled.rs | 3 +-- .../executor/prefill_chunk/check_chunk_on_loaded.rs | 5 +++-- .../executor/prefill_chunk/prepare_micro_ffn_rows.rs | 4 ++-- .../prefill_chunk/prepare_micro_ffn_rows/ffn_rows.rs | 2 +- .../prefill_chunk/prepare_micro_ffn_rows/gdn_native.rs | 2 +- .../prefill_chunk/prepare_micro_ffn_rows/plain_rows.rs | 2 +- .../prefill_chunk/prepare_micro_ffn_rows/qsa_native.rs | 2 +- .../executor/prefill_chunk/prepare_q6_layer_columns.rs | 4 ++-- .../qwen_forward/executor/prefill_chunk/qwen_forward.rs | 4 ++-- .../executor/prefill_chunk/qwen_forward/joint_chunk.rs | 2 +- .../qwen_forward/prefill_chunk_cached_windowed.rs | 4 ++-- .../qwen_forward/prefill_chunk_native_windowed.rs | 5 +++-- .../prefill_chunk/qwen_forward/prefill_chunk_planned.rs | 5 +++-- .../qwen_forward/prefill_chunk_planned/chunk_layer.rs | 2 +- .../qwen_forward/prefill_chunk_planned/chunk_setup.rs | 2 +- .../qwen_forward/prefill_chunk_planned/host_attention.rs | 2 +- .../prefill_chunk_planned/window_attention.rs | 2 +- .../qwen_forward/prefill_chunk_planned/window_experts.rs | 2 +- .../qwen_forward/prefill_chunk_planned/window_ffn.rs | 2 +- .../prefill_chunk_planned/window_ffn_flow.rs | 2 +- .../executor/prefill_chunk/read_chunk_attention_ffn.rs | 5 +++-- .../executor/prefill_chunk/target_step_product.rs | 4 ++-- .../executor/prefill_chunk/window_numeric/proof.rs | 3 ++- .../src/qwen_forward/executor/prefill_step_product.rs | 5 +++-- .../executor/qwen_forward/qwen_forward_reset.rs | 3 +-- .../src/qwen_forward/executor/read_layer_attention.rs | 5 +++-- .../src/qwen_forward/executor/reset_replay_sdet.rs | 4 +++- .../src/qwen_forward/executor/step_layers.rs | 3 ++- .../src/qwen_forward/executor/tests.rs | 3 ++- .../src/qwen_forward/gdn/cached_step.rs | 5 +++-- .../src/qwen_forward/gdn/chain/allocate_qk_slot.rs | 5 +++-- .../src/qwen_forward/gdn/chain/chain.rs | 4 ++-- .../gdn/chain/chain/chain_construction_and_buffers.rs | 4 ++-- .../gdn/chain/chain/chain_projection_convolution.rs | 4 ++-- .../gdn/chain/chain/chain_readout_and_finish.rs | 4 ++-- .../src/qwen_forward/gdn/chain/chain/chain_row_queue.rs | 5 +++-- .../src/qwen_forward/gdn/chain/chain_drop.rs | 3 +-- .../gdn/chunk_device/gdn_chunk_device_methods.rs | 3 +-- .../chunk_device_batch_compute.rs | 5 +++-- .../chunk_device_construction.rs | 5 +++-- .../chunk_device_finish_cleanup.rs | 4 ++-- .../gdn/chunk_device/mirror_reuse_enabled.rs | 4 ++-- .../qwen_forward/gdn/chunk_device/native_fused_step.rs | 4 ++-- .../gdn/chunk_device/numeric_gpu/batch_adoption.rs | 5 +++-- .../gdn/chunk_device/numeric_gpu/exercise.rs | 5 +++-- .../gdn/chunk_device/numeric_gpu/operands.rs | 4 ++-- .../src/qwen_forward/gdn/driver_error.rs | 4 ++-- crates/engine-qwen35-cuda/src/qwen_forward/gdn/gates.rs | 5 +++-- .../engine-qwen35-cuda/src/qwen_forward/gdn/gdn_ready.rs | 4 ++-- .../qwen_forward/gdn/mirror/gdn_state_mirror_methods.rs | 3 +-- .../state_mirror_compute_and_admit.rs | 5 +++-- .../state_mirror_publish_and_close.rs | 4 ++-- .../src/qwen_forward/gdn/mirror/mirror_readout.rs | 4 ++-- .../src/qwen_forward/gdn/mirror/upload_checked.rs | 3 +-- .../src/qwen_forward/gdn/prefill_batch/buffers.rs | 5 +++-- .../gdn/prefill_batch/gdn_batch_resources.rs | 5 +++-- .../src/qwen_forward/gdn/prefill_batch/gdn_stage.rs | 4 ++-- .../src/qwen_forward/gdn/prefill_batch/step_batch.rs | 5 ++++- .../src/qwen_forward/gdn/projection.rs | 5 +++-- .../src/qwen_forward/gdn/stage_steps.rs | 4 ++-- .../src/qwen_forward/gdn/verification/compute_row.rs | 4 ++-- .../compute_row/verified_row_compute_and_lease.rs | 4 ++-- .../gdn/verification/compute_row/workspace.rs | 4 ++-- .../gdn/verification/compute_row/workspace_replay.rs | 5 +++-- .../src/qwen_forward/gdn/verification/workspace.rs | 3 +-- .../src/qwen_forward/gr/batch_chunk/batch_inject.rs | 4 +++- .../src/qwen_forward/gr/batch_chunk/gr_micro_input.rs | 4 ++-- .../src/qwen_forward/gr/batch_chunk/gr_stage.rs | 5 +++-- .../gr/batch_chunk/gr_stage_prepare_injection.rs | 4 ++-- .../engine-qwen35-cuda/src/qwen_forward/gr/diagnose.rs | 4 ++-- .../src/qwen_forward/gr/download_f32.rs | 4 ++-- .../engine-qwen35-cuda/src/qwen_forward/gr/gr_stage.rs | 5 +++-- .../src/qwen_forward/gr/output_workspace_gpu.rs | 3 +-- .../gr/output_workspace_gpu/check_handoff.rs | 4 ++-- .../qwen_forward/gr/output_workspace_gpu/fresh_read.rs | 4 ++-- .../src/qwen_forward/gr/read_cached_cuda.rs | 4 ++-- .../engine-qwen35-cuda/src/qwen_forward/gr/read_cuda.rs | 4 ++-- .../src/qwen_forward/gr/residual_ready.rs | 4 ++-- crates/engine-qwen35-cuda/src/qwen_forward/gr/tests.rs | 3 ++- crates/engine-qwen35-cuda/src/qwen_forward/input.rs | 4 ++++ .../src/qwen_forward/input/gather_rows.rs | 5 +++-- crates/engine-qwen35-cuda/src/qwen_forward/input/hash.rs | 3 +++ .../src/qwen_forward/input/input_stage.rs | 5 +++-- .../src/qwen_forward/input/input_stage_ple_micro.rs | 5 +++-- .../src/qwen_forward/input/ple_cuda.rs | 5 +++-- .../input/ple_transport/ple_key_retained_gpu/bf16.rs | 4 ++-- .../src/qwen_forward/input/ple_transport/role.rs | 5 +++-- .../src/qwen_forward/input/ple_upload_f32.rs | 4 ++-- .../src/qwen_forward/input/residual_streams.rs | 4 ++-- .../qwen_forward/kar_ple_cache/kar_ple_cache_methods.rs | 5 +++-- .../src/qwen_forward/kar_ple_cache/lru_tests.rs | 5 +++-- .../src/qwen_forward/kar_ple_cache/publish_gather.rs | 4 ++-- .../src/qwen_forward/kar_ple_cache/row_parity_probe.rs | 5 +++-- .../src/qwen_forward/kar_ple_cache/scratch_bytes.rs | 5 +++-- .../src/qwen_forward/kar_ple_cache/slot_tests.rs | 5 +++-- .../src/qwen_forward/moe_expert/cached_expert_run.rs | 5 +++-- .../qwen_forward/moe_expert/expert_matrix_projection.rs | 6 ++++-- .../src/qwen_forward/moe_expert/expert_mlp_values.rs | 6 ++++-- .../src/qwen_forward/moe_expert/expert_step.rs | 6 ++++-- .../adaptive_packets/adaptive_packet_projection.rs | 5 +++-- .../grouped/adaptive_packets/packet_wave_projection.rs | 5 +++-- .../qwen_forward/moe_expert/grouped/direct_gpu/arm.rs | 5 +++-- .../moe_expert/grouped/direct_gpu/loaded_arms.rs | 5 +++-- .../qwen_forward/moe_expert/grouped/direct_gpu/policy.rs | 6 ++++-- .../qwen_forward/moe_expert/grouped/direct_gpu/probe.rs | 5 +++-- .../src/qwen_forward/moe_expert/grouped/execute_bound.rs | 6 ++++-- .../moe_expert/grouped/finish_shared_with.rs | 5 +++-- .../moe_expert/grouped/ordered_down_refusal.rs | 6 ++++-- .../grouped/packet_run_project_group_direct.rs | 6 ++++-- .../qwen_forward/moe_expert/grouped/prepared_moe_row.rs | 6 ++++-- .../src/qwen_forward/moe_expert/grouped/project_group.rs | 6 ++++-- .../moe_expert/grouped/project_group_source_consumers.rs | 5 +++-- .../moe_expert/grouped/project_group_source_fenced.rs | 5 +++-- .../moe_expert/moe_activation_reuse_gpu/encoded.rs | 5 +++-- .../former_fixture_domain_refusal.rs | 5 +++-- .../src/qwen_forward/moe_expert/moe_down/down_scope.rs | 5 +++-- .../moe_expert/moe_down/moe_down_reuse_gpu/exact.rs | 4 ++-- .../moe_expert/moe_down/resident_packed_down.rs | 5 +++-- .../qwen_forward/moe_expert/moe_down/retained_scalar.rs | 5 +++-- .../src/qwen_forward/moe_expert/scoped_expert_mlp.rs | 5 +++-- .../src/qwen_forward/moe_expert/tests.rs | 3 ++- .../src/qwen_forward/moe_expert/validate_values.rs | 4 ++-- .../src/qwen_forward/moe_prefill_batch/device_bytes.rs | 5 +++-- .../moe_prefill_batch/moe_prefill_resources.rs | 5 +++-- .../qwen_forward/moe_prefill_batch/moe_prefill_stage.rs | 5 +++-- .../src/qwen_forward/moe_prefill_batch/tests.rs | 4 +++- .../src/qwen_forward/moe_route/project_logits.rs | 6 ++++-- .../src/qwen_forward/moe_route/router_logits.rs | 5 +++-- .../src/qwen_forward/moe_route/run_cuda.rs | 5 +++-- .../src/qwen_forward/moe_route/tests.rs | 4 ++++ .../cache_ephemeral_routed/ephemeral_mapped_stage.rs | 5 +++-- .../cache_ephemeral_routed/ephemeral_routed_owner.rs | 4 ++-- .../ephemeral_routed_owner/ephemeral_owner_allocation.rs | 5 +++-- .../ephemeral_owner_loans_and_drain.rs | 5 +++-- .../ephemeral_owner_stage_transfer.rs | 5 +++-- .../cache_ephemeral_routed/healthy_cancel.rs | 5 +++-- .../moe_weight_cache/cache_lru_index/lru_index.rs | 5 +++-- .../cache_lru_index/lru_index_seeding.rs | 5 +++-- .../moe_weight_cache/cache_lru_index/slot.rs | 4 ++-- .../moe_weight_cache/cache_lru_index/tests.rs | 4 +++- .../cache_original_prompt/moe_weight_cache.rs | 5 +++-- .../cache_original_prompt/moe_weights_original_prompt.rs | 5 +++-- .../cache_original_prompt/prompt_stream_settings.rs | 5 +++-- .../moe_weight_cache/cache_profile/learned_main_sdet.rs | 3 ++- .../moe_weight_cache/cache_profile/ranked_profile.rs | 5 +++-- .../cache_profile/shared_permanent_pool.rs | 5 +++-- .../cache_profile_fill/learned_main_lru_profile.rs | 5 +++-- .../cache_profile_fill/moe_weight_cache.rs | 4 ++-- .../moe_weight_cache/pinned_triplet_preload.rs | 5 +++-- .../moe_weight_cache/profile_ranked_fill_and_pool.rs | 5 +++-- .../cache_profile_fill/profile_window_spill.rs | 5 +++-- .../cache_profile_fill/shared_quartet_preload.rs | 5 +++-- .../cache_profile_fill/strata_adaptive_shared_pool.rs | 5 +++-- .../cache_strata_adaptive/adaptive_cache.rs | 5 +++-- .../moe_weight_cache/cache_strata_adaptive/reserve.rs | 5 +++-- .../moe_weight_cache/cache_strata_adaptive/tests.rs | 4 ++-- .../cache_strata_adaptive/transfer_metadata_bound.rs | 3 +-- .../moe_weight_cache/moe_cache_routed_owners.rs | 5 +++-- .../moe_weight_cache/moe_weight_cache_methods.rs | 4 ++-- .../moe_weight_cache_methods/moe_cache_close_owners.rs | 4 ++-- .../moe_cache_compose_shared_and_mtp.rs | 5 +++-- .../moe_weight_cache_methods/moe_cache_lru_updates.rs | 5 +++-- .../moe_cache_lru_updates/shared_keys.rs | 4 ++-- .../moe_cache_main_entry_routed_source.rs | 4 ++-- .../moe_cache_matrix_and_mtp_lookup.rs | 4 ++-- .../moe_cache_mmq_chunk_admission.rs | 5 +++-- .../moe_cache_mmq_constructors.rs | 4 ++-- .../moe_cache_shared_tail_constructors.rs | 4 ++-- .../moe_cache_triplet_plan_upload.rs | 5 +++-- .../moe_cache_validate_prepare_step.rs | 4 ++-- .../original_mtp_weights/dense_copies_equal.rs | 5 +++-- .../retained_original_mtp_weights.rs | 5 +++-- .../moe_weight_cache/routed_source_health.rs | 4 ++-- .../moe_weight_cache/routed_workspace_owner.rs | 5 +++-- .../moe_weight_cache/validate_ranked_profile.rs | 5 +++-- .../engine-qwen35-cuda/src/qwen_forward/mtp/mtp_frame.rs | 6 ++++-- .../qwen_forward/mtp/project_attention_out_numeric.rs | 5 +++-- .../qwen_forward/mtp/state/chunk/checked_chunk_end.rs | 6 ++++-- .../src/qwen_forward/mtp/state/chunk/mtp_session.rs | 4 ++-- .../src/qwen_forward/mtp/state/dense_kv.rs | 5 +++-- .../src/qwen_forward/mtp/state/mtp_session.rs | 5 +++-- .../src/qwen_forward/mtp/state/prefix_draft_snapshot.rs | 5 +++-- .../src/qwen_forward/mtp/state/tests.rs | 4 +++- crates/engine-qwen35-cuda/src/qwen_forward/mtp/step.rs | 6 ++++-- .../src/qwen_forward/mtp_attention/attention_stage.rs | 6 ++++-- .../qwen_forward/mtp_attention/attention_transport.rs | 5 +++-- .../src/qwen_forward/mtp_attention/dense_geometry.rs | 5 +++-- .../src/qwen_forward/mtp_attention/tests.rs | 3 ++- .../qwen_forward/mtp_decode/batch_gpu/check_loaded.rs | 4 ++-- .../mtp_decode/batch_gpu/check_loaded/flow.rs | 5 +++-- .../batch_gpu/check_loaded/flow_decode_edge_scenarios.rs | 5 +++-- .../mtp_decode/batch_gpu/check_loaded/position_at.rs | 4 ++-- .../src/qwen_forward/mtp_decode/batch_gpu/collection.rs | 5 +++-- .../qwen_forward/mtp_decode/first_seed_reuse_enabled.rs | 6 ++++-- .../src/qwen_forward/mtp_decode/mtp_window_spec.rs | 5 +++-- .../src/qwen_forward/mtp_experts/append_row.rs | 4 ++-- .../mtp_experts/fixed_workspace/fixed_buffers.rs | 5 +++-- .../mtp_experts/fixed_workspace/fixed_workspace_gpu.rs | 4 +++- .../src/qwen_forward/mtp_experts/fixed_workspace/role.rs | 6 ++++-- .../mtp_experts/fixed_workspace/transport_drop.rs | 5 +++-- .../src/qwen_forward/mtp_experts/mtp_block.rs | 6 ++++-- .../mtp_expert_transport_gpu/exact.rs | 5 +++-- .../mtp_expert_transport_gpu/owner_guards.rs | 5 +++-- .../mtp_experts/mtp_expert_transport/role.rs | 6 ++++-- .../mtp_experts/mtp_expert_transport/shared_project.rs | 5 +++-- .../mtp_experts/routed_and_shared_experts.rs | 5 +++-- .../src/qwen_forward/mtp_experts/tests.rs | 4 +++- .../src/qwen_forward/mtp_gr/driver_error.rs | 6 ++++-- .../src/qwen_forward/mtp_gr/finalize.rs | 6 ++++-- .../mtp_full_owner_actor_close.rs | 5 +++-- .../original_mtp_full_owner_methods.rs | 6 ++++-- .../original_mtp_full_owner/original_mtp_request.rs | 5 +++-- .../original_mtp_verified_adapter/driver_error.rs | 5 +++-- .../original_mtp_draft_receipt.rs | 6 ++++-- .../original_prompt_executor.rs | 6 ++++-- .../src/qwen_forward/original_serve_config/tests.rs | 3 ++- .../original_serve_engine/draft_completion.rs | 4 ++-- .../draft_completion/serve_engine_draft_commit.rs | 5 +++-- .../qwen_forward/original_serve_engine/round_tally.rs | 4 ++-- .../round_tally/original_serve_settings.rs | 5 +++-- .../original_serve_engine/round_tally/serve_rounds.rs | 5 +++-- .../src/qwen_forward/original_serve_engine/tests.rs | 3 ++- .../tests/constructor_validates_dimensions.rs | 5 ++--- .../tests/restore_attempts_do_not_depend.rs | 6 ++---- .../original_serve_host_native_serve_host.rs | 4 ++-- .../qwen_forward/original_serve_host/request_sampling.rs | 5 +++-- .../src/qwen_forward/original_serve_host/tests.rs | 3 ++- .../native_serve_port_original_serve_port.rs | 4 ++-- .../qwen_forward/original_serve_native/native_window.rs | 5 +++-- .../qwen_forward/original_serve_pool/cpu_expert_pool.rs | 5 +++-- .../src/qwen_forward/original_serve_pool/direct_tier.rs | 5 +++-- .../qwen_forward/original_serve_pool/direct_tier_drop.rs | 4 ++-- .../original_serve_pool/prefetch_off_file_exists.rs | 5 +++-- .../src/qwen_forward/original_serve_pool/tests.rs | 3 ++- .../src/qwen_forward/original_serve_request/tests.rs | 3 ++- .../original_serve_residency/source_spans.rs | 4 ++-- .../original_serve_residency/span_cache_and_pcie_lag.rs | 4 ++-- .../original_serve_residency/split_group_pcie.rs | 5 +++-- .../original_serve_residency/tail_skip_rank.rs | 4 ++-- .../src/qwen_forward/original_serve_residency/tests.rs | 3 ++- .../original_serve_stack/conversation/tests.rs | 3 ++- .../original_serve_stack_device_ports.rs | 4 ++-- .../original_serve_stack_decode_phase.rs | 4 ++-- .../original_serve_stack_decode_phase/decode_steps.rs | 5 ++--- .../original_serve_stack_decode_phase/decode_view.rs | 2 +- .../original_serve_stack_memory_classes.rs | 4 ++-- .../original_serve_stack_metrics_close.rs | 4 ++-- .../original_serve_stack_open.rs | 4 ++-- .../original_serve_stack_open/assemble.rs | 4 ++-- .../original_serve_stack_open/open_phases.rs | 4 ++-- .../original_serve_stack_prefill_chunk.rs | 4 ++-- .../original_serve_stack_prefill_phase.rs | 4 ++-- .../original_serve_stack/prefix/prefix_config.rs | 4 ++-- .../original_serve_stack/prefix/prefix_serve.rs | 4 ++-- .../prefix_serve/prefix_serve_after_phase_parking.rs | 4 ++-- .../prefix_serve/prefix_serve_store_and_shedding.rs | 4 ++-- .../qwen_forward/original_serve_stack/prefix/tests.rs | 3 ++- .../prefix/tests/one_token_prompt_reads.rs | 7 ++----- .../original_serve_stack/prefix/tests/second_session.rs | 7 ++----- .../qwen_forward/original_serve_stack/prompt_chunk.rs | 4 ++-- .../original_serve_stack/stack_config_and_ttft_marks.rs | 4 ++-- .../qwen_forward/original_serve_stack/stack_groups.rs | 4 ++-- .../src/qwen_forward/original_serve_stack/tests.rs | 3 ++- .../src/qwen_forward/original_serve_verifier/tests.rs | 3 ++- .../original_spec_controller_finish.rs | 5 +++-- .../original_spec_controller_start_request.rs | 5 +++-- .../original_spec_controller_verify_commit.rs | 4 ++-- .../src/qwen_forward/original_spec_controller/tests.rs | 3 ++- .../tests/adaptation_join_failure_is_reported.rs | 6 ++---- .../tests/config_rejects_out_of_range.rs | 7 +++---- .../original_spec_controller/tests/non_finite_window.rs | 7 +++---- .../original_spec_controller/trace_enabled.rs | 4 ++-- .../src/qwen_forward/output/original_prompt_sample.rs | 5 +++-- .../src/qwen_forward/output/output_stage.rs | 4 ++-- .../output/output_stage/output_stage_load_and_logits.rs | 4 ++-- .../output_stage/output_stage_sampling_projection.rs | 5 +++-- .../src/qwen_forward/output/output_stage_test_replay.rs | 4 ++-- .../engine-qwen35-cuda/src/qwen_forward/output/tests.rs | 3 ++- .../prompt_device_rows/prompt_device_read.rs | 4 ++-- .../prompt_device_read/produce_original_gdn.rs | 5 +++-- .../prompt_device_read/read_completion.rs | 4 ++-- .../prompt_device_rows/prompt_ple_history.rs | 4 ++-- .../src/qwen_forward/prompt_device_rows/std_ops_deref.rs | 4 ++-- .../std_ops_deref/prompt_device_rows.rs | 5 +++-- .../std_ops_deref/prompt_device_rows_ple_read.rs | 4 ++-- .../std_ops_deref/source_input_deref.rs | 4 ++-- .../q6_attention_columns/column_projection.rs | 5 +++-- .../qwen_forward/q6_attention_columns/projection_row.rs | 5 +++-- .../src/qwen_forward/q6_attention_columns/q6_numeric.rs | 5 +++-- .../qwen_forward/qsa_attention/decode_selected_cached.rs | 5 +++-- .../src/qwen_forward/qsa_attention/native_attended.rs | 5 +++-- .../src/qwen_forward/qsa_attention/qsa_ready.rs | 5 +++-- .../src/qwen_forward/qsa_index/context.rs | 5 +++-- .../qsa_index/directory/qsa_directory_sdet.rs | 3 +++ .../src/qwen_forward/qsa_index/index_kernels.rs | 4 ++-- .../qwen_forward/qsa_index/index_resident/max_rows.rs | 5 +++-- .../qsa_index/index_resident/synthetic_late_prior.rs | 3 +-- .../resident_device/resident_qsa_completed.rs | 5 +++-- .../prompt_device/resident_device/resident_qsa_layer.rs | 5 +++-- .../prompt_device/resident_device/resident_qsa_prior.rs | 5 +++-- .../resident_device/resident_qsa_span_export_and_seal.rs | 5 +++-- .../resident_device/scalar/gated_out_projection.rs | 4 ++-- .../resident_device/scalar/scalar_row_admission.rs | 4 ++-- .../resident_device/scalar/scalar_row_run.rs | 4 ++-- .../src/qwen_forward/qsa_index/qsa_index_stage.rs | 5 +++-- .../src/qwen_forward/qsa_index/qsa_pending.rs | 4 ++-- .../src/qwen_forward/qsa_index/qsa_projection.rs | 4 ++-- .../src/qwen_forward/qsa_index/selected_cache/tests.rs | 3 ++- .../src/qwen_forward/qsa_index/validate_ids.rs | 4 ++-- .../qsa_prefill_batch/native_projection_row.rs | 5 +++-- .../qwen_forward/qsa_prefill_batch/projection_rows.rs | 4 ++-- .../src/qwen_forward/router_scratch/gpu/report.rs | 5 +++-- .../src/qwen_forward/router_scratch/gpu/valid_reset.rs | 5 +++-- .../src/qwen_forward/session/chunk/gdn_chunk_start.rs | 5 +++-- .../qwen_forward/session/chunk/host_charge_bounded.rs | 5 +++-- .../src/qwen_forward/session/chunk/qwen_chunk_txn.rs | 5 +++-- .../qwen_chunk_txn/qwen_chunk_txn_attention_sources.rs | 4 ++-- .../session/chunk/qwen_chunk_txn/qwen_chunk_txn_begin.rs | 5 +++-- .../qwen_chunk_txn/qwen_chunk_txn_ffn_after_attention.rs | 4 ++-- .../qwen_chunk_txn/qwen_chunk_txn_finish_publish.rs | 5 +++-- .../chunk/qwen_chunk_txn/qwen_chunk_txn_gdn_micro.rs | 5 +++-- .../chunk/qwen_chunk_txn/qwen_chunk_txn_layer_batch.rs | 4 ++-- .../chunk/qwen_chunk_txn/qwen_chunk_txn_micro_inputs.rs | 5 +++-- .../chunk/qwen_chunk_txn/qwen_chunk_txn_micro_window.rs | 4 ++-- .../qwen_chunk_txn/qwen_chunk_txn_rows_and_witness.rs | 4 ++-- .../session/chunk/test_gdn_component_rows.rs | 4 ++-- .../src/qwen_forward/session/chunk/txn_groups.rs | 4 ++-- .../qwen_forward/session/chunk/verify/qwen_chunk_txn.rs | 4 ++-- .../qwen_chunk_txn/qwen_chunk_txn_begin_verification.rs | 5 +++-- .../qwen_chunk_txn/qwen_chunk_txn_verification_state.rs | 4 ++-- .../qwen_chunk_txn/qwen_chunk_txn_verified_prefix.rs | 5 +++-- .../src/qwen_forward/session/chunk/verify/tests.rs | 3 ++- .../session/chunk/verify/verified_target_prefix.rs | 4 ++-- .../original_prompt/draft/original_draft_checkpoint.rs | 5 +++-- .../draft/original_draft_session_ring_restore.rs | 5 +++-- .../draft/published_first_materialized.rs | 4 ++-- .../session/original_prompt/original_prompt_input.rs | 4 ++-- .../original_prompt_input_qsa_seed.rs | 4 ++-- .../original_prompt_input/qwen_session.rs | 5 +++-- .../session/original_prompt/original_prompt_phase.rs | 4 ++-- .../session/original_prompt/original_prompt_txn.rs | 3 +-- .../original_prompt_txn/original_prompt_txn_begin.rs | 4 ++-- .../original_prompt_txn_prior_and_abort.rs | 4 ++-- .../original_prompt_txn/original_prompt_txn_publish.rs | 4 ++-- .../src/qwen_forward/session/original_verified/tests.rs | 4 +++- .../src/qwen_forward/session/qwen_session.rs | 4 ++-- .../src/qwen_forward/session/qwen_step_txn.rs | 3 +-- .../session/qwen_step_txn/qwen_step_txn_inputs.rs | 4 ++-- .../session/qwen_step_txn/qwen_step_txn_prior_finish.rs | 4 ++-- .../src/qwen_forward/session/reset_replay_snapshot.rs | 5 +++-- .../engine-qwen35-cuda/src/qwen_forward/session/tests.rs | 3 ++- .../session/tests/gdn_session_commit_advances_all.rs | 8 +++----- .../session/tests/retained_gr_handoff_identity.rs | 8 +++----- crates/engine-qwen35-cuda/src/serve_meta/tests.rs | 4 +++- crates/engine-qwen35-cuda/src/serve_tuning/tests.rs | 4 ++++ crates/engine-qwen35-cuda/src/settings/capture_tests.rs | 4 ++++ 438 files changed, 1084 insertions(+), 843 deletions(-) diff --git a/crates/engine-core/src/conversation/cache/conversation_cache.rs b/crates/engine-core/src/conversation/cache/conversation_cache.rs index a5374a9d..6f47f887 100644 --- a/crates/engine-core/src/conversation/cache/conversation_cache.rs +++ b/crates/engine-core/src/conversation/cache/conversation_cache.rs @@ -1,5 +1,6 @@ -//! Methods of `ConversationCache`: `new`, `enabled`, `budget`, `slots` and 15 more. Functions: `deepest_key`. -//! Split out of `cache` to keep its files under the line limit. +//! Behaviour of the parked-conversation cache: byte and slot accounting, the retained K/V reuse buffers, best-prefix +//! lookup, making room by eviction, removal of superseded copies and `put`. +//! Pure CPU policy; the types and the `ParkedConversation` trait it works on are in the parent `cache` module. use super::{ CheckpointKey, ConversationCache, ConversationImageKey, ConversationKv, ConversationKvReuse, Match, diff --git a/crates/engine-core/src/conversation/cache/conversation_checkpoint.rs b/crates/engine-core/src/conversation/cache/conversation_checkpoint.rs index a3491442..9d82b16c 100644 --- a/crates/engine-core/src/conversation/cache/conversation_checkpoint.rs +++ b/crates/engine-core/src/conversation/cache/conversation_checkpoint.rs @@ -1,5 +1,5 @@ -//! Methods of `ConversationCheckpoint`: `bytes`. Methods of `ConversationKv`: `bytes`, `buffers`, `buffers_mut`. -//! Implements `Default for SavedConversation`, `ParkedConversation for SavedConversation`. +//! Byte accounting of a saved checkpoint and of a layer's K/V buffers, the reuse bookkeeping for retained K/V, and +//! the `ParkedConversation` view of a host-memory `SavedConversation` (live and checkpoint keys, steering, size). use super::{ CheckpointKey, ConversationBuffer, ConversationCheckpoint, ConversationImageKey, ConversationKv, diff --git a/crates/engine-core/src/conversation/cache/tests/retained_buffers_count_against_bytes.rs b/crates/engine-core/src/conversation/cache/tests/retained_buffers_count_against_bytes.rs index 3971be70..010a0a59 100644 --- a/crates/engine-core/src/conversation/cache/tests/retained_buffers_count_against_bytes.rs +++ b/crates/engine-core/src/conversation/cache/tests/retained_buffers_count_against_bytes.rs @@ -1,6 +1,6 @@ -//! Tests of tests by topic (moved out of the test file by STRA-338): -//! retained_buffers_count_against_bytes_but_not_slots, a_b_a_recovery_and_slot_eviction, -//! checkpoints_steering_and_boundary_rules, image_identity_is_part_of_the_prefix .... +//! Pins the cache accounting and eviction rules: retained K/V buffers cost bytes but no slot, A-B-A recovery, slot +//! and byte eviction oldest first, checkpoint, steering and boundary matching, image identity as part of the prefix, +//! and superseded copies of one conversation never pushing another out. use super::{A, B, ConversationCache, ConversationImageKey, ConversationKv, cp, exact_kv_layers, image, size_of, with}; diff --git a/crates/engine-core/src/conversation/cache/tests/what_is_not_superseded.rs b/crates/engine-core/src/conversation/cache/tests/what_is_not_superseded.rs index 6c62309e..a9cf235a 100644 --- a/crates/engine-core/src/conversation/cache/tests/what_is_not_superseded.rs +++ b/crates/engine-core/src/conversation/cache/tests/what_is_not_superseded.rs @@ -1,6 +1,5 @@ -//! Tests of `tests` by topic: what_is_not_superseded, -//! disabled_caches_store_nothing, take_out_of_range_is_none_and_prefix_len_is_generic_over_token_types, -//! struct_sizes_match_the_64_bit_original_layout. +//! Pins what the cache must NOT treat as superseded (other conversations sharing only a root, a different steering +//! mode, entries without checkpoints), plus the disabled-cache, out-of-range `take` and struct-layout edge cases. use super::{ A, B, ConversationCache, ConversationCheckpoint, ConversationImageKey, ConversationKv, SavedConversation, cp, diff --git a/crates/engine-core/src/conversation/kv/kv_image_readback.rs b/crates/engine-core/src/conversation/kv/kv_image_readback.rs index 9706651b..4f8886c9 100644 --- a/crates/engine-core/src/conversation/kv/kv_image_readback.rs +++ b/crates/engine-core/src/conversation/kv/kv_image_readback.rs @@ -1,5 +1,5 @@ -//! Functions: `verify_ring`, `kv_verify`. -//! Split out of `kv` to keep its files under the line limit. +//! Read-back check of a restored K/V layer: the saved bytes and the drafter ring's resident pages are compared with +//! the device and the authoritative payload is fingerprinted. Diagnostic only; it never changes model state. use super::{ ConvResult, ConversationKv, KvLayer, KvPool, KvTarget, QsaDesc, StateMemory, Verifier, kv_validate, region, diff --git a/crates/engine-core/src/conversation/kv/kv_image_save_restore.rs b/crates/engine-core/src/conversation/kv/kv_image_save_restore.rs index 95d15b35..bfb979f5 100644 --- a/crates/engine-core/src/conversation/kv/kv_image_save_restore.rs +++ b/crates/engine-core/src/conversation/kv/kv_image_save_restore.rs @@ -1,5 +1,6 @@ -//! Methods of `Verifier`: `compare`, `failure`. -//! Functions: `set_geometry`, `reusable_prefix`, `capture_buffer`, `capture_layer` and 5 more. +//! Capture, validation and restore of one layer's K/V image against device memory. Capture keeps the unchanged prefix +//! of buffers retained from an earlier restore and copies only the rest; restore refills streamed residency. +//! Also the `Verifier` that compares device bytes with the image for the read-back check. use super::{ ConvError, ConvResult, ConversationKv, IDX_BLOCK, KvLayer, KvPool, KvTarget, Layout, ModelGeometry, PAGE_SIZE, diff --git a/crates/engine-core/src/conversation/kv/layout.rs b/crates/engine-core/src/conversation/kv/layout.rs index 0bd3a91a..8b55d9df 100644 --- a/crates/engine-core/src/conversation/kv/layout.rs +++ b/crates/engine-core/src/conversation/kv/layout.rs @@ -1,5 +1,5 @@ -//! Methods of `Layout`: `sizes`. -//! Functions: `kv_q4_bytes_per_head`, `valid_extent`, `geometry_ok`, `check_layout_inputs` and 12 more. +//! Byte layout of one layer's K/V image: the snapshot format code, the extent and geometry checks, and the sizes of +//! keys, values, scales and pooled indexer rows. `kv_bytes` and `kv_capture_bytes` give the sizes a capture needs. use super::{ ConvError, ConvResult, ConversationKv, IDX_BLOCK, KV_HYBRID, KV_ROTATED, KvLayer, KvPool, Layout, ModelGeometry, diff --git a/crates/engine-core/src/conversation/manager/conversation_manager.rs b/crates/engine-core/src/conversation/manager/conversation_manager.rs index e97714f5..49224e07 100644 --- a/crates/engine-core/src/conversation/manager/conversation_manager.rs +++ b/crates/engine-core/src/conversation/manager/conversation_manager.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `conversation_resume_checkpoints`, `conversation_state_events`. -//! Split out of `manager` to keep its files under the line limit. +//! Hub of the `ConversationManager` implementation: the resume and checkpoint half and the state and parking half +//! live in the two child modules and share the imports declared here. use super::{ CheckpointKey, ConvError, ConvResult, ConversationCache, ConversationCheckpoint, ConversationImageKey, diff --git a/crates/engine-core/src/conversation/manager/conversation_manager/conversation_resume_checkpoints.rs b/crates/engine-core/src/conversation/manager/conversation_manager/conversation_resume_checkpoints.rs index 8735e1d3..c579b7ac 100644 --- a/crates/engine-core/src/conversation/manager/conversation_manager/conversation_resume_checkpoints.rs +++ b/crates/engine-core/src/conversation/manager/conversation_manager/conversation_resume_checkpoints.rs @@ -1,5 +1,6 @@ -//! Methods of `ConversationManager`: `pick_resume`, `take_incoming`, `restore_parked`, `align_to_request` and 10 more. -//! Split out of `conversation_manager` to keep its files under the line limit. +//! The request path of `ConversationManager`: choose what a request resumes from (live session, checkpoint or parked +//! conversation), restore and position the device, then keep the checkpoint chain through the prompt and at the end. +//! Mirrors the resume choice and `checkpoint_at` of the Original's `generate.cpp`. use super::{ ConvError, ConvResult, ConversationCheckpoint, ConversationImageKey, ConversationManager, PromptAction, PromptPath, diff --git a/crates/engine-core/src/conversation/manager/conversation_manager/conversation_state_events.rs b/crates/engine-core/src/conversation/manager/conversation_manager/conversation_state_events.rs index 1bfd0e3d..0814efe3 100644 --- a/crates/engine-core/src/conversation/manager/conversation_manager/conversation_state_events.rs +++ b/crates/engine-core/src/conversation/manager/conversation_manager/conversation_state_events.rs @@ -1,5 +1,5 @@ -//! Methods of `ConversationManager`: `new`, `options`, `live`, `live_ok` and 13 more. -//! Split out of `conversation_manager` to keep its files under the line limit. +//! The state half of `ConversationManager`: construction, read-only views of the live tokens, checkpoints and cache, +//! the event log, invalidation, and the parking of the current session (size estimate, making room, capture, store). use super::{ CheckpointKey, ConvResult, ConversationCache, ConversationCheckpoint, ConversationKvReuse, ConversationManager, diff --git a/crates/engine-core/src/conversation/manager/conversation_options_default.rs b/crates/engine-core/src/conversation/manager/conversation_options_default.rs index af5aceb8..3b648d38 100644 --- a/crates/engine-core/src/conversation/manager/conversation_options_default.rs +++ b/crates/engine-core/src/conversation/manager/conversation_options_default.rs @@ -1,5 +1,5 @@ -//! Implements `Default for ConversationOptions`. Functions: `images_below`, `starts_with`, `is_allocation`. -//! Split out of `manager` to keep its files under the line limit. +//! Default `ConversationOptions` and the prompt-prefix helpers the manager uses: picture positions below a limit, +//! the "saved point is a prefix of the request" test, and the classification of allocation failures. use super::{ConvError, ConversationImageKey, ConversationOptions}; diff --git a/crates/engine-core/src/conversation/manager_tests/byte_budget_and_slot.rs b/crates/engine-core/src/conversation/manager_tests/byte_budget_and_slot.rs index 7f4f3014..61f47879 100644 --- a/crates/engine-core/src/conversation/manager_tests/byte_budget_and_slot.rs +++ b/crates/engine-core/src/conversation/manager_tests/byte_budget_and_slot.rs @@ -1,8 +1,7 @@ -//! Tests of manager_tests by topic (moved out of the test file by STRA-338): -//! the_byte_budget_and_slot_limit_evict_oldest_first, -//! an_incompatible_parked_image_is_discarded_and_the_request_falls_back, -//! a_failed_restore_transfer_is_fatal_to_the_request, -//! switching_steering_invalidates_checkpoints_and_isolates_parked_images .... +//! Pins the manager's budget and failure rules: the byte budget and slot limit evict oldest first, an incompatible +//! parked image is discarded, a failed restore transfer is fatal, steering switches isolate parked images, a +//! cancelled prompt keeps its checkpoints, periodic checkpoints follow the chunk stride, and pictures and the PLE +//! history window are part of the resume identity. use super::{ConversationImageKey, DeviceEngine, ReplayedRequest, TURN, chat, gen_tokens, options, world}; diff --git a/crates/engine-core/src/conversation/manager_tests/continuing_chat_reuses.rs b/crates/engine-core/src/conversation/manager_tests/continuing_chat_reuses.rs index 75d1bd2b..1460bbfa 100644 --- a/crates/engine-core/src/conversation/manager_tests/continuing_chat_reuses.rs +++ b/crates/engine-core/src/conversation/manager_tests/continuing_chat_reuses.rs @@ -1,7 +1,6 @@ -//! Tests of manager_tests by topic (moved out of the test file by STRA-338): -//! a_continuing_chat_reuses_the_live_session_without_a_copy, an_identical_prompt_still_reads_its_last_token, -//! a_rewritten_tail_resumes_from_the_turn_boundary_checkpoint, the_shared_root_is_pinned_while_other_checkpoints_rotate -//! .... +//! Pins which source a request resumes from: a continuing chat reuses the live session without a copy, a rewritten +//! tail resumes from the turn-boundary checkpoint, the shared root stays pinned while other checkpoints rotate, +//! switching conversations parks and restores exactly, and physical-memory admission gates parking. use super::{GIB, ReplayedRequest, Run, TURN, World, chat, gen_tokens, options, world}; diff --git a/crates/engine-core/src/conversation/manager_tests/hash.rs b/crates/engine-core/src/conversation/manager_tests/hash.rs index e2f310ff..96261fce 100644 --- a/crates/engine-core/src/conversation/manager_tests/hash.rs +++ b/crates/engine-core/src/conversation/manager_tests/hash.rs @@ -1,5 +1,5 @@ -//! Methods of `SimDevice`: `per`, `row_bytes`, `write_cell`, `mirror_ring` and 7 more. -//! Implements `StateMemory for SimDevice`. Functions: `hash`, `pat`, `pattern`, `idx`. +//! The simulated device memory of the manager tests: token-prefix hashing and patterns, the `SimDevice` byte regions +//! (running state, K/V pools, indexer rows, drafter ring) and its `StateMemory` implementation. use super::{ IdxKind, KvLayer, KvPool, PAGE, RingBlocks, SLOTS, SimDevice, StateMemory, StateRegion, kv_region, state_sizes, diff --git a/crates/engine-core/src/conversation/manager_tests/sim_device_session_device.rs b/crates/engine-core/src/conversation/manager_tests/sim_device_session_device.rs index c9b9902f..257b4a67 100644 --- a/crates/engine-core/src/conversation/manager_tests/sim_device_session_device.rs +++ b/crates/engine-core/src/conversation/manager_tests/sim_device_session_device.rs @@ -1,5 +1,5 @@ -//! Methods of `ReplayedRequest`: `new`. Methods of `World`: `read_plan`, `request`. -//! Implements `SessionDevice for SimDevice`. +//! The simulated world of the manager tests: `SimDevice` as a `SessionDevice`, the small model geometry, the +//! `World` that replays requests (reading a prompt plan into device state) and the chat and token generators. use super::{ ConversationImageKey, ConversationManager, ConversationOptions, DeviceEngine, Fixture, FixtureGeometry, GIB, diff --git a/crates/engine-core/src/conversation/snapshot_tests/fixture.rs b/crates/engine-core/src/conversation/snapshot_tests/fixture.rs index e7f93bd4..1c6f0bb8 100644 --- a/crates/engine-core/src/conversation/snapshot_tests/fixture.rs +++ b/crates/engine-core/src/conversation/snapshot_tests/fixture.rs @@ -1,5 +1,5 @@ -//! Methods of `Fx`: `new`, `unchanged`, `restore`, `reject` and 13 more. -//! Functions: `fixture_geometry`, `fixture_session`, `fixture_checkpoint`, `fixture_image` and 3 more. +//! The fixture of the snapshot tests: a small model with a first, a last and a drafter layer registered in host +//! memory, a complete saved image, and the checks `Fx` runs on it (sizes, save, restore, rejection before any write). use super::{ ConversationCheckpoint, ConversationImageKey, ConversationKvReuse, ConversationView, HostMemory, IDX_BLOCK, diff --git a/crates/engine-core/src/conversation/snapshot_tests/full_session.rs b/crates/engine-core/src/conversation/snapshot_tests/full_session.rs index 504ec73d..ce4a69ae 100644 --- a/crates/engine-core/src/conversation/snapshot_tests/full_session.rs +++ b/crates/engine-core/src/conversation/snapshot_tests/full_session.rs @@ -1,5 +1,5 @@ -//! Methods of `Session`: `new`, `spare`, `fill`, `save_checkpoint` and 9 more. -//! Functions: `session_geometry`, `put_session_regions`, `session_spec`, `full_session`. Defines `Session`. +//! The whole-session scenario of the snapshot tests: a main and a draft layer with running state and checkpoints in +//! one host memory, saved and restored, with the observations compared against the golden values. use super::{ ConversationCheckpoint, ConversationImageKey, ConversationKv, ConversationKvReuse, Fixture, HYBRID, HostMemory, diff --git a/crates/engine-core/src/conversation/snapshot_tests/golden_state.rs b/crates/engine-core/src/conversation/snapshot_tests/golden_state.rs index fe714149..b412eb3a 100644 --- a/crates/engine-core/src/conversation/snapshot_tests/golden_state.rs +++ b/crates/engine-core/src/conversation/snapshot_tests/golden_state.rs @@ -1,5 +1,5 @@ -//! Functions: `golden_state`, `fnv`, `fnv_buf`, `assert_kv` and 2 more. -//! Split out of `snapshot_tests` to keep its files under the line limit. +//! Helpers that compare saved images, K/V layers and checkpoints with the golden JSON the Original's C++ produced: +//! FNV fingerprints of the buffers and the field-by-field assertions. use super::{ConversationCheckpoint, ConversationKv, SavedConversation}; diff --git a/crates/engine-core/src/conversation/snapshot_tests/kv_level.rs b/crates/engine-core/src/conversation/snapshot_tests/kv_level.rs index f7d9e702..3cd00fd8 100644 --- a/crates/engine-core/src/conversation/snapshot_tests/kv_level.rs +++ b/crates/engine-core/src/conversation/snapshot_tests/kv_level.rs @@ -1,5 +1,5 @@ -//! Methods of `Level`: `save`, `restore`, `reject_hybrid_streaming`, `reject_bad_extents` and 5 more. -//! Functions: `kv_level`. Defines `Level`. +//! The per-layer K/V scenario of the snapshot tests: for one format and residency mode, save, restore, verify, and +//! reject hybrid-streaming and bad extents, over one fixture layer in host memory. use super::{ ConversationKv, Fixture, HYBRID, HostMemory, KV_INT8, KV_Q4, KV_VALUE_INT8, KvLayer, KvPool, KvTarget, equal, diff --git a/crates/engine-core/src/conversation/snapshot_tests/kv_region.rs b/crates/engine-core/src/conversation/snapshot_tests/kv_region.rs index 15244030..9bbb63c0 100644 --- a/crates/engine-core/src/conversation/snapshot_tests/kv_region.rs +++ b/crates/engine-core/src/conversation/snapshot_tests/kv_region.rs @@ -1,5 +1,5 @@ -//! Methods of `Alloc`: `put`. Methods of `Fixture`: `new`, `with_geometry`, `source`, `fill` and 1 more. -//! Functions: `kv_region`, `mk_view`, `equal`, `q4_per_head` and 8 more. Defines `Alloc`, `Dims`. +//! Allocation of the K/V pools of a snapshot-test layer (fp16, INT8, Q4_0 and hybrid formats, device slots and host +//! pools) in host memory, and the region and view helpers the other snapshot tests share. use super::{ ConversationCheckpoint, ConversationImageKey, ConversationKv, ConversationView, Fixture, FixtureGeometry, HYBRID, diff --git a/crates/engine-core/src/conversation/snapshot_tests/layer_snapshots_are_byte_exact.rs b/crates/engine-core/src/conversation/snapshot_tests/layer_snapshots_are_byte_exact.rs index 61f985bc..7caef515 100644 --- a/crates/engine-core/src/conversation/snapshot_tests/layer_snapshots_are_byte_exact.rs +++ b/crates/engine-core/src/conversation/snapshot_tests/layer_snapshots_are_byte_exact.rs @@ -1,7 +1,6 @@ -//! Tests of snapshot_tests by topic (moved out of the test file by STRA-338): -//! layer_snapshots_are_byte_exact_across_formats_and_residency_modes, whole_session_snapshots_round_trip_exactly, -//! validation_rejects_before_any_device_write_and_faults_are_fatal, -//! checkpoint_save_restore_round_trips_through_host_memory .... +//! Pins the snapshot contracts: layer and whole-session images are byte exact across formats and residency modes, +//! validation rejects before any device write, checkpoints round-trip through host memory, and geometry, carve sizes, +//! layouts and payload hashes match the Original's golden values. use super::{ ConversationCheckpoint, ConversationKv, Fixture, HYBRID, HostMemory, IDX_BLOCK, IdxKind, KV_F16, KV_INT8, KV_Q4, diff --git a/crates/engine-core/src/conversation/snapshot_tests/pools.rs b/crates/engine-core/src/conversation/snapshot_tests/pools.rs index a1dfcfd3..49f02dc9 100644 --- a/crates/engine-core/src/conversation/snapshot_tests/pools.rs +++ b/crates/engine-core/src/conversation/snapshot_tests/pools.rs @@ -1,5 +1,5 @@ -//! Methods of `Pools`: `new`, `register`, `image`. Functions: `mark_present`. -//! Split out of `snapshot_tests` to keep its files under the line limit. +//! The K/V pool set of a snapshot-test layer: which buffers a format has (fp16, INT8, Q4_0), registering them in host +//! memory and building the matching image. use super::{ ConversationKv, HostMemory, IdxKind, KvLayer, KvPool, ModelGeometry, Pools, QsaDesc, StateRegion, kv_region, diff --git a/crates/engine-core/src/prefix_cache/store/decayed.rs b/crates/engine-core/src/prefix_cache/store/decayed.rs index 3162928a..ac306720 100644 --- a/crates/engine-core/src/prefix_cache/store/decayed.rs +++ b/crates/engine-core/src/prefix_cache/store/decayed.rs @@ -1,5 +1,4 @@ -//! Functions: `decayed`. -//! Split out of `store` to keep its files under the line limit. +//! Half-life decay of a hit mass or prior with age, shared by the store's value estimate. pub(super) fn decayed(value: f64, age: u64, half_life: f64) -> f64 { diff --git a/crates/engine-core/src/prefix_cache/store/policy_params_default.rs b/crates/engine-core/src/prefix_cache/store/policy_params_default.rs index 889d82da..730c7369 100644 --- a/crates/engine-core/src/prefix_cache/store/policy_params_default.rs +++ b/crates/engine-core/src/prefix_cache/store/policy_params_default.rs @@ -1,5 +1,4 @@ -//! Methods of `Candidate`: `key`, `blocks`. Implements `Default for PolicyParams`. -//! Split out of `store` to keep its files under the line limit. +//! The operator-facing default values of `PolicyParams`, and the accessors of an admission `Candidate`. use super::{Candidate, PolicyParams}; diff --git a/crates/engine-core/src/prefix_cache/store/prefix_store.rs b/crates/engine-core/src/prefix_cache/store/prefix_store.rs index e904a804..f36680bf 100644 --- a/crates/engine-core/src/prefix_cache/store/prefix_store.rs +++ b/crates/engine-core/src/prefix_cache/store/prefix_store.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `admit`, `prefix_store_consider_commit`, `prefix_store_evict_and_budget` and 2 more. -//! Split out of `store` to keep its files under the line limit. +//! Hub of the `PrefixStore` implementation: admission, the consider and commit path, eviction and budget, the +//! statistics and clock, and node scoring each live in a child module over the shared store types. use super::{ Block, ByteSize, CHAIN_SEED, Candidate, Consider, HashMap, HashSet, KeptTail, Match, Node, NodePayload, diff --git a/crates/engine-core/src/prefix_cache/store/prefix_store/prefix_store_consider_commit.rs b/crates/engine-core/src/prefix_cache/store/prefix_store/prefix_store_consider_commit.rs index 887dc6e1..7d240b09 100644 --- a/crates/engine-core/src/prefix_cache/store/prefix_store/prefix_store_consider_commit.rs +++ b/crates/engine-core/src/prefix_cache/store/prefix_store/prefix_store_consider_commit.rs @@ -1,5 +1,5 @@ -//! Methods of `PrefixStore`: `consider`, `consider_tail`, `candidate_value`, `commit` and 3 more. -//! Split out of `prefix_store` to keep its files under the line limit. +//! Admission decision and commit of prefix-store nodes: `consider` (is a node worth its bytes), the request-end tail +//! variants, the value estimate of a candidate, and `commit` once the caller has built the payloads. use super::{ByteSize, Candidate, Consider, HashSet, KeptTail, NodePayload, PrefixStore, Reject}; diff --git a/crates/engine-core/src/prefix_cache/store/prefix_store/prefix_store_evict_and_budget.rs b/crates/engine-core/src/prefix_cache/store/prefix_store/prefix_store_evict_and_budget.rs index 7f8a74c0..8cd67ed9 100644 --- a/crates/engine-core/src/prefix_cache/store/prefix_store/prefix_store_evict_and_budget.rs +++ b/crates/engine-core/src/prefix_cache/store/prefix_store/prefix_store_evict_and_budget.rs @@ -1,5 +1,5 @@ -//! Methods of `PrefixStore`: `enforce_budget`, `abort`, `release_orphans`, `evict` and 6 more. -//! Split out of `prefix_store` to keep its files under the line limit. +//! Removal from the prefix store: enforcing the byte budget, aborting a candidate, evicting a node together with the +//! blocks only it covered, orphan release, clearing, and the invariant check. use super::{ByteSize, Candidate, HashSet, Node, PrefixStore}; #[cfg(any(test, feature = "testing"))] diff --git a/crates/engine-core/src/prefix_cache/store/prefix_store/prefix_store_stats_and_clock.rs b/crates/engine-core/src/prefix_cache/store/prefix_store/prefix_store_stats_and_clock.rs index aad9e3b4..3e1c4add 100644 --- a/crates/engine-core/src/prefix_cache/store/prefix_store/prefix_store_stats_and_clock.rs +++ b/crates/engine-core/src/prefix_cache/store/prefix_store/prefix_store_stats_and_clock.rs @@ -1,5 +1,5 @@ -//! Methods of `PrefixStore`: `new`, `config`, `stats`, `bytes` and 26 more. -//! Split out of `prefix_store` to keep its files under the line limit. +//! Construction, statistics, request clock and expiry of the prefix store, and its lookups: the longest token-exact +//! match, the hash-only prefix match a router uses, the node heads, and the hit and miss records that feed admission. use super::{ ByteSize, CHAIN_SEED, HashMap, HashSet, Match, Node, PrefixStore, Stats, StoreConfig, chain_step, decayed, diff --git a/crates/engine-core/src/prefix_cache/store/tests/hit_by_another_session.rs b/crates/engine-core/src/prefix_cache/store/tests/hit_by_another_session.rs index 393b5b6f..55aae5b2 100644 --- a/crates/engine-core/src/prefix_cache/store/tests/hit_by_another_session.rs +++ b/crates/engine-core/src/prefix_cache/store/tests/hit_by_another_session.rs @@ -1,8 +1,6 @@ -//! Tests of tests by topic (moved out of the test file by STRA-338): -//! a_hit_by_another_session_makes_a_shared_root_outlive_private_leaves, -//! thinning_a_chain_keeps_the_deepest_node_and_the_blocks_it_needs, -//! the_budget_is_enforced_again_when_the_real_payload_is_bigger_than_the_estimate, -//! commit_refuses_blocks_that_are_not_the_candidates .... +//! Pins the store's sharing and budget behaviour: a hit by another session keeps a shared root alive, chains are +//! thinned, the budget is enforced again when a payload exceeds its estimate, collisions are never matched, the node +//! cap evicts by value, and long agent sessions stay inside the budget with a fast lookup. use super::{ BLOCK, Consider, G, Payload, PolicyParams, PrefixStore, Reject, STATE, StoreConfig, chain, put, store, tokens, diff --git a/crates/engine-core/src/prefix_cache/store/tests/request_resumes_from.rs b/crates/engine-core/src/prefix_cache/store/tests/request_resumes_from.rs index 465352f4..7691e4f5 100644 --- a/crates/engine-core/src/prefix_cache/store/tests/request_resumes_from.rs +++ b/crates/engine-core/src/prefix_cache/store/tests/request_resumes_from.rs @@ -1,7 +1,6 @@ -//! Tests of tests by topic (moved out of the test file by STRA-338): -//! a_request_resumes_from_the_deepest_node_of_any_session, common_prefixes_are_stored_once, -//! a_node_with_descendants_is_a_branch_point_and_a_frontier_is_not, -//! the_prompt_end_checkpoint_survives_the_decode_end_checkpoint_of_its_request .... +//! Pins resume and eviction semantics of the store: resume from the deepest node of any session, shared prefixes +//! stored once, branch points versus frontiers, request-end tail nodes and their supersession, retention and expiry, +//! and value-ordered eviction under a full budget. use super::{ BLOCK, Consider, G, MINUTE, Payload, PolicyParams, PrefixStore, Reject, STATE, StoreConfig, put, put_tail, diff --git a/crates/engine-core/src/prompt/prompt_options.rs b/crates/engine-core/src/prompt/prompt_options.rs index 1e2351fb..355920cb 100644 --- a/crates/engine-core/src/prompt/prompt_options.rs +++ b/crates/engine-core/src/prompt/prompt_options.rs @@ -1,5 +1,5 @@ -//! Methods of `PromptOptions`: `original_mode17`. -//! Methods of `PromptPlan`: `new_in_context`, `new`, `prompt`, `next_segment` and 1 more. +//! Prompt planning of the Original serve path: the options and capacity choice (auto ladder, cache-slot loan), the +//! validity checks, the `PromptPlan` iterator that cuts a prompt into segments, and `drive`, which runs a plan. use super::{ DriveError, DriveSummary, PlanError, PlanLimits, PromptAction, PromptOptions, PromptPath, PromptPlan, PromptRunner, diff --git a/crates/engine-core/src/spec/adaptive/adaptive_config.rs b/crates/engine-core/src/spec/adaptive/adaptive_config.rs index f1bff54e..56dd11f3 100644 --- a/crates/engine-core/src/spec/adaptive/adaptive_config.rs +++ b/crates/engine-core/src/spec/adaptive/adaptive_config.rs @@ -1,5 +1,5 @@ -//! Methods of `AdaptiveConfig`: `new`, `with_policy`, `set_option`, `set_tuning` and 1 more. -//! Methods of `Cell`: `rate`, `add`. Functions: `p_bucket`, `m_bucket`, `logit`, `sigmoid`. +//! Constants of the adaptive window policy: construction, the `LELEKA_SPEC_POLICY` presets, named options for replay +//! arms, the acceptance `Cell` statistics, and the probability bucketing and logit helpers. use super::{AdaptiveConfig, Cell, FLOOR_CEILING, FLOOR_CEILING_LEGACY, MAX_T, P_BUCKETS, P_EDGES}; diff --git a/crates/engine-core/src/spec/adaptive/adaptive_policy.rs b/crates/engine-core/src/spec/adaptive/adaptive_policy.rs index fc06c6dc..02994f8f 100644 --- a/crates/engine-core/src/spec/adaptive/adaptive_policy.rs +++ b/crates/engine-core/src/spec/adaptive/adaptive_policy.rs @@ -1,5 +1,5 @@ -//! Methods of `AdaptivePolicy`: `new`, `config`, `rounds`, `begin_request` and 7 more. -//! Split out of `adaptive` to keep its files under the line limit. +//! State and calibration of the adaptive window policy: per-request reset, the acceptance rate of an MTP draft or a +//! suffix row, the per-width cost mean and its fit, and the candidate widths offered to the decision. use super::{ AdaptiveConfig, AdaptivePolicy, Cand, Cell, M_BUCKETS, MAX_T, N0_BUCKET, N0_DEPTH, N0_SUFFIX, Offer, Origin, diff --git a/crates/engine-core/src/spec/adaptive/spec_stats.rs b/crates/engine-core/src/spec/adaptive/spec_stats.rs index 61504a89..31c2a8cd 100644 --- a/crates/engine-core/src/spec/adaptive/spec_stats.rs +++ b/crates/engine-core/src/spec/adaptive/spec_stats.rs @@ -1,5 +1,5 @@ -//! Methods of `SpecStats`: `record`, `line`. -//! Split out of `adaptive` to keep its files under the line limit. +//! Per-round statistics of the adaptive policy (width, accepted rows, flags, milliseconds) and the one-line report +//! printed from them. use super::{MAX_T, RoundFlags, SpecStats}; diff --git a/crates/engine-core/src/spec/adaptive/tests/default_ceiling.rs b/crates/engine-core/src/spec/adaptive/tests/default_ceiling.rs index 29d6cb9e..2bb08d08 100644 --- a/crates/engine-core/src/spec/adaptive/tests/default_ceiling.rs +++ b/crates/engine-core/src/spec/adaptive/tests/default_ceiling.rs @@ -1,6 +1,5 @@ -//! Tests of tests by topic (moved out of the test file by STRA-338): -//! the_default_ceiling_is_the_new_one_and_the_legacy_switch_restores_the_old_policy_exactly, -//! the_smooth_floor_moves_continuously_with_the_bar, a_trace_is_reproducible, stats_line_reports_the_histograms. +//! Pins the policy constants: the default draft-floor ceiling is the new one, the legacy switch restores the earlier +//! policy exactly, the smooth floor moves continuously with the bar, traces are reproducible, and the stats line. use super::{ AdaptiveConfig, AdaptivePolicy, CODE_COSTLY, FLOOR_CEILING, P_BUCKETS, P_EDGES, PROSE_CHEAP, Rng, RoundFlags, diff --git a/crates/engine-core/src/spec/adaptive/tests/stationary_regimes_reach_the_best.rs b/crates/engine-core/src/spec/adaptive/tests/stationary_regimes_reach_the_best.rs index 5bce6e24..0307a1c5 100644 --- a/crates/engine-core/src/spec/adaptive/tests/stationary_regimes_reach_the_best.rs +++ b/crates/engine-core/src/spec/adaptive/tests/stationary_regimes_reach_the_best.rs @@ -1,6 +1,6 @@ -//! Tests of `tests` by topic: stationary_regimes_reach_the_best_fixed_width, -//! it_widens_when_rows_are_cheap_and_narrows_when_they_are_not, it_follows_a_change_of_content_and_of_cost, -//! reaction_to_a_switch_takes_tens_of_rounds_not_hundreds .... +//! Pins the adaptive window's learning: stationary regimes reach the best fixed width, it widens when rows are cheap +//! and narrows when not, follows a change of content or cost, explores cheaply, interpolates unmeasured widths, and +//! keeps the draft plan inside its bounds. use super::{ AdaptivePolicy, CODE_CHEAP, CODE_COSTLY, Choice, MAX_T, Offer, Origin, PROSE_CHEAP, PROSE_COSTLY, REPEAT, Rng, diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve/original_serve_mode.rs b/crates/engine-qwen35-cuda/src/backend/original_serve/original_serve_mode.rs index 3933e54a..cbf970e6 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve/original_serve_mode.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve/original_serve_mode.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalServeMode`: `parse`, `as_str`. Methods of `ExpertSource`: `parse`, `as_str`. -//! Implements `Default for OriginalServeOptions`. +//! Parsing and printing of the Original-path choices (`OriginalServeMode`, `ExpertSource`, `PrefixTail`), the +//! published prefix-cache pool summary, and the default and run-time validation of `OriginalServeOptions`. use super::{ BackendError, ConfigFacts, ExpertSource, OriginalServeChoice, OriginalServeMode, OriginalServeOptions, diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve/runner/command_loop.rs b/crates/engine-qwen35-cuda/src/backend/original_serve/runner/command_loop.rs index ae4676f5..6c62bc7e 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve/runner/command_loop.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve/runner/command_loop.rs @@ -1,5 +1,5 @@ -//! The command loop of the Original owner, moved out of `run` by STRA-338 (size): receive, sweep the idle sessions, -//! and answer each command in the order `run` did. +//! The command loop of the Original owner: publish readiness, then receive commands, sweep idle sessions while none +//! arrives, and answer Load (refused), Reconfigure, Unload and Generate until unload or shutdown. use super::{ BackendError, Command, Duration, GenerateEnv, IdleSweep, Live, LoadPhase, LoadedModel, Ordering, diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve/tests.rs b/crates/engine-qwen35-cuda/src/backend/original_serve/tests.rs index 7fa58caa..b03cc57b 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve/tests.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve/tests.rs @@ -1,4 +1,6 @@ -//! Unit tests of `original_serve`. +//! Pins the Original-path selection and options: modes parse and print symmetrically, `Auto` takes the Original path +//! only when everything is sealed and fed, explicit `Original` never falls back and names what is missing, `Preview` +//! is never overridden, option bounds, the conversation-cache defaults, and the eight-cell slack of the fit test. use super::{ConfigFacts, OriginalServeChoice, OriginalServeMode, OriginalServeOptions, PathBuf, choose, context_fits}; diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_replay/required_path.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_replay/required_path.rs index 77c86354..d2aa3bb5 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_replay/required_path.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_replay/required_path.rs @@ -1,5 +1,5 @@ -//! Functions: `required_path`. -//! Split out of `original_serve_replay` to keep its files under the line limit. +//! Reads an operator-owned input path from an environment variable for the replay and the GPU proofs; a missing +//! variable panics with its name, so a proof never runs against a guessed file. use super::{PathBuf, env}; diff --git a/crates/engine-qwen35-cuda/src/backend/tests.rs b/crates/engine-qwen35-cuda/src/backend/tests.rs index 1477b82b..05cf4462 100644 --- a/crates/engine-qwen35-cuda/src/backend/tests.rs +++ b/crates/engine-qwen35-cuda/src/backend/tests.rs @@ -1,3 +1,7 @@ +//! Backend-level tests of the Native path: the queued-owner identity digest, explicit KAR selection and context +//! admission, request caps and sampling plans, incremental UTF-8 publication, cancel with a full control queue, +//! control-token encoding, and a request arriving during the deferred tail. + use super::{ Active, ActiveGuard, Arc, AtomicBool, Backend, BackendError, Command, DeferredTail, Digest, ErrorCode, EvaluationExecution, FRAME_LIMIT, GenerationRequest, InferenceMode, KAR_LOAD_REPLY_TIMEOUT, KAR_PROFILE, diff --git a/crates/engine-qwen35-cuda/src/conversation/resident/tests.rs b/crates/engine-qwen35-cuda/src/conversation/resident/tests.rs index 7bf82d4c..dde09a75 100644 --- a/crates/engine-qwen35-cuda/src/conversation/resident/tests.rs +++ b/crates/engine-qwen35-cuda/src/conversation/resident/tests.rs @@ -1,4 +1,6 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Pins the resident-conversation store: a disabled policy keeps the single continuation, an identical prompt may +//! reuse the live session but not a parked one, A-B-A swaps pick the longest prefix (ties to the newest), slots and +//! bytes bound the parked set oldest first, unusable candidates are dropped, and operator settings parse strictly. use super::{ResidentConversations, ResidentPolicy, ResumeSource}; diff --git a/crates/engine-qwen35-cuda/src/experimental/tests.rs b/crates/engine-qwen35-cuda/src/experimental/tests.rs index 0cfc2d99..eb9c96c2 100644 --- a/crates/engine-qwen35-cuda/src/experimental/tests.rs +++ b/crates/engine-qwen35-cuda/src/experimental/tests.rs @@ -1,4 +1,6 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Pins the experimental-mode admission: the default is off and changes nothing, each mode selects the Original's +//! format and programs, exclusions follow its rules, pool sizes match, the digest binds modes, values and files, +//! an enabled mode is refused until the forward pass consumes it, and control-vector files are validated at load. use super::{ ExperimentalConfig, ExperimentalError, KvFormat, Mode, OptIn, PathBuf, Program, ensure_consumed, diff --git a/crates/engine-qwen35-cuda/src/model_binding/mod.rs b/crates/engine-qwen35-cuda/src/model_binding/mod.rs index c70d0831..896574b4 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/mod.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/mod.rs @@ -1,3 +1,6 @@ +//! Binding of the pinned model files to the engine: the KAR expert source and its levels, the Qwen4Exp input +//! binding (weights read from the verified artifact) and the KAR PLE source. + pub(crate) mod kar_expert_source; pub(crate) mod kar_levels; pub(crate) mod qwen4exp_input; diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/binding_identity_and_input_binding_error.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/binding_identity_and_input_binding_error.rs index f204b1dd..7e64b905 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/binding_identity_and_input_binding_error.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/binding_identity_and_input_binding_error.rs @@ -1,5 +1,6 @@ -//! Methods of `BindingIdentity` and `BoundLayer`, and the `Display` and `Error` impls of `InputBindingError`: what a -//! binding says about itself and how its failures read. +//! The small identity and constants types of the input binding: `Display` text of `InputBindingError`, the identity +//! that ties a weights handle to its binding, the index and kind of a bound layer, and the `InputConstants` read from +//! the artifact (PLE head offsets and vocabularies, EOS, context length) with their validation. use super::{ BindingIdentity, BoundLayer, BoundLayerKind, InputBindingError, InputConstants, InputResult, PLE_ROWS, diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/gdn/tests.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/gdn/tests.rs index 152e1f18..5588f4c6 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/gdn/tests.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/gdn/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Pins the GDN weight binding: the epsilon is the Original's exact layer operand, the projection kinds and +//! containers are the closed set, and shapes and row bounds are checked before any read. use super::{E, NATIVE_EPSILON, TensorSignature, block_range, descriptor, exact_bf16, kind}; #[test] diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/gr/tests.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/gr/tests.rs index 7b1c8b58..c19514cf 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/gr/tests.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/gr/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Pins the GR weight binding: only exact finite BF16 containers are accepted, role shapes are frozen, and the final +//! layer has no injection. use super::{GrRole, InputBindingError, TensorSignature, exact_bf16, role_set, validate_descriptor}; #[test] diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/model_binding.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/model_binding.rs index 01bcc7d2..08b6a223 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/model_binding.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/model_binding.rs @@ -1,5 +1,5 @@ -//! Methods of `ModelBinding`: `bind`, `from_artifact`, `from_artifact_with_kar_ple`, `with_kar_expert_source` and 22... -//! Functions: `bind_expert_counts`. +//! The `ModelBinding` over a verified Qwen4Exp artifact: its constructors (plain, with KAR PLE, KAR expert source or +//! MTP pack), layer and expert counts, the embedding and PLE row reads, and expert-count validation. use super::{ BindingError, BindingIdentity, BoundLayer, EMBEDDING_VALUES, GlobalRole, InputBindingError, InputConstants, diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/moe_expert/model_binding.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/moe_expert/model_binding.rs index 5c7492c0..cc206e1d 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/moe_expert/model_binding.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/moe_expert/model_binding.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `model_binding_moe_descriptors`, `moe_expert_block_reads`. -//! Split out of `moe_expert` to keep its files under the line limit. +//! Hub of the `ModelBinding` MoE accessors: expert matrix admission and preload descriptors (one child) and the +//! block reads of selected expert rows from the artifact (the other). use super::{ E, EXPERTS, FF, InputResult, LayerRole, Matrix, ModelBinding, MoeExpertBlock, MoeExpertSelection, MoeExpertWeights, diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/moe_expert/model_binding/model_binding_moe_descriptors.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/moe_expert/model_binding/model_binding_moe_descriptors.rs index 6a2bfac8..3df9d6cc 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/moe_expert/model_binding/model_binding_moe_descriptors.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/moe_expert/model_binding/model_binding_moe_descriptors.rs @@ -1,5 +1,5 @@ -//! Methods of `ModelBinding`: `moe_expert_weights`, `moe_preload_descriptor`, `check_preload_key`, `moe_preload_bloc... -//! Functions: `moe_matrix`, `check_gate_scalar`, `preload_key`, `preload_matrix_role` and 1 more. +//! Admission of one layer's routed and shared MoE matrices against the expected kind, shape and extent, and the +//! preload descriptors and blocks of routed experts that the MoE weight cache reads to preload pinned experts. use super::super::routed_source_descriptor::validate_rows_finite; use super::super::routed_source_descriptor::{check_matrix_tensor, check_moe_metadata, selected_expert}; diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/moe_expert/moe_expert_weights.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/moe_expert/moe_expert_weights.rs index d6b5e839..536c5ddc 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/moe_expert/moe_expert_weights.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/moe_expert/moe_expert_weights.rs @@ -1,5 +1,5 @@ -//! Methods of `MoeExpertWeights`: `matches`, `matrix`, `shape`, `kind`. -//! Methods of `MoeExpertBlock`: `kind`, `columns`, `rows`, `bytes` and 1 more. +//! Accessors of the admitted `MoeExpertWeights` and `MoeExpertBlock`, and the decoding of raw tensor kinds into +//! `MoeMatrixKind` for routed and shared matrices, with the selection and row-range checks. use super::{ BindingIdentity, E, EXPERTS, FF, InputResult, Matrix, MoeExpertBlock, MoeExpertSelection, MoeExpertWeights, diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/moe_expert/moe_routed_source_scope.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/moe_expert/moe_routed_source_scope.rs index 9f6078db..0ac270dd 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/moe_expert/moe_routed_source_scope.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/moe_expert/moe_routed_source_scope.rs @@ -1,5 +1,5 @@ -//! Methods of `MoeRoutedSourceScope`: `retarget`, `check_first_member`, `check_members`. -//! Methods of `ModelBinding`: `with_moe_routed_group_source`, `moe_shared_preload_descriptors`, `moe_shared_preload_... +//! The routed-source group scope (`MoeRoutedSourceScope`): retargeting it to a new set of experts with member checks, +//! and the shared-expert preload descriptors and blocks streamed from the artifact. use super::routed_source_descriptor::check_moe_metadata; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/moe_expert/routed_source_descriptor.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/moe_expert/routed_source_descriptor.rs index 0465a865..1175c012 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/moe_expert/routed_source_descriptor.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/moe_expert/routed_source_descriptor.rs @@ -1,5 +1,5 @@ -//! Methods of `MoeRoutedSourceScope`: `validate_binding`, `descriptor`, `block`, `bank_span` and 2 more. -//! Methods of `ModelBinding`: `with_moe_routed_source`, `check_members_select`, `open_routed_source`. +//! Source descriptors and reads of routed experts: model-metadata and finite-weight admission, and the scope's +//! descriptor, block, bank-span and mapped-span reads over the retained artifact owners. use super::{ BindingIdentity, E, EXPERTS, FF, InputResult, LayerRole, Matrix, ModelBinding, MoeExpertBlock, MoeExpertSelection, diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/dense_bytes_types.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/dense_bytes_types.rs index 7111885e..eaadea4a 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/dense_bytes_types.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/dense_bytes_types.rs @@ -1,5 +1,5 @@ -//! Defines `MtpIndex`, `MtpRows`, `MtpWeights`. -//! DENSE_BYTES, EXPERT_BYTES, EXPERT_BLOB, INDEX_BYTES, MAX_ROWS, MAX_READ .... +//! The pinned MTP pack: byte sizes, read limits and file digests of `dense.txt`, `dense.bin` and `experts.bin`, and +//! the `MtpWeights`, `MtpRows` and `MtpIndex` owners that hold its files and rows. use super::{BindingIdentity, File, MtpKind}; diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/descriptors_types.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/descriptors_types.rs index 1e6b5260..3debfba7 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/descriptors_types.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/descriptors_types.rs @@ -1,5 +1,5 @@ -//! Items of the parent module. -//! Split out of `mtp` to keep its files under the line limit. +//! The table of the 31 MTP tensors: for each role its name, source file, shape, source SHA-256 and, where it is +//! packed into `dense.bin`, the kind and byte placement. use super::{Dense, Descriptor, MtpKind, MtpRole}; diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/mtp_kind_types.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/mtp_kind_types.rs index 1271f2e4..66e8346e 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/mtp_kind_types.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/mtp_kind_types.rs @@ -1,5 +1,5 @@ -//! Defines `MtpKind`, `MtpExpertMatrix`, `MtpExpertRef` and 3 more. -//! MtpKind, MtpExpertMatrix, MtpRole, Descriptor, Dense. +//! The vocabulary of the MTP pack: storage kinds, expert matrices, the roles of its tensors, and the `Descriptor` +//! and `Dense` records that describe one tensor. #[derive(Clone, Copy, Debug, Eq, PartialEq)] diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/pack_identity.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/pack_identity.rs index 45917a99..718a3883 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/pack_identity.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/pack_identity.rs @@ -1,5 +1,5 @@ -//! Methods of `IndexScan`: `accept`, `fits`, `complete`. Methods of `MtpIndex`: `inspect`. -//! Functions: `pack_identity`, `descriptor`, `pinned_dense_bytes`, `rt_dense_roles` and 6 more. +//! Identity and index of the MTP pack: the digests that name it, the descriptor lookup, the RT-directory contract +//! (consumed roles, names, kinds, shapes) and the strict parser that turns `dense.txt` into a validated `MtpIndex`. use super::{ DENSE_BYTES, DESCRIPTORS, Dense, Descriptor, FILE_PINS, INDEX_LIMIT, InputBindingError, InputResult, MtpIndex, diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/tests.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/tests.rs index 0eecf459..0dffcfcd 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/tests.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/tests.rs @@ -1,4 +1,6 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Pins the MTP pack binding: exact receipts and runtime index, the RT contract's roles and shapes, malformed +//! descriptors never becoming an index, bounded rows and lossless Q2 planes keeping signed zeros, non-finite weights +//! refused, and an identity that cannot be recreated from metadata. use super::{ BindingIdentity, DESCRIPTORS, INDEX_LIMIT, InputBindingError, MtpIndex, MtpKind, MtpRole, interleave_q2, row_range, diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/validate_ple_descriptor.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/validate_ple_descriptor.rs index fde7c92c..63e755c1 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/validate_ple_descriptor.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/validate_ple_descriptor.rs @@ -1,5 +1,5 @@ -//! Methods of `InputConstants`: `test_fixture`. Methods of `BindingIdentity`: `test_identity`. -//! Functions: `validate_ple_descriptor`, `bind_layers`, `bind_layer`. +//! Bind-time admission of a Qwen4Exp artifact: the per-layer token-embedding (PLE) descriptor and the ordered list of +//! bound layers with their kinds. Also the test fixtures for `InputConstants` and `BindingIdentity`. use super::{ BoundLayer, BoundLayerKind, GlobalRole, InputBindingError, InputResult, LayerRole, PLE_ROWS, Qwen4ExpArtifact, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/dense_slab_policy.rs b/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/dense_slab_policy.rs index a43267db..59a8c5fc 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/dense_slab_policy.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/dense_slab_policy.rs @@ -1,5 +1,5 @@ -//! Functions: `dense_slab_policy`, `startup_step`. -//! Split out of `dense_weight_cache` to keep its files under the line limit. +//! Startup policy of the dense weight cache: whether dense weights are packed into 64 MiB slabs or get one allocation +//! each, and the step-named refusal message of the prompt-capacity startup. Both layouts place the same bytes. use super::SlabPolicy; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/dense_weight_cache_methods.rs b/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/dense_weight_cache_methods.rs index cd4089b4..32e39404 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/dense_weight_cache_methods.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/dense_weight_cache_methods.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `dense_cache_buffers_and_close`, `dense_cache_eager_layer_load`, `dense_cache_gdn_qsa_works... -//! Split out of `dense_weight_cache` to keep its files under the line limit. +//! The `impl DenseWeightCache` blocks by responsibility: constructors, eager layer load, matrix registration, PLE and +//! verifier weight views, prompt and GDN scratch, GDN/QSA workspaces, buffers and close. Shared imports live here. use super::{ ALL_MIRROR_BYTES, BoundLayerKind, Cell, Context, DenseCacheCounters, DenseWeightCache, DeviceBuffer, DeviceRef, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/dense_weight_cache_methods/dense_cache_buffers_and_close.rs b/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/dense_weight_cache_methods/dense_cache_buffers_and_close.rs index 0c319e4e..15a08ad4 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/dense_weight_cache_methods/dense_cache_buffers_and_close.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/dense_weight_cache_methods/dense_cache_buffers_and_close.rs @@ -1,5 +1,5 @@ -//! Methods of `DenseWeightCache`: `gr_buffers`, `counters`, `chunk_modules`, `close` and 4 more. -//! Functions: `close_into`. +//! Buffer access and teardown of the dense weight cache: GR buffers, counters, chunk modules and the consuming close, +//! which releases scratch, modules, batch workspaces, buffers and slabs and keeps the first error. use super::{ Context, DenseCacheCounters, DenseWeightCache, DeviceBuffer, Error, GrResident, ModelBinding, QkScratch, Rc, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/dense_weight_cache_methods/dense_cache_eager_layer_load.rs b/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/dense_weight_cache_methods/dense_cache_eager_layer_load.rs index 0e608622..66d39b1c 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/dense_weight_cache_methods/dense_cache_eager_layer_load.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/dense_weight_cache_methods/dense_cache_eager_layer_load.rs @@ -1,5 +1,5 @@ -//! Methods of `DenseWeightCache`: `new_with_selected`, `unloaded`, `load_eager`, `reserve_layer_tables` and 6 more. -//! Functions: `reserve_table`. +//! Eager load of the dense weights at construction: reserves the layer tables, loads the router, GDN and QSA layers +//! of a binding into the slab allocator and adds the scratch owners. use super::{ ALL_MIRROR_BYTES, BoundLayerKind, Cell, Context, DenseCacheCounters, DenseWeightCache, Error, GdnInputScratch, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/dense_weight_cache_methods/dense_cache_gdn_qsa_workspaces.rs b/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/dense_weight_cache_methods/dense_cache_gdn_qsa_workspaces.rs index 2b451667..76f5fbbe 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/dense_weight_cache_methods/dense_cache_gdn_qsa_workspaces.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/dense_weight_cache_methods/dense_cache_gdn_qsa_workspaces.rs @@ -1,5 +1,6 @@ -//! Methods of `DenseWeightCache`: `gdn_batch_resources`, `qsa_native_workspace`, `test_record_gr_batch_completed`, `... -//! Split out of `dense_weight_cache_methods` to keep its files under the line limit. +//! Lookups of the dense cache that the decode and prompt paths borrow from: GDN batch resources, QSA workspace, +//! GDN and QSA scratch loans, and the per-layer GDN, QSA, GR and router entries with buffer handles for a held +//! verify assembly. use super::{ Cell, Context, DenseWeightCache, DeviceBuffer, DeviceRef, Error, GdnInputLease, GdnInputScratch, GdnResident, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/dense_weight_cache_methods/dense_cache_matrix_registration.rs b/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/dense_weight_cache_methods/dense_cache_matrix_registration.rs index 2a0233d9..1ef9605a 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/dense_weight_cache_methods/dense_cache_matrix_registration.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/dense_weight_cache_methods/dense_cache_matrix_registration.rs @@ -1,5 +1,5 @@ -//! Methods of `DenseWeightCache`: `add`, `add_f32`, `add_bf16`, `add_gr` and 13 more. Defines `ExpectedPleMatrix`. -//! Split out of `dense_weight_cache_methods` to keep its files under the line limit. +//! Registration of dense matrices (raw, F32, BF16, GR roles, the retained PLE matrices) into the cache with byte and +//! finite checks, plus binding validation and the router, GR, PLE and native batch scratch loans. use super::{ Context, DenseWeightCache, DeviceRef, Error, GrBatchInjectWorkspace, GrResident, GrRole, GrScratch, ModelBinding, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/dense_weight_cache_methods/dense_cache_ple_and_verify_weights.rs b/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/dense_weight_cache_methods/dense_cache_ple_and_verify_weights.rs index 3085ba48..809b4d4a 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/dense_weight_cache_methods/dense_cache_ple_and_verify_weights.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/dense_weight_cache_methods/dense_cache_ple_and_verify_weights.rs @@ -1,5 +1,6 @@ -//! Methods of `DenseWeightCache`: `ple`, `ple_key`, `ple_value`, `ple_value_tile` and 16 more. -//! Functions: `gdn_native_type`, `qsa_native_type`. +//! Read-only views of the loaded dense weights: PLE key, value and norm slots, GDN and QSA matrix and norm slots, and +//! the ordered operands of the Original verifier window (GDN weights, QSA gammas, native MMVQ projections). They are +//! the cache's own allocations, so no host conversion happens at this boundary. use super::{ BoundLayerKind, Context, DenseWeightCache, DeviceBuffer, DeviceRef, Error, GdnMatrixKind, GdnMatrixRole, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/dense_weight_cache_methods/dense_cache_prompt_and_gdn_scratch.rs b/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/dense_weight_cache_methods/dense_cache_prompt_and_gdn_scratch.rs index cfe3279e..ab31a03d 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/dense_weight_cache_methods/dense_cache_prompt_and_gdn_scratch.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/dense_weight_cache_methods/dense_cache_prompt_and_gdn_scratch.rs @@ -1,5 +1,6 @@ -//! Methods of `DenseWeightCache`: `new_original_prompt_capacity`, `load_prompt_owners`, `load_prompt_workspaces`, `l... -//! Split out of `dense_weight_cache_methods` to keep its files under the line limit. +//! The prompt-capacity constructor of the dense weight cache (prompt owners, workspaces and scratch sized for the +//! chunk capacity) and the pools that serve it: idle GDN finite guards, pooled GDN state buffers and the GDN +//! verification workspace. use super::{ Context, DenseWeightCache, DeviceBuffer, Error, GdnVerificationWorkspace, ModelBinding, QkScratch, Rc, RefCell, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/dense_weight_cache_methods/dense_weight_cache_constructors.rs b/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/dense_weight_cache_methods/dense_weight_cache_constructors.rs index 222b2aa4..1c3900dc 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/dense_weight_cache_methods/dense_weight_cache_constructors.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/dense_weight_cache_methods/dense_weight_cache_constructors.rs @@ -1,5 +1,5 @@ -//! Methods of `DenseWeightCache`: `new`, `new_qsa_selected`, `new_qsa_selected_router`, `new_qsa_selected_router_gr_... -//! Split out of `dense_weight_cache_methods` to keep its files under the line limit. +//! The named constructors of the dense weight cache, from the plain cache up to the selected router, GR batch, QK, +//! attention and MTP journal variants, and the attachment of the prompt owners, queues and native QSA resources. use super::{ Context, DenseWeightCache, Error, ModelBinding, QkScratch, QsaAttentionScratch, Rc, RefCell, Result, RouterScratch, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/workspaces.rs b/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/workspaces.rs index e6ac1bf0..4fe9d212 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/workspaces.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/workspaces.rs @@ -1,5 +1,6 @@ -//! The lazily created workspaces of the dense weight cache, moved out of it by STRA-338 (size): consecutive owners, -//! declared in the order the cache dropped them, so the drop order is unchanged. +//! The lazily created workspaces of the dense weight cache (GDN, QSA, GR and router scratch, idle guards and pooled +//! GDN state buffers), all empty at construction and filled on first use. The fields are declared in the order the +//! cache drops them, so the drop order is unchanged. use super::{ DeviceBuffer, GdnInputScratch, GrBatchInjectWorkspace, GrScratch, QkScratch, QsaAttentionScratch, QsaIndexKeyCache, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor.rs index e4965950..bef1d479 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor.rs @@ -1,5 +1,6 @@ -//! Groups the submodules `construction_and_parking`, `prompt_executor_forward_and_close`, `prompt_executor_retire_ow... -//! Split out of `original_prompt` to keep its files under the line limit. +//! Impl family of `OriginalPromptExecutor`, the owner of every device resource of the layer-major Original prefill +//! (prompt rows, GDN, QSA, MTP). The children share this import list: construction and parking, chunk forward, +//! retirement. use super::{ BoundLayerKind, Carrier, ChunkCaches, ChunkDraft, ChunkInFlight, ChunkRollback, ChunkWork, Context, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor/construction_and_parking.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor/construction_and_parking.rs index d1693815..29946253 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor/construction_and_parking.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor/construction_and_parking.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `executor_construction`, `session_park_and_qsa_owners`. -//! Split out of `original_prompt_executor` to keep its files under the line limit. +//! Construction of an `OriginalPromptExecutor` and the parking of its session state. Builds the device owners and the +//! twelve resident QSA layers; parks, imports and restores the session for the prefix cache. use super::{ BoundLayerKind, Context, DenseWeightCache, Dimension, DraftAttachmentTables, DraftAttachmentTarget, Error, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor/construction_and_parking/executor_construction.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor/construction_and_parking/executor_construction.rs index 98757cbf..35ec4a20 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor/construction_and_parking/executor_construction.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor/construction_and_parking/executor_construction.rs @@ -1,5 +1,6 @@ -//! Methods of `OriginalPromptExecutor`: `new`, `new_with_mtp_weights`, `check_construction`, `empty` and 17 more. -//! Split out of `construction_and_parking` to keep its files under the line limit. +//! Builds an `OriginalPromptExecutor`: the prompt, GDN, QSA and MTP device owners and the twelve resident QSA layers. +//! Also the drafter hooks the serve host calls on it (RT bank selection, prompt length, draft limit, idle, KV +//! restore). use super::{ BoundLayerKind, Context, DenseWeightCache, Dimension, DraftAttachmentTables, DraftAttachmentTarget, Error, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor/construction_and_parking/session_park_and_qsa_owners.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor/construction_and_parking/session_park_and_qsa_owners.rs index ce25343b..f386fa5f 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor/construction_and_parking/session_park_and_qsa_owners.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor/construction_and_parking/session_park_and_qsa_owners.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalPromptExecutor`: `take_qsa_owners`, `adopt_qsa_owners`, `rebuild_qsa_layers`, `checkpoint_ses... -//! Defines `QsaOwners`. +//! Session handoff of the executor: the resident QSA owners lent to the native verifier for a decode phase and taken +//! back, and the checkpoint, park, import and restore of the session point (prefix cache, request reset). use super::{ DenseWeightCache, Error, ModelBinding, OriginalPromptExecutor, OriginalSessionCheckpoint, ParkedBlock, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor/prompt_executor_forward_and_close.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor/prompt_executor_forward_and_close.rs index 82e5aa82..533cdaf0 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor/prompt_executor_forward_and_close.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor/prompt_executor_forward_and_close.rs @@ -1,5 +1,4 @@ -//! Groups the submodules `prompt_chunk_forward`, `prompt_executor_close`. -//! Split out of `original_prompt_executor` to keep its files under the line limit. +//! Running and closing a prompt chunk on the executor: the forward pass over the arena and the consuming `close`. use super::{ BoundLayerKind, Carrier, ChunkCaches, ChunkDraft, ChunkInFlight, ChunkRollback, ChunkWork, Context, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor/prompt_executor_forward_and_close/prompt_chunk_forward.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor/prompt_executor_forward_and_close/prompt_chunk_forward.rs index 9fcf0cff..5065a867 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor/prompt_executor_forward_and_close/prompt_chunk_forward.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor/prompt_executor_forward_and_close/prompt_chunk_forward.rs @@ -1,5 +1,6 @@ -//! Methods of `OriginalPromptExecutor`: `forward`, `arena_holds_window`, `admit_window`, `finish_forward` and 4 more. -//! Functions: `trace_step`, `arena_serves_chunk`, `trace_error`. Defines `ForwardDone`, `StagedRows`. +//! `OriginalPromptExecutor::forward`: one batched prompt chunk, from input staging through every layer to the final +//! row, its sample and the draft KV. An error rolls the transaction and the draft back; success leaves a pending +//! target to publish. use super::{ BoundLayerKind, Carrier, ChunkCaches, ChunkDraft, ChunkInFlight, ChunkRollback, ChunkWork, Context, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor/prompt_executor_forward_and_close/prompt_chunk_forward/forward_draft.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor/prompt_executor_forward_and_close/prompt_chunk_forward/forward_draft.rs index 689dc743..8f588029 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor/prompt_executor_forward_and_close/prompt_chunk_forward/forward_draft.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor/prompt_executor_forward_and_close/prompt_chunk_forward/forward_draft.rs @@ -1,4 +1,4 @@ -//! STRA-338 size: the draft-KV phase of `OriginalPromptExecutor::forward`. +//! The draft-KV phase of `OriginalPromptExecutor::forward`. use super::{ ChunkDraft, Context, Error, MoeWeightCache, OriginalDraftKvPending, OriginalMtpPrefill, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor/prompt_executor_forward_and_close/prompt_chunk_forward/forward_final.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor/prompt_executor_forward_and_close/prompt_chunk_forward/forward_final.rs index ec4f8bc2..4e5a75af 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor/prompt_executor_forward_and_close/prompt_chunk_forward/forward_final.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor/prompt_executor_forward_and_close/prompt_chunk_forward/forward_final.rs @@ -1,4 +1,4 @@ -//! STRA-338 size: the final row of `OriginalPromptExecutor::forward` (conditioning preview, sample, R trace). +//! The final row of `OriginalPromptExecutor::forward` (conditioning preview, sample, R trace). use super::{ Carrier, ChunkWork, DenseWeightCache, Error, ModelBinding, OriginalPromptExecutor, OriginalPromptSample, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor/prompt_executor_forward_and_close/prompt_chunk_forward/forward_input.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor/prompt_executor_forward_and_close/prompt_chunk_forward/forward_input.rs index 52f68fb7..d1dfe7d2 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor/prompt_executor_forward_and_close/prompt_chunk_forward/forward_input.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor/prompt_executor_forward_and_close/prompt_chunk_forward/forward_input.rs @@ -1,4 +1,4 @@ -//! STRA-338 size: the input phase of `OriginalPromptExecutor::forward` (staging, row upload, PLE read-ahead). +//! The input phase of `OriginalPromptExecutor::forward` (staging, row upload, PLE read-ahead). use super::{ ChunkInFlight, Context, DenseWeightCache, Error, InputStage, KarPleCache, ModelBinding, OriginalPrefillArena, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor/prompt_executor_forward_and_close/prompt_chunk_forward/forward_layers.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor/prompt_executor_forward_and_close/prompt_chunk_forward/forward_layers.rs index a3040fb8..7558d188 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor/prompt_executor_forward_and_close/prompt_chunk_forward/forward_layers.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor/prompt_executor_forward_and_close/prompt_chunk_forward/forward_layers.rs @@ -1,4 +1,4 @@ -//! STRA-338 size: the layer loop of `OriginalPromptExecutor::forward`, one helper per phase of a layer. +//! The layer loop of `OriginalPromptExecutor::forward`, one helper per phase of a layer. use super::{ BoundLayerKind, Carrier, ChunkWork, DenseWeightCache, Error, InputStage, ModelBinding, MoeWeightCache, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor/prompt_executor_forward_and_close/prompt_executor_close.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor/prompt_executor_forward_and_close/prompt_executor_close.rs index 07311086..7cc06990 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor/prompt_executor_forward_and_close/prompt_executor_close.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor/prompt_executor_forward_and_close/prompt_executor_close.rs @@ -1,5 +1,4 @@ -//! Methods of `OriginalPromptExecutor`: `close`. -//! Split out of `prompt_executor_forward_and_close` to keep its files under the line limit. +//! Consuming `close` of the executor; the retirement of the owners itself is `close_inner`. use super::{OriginalPromptExecutor, Result}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor/prompt_executor_retire_owners.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor/prompt_executor_retire_owners.rs index 8e36bcd0..9a7e17bd 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor/prompt_executor_retire_owners.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor/prompt_executor_retire_owners.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalPromptExecutor`: `close_inner`, `retire_device_owners`, `retire_mtp_and_layers`. -//! Split out of `original_prompt_executor` to keep its files under the line limit. +//! Retirement of the executor's device owners: prompt, GDN, QSA, transport, attention, MTP and the resident layers. +//! Every owner is closed even after a failure; the first error is kept and the executor is marked failed. use super::{Error, OriginalPromptExecutor, Result, driver_error}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor_drop.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor_drop.rs index c7e1af8b..5397dbbd 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor_drop.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/original_prompt_executor_drop.rs @@ -1,5 +1,6 @@ -//! Methods of `OriginalPromptPending`: `publish`. -//! Implements `Drop for OriginalPromptExecutor`, `Drop for OriginalPromptPending` and 2 more. +//! Publication and rollback of a prompt chunk: `OriginalPromptPending::publish`, and the drops that close the +//! executor or abort an unpublished transaction. Also the `PromptRunner` that drives the chunks of a prompt plan, and +//! `driver_error`. use super::{ ChunkCaches, ChunkDraft, Error, NoPromptHooks, OriginalPromptComposer, OriginalPromptExecutor, OriginalPromptHooks, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/staged_input_enabled.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/staged_input_enabled.rs index 159ecd34..172eb120 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/staged_input_enabled.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/staged_input_enabled.rs @@ -1,5 +1,4 @@ -//! Functions: `staged_input_enabled`. -//! Split out of `original_prompt` to keep its files under the line limit. +//! The `prefill_staged_input` switch: staged chunk input, or the per-token host path of the KAR inputs (the A/B arm). /// `LELEKA_PREFILL_STAGED_INPUT=0` keeps the per-token host path of the KAR inputs (the A/B arm). diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/check_chunk_on_loaded.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/check_chunk_on_loaded.rs index cc2806e2..be5921b4 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/check_chunk_on_loaded.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/check_chunk_on_loaded.rs @@ -1,5 +1,6 @@ -//! Methods of `Ids`: `new`, `position`. -//! Methods of `Rig`: `snapshot`, `prefill`, `step_final`, `prefill_chunk` and 7 more. +//! GPU test phase on the loaded target: a genuine four-row prefill chunk must reproduce the scalar known-next path +//! exactly (logits, greedy token, residual, state, draft), and a cancelled chunk must leave the committed target and +//! draft untouched. #![cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] use super::{ diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/prepare_micro_ffn_rows.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/prepare_micro_ffn_rows.rs index ee6dceaf..3c357e07 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/prepare_micro_ffn_rows.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/prepare_micro_ffn_rows.rs @@ -1,5 +1,5 @@ -//! Methods of `MicroRows`: `reserve`, `push`, `collect`, `inject`. Functions: `prepare_micro_ffn_rows`. -//! Defines `MicroEnv`, `MicroSources`, `MicroBlockSources` and 2 more. +//! FFN preparation of a micro window of a prefill layer: the attention blocks of the window, one whole retained-GR +//! FFN read over them, then the per-row proofs. The block kinds and the FFN routing are the child modules. #![cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] use super::{ diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/prepare_micro_ffn_rows/ffn_rows.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/prepare_micro_ffn_rows/ffn_rows.rs index 4a3c5283..3a26d009 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/prepare_micro_ffn_rows/ffn_rows.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/prepare_micro_ffn_rows/ffn_rows.rs @@ -1,4 +1,4 @@ -//! STRA-338 size: the routing of the FFN reads of a micro window. +//! The routing of the FFN reads of a micro window. use super::{ ChunkFfnRow, Context, DetachedGrRead, Error, ForwardPhase, GrStage, MicroEnv, MoeExpertStage, MoeMicroProducts, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/prepare_micro_ffn_rows/gdn_native.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/prepare_micro_ffn_rows/gdn_native.rs index c9af8168..b2d405a1 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/prepare_micro_ffn_rows/gdn_native.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/prepare_micro_ffn_rows/gdn_native.rs @@ -1,4 +1,4 @@ -//! STRA-338 size: the native prompt GDN attention blocks of a micro window. +//! The native prompt GDN attention blocks of a micro window. use super::{ ChunkAttentionRow, Context, DetachedGrRead, Error, GdnChunkDevice, GdnStage, GrMicroAttentionBank, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/prepare_micro_ffn_rows/plain_rows.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/prepare_micro_ffn_rows/plain_rows.rs index e32da09c..302994ae 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/prepare_micro_ffn_rows/plain_rows.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/prepare_micro_ffn_rows/plain_rows.rs @@ -1,4 +1,4 @@ -//! STRA-338 size: the row-by-row attention blocks of a micro window (device GDN owner or host stages). +//! The row-by-row attention blocks of a micro window (device GDN owner or host stages). use super::{ BoundLayerKind, ChunkAttentionRow, DetachedGrRead, Error, ForwardPhase, GdnChunkDevice, GdnStage, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/prepare_micro_ffn_rows/qsa_native.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/prepare_micro_ffn_rows/qsa_native.rs index d043ec7e..20f61a2f 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/prepare_micro_ffn_rows/qsa_native.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/prepare_micro_ffn_rows/qsa_native.rs @@ -1,4 +1,4 @@ -//! STRA-338 size: the native prompt QSA attention blocks of a micro window. +//! The native prompt QSA attention blocks of a micro window. use super::{ ChunkAttentionRow, Context, Error, GrMicroAttentionBank, GrStage, MicroBlockRequest, MicroEnv, MicroRows, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/prepare_q6_layer_columns.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/prepare_q6_layer_columns.rs index 911129b7..32fcda05 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/prepare_q6_layer_columns.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/prepare_q6_layer_columns.rs @@ -1,5 +1,5 @@ -//! Functions: `prepare_q6_layer_columns`, `q6_inputs`, `q6_roles`, `q6_project` and 1 more. -//! Split out of `prefill_chunk` to keep its files under the line limit. +//! Q6K projection of the attention rows of a layer: the validated residual input of each row goes through the layer's +//! Q6K matrices (GDN or QSA roles), giving the projected columns per row for the retained GR bank. use super::{BoundLayerKind, DenseWeightCache, Error, LayerId, ModelBinding, QwenChunkTxn, Result}; use crate::model_binding::qwen4exp_input::{GdnMatrixKind, GdnMatrixRole, QsaMatrixKind, QsaMatrixRole}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward.rs index 0642643c..f251b02e 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `joint_chunk`, `prefill_chunk_cached_windowed`, `prefill_chunk_native_windowed` and 1 more. -//! Split out of `prefill_chunk` to keep its files under the line limit. +//! Chunk entry points of `QwenForward`: the joint target+draft prefill chunk in its cached, MMQ and native windowed +//! forms, and the planned layer loop they share. use super::{ AttentionHandoff, BoundLayerKind, ChunkMoePolicy, DenseWeightCache, Dimension, Error, ForwardPhase, GdnStage, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/joint_chunk.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/joint_chunk.rs index c431cae6..501f8aff 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/joint_chunk.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/joint_chunk.rs @@ -1,4 +1,4 @@ -//! STRA-338 size: the inputs and the joint target+draft publication shared by the prefill chunk entry points. +//! The inputs and the joint target+draft publication shared by the prefill chunk entry points. use super::{ ChunkMoePolicy, DenseWeightCache, Error, KarPleCache, ModelBinding, MoeWeightCache, OutputStage, QwenForward, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_cached_windowed.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_cached_windowed.rs index 80b6caba..090a2c7a 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_cached_windowed.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_cached_windowed.rs @@ -1,5 +1,5 @@ -//! Methods of `QwenForward`: `test_chunk_on_loaded`, `prefill_chunk_mmq_joint`, `prefill_chunk_cached_joint`, `prepa... -//! Split out of `qwen_forward` to keep its files under the line limit. +//! Entry points of `QwenForward` for the cached prefill chunk: MMQ joint, cached joint and the private outer256 +//! windowed experiments (plain and retained-GR transport). Normal serving stays on outer64 with the host transport. use super::{ ChunkMoePolicy, MoeWeightCache, PrefillChunkInputs, PrefillChunkPlan, QwenChunkTxn, QwenForward, QwenSession, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_native_windowed.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_native_windowed.rs index cb788161..ced380a7 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_native_windowed.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_native_windowed.rs @@ -1,5 +1,6 @@ -//! Methods of `QwenForward`: `prefill_chunk_native_integer_iq3_windowed256_retained_gr_joint`, `prepare_prefill_chun... -//! Split out of `qwen_forward` to keep its files under the line limit. +//! Entry point of `QwenForward` for the native IntegerIQ3 prefill chunk: outer256 layers run in windows of at most 64 +//! rows over the retained-GR transport; the draft is warmed and published with the target only after all 48 layers +//! completed. use super::{ AllocationTrace, ChunkMoePolicy, Error, MoeWeightCache, PrefillChunkInputs, PrefillChunkPlan, QwenChunkTxn, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned.rs index 858c0c53..474fa71a 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned.rs @@ -1,5 +1,6 @@ -//! Methods of `ChunkEnv`: `new`, `with_boundary`, `native_prompt`. Methods of `ChunkRun`: `window`. -//! Defines `MicroBank`, `MicroBank`, `NativeMoe` and 6 more. +//! The planned prefill chunk: admission, the `ChunkEnv` every phase reads, the `ChunkRun` of the rows a run covers +//! and the layer loop that ends in the output head. The phases are the child modules (setup, layer, window attention, +//! FFN, experts). use super::{ AttentionHandoff, BoundLayerKind, ChunkMoePolicy, DenseWeightCache, Dimension, Error, ForwardPhase, GdnStage, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/chunk_layer.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/chunk_layer.rs index ce89ceca..fef33659 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/chunk_layer.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/chunk_layer.rs @@ -1,4 +1,4 @@ -//! STRA-338 size: one layer of the prefill chunk, its GDN device owner and its windows. +//! One layer of the prefill chunk, its GDN device owner and its windows. use super::window_experts::ExpertRun; use super::window_ffn::WindowOwners; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/chunk_setup.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/chunk_setup.rs index 496b946d..0d720bb1 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/chunk_setup.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/chunk_setup.rs @@ -1,4 +1,4 @@ -//! STRA-338 size: admission, transaction begin, input rows and output head of one prefill chunk. +//! Admission, transaction begin, input rows and output head of one prefill chunk. use super::{ ChunkEnv, ChunkMoePolicy, ChunkOpening, Context, DenseWeightCache, Error, InjectedResidual, InputStage, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/host_attention.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/host_attention.rs index b9490f66..5215db16 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/host_attention.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/host_attention.rs @@ -1,4 +1,4 @@ -//! STRA-338 size: the host GDN and QSA attention stages of one prefill row, shared by the FFN-row and micro-FFN paths. +//! The host GDN and QSA attention stages of one prefill row, shared by the FFN-row and micro-FFN paths. use super::{ DenseWeightCache, ForwardPhase, GdnStage, LayerId, ModelBinding, Position, QsaAttentionStage, QsaIndexStage, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/window_attention.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/window_attention.rs index 65062021..2fb5da02 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/window_attention.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/window_attention.rs @@ -1,4 +1,4 @@ -//! STRA-338 size: the attention reads of one window of a prefill layer. +//! The attention reads of one window of a prefill layer. use super::{ ChunkEnv, ChunkRun, Error, GrStage, InjectedResidual, InputStage, LayerEntry, LayerId, MicroBank, QwenChunkTxn, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/window_experts.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/window_experts.rs index 82248e3f..5709e1e9 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/window_experts.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/window_experts.rs @@ -1,4 +1,4 @@ -//! STRA-338 size: the expert execution and the batched FFN injection of one window of a prefill layer. +//! The expert execution and the batched FFN injection of one window of a prefill layer. use super::{ ChunkEnv, ChunkMoePolicy, ChunkRun, Error, GrStage, InjectedResidual, LayerId, MoeExpertStage, MoeWeightCache, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/window_ffn.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/window_ffn.rs index 7606f215..0d9ef893 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/window_ffn.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/window_ffn.rs @@ -1,4 +1,4 @@ -//! STRA-338 size: the projected columns and the prepared FFN rows of one window of a prefill layer. +//! The projected columns and the prepared FFN rows of one window of a prefill layer. use super::{ AttentionHandoff, BoundLayerKind, ChunkEnv, ChunkRun, Error, ForwardPhase, GdnStage, InjectedResidual, LayerId, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/window_ffn_flow.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/window_ffn_flow.rs index e920ac5d..d08b94b2 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/window_ffn_flow.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/window_ffn_flow.rs @@ -1,4 +1,4 @@ -//! STRA-338 size: the host stages of one prefill row (GDN or QSA attention, GR injection, FFN read, routing). +//! The host stages of one prefill row (GDN or QSA attention, GR injection, FFN read, routing). use super::{ AttentionHandoff, BoundLayerKind, ChunkEnv, ChunkMoePolicy, ForwardPhase, GrStage, InjectedResidual, LayerId, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/read_chunk_attention_ffn.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/read_chunk_attention_ffn.rs index ea40d3bf..006ebbdb 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/read_chunk_attention_ffn.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/read_chunk_attention_ffn.rs @@ -1,5 +1,6 @@ -//! Methods of `AttentionHandoff`: `new`. -//! Methods of `QwenForward`: `test_layer0_pair_on_loaded`, `run_layer0_diagnostic`. +//! The FFN read of a chunk attention row: the detached attention residual and the block output (`AttentionHandoff`) +//! go to the retained GR bank. Also the layer-0 pair diagnostic, whose four-row chunk must refuse with the executor +//! error. use super::{DenseWeightCache, ForwardPhase, GrStage, ModelBinding, Result, diagnose}; #[cfg(test)] diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/target_step_product.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/target_step_product.rs index 996646a8..9698f1db 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/target_step_product.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/target_step_product.rs @@ -1,5 +1,5 @@ -//! Methods of `TargetStepProduct`: `from_chunk_commit`. Functions: `chunk_diagnostic`. -//! Split out of `prefill_chunk` to keep its files under the line limit. +//! `TargetStepProduct` of a committed prefill chunk (only the checked joint publisher supplies its final source) and +//! the `chunk_diagnostic` tracer, which prints the stage, layer and rows of a failure in test builds only. use super::{Result, TargetStepProduct}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/window_numeric/proof.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/window_numeric/proof.rs index dc9ae9c8..7ac9ec4c 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/window_numeric/proof.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/window_numeric/proof.rs @@ -1,4 +1,5 @@ -//! The proof phases of the window boundary observer (STRA-338 size: extract-method only). +//! The phases of the window boundary observer: the unchanged Native4 baseline measured first, the windowed candidate +//! under the retained-GR policy compared with it, and the cancellation phase. use super::{ BoundaryPlan, Cell, ChunkMoePolicy, DenseWeightCache, Dimension, Error, KarPleCache, ModelBinding, MoeWeightCache, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_step_product.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_step_product.rs index 2b65df2f..9448b57c 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_step_product.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_step_product.rs @@ -1,5 +1,6 @@ -//! Methods of `PrefillStepProduct`: `mtp_source`. -//! Methods of `TargetStepProduct`: `test_prefix_residual`, `mtp_source`, `predicted`, `position` and 1 more. +//! `mtp_source` of a finished step: the validated product (token, position, ten residual streams, origin) an MTP +//! draft starts from, for a known-next prefill step and for a full target step. A stale origin or a non-finite stream +//! is refused. use super::{ Error, ForwardPhase, ModelBinding, Position, PrefillStepProduct, QwenSession, Result, TargetStepOrigin, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/qwen_forward/qwen_forward_reset.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/qwen_forward/qwen_forward_reset.rs index e293b4b5..a5548050 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/qwen_forward/qwen_forward_reset.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/qwen_forward/qwen_forward_reset.rs @@ -1,5 +1,4 @@ -//! Methods of `QwenForward`: `reset`. -//! Split out of `qwen_forward` to keep its files under the line limit. +//! `QwenForward::reset`: returns the session to the empty prompt. use super::{QwenForward, QwenSession, Result}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/read_layer_attention.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/read_layer_attention.rs index 09a1be14..1be83f22 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/read_layer_attention.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/read_layer_attention.rs @@ -1,5 +1,6 @@ -//! Functions: `read_layer_attention`, `read_layer_one`, `prepare_layer_attention_micro`, `prepare_layer_one_micro` a... -//! Defines `LayerEntry`. +//! The GR attention read of one layer of a step: layer 0 applies, layer 1 consumes the PLE producer first, later +//! layers read from the previous residual. Also the micro-window variants and the layer-plan and descriptor +//! validation. use super::{ BoundLayerKind, DenseWeightCache, Dimension, Error, ForwardPhase, GrRead, GrStage, InjectedResidual, InputStage, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/reset_replay_sdet.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/reset_replay_sdet.rs index f5111017..f3bc82c3 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/reset_replay_sdet.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/reset_replay_sdet.rs @@ -1,4 +1,6 @@ -//! Cache-reset-replay numerical proof, moved out of `executor.rs` by STRA-338 (size); same module path as before. +//! GPU test: cached forward and legacy replay agree numerically across an actual reset of the same session (not two +//! fresh requests), with the cache counters unchanged and only equality and bounded counts reported, never tensor +//! words. use super::{ BoundLayerKind, DenseWeightCache, Dimension, KarPleCache, ModelBinding, MoeWeightCache, OutputStage, Position, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/step_layers.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/step_layers.rs index 7a5576a4..8947e066 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/step_layers.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/step_layers.rs @@ -1,4 +1,5 @@ -//! Phases of `QwenForward::step_core` (STRA-338 size: extract-method only, same order of operations). +//! The layer phases of `QwenForward::step_core`: cache preparation, the input row, the layer loop (attention half +//! with GDN or QSA, FFN half with routing and experts) and the step finish. The order of the stages is the contract. use super::{ BoundLayerKind, DenseWeightCache, Dimension, Error, ForwardPhase, GdnStage, GrRead, GrStage, InjectedResidual, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/tests.rs index 33c2ff59..04ea33bd 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Pins the layer-plan topology check (the exact contiguous closed sequence) and, on a GPU, that a missing output +//! refuses before the layers without committing state and that two tokens finish all layers and commit. use super::{ BoundLayerKind, Dimension, Error, LayerId, OutputStage, Position, QwenForward, QwenSession, QwenStepTxn, Result, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/cached_step.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/cached_step.rs index f31ac909..a0548099 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/cached_step.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/cached_step.rs @@ -1,5 +1,6 @@ -//! Methods of `CachedGdn`: `project`, `run`, `leading_products`, `recurrence` and 3 more. -//! Functions: `step_cached`, `open_chain`, `settle_cached`, `chain_output_role` and 3 more. +//! One native GDN token step with the dense-weight cache: projections, convolution, q/k norm, gates, recurrence. +//! Runs on a step-local `Chain`, then publishes the next recurrent state through the mirror only if the whole step +//! succeeded; on failure the computed candidate is discarded and the chain is cleaned up. use super::{ CandidatePair, Context, DEVICE_PEAK, DenseWeightCache, DeviceBuffer, Error, GdnInputLease, GdnLayerInput, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chain/allocate_qk_slot.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chain/allocate_qk_slot.rs index 9d675158..008bb41f 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chain/allocate_qk_slot.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chain/allocate_qk_slot.rs @@ -1,5 +1,6 @@ -//! Methods of `QkScratch`: `test_slot_bytes`, `new`, `validate`, `take` and 2 more. Methods of `Role`: `count`. -//! Functions: `allocate_qk_slot`, `normalize_retained_qk`. +//! The retained whole-QK scratch slot of the GDN chain and the q/k normalisation that writes into it. +//! One slot is lent to a chain at a time and must come back as the same allocation; a failed return forbids every +//! later take. Also gives each chain `Role` its element count and the products and borrows their accessors. use super::{ BindingIdentity, CHANNELS, Cell, Context, DeviceBuffer, Error, HISTORY_ELEMENTS, MirrorAuthority, Product, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chain/chain.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chain/chain.rs index d7f84f03..3b13793e 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chain/chain.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chain/chain.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `chain_construction_and_buffers`, `chain_projection_convolution`, `chain_readout_and_finish... -//! Split out of `chain` to keep its files under the line limit. +//! The step-local `Chain` of GDN stage products, split by phase: construction and buffers, scalar projection and +//! convolution stages, readout and finish, and the one-drain row queue. All phases share the chain's private slots. use super::{ BindingIdentity, CHANNELS, Cell, Chain, Context, DeviceBuffer, DeviceOperand, DeviceProduct, Error, GdnLayerInput, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chain/chain/chain_construction_and_buffers.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chain/chain/chain_construction_and_buffers.rs index c745c2dc..7bc99b28 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chain/chain/chain_construction_and_buffers.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chain/chain/chain_construction_and_buffers.rs @@ -1,5 +1,5 @@ -//! Methods of `Chain`: `new`, `validate`, `set_verification_pool`, `return_fixed` and 15 more. -//! Split out of `chain` to keep its files under the line limit. +//! Construction of a step-local `Chain` and its slot bookkeeping: pending operands, products, buffer lookup. +//! Every lookup refuses a stale epoch, a wrong role or a foreign chain, so a capability cannot outlive its drain. use super::{ BindingIdentity, Cell, Chain, Context, DeviceBuffer, DeviceOperand, DeviceProduct, Error, GdnMatrixKind, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chain/chain/chain_projection_convolution.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chain/chain/chain_projection_convolution.rs index 315b56b0..f313d5bc 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chain/chain/chain_projection_convolution.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chain/chain/chain_projection_convolution.rs @@ -1,5 +1,5 @@ -//! Methods of `Chain`: `upload_values`, `note`, `note_err`, `free` and 10 more. -//! Split out of `chain` to keep its files under the line limit. +//! The scalar (host-readback) stages of the GDN chain: upload, projection, convolution, q/k normalisation, gates. +//! Each producer runs its own kernel and its own finite readback; callers never hand in a separate numeric proof. use super::{ CHANNELS, Chain, DeviceBuffer, Error, GdnMatrixKind, GdnMatrixLayout, HISTORY_ELEMENTS, Product, QkReturn, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chain/chain/chain_readout_and_finish.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chain/chain/chain_readout_and_finish.rs index b728b448..b7ffaa02 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chain/chain/chain_readout_and_finish.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chain/chain/chain_readout_and_finish.rs @@ -1,5 +1,5 @@ -//! Methods of `Chain`: `import_chunk_readout`, `out_norm`, `drain`, `finish`. -//! Split out of `chain` to keep its files under the line limit. +//! The tail of the GDN chain: import of a chunk readout, the output norm, and the drain that ends the chain. +//! `drain` bumps the epoch (invalidating every product), returns pooled slots and frees the rest. use super::{Chain, DeviceBuffer, Error, Product, Rc, Result, Role, VALUES, download, driver_error}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chain/chain/chain_row_queue.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chain/chain/chain_row_queue.rs index f769eedc..52d07aa7 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chain/chain/chain_row_queue.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chain/chain/chain_row_queue.rs @@ -1,5 +1,6 @@ -//! Methods of `Chain`: `run_row_queue`, `reserve_row_slots`, `drain_row_queue`, `row_input_buffers` and 12 more. -//! Functions: `check_distinct_slots`. Defines `RowSlots`, `RowInputBuffers`, `RowOutputBuffers`. +//! The queued row of the GDN chain: conv, q/k norm, beta sigmoid, gates, recurrence and out-norm in ONE driver drain. +//! The scalar chain's intermediate host readbacks and fences are gone; every stage output is still scanned for finite +//! values and nothing is published unless the whole drain was clean. Also lends recurrence inputs to the caller. use super::{ Chain, DeviceBuffer, DeviceOperand, Error, GdnLayerInput, GdnRowQueue, Product, QkvInput, QueueInputs, QueuedRow, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chain/chain_drop.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chain/chain_drop.rs index 4f0b8715..ae72fb6e 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chain/chain_drop.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chain/chain_drop.rs @@ -1,5 +1,4 @@ -//! Implements `Drop for Chain`. -//! Split out of `chain` to keep its files under the line limit. +//! Drop of a `Chain`: drains it, so slots go back to their pools or are freed even when a step bails out early. use super::Chain; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/gdn_chunk_device_methods.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/gdn_chunk_device_methods.rs index abb0f45f..6ad48c03 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/gdn_chunk_device_methods.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/gdn_chunk_device_methods.rs @@ -1,5 +1,4 @@ -//! Groups the submodules `chunk_device_batch_compute`, `chunk_device_construction`, `chunk_device_finish_cleanup`. -//! Split out of `chunk_device` to keep its files under the line limit. +//! The `GdnChunkDevice` methods by phase: construction and admission, per-row and batch compute, finish and cleanup. use super::{ BindingIdentity, CHUNK_DEVICE_CHARGE, Cell, ChunkEdge, ChunkReadout, Context, DenseWeightCache, DeviceBuffer, Error, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/gdn_chunk_device_methods/chunk_device_batch_compute.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/gdn_chunk_device_methods/chunk_device_batch_compute.rs index 460d22fb..5eca8118 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/gdn_chunk_device_methods/chunk_device_batch_compute.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/gdn_chunk_device_methods/chunk_device_batch_compute.rs @@ -1,5 +1,6 @@ -//! Methods of `GdnChunkDevice`: `finish_batch`, `history`, `step_source`, `read_checked` and 13 more. -//! Split out of `gdn_chunk_device_methods` to keep its files under the line limit. +//! Per-row and per-batch recurrence compute of a `GdnChunkDevice`: upload or borrow the inputs, run the step, +//! read the readout back and mint the row edges. The earliest full-state refusal precedes the readout and any user. +//! Also adopts the final state of a batch that drained clean. use super::{ ChunkEdge, ChunkReadout, DeviceBuffer, Error, GdnChunkDevice, GdnChunkRow, HISTORY_ELEMENTS, Rc, ReadoutDownload, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/gdn_chunk_device_methods/chunk_device_construction.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/gdn_chunk_device_methods/chunk_device_construction.rs index 6b0e3d57..04241e1e 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/gdn_chunk_device_methods/chunk_device_construction.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/gdn_chunk_device_methods/chunk_device_construction.rs @@ -1,5 +1,6 @@ -//! Methods of `GdnChunkDevice`: `new`, `empty`, `copy_history`, `take_prior_owners` and 16 more. -//! Split out of `gdn_chunk_device_methods` to keep its files under the line limit. +//! Construction and admission of a `GdnChunkDevice`: prior-state upload, verification pool, optional row queue. +//! Validates that rows, batches and micro-windows are exactly the next rows of the chunk from the cursor. +//! Nothing is mutated until a clean drain completes the step. use super::{ BindingIdentity, CHUNK_DEVICE_CHARGE, Cell, ChunkEdge, Context, DenseWeightCache, DeviceBuffer, Error, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/gdn_chunk_device_methods/chunk_device_finish_cleanup.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/gdn_chunk_device_methods/chunk_device_finish_cleanup.rs index c5299ddb..3c2efd22 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/gdn_chunk_device_methods/chunk_device_finish_cleanup.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/gdn_chunk_device_methods/chunk_device_finish_cleanup.rs @@ -1,5 +1,5 @@ -//! Methods of `GdnChunkDevice`: `finish`, `sealed_prior`, `return_scratch_and_guard`, `adopt_final_state` and 5 more. -//! Split out of `gdn_chunk_device_methods` to keep its files under the line limit. +//! End of life of a `GdnChunkDevice`: seal the chunk, return scratch and guards, adopt the final state, clean up. +//! Covers the ordinary chunk and the MTP verification variant. Cleanup keeps the first failure, frees the rest. use super::{ DenseWeightCache, Error, GdnChunkDevice, GdnChunkSeal, GdnPrior, ModelBinding, Result, STATE_ELEMENTS, download, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/mirror_reuse_enabled.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/mirror_reuse_enabled.rs index 8fe6391c..f820325e 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/mirror_reuse_enabled.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/mirror_reuse_enabled.rs @@ -1,5 +1,5 @@ -//! Methods of `ChunkEdge`: `into_parts`, `into_row`. Methods of `ChunkReadout`: `into_parts`, `same_owner`. -//! Implements `Drop for ChunkReadout`. Functions: `mirror_reuse_enabled`, `micro_rows`. +//! Edge and readout handles of a GDN chunk row, and the `prefill_gdn_mirror` switch for reusing the resident mirror. +//! A `ChunkReadout` frees its device buffer on drop; it can be consumed only by the chain that owns its scope. use super::{ Cell, ChunkEdge, ChunkReadout, Context, DeviceBuffer, Error, GdnChunkMicro, GdnChunkRow, Rc, Result, VALUES, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/native_fused_step.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/native_fused_step.rs index ff2ccf6b..da0a7e89 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/native_fused_step.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/native_fused_step.rs @@ -1,5 +1,5 @@ -//! Methods of `GdnChunkDevice`: `bind_native_fused`, `native_fused_operands`, `complete_native_fused_step`. -//! Implements `Drop for GdnChunkDevice`. +//! The in-place fused T1 recurrence of a verification `GdnChunkDevice`: bind the closed fused program to its +//! workspace, hand out the step operands, complete the step. Also the Drop that cleans up the chunk's device owners. use super::{DeviceBuffer, Error, GdnChunkDevice, GdnChunkRow, Rc, Result}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/numeric_gpu/batch_adoption.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/numeric_gpu/batch_adoption.rs index 87950278..7d727ccb 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/numeric_gpu/batch_adoption.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/numeric_gpu/batch_adoption.rs @@ -1,5 +1,6 @@ -//! Functions: `batch_adoption`, `adoption_rows`, `adoption_phase`, `batch_operand_guards` and 6 more. -//! Split out of `numeric_gpu` to keep its files under the line limit. +//! GPU-test proof of batch adoption on a `GdnChunkDevice`: only the next consecutive rows form a batch, a refused +//! batch mutates nothing, an accepted one advances the cursor and swaps the final state into place once. +//! Pure ownership and identity: no kernel runs, the final state is a recognisable pattern. use super::{ BindingIdentity, Context, Dimension, Error, GdnChunkDevice, GdnChunkRow, GdnPrior, HISTORY_ELEMENTS, LayerId, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/numeric_gpu/exercise.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/numeric_gpu/exercise.rs index 81e5f18f..36f1d02d 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/numeric_gpu/exercise.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/numeric_gpu/exercise.rs @@ -1,5 +1,6 @@ -//! Methods of `Fixture`: `new`, `row_guards`, `run_rows`, `compute_row` and 12 more. -//! Functions: `require_rejected_clean`, `exercise`, `run_gdn_chunk_numeric`. Defines `Fixture`, `ComputedRow`. +//! GPU-test driver of the chunk-device recurrence proof: 65 rows, the seal, finite guards and abort/replay. +//! Compares every readout and interior state against a same-PTX reference and checks that wrong rows, rival seals and +//! non-finite sources are refused without moving the owner. use super::{ BUDGET, BindingIdentity, CHUNK_DEVICE_CHARGE, ChunkReadout, Context, Counts, DeviceBuffer, Dimension, Driver, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/numeric_gpu/operands.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/numeric_gpu/operands.rs index e67ac3d2..65f4b9a9 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/numeric_gpu/operands.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/numeric_gpu/operands.rs @@ -1,5 +1,5 @@ -//! Methods of `Operands`: `recurrence`. -//! Functions: `operands`, `convolution_input`, `convolution_weights`, `difference` and 3 more. +//! Deterministic row inputs, convolution data and the reference recurrence of the chunk-device GPU proof, plus the +//! component owner that holds real buffers without a model binding. use super::{ CHUNK_DEVICE_CHARGE, Cell, Context, Error, GdnChunkDevice, GdnChunkStart, GdnPrior, Operands, ROWS, Rc, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/driver_error.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/driver_error.rs index aa103a5f..c0082b22 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/driver_error.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/driver_error.rs @@ -1,5 +1,5 @@ -//! Functions: `driver_error`, `validate_candidates`, `state_index`, `key_head`. -//! Split out of `gdn` to keep its files under the line limit. +//! Maps CUDA driver errors to the GDN `Error` and holds the GDN state addressing checks (`state_index`, `key_head`). +//! The state address is the exact native layout, never a head-major reinterpretation. use super::{DriverError, Error, KEY_HEADS, Result, Stage, VALUE_HEADS, WIDTH}; #[cfg(test)] diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/gates.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/gates.rs index 7a215694..e9cb7f87 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/gates.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/gates.rs @@ -1,5 +1,6 @@ -//! Methods of `RecurHost`: `validate`, `upload_all`. -//! Functions: `gates`, `upload_gate_inputs`, `run_gate_kernels`, `release_owned` and 16 more. +//! Kernel runners of the scalar GDN stages: gates, the recurrence step and the output norm, with their device +//! upload, download and release helpers. Every output is read back and checked finite before use. +//! Also the `prefill_gdn_pool` switch that pools the 3.1 MB state buffers across layers and chunks. use super::{ CandidatePair, Context, DeviceBuffer, Error, InputBindingError, POOL_OVERRIDE, RecurrenceOperands, Result, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/gdn_ready.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/gdn_ready.rs index 1d760b45..9d05ad2e 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/gdn_ready.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/gdn_ready.rs @@ -1,5 +1,5 @@ -//! Methods of `GdnReady`: `identity`, `output`, `validate_origin`, `take_pending`. -//! Split out of `gdn` to keep its files under the line limit. +//! Accessors of `GdnReady`, the finished output of one GDN layer step: its identity, origin check and the pending +//! recurrent candidate, which can be taken once (the session is the only publisher). use super::{BindingIdentity, Error, GdnPending, GdnReady, Result, TokenLayer}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/mirror/gdn_state_mirror_methods.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/mirror/gdn_state_mirror_methods.rs index cda577a1..1dbca0e2 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/mirror/gdn_state_mirror_methods.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/mirror/gdn_state_mirror_methods.rs @@ -1,5 +1,4 @@ -//! Groups the submodules `state_mirror_compute_and_admit`, `state_mirror_publish_and_close`. -//! Split out of `mirror` to keep its files under the line limit. +//! The `GdnStateMirror` methods by phase: construction, admission and compute, then publish, adopt and close. use super::{ BindingIdentity, Cell, Context, DeviceBuffer, Error, GdnPending, GdnPrior, GdnStateKey, GdnStateMirror, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/mirror/gdn_state_mirror_methods/state_mirror_compute_and_admit.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/mirror/gdn_state_mirror_methods/state_mirror_compute_and_admit.rs index 9af89767..8184ad6a 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/mirror/gdn_state_mirror_methods/state_mirror_compute_and_admit.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/mirror/gdn_state_mirror_methods/state_mirror_compute_and_admit.rs @@ -1,5 +1,6 @@ -//! Methods of `GdnStateMirror`: `new`, `allocate_mirror`, `compute`, `compute_retained` and 13 more. -//! Split out of `gdn_state_mirror_methods` to keep its files under the line limit. +//! Admission and compute half of `GdnStateMirror`: allocate the resident state buffer at load, check that a prior is +//! exactly the state the mirror holds, upload it on a miss, run the step and mint the candidate. +//! Nothing here changes the mirror's identity; only `publish` does. use super::{ BindingIdentity, Cell, Context, DeviceBuffer, Error, GdnPrior, GdnStateMirror, MIRROR_BYTES, MirrorNext, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/mirror/gdn_state_mirror_methods/state_mirror_publish_and_close.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/mirror/gdn_state_mirror_methods/state_mirror_publish_and_close.rs index afc3ac2a..76d06f34 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/mirror/gdn_state_mirror_methods/state_mirror_publish_and_close.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/mirror/gdn_state_mirror_methods/state_mirror_publish_and_close.rs @@ -1,5 +1,5 @@ -//! Methods of `GdnStateMirror`: `compute_borrowed`, `step_products`, `publish`, `admit_publish` and 5 more. -//! Split out of `gdn_state_mirror_methods` to keep its files under the line limit. +//! Publish half of `GdnStateMirror`: replace the resident buffer by an admitted candidate, hand the resident image to +//! a chunk, adopt a sealed chunk's state, and close. A hit key is never published before replacement cleanup is done. use super::{ Context, DeviceBuffer, Error, GdnPending, GdnPrior, GdnStateKey, GdnStateMirror, MIRROR_BYTES, MirrorAuthority, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/mirror/mirror_readout.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/mirror/mirror_readout.rs index dee8dede..e5a9f756 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/mirror/mirror_readout.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/mirror/mirror_readout.rs @@ -1,5 +1,5 @@ -//! Methods of `MirrorReadout`: `test_values`, `into_parts`, `same_owner`, `into_host`. -//! Implements `Drop for MirrorReadout`. +//! The readout of one mirror step: the device buffer and the finite host values read back from it. +//! Only the recurrence producer can pair the buffer with its readback; dropping it frees the device buffer. use super::{DeviceBuffer, Error, MirrorReadout, Rc, ReadoutClaim, Result, VALUES, driver_error, validate_values}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/mirror/upload_checked.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/mirror/upload_checked.rs index fd54ab2f..d7725965 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/mirror/upload_checked.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/mirror/upload_checked.rs @@ -1,5 +1,4 @@ -//! Functions: `upload_checked`. -//! Split out of `mirror` to keep its files under the line limit. +//! Uploads host f32 values into a fresh device buffer, freeing it and latching the failed flag if the copy fails. use super::{Cell, Context, DeviceBuffer, Error, Result, driver_error}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/prefill_batch/buffers.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/prefill_batch/buffers.rs index c6a999bf..e3c88b02 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/prefill_batch/buffers.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/prefill_batch/buffers.rs @@ -1,5 +1,6 @@ -//! Methods of `Buffers`: `allocated_bytes`, `new`, `pool_sizes`, `from_pool` and 1 more. Methods of `Images`: `take`. -//! Functions: `next_buffer`, `release_pool`. Defines `PoolIter`, `Images`, `Projections` and 1 more. +//! The per-call device buffers of one batched GDN prefill step: BF16/FP16 activation images, projection outputs and +//! rolling histories, sized for `tokens` rows. Allocated as one pool and released together, so a failed allocation +//! leaves nothing behind. use super::{ ALPHA_BETA, Bf16Profile, Buffers, CHANNELS, Context, DeviceBuffer, Error, HISTORY_ELEMENTS, MIXED, Result, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/prefill_batch/gdn_batch_resources.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/prefill_batch/gdn_batch_resources.rs index 321b6ac5..39abc3f5 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/prefill_batch/gdn_batch_resources.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/prefill_batch/gdn_batch_resources.rs @@ -1,5 +1,6 @@ -//! Methods of `GdnBatchResources`: `new`, `new_for_prompt`, `new_capacity`, `admit_capacity` and 8 more. -//! Implements `Drop for GdnBatchResources`. +//! The persistent owner of the batched GDN prefill program: closed driver program, dequantization scratch and the +//! per-call buffers, charged once per context before the routed prefix plan is admitted. +//! Buffers grow to a prompt's token count; closing releases scratch, program and buffers (also on Drop). use super::{ ALPHA_BETA, BATCH_RESERVE, BATCH_SCRATCH_BYTES, Bf16Profile, Buffers, CHANNELS, Context, DeviceBuffer, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/prefill_batch/gdn_stage.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/prefill_batch/gdn_stage.rs index 7b8ba09e..18c0c3cd 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/prefill_batch/gdn_stage.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/prefill_batch/gdn_stage.rs @@ -1,5 +1,5 @@ -//! Methods of `GdnStage`: `step_chunk_batch`. -//! Split out of `prefill_batch` to keep its files under the line limit. +//! Entry point `GdnStage::step_chunk_batch`: the batched Strata-prefill GDN step over one causal micro-window. +//! Rows and cursor come only from the validated micro; every row edge is minted after the whole batch drained finite. use super::step_batch::{ check_gdn_window, gather_gdn_rows, gdn_operands, latch_cuda_failure, prepare_or_refuse, run_gdn_program, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/prefill_batch/step_batch.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/prefill_batch/step_batch.rs index 44b04be4..ca08d80e 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/prefill_batch/step_batch.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/prefill_batch/step_batch.rs @@ -1,4 +1,7 @@ -//! Phases of `GdnStage::step_chunk_batch` (STRA-338 size: extract-method only). +//! The phases of `GdnStage::step_chunk_batch`: check the window, gather its genuine rows, resolve the layer's +//! resident matrices, run the closed batch program and settle. Edges are minted only after the whole batch drained +//! finite and the chunk device adopted the final state; a refusal marks the chunk device and, on CUDA failure, the +//! transport. use super::{ BoundLayerKind, Buffers, CHANNELS, ChunkReady, Context, DenseWeightCache, DeviceBuffer, Dimension, Error, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/projection.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/projection.rs index 15a9b678..353a7fdb 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/projection.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/projection.rs @@ -1,5 +1,6 @@ -//! Methods of `ProjectionOperands`: `without_cache`. -//! Functions: `project`, `project_leased`, `project_uploaded`, `upload_matrix_block` and 10 more. +//! Scalar projection stages of the GDN layer: QKV, alpha, beta, Z and Out matrix products, the convolution and the +//! q/k normalisation, each with a host readback checked finite. Uses the resident dense-weight cache and the input +//! lease when present, otherwise uploads the matrix block for this call only. use super::gates::{release_with_owned, upload_unless_resident}; use super::{ diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/stage_steps.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/stage_steps.rs index 5232ac92..b65e495a 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/stage_steps.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/stage_steps.rs @@ -1,5 +1,5 @@ -//! Methods of `GdnStage`: `step_chunk_selected`, `step`, `step_projected`, `step_impl` and 4 more. -//! Split out of `gdn` to keep its files under the line limit. +//! The `GdnStage` step entry points of one token: pick the fused native owner, the cached chain or the uncached path. +//! Validates binding, layer, input origin and prior before any device work, then returns a `GdnReady` candidate. use super::{ BoundLayerKind, CandidatePair, Context, DenseWeightCache, DeviceChunkRow, Dimension, Error, GateHostOperands, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/verification/compute_row.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/verification/compute_row.rs index 8e5c7a15..42d9a2e4 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/verification/compute_row.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/verification/compute_row.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `verified_row_compute_and_lease`, `workspace`, `workspace_replay`. -//! Split out of `verification` to keep its files under the line limit. +//! Row compute of MTP verification, split by owner: the verified row, the `Workspace` it runs in, and accepted-prefix +//! replay on that workspace. use super::{ ActiveLease, BindingIdentity, COUNTS, Cell, Context, DEVICE_BYTES, DeviceBuffer, Error, GdnChunkRow, GdnChunkStart, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/verification/compute_row/verified_row_compute_and_lease.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/verification/compute_row/verified_row_compute_and_lease.rs index 11aafebf..e3c0f751 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/verification/compute_row/verified_row_compute_and_lease.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/verification/compute_row/verified_row_compute_and_lease.rs @@ -1,5 +1,5 @@ -//! Methods of `ActiveLease`: `validate`, `refuse`. Methods of `VerifiedRow`: `history`, `validate`. -//! Functions: `compute_row`. +//! One verified GDN row of MTP verification: the recurrence compute over the workspace buffers, plus the checks +//! of the active lease and of a saved `VerifiedRow`. A refused lease invalidates every row minted under it. use super::{ ActiveLease, BindingIdentity, Context, Error, GdnStateFiniteGuard, HISTORY_ELEMENTS, LayerId, Rc, Result, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/verification/compute_row/workspace.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/verification/compute_row/workspace.rs index d682c95d..08b66fd4 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/verification/compute_row/workspace.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/verification/compute_row/workspace.rs @@ -1,5 +1,5 @@ -//! Methods of `Workspace`: `new`, `empty`, `reserve_slot_tables`, `allocate_owners` and 15 more. -//! Split out of `compute_row` to keep its files under the line limit. +//! The verification `Workspace`: fixed device owners (three state buffers, readout, finite guard, per-row operands) +//! for one verify round. Admits a lease, lends layers and rows out, takes them back and records verified rows. use super::{ ActiveLease, BindingIdentity, COUNTS, Cell, Context, DEVICE_BYTES, DeviceBuffer, Error, GdnChunkRow, GdnChunkStart, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/verification/compute_row/workspace_replay.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/verification/compute_row/workspace_replay.rs index ec6c2233..1b221d19 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/verification/compute_row/workspace_replay.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/verification/compute_row/workspace_replay.rs @@ -1,5 +1,6 @@ -//! Methods of `Workspace`: `replay`, `replayed_prior`, `replay_row`, `settle_replay` and 9 more. -//! Methods of `ReplaySeal`: `validate_prior`. Implements `Drop for Workspace`, `Drop for PoolRow`. +//! Replay of the accepted prefix on the verification workspace: after a verify round, re-run only the accepted rows +//! from the untouched device prior and return the resulting `GdnPrior`. Checks cancellation between rows. +//! Also cleanup and Drop of the workspace and of pooled rows. use super::{ ActiveLease, COUNTS, DeviceBuffer, Error, GdnPrior, GdnStateFiniteGuard, HISTORY_ELEMENTS, PoolRow, Rc, ReplaySeal, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/verification/workspace.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/verification/workspace.rs index 069d4962..7319fc3d 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/verification/workspace.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/verification/workspace.rs @@ -1,5 +1,4 @@ -//! Methods of `Workspace`: `bind_native_fused`. -//! Split out of `verification` to keep its files under the line limit. +//! Binds the closed fused T1 program to the verification `Workspace`, so fused rows reuse its owners and lease. use super::{ActiveLease, Error, Rc, RefCell, Result, Workspace, driver_error}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gr/batch_chunk/batch_inject.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gr/batch_chunk/batch_inject.rs index 1c872fae..7111bb61 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gr/batch_chunk/batch_inject.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gr/batch_chunk/batch_inject.rs @@ -1,4 +1,6 @@ -//! Phases of `GrStage::inject_batch` (STRA-338 size: extract-method only). +//! The phases of `GrStage::inject_batch`: gather the consecutive rows, run the queued T1/T2/T3 workspace path or the +//! generic device path, and publish one `InjectedResidual` per row. The exclusive scratch lease ends before any host +//! finite validation or publication of a row capability. use super::{ Cell, Context, DenseWeightCache, DeviceBuffer, Error, GrBatchRow, GrBatchScope, GrRole, InjectedResidual, LayerId, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gr/batch_chunk/gr_micro_input.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gr/batch_chunk/gr_micro_input.rs index 7f0837fc..1f51bc17 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gr/batch_chunk/gr_micro_input.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gr/batch_chunk/gr_micro_input.rs @@ -1,5 +1,5 @@ -//! Methods of `GrMicroInput`: `validate_origin`, `identity`. Methods of `GrMicroAttention`: `into_parts`. -//! Implements `Drop for GrMicroAttentionBank`. Functions: `save_micro_values`, `micro_driver_error`. +//! Micro-window side of GR: accessors of the immutable current-row input, the attention bank that owns the micro +//! device (legacy or native), and its close/Drop. Maps driver errors for the micro path and saves finite row values. use super::{ BindingIdentity, DetachedGrRead, DeviceBuffer, DriverError, Error, GrBatchScope, GrMicroAttention, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gr/batch_chunk/gr_stage.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gr/batch_chunk/gr_stage.rs index cf618a93..fffc2e0c 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gr/batch_chunk/gr_stage.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gr/batch_chunk/gr_stage.rs @@ -1,5 +1,6 @@ -//! Methods of `GrStage`: `mint_micro_input`, `prepare_micro_initial`, `prepare_micro_after_ple`, `prepare_micro_afte... -//! Methods of `GrBatchScope`: `detach_rows`, `refuse_device`, `seal`. +//! GR over one micro-window of rows: mint micro inputs (initial, after PLE, after FFN) and read the attention blocks +//! of every row in one device call. Checks that all rows are the next positions of one layer and that the bank, +//! binding and transaction agree; refusal closes the micro device. use super::super::super::dense_weight_cache::GrResident; use super::{ diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gr/batch_chunk/gr_stage_prepare_injection.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gr/batch_chunk/gr_stage_prepare_injection.rs index 5c7830db..652a910b 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gr/batch_chunk/gr_stage_prepare_injection.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gr/batch_chunk/gr_stage_prepare_injection.rs @@ -1,5 +1,5 @@ -//! Methods of `GrStage`: `prepare_detached_batch_injection`, `prepare_batch_injection`, `inject_batch`. -//! Functions: `check_batch_read`. +//! Batch injection of GR: prepare the FFN-side detached reads of a chunk and inject each block output back into its +//! residual streams. Every read is checked against the transaction (binding, origin, position, finite witnesses). use super::batch_inject::{device_inject, gather_batch}; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gr/diagnose.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gr/diagnose.rs index 50c757a2..ccaf73df 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gr/diagnose.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gr/diagnose.rs @@ -1,5 +1,5 @@ -//! Methods of `GrScratch`: `new`, `new_identity`, `allocate_owned`, `buffer` and 5 more. -//! Methods of `GrRead`: `ready`, `finish`. Implements `Drop for GrScratch`. +//! GR scratch and failure diagnostics: the eagerly charged actor-owned scratch slot (11 device owners) that every GR +//! read overwrites, its lease/finish, and the labelled aggregate diagnostics that reveal no tensor data. use super::{ BindingIdentity, Cell, Context, DeviceBuffer, Error, GR_INJECT_BYTES, GR_OUTPUT_BYTES, GR_OWNED_DEVICE_BYTES, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gr/download_f32.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gr/download_f32.rs index 6996c3e0..ed066814 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gr/download_f32.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gr/download_f32.rs @@ -1,5 +1,5 @@ -//! Methods of `GrStage`: `validate_detached_ffn`, `validate_ffn_ready`. -//! Functions: `download_f32`, `driver_error`, `binding_error`, `validate_values` and 2 more. +//! Host-side helpers shared by the GR stages: finite device readback, driver and binding error mapping, and the +//! shape checks of values, layers and streams. Also validates a detached FFN read against the current transaction. use super::{ DetachedGrRead, DeviceBuffer, Dimension, DriverError, Error, GrRole, GrStage, InputBindingError, LayerId, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gr/gr_stage.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gr/gr_stage.rs index 6675062c..dbd0ec3b 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gr/gr_stage.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gr/gr_stage.rs @@ -1,5 +1,6 @@ -//! Methods of `GrStage`: `apply`, `read_ffn`, `read_attention`, `read_attention_after_ple` and 6 more. -//! Functions: `copy_streams`, `resolve_gr_weights`, `read_candidate`, `check_injection_origin` and 2 more. +//! Single-row entry points of the GR stage: `apply` for layer 0, the attention and FFN reads, the final mix and the +//! injection of a block output into the residual streams. Each entry validates origin, layer and transaction before +//! touching the device; the result is a read capability or an `InjectedResidual`. use super::super::dense_weight_cache::GrResident; use super::{ diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gr/output_workspace_gpu.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gr/output_workspace_gpu.rs index 5b327d43..9ef07ee5 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gr/output_workspace_gpu.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gr/output_workspace_gpu.rs @@ -1,5 +1,4 @@ -//! Functions: `run_proof`, `compare_outputs`, `release_owners`, `original_first_fixed_outputs_repeat_overwrite_abort... -//! Defines `Tally`. +//! GPU test that the fixed GR output workspace is overwritten on every repeat read, survives an abort and is cleaned. use super::{ BindingIdentity, Cell, Context, DeviceBuffer, Error, GR_OUTPUT_BYTES, GR_OUTPUT_DEVICE_BYTES, GrScratch, Rc, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gr/output_workspace_gpu/check_handoff.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gr/output_workspace_gpu/check_handoff.rs index f9a28ce3..3e02ac1a 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gr/output_workspace_gpu/check_handoff.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gr/output_workspace_gpu/check_handoff.rs @@ -1,5 +1,5 @@ -//! Functions: `check_handoff`, `handoff_reference`, `residual_differences`, `ffn_differences`. -//! Split out of `output_workspace_gpu` to keep its files under the line limit. +//! GPU-test check of the attention to FFN handoff: the swapped producer feeds the FFN read without a host residual +//! upload, and residual and FFN outputs are compared against fresh-allocation references. use super::{ BindingIdentity, Context, DeviceBuffer, Error, GR_OUTPUT_DEVICE_BYTES, GrScratch, ReadCandidate, Result, block, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gr/output_workspace_gpu/fresh_read.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gr/output_workspace_gpu/fresh_read.rs index c4772494..58ef0927 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gr/output_workspace_gpu/fresh_read.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gr/output_workspace_gpu/fresh_read.rs @@ -1,5 +1,5 @@ -//! Functions: `fresh_read`, `release_reverse`, `fresh_read_launch`, `queue_fresh_read` and 5 more. -//! Split out of `output_workspace_gpu` to keep its files under the line limit. +//! GPU-test reference of the output workspace proof: fresh-allocation GR read and inject with the original +//! allocation boundary, plus the pattern inputs and the NaN poison that proves every retained byte is overwritten. use super::{Context, DeviceBuffer, Error, GR_OUTPUT_BYTES, GrScratch, Result, download_f32, driver_error, upload_f32}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gr/read_cached_cuda.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gr/read_cached_cuda.rs index 4a3a8c63..a8916ba0 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gr/read_cached_cuda.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gr/read_cached_cuda.rs @@ -1,5 +1,5 @@ -//! Functions: `read_cached_cuda`, `borrow_read_outputs`, `borrow_read_inject`, `cached_read_body` and 12 more. -//! Split out of `gr` to keep its files under the line limit. +//! The cached GR read and inject on the actor-owned scratch: queued read kernels, the finite mask naming the first +//! failing stage, and the upload/copy/budget helpers. No result is cached: every active byte is rewritten per call. use super::{ Cell, Context, DeviceBuffer, Error, GR_OUTPUT_BYTES, GrPhase, GrScratch, ReadCandidate, RefCell, Result, diagnose, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gr/read_cuda.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gr/read_cuda.rs index ef86c7e1..8720b631 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gr/read_cuda.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gr/read_cuda.rs @@ -1,5 +1,5 @@ -//! Methods of `OwnedReadWeights`: `upload`, `select`, `release`. -//! Methods of `ReadWork`: `allocate`, `norm_down_silu`, `up_gates`, `release`. +//! The uncached GR read: upload the weights (unless resident), run norm, down projection, SiLU, up gates and the +//! inject coefficients on a fresh workspace, read them back and release everything before publishing. use super::{ Context, DeviceBuffer, Error, GrPhase, GrWeights, ReadCandidate, Result, diagnose, diagnose_extrema, download_f32, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gr/residual_ready.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gr/residual_ready.rs index f19790c5..e1c01364 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gr/residual_ready.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gr/residual_ready.rs @@ -1,5 +1,5 @@ -//! Methods of `ResidualReady`: `oracle_inject`, `validate_origin`, `identity`, `streams` and 1 more. -//! Methods of `InjectedResidual`: `from_candidates`, `validate_origin`, `identity`, `streams`. +//! Accessors of the GR capabilities: `ResidualReady` (a read result with mixed values and streams) and +//! `InjectedResidual` (streams after injection). Each can be checked for binding and role origin. use super::{BindingIdentity, Error, GrRole, InjectedResidual, ResidualReady, Result, TokenLayer, validate_streams}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gr/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gr/tests.rs index 6375eba7..bdbed92a 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gr/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gr/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of `gr`. +//! Pins GR refusals: shape and numeric failures leave inputs unchanged, a late NaN publishes no streams, norm and +//! post-op overflow are detected, not masked, and an injected capability from another model or stage is refused. use super::{ BindingIdentity, Dimension, Error, GrRole, InjectedResidual, LayerId, TokenLayer, validate_layer, validate_streams, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/input.rs b/crates/engine-qwen35-cuda/src/qwen_forward/input.rs index 71314d89..f69e9d6f 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/input.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/input.rs @@ -1,3 +1,7 @@ +//! The input stage of a model step: the types of what a token step consumes (InputReady with its residual streams and +//! PLE rows, the chunk-wide StagedInput) and of the PLE history it advances (owner, prior, pending, ready). +//! The behaviour lives in the submodules; this file holds the data and the constants of the PLE layout. + #![allow(dead_code)] use super::contract::{Dimension, Error, Position, Result, Stage, TokenId}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/input/gather_rows.rs b/crates/engine-qwen35-cuda/src/qwen_forward/input/gather_rows.rs index 53c5d647..7fae45e2 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/input/gather_rows.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/input/gather_rows.rs @@ -1,5 +1,6 @@ -//! Methods of `InputReady`: `test_fixture`. Methods of `PleOwner`: `new`, `matches`. -//! Functions: `gather_rows`, `binding_error`. +//! The PLE history state of a session: PlePrior (the nine-slot history before a step), PlePending and PleReady (a +//! step in flight), plus the head-major gather of the sixteen PLE rows of one token. +//! Kept apart from input_stage so the history types can be checked and advanced without the input stage's callers. use super::{ BindingIdentity, Dimension, EMBEDDING_VALUES, Error, GrRole, InjectedResidual, InputBindingError, InputError, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/input/hash.rs b/crates/engine-qwen35-cuda/src/qwen_forward/input/hash.rs index cfe43abb..1eb2ece0 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/input/hash.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/input/hash.rs @@ -1,3 +1,6 @@ +//! The sixteen PLE row indices of a token: a wrapping multiplicative hash of the token and its two predecessors +//! (with the EOS rule), identical per head to the Original, and bounded to the token and row domains. + use super::super::contract::{Error, Result}; use crate::model_binding::qwen4exp_input::{InputConstants, PLE_ROWS, VOCABULARY}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/input/input_stage.rs b/crates/engine-qwen35-cuda/src/qwen_forward/input/input_stage.rs index 6949a8df..ed3d11f1 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/input/input_stage.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/input/input_stage.rs @@ -1,5 +1,6 @@ -//! Methods of `InputStage`: `consume`, `consume_kar`, `consume_kar_deferred`, `ple_rows_ahead` and 3 more. -//! Functions: `admit_kar_input`, `stage_new_embedding`, `window_ple_row`, `gather_window_rows` and 3 more. +//! InputStage: turns a token and position into the step's input, its embedding broadcast to the four residual streams +//! and its sixteen PLE rows, for decode (`consume`) and for KAR-backed prefill (`consume_kar`, `..._deferred`). +//! The deferred form only records rows for the chunk-wide device gather; it never materialises per-row host values. use super::{ Context, Dimension, EMBEDDING_VALUES, Error, InputBindingError, InputError, InputReady, InputStage, ModelBinding, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/input/input_stage_ple_micro.rs b/crates/engine-qwen35-cuda/src/qwen_forward/input/input_stage_ple_micro.rs index 399c35f7..0211fed1 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/input/input_stage_ple_micro.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/input/input_stage_ple_micro.rs @@ -1,5 +1,6 @@ -//! Methods of `InputStage`: `prepare_ple_micro_input`, `apply_ple_micro_cached`, `apply_ple`, `apply_ple_cached`. -//! Functions: `check_micro_origin`, `check_micro_source`, `copy_ple_values`, `check_micro_admission` and 12 more. +//! The PLE step of InputStage: validates the genuine layer-one residual and the PLE prior, composes the key, value, +//! gate and history update on the device, and returns the new streams and history as one candidate or none. +//! No session history escapes on a numerical or transport refusal; the micro-window form covers a whole window. use super::{ Context, DenseWeightCache, Dimension, Error, GrRole, InjectedResidual, InputReady, InputStage, LayerId, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/input/ple_cuda.rs b/crates/engine-qwen35-cuda/src/qwen_forward/input/ple_cuda.rs index da7d7a26..34b1a794 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/input/ple_cuda.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/input/ple_cuda.rs @@ -1,5 +1,6 @@ -//! Methods of `PleUploads`: `upload`. Methods of `OwnedPleAux`: `upload`, `select`, `release`. -//! Functions: `ple_cuda`, `project_key_value`, `ple_project`, `project_resident_key` and 6 more. +//! The CUDA composition of one PLE row from separate uploads: key and value projection of the embedding, then gate, +//! norms and convolution over the residual streams and the nine-slot history, with resident or uploaded weights. +//! Owns every device buffer of the step and releases them before a candidate can leave. use super::{ Bf16ProjectionShape, Context, DenseWeightCache, DeviceBuffer, Error, ModelBinding, PLE_DEVICE_PEAK, PLE_HC, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/input/ple_transport/ple_key_retained_gpu/bf16.rs b/crates/engine-qwen35-cuda/src/qwen_forward/input/ple_transport/ple_key_retained_gpu/bf16.rs index bc48ddeb..57ab95cc 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/input/ple_transport/ple_key_retained_gpu/bf16.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/input/ple_transport/ple_key_retained_gpu/bf16.rs @@ -1,5 +1,5 @@ -//! Methods of `Matrices`: `new`, `aux`, `unchanged`, `close`. -//! Methods of `Chain`: `key_value`, `norms`, `gate`, `gated` and 2 more. +//! Test support for the retained-PLE proof: synthetic BF16 PLE matrices and the legacy chain (one key projection and +//! forty ephemeral value tiles) that the whole-matrix retained path must reproduce bit for bit. use super::{ Bf16ProjectionShape, Context, DeviceBuffer, Finite, Matrices, Role, Transport, at, ple_download, ple_driver_error, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/input/ple_transport/role.rs b/crates/engine-qwen35-cuda/src/qwen_forward/input/ple_transport/role.rs index 0d49a691..034f8eb2 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/input/ple_transport/role.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/input/ple_transport/role.rs @@ -1,5 +1,6 @@ -//! Methods of `Role`: `count`. Methods of `Transport`: `new`, `note`, `allocate`, `buffer` and 8 more. -//! Implements `Drop for Transport`. Functions: `at`, `compose`, `admit`. +//! Impls of the PLE transport: the device buffers of one invocation, the certificates (`Finite`) a full readback +//! mints for each role (key, value, norms, gate, conv, history, streams), and the entry points `compose` and `admit`. +//! Any CUDA failure latches the invocation as failed, so nothing it produced can be published. use super::{ Cell, Context, DeviceBuffer, Error, Finite, PLE_HC, PLE_HISTORY, PleCandidate, PleRows, Rc, Result, Role, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/input/ple_upload_f32.rs b/crates/engine-qwen35-cuda/src/qwen_forward/input/ple_upload_f32.rs index 7febeb4f..3546598c 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/input/ple_upload_f32.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/input/ple_upload_f32.rs @@ -1,5 +1,5 @@ -//! Methods of `InputStage`: `prepare_original_prompt_history`, `finish_original_prompt_history`, `prepare_prompt_dev... -//! Functions: `ple_upload_f32`, `ple_upload_u16`, `ple_download`, `ple_driver_error`. +//! Host-device transfer helpers of the PLE path (f32 and u16 uploads, readback, driver error mapping) and the +//! preparation of the prompt PLE history on the device: seeding it from the prior, closing it after a prefill chunk. use super::{ Context, DenseWeightCache, DeviceBuffer, DriverError, Error, GrRole, InputReady, InputStage, ModelBinding, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/input/residual_streams.rs b/crates/engine-qwen35-cuda/src/qwen_forward/input/residual_streams.rs index 664e8e89..b42eca24 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/input/residual_streams.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/input/residual_streams.rs @@ -1,5 +1,5 @@ -//! Methods of `ResidualStreams`: `broadcast`, `values`. -//! Methods of `InputReady`: `binding_identity`, `token`, `position`, `streams` and 3 more. Implements `From for Error`. +//! Accessors of the input step: `ResidualStreams` (one embedding broadcast to the four residual streams, checked for +//! shape and finiteness) and the read-only view of `InputReady` (binding, token, position, streams, PLE rows). use super::{ BindingIdentity, EMBEDDING_VALUES, Error, InputError, InputReady, Position, ResidualStreams, Result, StagedInput, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache/kar_ple_cache_methods.rs b/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache/kar_ple_cache_methods.rs index 1fa25287..322a8841 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache/kar_ple_cache_methods.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache/kar_ple_cache_methods.rs @@ -1,5 +1,6 @@ -//! Methods of `KarPleCache`: `new`, `admit_budget`, `allocate_scratch`, `admit_binding` and 15 more. -//! Functions: `check_stage_rows`, `encode_staged`, `verify_ahead_packets`, `serialize_books` and 4 more. +//! The lifecycle of `KarPleCache`: admission of the budget and binding, the staging scratch, staging a chunk of PLE +//! rows (hits, misses, packets from the read-ahead or the archive), commit after the device accepted the scatter, +//! and the direct 16-row gather with scatter, decode and finite readback. The cache map changes only in `commit`. use super::{ AHEAD_KEEP, AHEAD_THREADS, Ahead, Arc, CACHE_BYTES, Context, DeviceBuffer, Error, GatherPlan, KarPleBinding, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache/lru_tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache/lru_tests.rs index 8fad61f9..df0bc762 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache/lru_tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache/lru_tests.rs @@ -1,5 +1,6 @@ -//! Methods of `Rng`: `next`, `row`. Methods of `Scan`: `new`, `victim`, `plan`, `gather`. -//! Functions: `token`, `gather_equals_the_full_scan_on_random_sequences`, `chunks_and_gathers_interleaved_keep_every... +//! Pins the resident-row LRU of the KAR PLE cache: gather planning equals a full-scan reference on random +//! sequences, chunks and gathers interleaved keep every row in its own slot, and eviction examines a handful of +//! queue items, not the whole cache. use super::{Lookup, Residents, SLOTS, assign_slots, lookup_rows, plan_gather, publish_gather}; use std::collections::HashMap; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache/publish_gather.rs b/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache/publish_gather.rs index 7dc91ff8..b8df218f 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache/publish_gather.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache/publish_gather.rs @@ -1,5 +1,5 @@ -//! Methods of `Ahead`: `collect`. Functions: `publish_gather`, `ahead_enabled`. -//! Split out of `kar_ple_cache` to keep its files under the line limit. +//! Publication of a gather the device accepted (evict victims, map new rows, age the sixteen rows in order), the +//! `LELEKA_PLE_AHEAD` switch for read-ahead of the next chunk's packets, and collection of a finished read-ahead. use super::{Ahead, PlannedMiss, Residents}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache/row_parity_probe.rs b/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache/row_parity_probe.rs index 9b8ab142..ff609710 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache/row_parity_probe.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache/row_parity_probe.rs @@ -1,5 +1,6 @@ -//! Functions: `fnv`, `probe_binding`, `probe_rows`, `dump_decoded_rows_for_original_comparison` and 2 more. -//! Split out of `kar_ple_cache` to keep its files under the line limit. +//! Ignored probes against the real KAR archive and a GPU: dump the decoded PLE rows as FNV hashes for comparison +//! with the Original, and check that the batch read equals the sixteen-row reads. They admit a plain file path +//! through the same verification as production. use super::{BindingIdentity, KarPleBinding, KarPleCache, PLE_ROWS}; use crate::model_binding::qwen4exp_kar_ple::pinned_profile; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache/scratch_bytes.rs b/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache/scratch_bytes.rs index 94838bc2..5344a1ca 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache/scratch_bytes.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache/scratch_bytes.rs @@ -1,5 +1,6 @@ -//! Methods of `Residents`: `len`, `get`, `contains_key`, `try_reserve` and 7 more. -//! Methods of `KarPleStaged`: `updates`, `slots`. Implements `Hasher for RowHasher`. +//! The row bookkeeping of the KAR PLE cache: `Residents`, the map of cached rows with a recency queue that finds +//! the oldest rows without scanning, the hasher for dense row numbers, and the pure slot planning for a chunk +//! (`lookup_rows`, `assign_slots`) and a gather (`plan_gather`). Nothing here touches the device. use super::{ Entry, Error, GatherPlan, Hasher, KarPleStaged, Lookup, MAX_MISSES, PlannedMiss, Residents, Result, RowHasher, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache/slot_tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache/slot_tests.rs index 3d6dca7d..6dd06703 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache/slot_tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache/slot_tests.rs @@ -1,5 +1,6 @@ -//! Functions: `apply`, `the_scatter_staging_buffers_match_the_update_records`, `chunk`, `consistent` and 9 more. -//! Defines `Given`. +//! Pins the slot assignment of the KAR PLE cache: fresh rows get distinct free slots, hits keep their slots and +//! refresh age, a full cache evicts the oldest untouched rows, rows match by id not position, and a chunk that needs +//! more slots than the untouched rows hold is refused. Also the scatter staging sizes. use super::{Error, Lookup, MAX_MISSES, Residents, UPDATE_RECORD_BYTES, assign_slots, lookup_rows, scratch_bytes}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/cached_expert_run.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/cached_expert_run.rs index 575f6e91..51f578a3 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/cached_expert_run.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/cached_expert_run.rs @@ -1,5 +1,6 @@ -//! Methods of `ActualSlotPacket`: `validate`. Methods of `ActualDown`: `take`. -//! Functions: `shared_scalar_buffers`, `release_shared_inputs`, `scaled_shared`, `finish_with_parts` and 1 more. +//! Cached-weights execution of one expert row: routed Down packets, the scalar-gated shared expert and the combine. +//! Owns the partial buffers of a run and closes every one of them whatever failed, so a failure never leaks device +//! memory. Also holds the origin checks that tie a Down packet to the binding and layer that minted it. use super::moe_down::{RetainedScalar, ScaledDown}; use super::{ diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/expert_matrix_projection.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/expert_matrix_projection.rs index 4e89fa25..86e3e2a4 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/expert_matrix_projection.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/expert_matrix_projection.rs @@ -1,5 +1,7 @@ -//! Functions: `matrix_dims`, `gate_up_dims`, `prepared_routed_format`, `gate_up_prepared_format` and 15 more. -//! Defines `MatrixDims`, `ExpertMatrix`, `ExpertActivation` and 2 more. +//! Projection of one expert matrix (Gate, Up or Down): shape and format admission, launch plan per matrix kind, +//! readback. The declared dimensions come from the binding; each matrix kind maps to exactly one launch (dense, +//! routed prepared Q8 or cached MMQ), and a kind without a plan is refused. The uncached diagnostic path uploads the +//! raw matrix here. use super::{ BoundExpert, CachedMoeMatrix, Context, DEVICE_PEAK, DenseFormat, DeviceBuffer, Error, FF, ModelBinding, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/expert_mlp_values.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/expert_mlp_values.rs index 3a2962a0..c3ed9aaa 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/expert_mlp_values.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/expert_mlp_values.rs @@ -1,5 +1,7 @@ -//! Functions: `expert_mlp`, `cached_expert_mlp`, `uncached_hidden`, `project_cached_gate_up` and 3 more. -//! Split out of `moe_expert` to keep its files under the line limit. +//! One expert MLP (Gate and Up, SwiGLU, Down) returning host values, on the uncached diagnostic path or on cached +//! weights. The uncached path keeps its original download and re-upload chain; the cached path keeps Gate/Up on the +//! device. Release of every owned buffer is attempted after the last use and a cleanup failure withholds a finished +//! candidate. use super::expert_matrix_projection::{gate_up_dims, gate_up_prepared_format}; use super::{ diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/expert_step.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/expert_step.rs index 8fd3e1c9..96ed8a92 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/expert_step.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/expert_step.rs @@ -1,5 +1,7 @@ -//! Methods of `ExpertReady`: `identity`, `output`, `validate_origin`, `from_completed`. -//! Methods of `StepCuda`: `dispatch`, `dispatch_prepared`. +//! Entry of one MoE expert step: validates the FFN row, uploads the activation and dispatches the routed experts and +//! the shared expert (weight cache, KAR archive or uncached diagnostic) into an `ExpertReady` row. All descriptors +//! and expert ids are admitted before any CUDA work; the activation and the prepared owner are released whatever the +//! dispatch result, and the dispatch error wins over cleanup errors. use super::{ BindingIdentity, BoundExpert, Context, DeviceBuffer, Error, ExpertActivation, ExpertReady, GrRole, K, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/adaptive_packets/adaptive_packet_projection.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/adaptive_packets/adaptive_packet_projection.rs index f91c557d..8da4a37c 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/adaptive_packets/adaptive_packet_projection.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/adaptive_packets/adaptive_packet_projection.rs @@ -1,5 +1,6 @@ -//! Functions: `project_adaptive_packets`. -//! Split out of `adaptive_packets` to keep its files under the line limit. +//! Entry that projects every expert group of one chunk batch into its slot packets on the adaptive path. +//! It owns the ephemeral routed owner for the call and drains it whatever the outcome, so no pending expert transfer +//! outlives the batch, including after a prepare, copy or cancel error. use super::super::direct_packets_fns::PacketRun; use super::super::packet_run_project_group_direct::DirectRun; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/adaptive_packets/packet_wave_projection.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/adaptive_packets/packet_wave_projection.rs index f51e597e..af8a880e 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/adaptive_packets/packet_wave_projection.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/adaptive_packets/packet_wave_projection.rs @@ -1,5 +1,6 @@ -//! Functions: `project_inner`, `observe_adaptive`, `ephemeral_slot_count`. -//! Split out of `adaptive_packets` to keep its files under the line limit. +//! Driver of one adaptive packet wave: observe the rows for the adaptive policy, classify the expert groups, stage +//! the GPU misses, run the CPU miss batches, then finish the GPU queue. Also checks that the ephemeral routed owner +//! has a supported slot count (legacy 2, or mapped 8 or 16). use super::super::direct_packets_fns::PacketRun; use super::super::packet_run_project_group_direct::DirectRun; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu/arm.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu/arm.rs index bf231305..107d86f7 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu/arm.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu/arm.rs @@ -1,5 +1,6 @@ -//! Functions: `arm`, `probe_payload`, `preflight_copy`, `corrupted_bytes` and 1 more. -//! Split out of `direct_gpu` to keep its files under the line limit. +//! Setup of one proof arm of the direct-Down transport probe: real layer-0 chunk rows, the probe payload and the +//! corrupted-byte and refused-scope cases the all-copy preflight uses. Completed layer-0 FFN products stay private; +//! no injection, head or target publication is made, and a cancelled chunk is dropped, not repaired. use super::{ Cell, ChunkFfnLayer, DEVICE_PEAK, DownScope, Error, FF, K, LoadedArms, MoeExpertStage, N, Observation, ObservedArm, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu/loaded_arms.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu/loaded_arms.rs index 8d458a04..f006eead 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu/loaded_arms.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu/loaded_arms.rs @@ -1,5 +1,6 @@ -//! Methods of `LoadedArms`: `arm`, `matches_snapshot`, `precheck`, `reference_and_candidate` and 2 more. -//! Methods of `QwenForward`: `test_direct_down_on_loaded`. +//! The arms of the loaded direct-Down proof on a real binding and session: reference, candidate, cancelled and +//! recovery runs of the same three-row chunk. Pins that a cancelled arm is refused after the copy and leaves the +//! session snapshot untouched, and that the recovery arm after a reset reproduces the reference outputs. use super::{ CANCELLED_ON_COPY, DirectDownReport, DirectRun, Error, K, LoadedArms, N, ObservedArm, QwenForward, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu/policy.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu/policy.rs index 3d9b7147..5a98259d 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu/policy.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu/policy.rs @@ -1,5 +1,7 @@ -//! Methods of `Observation`: `begin`, `take`. Methods of `DirectDownReport`: `assert_after_teardown`. -//! Implements `Drop for Observation`. Functions: `policy`, `copy_completed`, `observe_packet`, `compare` and 7 more. +//! Observation hooks and the report of the direct-Down proof: whether an arm uses the old split-and-pack or the +//! direct copy, recording of the copied packets, and their comparison. Also builds the chunk inputs of an arm. The +//! report is asserted only after the caller closed every cache, session and Context; it is not a full-target commit +//! proof. use super::{ CANCELLED_ON_COPY, COPIED, ChunkAttentionRow, ChunkFfnRow, DenseWeightCache, DetachedGrRead, DeviceBuffer, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu/probe.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu/probe.rs index 1c468146..70070e82 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu/probe.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu/probe.rs @@ -1,5 +1,6 @@ -//! Methods of `Probe`: `run`, `fill_sentinels`, `split_and_pack_old`, `copy_direct` and 7 more. -//! Functions: `transport_probe`, `output_differences`, `same_outputs`. +//! Byte-level transport probe: the old split-and-pack of a grouped Down result against the direct whole-group copy. +//! Both packets start from sentinels so untouched slots are compared too. Also pins the refusals: an invalid slot or +//! column in the all-copy preflight mutates nothing, an alien scope is refused, and a non-finite source is refused. use super::{ Cell, Context, DownScope, DownSelection, DriverError, Error, ExpertReady, K, N, Probe, Rc, Result, SLOTS, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/execute_bound.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/execute_bound.rs index 698fb918..048f1718 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/execute_bound.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/execute_bound.rs @@ -1,5 +1,7 @@ -//! Functions: `execute_bound`, `open_bound`, `finish_bound`, `is_extended_group` and 8 more. -//! Split out of `grouped` to keep its files under the line limit. +//! Entry of one chunk layer on the bound (cached-weight) path: admit and reserve device room, upload the row +//! activations, prepare their Q8 owners, run the rows, then close every owner. Decides whether the rows run as sorted +//! expert groups and opens the step-local Down scope; any failure marks the transport failed and the primary error +//! wins over cleanup errors. use super::bound_rows::{BoundRows, DirectPacketInputs}; use super::{ diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/finish_shared_with.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/finish_shared_with.rs index d1e0bb83..07936fb1 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/finish_shared_with.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/finish_shared_with.rs @@ -1,5 +1,6 @@ -//! Methods of `SharedOwners`: `scale_shared`, `combine_with`, `close_all`. -//! Functions: `finish_shared_with`, `uses_adaptive`. Defines `RowTail`, `SharedOwners`. +//! Shared-expert tail of one chunk row: scalar-gate scaling of the shared expert and the weighted combine with the +//! routed Down packet, finished by a caller-supplied combine. Holds the partial owners of the row and closes every +//! one in a fixed order whatever failed; also tells whether the adaptive path serves the row. use super::{ BoundExpert, Context, DeviceBuffer, DownOrigin, DownProvenance, DownScope, Error, ExpertActivation, K, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/ordered_down_refusal.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/ordered_down_refusal.rs index b4fe4bbc..7550d988 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/ordered_down_refusal.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/ordered_down_refusal.rs @@ -1,5 +1,7 @@ -//! Functions: `ordered_down_refusal`, `replay_selection`, `use_direct_packets`, `validate_packet_pairs` and 5 more. -//! Defines `PacketGroupMembers`. +//! Refusal and finish rules shared by the direct packet groups: replay of a numerical Q8 refusal in original row +//! order, packet and pair validation against the row origins, and the shared-expert finish. A later column's +//! quantizer refusal must not overtake an earlier column's Down NonFinite, so the refusal is replayed ascending; +//! every packet is closed whatever the first failure was. use super::finish_shared_with::RowTail; use super::packet_run_project_group_direct::{DownProjection, RefusalReplay}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/packet_run_project_group_direct.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/packet_run_project_group_direct.rs index bf5454de..d23a38fb 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/packet_run_project_group_direct.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/packet_run_project_group_direct.rs @@ -1,5 +1,7 @@ -//! Methods of `PacketRun`: `project_group_direct`. -//! Methods of `DirectGroup`: `check_descriptors`, `run`, `project_gate_up`, `project_gate_up_role` and 6 more. +//! Plain device path (no source fence) that projects one expert group into its row slot packets: Gate and Up, SwiGLU, +//! grouped Down, then copy of the Down columns into each row's packet. Defines the group and run descriptors the +//! direct and source paths share. Origins of all rows are validated before any packet is mutably loaned, and every +//! group buffer is closed whatever the outcome. use super::direct_packets_fns::PacketRun; use super::project_group_shared_fns::*; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/prepared_moe_row.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/prepared_moe_row.rs index 448ef6b3..60dd5406 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/prepared_moe_row.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/prepared_moe_row.rs @@ -1,5 +1,7 @@ -//! Methods of `PreparedMoeRow`: `validate`, `into_read`. -//! Methods of `MoeExpertStage`: `prepare_chunk_row`, `prepare_chunk_row_detached`, `execute_chunk`, `execute_chunk_n... +//! Per-row entry of the chunk MoE stage: prepares a row from its detached GR read and route, and executes the rows of +//! a chunk layer on the ordinary or the native-prompt path. The chunk transaction validates each row and its micro- +//! batch size (1 to 64 rows) before experts run; the direct packet path is used when the cache allows it. Also holds +//! the row-to-expert inverse grouping. use super::bound_rows::DirectPacketInputs; use super::{ diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/project_group.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/project_group.rs index 215642b1..dc1f54ed 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/project_group.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/project_group.rs @@ -1,5 +1,7 @@ -//! Methods of `ResidentGroup`: `run`, `project_gate_up`, `project_gate_up_role`, `finish_gate_up` and 7 more. -//! Methods of `DownArgs`: `refusal_values`. Functions: `project_group`. +//! Resident (or adaptive workspace) path that projects one expert group: Gate and Up, SwiGLU, then grouped Down +//! stored into the Down cells of the group's rows. Each Gate/Up role keeps the original finite stage boundary; a +//! numerical refusal of a later column is replayed in row order so it cannot overtake an earlier column's NonFinite. +//! Destination cells must still be empty. use super::packet_run_project_group_direct::{DownProjection, GroupBuffers, RefusalReplay}; use super::project_group_shared_fns::{ diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/project_group_source_consumers.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/project_group_source_consumers.rs index c201cdc5..d9a78724 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/project_group_source_consumers.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/project_group_source_consumers.rs @@ -1,5 +1,6 @@ -//! Methods of `DirectGroup`: `run_source`, `source_gate_up`, `source_up`, `source_gate_up_role` and 5 more. -//! Functions: `project_group_source_consumers`, `check_source_members`. +//! Source-backed direct group: Gate, Up, SwiGLU and Down of one expert read through the opened routed source scope. +//! The scope ends after the last private consumer and before any packet coverage or group acceptance; a failure +//! discards every copied private packet. Also checks that the source members match the group descriptors. #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] use super::packet_run_project_group_direct::{ diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/project_group_source_fenced.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/project_group_source_fenced.rs index 04722779..c824cfa1 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/project_group_source_fenced.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/project_group_source_fenced.rs @@ -1,5 +1,6 @@ -//! Methods of `PacketRun`: `direct_group`, `project_group_fenced`. Functions: `source_members`. -//! Split out of `grouped` to keep its files under the line limit. +//! Fenced entry of the source-backed direct group: opens the source scope around the consumers of one expert group. +//! The mandatory source finish is attempted even after a failure and runtime primary errors are preserved; the cache +//! is rechecked after the matrix and source loans ended. #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] use super::direct_packets_fns::PacketRun; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/moe_activation_reuse_gpu/encoded.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/moe_activation_reuse_gpu/encoded.rs index 2177729d..6772340d 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/moe_activation_reuse_gpu/encoded.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/moe_activation_reuse_gpu/encoded.rs @@ -1,5 +1,6 @@ -//! Functions: `block_geometry`, `fill_block`, `encoded`, `exact` and 9 more. -//! Split out of `moe_activation_reuse_gpu` to keep its files under the line limit. +//! Deterministic encoded expert-matrix fixtures and the reference MLP of the retained Gate/Up proof (GPU tests only). +//! Builds quantized blocks for each matrix kind with bounded values, runs the same Down kernel and a download and re- +//! upload reference chain, and checks the outputs are bit-exact and the uploaded matrices unchanged. use super::{ Cell, Context, DenseFormat, DeviceBuffer, DriverError, FF, MatrixDims, MoeMatrixKind, N, ProjectionKind, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/moe_activation_reuse_gpu/former_fixture_domain_refusal.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/moe_activation_reuse_gpu/former_fixture_domain_refusal.rs index 82e41d0d..0580e4cc 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/moe_activation_reuse_gpu/former_fixture_domain_refusal.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/moe_activation_reuse_gpu/former_fixture_domain_refusal.rs @@ -1,5 +1,6 @@ -//! Methods of `DomainFixture`: `build`, `release`. -//! Functions: `hidden_extrema`, `former_fixture_domain_refusal`, `nonfinite_hidden_refused`, `late_nan_projection_re... +//! Refusal cases of the retained Gate/Up proof: the fixture of a former domain failure, non-finite hidden values, a +//! late NaN written by a real projection, a Down shape mismatch, and saturation. Each case must be refused by genuine +//! native admission before the retained projection owner is published. use super::{ Cell, Context, DeviceBuffer, DriverError, Error, FF, MatrixDims, MoeMatrixKind, N, compare_mlp, down_projection, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/moe_down/down_scope.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/moe_down/down_scope.rs index 706731a6..99d20c2a 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/moe_down/down_scope.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/moe_down/down_scope.rs @@ -1,5 +1,6 @@ -//! Methods of `DownScope`: `new`, `with_routed_finite`, `with_routed_workspace`, `with_workspace` and 15 more. -//! Functions: `check_grouped_selections`, `completed_row_source`. Defines `GroupedColumn`, `GroupedHandoff`. +//! The step-local scope every Down output of one expert step is minted under: its epoch, failure flag and workspaces. +//! A CUDA failure recorded in the scope poisons it, so no later consumer can use a Down output of a failed step. Also +//! splits a grouped Down allocation into per-slot Down owners once its producer readback is finite. use super::{ Cell, CompletedCpuRow, Context, DeviceBuffer, DownScope, DownSelection, Error, K, N, Rc, Result, RetainedDown, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/moe_down/moe_down_reuse_gpu/exact.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/moe_down/moe_down_reuse_gpu/exact.rs index 4477606e..c7155b96 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/moe_down/moe_down_reuse_gpu/exact.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/moe_down/moe_down_reuse_gpu/exact.rs @@ -1,5 +1,5 @@ -//! Functions: `exact`, `down_weights`, `scalar_weights`, `project` and 3 more. -//! Split out of `moe_down_reuse_gpu` to keep its files under the line limit. +//! Fixtures and exact-comparison helpers of the retained Down proof: seeded Down and scalar weight bytes, the +//! original Down projection, retained Down outputs, and a check that an expected refusal is counted. use super::{ Cell, Context, DenseFormat, DeviceBuffer, DownScope, DownSelection, Error, N, ProjectionKind, ProjectionSpec, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/moe_down/resident_packed_down.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/moe_down/resident_packed_down.rs index 1eed90dc..f1d194c3 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/moe_down/resident_packed_down.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/moe_down/resident_packed_down.rs @@ -1,5 +1,6 @@ -//! Methods of `ResidentPackedDown`: `new`, `validate`, `complete`, `with_completed` and 7 more. -//! Split out of `moe_down` to keep its files under the line limit. +//! Destination of the K routed Down outputs of one resident chunk row, filled by one closed producer copy. +//! Coverage is published only after the copy and the origin and cancellation postchecks succeeded; partial coverage +//! is never visible, and the window can be lent out only once every slot is covered. use super::{DeviceBuffer, DownScope, Error, K, N, Rc, ResidentPackedDown, Result, ScaledDown}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/moe_down/retained_scalar.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/moe_down/retained_scalar.rs index 8d62a8f5..24f49ab6 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/moe_down/retained_scalar.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/moe_down/retained_scalar.rs @@ -1,5 +1,6 @@ -//! Methods of `RetainedScalar`: `close`. Methods of `TransportBuffer`: `buffer`, `buffer_mut`, `close`, `release`. -//! Implements `Drop for TransportBuffer`. +//! Ownership and lifetime of the retained Down device buffers: scalar, scaled shared and the packed routed Down. +//! `TransportBuffer` fails closed (a failed scope refuses every access) and releases its device memory on drop; the +//! packed owner fills K slots in order and lends only a complete, in-scope packet to the combine. use super::{ DeviceBuffer, DownScope, DownSelection, Error, K, N, PackedDown, Rc, Result, RetainedDown, RetainedScalar, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/scoped_expert_mlp.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/scoped_expert_mlp.rs index f2ffd2ae..f49b9fc8 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/scoped_expert_mlp.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/scoped_expert_mlp.rs @@ -1,5 +1,6 @@ -//! Functions: `check_origin`, `swiglu_hidden`, `project_down`, `close_down_parts` and 4 more. Defines `DownProvenance`. -//! Split out of `moe_expert` to keep its files under the line limit. +//! Expert MLP on cached weights whose Down output is minted inside a step-local `DownScope` (Gate, Up, SwiGLU, Down). +//! Gate, Up and hidden stay on the device as scope-owned buffers; the Down result is recorded under the scope's +//! origin and every owner is closed after use, the primary failure winning over cleanup failures. use super::expert_matrix_projection::{MatrixDims, gate_up_dims, gate_up_prepared_format}; use super::{ diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/tests.rs index dfb7a46c..7ccaf69b 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Pins the expert-row collection and finite checks: completed tiles keep all rows, a late failure withholds the +//! candidate, and a non-finite last expert output is refused while a signed zero is retained. use super::{DEVICE_PEAK, Error, FF, N, admit_budget}; #[cfg(test)] diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/validate_values.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/validate_values.rs index 06f1e390..87826447 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/validate_values.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/validate_values.rs @@ -1,5 +1,5 @@ -//! Functions: `validate_values`, `upload_bytes`, `upload_f32`, `download_f32` and 2 more. -//! Split out of `moe_expert` to keep its files under the line limit. +//! Shared helpers of the expert stage: finite and length checks of host values, f32 upload and download of device +//! buffers, and the mapping of binding and driver errors onto the stage error. use super::{Context, DeviceBuffer, DriverError, Error, InputBindingError, Result, Stage}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_prefill_batch/device_bytes.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_prefill_batch/device_bytes.rs index 95a83f12..a6cde714 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_prefill_batch/device_bytes.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_prefill_batch/device_bytes.rs @@ -1,5 +1,6 @@ -//! Methods of `Buffers`: `new`, `from_pool`, `into_outputs`, `release`. -//! Functions: `device_bytes`, `release_pool`, `buffer_sizes`, `allocate_pool` and 4 more. +//! Device buffers of one batched prefill MoE step: the per-call sizes in allocation order and the `Buffers` that +//! own them. Sizes depend on the window row count, the router profile and whether the combine runs. The pool is +//! released as a whole, and outputs are handed out only after the internal owners are released. use super::{ Buffers, Context, DeviceBuffer, EXPERTS, Error, FF, MIXED, MoeBf16Profile, Result, SELECTED, driver_error, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_prefill_batch/moe_prefill_resources.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_prefill_batch/moe_prefill_resources.rs index ddcc799c..dc266b01 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_prefill_batch/moe_prefill_resources.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_prefill_batch/moe_prefill_resources.rs @@ -1,5 +1,6 @@ -//! Methods of `MoePrefillResources`: `new`, `validate_context`, `allocated_bytes`, `close` and 1 more. -//! Methods of `RouteRow`: `validate_origin`. Implements `Drop for MoePrefillResources`, `Drop for MoeMicroProducts`. +//! Persistent resources of the batched prefill MoE router and shared expert, and the products it hands to the caller. +//! Owns the allocation charge, context check and close of both; validates that every route row and window come from +//! the genuine FFN reads of the layer under the same binding, and that route ids and weights are valid. use super::{ BindingIdentity, Context, DeviceBuffer, EXPERTS, Error, GdnNativeFormat, GrRole, LayerId, MOE_BATCH_SCRATCH_BYTES, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_prefill_batch/moe_prefill_stage.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_prefill_batch/moe_prefill_stage.rs index c8048bcc..be8d3520 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_prefill_batch/moe_prefill_stage.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_prefill_batch/moe_prefill_stage.rs @@ -1,5 +1,6 @@ -//! Methods of `MoePrefillStage`: `transient_bytes`, `route_shared_micro`, `combine_micro`. -//! Split out of `moe_prefill_batch` to keep its files under the line limit. +//! Entry points of the batched prefill MoE stage over one micro-window: the router and shared expert, and the later +//! separate combine. The combine consumes only the products' own device outputs, so it re-routes nothing and +//! recomputes no shared expert; it is single-use per window and fenced against the actual chunk rows and binding. use super::{ Buffers, CombineInput, CombineOperands, CombineWindow, Error, MIXED, MicroInputs, MoeBf16Profile, MoeMicroProducts, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_prefill_batch/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_prefill_batch/tests.rs index c042c301..93d935c9 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_prefill_batch/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_prefill_batch/tests.rs @@ -1,4 +1,6 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Pins the prefill MoE contract: a route row needs distinct in-range ids and finite, ordered unit weights, the +//! shared formats are the six native kinds, device byte counts follow the prompt-path buffer set, and f32 staging is +//! little-endian. use super::{ EXPERTS, Error, FF, GdnNativeFormat, MIXED, MoeBf16Profile, MoeWeightDescriptor, SELECTED, device_bytes, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_route/project_logits.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_route/project_logits.rs index 07e81d07..e93d098d 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_route/project_logits.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_route/project_logits.rs @@ -1,5 +1,7 @@ -//! Functions: `activation_bytes`, `upload_router_matrix`, `finish_logits`, `project_logits` and 9 more. -//! Defines `RouterInput`. +//! Router projection and route validation: the 512 router logits of one mixed residual, then the raw top-10 turned +//! into `RoutedExperts` only through the same checks, for a per-row and for a batch route. Validates request shape, +//! binding and finite logits; the router matrix is uploaded here only on the uncached diagnostic path, and every +//! owner is released explicitly. use super::{ Bf16ProjectionShape, BindingIdentity, COLUMNS, Context, DenseWeightCache, Dimension, EXPERTS, Error, ExpertId, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_route/router_logits.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_route/router_logits.rs index 3d1b0543..da22f8de 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_route/router_logits.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_route/router_logits.rs @@ -1,5 +1,6 @@ -//! Methods of `RouterLogits`: `from_preceding`, `fixture`. -//! Methods of `RoutedExperts`: `new`, `identity`, `experts`, `weights` and 2 more. +//! Producer-owned router products and the route entry points of `MoeRouteStage`. +//! `RouterLogits` and `RoutedExperts` can be made only by the router producer for one token, layer and binding; the +//! stage routes from the typed FFN read, through the retained router scratch or the closed CUDA operation. use super::{ BindingIdentity, COLUMNS, Context, DenseWeightCache, EXPERTS, Error, ExpertId, FiniteF32, GrRole, LayerId, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_route/run_cuda.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_route/run_cuda.rs index 15b5376d..58efaaf4 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_route/run_cuda.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_route/run_cuda.rs @@ -1,5 +1,6 @@ -//! Functions: `logits_to_bytes`, `decode_route`, `release_route_buffers`, `run_cuda` and 1 more. -//! Split out of `moe_route` to keep its files under the line limit. +//! The fixed CUDA route operation: the 512 logits go to the device and the top-10 expert ids and weights come back. +//! Explicit releases are part of success: a cleanup failure withholds the host result. Also maps driver errors to the +//! closed runtime error categories. use super::{Context, DriverError, EXPERTS, Error, IDS_BYTES, LOGITS_BYTES, Result, SELECTED, Stage, WEIGHTS_BYTES}; use leleka_cuda_driver::DeviceBuffer; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_route/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_route/tests.rs index a6ecbfca..efc2f346 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_route/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_route/tests.rs @@ -1,3 +1,7 @@ +//! Pins the router contract against an independent reference: typed results keep tie order and weights, wrong +//! binding, token or layer identity and bad topology or logits are refused before dispatch, malformed or non-finite +//! routes are never published, driver failures return no partial route, and rank weights never grow. + use super::{ BindingIdentity, DriverError, EXPERTS, Error, ExpertId, LOGITS_BYTES, LayerId, Result, RoutedExperts, RouterLogits, SELECTED, Stage, TokenId, TokenLayer, map_driver_error, route_with, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_ephemeral_routed/ephemeral_mapped_stage.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_ephemeral_routed/ephemeral_mapped_stage.rs index 04563ab5..df50fec3 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_ephemeral_routed/ephemeral_mapped_stage.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_ephemeral_routed/ephemeral_mapped_stage.rs @@ -1,5 +1,6 @@ -//! Methods of `MappedStageShape`: `slots`. -//! Methods of `EphemeralRoutedOwner`: `new_mapped`, `slot_count`, `uses_mapped`, `mapped_eligible`. +//! The mapped variant of the ephemeral routed owner: 8 or 16 whole-triplet slots filled by a device copy straight +//! from the retained expert bank pages, with no host payload read. Owns the slot state machine (idle, pending, +//! completed, in use), its byte accounting and drain/release. The owner delegates here whenever `mapped` is set. use super::{ Buffers, Context, DeviceBuffer, EphemeralRoutedOwner, Error, HOST_LIMIT, MappedExpertCopyScratch, MappedSlot, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_ephemeral_routed/ephemeral_routed_owner.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_ephemeral_routed/ephemeral_routed_owner.rs index 867b84b8..a0fb07d2 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_ephemeral_routed/ephemeral_routed_owner.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_ephemeral_routed/ephemeral_routed_owner.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `ephemeral_owner_allocation`, `ephemeral_owner_loans_and_drain`, `ephemeral_owner_stage_tra... -//! Split out of `cache_ephemeral_routed` to keep its files under the line limit. +//! The non-mapped half of `EphemeralRoutedOwner`, split by phase: allocation and key checks, staging and transfer, +//! loans and drain. Each phase file is an `impl` block of the one owner; the slot state machine stays in the parent. use super::{ Buffers, CLOSED_MAXIMUM, Cell, Context, DeviceBuffer, EphemeralRoutedOwner, Error, HOST_LIMIT, MappedStage, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_ephemeral_routed/ephemeral_routed_owner/ephemeral_owner_allocation.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_ephemeral_routed/ephemeral_routed_owner/ephemeral_owner_allocation.rs index 2956ac23..7780ae2f 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_ephemeral_routed/ephemeral_routed_owner/ephemeral_owner_allocation.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_ephemeral_routed/ephemeral_routed_owner/ephemeral_owner_allocation.rs @@ -1,5 +1,6 @@ -//! Methods of `EphemeralRoutedOwner`: `new`, `validate_maximum`, `allocate_idle`, `room` and 9 more. -//! Functions: `key_identity_ok`, `key_shape_ok`. +//! Construction and admission of the ephemeral routed owner: the two idle whole-triplet slots, the room check against +//! the context budget and free device memory, and the key checks that tie a staged triplet to its binding and layer. +//! Every allocation is made up front so a later stage can never fail on device memory. use super::{ CLOSED_MAXIMUM, Context, DeviceBuffer, EphemeralRoutedOwner, Error, MappedStage, ModelBinding, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_ephemeral_routed/ephemeral_routed_owner/ephemeral_owner_loans_and_drain.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_ephemeral_routed/ephemeral_routed_owner/ephemeral_owner_loans_and_drain.rs index 2a1aa7f6..433addf0 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_ephemeral_routed/ephemeral_routed_owner/ephemeral_owner_loans_and_drain.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_ephemeral_routed/ephemeral_routed_owner/ephemeral_owner_loans_and_drain.rs @@ -1,5 +1,6 @@ -//! Methods of `EphemeralRoutedOwner`: `loan_completed`, `borrow_triplet`, `with_triplet_inner`, `settle_inner_loan` ... -//! Split out of `ephemeral_routed_owner` to keep its files under the line limit. +//! Loan, drain and release of the ephemeral routed owner: a completed triplet is lent once to a synchronous callback +//! and returns to idle. Drain waits for every pending copy and keeps the buffers; release closes everything and +//! poisons the owner on any failure so a half-released slot is never reused. use super::{ Buffers, DeviceBuffer, EphemeralRoutedOwner, Error, MappedStage, MoeRoutedSourceScope, MoeWeightDescriptor, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_ephemeral_routed/ephemeral_routed_owner/ephemeral_owner_stage_transfer.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_ephemeral_routed/ephemeral_routed_owner/ephemeral_owner_stage_transfer.rs index 1f4e1d17..d6ef3ad2 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_ephemeral_routed/ephemeral_routed_owner/ephemeral_owner_stage_transfer.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_ephemeral_routed/ephemeral_routed_owner/ephemeral_owner_stage_transfer.rs @@ -1,5 +1,6 @@ -//! Methods of `EphemeralRoutedOwner`: `stage_inner`, `fixed_preparation`, `admit_stage`, `install_idle_buffers` and ... -//! Functions: `check_block_matches`. Defines `DetachedPayloads`. +//! Staging side of the ephemeral routed owner: admit a triplet against the host and device limits, read its three +//! blocks from the routed source, detach the host payloads and enqueue one owned copy into an idle slot. Also polls +//! and waits for that copy and installs the finished buffers, so a slot is Completed only once all roles landed. use super::{ Buffers, Cell, DeviceBuffer, EphemeralRoutedOwner, Error, HOST_LIMIT, ModelBinding, MoeExpertBlock, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_ephemeral_routed/healthy_cancel.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_ephemeral_routed/healthy_cancel.rs index df7531ee..f1f95c1d 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_ephemeral_routed/healthy_cancel.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_ephemeral_routed/healthy_cancel.rs @@ -1,5 +1,6 @@ -//! Functions: `healthy_cancel`, `observe_cancel`, `combine`, `close_buffers` and 2 more. -//! Split out of `cache_ephemeral_routed` to keep its files under the line limit. +//! Cancellation and cleanup helpers shared by the ephemeral routed owner and its mapped stage: the rule that only an +//! observed executor cancel on a healthy owner keeps the owner alive, and the buffer and slot release functions that +//! keep the first error while still closing every buffer. use super::{Buffers, Cell, Error, Result, Slot, Stage, driver_error}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_lru_index/lru_index.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_lru_index/lru_index.rs index 864d8cd7..7e4f92f3 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_lru_index/lru_index.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_lru_index/lru_index.rs @@ -1,5 +1,6 @@ -//! Methods of `LruIndex`: `new`, `with_capacity`, `metadata_bytes`, `len` and 15 more. -//! Split out of `cache_lru_index` to keep its files under the line limit. +//! The bounded min-heap behind the per-matrix expert LRU: ages by descriptor slot, atomic batch update (prepare then +//! commit), removal, and the oldest-key search that skips the protected keys of the current round. It is the only +//! eviction order of the MoE cache, so the slot count and the heap/position coherence are checked here. use super::{ ABSENT, Error, HOST_LIMIT, LruIndex, MAX_KEYS, MAX_PROTECTED, MoeWeightDescriptor, Node, PER_LAYER, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_lru_index/lru_index_seeding.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_lru_index/lru_index_seeding.rs index b5df35b6..ef9d74d3 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_lru_index/lru_index_seeding.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_lru_index/lru_index_seeding.rs @@ -1,5 +1,6 @@ -//! Methods of `LruIndex`: `seed_existing`, `is_pristine`, `load_seed`, `seed_insert` and 5 more. -//! Split out of `cache_lru_index` to keep its files under the line limit. +//! Seeding of an empty `LruIndex` from entries that already exist on the device: used by constructors that fill the +//! cache before it is published. A refused seed restores the empty state, and `matches_existing` lets a test prove +//! the index equals the actual owners. use super::{ABSENT, Error, LruIndex, MAX_KEYS, MoeWeightDescriptor, Node, Result, slot}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_lru_index/slot.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_lru_index/slot.rs index 1aeb438a..28d35f04 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_lru_index/slot.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_lru_index/slot.rs @@ -1,5 +1,5 @@ -//! Functions: `slot`. -//! Split out of `cache_lru_index` to keep its files under the line limit. +//! Maps an expert or shared-weight descriptor (layer, expert, role) to its fixed slot in the LRU position table, +//! and refuses any coordinate outside the 48-layer, 512-expert domain. use super::{Error, MAX_KEYS, MoeWeightDescriptor, PER_LAYER, Result}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_lru_index/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_lru_index/tests.rs index 790c7145..b6a82219 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_lru_index/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_lru_index/tests.rs @@ -1,4 +1,6 @@ -//! Pure metadata proof. Literal descriptors convey no model, weight or device authority. +//! Pins the bounded LRU index against a scan oracle: oldest-first order with protected keys, atomic batch refusals, +//! descriptor collisions, a full index and long deterministic churn. Literal descriptors carry no model or device +//! authority, so these tests run without a GPU. use super::{LruIndex, MAX_KEYS, MoeWeightDescriptor, PER_LAYER, slot}; #[cfg(any(test))] use super::HOST_LIMIT; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_original_prompt/moe_weight_cache.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_original_prompt/moe_weight_cache.rs index 66646e50..29bfd194 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_original_prompt/moe_weight_cache.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_original_prompt/moe_weight_cache.rs @@ -1,5 +1,6 @@ -//! Methods of `MoeWeightCache`: `new_original_prompt_arena`, `retained_bank_mapping`, `arena_workspace`, `attach_are... -//! Functions: `arena_driver_error`, `shared_descriptors`, `shared_bytes`. Defines `ArenaPlan`, `ExpertBankMapping`. +//! Bring-up of the original prefill arena on `MoeWeightCache`: carves the arena from the prefill options, maps the +//! retained expert bank, builds the MMQ workspace with its expert group arena, and attaches the copy schedule and +//! prompt device. Also the prompt-routing capture, the end of a prompt expert stream and the per-expert span lookups. use super::{ Context, Error, LayerId, MmqRoutingPolicy, MmqWorkspace, ModelBinding, MoeExpertSelection, MoeExpertWeights, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_original_prompt/moe_weights_original_prompt.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_original_prompt/moe_weights_original_prompt.rs index 2986fa32..b3538863 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_original_prompt/moe_weights_original_prompt.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_original_prompt/moe_weights_original_prompt.rs @@ -1,5 +1,6 @@ -//! Methods of `MoeWeightCache`: `original_prompt_moe`, `original_prompt_parts`, `original_prompt_precheck`. -//! Functions: `raw_weight`, `shared_formats`, `shared_weights`. +//! Entry point of one original-prompt MoE layer on the cache: borrows the disjoint owners the layer drives (shared +//! weights, copy ring, span state), prechecks binding and dense cache, and loads the router and shared weights raw. +//! The layer body itself is in `prompt_layer_fns`. use super::prompt_layer_fns::{PromptIo, PromptParts, PromptWeightOwners, SpanScan, run_prompt_layer}; use super::{ diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_original_prompt/prompt_stream_settings.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_original_prompt/prompt_stream_settings.rs index 5fab9bc9..3499405a 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_original_prompt/prompt_stream_settings.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_original_prompt/prompt_stream_settings.rs @@ -1,5 +1,6 @@ -//! Functions: `prompt_stream_settings`, `native_format`, `span_cache_enabled`, `set_span_cache_override`. -//! Split out of `cache_original_prompt` to keep its files under the line limit. +//! Settings of the prompt expert stream and span cache: whether a prefill chunk copies every expert of every layer +//! through an issuer thread or uses the per-layer copy ring, and the per-arm overrides the replay harness sets. +//! Also maps a descriptor's raw kind to its native format. use super::{Error, GdnNativeFormat, MoeWeightDescriptor, PREFILL_STREAM_OVERRIDE, Result, SPAN_CACHE_OVERRIDE}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile/learned_main_sdet.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile/learned_main_sdet.rs index 7c9752e1..686e5d21 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile/learned_main_sdet.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile/learned_main_sdet.rs @@ -1,4 +1,5 @@ -//! Pure current-age bootstrap policy proof; no binding/device/weight certificate. +//! Pins the learned-main bootstrap: a seeded LRU index equals the scan over the actual ages, refused seeds restore +//! the empty owner, and `learned_main_slot_bound` equals the expanded multiset count. Pure policy, no device. use super::super::cache_lru_index::LruIndex; use super::{MoeWeightDescriptor, learned_main_slot_bound}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile/ranked_profile.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile/ranked_profile.rs index 54861722..8ed42848 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile/ranked_profile.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile/ranked_profile.rs @@ -1,5 +1,6 @@ -//! Methods of `RankedProfile`: `parse`, `check_header`, `parse_pair`, `ordered_pairs` and 1 more. -//! Methods of `PlanBudget`: `capacity`, `new`. Defines `PlanBudget`. +//! Parser of the ranked expert profile (the `STRP` file: header, SHA check, ordered layer/expert pairs and the +//! optional rank table) and the prefix planner: `PlanBudget` turns the device limits into the largest whole-triplet +//! prefix of the ranking that can stay pinned. Pure metadata; it reads no weights and touches no device. use super::{ Digest, EXPERTS, Error, HOST_CAP, LAYERS, PAIRS, PrefixPlan, ProfileLimits, RankedProfile, Result, Sha256, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile/shared_permanent_pool.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile/shared_permanent_pool.rs index 37bd6688..c7567864 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile/shared_permanent_pool.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile/shared_permanent_pool.rs @@ -1,5 +1,6 @@ -//! Methods of `SharedPermanentPool`: `new`, `contains`, `quartet`, `descriptor_count` and 7 more. -//! Functions: `remaining_shared_main`, `learned_main_slot_bound`. +//! The permanent pool of shared-expert quartets (gate, up, down, scalar) of all 48 layers, pinned for the model +//! lifetime, with per-role hit, fill and eviction counters. Also the two sizing rules that leave the rest of the main +//! tier to the learned LRU: what remains after the shared bytes and the upper bound of routed slots. No device state. use super::{Error, LAYERS, MoeWeightDescriptor, Result, RoleTraffic, SHARED_MAX_BYTES, SharedPermanentPool}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/learned_main_lru_profile.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/learned_main_lru_profile.rs index 8181c72a..e93190f0 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/learned_main_lru_profile.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/learned_main_lru_profile.rs @@ -1,5 +1,6 @@ -//! Methods of `MoeWeightCache`: `new_profile_shared_permanent_learned_main_lru`, `learned_main_totals`, `check_learn... -//! Split out of `cache_profile_fill` to keep its files under the line limit. +//! Constructor of the MoE cache whose routed main tier is a learned LRU over the shared permanent pool: the preload +//! bytes are kept, routed residency is then learned from traffic. Also the witness and totals that check the actual +//! main entries against the byte limit and the slot bound. #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] use super::profile_build::{ProfileFile, ProfileKind, ProfileRequest}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/moe_weight_cache.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/moe_weight_cache.rs index e6164ae8..cf672050 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/moe_weight_cache.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/moe_weight_cache.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `pinned_triplet_preload`, `profile_ranked_fill_and_pool`. -//! Split out of `cache_profile_fill` to keep its files under the line limit. +//! The `MoeWeightCache` constructors of the profile fill: the ranked fill with its pinned pool and the pinned triplet +//! preload. use super::{ Context, DeviceRef, EncodedWeight, Entry, Error, HOST_CAP, HashMap, MAIN_LIMIT, ModelBinding, MoeMatrixRole, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/moe_weight_cache/pinned_triplet_preload.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/moe_weight_cache/pinned_triplet_preload.rs index 76872ac1..46ddd439 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/moe_weight_cache/pinned_triplet_preload.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/moe_weight_cache/pinned_triplet_preload.rs @@ -1,5 +1,6 @@ -//! Methods of `MoeWeightCache`: `preload_pinned_triplet`, `admit_pinned_triplet`, `pinned_layouts`, `check_pinned_ro... -//! Defines `PinnedLayouts`, `PinnedSource`, `PinnedAdmission`. +//! Preload of one pinned routed expert triplet of the ranked profile: admit it against room and spill reserve, read +//! its three raw blocks from the binding, upload them (dual or mixed layout) and commit them as pinned main entries +//! with the traffic counters. Also the profile witness that reads those counters back for tests. use super::{ DeviceRef, EncodedWeight, Entry, Error, MAIN_LIMIT, ModelBinding, MoeWeightCache, MoeWeightDescriptor, Result, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/moe_weight_cache/profile_ranked_fill_and_pool.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/moe_weight_cache/profile_ranked_fill_and_pool.rs index 026acb27..ddcfac42 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/moe_weight_cache/profile_ranked_fill_and_pool.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/moe_weight_cache/profile_ranked_fill_and_pool.rs @@ -1,5 +1,6 @@ -//! Methods of `MoeWeightCache`: `new_native_integer_iq3_mmq_retained_mtp_kv_shared_tail_profile`, `new_native_intege... -//! Functions: `ranked_keys`. Defines `MapReservation`, `ProfileFill`. +//! Constructors of the MoE cache for the ranked profile with the retained MTP KV and shared tail: derive the prefix +//! plan from the first-expert descriptors of every layer, reserve the one weight map under the metadata ceiling, +//! install the pinned pool and preload the ranked prefix. An MTP input or spill floor widens the window reserve. use super::{ Context, Entry, Error, HOST_CAP, HashMap, MAIN_LIMIT, ModelBinding, MoeMatrixRole, MoeWeightCache, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/profile_window_spill.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/profile_window_spill.rs index d93b6f83..eec7ee48 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/profile_window_spill.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/profile_window_spill.rs @@ -1,5 +1,6 @@ -//! Functions: `profile_window_spill`, `profile_window_spill_with_floor`. -//! Split out of `cache_profile_fill` to keep its files under the line limit. +//! The device bytes the prefill MoE micro-window keeps live next to the pinned pool (the live prefill owners and the +//! GDN chunk charge), optionally raised by a reusable spill floor. The profile planners reserve this much beyond the +//! pinned prefix. use super::{Error, Result}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/shared_quartet_preload.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/shared_quartet_preload.rs index ce98641a..627bff67 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/shared_quartet_preload.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/shared_quartet_preload.rs @@ -1,5 +1,6 @@ -//! Methods of `MoeWeightCache`: `new_native_integer_iq3_mmq_retained_mtp_kv_shared_tail_profile_mtp_input_spill_floo... -//! Defines `QuartetRoom`. +//! Preload of the shared-expert quartets (gate, up, down, scalar) into the main tier of a profile with a shared +//! permanent pool: admission against room and spill, upload, then publication with no fallible step after the first +//! insert. Also the shared-pool witness that reconciles the traffic counters with actual residency. #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] #[cfg(test)] diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/strata_adaptive_shared_pool.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/strata_adaptive_shared_pool.rs index 0a850b46..15a6d3b3 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/strata_adaptive_shared_pool.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/strata_adaptive_shared_pool.rs @@ -1,5 +1,6 @@ -//! Methods of `MoeWeightCache`: `new_native_strata_adaptive_shared_permanent`, `new_native_strata_adaptive_shared_pe... -//! Functions: `adaptive_template`. Defines `AdaptivePlan`, `SharedKeys`. +//! Constructors of the MoE cache for the Strata adaptive policy (copy transport or mapped transport): size the shared +//! permanent pool and the adaptive plan from the descriptor template, admit the whole allocation bound before the +//! first shared upload, then adopt the adaptive owner. A failed build closes the cache. use super::profile_build::ProfileFile; use super::{ diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_strata_adaptive/adaptive_cache.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_strata_adaptive/adaptive_cache.rs index e1b01cd6..338e706a 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_strata_adaptive/adaptive_cache.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_strata_adaptive/adaptive_cache.rs @@ -1,5 +1,6 @@ -//! Methods of `AdaptiveCache`: `preload`, `unpublished`, `validate`, `revalidate_keys` and 19 more. -//! Defines `StagedPairs`, `Staged`, `UploadReserve` and 1 more. +//! The adaptive expert cache of the Strata policy: the device slots that hold whole expert triplets and the transfer +//! queue of the current round. It observes every routed row, serves hits, stages the due swaps after each verified +//! window, polls the copies and publishes a swap only after its transfer completed. use super::{ ADAPT_EVERY, ADAPT_SWAPS, AdaptiveCache, AdaptivePolicy, AdaptiveSizing, AdaptiveWitness, CachedMoeMatrix, Context, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_strata_adaptive/reserve.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_strata_adaptive/reserve.rs index 30892856..c4b37459 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_strata_adaptive/reserve.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_strata_adaptive/reserve.rs @@ -1,5 +1,6 @@ -//! Methods of `AdaptivePolicy`: `new`, `template_charges`, `initial_slots_for`, `measure_metadata` and 13 more. -//! Functions: `reserve`, `cell`, `blob_key_identity_ok`, `blob_key_shape_ok` and 2 more. Defines `InitialSlots`. +//! `AdaptivePolicy`, the pure frequency policy of the Strata adaptive cache: usage counters, the resident map and the +//! initial slots of the ranked prefix, then swap selection per verified window (candidates used twice or more +//! against the coldest residents). Holds metadata only; the adapter owns the buffers and confirms every transfer. use super::{ ADAPT_EVERY, ADAPT_SWAPS, AdaptivePolicy, CELLS, EXPERTS, Error, HOST_CAP, LAYERS, MoeWeightDescriptor, PrefixPlan, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_strata_adaptive/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_strata_adaptive/tests.rs index d16d0a25..3719e80e 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_strata_adaptive/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_strata_adaptive/tests.rs @@ -1,5 +1,5 @@ -//! Pure source-policy oracle only. No fabricated BindingIdentity, device slot, -//! event completion, CPU expert output, or model acceptance certificate. +//! Pins the adaptive policy to its Strata original: frequency threshold, same-layer slots, pending transition, +//! decay and refusals of bad observations. A pure oracle; no binding identity, device slot or completion is faked. use super::{AdaptivePolicy, EXPERTS, Error, LAYERS, MoeWeightDescriptor, ProfileLimits, RankedProfile, Swap}; use sha2::{Digest, Sha256}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_strata_adaptive/transfer_metadata_bound.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_strata_adaptive/transfer_metadata_bound.rs index bcbb6a6a..0c647e11 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_strata_adaptive/transfer_metadata_bound.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_strata_adaptive/transfer_metadata_bound.rs @@ -1,5 +1,4 @@ -//! Functions: `transfer_metadata_bound`. -//! Split out of `cache_strata_adaptive` to keep its files under the line limit. +//! The host metadata bound of one adaptive round: the swap count times the size of a transfer record. use super::{ADAPT_SWAPS, Transfer}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_cache_routed_owners.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_cache_routed_owners.rs index 275f36da..95b7d66c 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_cache_routed_owners.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_cache_routed_owners.rs @@ -1,5 +1,6 @@ -//! Methods of `MoeWeightCache`: `routed_output_owner`, `uses_mapped_expert_source`, `ephemeral_routed_owner`, `route... -//! Functions: `triplet_keys`, `adaptive_raw_triplet`. +//! The routed-expert owners of the MoE cache and the loans through them: output owner, ephemeral owner, resident +//! queue, CPU miss owner, and the Strata adaptive row observation, window completion and polling. The callbacks lend +//! whole triplet buffers read-only; no fill, poll or mutable cache access happens while a loan is held. use super::{ CachedMoeMatrix, Context, DeviceBuffer, Error, ModelBinding, MoeExpertSelection, MoeExpertWeights, MoeMatrixRole, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_weight_cache_methods.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_weight_cache_methods.rs index 85532e76..d9364c9a 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_weight_cache_methods.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_weight_cache_methods.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `moe_cache_close_owners`, `moe_cache_compose_shared_and_mtp`, `moe_cache_lru_updates` and 7... -//! Split out of `moe_weight_cache` to keep its files under the line limit. +//! The `impl MoeWeightCache` blocks by responsibility: constructors, lookup, triplet and chunk admission, LRU +//! updates, shared and MTP composition, routed source fills, validation and teardown. Shared imports live here. use super::{ BoundExpert, CachedMoeMatrix, Cell, Context, Dense, DeviceBuffer, DeviceRef, EncodedWeight, Entry, Error, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_weight_cache_methods/moe_cache_close_owners.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_weight_cache_methods/moe_cache_close_owners.rs index 2dafb974..29ab6b1b 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_weight_cache_methods/moe_cache_close_owners.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_weight_cache_methods/moe_cache_close_owners.rs @@ -1,5 +1,5 @@ -//! Methods of `MoeWeightCache`: `close_original_owners`, `close_original_owners`, `close_shared_owners`, `close_work... -//! Functions: `close_shared`. +//! Consuming teardown of the MoE cache: closes the Original owners, shared owners, workspaces and every encoded +//! weight in a fixed order, keeps the first error and counts an owner still held elsewhere as a failed close. use super::{Error, MoeWeightCache, Rc, Result}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_weight_cache_methods/moe_cache_compose_shared_and_mtp.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_weight_cache_methods/moe_cache_compose_shared_and_mtp.rs index e2733f83..0a7d53cd 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_weight_cache_methods/moe_cache_compose_shared_and_mtp.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_weight_cache_methods/moe_cache_compose_shared_and_mtp.rs @@ -1,5 +1,6 @@ -//! Methods of `MoeWeightCache`: `compose_target_shared_tail`, `compose_shared`, `compose_fixed_mtp_experts`, `admit_... -//! Split out of `moe_weight_cache_methods` to keep its files under the line limit. +//! Composition of the closed device producers over cache-owned weights: target shared tail, the fixed MTP experts, +//! the MTP KV ring (prepare and attend) and MMQ assembly. Descriptors are admitted before any fill and every weight +//! stays borrowed until the producer's completion readback has consumed the result. use super::super::super::shared_expert_workspace::{SharedTailInputs, SharedTailKeys, WorkspaceOwner}; use super::moe_cache_lru_updates::shared_keys::{raw_shared_buffers, shared_descriptors}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_weight_cache_methods/moe_cache_lru_updates.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_weight_cache_methods/moe_cache_lru_updates.rs index 2115c4ce..a0995b38 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_weight_cache_methods/moe_cache_lru_updates.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_weight_cache_methods/moe_cache_lru_updates.rs @@ -1,5 +1,6 @@ -//! Methods of `MoeWeightCache`: `prepare_lru_updates`, `spill_updates`, `pinned_updates_allowed`, `commit_lru_update... -//! Split out of `moe_weight_cache_methods` to keep its files under the line limit. +//! LRU bookkeeping of the main tier (prepare, commit, eviction key, removal) and the lending of whole shared weights: +//! the native prefill resources and `with_native_shared_weights`. Shared weights are filled without evicting one +//! another and stay protected while lent. use super::{ Context, DeviceBuffer, EncodedWeight, Entry, Error, HashMap, LruIndex, ModelBinding, MoeExpertSelection, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_weight_cache_methods/moe_cache_lru_updates/shared_keys.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_weight_cache_methods/moe_cache_lru_updates/shared_keys.rs index 4fc406e1..452f782d 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_weight_cache_methods/moe_cache_lru_updates/shared_keys.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_weight_cache_methods/moe_cache_lru_updates/shared_keys.rs @@ -1,5 +1,5 @@ -//! The four shared-expert descriptors, their fill and their raw buffers: common to the native shared-weights loan and -//! the target shared tail. +//! The four shared-expert descriptors of a layer, their fill and their raw buffers: common to the native +//! shared-weights loan and the target shared tail. use super::{ DeviceBuffer, EncodedWeight, Entry, Error, HashMap, ModelBinding, MoeExpertSelection, MoeExpertWeights, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_weight_cache_methods/moe_cache_main_entry_routed_source.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_weight_cache_methods/moe_cache_main_entry_routed_source.rs index 2e5dcda7..22bfbc74 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_weight_cache_methods/moe_cache_main_entry_routed_source.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_weight_cache_methods/moe_cache_main_entry_routed_source.rs @@ -1,5 +1,5 @@ -//! Methods of `MoeWeightCache`: `main_entry`, `main_entry_owned_gate_up`, `with_matrix_routed_source`, `source_healt... -//! Split out of `moe_weight_cache_methods` to keep its files under the line limit. +//! Main-tier lookup and fill for routed expert matrices: the entries that hit or fill the cache, the loan of a cache +//! matrix to a closed routed-source consumer, and the adaptive slot matrix, which can never fill or evict. use super::{ CachedMoeMatrix, DeviceRef, EncodedWeight, Entry, Error, MmqFormat, MmqWeights, ModelBinding, MoeMatrixRole, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_weight_cache_methods/moe_cache_matrix_and_mtp_lookup.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_weight_cache_methods/moe_cache_matrix_and_mtp_lookup.rs index 3db41975..e1beb533 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_weight_cache_methods/moe_cache_matrix_and_mtp_lookup.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_weight_cache_methods/moe_cache_matrix_and_mtp_lookup.rs @@ -1,5 +1,5 @@ -//! Methods of `MoeWeightCache`: `matrix`, `shared_scalar`, `admit_mtp_input_workspace`, `mtp_input_workspace_support... -//! Split out of `moe_weight_cache_methods` to keep its files under the line limit. +//! Read-side lookups of the MoE cache: a routed or shared matrix, the shared scalar, the MTP bank, matrix and F32 +//! rows, and the MTP input workspace admission and completion count. Lookups never fill or evict. use super::{ CachedMoeMatrix, Context, DeviceBuffer, Error, MTP_INPUT_WORKSPACE_BYTES, ModelBinding, MoeExpertSelection, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_weight_cache_methods/moe_cache_mmq_chunk_admission.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_weight_cache_methods/moe_cache_mmq_chunk_admission.rs index ec011233..22bd5258 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_weight_cache_methods/moe_cache_mmq_chunk_admission.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_weight_cache_methods/moe_cache_mmq_chunk_admission.rs @@ -1,5 +1,6 @@ -//! Methods of `MoeWeightCache`: `note_test_mmq_dispatch`, `mmq_context`, `weight_layout`, `has_original_prompt_mmq` ... -//! Functions: `admit_triplets`. +//! MMQ chunk admission and workspace access of the MoE cache: checks every triplet of a chunk against the kind +//! admission policy before quantization, cache fill or a gate/up kernel runs, and lends the MMQ workspace and the +//! three whole weights of a triplet. A refused triplet declines the whole chunk. use super::{ BoundExpert, Context, Error, MmqChunkAdmission, MmqChunkRequest, MmqFormat, MmqRoutingPolicy, MmqWeights, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_weight_cache_methods/moe_cache_mmq_constructors.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_weight_cache_methods/moe_cache_mmq_constructors.rs index de242680..038742ff 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_weight_cache_methods/moe_cache_mmq_constructors.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_weight_cache_methods/moe_cache_mmq_constructors.rs @@ -1,5 +1,5 @@ -//! Methods of `MoeWeightCache`: `new_native_integer_iq3_mmq_retained_mtp_kv_shared_tail_profile_mtp_input_spill_floo... -//! Functions: `dense_f32_words`. +//! The base constructors of the MoE cache: the empty cache of one binding and context, the pinned MTP pack upload +//! (with or without its expert bank), and the MMQ, native MMQ and integer IQ3 variants with the retained MTP KV. use super::{ Cell, Context, Dense, Error, HashMap, MTP_DENSE_LIMIT, MTP_PACK_EXPERT_BANK_BYTES, MmqRoutingPolicy, ModelBinding, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_weight_cache_methods/moe_cache_shared_tail_constructors.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_weight_cache_methods/moe_cache_shared_tail_constructors.rs index a9898858..32081b79 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_weight_cache_methods/moe_cache_shared_tail_constructors.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_weight_cache_methods/moe_cache_shared_tail_constructors.rs @@ -1,5 +1,5 @@ -//! Methods of `MoeWeightCache`: `new_native_integer_iq3_mmq_retained_mtp_kv_shared_tail`, `new_native_integer_iq3_mm... -//! Split out of `moe_weight_cache_methods` to keep its files under the line limit. +//! Constructors that add the target shared tail and the bounded LRU index to the MoE cache, plus the small +//! accessors the profile and adaptive builders use (pinned test, spill length, main reservation, request note). use super::{ Context, Error, LruIndex, ModelBinding, MoeWeightCache, MoeWeightDescriptor, Rc, RefCell, Result, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_weight_cache_methods/moe_cache_triplet_plan_upload.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_weight_cache_methods/moe_cache_triplet_plan_upload.rs index ca172969..7aaaadea 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_weight_cache_methods/moe_cache_triplet_plan_upload.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_weight_cache_methods/moe_cache_triplet_plan_upload.rs @@ -1,5 +1,6 @@ -//! Methods of `MoeWeightCache`: `with_integer_mmq_triplet`, `triplet_fill`, `triplet_owners`, `triplet_admit` and 16... -//! Functions: `read_triplet`. Defines `TripletAccounting`, `TripletPlan`. +//! Triplet access to the MMQ weights: plans a gate/up/down request, fills only what is missing under room and slot +//! admission, uploads whole triplets and publishes them after driver completion with no fallible step after the +//! first insert. A full hit allocates and uploads nothing. use super::{ BoundExpert, EncodedWeight, Entry, Error, MmqFormat, MmqWeights, ModelBinding, MoeExpertSelection, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_weight_cache_methods/moe_cache_validate_prepare_step.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_weight_cache_methods/moe_cache_validate_prepare_step.rs index 2518e367..71d4f5dd 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_weight_cache_methods/moe_cache_validate_prepare_step.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/moe_weight_cache_methods/moe_cache_validate_prepare_step.rs @@ -1,5 +1,5 @@ -//! Methods of `MoeWeightCache`: `owners_failed`, `validate_original_owners`, `validate_original_owners`, `validate` ... -//! Split out of `moe_weight_cache_methods` to keep its files under the line limit. +//! Validation and per-step preparation of the MoE cache: binding, context and owner health checks, the transient MMQ +//! reserve, the room routine that evicts for a request while protecting lent entries, and plain device upload. use super::moe_cache_main_entry_routed_source::fill_fns::Room; use super::{ diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/original_mtp_weights/dense_copies_equal.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/original_mtp_weights/dense_copies_equal.rs index 761418b1..d795fedb 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/original_mtp_weights/dense_copies_equal.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/original_mtp_weights/dense_copies_equal.rs @@ -1,5 +1,6 @@ -//! Methods of `MoeWeightCache`: `share_rt_mtp_dense`, `share_entry`, `device_copies_equal`, `adopt_rt_buffer` and 2 ... -//! Functions: `dense_copies_equal`. +//! Merges the two device copies of the MTP dense roles on the RT-directory path: when both are read back and prove +//! byte-equal, the cache adopts the RT bank allocation and frees its own, so the model holds one copy. Also builds +//! the retained original MTP weights from the cache. use super::{ Cell, Context, Dense, Error, ModelBinding, MoeWeightCache, MtpDenseShare, MtpKind, MtpRole, Rc, Result, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/original_mtp_weights/retained_original_mtp_weights.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/original_mtp_weights/retained_original_mtp_weights.rs index 60b5893e..15cd8597 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/original_mtp_weights/retained_original_mtp_weights.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/original_mtp_weights/retained_original_mtp_weights.rs @@ -1,5 +1,6 @@ -//! Methods of `RetainedOriginalMtpWeights`: `from_rt_bank`, `rt_dense`, `rt_extras`, `dense_file_bytes` and 11 more. -//! Functions: `rt_kind`. Defines `HeadBinding`. +//! The model-lifetime MTP weights taken from the loaded RT bank: dense roles, extras and the expert bank, shared +//! by reference and checked against the role contract. Serves the scalar prefill graph weights and the full MTP +//! forward role order, choosing between the native head and the gathered draft-vocabulary head. use super::{ Context, DeviceBuffer, Error, FULL_FORWARD_ROLES, ModelBinding, MtpHeadSources, MtpKind, MtpRole, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/routed_source_health.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/routed_source_health.rs index 80a421cf..5b60dbfa 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/routed_source_health.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/routed_source_health.rs @@ -1,5 +1,5 @@ -//! Methods of `RoutedSourceHealth`: `validate`. -//! Methods of `MoeWeightCache`: `note_permanent_lookup`, `note_permanent_hit`, `note_permanent_fill`, `note_permanen... +//! Health check of the routed source (failed flag, poisoned context, binding identity) and the cache hooks that count +//! lookups, hits, fills and evictions of permanent-pool entries in the active pool (pinned or adaptive shared). use super::{Context, Error, ModelBinding, MoeWeightCache, MoeWeightDescriptor, Result, RoutedSourceHealth}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/routed_workspace_owner.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/routed_workspace_owner.rs index ff50ccfb..3d476cd2 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/routed_workspace_owner.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/routed_workspace_owner.rs @@ -1,5 +1,6 @@ -//! Methods of `RoutedWorkspaceOwner`: `new`, `matches_context`, `is_failed`, `with_workspace` and 1 more. -//! Methods of `RoutedResidentOwner`: `new`, `matches_context`, `is_failed`, `with_queue` and 1 more. +//! The small device owners the routed expert path leases from the MoE cache: the routed group workspace, the resident +//! queue and the MTP input workspace. Each is created once per context, lent to one synchronous callback at a time, +//! marked failed on any execution error and released on close or drop. use super::{ BindingIdentity, Cell, Context, Error, MTP_INPUT_WORKSPACE_BYTES, MtpInputWorkspace, MtpInputWorkspaceOwner, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/validate_ranked_profile.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/validate_ranked_profile.rs index 0b123d07..3609cb77 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/validate_ranked_profile.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/validate_ranked_profile.rs @@ -1,5 +1,6 @@ -//! Methods of `EncodedWeight`: `close`. -//! Methods of `RoutedFiniteOwner`: `new`, `matches_context`, `is_failed`, `check_stage` and 1 more. +//! Admission rules of the MoE cache: bounded validation of a ranked profile before the driver loads, the room +//! predicate, which descriptors get the padded dual MMQ layout (and the Original prompt formats), triplet shape +//! checks, and `RoutedFiniteOwner`, the guard that proves a routed stage output is finite. use super::{ Cell, Context, DeviceBuffer, EncodedWeight, Error, MAIN_LIMIT, MmqFormat, MoeWeightDescriptor, RefCell, Result, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp/mtp_frame.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp/mtp_frame.rs index 2e987f06..82321638 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp/mtp_frame.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp/mtp_frame.rs @@ -1,5 +1,7 @@ -//! Methods of `MtpFrame`: `within_bounds`, `validate`, `token`, `position` and 1 more. -//! Methods of `MtpInput`: `from_previous`, `frame`, `streams`, `from_target` and 5 more. +//! The frame of one draft token and the input of a draft step: `MtpFrame` (which target position, token and depth a +//! draft branch stands on) and `MtpInput`, the pre-FC norms and the two Q8_0 matrices that turn the source residual +//! and the next-token embedding into the draft step input. Frames are valid only for the current target session and +//! epoch, so a reset or rewind invalidates every older one. No CPU forward arithmetic happens here. use super::{ Context, DeviceBuffer, Dimension, Error, KnownNext, ModelBinding, MoeWeightCache, MtpFrame, MtpInput, MtpKind, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp/project_attention_out_numeric.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp/project_attention_out_numeric.rs index 6c915119..53e5b7c6 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp/project_attention_out_numeric.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp/project_attention_out_numeric.rs @@ -1,5 +1,6 @@ -//! Functions: `project_gated`, `project_attention_out_numeric`. -//! Split out of `mtp` to keep its files under the line limit. +//! Output projection of the draft attention: the 6144 gated attention values to 2560 through the Q8_0 matrix. +//! It reads the retained gated device buffer directly, reserving the same output and quantizer room as the original +//! upload-based path. use super::{ Context, DenseFormat, DeviceBuffer, Error, ProjectionKind, ProjectionSpec, Result, allocate, download, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/chunk/checked_chunk_end.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/chunk/checked_chunk_end.rs index 6358a365..5c5a9210 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/chunk/checked_chunk_end.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/chunk/checked_chunk_end.rs @@ -1,5 +1,7 @@ -//! Methods of `ValidatedWarmEnd`: `from_txn`. -//! Methods of `MtpSession`: `stage_chunk`, `stage_chunk_bound`, `stage_chunk_with_end`, `admit_chunk_start` and 2 more. +//! Staging of a draft chunk branch over an actual bounded target chunk: `MtpSession::stage_chunk` forks a private +//! candidate, and `MtpChunkStage` validates its anchor and lineage and publishes it once. The live draft stays +//! borrowed until the joint target and draft publication, so a failed chunk leaves it unchanged; also checks the +//! chunk end position against its limit. use super::{ Error, ModelBinding, MtpChunkStage, MtpSession, Position, QwenChunkTxn, QwenSession, Rc, Result, TargetStepOrigin, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/chunk/mtp_session.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/chunk/mtp_session.rs index 238c23cf..09ccd802 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/chunk/mtp_session.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/chunk/mtp_session.rs @@ -1,5 +1,5 @@ -//! Methods of `MtpSession`: `test_chunk_snapshot`, `test_chunk_eq`. -//! Split out of `chunk` to keep its files under the line limit. +//! Test-only numeric snapshot of a chunk-candidate draft session and its comparison, used to prove that a refused or +//! cancelled chunk left the draft bit-identical. #[cfg(all(test, target_arch = "x86_64"))] use super::MtpChunkNumericSnapshot; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/dense_kv.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/dense_kv.rs index cb8ca8f2..d00ef22e 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/dense_kv.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/dense_kv.rs @@ -1,5 +1,6 @@ -//! Methods of `DenseKv`: `empty`, `append`, `ring_validate`, `ring_same` and 6 more. Functions: `validate_half`. -//! Split out of `state` to keep its files under the line limit. +//! Immutable dense draft K/V (`DenseKv`): append one cell for a frame, validate and compare the ring mirror, and read +//! the half-precision window of a frame. Cells are shared and never mutated; an append returns a new value, and every +//! cell is checked finite before it is admitted. use super::{ BindingIdentity, Cell, CellPair, DenseKv, Error, HALF_ROW, HalfWindow, MtpFrame, Rc, Result, WINDOW, Weak, reserve, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/mtp_session.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/mtp_session.rs index 7a891d2f..e7590f70 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/mtp_session.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/mtp_session.rs @@ -1,5 +1,6 @@ -//! Methods of `MtpSession`: `new`, `frame`, `prior`, `validate_frame` and 17 more. Functions: `seed_frame_foreign`. -//! Split out of `state` to keep its files under the line limit. +//! The draft session `MtpSession`: committed draft K/V, residual and position, and the frames and checkpoints derived +//! from them. Commit publishes only a fully produced pending K/V and residual; restore accepts only checkpoints of +//! this live lineage, including the closed first-seed restore that replaces a repeated warm. use super::{ Cell, DenseKv, Dimension, Error, ModelBinding, MtpCheckpoint, MtpFrame, MtpSession, Position, Rc, Result, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/prefix_draft_snapshot.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/prefix_draft_snapshot.rs index 2ebf9e07..74f6aae7 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/prefix_draft_snapshot.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/prefix_draft_snapshot.rs @@ -1,5 +1,6 @@ -//! Methods of `PrefixDraftSnapshot`: `has_prefix`, `numeric_eq`, `retained_bytes`. -//! Methods of `MtpSession`: `test_prefix_snapshot`, `admit_snapshot_owner`, `admit_snapshot_frame`. +//! Test-only snapshot of the draft state after a target prefix, with its numeric comparison and retained size, and +//! the admission checks of its owner and frame. Also keeps the live-checkpoint count honest: dropping an +//! `MtpCheckpoint` releases its slot against the cap. use super::{CellPair, Error, HALF_ROW, MtpCheckpoint, MtpFrame, Rc, Result}; #[cfg(all(test, target_arch = "x86_64"))] diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/tests.rs index 510c1d5e..a8ad2fe1 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/tests.rs @@ -1,4 +1,6 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Pins the draft state rules: first-seed restore keeps the real snapshot and rolls back to the original, a coupled +//! refusal never re-mints or mutates, ring operations need the exact parent epoch and branch, and a new pending +//! token, epoch or residual is refused atomically. Metadata and lineage only, not a CUDA or numerical proof. use super::{ BindingIdentity, Cell, CellPair, DenseKv, Dimension, Error, HALF_ROW, MtpCheckpoint, MtpFrame, MtpSession, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp/step.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp/step.rs index e71200c7..bfa66aa2 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp/step.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp/step.rs @@ -1,5 +1,7 @@ -//! Methods of `MtpFinalMixed`: `from_native_mixer`, `frame`, `values`. -//! Functions: `step`, `warm_step`, `warm_chunk_row`, `run_blocks` and 12 more. Defines `MtpBlocks`. +//! One MTP draft step: attention read, draft attention, MLP read, experts, final mix, optional greedy head, then +//! commit of the draft state; also the norm and projection helpers the draft stages share. The known-next warm path +//! and the chunk-row path run it without a head; a chunk row commits only a private draft. Block products live until +//! the step is committed and synchronized; a teardown ambiguity stays sticky. use super::{ Bf16ProjectionShape, Cell, Context, DenseFormat, DeviceBuffer, Error, ModelBinding, MoeWeightCache, MtpChunkStage, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_attention/attention_stage.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_attention/attention_stage.rs index 8e7ede5c..7312adca 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_attention/attention_stage.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_attention/attention_stage.rs @@ -1,5 +1,7 @@ -//! Methods of `MtpAttentionReady`: `frame`, `output`, `streams`, `inject` and 2 more. -//! Methods of `MtpAttentionStage`: `run`. Implements `Drop for RetainedAttended`, `Drop for RetainedGated`. +//! The MTP draft attention stage: runs one dense draft attention row over the read of the source row and returns +//! `MtpAttentionReady`, which carries a pending K/V cell and never commits a draft position. Admits every pinned +//! descriptor before CUDA work, produces the K/V cell and Q and gate of the row, and owns the retained attended and +//! gated buffers until they are closed. use super::{ Cell, Context, DenseGeometry, DenseKv, DeviceBuffer, Error, KV, KvWindow, ModelBinding, MoeWeightCache, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_attention/attention_transport.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_attention/attention_transport.rs index f062d5d3..ff0c392f 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_attention/attention_transport.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_attention/attention_transport.rs @@ -1,5 +1,6 @@ -//! Methods of `AttendBuffers`: `upload_window`, `attend`, `attend_ring`. Methods of `GateBuffers`: `apply`. -//! Functions: `release_transport`, `close_transport`, `note_transport`, `upload_transport` and 7 more. +//! Device transport of the draft attention: window upload, attend (with or without the actor's K/V ring), gate and +//! the release of every step-local buffer. Each buffer is released explicitly whatever failed; a failed launch or +//! release withholds the readback and flags the step transport as failed. use super::{ Cell, Context, DenseGeometry, DeviceBuffer, Error, KvWindow, Q, Rc, Result, RetainedAttended, RetainedGated, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_attention/dense_geometry.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_attention/dense_geometry.rs index 1923060f..09552f82 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_attention/dense_geometry.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_attention/dense_geometry.rs @@ -1,5 +1,6 @@ -//! Functions: `geometry`, `validate_window`, `norm_rope_launch`, `norm_rope` and 6 more. -//! Split out of `mtp_attention` to keep its files under the line limit. +//! Geometry and launches of the dense draft attention: causal window shape for a position, the budget of its scratch, +//! norm and rope, K/V packing, query and gate split, the attend launch and the gate application. Windows are half- +//! precision cells checked against the geometry before any launch. use super::{ Context, DenseGeometry, DeviceBuffer, Error, HALF_CELL, KV, NormGamma, PackedKv, Q, QGate, Result, WINDOW, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_attention/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_attention/tests.rs index 282b5669..8e0eb2e1 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_attention/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_attention/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Pins the draft attention shape rules: the causal geometry and its budget boundaries, and the window shape, half +//! domains and preservation of caller buffers. use super::{Error, geometry, validate_window}; #[test] diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu/check_loaded.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu/check_loaded.rs index 745ca460..ea9edd93 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu/check_loaded.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu/check_loaded.rs @@ -1,5 +1,5 @@ -//! Defines `Shared`, `Refs`, `Chain` and 2 more. -//! Split out of `batch_gpu` to keep its files under the line limit. +//! State types of the loaded batched-MTP proof: the loan of the loaded stages, the reference tokens and snapshots, +//! the scalar chain and prefix, and the flow every phase runs on (GPU tests only). use super::{ Collection, DenseWeightCache, Dimension, Error, Expected, KarPleCache, ModelBinding, MoeWeightCache, MtpDecoder, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu/check_loaded/flow.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu/check_loaded/flow.rs index 91589bdb..7c605da8 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu/check_loaded/flow.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu/check_loaded/flow.rs @@ -1,5 +1,6 @@ -//! Methods of `Flow`: `step`, `warm`, `observe`, `matches_state` and 8 more. Defines `CancelledWindow`. -//! Split out of `check_loaded` to keep its files under the line limit. +//! Phases of the loaded batched-MTP proof: the scalar references, the candidate seed, refused windows and the +//! cancelled T3 publication. Each phase compares the batched window with the scalar reference on the same loaded +//! model and requires a cancelled window to leave the session state unchanged (GPU tests only). use super::{ Chain, Collection, Error, Expected, Flow, MoeWeightCache, MtpDecoder, MtpWindowError, MtpWindowSpec, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu/check_loaded/flow_decode_edge_scenarios.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu/check_loaded/flow_decode_edge_scenarios.rs index afa75bc8..375c452b 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu/check_loaded/flow_decode_edge_scenarios.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu/check_loaded/flow_decode_edge_scenarios.rs @@ -1,5 +1,6 @@ -//! Methods of `Flow`: `eos_prefix`, `max_one`, `idle_window`, `no_advance`. Functions: `check_loaded`. -//! Split out of `check_loaded` to keep its files under the line limit. +//! Edge scenarios of the loaded batched-MTP proof and its entry point: an accepted prefix ending in EOS, a window +//! limited to one token (which exercises rewind and head-free catch-up), and windows with nothing to advance. A +//! window with zero remaining or an authoritative EOS must do no draft work and publish nothing (GPU tests only). use super::{ Chain, Collection, Expected, Flow, MoeWeightCache, MtpDecoder, MtpWindowSpec, QwenForward, Rc, Refs, Report, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu/check_loaded/position_at.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu/check_loaded/position_at.rs index 240090a4..199031fd 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu/check_loaded/position_at.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu/check_loaded/position_at.rs @@ -1,5 +1,5 @@ -//! Methods of `Shared`: `step`, `window`. Methods of `Flow`: `open`. Functions: `position_at`, `admit_binding`. -//! Split out of `check_loaded` to keep its files under the line limit. +//! Shared loan of the loaded stages for the batched-MTP proof: scalar steps, window preparation and opening a flow. +//! Also the position helper and the host cap check for the snapshots and draft copies (GPU tests only). use super::{ Dimension, Flow, ModelBinding, MoeWeightCache, MtpDecoder, MtpVerifiedWindow, MtpWindowError, MtpWindowSpec, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu/collection.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu/collection.rs index a7e11f07..fee32aa3 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu/collection.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu/collection.rs @@ -1,5 +1,6 @@ -//! Methods of `Collection`: `begin`, `finish`. Methods of `PostcommitCancellation`: `arm`, `cancelled`. -//! Implements `Drop for Collection`, `Drop for PostcommitCancellation`. +//! Row observation of the batched-MTP proof: a collector that records the head words, residual and state of up to +//! three rows while a window runs, and a post-commit cancellation trigger. Both are armed for one scope and cleared +//! on drop. Heads and state stay private; the report holds counts and predicates only (GPU tests only). use super::{ COLLECTOR, Collection, Collector, Dimension, Error, Expected, ModelBinding, OutputStage, POSTCOMMIT_CANCEL, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/first_seed_reuse_enabled.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/first_seed_reuse_enabled.rs index 723120dc..16afe095 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/first_seed_reuse_enabled.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/first_seed_reuse_enabled.rs @@ -1,5 +1,7 @@ -//! Functions: `first_seed_reuse_enabled`, `needed_draft_predictions`, `window_limit`, `window_stage_error`. -//! Split out of `mtp_decode` to keep its files under the line limit. +//! Policy and bounds of an MTP decoder window: whether the first draft seed may be reused, how many draft predictions +//! a window needs, its position limit, and how a cancelled stage maps to a window error. Reuse is on only with the +//! adaptive expert policy and no numerical observer active. The seed already fills slot zero, so the bounds change +//! speculative work only; verification and accepted-prefix limits are unchanged. use super::{Error, MoeWeightCache, MtpWindowError, Result}; #[cfg(all(test, target_arch = "x86_64"))] diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/mtp_window_spec.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/mtp_window_spec.rs index 678df959..5a7aa4a3 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/mtp_window_spec.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/mtp_window_spec.rs @@ -1,5 +1,6 @@ -//! Methods of `MtpWindowSpec`: `new`. Methods of `MtpVerifiedWindow`: `tokens`, `draft_steps`, `into_parts`. -//! Implements `From for MtpWindowError`. Functions: `kv_prefill_host_charge`. +//! Request and result types of one verified MTP window: depth, remaining tokens and EOS of the spec, the window +//! error, and the verified tokens with the draft step count. Also holds the conservative host charge of the draft K/V +//! prefill of a prompt. use super::{Dimension, Error, MtpVerifiedWindow, MtpWindowError, MtpWindowSpec, Result, TargetStepProduct, TokenId}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/append_row.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/append_row.rs index 147bdac3..212fbe33 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/append_row.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/append_row.rs @@ -1,5 +1,5 @@ -//! Functions: `append_row`. -//! Split out of `mtp_experts` to keep its files under the line limit. +//! Splits one Q2_0 expert row into the separate scale and code planes of an `S2Tile`, byte for byte. +//! Each 18-byte block is a half-precision scale plus 16 code bytes; a non-finite scale is refused. use super::{Error, Result, S2Tile}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace/fixed_buffers.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace/fixed_buffers.rs index 6d833944..8fdecc7c 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace/fixed_buffers.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace/fixed_buffers.rs @@ -1,5 +1,6 @@ -//! Methods of `FixedBuffers`: `new`, `check`, `take`, `put` and 1 more. -//! Methods of `MtpExpertWorkspace`: `new`, `compose`, `close`. Implements `Drop for FixedBuffers`. +//! Pre-allocated device buffers of the fixed-ABI draft MoE workspace (`FixedBuffers`) and its public owner +//! `MtpExpertWorkspace`. Buffers are taken for an invocation and put back after it; a failed context or a missing +//! buffer is refused, and every buffer is released on close or drop. use super::{ ALLOCATED_BYTES, BindingIdentity, CHARGES, Cell, Context, DEVICE_PEAK, DeviceBuffer, Error, ExpertInputs, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace/fixed_workspace_gpu.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace/fixed_workspace_gpu.rs index 08e23edf..378fdfa5 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace/fixed_workspace_gpu.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace/fixed_workspace_gpu.rs @@ -1,4 +1,6 @@ -//! GPU proof of the fixed-ABI draft MoE workspace (moved out of mtp_expert_workspace.rs; test builds only). +//! GPU proof of the fixed-ABI draft MoE workspace (test builds only): repeated invocations over the leased buffers +//! match the reference bit for bit, and an abort, a late non-finite value, bad input or a failed flag is refused +//! cleanly. use super::super::mtp_expert_transport::{ExpertWeights, FixedReference, SelectedRoute, fixed_reference}; use super::{ diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace/role.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace/role.rs index d2b727b2..44c02fc0 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace/role.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace/role.rs @@ -1,5 +1,7 @@ -//! Methods of `Role`: `slot`, `output_slot`, `count`. -//! Methods of `Transport`: `new`, `note`, `allocate`, `buffer` and 11 more. +//! The roles of the fixed draft MoE workspace (which routed or shared stage a buffer serves, its slot and element +//! count) and the per-invocation `Transport` that leases buffers from it: upload, produce, finite readback, release. +//! Also runs the original FP32-scale quantizers, whose completed scales are inspected before any grouped dot uses +//! them. use super::{ Cell, DEVICE_PEAK, DeviceBuffer, Error, FF, Finite, FixedBuffers, N, Rc, Result, Role, Slot, Transport, at, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace/transport_drop.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace/transport_drop.rs index aca3f382..2c100937 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace/transport_drop.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace/transport_drop.rs @@ -1,5 +1,6 @@ -//! Methods of `Packed`: `new`, `pack`, `observe_packed`, `combine`. Methods of `Slot`: `bytes`. -//! Implements `Drop for Transport`. Functions: `at`, `routed_hidden`, `routed_down`, `routed` and 8 more. +//! Expert math of the fixed workspace transport: routed hidden and Down per expert, the shared expert (gate, up, +//! scaled by its scalar), the packed routed Downs and the final combine in router slot order. Also releases every +//! leased buffer when a transport drops; the first failure stops before any later expert runs. use super::{ CHARGES, Cell, DenseFormat, DeviceBuffer, Error, ExpertInputs, FF, Finite, FixedBuffers, K, N, Packed, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/mtp_block.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/mtp_block.rs index ed66185b..84481737 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/mtp_block.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/mtp_block.rs @@ -1,5 +1,7 @@ -//! Methods of `MtpBlock`: `frame`, `output`. Methods of `MtpExpertStage`: `run`, `run_checked`. -//! Functions: `admit_input`, `route_mixed`, `compose_bound`, `moe_driver_error` and 1 more. +//! Entry of the draft MoE block: `MtpExpertStage::run` routes the mixed row and composes the routed and shared +//! experts into a pending `MtpBlock`. All fixed dense roles are admitted before the first model row or CUDA call. The +//! composed device products live only in the current frame-bound invocation, so none escapes to a later draft +//! position or rollback epoch. use super::mtp_expert_transport::SelectedRoute; use super::{ diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/mtp_expert_transport/mtp_expert_transport_gpu/exact.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/mtp_expert_transport/mtp_expert_transport_gpu/exact.rs index 020194da..e08d9cd4 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/mtp_expert_transport/mtp_expert_transport_gpu/exact.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/mtp_expert_transport/mtp_expert_transport_gpu/exact.rs @@ -1,5 +1,6 @@ -//! Methods of `Env`: `compare_observed`. Functions: `exact`, `bytes`, `fill_blob_part`, `bank_fixture` and 12 more. -//! Defines `SharedStage`. +//! Original reference chain and fixtures of the MTP expert transport proof (GPU tests only). +//! Builds a synthetic expert bank, runs each routed expert and the shared expert through the original stages with +//! every stage read back, and checks the retained transport matches that baseline bit for bit. use super::{ BANK_BYTES, BLOB_BYTES, Cell, Context, DenseFormat, DeviceBuffer, Env, Error, ExpertWeights, FF, IDS, N, Original, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/mtp_expert_transport/mtp_expert_transport_gpu/owner_guards.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/mtp_expert_transport/mtp_expert_transport_gpu/owner_guards.rs index 781050cf..7e3c7800 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/mtp_expert_transport/mtp_expert_transport_gpu/owner_guards.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/mtp_expert_transport/mtp_expert_transport_gpu/owner_guards.rs @@ -1,5 +1,6 @@ -//! Methods of `Env`: `private_owner_guards`. Functions: `gate_guards`, `slot_guards`. Defines `Count`. -//! Split out of `mtp_expert_transport_gpu` to keep its files under the line limit. +//! Owner guards of the MTP expert transport proof (GPU tests only): a released or foreign-invocation product is never +//! accepted by another transport, a Down of the wrong slot cannot be packed, and the packed destination cannot +//! combine early. use super::{ Cell, Context, DeviceBuffer, Env, Error, IDS, Packed, ROUTE, Role, RoutedExpert, Transport, refusal, routed, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/mtp_expert_transport/role.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/mtp_expert_transport/role.rs index 34d3c647..a9049856 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/mtp_expert_transport/role.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/mtp_expert_transport/role.rs @@ -1,5 +1,7 @@ -//! Methods of `Role`: `count`. Methods of `Transport`: `new`, `note`, `allocate`, `buffer` and 9 more. -//! Implements `Drop for Transport`. +//! The per-invocation `Transport` of the MTP expert stage: allocates, uploads, produces and reads back device buffers +//! for one invocation, plus the routed expert Down and hidden steps. A product is accepted only with its exact role +//! and current invocation owner; every buffer is released on close or drop, and the original quantizers run with +//! their scales inspected before any dot. use super::{ Cell, Context, DEVICE_PEAK, DeviceBuffer, Error, FF, Finite, K, N, Rc, Result, Role, Transport, download, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/mtp_expert_transport/shared_project.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/mtp_expert_transport/shared_project.rs index fe6cff1e..b6041e1a 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/mtp_expert_transport/shared_project.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/mtp_expert_transport/shared_project.rs @@ -1,5 +1,6 @@ -//! Methods of `Packed`: `new`, `pack`, `observe_packed`, `combine`. -//! Functions: `shared_project`, `shared_hidden`, `shared_down`, `shared_scaled` and 6 more. +//! Shared expert, packing and combine of the MTP expert transport: shared gate, up, hidden, down and scalar scaling, +//! the routed Downs packed in slot order, and the weighted combine. Entry points `compose` and `compose_observed` run +//! a whole block; the first failure stops before any later expert runs. use super::{ Cell, Context, DenseFormat, DeviceBuffer, Error, FF, Finite, K, N, Packed, ProjectionKind, ProjectionSpec, Rc, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/routed_and_shared_experts.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/routed_and_shared_experts.rs index f74804f5..24705c45 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/routed_and_shared_experts.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/routed_and_shared_experts.rs @@ -1,5 +1,6 @@ -//! Functions: `route`, `route_on_device`, `compose`, `routed_parts` and 9 more. Defines `MtpRoutingScope`. -//! Split out of `mtp_experts` to keep its files under the line limit. +//! Expert math of the MTP block on uploaded activations: route on the device, routed Gate/Up/hidden/Down parts, +//! shared expert, and the original ordered combine in router slot order. Also repacks Q2_0 expert rows into the +//! separate scale and code planes of `S2Tile`. use super::{ Context, DeviceBuffer, Error, FF, K, ModelBinding, MoeWeightCache, MtpRole, N, Result, S2Tile, allocate, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/tests.rs index efae8aa1..7936f0e5 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/tests.rs @@ -1,4 +1,6 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Pins the MTP expert adapter: gate/up and down tiles keep every byte label (signed-zero and subnormal scales +//! included), a bad shape or non-finite scale is refused, and a route with duplicate, out-of-range or bad weights is +//! refused. use super::{Error, K, down_tile, gate_up_tile, validate_route}; fn fixture(rows: usize, blocks: usize, salt: u8) -> Vec { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_gr/driver_error.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_gr/driver_error.rs index fa00280e..4d16cc36 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_gr/driver_error.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_gr/driver_error.rs @@ -1,5 +1,7 @@ -//! Methods of `MtpAttentionRead`: `frame`, `streams`, `mixed`, `inject`. -//! Methods of `MtpMlpReady`: `frame`, `streams`, `mixed`, `inject`. +//! The fused GR reads of the MTP draft step: `MtpAttentionRead` and `MtpMlpReady` (residual streams, mixed row and +//! injection) and the fused launches that produce them. Products are bound to their draft frame and never commit +//! target or draft state; the four dense matrices are admitted before the launch, and each completed component is +//! validated before the next entry consumes it. use super::{ Candidate, Context, Error, FUSED_PEAK, H, ModelBinding, MoeWeightCache, MtpAttentionRead, MtpAttentionReady, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_gr/finalize.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_gr/finalize.rs index cc458628..006fe3d3 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_gr/finalize.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_gr/finalize.rs @@ -1,5 +1,7 @@ -//! Functions: `admit_final_inputs`, `finalize`, `finalize_checked`, `final_matrix` and 7 more. -//! Defines `FinalStageInputs`. +//! Final chain of the MTP draft step: the MTP block output and MLP streams are normalized, gated and injected into +//! the draft's final mixed row (`MtpDraftFinal`). Frame, finiteness and dense-shape admission precede any launch. The +//! legacy host-transfer chain stays as the numerical baseline that the retained chain is proved against, never as a +//! fallback. use super::{ Cell, Context, Error, FINAL_PEAK, H, ModelBinding, MoeWeightCache, MtpBlock, MtpDraftFinal, MtpFinalMixed, MtpKind, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_mtp_full_owner/mtp_full_owner_actor_close.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_mtp_full_owner/mtp_full_owner_actor_close.rs index 0532d79a..a166474c 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_mtp_full_owner/mtp_full_owner_actor_close.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_mtp_full_owner/mtp_full_owner_actor_close.rs @@ -1,5 +1,6 @@ -//! Methods of `OriginalMtpFullOwner`: `validate`, `actor_mut`, `actor`, `close` and 1 more. -//! Implements `Drop for OriginalMtpFullOwner`. Functions: `driver_error`. +//! Access and teardown of `OriginalMtpFullOwner`: the validated, exclusive loan of its MTP actor, a read-only actor +//! view, and close. The actor drains its stream and closes the drafter before the retained weights it holds are +//! released, in the source order. No mutable ring reference escapes the owner, and drop closes best-effort. use super::{Context, Error, ModelBinding, OriginalMtpActor, OriginalMtpFullOwner, Result, Stage}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_mtp_full_owner/original_mtp_full_owner_methods.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_mtp_full_owner/original_mtp_full_owner_methods.rs index 9d85da25..245a2544 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_mtp_full_owner/original_mtp_full_owner_methods.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_mtp_full_owner/original_mtp_full_owner_methods.rs @@ -1,5 +1,7 @@ -//! Methods of `OriginalMtpFullOwner`: `bind_reserve`, `assemble_rt`, `assemble`, `assemble_core` and 5 more. -//! Split out of `original_mtp_full_owner` to keep its files under the line limit. +//! Assembly of the full MTP draft owner: the startup byte reserve, and the load from an RT directory or from the +//! pinned pack held by the MoE cache. Follows the source order: load meter and native head, checked plan, optional +//! draft head, shared drafter, then the actor that adopts drafter, ring and weights; a failed step closes everything +//! built so far. use super::{ AdoptParts, Context, DraftAttachmentTables, DraftAttachmentTarget, Error, ModelBinding, MoeWeightCache, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_mtp_full_owner/original_mtp_request.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_mtp_full_owner/original_mtp_request.rs index 98a2a695..c0dce4cd 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_mtp_full_owner/original_mtp_request.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_mtp_full_owner/original_mtp_request.rs @@ -1,5 +1,6 @@ -//! Methods of `OriginalMtpRequest`: `ring_int8`. -//! Implements `From for OriginalMtpLoadError`, `From for OriginalMtpLoadError`. Functions: `plan_error`, `capture_of`. +//! The load request of the Original MTP drafter (`OriginalMtpRequest`, with the Original defaults of window 32768 and +//! the INT8 window-ring draft state) and the mapping of plan, driver and engine failures onto `OriginalMtpLoadError`. +//! Also builds the load capture (device, expert count, cells of the primary QSA state) the plan is checked against. use super::{ Context, Error, ModelBinding, OriginalMtpCapture, OriginalMtpKvStartup, OriginalMtpLoadError, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_mtp_verified_adapter/driver_error.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_mtp_verified_adapter/driver_error.rs index df7e03da..2c9fafe8 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_mtp_verified_adapter/driver_error.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_mtp_verified_adapter/driver_error.rs @@ -1,5 +1,6 @@ -//! Functions: `driver_error`. -//! Split out of `original_mtp_verified_adapter` to keep its files under the line limit. +//! Maps a CUDA driver error onto the engine error of the verified MTP adapter: a context mismatch is an identity +//! mismatch, size and shape errors are dimension errors, budget errors are allocation errors, anything else is a CUDA +//! execution failure. use super::Error; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_mtp_verified_adapter/original_mtp_draft_receipt.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_mtp_verified_adapter/original_mtp_draft_receipt.rs index f4ab3d3c..5c64e9a6 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_mtp_verified_adapter/original_mtp_draft_receipt.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_mtp_verified_adapter/original_mtp_draft_receipt.rs @@ -1,5 +1,7 @@ -//! Methods of `OriginalMtpDraftReceipt`: `ids`, `probabilities`, `count`, `first_position` and 2 more. -//! Methods of `OriginalVerifiedMtpReceipt`: `new`, `commit_origin_foreign`, `after_target_commit`. +//! Receipts that carry a verifier window into an MTP draft: the draft receipt (ids, probabilities, first position and +//! accepted row), the verified-window receipt before the target commit, and the published-window variant. A draft is +//! valid only while the real target prefix still equals the commit that produced it; skipped, extra or cross-branch +//! publication is refused before MTP capture. use super::{ Context, Error, ModelBinding, NativeHeadSelection, OriginalCommittedMtpReceipt, OriginalDraftSession, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_mtp_verified_adapter/original_prompt_executor.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_mtp_verified_adapter/original_prompt_executor.rs index 0d766959..b13408e2 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_mtp_verified_adapter/original_prompt_executor.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_mtp_verified_adapter/original_prompt_executor.rs @@ -1,5 +1,7 @@ -//! Methods of `OriginalPromptExecutor`: `launch_committing_mtp`, `admit_launch`, `launch_origin`, `finish_committing... -//! Split out of `original_mtp_verified_adapter` to keep its files under the line limit. +//! The MTP drafting calls of `OriginalPromptExecutor` on a committed verifier window: launch the draft behind the +//! commit and finish it after the commit is published, the full draft, the first draft after the prompt, and the +//! draft sampling and history setters. Follows the source order verifier completion, target commit, draft; this +//! neither commits target state nor accepts tokens, and a draft is sealed into the receipt of the committed origin. use super::{ AcceptedWindow, CompletedOriginalMtpDraft, DraftLaunch, DraftTarget, Error, ModelBinding, MtpDraftOwners, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_config/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_config/tests.rs index e2ecd974..e5a50f94 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_config/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_config/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Pins the Mode17 values derived for the Original serve path: pack expert bank and footprint switches, blob sizes, +//! rope theta scale, MTP policies, sampler path flags, request parameter mapping and the geometry and prefill carve. use super::{ Error, ExpertBlobSizes, OriginalMtpGrVariant, RopeConstants, SamplerPath, driver_sampler_params, greedy_params, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/draft_completion.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/draft_completion.rs index e4d1fb4b..dece4ef9 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/draft_completion.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/draft_completion.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `original_serve_engine_original_spec_engine`, `serve_engine_draft_commit`. -//! Split out of `original_serve_engine` to keep its files under the line limit. +//! The draft half of OriginalServeEngine: the commit-before-draft protocol (`serve_engine_draft_commit`) and the +//! OriginalSpecEngine face the speculative controller drives (`spec_engine_for_serve_engine`). use super::{ CommittedWindow, DraftCompletion, DraftLimits, DraftPick, DraftStage, Error, FirstStage, MAX_T, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/draft_completion/serve_engine_draft_commit.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/draft_completion/serve_engine_draft_commit.rs index 3889d20e..5f2ca3ee 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/draft_completion/serve_engine_draft_commit.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/draft_completion/serve_engine_draft_commit.rs @@ -1,5 +1,6 @@ -//! Methods of `DraftCompletion`: `validate`. Methods of `ServedWindow`: `rows`, `committed_rows`. -//! Implements `OriginalDraftEngine for OriginalServeEngine`. +//! OriginalServeEngine: constructor, window admission and checks, and the one-shot MTP draft (replay, seed, chain) +//! cached for the controller's callbacks, with commit enqueued before any draft reads the branch. +//! The engine only keeps the protocol discipline; every number comes from the `OriginalServePort` owners behind it. use super::{ CommittedWindow, DraftCompletion, DraftLimits, DraftPick, DraftStage, Error, FirstStage, MAX_T, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/round_tally.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/round_tally.rs index 5e5b0d8a..2e576a2b 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/round_tally.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/round_tally.rs @@ -1,5 +1,5 @@ -//! Defines `RoundTally`. -//! Split out of `original_serve_engine` to keep its files under the line limit. +//! RoundTally, the produced-token and round counters of one served request and why it stopped, with the submodules +//! that run the request: settings, the round loop and the first-draft stage. use super::{ ADAPTIVE_DEFAULT, AdaptiveConfig, CommittedWindow, DraftCompletion, DraftLimits, DraftPick, DraftStage, EnvSource, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/round_tally/original_serve_settings.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/round_tally/original_serve_settings.rs index 3750c636..a9325d3c 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/round_tally/original_serve_settings.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/round_tally/original_serve_settings.rs @@ -1,5 +1,6 @@ -//! Methods of `OriginalServeSettings`: `mode17`, `from_environment`, `adaptive_wanted`, `arms_from_environment` and ... -//! Methods of `SpeculativeRequest`: `from_request`. Functions: `serve_request`. +//! OriginalServeSettings: the speculative window policy of a served request (mode17 defaults, `LELEKA_SPEC_*` and +//! `LELEKA_SPEC_ARMS` overrides, adaptive or fixed window, window cap), and `serve_request`, the per-request loop. +//! The loop runs begin, verify/commit, emit, finish round until the request stops; `emit` runs only after the commit. use super::{ ADAPTIVE_DEFAULT, AdaptiveConfig, EnvSource, MAX_T, NanGuard, OriginalServeSettings, OriginalSpecController, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/round_tally/serve_rounds.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/round_tally/serve_rounds.rs index 532074f8..78498f83 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/round_tally/serve_rounds.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/round_tally/serve_rounds.rs @@ -1,5 +1,6 @@ -//! Implements `OriginalServePort for TracePort`. Functions: `serve_rounds`, `serve_round`, `tr_port`. -//! Split out of `round_tally` to keep its files under the line limit. +//! The round loop of a served request (`serve_rounds`, `serve_round`: verify and commit, emit, finish) and the +//! timing wrappers that trace each port call under the bring-up trace (`TracePort`, `tr_port`). +//! A failed emit still finishes its round (drain and join) before the error is reported. use super::{ CommittedWindow, DraftCompletion, DraftLimits, FirstDraftSeed, OriginalServePort, OriginalSpecController, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/tests.rs index 6494bad2..9b31660b 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Test world of the serve engine: a scripted port (`Fake`) with an event log and a deterministic model, and the +//! helpers that drive a request through the engine and the controller. The scenarios sit in the submodules. use super::super::original_spec_controller::{NanGuard, OriginalSpecController, SpecConfig, SpecError, SpecWindow}; use super::super::original_spec_draft::{DraftPreparation, DraftSampling, VerifiedWindow}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/tests/constructor_validates_dimensions.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/tests/constructor_validates_dimensions.rs index 7db09501..905ca612 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/tests/constructor_validates_dimensions.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/tests/constructor_validates_dimensions.rs @@ -1,6 +1,5 @@ -//! Tests of `tests` by topic: constructor_validates_dimensions, -//! verify_returns_all_t_outputs_and_requires_a_drained_window, out_of_range_tokens_never_reach_the_port, -//! a_short_or_invalid_window_is_drained_not_leaked .... +//! Pins the engine's admission rules: constructor dimension checks, a verify returning all T outputs only over a +//! drained window, out-of-range tokens never reaching the port, and short or invalid windows drained, not leaked. use super::{ Error, Fake, OriginalDraftEngine, OriginalServeEngine, OriginalSpecEngine, VOCAB, engine, events, idx, model, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/tests/restore_attempts_do_not_depend.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/tests/restore_attempts_do_not_depend.rs index a2834156..098dc35b 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/tests/restore_attempts_do_not_depend.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/tests/restore_attempts_do_not_depend.rs @@ -1,7 +1,5 @@ -//! Tests of tests by topic (moved out of the test file by STRA-338): -//! restore_attempts_do_not_depend_on_engine_health_and_reset_draft_state, -//! a_refused_window_is_taken_back_only_after_it_drained_and_a_failed_take_back_poisons, -//! first_draft_path_is_cached_and_drains, controller_over_the_engine_emits_the_greedy_continuation .... +//! Pins restore and draft behaviour: restore attempts independent of engine health, a refused window taken back only +//! after it drained (a failed take-back poisons), the cached first-draft path and the greedy end-to-end continuation. use super::{ ADAPTIVE_DEFAULT, AdaptiveConfig, DraftPreparation, DraftSampling, Error, Fake, OriginalDraftEngine, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_host/original_serve_host_native_serve_host.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_host/original_serve_host_native_serve_host.rs index 9dce20ea..b960bfb6 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_host/original_serve_host_native_serve_host.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_host/original_serve_host_native_serve_host.rs @@ -1,5 +1,5 @@ -//! Implements `NativeServeHost for OriginalServeHost`. -//! Split out of `original_serve_host` to keep its files under the line limit. +//! The `NativeServeHost` face of OriginalServeHost: lineage checkpoints and restores, the verified-window run, commit +//! and publication, the adaptive swaps around the commit, and the MTP draft launch and drain, in generate.cpp order. use super::{ AcceptedWindow, DraftCompletion, DraftLaunch, Error, LedgerCheckpoint, MtpDraftOwners, NativeServeHost, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_host/request_sampling.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_host/request_sampling.rs index 7ca6ca10..29434adb 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_host/request_sampling.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_host/request_sampling.rs @@ -1,5 +1,6 @@ -//! Methods of `RequestSampling`: `new`, `enabled`. -//! Methods of `OriginalServeHost`: `new`, `from_owners`, `position`, `settle_state` and 10 more. +//! The state OriginalServeHost carries for one request: sampling setup (`RequestSampling`), construction from the +//! session owners, the position and token lineage it ends on, and the settle of the recurrent GDN and PLE priors. +//! Also the A/B switches of the publication (`LELEKA_SERVE_PUBLISH`, `LELEKA_SERVE_ADAPT_DEFER`) and the draft cap. use super::{ BoundLayerKind, DraftCompletion, Error, GdnPrior, HostOutcome, HostOwners, OriginalNativeHeadGraphResources, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_host/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_host/tests.rs index 10f5d4b7..f3fac337 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_host/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_host/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Pins the host's request setup: a greedy request without penalties keeps the plain argmax head, invalid sampler +//! parameters are refused before any window, and the host outcome carries the four things the stack decides on. use super::{HostOutcome, RequestSampling, SamplerParams, SamplerPath}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_native/native_serve_port_original_serve_port.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_native/native_serve_port_original_serve_port.rs index 642e2022..f8c0d336 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_native/native_serve_port_original_serve_port.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_native/native_serve_port_original_serve_port.rs @@ -1,5 +1,5 @@ -//! Implements `OriginalServePort for NativeServePort`. Functions: `start_foreign`, `check_completed`. -//! Split out of `original_serve_native` to keep its files under the line limit. +//! The `OriginalServePort` face of NativeServePort: every port call mapped onto the driver Verifier and the host +//! owners, with the driver's own window receipt as the authority for what ran and what may be committed. use super::{ CommittedWindow, DraftCompletion, DraftLimits, Error, FirstDraftSeed, NativeServeHost, NativeServePort, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_native/native_window.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_native/native_window.rs index 1c4c78e9..8c7bb2cc 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_native/native_window.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_native/native_window.rs @@ -1,5 +1,6 @@ -//! Methods of `NativeWindow`: `generation`. -//! Methods of `NativeServePort`: `new`, `verifier`, `verifier_mut`, `host` and 13 more. +//! NativeServePort's window life cycle: commit wait and publication of the accepted prefix to the session, receipt +//! admission, and the overlapped or serialized draft launched behind the commit event. +//! Also the bring-up traces of windows and drafts and the `LELEKA_SERVE_OVERLAP` A/B switch. use super::{ DraftCompletion, DraftLimits, Error, NativeCommittedWindow, NativeServeHost, NativeServePort, NativeWindow, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_pool/cpu_expert_pool.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_pool/cpu_expert_pool.rs index cf28cdb8..1576ca38 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_pool/cpu_expert_pool.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_pool/cpu_expert_pool.rs @@ -1,5 +1,6 @@ -//! Methods of `CpuExpertPool`: `run_entries`, `admit_rows`, `plan_group`, `run_direct` and 6 more. -//! Functions: `legacy_batch`, `prepare_legacy_jobs`, `validate_legacy_job`, `compare_rows` and 1 more. +//! CpuExpertPool: computing one group of routed experts on the CPU (admission of the rows, planning, the direct +//! dispatch and the legacy per-expert batches) and writing every slot of the mapped sink, zeros for entries it skips. +//! The legacy path re-validates each finished job against a re-opened source and can be compared bit for bit. use super::{ BATCH_ALLOWANCE, ComputeSample, CpuExpertPool, CpuMissWorkspace, Error, ExpertJob, GroupTraceInfo, GroupWork, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_pool/direct_tier.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_pool/direct_tier.rs index b6c812aa..75545922 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_pool/direct_tier.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_pool/direct_tier.rs @@ -1,5 +1,6 @@ -//! Methods of `DirectTier`: `admit_all`, `start_lookahead`, `layer_layout`, `index` and 7 more. -//! Methods of `CpuExpertPool`: `new`, `with_path`. Implements `OriginalServePool for CpuExpertPool`. +//! DirectTier: the direct CPU path's expert admission, i.e. opening a layer group's experts under one source fence, +//! checking their gate/up/down spans and caching them so later groups pay nothing; and the pool constructors. +//! Eager admission at stack open takes the first-use cost out of the first decode. use super::{ ComputeSample, CpuExpertPool, CpuMissWorkspace, CrosscheckCounts, DirectCpuPool, DirectTier, EXPERTS, Error, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_pool/direct_tier_drop.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_pool/direct_tier_drop.rs index d51d6204..6d09ea6a 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_pool/direct_tier_drop.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_pool/direct_tier_drop.rs @@ -1,5 +1,5 @@ -//! Implements `Drop for DirectTier`. Functions: `admit_eager`, `sink_result`, `native_cpu_error`, `selection`. -//! Split out of `original_serve_pool` to keep its files under the line limit. +//! Closing of the direct tier (its Drop) and the small helpers of the direct path: the `LELEKA_CPU_ADMIT_EAGER` +//! switch, sink-write result mapping, native CPU error mapping and the per-row top-k selection check. use super::{DirectTier, Error, Result, TOP_K}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_pool/prefetch_off_file_exists.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_pool/prefetch_off_file_exists.rs index fa1e207c..9c22108b 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_pool/prefetch_off_file_exists.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_pool/prefetch_off_file_exists.rs @@ -1,5 +1,6 @@ -//! Methods of `PoolPath`: `from_env`. -//! Functions: `prefetch_off_file_exists`, `plan_experts`, `plan_experts_where`, `plan_row` and 7 more. +//! Planning of a CPU expert group and the per-job source checks: router ids grouped by expert in first-use order, +//! scatter of one expert's rows into the group output, and open/admit of an expert's matrices (`open_job`). +//! Also the `LELEKA_CPU_PREFETCH_OFF_FILE` bring-up switch that skips the page-touch pass. use super::{ EXPERTS, Error, ExpertJob, HIDDEN, ModelBinding, MoeMatrixRole, MoeRoutedSourceScope, Opened, PoolPath, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_pool/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_pool/tests.rs index 790b9fd9..c5350e6b 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_pool/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_pool/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Pins the expert group plan: every (row, slot) pair planned once with experts in first-use order, masked GPU +//! entries left out but still validated, bad router output refused, and scatter offsets of each output slot. use super::{Error, ExpertJob, HIDDEN, TOP_K, output_offset, plan_experts_where, scatter, selection}; #[cfg(test)] diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_request/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_request/tests.rs index e0b02ba8..64e81f0b 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_request/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_request/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of `original_serve_request`. +//! Pins the request flow of the serve layer: the stop set, reset and resume rules for fresh, used and resumed +//! stacks, admission as in generate.cpp, untouched owners on refusal, error classes and emit failure handling. use super::super::original_serve_engine::ServeStop; use super::{ diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/source_spans.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/source_spans.rs index 7eb4931e..0f0b7f46 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/source_spans.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/source_spans.rs @@ -1,5 +1,5 @@ -//! Methods of `GpuExpertPool`: `admit_group`, `note_usage`, `split_group`, `current_pcie_num` and 7 more. -//! Implements `OriginalServePool for GpuExpertPool`. +//! GpuExpertPool as an `OriginalServePool`: runs a window group (split into VRAM, PCIe and CPU shares, plan published +//! before the CPU starts), applies and begins the adaptive swaps, and fetches the source spans of PCIe experts. use super::{ CpuExpertPool, EXPERTS, Error, GpuExpertPool, GroupSplit, LAYERS, MappedExpertBank, ModelBinding, MoeWeightCache, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/span_cache_and_pcie_lag.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/span_cache_and_pcie_lag.rs index 0ee82e2a..9087401f 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/span_cache_and_pcie_lag.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/span_cache_and_pcie_lag.rs @@ -1,5 +1,5 @@ -//! Methods of `SpanCache`: `key`, `get`, `contains`, `insert`. -//! Methods of `PcieLag`: `from_environment`, `pcie_num`, `measure`, `round`. Implements `Debug for SpanCache`. +//! Small stateful helpers of the VRAM expert tier: the span cache of bank spans per (layer, expert), the PCIe share +//! controllers (`PcieLag` from copy lateness, `PcieAuto`) and ResidencyState (usage counts, round marks). use super::{ EXPERTS, ExpertTierConfig, GpuExpertPool, LAYERS, PcieAuto, PcieLag, ResidencyState, ResidencyStats, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/split_group_pcie.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/split_group_pcie.rs index 1c6688b9..b390084a 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/split_group_pcie.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/split_group_pcie.rs @@ -1,5 +1,6 @@ -//! Methods of `RoutedGroup`: `new`. Methods of `PcieShare`: `takes`. -//! Functions: `split_group_pcie`, `is_valid_expert`, `is_miss`, `group_firsts` and 14 more. +//! The window split of one expert group: distinct experts in routing order become VRAM groups, the last eligible +//! misses up to the PCIe share go over PCIe, the rest stay with the CPU, with the route tail skip applied first. +//! Pure planning over ids and residency; it touches no device and no source. use super::{ ADAPT_DECAY_DEFAULT, EXPERTS, Error, GroupSplit, LAYERS, MAX_WINDOW_ENTRIES, ORIGINAL_VERIFY_MAX_PCIE_FETCHES, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/tail_skip_rank.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/tail_skip_rank.rs index 594a7c04..0124f481 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/tail_skip_rank.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/tail_skip_rank.rs @@ -1,5 +1,5 @@ -//! Methods of `PcieMode`: `graph_mode`. -//! Methods of `ExpertTierConfig`: `decode_headroom_mib`, `off`, `enabled`, `effective_slots` and 14 more. +//! Configuration of the VRAM expert tier: ExpertTierConfig (slots, reserves, PCIe share and mode, adaptation, seed; +//! defaults, validation, `LELEKA_ORIGINAL_SERVE_*` switches) and the route tail-skip rank of a decode phase. use super::{ AtomicU32, EXPERTS, EnvSource, Error, ExpertTierConfig, GroupSplit, LAYERS, Ordering, OriginalExpertCache, PathBuf, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/tests.rs index 0fc54c52..a6556578 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Pins the expert tier rules: reserves and decode headroom, the selection-based swap ranking, the window split +//! (residents, PCIe share, tail skip, invalid ids), the lag controller, the PCIe mode and the off-by-default config. use super::{ EXPERTS, ExpertTierConfig, GroupSplit, LAYERS, PcieLag, PcieMode, PcieSplitPolicy, ResidencyState, RoutedGroup, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/conversation/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/conversation/tests.rs index 20f401d6..e7617ff2 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/conversation/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/conversation/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Pins the serve conversation policy over a fake stack: a continuing request resumes at its last turn, a settled +//! session continues live, cancel and failure keep or drop checkpoints, the chain is bounded and reread mode works. use super::{ConversationConfig, Error, PromptOptions, RequestStart, ResumeDevice, ServeConversation, TURN_TOKEN}; use crate::backend::original_prompt::{PlanLimits, PromptPath, PromptPlan, ResumePoint}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_device_ports.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_device_ports.rs index f154bb10..ad4b52a8 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_device_ports.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_device_ports.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalServeStack`: `settle_lent_refills`, `report_tier_request`, `pcie_num_for_report`, `report_req... -//! Implements `PrefixDevice for OriginalServeStack`, `RequestOwners for OriginalServeStack` and 1 more. +//! The ports OriginalServeStack implements for its callers: the prefix cache's device side (`PrefixDevice`), the +//! request flow (`RequestOwners`) and the serve device (`ServeDevice`), plus lent-slot refill and tier reports. use super::{ Clock, Error, OriginalServeStack, PARKED_BYTES_PER_TOKEN, PARKED_STATE_ESTIMATE, ParkedBlock, PrefixDevice, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_decode_phase.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_decode_phase.rs index d9fda73c..ec4ba579 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_decode_phase.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_decode_phase.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalServeStack`: `decode_phase`. -//! Split out of `original_serve_stack_methods` to keep its files under the line limit. +//! OriginalServeStack::decode_phase: hands the twelve QSA owners to a fresh verifier and runs the request's decode. +//! The steps and the read-only view of the phase are in the submodules `decode_steps` and `decode_view`. use super::{ AssembleFailure, AssembleInputs, Began, Context, CpuExpertPool, DecodeGraphKey, DecodeResources, DenseWeightCache, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_decode_phase/decode_steps.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_decode_phase/decode_steps.rs index e31a0eb7..988db864 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_decode_phase/decode_steps.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_decode_phase/decode_steps.rs @@ -1,6 +1,5 @@ -//! The phases of `OriginalServeStack::decode_phase` (STRA-338 size4): the request's start, the assembly of the verifier -//! window, the settlement of its outcome and the serve step. The order of the operations, the error paths and the -//! log lines are those of the single function they were taken from. +//! The phases of `OriginalServeStack::decode_phase`: the request's start, the assembly of the verifier window, the +//! settlement of its outcome and the serve step. Operation order, error paths and log lines are the decode's own. use super::decode_view::{Book, DecodeView, Extra, Ids, Owners, Policy, Reads, Refill, Tier}; use super::{ diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_decode_phase/decode_view.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_decode_phase/decode_view.rs index 9976d2aa..e5a9ea72 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_decode_phase/decode_view.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_decode_phase/decode_view.rs @@ -1,4 +1,4 @@ -//! The stack's fields a decode works on, borrowed one by one and grouped by who reads or writes them (STRA-338 size4). +//! The stack's fields a decode works on, borrowed one by one and grouped by who reads or writes them. //! The stack's own layout is flat and the verifier window resources of an assembly borrow its caches for the whole //! phase, so the phases cannot be `&mut self` methods of the stack; each phase is a method of this view instead. diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_memory_classes.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_memory_classes.rs index 09005434..0365def4 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_memory_classes.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_memory_classes.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalServeStack`: `health`, `serve`, `apply_memory_directive`, `note_memory` and 23 more. -//! Split out of `original_serve_stack_methods` to keep its files under the line limit. +//! Request-level surface of OriginalServeStack: stack health, `serve`, following the memory governor between +//! requests, registering allocation classes with the memory inventory, and the speculative window arms. use super::{ Error, ExpertTierConfig, OriginalServeStack, PLE_HISTORY_BYTES, PLE_SCRATCH_BYTES, PrefixMatch, PrefixSummary, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_metrics_close.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_metrics_close.rs index f35e044a..fccfed7f 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_metrics_close.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_metrics_close.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalServeStack`: `prefix_metrics`, `prefix_bytes`, `prefix_budget_bytes`, `retire_held` and 2 more. -//! Split out of `original_serve_stack_methods` to keep its files under the line limit. +//! Prefix cache metrics of OriginalServeStack, retirement of kept decode graphs, closing of every owner in dependency +//! order (the first failure is reported after all were attempted) and marking the stack broken. use super::{Error, ModelBinding, OriginalServeStack, Result, retire_kept}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_open.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_open.rs index ddfd5a34..4f578b87 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_open.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_open.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalServeStack`: `open`. -//! Split out of `original_serve_stack_methods` to keep its files under the line limit. +//! OriginalServeStack::open: the generate.cpp start-up over the model binding (embedding, native head, dense weights, +//! MoE cache, session, prompt executor with MTP drafter, prefill arena, per-request stages). use super::{ Context, CpuExpertPool, DenseWeightCache, DeviceRef, Error, ExecutorOpening, ExpertBlobSizes, GraphReuse, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_open/assemble.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_open/assemble.rs index 5804f06a..762f9f38 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_open/assemble.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_open/assemble.rs @@ -1,5 +1,5 @@ -//! The start and the end of `OriginalServeStack::open`, moved out of it by STRA-338 (size): the config-derived values -//! computed before any allocation and the final assembly of the stack from the opened parts. +//! The two ends of `OriginalServeStack::open`: the config-derived values computed before any allocation and the +//! final assembly of the stack from the opened parts. use super::open_phases::{Buffers, Core, TierParts}; use super::{ diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_open/open_phases.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_open/open_phases.rs index 6c212676..365fc7cf 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_open/open_phases.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_open/open_phases.rs @@ -1,5 +1,5 @@ -//! Phases of `OriginalServeStack::open`, moved out of it by STRA-338 (size): each helper runs one step of the startup -//! in the order `open` called it, with the same stage marks, notes and error context. +//! The steps of `OriginalServeStack::open`: each helper runs one step of the start-up in order, with its stage +//! marks, notes and error context. use super::{ Context, CpuExpertPool, DenseWeightCache, DeviceRef, ExecutorOpening, KarPleCache, LoanTier, ModelBinding, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_prefill_chunk.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_prefill_chunk.rs index 7ea70044..3396e3c5 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_prefill_chunk.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_prefill_chunk.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalServeStack`: `prefill_chunk`, `prefix_after_prefill`, `prefix_after_decode`, `prefix_after_re... -//! Functions: `report_decode_tail`, `lend_tail`. +//! One published prompt chunk of OriginalServeStack (with or without a loan of the expert cache's last slots) and +//! the prefix and conversation checkpoints taken after a chunk, at the end of prefill and of decode, or on a cancel. use super::{ ChunkOutcome, Error, OriginalExpertCache, OriginalPrefillArena, OriginalPromptInput, OriginalServeStack, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_prefill_phase.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_prefill_phase.rs index 701296b1..c8818d05 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_prefill_phase.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_prefill_phase.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalServeStack`: `prefill_phase`, `refill_deferred`, `begin_prefill`, `refill_after_read` and 8 m... -//! Functions: `trace_action`, `seed_rows_capped`, `trace_seed_report`, `coverage_by_layer`. +//! The prefill phase of OriginalServeStack: conditions prompt[resume..n-1] chunk by chunk, refills lent expert +//! slots, seeds the expert tier from the prompt's routing and sets up the MTP actor and prompt options. use super::{ Clock, Error, ModelBinding, OriginalPromptInput, OriginalServeStack, PlanLimits, PromptOptions, PromptPath, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/prefix_config.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/prefix_config.rs index 20d4ac6d..a293cd40 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/prefix_config.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/prefix_config.rs @@ -1,5 +1,5 @@ -//! Methods of `PrefixConfig`: `auto`, `validate`, `resolved_block`, `resolve_budget`. -//! Functions: `admission_reading`, `lcp`. +//! PrefixConfig: auto defaults, validation, block size and host byte budget of the cross-session prefix cache, +//! and the memory reading a checkpoint is admitted against (re-judged once after the governor trims pages). use super::{Error, PolicyParams, PrefixBudget, PrefixConfig, TailMode, budget}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/prefix_serve.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/prefix_serve.rs index ce52860e..ed353f1a 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/prefix_serve.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/prefix_serve.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `prefix_serve_after_phase_parking`, `prefix_serve_store_and_shedding`. -//! Split out of `prefix` to keep its files under the line limit. +//! PrefixServe: the per-stack prefix cache policy, split into its store, clock and shedding side and the side that +//! plans, parks and imports checkpoints around the prefill and decode phases. use super::{ AnyClock, ByteSize, ChunkOutcome, Clock, Consider, Error, PendingTail, PrefixConfig, PrefixDevice, PrefixMatch, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/prefix_serve/prefix_serve_after_phase_parking.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/prefix_serve/prefix_serve_after_phase_parking.rs index 241c511c..99378cda 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/prefix_serve/prefix_serve_after_phase_parking.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/prefix_serve/prefix_serve_after_phase_parking.rs @@ -1,5 +1,5 @@ -//! Methods of `PrefixServe`: `after_chunk`, `plan_chunk`, `park_chunk`, `park_missing` and 16 more. Defines `Point`. -//! Split out of `prefix_serve` to keep its files under the line limit. +//! The checkpoint side of PrefixServe: after a published chunk, at the end of prefill and of decode (or deferred +//! until after the response) it plans, parks and admits a checkpoint; a failure costs the cache, never the request. use super::{ ByteSize, ChunkOutcome, Clock, Consider, Error, PendingTail, PrefixDevice, PrefixServe, PrefixStore, TailMode, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/prefix_serve/prefix_serve_store_and_shedding.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/prefix_serve/prefix_serve_store_and_shedding.rs index 0112cd61..3710ff9f 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/prefix_serve/prefix_serve_store_and_shedding.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/prefix_serve/prefix_serve_store_and_shedding.rs @@ -1,5 +1,5 @@ -//! Methods of `PrefixServe`: `new`, `new_store`, `with_clock`, `wall_ms` and 23 more. Defines `ImportPlan`. -//! Split out of `prefix_serve` to keep its files under the line limit. +//! The store side of PrefixServe: construction over a namespace and clock, shedding to the memory governor's +//! directive, bypass mode, and read-only accessors (bytes, budget, nodes, blocks, summary, `prefix_match`). use super::{ AnyClock, ByteSize, Clock, Error, PrefixConfig, PrefixDevice, PrefixMatch, PrefixServe, PrefixStore, PrefixSummary, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/tests.rs index bc5792ca..f59a1559 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Test fixture of the stack prefix cache: a fake device with parked state and blocks, prompt and session generators +//! and helpers that drive a request through `PrefixServe` (begin, read chunks, turn). The scenarios are submodules. use super::{ByteSize, ChunkOutcome, Error, PrefixBudget, PrefixConfig, PrefixDevice, PrefixServe, Start, TailMode}; use crate::backend::original_prompt::{PlanLimits, PromptOptions, PromptPath, PromptPlan, ResumePoint}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/tests/one_token_prompt_reads.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/tests/one_token_prompt_reads.rs index d3a8198e..cd9568f1 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/tests/one_token_prompt_reads.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/tests/one_token_prompt_reads.rs @@ -1,8 +1,5 @@ -//! Tests of tests by topic (moved out of the test file by STRA-338): -//! a_one_token_prompt_reads_nothing_and_claims_nothing, -//! a_failed_import_is_an_error_for_the_caller_and_invalidate_forgets_everything, -//! the_budget_bounds_the_store_and_the_newest_frontier_survives, -//! a_memory_shed_evicts_to_the_target_and_the_configured_budget_comes_back .... +//! Pins the prefix cache edge cases: a one-token prompt reads and claims nothing, a failed import is the caller's +//! error and invalidate forgets everything, the budget bounds the store, and a memory shed evicts then restores. use super::{ Block, ChunkOutcome, Fake, G, PrefixBudget, PrefixConfig, PrefixServe, State, cfg, doc, full_digest, governor, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/tests/second_session.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/tests/second_session.rs index c1c82681..a21acf45 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/tests/second_session.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/tests/second_session.rs @@ -1,8 +1,5 @@ -//! Tests of tests by topic (moved out of the test file by STRA-338): -//! a_second_session_with_the_same_system_prompt_resumes_from_the_shared_blocks_and_ends_in_the_full_reads_state, -//! interleaved_sessions_each_resume_from_their_own_deepest_checkpoint, -//! a_miss_resets_the_owners_so_nothing_is_claimed_even_if_the_request_is_cancelled_before_its_first_chunk, -//! a_checkpoint_at_the_end_of_the_prefill_lets_the_next_turn_resume_at_the_exact_position .... +//! Pins prefix reuse across sessions: a second session with the same system prompt resumes from the shared blocks, +//! interleaved sessions use their own deepest checkpoint, a miss resets the owners, a turn resumes at its exact end. use super::{ Block, Fake, G, PrefixServe, State, TailMode, cfg, doc, full_digest, request, serve, session, tail_serve, turn, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prompt_chunk.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prompt_chunk.rs index 01bc1ede..9a58c1fe 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prompt_chunk.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prompt_chunk.rs @@ -1,5 +1,5 @@ -//! Methods of `PromptChunk`: `run`. Methods of `OriginalServeStack`: `prefix_resume`, `prefix_begin`. -//! Implements `ResumeDevice for OriginalServeStack`. +//! PromptChunk::run (one prefill forward over a chunk, then publication), the conversation cache's device side +//! (`ResumeDevice`) over the stack owners, and the bring-up notes (VRAM ledger, kernel selection, logs). use super::{ ChunkCaches, ChunkDraft, Context, DBG_T0, Error, OriginalPrefillArena, OriginalServeStack, PrefixServe, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/stack_config_and_ttft_marks.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/stack_config_and_ttft_marks.rs index 04758a9b..a95c73bc 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/stack_config_and_ttft_marks.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/stack_config_and_ttft_marks.rs @@ -1,5 +1,5 @@ -//! Methods of `TtftMarks`: `start`, `since`, `note_first_round`, `as_array`. -//! Methods of `StackConfig`: `new`, `kv_footprint`, `capacity_invalid`, `context_invalid` and 1 more. +//! StackConfig (defaults, KV footprint, capacity and context validation), TtftMarks (the time-to-first-token marks of +//! a request), the prefill loan ladder helpers and the byte sizes of parked stack state and blocks. use super::{ ADMITTED_CAPACITIES, AnyClock, ByteSize, CPU_WORKERS, Clock, ConversationConfig, DEFAULT_CAPACITY, Error, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/stack_groups.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/stack_groups.rs index 67232669..e1df5ea1 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/stack_groups.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/stack_groups.rs @@ -1,5 +1,5 @@ -//! Groups of cohesive plain-data fields of `OriginalServeStack`, moved out of it by STRA-338 (size). None owns a -//! device resource; each is declared at the position of its first member, so the stack's drop order is unchanged. +//! Groups of cohesive plain-data fields of `OriginalServeStack`. None owns a device resource; each is declared at +//! the position of its first member, so the stack's drop order is unchanged. use super::{ Error, ExpertBlobSizes, LoanTier, OriginalMtpFullPolicy, OriginalMtpScalarPolicy, OriginalServeSettings, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/tests.rs index f2a4bbe0..8031996a 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Pins the stack configuration rules: chunk loans take the smallest rung that holds them, the default chunk is an +//! admitted capacity, the conversation cache is on by default, KV defaults to INT8 and plan errors keep their class. use super::{ ADMITTED_CAPACITIES, Error, ExpertBlobSizes, KvFormat, LoanTier, PlanError, PrefillLayoutOptions, StackConfig, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_verifier/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_verifier/tests.rs index cba5d972..83742994 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_verifier/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_verifier/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Pins the verifier assembly fallback: a graph out-of-memory names the widest window worth recording, assembly is +//! retried with narrower windows until one fits, any other failure stops at once, and the PLE image has nine slots. use super::{ Error, PLE_HISTORY_BYTES, PLE_HISTORY_VALUES, ServeFailure, Stage, assemble_with_window_fallback, window_cap_after, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/original_spec_controller_finish.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/original_spec_controller_finish.rs index e96db58b..e48c9f7c 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/original_spec_controller_finish.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/original_spec_controller_finish.rs @@ -1,5 +1,6 @@ -//! Methods of `OriginalSpecController`: `finish_round`, `finish_request`. -//! Split out of `original_spec_controller` to keep its files under the line limit. +//! The end of a speculative round and of a request: `finish_round` runs after the committed tokens were emitted +//! (drafts the next window, joins adaptive work, drains the verified owner) and `finish_request` waits the last +//! commit. EOS and length skip drafting; a later draft error never un-commits what was already emitted. use super::{ CommittedRound, DraftBatch, Error, OriginalSpecController, OriginalSpecEngine, Result, RoundFacts, SpecResult, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/original_spec_controller_methods/original_spec_controller_start_request.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/original_spec_controller_methods/original_spec_controller_start_request.rs index 5aacf40b..a005843f 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/original_spec_controller_methods/original_spec_controller_start_request.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/original_spec_controller_methods/original_spec_controller_start_request.rs @@ -1,5 +1,6 @@ -//! Methods of `OriginalSpecController`: `planned_host_bytes`, `new`, `set_final_draft`, `begin_request` and 11 more. -//! Split out of `original_spec_controller_methods` to keep its files under the line limit. +//! Start of a request for OriginalSpecController: construction and host byte accounting, `begin_request` (precharge +//! of all append capacity, reset of the suffix state per request), read-only views, round stats and `abort`. Window +//! policy and the adaptive cadence survive across requests; the prompt history does not. use super::{ AdaptivePolicy, DraftBatch, DraftPolicy, Error, MAX_T, OriginalSpecController, OriginalSpecEngine, PrefixMemo, Rc, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/original_spec_controller_methods/original_spec_controller_verify_commit.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/original_spec_controller_methods/original_spec_controller_verify_commit.rs index 249028bf..4fa13d01 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/original_spec_controller_methods/original_spec_controller_verify_commit.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/original_spec_controller_methods/original_spec_controller_verify_commit.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalSpecController`: `verify_commit`. -//! Split out of `original_spec_controller_methods` to keep its files under the line limit. +//! `OriginalSpecController::verify_commit`: one round entry point, the verify half then the commit half, with the +//! steps in `verify_round_steps` and `commit_round_steps`. use super::{CommittedRound, Error, OriginalSpecController, OriginalSpecEngine, Round, SpecResult, window_inputs}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/tests.rs index d1b8c306..4b26e395 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Test world of the speculative controller: a scripted engine (`Fake`) with a deterministic model and fault trips, +//! and helpers that drive requests through the controller. The scenarios are submodules and the golden transcripts. use super::super::original_spec_draft::{DraftPick, FirstSeedPoint, OriginalFirstDraftEngine, TargetSeedRow}; use super::{ diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/tests/adaptation_join_failure_is_reported.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/tests/adaptation_join_failure_is_reported.rs index 85ce291a..dd7a8672 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/tests/adaptation_join_failure_is_reported.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/tests/adaptation_join_failure_is_reported.rs @@ -1,7 +1,5 @@ -//! Tests of tests by topic (moved out of the test file by STRA-338): -//! adaptation_join_failure_is_reported_even_after_a_good_draft, -//! finish_round_refuses_a_receipt_from_another_controller, a_request_cannot_restart_while_a_draft_is_pending, -//! policy_and_adaptive_cadence_survive_across_requests .... +//! Pins round bookkeeping: a failed adaptation join is reported even after a good draft, a receipt from another +//! controller is refused, a request cannot restart with a draft pending, and policy and cadence survive requests. use super::{ DraftPick, DraftPreparation, DraftSampling, Error, Fake, FirstSeedPoint, OriginalFirstDraftEngine, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/tests/config_rejects_out_of_range.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/tests/config_rejects_out_of_range.rs index 59862f8f..d3224760 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/tests/config_rejects_out_of_range.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/tests/config_rejects_out_of_range.rs @@ -1,7 +1,6 @@ -//! Tests of tests by topic (moved out of the test file by STRA-338): -//! config_rejects_out_of_range_and_mtp_zero_means_max_t, host_budget_is_checked_and_grows_with_the_request, -//! begin_request_validates_tokens_and_rejects_a_live_request, -//! the_adaptive_window_emits_the_same_text_as_a_fixed_one_under_any_drafter .... +//! Pins the controller's admission rules: out-of-range config refused (mtp zero means max T), host budget checked and +//! growing with the request, request tokens validated, and adaptive output equal to a fixed window's under any +//! drafter. use super::{ AdaptiveConfig, EndRunSetup, Error, Fake, NanGuard, OriginalSpecController, SpecConfig, SpecWindow, VOCAB, begin, config, drive, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/tests/non_finite_window.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/tests/non_finite_window.rs index 39e23214..24727893 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/tests/non_finite_window.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/tests/non_finite_window.rs @@ -1,7 +1,6 @@ -//! Tests of tests by topic (moved out of the test file by STRA-338): -//! a_non_finite_window_is_run_again_from_its_checkpoint_and_the_request_completes, -//! the_guard_costs_nothing_when_nothing_is_wrong, a_window_that_stays_non_finite_fails_the_request_after_the_retries, -//! only_a_non_finite_failure_is_retried_and_a_guard_that_is_off_retries_nothing .... +//! Pins the non-finite window guard: a bad window is run again from its checkpoint and the request completes, the +//! guard costs nothing when nothing is wrong, a persistent failure fails the request, and only a non-finite one is +//! retried. use super::{ Error, Fake, NanGuard, OriginalSpecController, OriginalSpecEngine, SpecError, VOCAB, begin, config, drive, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/trace_enabled.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/trace_enabled.rs index 8a3f322c..524ec46d 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/trace_enabled.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/trace_enabled.rs @@ -1,5 +1,5 @@ -//! Methods of `NanGuard`: `off`, `with_retries`, `with_injection`, `parse_switch` and 5 more. -//! Methods of `SpecConfig`: `new`, `with_nan_guard`, `with_adaptive`. Implements `From for SpecError`. +//! Settings of the speculative controller: NanGuard (non-finite window retry policy and its injection), SpecConfig +//! (window, context, suffix and adaptive options), the round accessors, and the `LELEKA_SPEC_TRACE/STATS` switches. use super::{AdaptiveConfig, CommittedRound, Error, MAX_T, NanGuard, Result, SpecConfig, SpecError, SpecWindow}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/output/original_prompt_sample.rs b/crates/engine-qwen35-cuda/src/qwen_forward/output/original_prompt_sample.rs index 7d2d242e..31d7e2fc 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/output/original_prompt_sample.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/output/original_prompt_sample.rs @@ -1,5 +1,6 @@ -//! Methods of `OriginalPromptSample`: `greedy`, `conditioning`, `validate`, `matches_final` and 3 more. -//! Methods of `FiniteLogits`: `validate_for`. +//! OriginalPromptSample: the authentic head result of the prompt's final row (greedy next token or the known +//! conditioning token) tied to one pending final phase, checked again before MTP uses it; and +//! FiniteLogits::validate_for. use super::{ BindingIdentity, Error, FiniteLogits, LogitValues, ModelBinding, OriginalPromptSample, Position, Result, TokenId, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/output/output_stage.rs b/crates/engine-qwen35-cuda/src/qwen_forward/output/output_stage.rs index 3b504d18..2cef1f5a 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/output/output_stage.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/output/output_stage.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `output_stage_load_and_logits`, `output_stage_sampling_projection`. -//! Split out of `output` to keep its files under the line limit. +//! OutputStage: the loaded Q6_K output head, split into loading and logits (`output_stage_load_and_logits`) and the +//! sampling and projection of a mixed residual (`output_stage_sampling_projection`). use super::{ ACTIVATION_BYTES, BindingIdentity, Context, DeviceBuffer, Dimension, EMBEDDING, Error, FiniteF32, FiniteLogits, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/output/output_stage/output_stage_load_and_logits.rs b/crates/engine-qwen35-cuda/src/qwen_forward/output/output_stage/output_stage_load_and_logits.rs index 78a90181..88669491 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/output/output_stage/output_stage_load_and_logits.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/output/output_stage/output_stage_load_and_logits.rs @@ -1,5 +1,5 @@ -//! Methods of `OutputStage`: `logits_original_prompt`, `finite_final_mix`, `certify_prompt_logits`, `load` and 13 more. -//! Split out of `output_stage` to keep its files under the line limit. +//! OutputStage loading and logits: uploads the fixed Q6_K head once per context, the compact (device argmax) variant, +//! the logits entry points for prompt, decode and MTP greedy, step checks and arming the per-request sampler. use super::{ BindingIdentity, Context, Dimension, EMBEDDING, Error, FiniteLogits, GrStage, HEAD_GREEDY_WORKSPACE_BYTES, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/output/output_stage/output_stage_sampling_projection.rs b/crates/engine-qwen35-cuda/src/qwen_forward/output/output_stage/output_stage_sampling_projection.rs index ea80ea78..76b1e352 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/output/output_stage/output_stage_sampling_projection.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/output/output_stage/output_stage_sampling_projection.rs @@ -1,5 +1,6 @@ -//! Methods of `OutputStage`: `sampler_wants`, `sample_complete`, `check_projection`, `with_projected` and 8 more. -//! Split out of `output_stage` to keep its files under the line limit. +//! OutputStage projection and sampling: uploads the mixed residual, projects it through the Q6_K head into a +//! candidate logit buffer, selects greedily on the device or reads the full vector, and applies the armed request +//! sampler. Short-lived buffers are accounted before the result is published; the first error stays primary. use super::{ ACTIVATION_BYTES, BindingIdentity, Context, DeviceBuffer, Dimension, EMBEDDING, Error, FiniteF32, FiniteLogits, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/output/output_stage_test_replay.rs b/crates/engine-qwen35-cuda/src/qwen_forward/output/output_stage_test_replay.rs index c4f9ece8..023dcf37 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/output/output_stage_test_replay.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/output/output_stage_test_replay.rs @@ -1,5 +1,5 @@ -//! Methods of `OutputStage`: `test_prefix_begin_target`, `test_reset_replay_record`, `test_reset_replay_capture`, `s... -//! Functions: `greedy`, `selected_token`, `validate_weight_owner`, `encode_activation` and 4 more. +//! Test-only replay hooks of OutputStage (record logits of a reset or prefix replay, count compact completions) and +//! the shared helpers of the stage: greedy pick, activation and logit encoding, weight-owner check and error mapping. use super::{ ACTIVATION_BYTES, BindingIdentity, Dimension, EMBEDDING, Error, FiniteF32, FiniteLogits, HeadGreedySelection, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/output/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/output/tests.rs index d7cb62f7..423b2ab9 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/output/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/output/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Pins the output head's rules: weights refused across bindings before extents, greedy ties take the lowest id, a +//! late strictly greater logit wins, incomplete or non-finite vectors are refused and cleanup errors take precedence. use super::{ BindingIdentity, Dimension, Error, FiniteF32, FiniteLogits, LOGIT_BYTES, LogitValues, OutputWeights, Position, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/prompt_device_rows/prompt_device_read.rs b/crates/engine-qwen35-cuda/src/qwen_forward/prompt_device_rows/prompt_device_read.rs index 6425e09e..3f79bd2a 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/prompt_device_rows/prompt_device_read.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/prompt_device_rows/prompt_device_read.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `produce_original_gdn`, `read_completion`. -//! Split out of `prompt_device_rows` to keep its files under the line limit. +//! PromptDeviceRead: a read of the prompt chunk's device rows at one GR role, split into producing the Original GDN +//! and QSA layers (`produce_original_gdn`) and validating and completing the read (`read_completion`). use super::{ Context, DenseWeightCache, Dimension, Error, GrRole, InputReady, LayerId, ModelBinding, OriginalDeviceBlock, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/prompt_device_rows/prompt_device_read/produce_original_gdn.rs b/crates/engine-qwen35-cuda/src/qwen_forward/prompt_device_rows/prompt_device_read/produce_original_gdn.rs index 87f2787c..9948fc63 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/prompt_device_rows/prompt_device_read/produce_original_gdn.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/prompt_device_rows/prompt_device_read/produce_original_gdn.rs @@ -1,5 +1,6 @@ -//! Methods of `Lap`: `new`, `off`, `at`. Methods of `GdnLayer`: `enter`, `compute`, `leave`. -//! Functions: `produce_original_gdn`, `produce_original_qsa`, `normed_gamma`, `produce_block` and 1 more. +//! Producers of one prompt layer on the device: the full GDN layer (state in, compute, state out) and the resident +//! QSA layer (setup, projections, indexer, attention, seal), plus the layer lap timing of the command profile. +//! End state enters the journal only from the completed whole-layer producer. use super::{ Context, DenseWeightCache, Error, GrRole, InputReady, LayerId, ModelBinding, OriginalDeviceBlock, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/prompt_device_rows/prompt_device_read/read_completion.rs b/crates/engine-qwen35-cuda/src/qwen_forward/prompt_device_rows/prompt_device_read/read_completion.rs index 511314a3..6fe797da 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/prompt_device_rows/prompt_device_read/read_completion.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/prompt_device_rows/prompt_device_read/read_completion.rs @@ -1,5 +1,5 @@ -//! Methods of `PromptDeviceRead`: `validate_original_rows`, `validate_row`, `device`, `attention_layer` and 8 more. -//! Split out of `prompt_device_read` to keep its files under the line limit. +//! Completion of a PromptDeviceRead: validates the chunk's rows against the phase, runs the GDN, FFN and GR steps +//! over the same physical arena, and checks the next role. Every current row must pass chronological validation. use super::super::super::gdn::PromptSource; use super::produce_original_gdn::{ diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/prompt_device_rows/prompt_ple_history.rs b/crates/engine-qwen35-cuda/src/qwen_forward/prompt_device_rows/prompt_ple_history.rs index 45667a80..79351a38 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/prompt_device_rows/prompt_ple_history.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/prompt_device_rows/prompt_ple_history.rs @@ -1,5 +1,5 @@ -//! Methods of `PromptPleHistory`: `from_prior`, `into_completed`, `close`. -//! Functions: `micro_driver_error`, `run_transfer`. +//! PromptPleHistory: the device copy of the PLE history a prefill chunk advances, seeded from the session's prior and +//! returned as the completed history; plus the transfer helper and GR driver error mapping of the PLE micro path. use super::{ BindingIdentity, Context, Error, ModelBinding, OriginalPleHistory, OriginalPromptDevice, PlePrior, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/prompt_device_rows/std_ops_deref.rs b/crates/engine-qwen35-cuda/src/qwen_forward/prompt_device_rows/std_ops_deref.rs index cbdb16d7..c16c1aa6 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/prompt_device_rows/std_ops_deref.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/prompt_device_rows/std_ops_deref.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `prompt_device_rows`, `prompt_device_rows_ple_read`, `source_input_deref`. -//! Split out of `prompt_device_rows` to keep its files under the line limit. +//! PromptDeviceRows: the prompt chunk's physical device rows, with its final-row preview, PLE application and device +//! reads (`prompt_device_rows`, `prompt_device_rows_ple_read`) and the source input views (`source_input_deref`). use super::{ BindingIdentity, Context, DenseWeightCache, Dimension, Error, FinalProduct, GrRole, InputReady, LayerId, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/prompt_device_rows/std_ops_deref/prompt_device_rows.rs b/crates/engine-qwen35-cuda/src/qwen_forward/prompt_device_rows/std_ops_deref/prompt_device_rows.rs index 3f8ec7d5..b69b2de3 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/prompt_device_rows/std_ops_deref/prompt_device_rows.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/prompt_device_rows/std_ops_deref/prompt_device_rows.rs @@ -1,5 +1,6 @@ -//! Methods of `PromptDeviceRows`: `final_point`, `preview_conditioning`, `preview_final`, `with_final_residual` and ... -//! Split out of `std_ops_deref` to keep its files under the line limit. +//! PromptDeviceRows: initial staging of the chunk's rows to the device, the final point of the phase, and the +//! conditioning and final previews that keep the all-row residual for the shifted MTP input. +//! Only the final-phase owner can lend the retained residual to the MTP producer. use super::{ Context, DenseWeightCache, Error, FinalProduct, GrRole, ModelBinding, OriginalDeviceResidual, OriginalPromptDevice, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/prompt_device_rows/std_ops_deref/prompt_device_rows_ple_read.rs b/crates/engine-qwen35-cuda/src/qwen_forward/prompt_device_rows/std_ops_deref/prompt_device_rows_ple_read.rs index 4ce3a820..0aff481c 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/prompt_device_rows/std_ops_deref/prompt_device_rows_ple_read.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/prompt_device_rows/std_ops_deref/prompt_device_rows_ple_read.rs @@ -1,5 +1,5 @@ -//! Methods of `PromptDeviceRows`: `apply_ple`, `check_ple`, `ple_weights`, `read` and 1 more. -//! Split out of `std_ops_deref` to keep its files under the line limit. +//! PromptDeviceRows PLE and read: applies the per-layer PLE step to the staged rows, checks and resolves the PLE +//! weights of the binding, and reads the rows to the device for a GR role. use super::{ Context, DenseWeightCache, Error, GrRole, ModelBinding, OriginalDeviceGrRead, OriginalDeviceResidual, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/prompt_device_rows/std_ops_deref/source_input_deref.rs b/crates/engine-qwen35-cuda/src/qwen_forward/prompt_device_rows/std_ops_deref/source_input_deref.rs index 4eda4dab..507c96d0 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/prompt_device_rows/std_ops_deref/source_input_deref.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/prompt_device_rows/std_ops_deref/source_input_deref.rs @@ -1,5 +1,5 @@ -//! Methods of `PromptDeviceSource`: `from_current`, `check_input_values`, `from_original`. -//! Methods of `PromptDeviceFinal`: `validate`, `token`, `position`, `streams` and 1 more. +//! Sources of the prompt rows: PromptDeviceSource (from the current input or the Original key), PromptDeviceFinal +//! accessors, and the checks that the sources are the ones validated before staging, a read or completion. use super::{ BindingIdentity, Context, DenseWeightCache, Dimension, Error, FinalProduct, GrRole, InputReady, LayerId, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/q6_attention_columns/column_projection.rs b/crates/engine-qwen35-cuda/src/qwen_forward/q6_attention_columns/column_projection.rs index d4180e19..bc95cf35 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/q6_attention_columns/column_projection.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/q6_attention_columns/column_projection.rs @@ -1,5 +1,6 @@ -//! Methods of `RowFactory`: `row`. -//! Functions: `check_inputs`, `check_row`, `check_successor`, `gdn_matrix_of` and 8 more. Defines `RowFactory`. +//! Q6_K projection of attention input columns (GDN QKV or a QSA role) for a run of consecutive rows: validates that +//! every input is a certified attention input of its layer, then projects and returns rows on the host or retained +//! on the device (GDN QKV only). use super::{ Cell, ColumnKey, ColumnTarget, Context, DenseWeightCache, DeviceBuffer, Error, GdnMatrixKind, GdnMatrixRole, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/q6_attention_columns/projection_row.rs b/crates/engine-qwen35-cuda/src/qwen_forward/q6_attention_columns/projection_row.rs index 0e1ad339..5bc3731c 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/q6_attention_columns/projection_row.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/q6_attention_columns/projection_row.rs @@ -1,5 +1,6 @@ -//! Methods of `Role`: `rows`, `qsa`. Methods of `RetainedColumns`: `buffer`. Implements `Drop for RetainedColumns`. -//! Functions: `project`, `project_retained`. +//! The row types of the Q6 attention-column adapter: `ProjectionRow` (host row, taken once), `RetainedRow` and +//! `RetainedColumns` (device output shared by the rows of a batch). Each is checked against the binding, session +//! and input; a host row cannot be converted into a retained one or back. use super::{ ColumnKey, ColumnTarget, Context, DenseWeightCache, DeviceBuffer, Error, GrRole, LayerId, ModelBinding, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/q6_attention_columns/q6_numeric.rs b/crates/engine-qwen35-cuda/src/qwen_forward/q6_attention_columns/q6_numeric.rs index ca1ff099..4dde2d5a 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/q6_attention_columns/q6_numeric.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/q6_attention_columns/q6_numeric.rs @@ -1,5 +1,6 @@ -//! Methods of `Q6Job`: `fence_refusal`, `admit_budget`, `project`, `download` and 1 more. -//! Functions: `numeric`, `numeric`, `numeric_retained`, `numeric_retained` and 1 more. Defines `Q6Buffers`, `Q6Job`. +//! The device run of one Q6_K column projection: upload, activation quantization, projection, readback or retention +//! of the output, and cleanup. Admission and quantization are identical for both ends; every failure marks the +//! shared fence failed and the first error is returned. use super::{Cell, Context, DeviceBuffer, Error, Result, download, driver_error}; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_attention/decode_selected_cached.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_attention/decode_selected_cached.rs index e9f83e52..469f76db 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_attention/decode_selected_cached.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_attention/decode_selected_cached.rs @@ -1,5 +1,6 @@ -//! Methods of `AttendBuffers`: `upload`, `launch`. -//! Functions: `decode_selected_cached`, `attend_selected`, `settle_retained`, `attend_retained` and 8 more. +//! QSA attention over the selected cells with the retained device cache: upload query, keys and values, launch the +//! attend kernel, read the output back whole and gate it. The finite boundary stays before gating, so the gate +//! cannot mask a bad value; a failed launch or cleanup marks the shared fence failed. use super::{ Cell, Context, DenseWeightCache, DeviceBuffer, Error, ModelBinding, Q, QsaAttendBuffers, QsaAttended, QsaGated, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_attention/native_attended.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_attention/native_attended.rs index 2c4681be..1dba59a8 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_attention/native_attended.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_attention/native_attended.rs @@ -1,5 +1,6 @@ -//! Methods of `NativeAttended`: `identity`, `values`, `gate`, `validate` and 4 more. -//! Methods of `NativePromptAttentionBatch`: `complete`, `owner`, `publish_row`, `locate` and 6 more. +//! The attended row of native prompt QSA attention (`NativeAttended`) and the chunk batch that completes it +//! (`NativePromptAttentionBatch`). Rows are published to the causal session one at a time, never as a batch-final +//! relabel, and each is checked against its chunk, layer and transaction first. #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] use super::super::qsa_index::QsaPending; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_attention/qsa_ready.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_attention/qsa_ready.rs index 654ad129..981cfb73 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_attention/qsa_ready.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_attention/qsa_ready.rs @@ -1,5 +1,6 @@ -//! Methods of `QsaReady`: `identity`, `output`, `validate_origin`. -//! Methods of `QsaAttentionStage`: `decode_native`, `complete_native`, `decode`, `decode_selected` and 4 more. +//! `QsaReady` (the output of one attention layer step) and the `QsaAttentionStage` decode entry points: native decode +//! on the device, the selected-cache path and the uncached host path. Only the native completion reaches the pending +//! journal; the joint transaction still owns publication. #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] use super::super::{ diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/context.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/context.rs index 54fe6a15..46505962 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/context.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/context.rs @@ -1,5 +1,6 @@ -//! Methods of `QsaOwner`: `new`, `matches`. -//! Methods of `QsaPrior`: `oracle_capture_parts`, `test_reset_replay_numeric_eq`, `same_native_kv`, `same_pages` and... +//! The immutable QSA state handles: `QsaOwner` (identity of one session's QSA state family) and `QsaPrior` (one +//! layer's KV pages, pooled index keys and tail at a position), with their equality, extent and gather checks. +//! Also the serving context size and the device headroom a QSA step requires. use super::{ BindingIdentity, Directory, Error, KV, LayerId, PackedKv, Position, QsaOwner, QsaPrior, Rc, Result, Stage, State, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/directory/qsa_directory_sdet.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/directory/qsa_directory_sdet.rs index f93fc3a2..688be25f 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/directory/qsa_directory_sdet.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/directory/qsa_directory_sdet.rs @@ -1,3 +1,6 @@ +//! Pins the persistent `Directory` at its 65536-entry limit: successors share their retained roots and payloads +//! (Rc identity), and iteration, replacement and fork of any earlier version leave the other versions unchanged. + use super::{Directory, Error, MAX_ENTRIES}; use std::rc::Rc; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/index_kernels.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/index_kernels.rs index 75bb6d83..9198eed9 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/index_kernels.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/index_kernels.rs @@ -1,5 +1,5 @@ -//! Functions: `norm`, `upload_gamma`, `release_gamma`, `run_norm` and 15 more. Defines `BlockQuery`. -//! Split out of `qsa_index` to keep its files under the line limit. +//! Kernel runners of the QSA index path: norm, RoPE, query/gate split, K/V pack, index-key append, block scoring and +//! top-k selection, and the index-side projection. Every output is read back and checked finite or in range. use super::{ Context, DenseWeightCache, DeviceBuffer, Error, KV, ModelBinding, Norm, PackedKv, Q, QGate, QsaLayerProjection, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/index_resident/max_rows.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/index_resident/max_rows.rs index 8970e88c..e784d4c2 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/index_resident/max_rows.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/index_resident/max_rows.rs @@ -1,5 +1,6 @@ -//! Methods of `QsaIndexKeyCache`: `layer_bytes`, `new`, `with_eager`, `admit_mirror` and 9 more. -//! Functions: `max_rows`, `update`, `append_rows`, `capacity` and 2 more. +//! Legacy device mirror of the pooled index keys (`QsaIndexKeyCache`, one entry per attention layer) and the plan +//! that brings it from one `QsaPrior` to its successor: reload, append one pooled row, or change only the spare row. +//! Reset, replay and speculative branches are misses. A layer's mirror is allocated on its first selection. use super::{ BindingIdentity, BlockQuery, Cell, Context, Entry, Error, QsaIndexKeyCache, QsaPrior, QsaSelectionRequest, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/index_resident/synthetic_late_prior.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/index_resident/synthetic_late_prior.rs index 436d28fd..194430f0 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/index_resident/synthetic_late_prior.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/index_resident/synthetic_late_prior.rs @@ -1,5 +1,4 @@ -//! Functions: `synthetic_late_prior`, `synthetic_late_prior_for`. -//! Split out of `index_resident` to keep its files under the line limit. +//! Test fixture: a `QsaPrior` of one zeroed KV page at a late position, bound to a given or test identity. #[cfg(test)] use super::{BindingIdentity, Directory, KvPage, LayerId, PAGE, QsaOwner, QsaPrior, Rc, State}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/resident_qsa_completed.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/resident_qsa_completed.rs index 38fbfce0..2d2067f8 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/resident_qsa_completed.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/resident_qsa_completed.rs @@ -1,5 +1,6 @@ -//! Methods of `ResidentQsaCompleted`: `first`, `rows`, `layer`, `validate_rows` and 7 more. -//! Defines `ResidentSealOwners`. +//! `ResidentQsaCompleted`: the rows a resident QSA layer completed in one prompt window, before they are sealed. +//! Checks the rows against the inputs and the session, finds a transaction's row, then seals the accepted prefix +//! (index and mapped K/V commit) or aborts. `ResidentSealOwners` names the owners a seal commits through. use super::resident_qsa_layer::mint; use super::{ diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/resident_qsa_layer.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/resident_qsa_layer.rs index 1b9f3f5e..aae0da9c 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/resident_qsa_layer.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/resident_qsa_layer.rs @@ -1,5 +1,6 @@ -//! Methods of `ResidentQsaLayer`: `new`, `empty_guards`, `current`, `validate` and 11 more. -//! Functions: `check_empty`, `mint`, `rehome`, `resident_identities` and 1 more. +//! `ResidentQsaLayer` lifecycle: construction from an empty lineage, validation of a prior, prepare of a prompt +//! window, prefix prefetch, publication of a seal and restore to a session checkpoint. Holds the resident index +//! image and mapped K/V journal; rows are provenance only, never a host image. use super::{ BindingIdentity, Context, DenseWeightCache, Error, InputReady, LayerId, ModelBinding, NativeBatchWorkspace, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/resident_qsa_prior.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/resident_qsa_prior.rs index 262a2bed..4974d8cd 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/resident_qsa_prior.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/resident_qsa_prior.rs @@ -1,5 +1,6 @@ -//! Methods of `ResidentQsaPrior`: `next_position`, `layer`, `same_prior`, `validate_for_session` and 5 more. -//! Methods of `ParkedLayerSpan`: `bytes`. +//! `ResidentQsaPrior`: the lineage witness of a resident QSA layer (index checkpoint plus mapped K/V prefix at one +//! position). Checks it against a session or model identity and re-stamps it: empty lineage onto a new branch, +//! a checkpoint onto the current branch generation, or advanced after the verifier committed rows. use super::{ BindingIdentity, Error, LayerId, ModelBinding, OriginalQsaIndexCheckpoint, OriginalQsaMappedPrefix, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/resident_qsa_span_export_and_seal.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/resident_qsa_span_export_and_seal.rs index 7147ada6..bfcc2a00 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/resident_qsa_span_export_and_seal.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/resident_qsa_span_export_and_seal.rs @@ -1,5 +1,6 @@ -//! Methods of `ResidentQsaLayer`: `export_span`, `export_kv`, `export_index`, `export_tail` and 5 more. -//! Methods of `ResidentQsaPublication`: `publish_validated`. Functions: `span_views`. Defines `SpanViews`. +//! Moving a resident QSA layer's state: export of a prefix span and tail for the prefix cache, import of a parked +//! prefix, the one-way handoff of the index and mapped K/V owners to the native verifier (and back), and the seal +//! and publication types that make a completed window canonical. use super::resident_qsa_layer::rehome; use super::{ diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/scalar/gated_out_projection.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/scalar/gated_out_projection.rs index 3fc2e878..ae9f5f54 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/scalar/gated_out_projection.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/scalar/gated_out_projection.rs @@ -1,5 +1,5 @@ -//! Functions: `out_matrix`, `project_gated_out`, `release_gate_buffers`, `gate_and_out`. -//! Split out of `scalar` to keep its files under the line limit. +//! The gate and Out projection of the scalar QSA continuation: the attended tensor is gated, then projected by the +//! layer's quantized Out matrix. Both the attended and the gated tensors are checked finite before Out runs. use super::{ BoundDense, Context, DenseWeightCache, DeviceBuffer, Error, GateBuffers, GateDevices, GateRows, ModelBinding, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/scalar/scalar_row_admission.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/scalar/scalar_row_admission.rs index 212c632a..c1a30c86 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/scalar/scalar_row_admission.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/scalar/scalar_row_admission.rs @@ -1,5 +1,5 @@ -//! Methods of `ScalarHost`: `gather`, `select`. -//! Methods of `ResidentQsaLayer`: `scalar_guards`, `check_scalar_prior`, `prepare_scalar`. +//! Admission of one scalar row (target or MTP) on a resident QSA layer: host gather and block selection, the guards +//! of the step, the lineage and the weights, and `prepare_scalar`, before any device work. use super::{ Context, DenseWeightCache, DeviceBuffer, Error, GrRole, LayerId, ModelBinding, NativeBatchWorkspace, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/scalar/scalar_row_run.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/scalar/scalar_row_run.rs index 75d8fa5d..91dce652 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/scalar/scalar_row_run.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/scalar/scalar_row_run.rs @@ -1,5 +1,5 @@ -//! Methods of `ResidentQsaScalar`: `validate`, `check_identity`, `attend`, `gate_out` and 3 more. -//! Methods of `ResidentQsaScalarReady`: `into_parts`, `check_identity`. +//! Run of one scalar row on a resident QSA layer: append, attend over the selected blocks, gate and Out project, +//! then seal or abort. `ResidentQsaScalarReady` is consumed once, after an identity check. use super::{ BoundDense, Cell, Context, DenseWeightCache, Error, GateBuffers, GateDevices, GateRows, GrRole, LayerId, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/qsa_index_stage.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/qsa_index_stage.rs index 666be817..baaa73bf 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/qsa_index_stage.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/qsa_index_stage.rs @@ -1,5 +1,6 @@ -//! Methods of `QsaIndexStage`: `prepare`, `prepare_projected`, `prepare_impl`, `prepare_host_rows` and 4 more. -//! Methods of `QsaPrep`: `layer_projection`, `project`, `project_column`, `key_stage` and 5 more. Defines `QsaPrep`. +//! `QsaIndexStage::prepare`: the QSA preparation of one token step (query, gate, KV append, selected block ids). +//! Projects the host rows or the native prompt row, then builds the next prior as a pending candidate that is +//! published only at token commit. Admission checks the binding, layer, position and residual input first. use super::{ Context, DenseWeightCache, DeviceBuffer, Error, GrRole, LayerId, ModelBinding, Norm, Position, ProjectionSources, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/qsa_pending.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/qsa_pending.rs index 44765953..97b79c78 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/qsa_pending.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/qsa_pending.rs @@ -1,5 +1,5 @@ -//! Methods of `QsaPending`: `new`, `next_pooled`, `admit`, `next_page` and 5 more. -//! Methods of `QsaPrepared`: `identity`, `validate_for`, `validate_binding`, `validate_origin` and 7 more. +//! The QSA successor candidate: `QsaPending` builds the next `QsaPrior` (one more KV cell, pooled key, tail) from a +//! prior; `QsaPrepared` carries the query, gate, selected ids and pending state to attention, with origin checks. use super::{ BindingIdentity, Directory, Error, KV, KvPage, LayerId, PAGE, PackedKv, Position, QsaPending, QsaPrepared, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/qsa_projection.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/qsa_projection.rs index c32ace55..1980b7b7 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/qsa_projection.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/qsa_projection.rs @@ -1,5 +1,5 @@ -//! Functions: `dispatch_projection`, `project_input`, `project_input_numeric`, `project_cached_out` and 4 more. -//! Defines `QsaMatrixLayout`, `QsaLayerProjection`, `ProjectionSources`. +//! Device projections of the QSA index path: dispatch by matrix layout, project an input column through the lease, +//! the resident cache or an uploaded matrix, and the Out projection. A device failure marks the transport failed. use super::{ Bf16ProjectionShape, Cell, Context, DenseFormat, DenseWeightCache, DeviceBuffer, DriverError, Error, ModelBinding, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/selected_cache/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/selected_cache/tests.rs index f3e52a4e..f9732e8b 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/selected_cache/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/selected_cache/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of the selected-cell cache (moved out of the file by STRA-338; the test ids are unchanged). +//! Pins the selected-cell plan: page lineage, tail checkpoints, reset, refusals and order, and that weak entries +//! retire without retaining reset pages or speculative branch payloads. use super::{ BindingIdentity, Error, KV, LayerDirectory, LayerId, Plan, Position, QsaOwner, QsaPending, QsaPrior, Rc, Result, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/validate_ids.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/validate_ids.rs index 3b1a0ee5..5588f8fb 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/validate_ids.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/validate_ids.rs @@ -1,5 +1,5 @@ -//! Functions: `validate_ids`, `validate_half`, `validate_values`, `reserve` and 10 more. -//! Split out of `qsa_index` to keep its files under the line limit. +//! Checks and device helpers shared by the QSA index path: finite and range checks of ids, halfwords and values, +//! bounded allocation, upload and download of device buffers, and driver/binding error mapping. use super::{ Context, DenseWeightCache, DeviceBuffer, DriverError, Error, InputBindingError, ModelBinding, QsaMatrixKind, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_prefill_batch/native_projection_row.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_prefill_batch/native_projection_row.rs index a3ad4853..4eef2e3d 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_prefill_batch/native_projection_row.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_prefill_batch/native_projection_row.rs @@ -1,5 +1,6 @@ -//! Methods of `NativeProjectionRow`: `validate`, `same_row`, `check_values`, `validate_fresh` and 7 more. -//! Functions: `native_error`, `native`, `project`, `chunk_owners` and 4 more. +//! One row of the native QSA prompt projections: the five projections (K, V, Q, index K, index Q) of a whole +//! micro-batch, split into per-row capabilities. Every row is checked as the chunk's own attention row, finite, +//! at consecutive positions. use super::{ AttentionRow, ChunkAttentionSlot, Context, DenseWeightCache, Error, GrRole, LayerId, ModelBinding, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_prefill_batch/projection_rows.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_prefill_batch/projection_rows.rs index a155312c..9984b500 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_prefill_batch/projection_rows.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_prefill_batch/projection_rows.rs @@ -1,5 +1,5 @@ -//! Methods of `NativeOutRow`: `take`. -//! Functions: `concat_mixed`, `check_batches`, `check_shapes`, `retained_matrices` and 6 more. +//! The Out projection of the native QSA prompt batch: gather the attended rows and gates, project them together +//! and hand each row its slice, with the batch shapes, finite checks and retained matrices checked on the way. use super::{ AttendedRows, BindingIdentity, Context, DenseWeightCache, DeviceBuffer, Error, LayerId, ModelBinding, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/router_scratch/gpu/report.rs b/crates/engine-qwen35-cuda/src/qwen_forward/router_scratch/gpu/report.rs index d1a886c0..4970af3d 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/router_scratch/gpu/report.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/router_scratch/gpu/report.rs @@ -1,5 +1,6 @@ -//! Methods of `Report`: `guard`, `compare`. -//! Functions: `valid_product`, `float_bytes`, `close_all`, `finish` and 12 more. +//! Original reference chain and result tally of the router scratch proof (GPU tests only). +//! Runs the original per-call projection and route with independent transport owners, snapshots the retained slots, +//! and records guards and comparisons in a `Report`. use super::{ Bf16ProjectionShape, Context, DeviceBuffer, Error, MATRIX_BYTES, Report, Result, RouterBuffers, map_driver_error, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/router_scratch/gpu/valid_reset.rs b/crates/engine-qwen35-cuda/src/qwen_forward/router_scratch/gpu/valid_reset.rs index 31ae8110..3771af48 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/router_scratch/gpu/valid_reset.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/router_scratch/gpu/valid_reset.rs @@ -1,5 +1,6 @@ -//! Methods of `Env`: `reset`, `project_refused`, `route_refused`, `project_refused_late`. Methods of `Held`: `release`. -//! Functions: `valid_reset`, `stage_buffers`, `install_workspace`, `open_proof` and 1 more. +//! Proof that the retained router scratch resets after valid, repeated and refused calls (GPU tests only). +//! Runs the original products first and the candidate over the repeat and reset order; refused inputs (non-finite, +//! wrong dimension, late NaN, foreign matrix, over budget) must leave every retained slot byte untouched. use super::{ Cell, Context, DeviceBuffer, EXTENTS, Error, MATRIX_BYTES, ROUTER_BYTES, Rc, Report, Result, RouterBuffers, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/gdn_chunk_start.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/gdn_chunk_start.rs index 79bd2f2b..3cb0b173 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/gdn_chunk_start.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/gdn_chunk_start.rs @@ -1,5 +1,6 @@ -//! Methods of `GdnChunkStart`: `prior`, `count`, `binding`, `validate_binding` and 2 more. -//! Methods of `GdnChunkRow`: `ordinal`, `identity`, `readout_key`, `matches_readout` and 1 more. +//! Accessors and validation of the capabilities a prefill chunk mints around the rolling GDN state: the chunk anchor, +//! its rows, micro windows and seal, and their construction from an Original prompt transaction. Each is checked +//! against the binding, layer extent and row cursor before the chunk accepts it. use super::{ BindingIdentity, ChunkAttentionRow, ChunkCommit, ChunkFfnRow, Error, GdnChunkAnchor, GdnChunkMicro, GdnChunkRow, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/host_charge_bounded.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/host_charge_bounded.rs index 9848d78b..39409dea 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/host_charge_bounded.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/host_charge_bounded.rs @@ -1,5 +1,6 @@ -//! Functions: `host_charge_bounded`. -//! Split out of `chunk` to keep its files under the line limit. +//! Host-memory charge of a prefill chunk of `tokens` rows ending at `end`: rolling state, attention and column +//! temporaries, row metadata and the MTP half-window readback. Refused above the caller's row limit or beyond the +//! served cells. use super::{Error, Rc, Result}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn.rs index 4a368b2b..1fca2742 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn.rs @@ -1,5 +1,6 @@ -//! Groups the submodules `qwen_chunk_txn_attention_sources`, `qwen_chunk_txn_begin`, `qwen_chunk_txn_ffn_after_atten... -//! Split out of `chunk` to keep its files under the line limit. +//! The `QwenChunkTxn` impl family, split by phase: begin, attention sources, layer batch, micro windows and inputs, +//! GDN micro windows, FFN after attention, rows and witnesses, finish and publish. The children share this import +//! list. use super::{ ActiveMicroWindow, AttentionProgress, AttentionSource, BatchProgress, ChunkAttentionRow, ChunkCommit, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn/qwen_chunk_txn_attention_sources.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn/qwen_chunk_txn_attention_sources.rs index b0308c5c..051c4925 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn/qwen_chunk_txn_attention_sources.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn/qwen_chunk_txn_attention_sources.rs @@ -1,5 +1,5 @@ -//! Methods of `QwenChunkTxn`: `check_attention_column`, `open_attention_sources`, `admit_row_ple`, `publish_attentio... -//! Defines `DeviceGdnFfn`. +//! Attention reads of a chunk layer: opens the per-row source slots, admits layer-one PLE history, mints the row +//! capability of each completed read and prepares the batch and FFN steps (host and device GDN) that consume it. use super::super::super::super::gr::DetachedGrRead; use super::{ diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn/qwen_chunk_txn_begin.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn/qwen_chunk_txn_begin.rs index e2532473..5213dba6 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn/qwen_chunk_txn_begin.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn/qwen_chunk_txn_begin.rs @@ -1,5 +1,6 @@ -//! Methods of `QwenChunkTxn`: `native_prefill_host_charge`, `begin`, `begin_windowed256`, `begin_bounded` and 9 more. -//! Functions: `prompt_origin`, `prompt_end`, `check_vocab`, `admit_prompt_host` and 1 more. Defines `PromptAdmission`. +//! Admission and start of a prefill chunk transaction: vocabulary, host-byte and device-budget checks, the rows with +//! their two predecessor tokens, and the phase queries. Normal serving caps a chunk at 64 rows; the windowed 256 form +//! is private. use super::{ AttentionProgress, BatchProgress, ChunkRowResidual, Dimension, Error, MicroProgress, ModelBinding, Position, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn/qwen_chunk_txn_ffn_after_attention.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn/qwen_chunk_txn_ffn_after_attention.rs index 9d5b6a47..77d3c021 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn/qwen_chunk_txn_ffn_after_attention.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn/qwen_chunk_txn_ffn_after_attention.rs @@ -1,5 +1,5 @@ -//! Methods of `QwenChunkTxn`: `ffn_after_attention_step`, `prepare_ffn_after_attention`, `check_edge_step`, `check_e... -//! Split out of `qwen_chunk_txn` to keep its files under the line limit. +//! The FFN step after an attention row: validates the row's batch proof, rolls the pending PLE, GDN and QSA history +//! into the next priors (or the device GDN edge) and prepares the FFN injection. #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] use super::super::super::super::{gr::DetachedGrRead, moe_expert::PreparedMoeRow}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn/qwen_chunk_txn_finish_publish.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn/qwen_chunk_txn_finish_publish.rs index f091b984..b11f5878 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn/qwen_chunk_txn_finish_publish.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn/qwen_chunk_txn_finish_publish.rs @@ -1,5 +1,6 @@ -//! Methods of `QwenChunkTxn`: `finish`, `check_finishable`, `witness_for`, `run_head` and 7 more. -//! Split out of `qwen_chunk_txn` to keep its files under the line limit. +//! End of a prefill chunk: every layer of every row must be complete, then the output head (or the known next token), +//! one finite residual witness per row, state slots valid at the end position and the joint target and draft +//! publication. use super::{ ChunkCommit, ChunkDraftPublication, ChunkRowResidual, Dimension, Error, GrRole, InjectedResidual, LayerId, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn/qwen_chunk_txn_gdn_micro.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn/qwen_chunk_txn_gdn_micro.rs index 9c54ed57..93b066a1 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn/qwen_chunk_txn_gdn_micro.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn/qwen_chunk_txn_gdn_micro.rs @@ -1,5 +1,6 @@ -//! Methods of `QwenChunkTxn`: `prepare_attention_device_gdn`, `gdn_micro_cursors_off`, `gdn_micro_start`, `build_gdn... -//! Split out of `qwen_chunk_txn` to keep its files under the line limit. +//! GDN micro windows of a prefill layer: the whole prompt GDN window completes before any row edge advances, then its +//! per-row products enter the journal; also the check and enlisting of prepared attention-output rows against their +//! causal proofs. #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] use super::super::super::super::{gdn::chunk_device::ChunkEdge, gr::DetachedGrRead}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn/qwen_chunk_txn_layer_batch.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn/qwen_chunk_txn_layer_batch.rs index 0ed34d29..b83f4edd 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn/qwen_chunk_txn_layer_batch.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn/qwen_chunk_txn_layer_batch.rs @@ -1,5 +1,5 @@ -//! Methods of `QwenChunkTxn`: `row_step`, `check_layer_row`, `layer`, `prepare_layer_batch` and 13 more. -//! Split out of `qwen_chunk_txn` to keep its files under the line limit. +//! Batched layer passes of a chunk: the row cursor of the unwindowed layer pass, opening and completing the batch of +//! a layer, minting `PreparedLayerRow` capabilities and checking batch outputs and FFN rows against their seals. use super::super::super::super::gdn::chunk_device::ChunkEdge; use super::{ diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn/qwen_chunk_txn_micro_inputs.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn/qwen_chunk_txn_micro_inputs.rs index faa83151..edafd15f 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn/qwen_chunk_txn_micro_inputs.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn/qwen_chunk_txn_micro_inputs.rs @@ -1,5 +1,6 @@ -//! Methods of `QwenChunkTxn`: `input`, `settle_failure`, `ple_micro_cursors_off`, `check_ple_micro` and 11 more. -//! Split out of `qwen_chunk_txn` to keep its files under the line limit. +//! Inputs of a micro window: the layer-one PLE window and the attention window, prepared row by row in causal order +//! while the GR reads complete as one device batch. No row capability is published until the whole batch has +//! completed. #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] use super::super::super::super::gr::{DetachedGrRead, GrMicroInput}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn/qwen_chunk_txn_micro_window.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn/qwen_chunk_txn_micro_window.rs index 53f727f2..cb2fe6d3 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn/qwen_chunk_txn_micro_window.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn/qwen_chunk_txn_micro_window.rs @@ -1,5 +1,5 @@ -//! Methods of `QwenChunkTxn`: `check_micro_open`, `micro_misaligned`, `phase_in_flight`, `micro_width` and 19 more. -//! Split out of `qwen_chunk_txn` to keep its files under the line limit. +//! Lifecycle of a micro window in a windowed chunk: open on an idle transaction at the cursor, close with the exact +//! minted capability once the range is computed, advance the cursors, and the QSA priors at the start of a window. use super::{ ActiveMicroWindow, ChunkMicroWindow, Context, Error, LayerId, Position, QsaIndexPrior, QwenChunkTxn, Rc, Result, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn/qwen_chunk_txn_rows_and_witness.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn/qwen_chunk_txn_rows_and_witness.rs index e7c676cc..ade75d12 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn/qwen_chunk_txn_rows_and_witness.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn/qwen_chunk_txn_rows_and_witness.rs @@ -1,5 +1,5 @@ -//! Methods of `QwenChunkTxn`: `qsa_prior_mismatch`, `validate_prompt_qsa_prior`, `original_session`, `rows` and 16 m... -//! Split out of `qwen_chunk_txn` to keep its files under the line limit. +//! Row ids, positions and residual witnesses of a chunk transaction (what an MTP draft reads), the begin and finish +//! of a GDN chunk, and the stage view of one row. use super::{ ChunkRowResidual, Error, GdnChunkAnchor, GdnChunkJournal, GdnChunkSeal, GdnChunkStart, GdnPrior, LayerId, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/test_gdn_component_rows.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/test_gdn_component_rows.rs index 45411d88..afc02aad 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/test_gdn_component_rows.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/test_gdn_component_rows.rs @@ -1,5 +1,5 @@ -//! Methods of `TestGdnComponentRows`: `new`, `start`, `row`, `seal`. -//! Split out of `chunk` to keep its files under the line limit. +//! Test-only GDN chunk journal of 65 fabricated rows over a given prior, so the chunk capabilities (start, row, seal) +//! can be exercised without a real chunk transaction. #[cfg(all(test, target_arch = "x86_64"))] use super::TestGdnComponentRows; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/txn_groups.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/txn_groups.rs index 14df878a..c8edd789 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/txn_groups.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/txn_groups.rs @@ -1,5 +1,5 @@ -//! Groups of cohesive fields of `QwenChunkTxn`, moved out of it by STRA-338 (size): the fields keep their declaration -//! order inside the transaction, so the drop order is unchanged. +//! Field groups of `QwenChunkTxn` by meaning (batch, attention and micro progress). Their order inside the +//! transaction fixes the drop order, so it must not change. use super::{ActiveMicroWindow, AttentionSource, LayerId, Rc}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/verify/qwen_chunk_txn.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/verify/qwen_chunk_txn.rs index 7e54be3a..0c4d8f60 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/verify/qwen_chunk_txn.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/verify/qwen_chunk_txn.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `qwen_chunk_txn_begin_verification`, `qwen_chunk_txn_verification_state`, `qwen_chunk_txn_v... -//! Split out of `verify` to keep its files under the line limit. +//! The `QwenChunkTxn` methods of MTP verification: starting a bounded window with its device GDN lease, the journal +//! of complete row states, and selecting and publishing the verified prefix. use super::{ ChunkCommit, ChunkRowResidual, Dimension, Error, GdnChunkAnchor, GdnChunkJournal, GdnPrior, GrRole, HOST_LIMIT, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/verify/qwen_chunk_txn/qwen_chunk_txn_begin_verification.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/verify/qwen_chunk_txn/qwen_chunk_txn_begin_verification.rs index e23ed76b..7ac97543 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/verify/qwen_chunk_txn/qwen_chunk_txn_begin_verification.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/verify/qwen_chunk_txn/qwen_chunk_txn_begin_verification.rs @@ -1,5 +1,6 @@ -//! Methods of `QwenChunkTxn`: `validate_verification_source`, `preflight_mtp_verification`, `begin_mtp_verification`... -//! Functions: `verification_total_charge`. Defines `ReplayInputs`. +//! Start of a verification window: validates the source target step, preflights the host charge and the device GDN +//! workspace, records the device GDN proofs and replays them into the canonical prior; also the layer-one PLE row +//! checks. use super::{ Dimension, Error, GdnChunkAnchor, GdnChunkJournal, GdnPrior, HOST_LIMIT, LayerId, ModelBinding, Position, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/verify/qwen_chunk_txn/qwen_chunk_txn_verification_state.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/verify/qwen_chunk_txn/qwen_chunk_txn_verification_state.rs index 5bcdf675..70eb3bda 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/verify/qwen_chunk_txn/qwen_chunk_txn_verification_state.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/verify/qwen_chunk_txn/qwen_chunk_txn_verification_state.rs @@ -1,5 +1,5 @@ -//! Methods of `QwenChunkTxn`: `record_gdn_prior`, `record_qsa_prior`, `record_verification_prior`, `validate_state_g... -//! Functions: `journal_state`, `journal_state_mut`. +//! Journal of the complete per-row states of a verification window (GDN, QSA, PLE priors at each row end), their +//! validation, and the window finish: the head on the actual row state and one residual witness per row. use super::{ ChunkRowResidual, Dimension, Error, GrRole, InjectedResidual, LayerId, Position, PrefixState, QwenChunkTxn, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/verify/qwen_chunk_txn/qwen_chunk_txn_verified_prefix.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/verify/qwen_chunk_txn/qwen_chunk_txn_verified_prefix.rs index 645db8a8..d47acc17 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/verify/qwen_chunk_txn/qwen_chunk_txn_verified_prefix.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/verify/qwen_chunk_txn/qwen_chunk_txn_verified_prefix.rs @@ -1,5 +1,6 @@ -//! Methods of `QwenChunkTxn`: `verified_prefix_seed`, `verified_rows`, `select_verified_prefix`, `prefix_mismatch` a... -//! Functions: `copy_streams`, `install_prefix`. +//! Selection and publication of the verified prefix: rows are accepted while their tokens follow the greedy heads +//! from the seed (a rejected tail is dropped), and the matching journaled state is installed in the session and the +//! draft. use super::{ ChunkCommit, ChunkRowResidual, Dimension, Error, LayerId, ModelBinding, Position, PrefixState, QwenChunkTxn, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/verify/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/verify/tests.rs index 09432b25..ab4401cc 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/verify/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/verify/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Pins the greedy accept rule (stops at the first rejection or EOS), the 512 MiB refusal of the verification journal +//! charge and that the PLE journal admits only the current layer-one GDN attention phase. use super::{ Dimension, Error, GdnChunkAnchor, GdnChunkStart, HOST_LIMIT, LayerId, PlePrior, Position, PrefixState, PromptInit, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/verify/verified_target_prefix.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/verify/verified_target_prefix.rs index e329e133..168b1746 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/verify/verified_target_prefix.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/verify/verified_target_prefix.rs @@ -1,5 +1,5 @@ -//! Methods of `VerifiedTargetPrefix`: `count`. Functions: `verification_extra_charge`, `greedy_prefix`. -//! Split out of `verify` to keep its files under the line limit. +//! The accepted-prefix decision of a verification window: the count, the extra host charge of the journaled states +//! and the pure greedy rule (a row is accepted while its token equals the previous head and is not EOS). use super::{Error, PrefixState, Rc, Result, TokenId, VerifiedTargetPrefix}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/draft/original_draft_checkpoint.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/draft/original_draft_checkpoint.rs index 4524ef8a..662a947e 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/draft/original_draft_checkpoint.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/draft/original_draft_checkpoint.rs @@ -1,5 +1,6 @@ -//! Methods of `OriginalDraftCheckpoint`: `host_bytes`. -//! Methods of `OriginalDraftSession`: `new`, `from_original_ring`, `validate`, `checkpoint` and 7 more. +//! The Original MTP draft session: its INT8 ring owner and immutable checkpoint, construction from the shared ring +//! layout, and lending the ring to the draft producer. Only a matching target origin may borrow it; it never advances +//! target state. use super::{ CompletedOriginalMtpDraft, Context, Error, ModelBinding, MtpInt8Snapshot, MtpOriginalInt8, OriginalDraftCheckpoint, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/draft/original_draft_session_ring_restore.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/draft/original_draft_session_ring_restore.rs index 6a929b89..6b2fc50b 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/draft/original_draft_session_ring_restore.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/draft/original_draft_session_ring_restore.rs @@ -1,5 +1,6 @@ -//! Methods of `OriginalDraftSession`: `with_mtp_current_ring`, `check_publication`, `prepare_publication`, `restore_... -//! Methods of `OriginalDraftPublication`: `publish_validated`. Implements `Drop for OriginalDraftSession`. +//! Publication and rollback of the draft ring: the receipt check of a completed MTP window, restore to a checkpoint, +//! reset to the empty prompt, conversation resume and rebinding to the target branch. An uncertain restore poisons +//! the owner. use super::{ CompletedDraftKv, DenseWeightCache, Error, ModelBinding, MtpInt8Snapshot, MtpOriginalInt8, OriginalDraftCheckpoint, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/draft/published_first_materialized.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/draft/published_first_materialized.rs index e5344008..c15fb17b 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/draft/published_first_materialized.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/draft/published_first_materialized.rs @@ -1,5 +1,5 @@ -//! Functions: `published_first_materialized`, `draft_driver_error`. -//! Split out of `draft` to keep its files under the line limit. +//! Ring bookkeeping after a prompt chunk: the lower bound of the cells the draft ring has materialized (a chunk that +//! continues the range keeps the earlier bound), and the mapping of driver errors of the draft. use super::{Error, Stage}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/original_prompt_input.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/original_prompt_input.rs index e0f11dad..a53e428a 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/original_prompt_input.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/original_prompt_input.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `original_prompt_input_qsa_seed`, `qwen_session`. -//! Split out of `original_prompt` to keep its files under the line limit. +//! The request input of an Original prompt and the session's checkpoint, park and restore over the resident QSA +//! layers. use super::{ DenseWeightCache, Dimension, Error, GdnPrior, LayerId, ModelBinding, OriginalPromptInput, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/original_prompt_input/original_prompt_input_qsa_seed.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/original_prompt_input/original_prompt_input_qsa_seed.rs index 008ff5ca..e01a528a 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/original_prompt_input/original_prompt_input_qsa_seed.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/original_prompt_input/original_prompt_input_qsa_seed.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalPromptInput`: `from_tokenized`, `len`, `window`. -//! Methods of `QwenSession`: `validate_resident_qsa_owner`, `original_qsa_seed`, `install_original_qsa_seed`, `seed_... +//! The tokenized request owner and the QSA seed of a session: prompt windows, installing the empty seed set into an +//! untouched session, and re-stamping checkpoints onto the session's current branch generation. use super::{ Dimension, Error, LayerId, ModelBinding, OriginalPromptInput, OriginalSessionCheckpoint, QsaIndexPrior, QsaOwner, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/original_prompt_input/qwen_session.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/original_prompt_input/qwen_session.rs index 4d2ec955..6d710f8f 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/original_prompt_input/qwen_session.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/original_prompt_input/qwen_session.rs @@ -1,5 +1,6 @@ -//! Methods of `QwenSession`: `check_resident_states`, `original_checkpoint`, `check_restore_slot`, `check_restore_sl... -//! Methods of `ParkedSession`: `next_position`, `host_bytes`. Defines `RestoredLayers`. +//! Checkpoint, restore and park of a `QwenSession` over its twelve resident QSA layers: saved witnesses are +//! validated, every layer is rolled back (all attempted, the first failure returned), and prefix-cache points and +//! blocks are exported or imported. use super::{ DenseWeightCache, Dimension, Error, GdnPrior, LayerId, ModelBinding, OriginalSessionCheckpoint, ParkedBlock, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/original_prompt_phase.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/original_prompt_phase.rs index 5db83df4..f80e781d 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/original_prompt_phase.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/original_prompt_phase.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalPromptPhase`: `validate_role`, `initialize`, `read`, `prepare_read` and 5 more. -//! Methods of `OriginalPromptRowKey`: `validate_initial`, `validate`, `phase`, `ordinal`. +//! The phase journal of an Original prompt window (which GR role may be read, injected or sealed next) and the row +//! keys that bind a source row to it. Shared only by authentic source rows and their producers. use super::{ BindingIdentity, DevicePhase, Dimension, Error, GrRole, InputReady, LayerId, OriginalPromptPhase, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/original_prompt_txn.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/original_prompt_txn.rs index e1709bbb..c6bbdf5b 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/original_prompt_txn.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/original_prompt_txn.rs @@ -1,5 +1,4 @@ -//! Groups the submodules `original_prompt_txn_begin`, `original_prompt_txn_prior_and_abort`, `original_prompt_txn_pu... -//! Split out of `original_prompt` to keep its files under the line limit. +//! The `OriginalPromptTxn` impl family: begin and queries, prior staging and abort, publication. use super::{ Cell, Context, DenseWeightCache, DevicePhase, Dimension, DraftRollback, Error, GdnPrior, GrRole, InputReady, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/original_prompt_txn/original_prompt_txn_begin.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/original_prompt_txn/original_prompt_txn_begin.rs index 67809fef..a93c3ce7 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/original_prompt_txn/original_prompt_txn_begin.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/original_prompt_txn/original_prompt_txn_begin.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalPromptTxn`: `begin`, `check`, `original_session`, `origin` and 14 more. -//! Methods of `OriginalPromptPhase`: `start`. +//! Start of an Original prompt transaction: checks of the session, window and vocabulary, its queries (origin, +//! positions, full prompt length, row keys) and the staging of input rows with the true token predecessors. use super::{ Cell, Context, DevicePhase, Dimension, Error, GrRole, InputReady, LayerId, ModelBinding, OriginalPromptInput, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/original_prompt_txn/original_prompt_txn_prior_and_abort.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/original_prompt_txn/original_prompt_txn_prior_and_abort.rs index f0fa27f2..4a56faf4 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/original_prompt_txn/original_prompt_txn_prior_and_abort.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/original_prompt_txn/original_prompt_txn_prior_and_abort.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalPromptTxn`: `gdn_start_prior`, `gdn_prior`, `stage_gdn`, `validate_ple_at` and 9 more. -//! Split out of `original_prompt_txn` to keep its files under the line limit. +//! Rolling GDN, PLE and QSA priors of a prompt transaction and their staging, and the abort: both physical restores +//! are attempted and the accepted target branch is read back from the session, never inferred. use super::{ DenseWeightCache, DraftRollback, Error, GdnPrior, GrRole, InputReady, LayerId, ModelBinding, OriginalPromptTxn, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/original_prompt_txn/original_prompt_txn_publish.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/original_prompt_txn/original_prompt_txn_publish.rs index 3bc72e0d..0e0530da 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/original_prompt_txn/original_prompt_txn_publish.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/original_prompt_txn/original_prompt_txn_publish.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalPromptTxn`: `validate_publish_inputs`, `publish_gdn_slot`, `check_qsa_seal`, `publish_qsa_slo... -//! Split out of `original_prompt_txn` to keep its files under the line limit. +//! Publication of a prompt transaction into the session: every GDN and QSA slot must stand at the end position with +//! its seal, and permits are prepared first so the state installation is infallible assignment. use super::super::super::super::qsa_index::prompt_device::resident_device::ResidentQsaPublication; use super::{ diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/original_verified/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/original_verified/tests.rs index fbeff6cb..1093ce3f 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/original_verified/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/original_verified/tests.rs @@ -1,4 +1,6 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Pins the verified-window publication: a refused one leaves the session untouched, rounds advance the lineage while +//! the recurrent state lags until the end-of-phase publication closes it, and priors of another owner or layer are +//! refused. use super::{Error, GdnPrior, OriginalVerifiedLineage, PlePrior, QwenSession, STATE_CAPACITY, predecessors_after}; use crate::model_binding::qwen4exp_input::BindingIdentity; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/qwen_session.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/qwen_session.rs index 5078e109..6d7c7a66 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/qwen_session.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/qwen_session.rs @@ -1,5 +1,5 @@ -//! Methods of `QwenSession`: `note_mtp_failure`, `finish_mtp_device`, `new`, `for_binding` and 11 more. -//! Functions: `layers_of_kind`. +//! `QwenSession` itself: the constructors (unbound, on a device), `begin` of a step transaction, the single commit +//! path `transact`, reset after CUDA completion and the MTP failure notes. use super::{ BindingIdentity, BoundLayerKind, Context, Error, GdnOwner, ModelBinding, PleOwner, Position, QsaOwner, QwenSession, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/qwen_step_txn.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/qwen_step_txn.rs index 5ad862ad..f735cd47 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/qwen_step_txn.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/qwen_step_txn.rs @@ -1,5 +1,4 @@ -//! Groups the submodules `qwen_step_txn_inputs`, `qwen_step_txn_prior_finish`. -//! Split out of `session` to keep its files under the line limit. +//! The `QwenStepTxn` impl family: the inputs and priors of a step, and its finish and commit. use super::{ BindingIdentity, Context, Dimension, Error, FiniteLogits, GdnPending, GdnPrior, GrRole, InjectedResidual, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/qwen_step_txn/qwen_step_txn_inputs.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/qwen_step_txn/qwen_step_txn_inputs.rs index 0a12d9c6..92af6e45 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/qwen_step_txn/qwen_step_txn_inputs.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/qwen_step_txn/qwen_step_txn_inputs.rs @@ -1,5 +1,5 @@ -//! Methods of `QwenStepTxn`: `token`, `position`, `residual_handoff_owner`, `validate_projection_branch` and 18 more. -//! Split out of `qwen_step_txn` to keep its files under the line limit. +//! Inputs and priors of one step transaction: token, position, binding checks, the staged input, and the PLE, GDN and +//! QSA priors with their staging. Nothing here updates committed history. use super::{ BindingIdentity, Context, Dimension, Error, GdnPending, GdnPrior, InputReady, LayerId, PlePending, PlePrior, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/qwen_step_txn/qwen_step_txn_prior_finish.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/qwen_step_txn/qwen_step_txn_prior_finish.rs index fd95e9c2..5331cecb 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/qwen_step_txn/qwen_step_txn_prior_finish.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/qwen_step_txn/qwen_step_txn_prior_finish.rs @@ -1,5 +1,5 @@ -//! Methods of `QwenStepTxn`: `qsa_prior`, `initial_qsa_prior`, `validate_qsa_prior`, `stage_qsa` and 8 more. -//! Functions: `next_ple`, `next_gdn`, `next_qsa`, `check_forward_output` and 1 more. +//! Completion of a step: QSA priors, layer-completion proofs, the finite-logits (or known-next prefill) finish and +//! `commit`, which alone publishes the next priors and advances one position, after the executor callback succeeded. use super::{ Dimension, Error, FiniteLogits, GdnPending, GdnPrior, GrRole, InjectedResidual, LayerId, PlePending, PlePrior, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/reset_replay_snapshot.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/reset_replay_snapshot.rs index 006c184a..5af738bc 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/reset_replay_snapshot.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/reset_replay_snapshot.rs @@ -1,5 +1,6 @@ -//! Methods of `ResetReplaySnapshot`: `has_prefix`, `numeric_eq`, `same_shape`, `retained_bytes`. -//! Methods of `QwenSession`: `oracle_capture_committed`, `validate_reset_states`, `validate_reset_ple`, `validate_re... +//! `ResetReplaySnapshot`, the retained numerical copy of a session used by the reset-replay proofs, with its +//! comparison, and the session's oracle capture of the committed state and validation of the retained priors after a +//! reset. #[cfg(all(test, target_arch = "x86_64"))] use super::ResetReplaySnapshot; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/tests.rs index bcd7ac97..e5e06d4b 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Pins the single-step session: commit advances every owner once, failure leaves the committed state untouched, and +//! the PLE, GDN and QSA priors keep their exact identity (child modules); the helpers build tokens and positions. use super::{ Error, GdnOwner, GdnPending, GdnPrior, InputReady, LayerId, PleOwner, PlePending, PlePrior, Position, QsaIndexPrior, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/tests/gdn_session_commit_advances_all.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/tests/gdn_session_commit_advances_all.rs index 4a8ea199..c62b2b80 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/tests/gdn_session_commit_advances_all.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/tests/gdn_session_commit_advances_all.rs @@ -1,8 +1,6 @@ -//! Tests of tests by topic (moved out of the test file by STRA-338): -//! gdn_session_commit_advances_all_state_once_and_failed_reset_preserves_owner, -//! full_forward_guard_refuses_skipped_layers_missing_logits_and_wrong_callback_token, -//! context_seam_missing_owner_refuses_after_identity_checks, context_seam_wrong_thread_refuses_before_backend_access -//! .... +//! Pins session commit semantics: a commit advances all GDN state once, a failed reset keeps the owner, the +//! full-forward guard and the context seam refuse skipped layers, wrong tokens, threads and CUDA failures, and +//! predecessors advance oldest first. use super::{ BindingIdentity, Dimension, Error, GdnPending, InputReady, LayerId, QwenSession, Rc, Stage, TokenId, TokenLayer, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/tests/retained_gr_handoff_identity.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/tests/retained_gr_handoff_identity.rs index f35ba114..e72c1cc8 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/tests/retained_gr_handoff_identity.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/tests/retained_gr_handoff_identity.rs @@ -1,8 +1,6 @@ -//! Tests of tests by topic (moved out of the test file by STRA-338): -//! retained_gr_handoff_identity_is_lazy_and_refuses_same_position_rebegin, -//! headfree_prefill_refuses_metadata_completion_without_actual_final_producer, -//! headfree_prefill_refuses_zero_layer_fixture_and_preserves_history, -//! qsa_session_prior_is_private_and_required_state_cannot_be_skipped .... +//! Pins prior identity in the session: the retained GR handoff is lazy and refuses a same-position rebegin, head-free +//! prefill needs a real final producer, priors are private, a late failure discards candidates and a reset fences old +//! generations. use super::{ BindingIdentity, Dimension, Error, GdnOwner, GdnPending, GdnPrior, InputReady, LayerId, PleOwner, PlePending, diff --git a/crates/engine-qwen35-cuda/src/serve_meta/tests.rs b/crates/engine-qwen35-cuda/src/serve_meta/tests.rs index 7dcb9731..2446146e 100644 --- a/crates/engine-qwen35-cuda/src/serve_meta/tests.rs +++ b/crates/engine-qwen35-cuda/src/serve_meta/tests.rs @@ -1,4 +1,6 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Pins the start-up meta lines: they match the golden sample byte for byte, each is one section of single-blank +//! separated key=value tokens, an unset profile prints as `none`, values cannot split a token, the values hash +//! follows only the values, model files are statted and never read, and formatting is deterministic. use super::{ BuildInfo, CacheFacts, ConfigFacts, MODEL_DIGEST_MAPPING, ModelFile, ModelInfo, Path, ProfileInfo, cache_line, diff --git a/crates/engine-qwen35-cuda/src/serve_tuning/tests.rs b/crates/engine-qwen35-cuda/src/serve_tuning/tests.rs index c7c5c7ac..d478f834 100644 --- a/crates/engine-qwen35-cuda/src/serve_tuning/tests.rs +++ b/crates/engine-qwen35-cuda/src/serve_tuning/tests.rs @@ -1,3 +1,7 @@ +//! Pins run-time tuning: an empty or unknown document is refused, valid values apply and name the changed members, +//! invalid values change nothing, the resident K/V window is accepted only at its value in force, the prefix cache +//! can be switched off and on, and `describe` reports the engine's defaults. + use super::{OriginalServeOptions, PrefixCacheOptions, PrefixTail, Tuning, describe}; fn base() -> (OriginalServeOptions, u32) { diff --git a/crates/engine-qwen35-cuda/src/settings/capture_tests.rs b/crates/engine-qwen35-cuda/src/settings/capture_tests.rs index 9b9ea93b..567bf617 100644 --- a/crates/engine-qwen35-cuda/src/settings/capture_tests.rs +++ b/crates/engine-qwen35-cuda/src/settings/capture_tests.rs @@ -1,3 +1,7 @@ +//! Pins the settings capture: only the operator namespace of the environment is captured, raw values are kept, an +//! empty environment gives every topic's defaults, and the conversation-cache and memory-governor keys are read +//! from the capture. + use super::{EnvSource, MapEnv, ServeSettings, Settings}; #[test] From f62f1762e2dc500c86b3e80229535da8c48eed91 Mon Sep 17 00:00:00 2001 From: Pavlo Ratushnyi Date: Sat, 14 Nov 2026 21:23:09 +0100 Subject: [PATCH 07/10] engine crates: open_cache_steps split off open_phase_steps, rustfmt, engine-core without #[allow(unused_imports)], baselines lowered (glob 70 -> 0, allow 166 -> 0 in the engine, 18 -> 0 in engine-core) Co-Authored-By: Claude Sonnet 5.5 --- architecture-baseline.json | 3 - crates/engine-core/src/conversation/cache.rs | 2 - crates/engine-core/src/conversation/kv.rs | 14 -- .../engine-core/src/conversation/manager.rs | 3 - .../src/conversation/manager_tests.rs | 14 -- .../src/conversation/snapshot_tests.rs | 16 -- crates/engine-core/src/prefix_cache/store.rs | 1 - .../src/prefix_cache/store/decayed.rs | 1 - .../prefix_store_evict_and_budget.rs | 2 +- crates/engine-core/src/prompt.rs | 3 - crates/engine-core/src/spec/adaptive.rs | 4 - .../combined_changed_boundary_proof.rs | 4 +- .../combined_changed_boundary_proof/rig.rs | 4 +- .../src/backend/native_down_public_pair.rs | 4 +- .../long_public_preflight.rs | 2 +- .../original_serve/runner/owner_run_steps.rs | 10 +- .../src/backend/original_serve_laptop.rs | 4 +- .../src/backend/original_serve_replay.rs | 4 +- .../src/backend/original_serve_smoke.rs | 4 +- .../original_serve_smoke/smoke_long.rs | 4 +- .../original_serve_smoke/smoke_main.rs | 4 +- .../original_serve_smoke/smoke_main/corpus.rs | 2 +- .../src/backend/original_serve_ttft.rs | 4 +- .../src/backend/serve_generate.rs | 4 +- .../src/conversation/memory.rs | 1 - .../engine-qwen35-cuda/src/memory_governor.rs | 4 +- .../qwen4exp_input/mtp/backing.rs | 2 +- .../qwen4exp_input/mtp/mtp_kind_types.rs | 1 - .../qwen4exp_input/mtp/mtp_weight_reads.rs | 6 +- .../qwen4exp_input/mtp/read_expert_rows.rs | 2 +- .../qwen4exp_input/validate_ple_descriptor.rs | 4 +- .../qwen4exp_kar_ple/inherited_kar_archive.rs | 4 +- .../load_pinned_inherited_archive.rs | 4 +- .../qwen4exp_kar_ple/pinned_profile.rs | 6 +- .../qwen4exp_kar_ple/pinned_profile_tests.rs | 2 +- .../private_copy/checked_reader.rs | 2 +- .../qwen4exp_kar_ple/private_copy/inode.rs | 4 +- .../dense_weight_cache/workspaces.rs | 4 +- .../original_prompt/staged_input_enabled.rs | 1 - .../qwen_forward/executor/prefill_chunk.rs | 4 +- .../prefill_chunk/qwen_forward/joint_chunk.rs | 4 +- .../prefill_chunk_cached_windowed.rs | 4 +- .../qwen_forward/prefill_chunk_planned.rs | 8 +- .../prefill_chunk_planned/chunk_layer.rs | 4 +- .../prefill_chunk_planned/chunk_setup.rs | 4 +- .../prefill_chunk_planned/window_attention.rs | 8 +- .../prefill_chunk/read_chunk_attention_ffn.rs | 2 +- .../src/qwen_forward/executor/qwen_forward.rs | 2 +- .../src/qwen_forward/executor/step_layers.rs | 4 +- .../src/qwen_forward/gdn.rs | 1 - .../src/qwen_forward/gdn/cached_step.rs | 4 +- .../chunk_device/gdn_chunk_device_methods.rs | 9 +- .../chunk_device_batch_compute.rs | 4 +- .../gdn/chunk_device/numeric_gpu.rs | 6 +- .../src/qwen_forward/gdn/driver_error.rs | 2 +- .../src/qwen_forward/gr/retained_handoff.rs | 4 +- .../ple_transport/ple_inner_composition.rs | 4 +- .../ple_transport/ple_key_retained_gpu.rs | 4 +- .../ple_key_retained_gpu/bf16.rs | 4 +- .../moe_expert/expert_matrix_projection.rs | 8 +- .../moe_expert/grouped/bound_rows.rs | 4 +- .../moe_expert/grouped/direct_gpu.rs | 4 +- .../moe_expert/grouped/direct_packets_fns.rs | 4 +- .../grouped/ordered_down_refusal.rs | 4 +- .../packet_run_project_group_direct.rs | 4 +- .../grouped/project_group_source_consumers.rs | 4 +- .../src/qwen_forward/moe_expert/tests.rs | 2 +- .../src/qwen_forward/moe_weight_cache.rs | 4 +- .../moe_weight_cache/cache_lru_index/tests.rs | 2 +- .../moe_weight_cache/cache_profile_fill.rs | 4 +- .../cache_profile_fill/moe_weight_cache.rs | 4 +- .../pinned_triplet_preload.rs | 8 +- .../cache_profile_fill/profile_build.rs | 4 +- .../shared_quartet_preload.rs | 4 +- .../src/qwen_forward/mtp/kv_only.rs | 2 +- .../mtp/state/prefix_draft_snapshot.rs | 2 +- .../mtp_decode/batch_gpu/check_loaded.rs | 4 +- .../mtp_decode/first_seed_reuse_enabled.rs | 2 +- .../qwen_forward/mtp_decode/mtp_decoder.rs | 6 +- .../mtp_decoder/batched_window_plan.rs | 4 +- .../fixed_workspace/fixed_workspace_gpu.rs | 27 +-- .../mtp_experts/fixed_workspace/role.rs | 4 +- .../fixed_workspace/transport_drop.rs | 4 +- .../mtp_expert_transport_gpu.rs | 4 +- .../mtp_expert_transport_gpu/exact.rs | 4 +- .../mtp_expert_transport/shared_project.rs | 8 +- .../original_serve_config/tests.rs | 4 +- .../original_serve_engine/draft_completion.rs | 2 +- .../src/qwen_forward/original_serve_host.rs | 4 +- .../original_serve_pool/pool_layer_trace.rs | 2 +- .../qwen_forward/original_serve_pool/tests.rs | 2 +- .../qwen_forward/original_serve_request.rs | 2 +- .../qwen_forward/original_serve_residency.rs | 4 +- .../original_serve_residency/open_tier.rs | 10 +- .../conversation/tests.rs | 3 +- .../original_serve_stack_methods.rs | 5 +- .../open_cache_steps.rs | 157 +++++++++++++++++ .../open_phase_steps.rs | 160 +----------------- .../original_spec_controller/tests.rs | 4 +- .../tests/config_rejects_out_of_range.rs | 4 +- .../output/output_stage_test_replay.rs | 4 +- .../src/qwen_forward/qsa_attention.rs | 2 +- .../src/qwen_forward/qsa_index/context.rs | 8 +- .../qwen_forward/qsa_index/index_resident.rs | 4 +- .../qsa_index/index_resident/max_rows.rs | 4 +- .../qwen_forward/qsa_index/qsa_index_stage.rs | 4 +- .../qwen_forward/session/original_prompt.rs | 6 +- .../src/qwen_forward/session/tests.rs | 4 +- 108 files changed, 359 insertions(+), 425 deletions(-) create mode 100644 crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/open_cache_steps.rs diff --git a/architecture-baseline.json b/architecture-baseline.json index 70adb3d2..1ec22606 100644 --- a/architecture-baseline.json +++ b/architecture-baseline.json @@ -5,8 +5,6 @@ "source": { "allow-unused-imports:leleka-cpu-sys": 35, "allow-unused-imports:leleka-cuda-driver": 410, - "allow-unused-imports:leleka-engine-core": 18, - "allow-unused-imports:leleka-engine-qwen35-cuda": 166, "allow-unused-imports:leleka-experimental-ref": 1, "allow-unused-imports:leleka-harmony": 2, "allow-unused-imports:leleka-igpu": 2, @@ -47,7 +45,6 @@ "env-read:leleka-tokenizer": 2, "env-read:strata-control": 3, "glob-super-import:leleka-cuda-driver": 3, - "glob-super-import:leleka-engine-qwen35-cuda": 70, "instant-now:leleka-cpu-worker": 9, "instant-now:leleka-cuda-driver": 25, "instant-now:leleka-engine-qwen35-cuda": 16, diff --git a/crates/engine-core/src/conversation/cache.rs b/crates/engine-core/src/conversation/cache.rs index fc713640..14df98fa 100644 --- a/crates/engine-core/src/conversation/cache.rs +++ b/crates/engine-core/src/conversation/cache.rs @@ -120,8 +120,6 @@ pub struct ConversationCache { mod tests; mod conversation_checkpoint; -#[allow(unused_imports)] pub use conversation_checkpoint::conversation_prefix; -#[allow(unused_imports)] pub use conversation_checkpoint::prefix_len; mod conversation_cache; diff --git a/crates/engine-core/src/conversation/kv.rs b/crates/engine-core/src/conversation/kv.rs index 45b44a82..5b2522b9 100644 --- a/crates/engine-core/src/conversation/kv.rs +++ b/crates/engine-core/src/conversation/kv.rs @@ -45,29 +45,15 @@ struct Verifier<'a> { } mod layout; -#[allow(unused_imports)] pub use layout::kv_bytes; -#[allow(unused_imports)] pub use layout::kv_capture_bytes; -#[allow(unused_imports)] -use layout::kv_q4_bytes_per_head; -#[allow(unused_imports)] use layout::layout; -#[allow(unused_imports)] use layout::region; -#[allow(unused_imports)] use layout::transfer_err; -#[allow(unused_imports)] use layout::valid; -#[allow(unused_imports)] -use layout::valid_extent; mod kv_image_save_restore; -#[allow(unused_imports)] pub use kv_image_save_restore::kv_restore; -#[allow(unused_imports)] pub use kv_image_save_restore::kv_save; -#[allow(unused_imports)] pub use kv_image_save_restore::kv_validate; mod kv_image_readback; -#[allow(unused_imports)] pub use kv_image_readback::kv_verify; diff --git a/crates/engine-core/src/conversation/manager.rs b/crates/engine-core/src/conversation/manager.rs index 70a11c90..d5da37e4 100644 --- a/crates/engine-core/src/conversation/manager.rs +++ b/crates/engine-core/src/conversation/manager.rs @@ -113,10 +113,7 @@ pub struct ConversationManager { } mod conversation_options_default; -#[allow(unused_imports)] pub use conversation_options_default::images_below; -#[allow(unused_imports)] use conversation_options_default::is_allocation; -#[allow(unused_imports)] pub use conversation_options_default::starts_with; mod conversation_manager; diff --git a/crates/engine-core/src/conversation/manager_tests.rs b/crates/engine-core/src/conversation/manager_tests.rs index 8a5968f2..7db74a4a 100644 --- a/crates/engine-core/src/conversation/manager_tests.rs +++ b/crates/engine-core/src/conversation/manager_tests.rs @@ -61,24 +61,10 @@ mod continuing_chat_reuses; mod random_traffic_resumes_into_exact_prefix_state; mod hash; -#[allow(unused_imports)] -use hash::hash; -#[allow(unused_imports)] use hash::idx; -#[allow(unused_imports)] -use hash::pat; -#[allow(unused_imports)] -use hash::pattern; mod sim_device_session_device; -#[allow(unused_imports)] use sim_device_session_device::ReplayedRequest; -#[allow(unused_imports)] use sim_device_session_device::chat; -#[allow(unused_imports)] use sim_device_session_device::gen_tokens; -#[allow(unused_imports)] use sim_device_session_device::options; -#[allow(unused_imports)] -use sim_device_session_device::prompt_options; -#[allow(unused_imports)] use sim_device_session_device::world; diff --git a/crates/engine-core/src/conversation/snapshot_tests.rs b/crates/engine-core/src/conversation/snapshot_tests.rs index ea1811bb..dd77699a 100644 --- a/crates/engine-core/src/conversation/snapshot_tests.rs +++ b/crates/engine-core/src/conversation/snapshot_tests.rs @@ -57,34 +57,18 @@ struct Pools { mod layer_snapshots_are_byte_exact; mod kv_region; -#[allow(unused_imports)] use kv_region::equal; -#[allow(unused_imports)] pub(super) use kv_region::kv_region; -#[allow(unused_imports)] use kv_region::mk_view; -#[allow(unused_imports)] use kv_region::q4_per_head; mod kv_level; -#[allow(unused_imports)] use kv_level::kv_level; mod full_session; -#[allow(unused_imports)] use full_session::full_session; mod fixture; mod pools; -#[allow(unused_imports)] use fixture::fixture; mod golden_state; -#[allow(unused_imports)] -use golden_state::assert_checkpoint; -#[allow(unused_imports)] use golden_state::assert_image; -#[allow(unused_imports)] use golden_state::assert_kv; -#[allow(unused_imports)] -use golden_state::fnv; -#[allow(unused_imports)] -use golden_state::fnv_buf; -#[allow(unused_imports)] use golden_state::golden_state; diff --git a/crates/engine-core/src/prefix_cache/store.rs b/crates/engine-core/src/prefix_cache/store.rs index 7a09fb52..b895c66f 100644 --- a/crates/engine-core/src/prefix_cache/store.rs +++ b/crates/engine-core/src/prefix_cache/store.rs @@ -201,5 +201,4 @@ mod tests; mod decayed; mod policy_params_default; mod prefix_store; -#[allow(unused_imports)] use decayed::decayed; diff --git a/crates/engine-core/src/prefix_cache/store/decayed.rs b/crates/engine-core/src/prefix_cache/store/decayed.rs index ac306720..3b0bf7b9 100644 --- a/crates/engine-core/src/prefix_cache/store/decayed.rs +++ b/crates/engine-core/src/prefix_cache/store/decayed.rs @@ -1,6 +1,5 @@ //! Half-life decay of a hit mass or prior with age, shared by the store's value estimate. - pub(super) fn decayed(value: f64, age: u64, half_life: f64) -> f64 { if value == 0.0 { 0.0 } else { value * 0.5f64.powf(age as f64 / half_life) } } diff --git a/crates/engine-core/src/prefix_cache/store/prefix_store/prefix_store_evict_and_budget.rs b/crates/engine-core/src/prefix_cache/store/prefix_store/prefix_store_evict_and_budget.rs index 8cd67ed9..5bc56679 100644 --- a/crates/engine-core/src/prefix_cache/store/prefix_store/prefix_store_evict_and_budget.rs +++ b/crates/engine-core/src/prefix_cache/store/prefix_store/prefix_store_evict_and_budget.rs @@ -1,9 +1,9 @@ //! Removal from the prefix store: enforcing the byte budget, aborting a candidate, evicting a node together with the //! blocks only it covered, orphan release, clearing, and the invariant check. -use super::{ByteSize, Candidate, HashSet, Node, PrefixStore}; #[cfg(any(test, feature = "testing"))] use super::HashMap; +use super::{ByteSize, Candidate, HashSet, Node, PrefixStore}; impl PrefixStore { pub(in super::super) fn enforce_budget(&mut self, fresh: u64) { diff --git a/crates/engine-core/src/prompt.rs b/crates/engine-core/src/prompt.rs index 25ad9e49..8c291099 100644 --- a/crates/engine-core/src/prompt.rs +++ b/crates/engine-core/src/prompt.rs @@ -139,9 +139,6 @@ mod grid_tests; #[path = "prompt/prompt_options.rs"] mod prompt_options; -#[allow(unused_imports)] pub use prompt_options::choose_auto_capacity; -#[allow(unused_imports)] pub use prompt_options::drive; -#[allow(unused_imports)] pub use prompt_options::request_capacity; diff --git a/crates/engine-core/src/spec/adaptive.rs b/crates/engine-core/src/spec/adaptive.rs index 09209276..f41220cb 100644 --- a/crates/engine-core/src/spec/adaptive.rs +++ b/crates/engine-core/src/spec/adaptive.rs @@ -192,13 +192,9 @@ pub struct SpecStats { mod tests; mod adaptive_config; -#[allow(unused_imports)] use adaptive_config::logit; -#[allow(unused_imports)] use adaptive_config::m_bucket; -#[allow(unused_imports)] use adaptive_config::p_bucket; -#[allow(unused_imports)] use adaptive_config::sigmoid; mod adaptive_policy; mod decide; diff --git a/crates/engine-qwen35-cuda/src/backend/combined_changed_boundary_proof.rs b/crates/engine-qwen35-cuda/src/backend/combined_changed_boundary_proof.rs index b9ca28c8..5edc3b16 100644 --- a/crates/engine-qwen35-cuda/src/backend/combined_changed_boundary_proof.rs +++ b/crates/engine-qwen35-cuda/src/backend/combined_changed_boundary_proof.rs @@ -1,10 +1,10 @@ //! Private sole new changed-path model gate; actual source identity/load preserved. +#[cfg(feature = "preview-path")] +use super::{DenseWeightCache, KarPleCache, MoeWeightCache, OutputStage, QwenForward, QwenSession}; use super::{ Driver, EvaluationExecution, InheritedKarArchive, ModelBinding, PathBuf, Qwen4ExpArtifact, Rc, SHARD0, SHARD1, Tokenizer, VerifiedGgufFile, }; -#[cfg(feature = "preview-path")] -use super::{DenseWeightCache, KarPleCache, MoeWeightCache, OutputStage, QwenForward, QwenSession}; use crate::qwen_forward::loaded_target_owners::LoadedTargetOwners as LoadedTarget; use std::env; pub(super) mod rig; diff --git a/crates/engine-qwen35-cuda/src/backend/combined_changed_boundary_proof/rig.rs b/crates/engine-qwen35-cuda/src/backend/combined_changed_boundary_proof/rig.rs index e09f59d2..3126edcd 100644 --- a/crates/engine-qwen35-cuda/src/backend/combined_changed_boundary_proof/rig.rs +++ b/crates/engine-qwen35-cuda/src/backend/combined_changed_boundary_proof/rig.rs @@ -1,11 +1,11 @@ //! The loaded real owners the single-load GPU proofs share: the pinned binding over the inherited sealed archive, //! the device owners built on one bounded Context, a phase run on a fresh target owner, and the teardown whose //! results are asserted only after every attempt was made. Opening and scheduling stay with each proof. +#[cfg(feature = "preview-path")] +use super::{DenseWeightCache, KarPleCache, MoeWeightCache, OutputStage, QwenSession}; use super::{ InheritedKarArchive, ModelBinding, PathBuf, Qwen4ExpArtifact, Rc, SHARD0, SHARD1, Tokenizer, VerifiedGgufFile, }; -#[cfg(feature = "preview-path")] -use super::{DenseWeightCache, KarPleCache, MoeWeightCache, OutputStage, QwenSession}; use std::{ env, panic::{AssertUnwindSafe, catch_unwind}, diff --git a/crates/engine-qwen35-cuda/src/backend/native_down_public_pair.rs b/crates/engine-qwen35-cuda/src/backend/native_down_public_pair.rs index 94be2c58..07f0b859 100644 --- a/crates/engine-qwen35-cuda/src/backend/native_down_public_pair.rs +++ b/crates/engine-qwen35-cuda/src/backend/native_down_public_pair.rs @@ -1,4 +1,6 @@ //! One-load private PUBLIC generation pair; actual owner timings, never HTTP timings. +#[cfg(test)] +use super::prepare_prompt; use super::{ AtomicBool, CacheCounts, Digest, Driver, Duration, EvaluationExecution, EvaluationMeasurement, FRAME_LIMIT, FinishReason, Generation, GenerationEvent, GenerationFailure, GenerationRequest, GenerationSink, GenerationStream, @@ -8,8 +10,6 @@ use super::{ }; #[cfg(feature = "preview-path")] use super::{DenseWeightCache, KarPleCache, MoeWeightCache, OutputStage, QwenSession}; -#[cfg(test)] -use super::prepare_prompt; use serde_json::{Value, json}; use std::{ env, diff --git a/crates/engine-qwen35-cuda/src/backend/native_down_public_pair/long_public_preflight.rs b/crates/engine-qwen35-cuda/src/backend/native_down_public_pair/long_public_preflight.rs index eb3e3e64..9d28f1a3 100644 --- a/crates/engine-qwen35-cuda/src/backend/native_down_public_pair/long_public_preflight.rs +++ b/crates/engine-qwen35-cuda/src/backend/native_down_public_pair/long_public_preflight.rs @@ -1,5 +1,6 @@ //! Offline/private producer; call with the actual already-bound model tokenizer. //! No asset opening, model hash scan, GPU allocation or inference occurs here. +use leleka_gateway_text::prompt as public_renderer; use leleka_tokenizer::Tokenizer; use serde_json::{Value, json}; use sha2::{Digest, Sha256}; @@ -9,7 +10,6 @@ use std::{ os::unix::fs::OpenOptionsExt, path::Path, }; -use leleka_gateway_text::prompt as public_renderer; const BYTE_CAP: usize = 1024 * 1024; const ARTIFACT_CAP: usize = 16 * 1024 * 1024; const CONTEXT: usize = 262144; diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve/runner/owner_run_steps.rs b/crates/engine-qwen35-cuda/src/backend/original_serve/runner/owner_run_steps.rs index f740d369..e95d15bd 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve/runner/owner_run_steps.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve/runner/owner_run_steps.rs @@ -2,11 +2,11 @@ //! sweep idle sessions and close everything; early exits stay in `run`. use super::{ - QUEUE, ActiveGuard, AtomicBool, BackendError, ClientLink, DeferredTail, ErrorCode, GenerationFailure, - GenerationRequest, GenerationSink, GenerationTerminal, IdleSweep, LoadedModel, LoadPhase, ModelBinding, Ordering, - OriginalServeOptions, OriginalServeStack, PathBuf, Rc, Reply, RequestToServe, Shared, SystemClock, Tokenizer, - TokenVocabulary, context_fits, emit_terminal, exhausted, generate, invalid, load_failure, meta_facts, open_error, - prepare_prompt, publish_prefix_summary, stack_config, unavailable, + ActiveGuard, AtomicBool, BackendError, ClientLink, DeferredTail, ErrorCode, GenerationFailure, GenerationRequest, + GenerationSink, GenerationTerminal, IdleSweep, LoadPhase, LoadedModel, ModelBinding, Ordering, + OriginalServeOptions, OriginalServeStack, PathBuf, QUEUE, Rc, Reply, RequestToServe, Shared, SystemClock, + TokenVocabulary, Tokenizer, context_fits, emit_terminal, exhausted, generate, invalid, load_failure, meta_facts, + open_error, prepare_prompt, publish_prefix_summary, stack_config, unavailable, }; use leleka_backend_api::GenerationStream; use leleka_cuda_driver::Context; diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_laptop.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_laptop.rs index 3b521e32..5edc97f3 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_laptop.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_laptop.rs @@ -27,7 +27,9 @@ //! //! Run: `cargo test -p leleka-engine-qwen35-cuda --features cuda-driver[,sm86] --release -- --ignored --nocapture //! original_serve_laptop_bench`. -use super::{Driver, InheritedKarArchive, ModelBinding, PathBuf, Qwen4ExpArtifact, Rc, SHARD0, SHARD1, VerifiedGgufFile}; +use super::{ + Driver, InheritedKarArchive, ModelBinding, PathBuf, Qwen4ExpArtifact, Rc, SHARD0, SHARD1, VerifiedGgufFile, +}; use crate::qwen_forward::{ original_serve_engine::ServeOutcome, original_serve_request::{ServeError, ServeRequest}, diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_replay.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_replay.rs index 42ab06d4..0d5f3300 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_replay.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_replay.rs @@ -30,7 +30,9 @@ //! //! Run (inside a holder job): ` --ignored --nocapture original_serve_replay_smoke`. use super::super::qwen_forward::original_serve_stack::dbg_el; -use super::{Driver, InheritedKarArchive, ModelBinding, PathBuf, Qwen4ExpArtifact, Rc, SHARD0, SHARD1, VerifiedGgufFile}; +use super::{ + Driver, InheritedKarArchive, ModelBinding, PathBuf, Qwen4ExpArtifact, Rc, SHARD0, SHARD1, VerifiedGgufFile, +}; use crate::qwen_forward::{ original_serve_request::{ServeError, ServeRequest}, original_serve_stack::{OriginalServeStack, PrefixBudget, PrefixConfig, StackConfig}, diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_smoke.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_smoke.rs index 1db20934..49346a98 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_smoke.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_smoke.rs @@ -25,12 +25,12 @@ //! While the verifier window producers listed in `UNBOUND_PRODUCERS` are unbound the stack refuses to open //! with the first missing producer's name; that refusal is the expected result of this smoke until they land. use super::super::qwen_forward::original_serve_stack::dbg_el; +#[cfg(all(test, target_arch = "x86_64"))] +use super::original_serve_arms; use super::{ Driver, InheritedKarArchive, ModelBinding, PathBuf, Qwen4ExpArtifact, Rc, SHARD0, SHARD1, Tokenizer, VerifiedGgufFile, }; -#[cfg(all(test, target_arch = "x86_64"))] -use super::original_serve_arms; use crate::qwen_forward::{ original_serve_request::{RequestSampling, ServeError, ServeRequest}, original_serve_stack::{OriginalServeStack, StackConfig}, diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_long.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_long.rs index 5e2c4335..d6bea2b6 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_long.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_long.rs @@ -1,11 +1,11 @@ //! Long-context smoke of the streamed INT8 KV: one greedy request over a prompt far longer than the resident //! window (documented on `original_serve_long_context_streamed_kv_smoke`). +#[cfg(all(test, target_arch = "x86_64"))] +use super::original_serve_arms; use super::{ OriginalServeStack, PathBuf, ServeRequest, StackConfig, Tokenizer, collect, dbg_el, env, env_or, ids, number, open_pinned, open_stack, request, with_context, }; -#[cfg(all(test, target_arch = "x86_64"))] -use super::original_serve_arms; use std::time::Instant; const COLORS: [&str; 8] = ["amber", "blue", "crimson", "green", "grey", "ivory", "orange", "violet"]; diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_main.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_main.rs index 017e513c..5fe4d668 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_main.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_main.rs @@ -1,11 +1,11 @@ //! The main smoke: greedy twice across a reset, a sampled request, a cancellation, the optional parity corpus //! and a short prompt on the scalar draft-KV path. +#[cfg(all(test, target_arch = "x86_64"))] +use super::original_serve_arms; use super::{ OriginalServeStack, PROMPT, PathBuf, ServeError, ServeRequest, StackConfig, Tokenizer, agent_sampler, collect, dbg_el, env, env_or, open_pinned, open_stack, optin, report_timing, request, with_context, }; -#[cfg(all(test, target_arch = "x86_64"))] -use super::original_serve_arms; mod corpus; diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_main/corpus.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_main/corpus.rs index 7219897f..a79db841 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_main/corpus.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_main/corpus.rs @@ -1,9 +1,9 @@ //! The parity corpus of the main smoke: every line of `LELEKA_SMOKE_PROMPTS` is tokenized with the verified //! tokenizer, served greedily for `LELEKA_SMOKE_MAX_NEW` tokens (default 64) and printed as ids so the Original //! can be run on the same ids. -use super::{ServeError, ServeRequest, Smoke, Tokenizer, agent_sampler, env, env_or, report_timing}; #[cfg(all(test, target_arch = "x86_64"))] use super::original_serve_arms; +use super::{ServeError, ServeRequest, Smoke, Tokenizer, agent_sampler, env, env_or, report_timing}; use crate::qwen_forward::{ original_serve_engine::ServeOutcome, original_serve_request::{RequestSampling, original_stop_tokens}, diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_ttft.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_ttft.rs index cd760f86..a7fc296c 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_ttft.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_ttft.rs @@ -11,7 +11,9 @@ //! Inputs: those of the replay (`LELEKA_ORIGINAL_SERVE_REPLAY=yes`, model, expert tier, `LELEKA_REPLAY_CAPACITY`, //! `LELEKA_REPLAY_PREFIX_MIB`, `LELEKA_ORIGINAL_SERVE_RT_DIR`), `LELEKA_SWEEP_MAX_NEW` (4). use super::super::qwen_forward::original_serve_stack::dbg_el; -use super::{Driver, InheritedKarArchive, ModelBinding, PathBuf, Qwen4ExpArtifact, Rc, SHARD0, SHARD1, VerifiedGgufFile}; +use super::{ + Driver, InheritedKarArchive, ModelBinding, PathBuf, Qwen4ExpArtifact, Rc, SHARD0, SHARD1, VerifiedGgufFile, +}; use crate::qwen_forward::{ original_serve_request::ServeRequest, original_serve_stack::{OriginalServeStack, PrefixBudget, PrefixConfig, StackConfig}, diff --git a/crates/engine-qwen35-cuda/src/backend/serve_generate.rs b/crates/engine-qwen35-cuda/src/backend/serve_generate.rs index 72906a83..fc80c128 100644 --- a/crates/engine-qwen35-cuda/src/backend/serve_generate.rs +++ b/crates/engine-qwen35-cuda/src/backend/serve_generate.rs @@ -1,4 +1,6 @@ //! One Generate command of the serve loop: admit it, resume or start a session, generate, publish the terminal. +#[cfg(feature = "preview-path")] +use super::QwenSession; use super::{ ActiveGuard, Arc, AtomicBool, BackendError, Conversations, Counters, GenerationRequest, GenerationSink, GenerationStream, LoadedModel, ModelBinding, MtpContinuation, Ordering, Outcome, PrefixSession, QUEUE, Rc, Reply, @@ -6,8 +8,6 @@ use super::{ log_conversation_events, log_generation_cache, measurement, prepare_prompt, run_generation, terminal_admit, terminal_of, unavailable, verdict, }; -#[cfg(feature = "preview-path")] -use super::QwenSession; use std::cell::RefCell; /// One Generate command as it arrived. diff --git a/crates/engine-qwen35-cuda/src/conversation/memory.rs b/crates/engine-qwen35-cuda/src/conversation/memory.rs index d56a4d7a..739c2013 100644 --- a/crates/engine-qwen35-cuda/src/conversation/memory.rs +++ b/crates/engine-qwen35-cuda/src/conversation/memory.rs @@ -5,7 +5,6 @@ //! every ambiguity (malformed, duplicated, wrongly-united, I/O failure) //! reads as unknown so admission fails closed. - pub use leleka_engine_core::memory::{mem_available, memory_admit}; /// Available host physical memory right now; `None` when unknown (any diff --git a/crates/engine-qwen35-cuda/src/memory_governor.rs b/crates/engine-qwen35-cuda/src/memory_governor.rs index 5885f621..ee3320c6 100644 --- a/crates/engine-qwen35-cuda/src/memory_governor.rs +++ b/crates/engine-qwen35-cuda/src/memory_governor.rs @@ -9,8 +9,8 @@ use crate::settings::{EnvSource, Settings}; use leleka_backend_api::BackendError; use leleka_memory::ledger::{DeviceSample, OpenStage}; use leleka_memory::{ - CacheWish, Entry, FixedItem, Governor, GovernorConfig, HostFacts, KarForm, PlanInput, SamplerGuard, - Space, VramFacts, When, + CacheWish, Entry, FixedItem, Governor, GovernorConfig, HostFacts, KarForm, PlanInput, SamplerGuard, Space, + VramFacts, When, }; use leleka_memory_os::{HostProc, real_governor}; use std::sync::Mutex; diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/backing.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/backing.rs index 8708bb4b..dc31258b 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/backing.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/backing.rs @@ -1,9 +1,9 @@ //! Methods of `OwnedCopy`: `create`, `writer`, `owns_directory`, `owns_file` and 1 more. //! Implements `Drop for OwnedCopy`. Functions: `inode`, `regular`, `root`, `copy_exact` and 8 more. -use super::{File, InputBindingError, InputResult, Path}; #[cfg(test)] use super::{EXPERT_BLOB, MtpExpertMatrix, MtpKind, read_exact_range, read_expert_rows}; +use super::{File, InputBindingError, InputResult, Path}; use sha2::{Digest, Sha256}; use std::io::Read; use std::os::unix::fs::{DirBuilderExt, MetadataExt, OpenOptionsExt, PermissionsExt}; diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/mtp_kind_types.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/mtp_kind_types.rs index 66e8346e..73253e58 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/mtp_kind_types.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/mtp_kind_types.rs @@ -1,7 +1,6 @@ //! The vocabulary of the MTP pack: storage kinds, expert matrices, the roles of its tensors, and the `Descriptor` //! and `Dense` records that describe one tensor. - #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub(crate) enum MtpKind { Q8_0, diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/mtp_weight_reads.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/mtp_weight_reads.rs index e356776b..adb749ef 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/mtp_weight_reads.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/mtp_weight_reads.rs @@ -1,9 +1,9 @@ //! The reads of the MTP weights: dense rows, expert rows and the binding identity check. use super::{ - DENSE_BYTES, DESCRIPTORS, EXPERT_BLOB, EXPERT_BYTES, FILE_PINS, INDEX_BYTES, MAX_ROWS, BindingIdentity, - InputBindingError, InputResult, ModelBinding, MtpExpertRef, MtpIndex, MtpKind, MtpRole, MtpRows, MtpWeights, - Path, backing, descriptor, read_exact_range, read_expert_rows, row_range, validate_numeric, + BindingIdentity, DENSE_BYTES, DESCRIPTORS, EXPERT_BLOB, EXPERT_BYTES, FILE_PINS, INDEX_BYTES, InputBindingError, + InputResult, MAX_ROWS, ModelBinding, MtpExpertRef, MtpIndex, MtpKind, MtpRole, MtpRows, MtpWeights, Path, backing, + descriptor, read_exact_range, read_expert_rows, row_range, validate_numeric, }; impl MtpWeights { diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/read_expert_rows.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/read_expert_rows.rs index bc32d4a8..3c75033f 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/read_expert_rows.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/read_expert_rows.rs @@ -1,9 +1,9 @@ //! Functions: `read_expert_rows`, `read_expert_row`, `row_range`, `allocate` and 3 more. //! Split out of `mtp` to keep its files under the line limit. -use super::{EXPERT_BLOB, MAX_READ, MAX_ROWS, File, InputBindingError, InputResult, MtpExpertMatrix, MtpKind, MtpRows}; #[cfg(not(target_os = "linux"))] use super::backing; +use super::{EXPERT_BLOB, File, InputBindingError, InputResult, MAX_READ, MAX_ROWS, MtpExpertMatrix, MtpKind, MtpRows}; pub(super) fn read_expert_rows( experts: &File, diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/validate_ple_descriptor.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/validate_ple_descriptor.rs index 63e755c1..6eecb9b7 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/validate_ple_descriptor.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/validate_ple_descriptor.rs @@ -1,12 +1,12 @@ //! Bind-time admission of a Qwen4Exp artifact: the per-layer token-embedding (PLE) descriptor and the ordered list of //! bound layers with their kinds. Also the test fixtures for `InputConstants` and `BindingIdentity`. +#[cfg(test)] +use super::{BindingIdentity, InputConstants, Rc}; use super::{ BoundLayer, BoundLayerKind, GlobalRole, InputBindingError, InputResult, LayerRole, PLE_ROWS, Qwen4ExpArtifact, TensorRole, }; -#[cfg(test)] -use super::{BindingIdentity, InputConstants, Rc}; pub(super) fn validate_ple_descriptor(artifact: &Qwen4ExpArtifact) -> InputResult<()> { let ple = artifact diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/inherited_kar_archive.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/inherited_kar_archive.rs index a320d75d..5521d204 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/inherited_kar_archive.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/inherited_kar_archive.rs @@ -2,8 +2,8 @@ //! Functions: `open_sealed_archive_fd`, `open_read_only_archive`, `check_read_only_archive`, `reopen_read_only_archi... use super::{ - ARCHIVE_DIGEST, PINNED_ARCHIVE_BYTES, PROVENANCE_DIGEST, File, InheritedKarArchive, InputBindingError, - InputResult, Path, PathBuf, SparseArchive, private_copy, + ARCHIVE_DIGEST, File, InheritedKarArchive, InputBindingError, InputResult, PINNED_ARCHIVE_BYTES, PROVENANCE_DIGEST, + Path, PathBuf, SparseArchive, private_copy, }; use leleka_model_format::weight_source::{BackingKind, FileWeightSource, Verification, WeightIdentity}; diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/load_pinned_inherited_archive.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/load_pinned_inherited_archive.rs index 8f8bcde2..afa36b82 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/load_pinned_inherited_archive.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/load_pinned_inherited_archive.rs @@ -2,8 +2,8 @@ //! Functions: `open_archive_reader`, `load_pinned_inherited_archive`, `log_startup_read`, `load_pinned_inherited_arc... use super::{ - NATIVE_DIGESTS, PINNED_ARCHIVE_BYTES, PLE_ROWS, PROVENANCE_DIGEST, BindingIdentity, File, InheritedKarArchive, - InputBindingError, InputResult, KarError, KarPleBinding, KarRowPacket, KarRowReader, LoadPhase, RefCell, + BindingIdentity, File, InheritedKarArchive, InputBindingError, InputResult, KarError, KarPleBinding, KarRowPacket, + KarRowReader, LoadPhase, NATIVE_DIGESTS, PINNED_ARCHIVE_BYTES, PLE_ROWS, PROVENANCE_DIGEST, RefCell, VerifiedKarPleArtifact, open_sealed_archive_fd, pinned_profile, reopen_read_only_archive, verify_open_provenance, }; diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/pinned_profile.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/pinned_profile.rs index b3588b0d..136c70bf 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/pinned_profile.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/pinned_profile.rs @@ -2,9 +2,9 @@ //! Functions: `pinned_profile`, `pinned_parts`, `pinned_profile_spec`, `load_pinned_archive` and 3 more. use super::{ - ARCHIVE_DIGEST, NATIVE_DIGESTS, PART0_F32_DIGEST, PART1_F32_DIGEST, PROVENANCE_DIGEST, VIRTUAL_F32_DIGEST, File, - InheritedKarArchive, InputBindingError, InputResult, KarPlePartProvenance, KarPleProfile, KarPleProfileSpec, - LoadPhase, Path, VerifiedKarPleArtifact, error, input_failure, kar_failure, private_copy, + ARCHIVE_DIGEST, File, InheritedKarArchive, InputBindingError, InputResult, KarPlePartProvenance, KarPleProfile, + KarPleProfileSpec, LoadPhase, NATIVE_DIGESTS, PART0_F32_DIGEST, PART1_F32_DIGEST, PROVENANCE_DIGEST, Path, + VIRTUAL_F32_DIGEST, VerifiedKarPleArtifact, error, input_failure, kar_failure, private_copy, }; /// Candidate expectations from independently verified v4 conversion receipts diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/pinned_profile_tests.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/pinned_profile_tests.rs index fb64dc2c..fc20946a 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/pinned_profile_tests.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/pinned_profile_tests.rs @@ -2,7 +2,7 @@ //! Functions: `diagnostic_cases`, `assert_kar_diagnostic_redacts`, `assert_input_diagnostic_survives_broken_sink`, `... use super::{ - NATIVE_DIGESTS, PLE_ROWS, InputBindingError, KarError, LoadPhase, error, input_diagnostic, kar_diagnostic, + InputBindingError, KarError, LoadPhase, NATIVE_DIGESTS, PLE_ROWS, error, input_diagnostic, kar_diagnostic, pinned_profile, pinned_profile_spec, }; diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/private_copy/checked_reader.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/private_copy/checked_reader.rs index f3886295..e4b13051 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/private_copy/checked_reader.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/private_copy/checked_reader.rs @@ -3,7 +3,7 @@ use super::{COPY_BUFFER, InputBindingError, InputResult, IoPhase, LoadPhase, Read, Write, input_failure, report_io}; #[cfg(not(target_os = "linux"))] -use super::{SOURCE_FLAGS, File, Metadata, MetadataExt, OpenOptions, OpenOptionsExt, Seek, inode, phase_error}; +use super::{File, Metadata, MetadataExt, OpenOptions, OpenOptionsExt, SOURCE_FLAGS, Seek, inode, phase_error}; #[cfg(target_os = "macos")] pub(super) fn checked_reader(own: &OwnedCopy, bytes: u64) -> InputResult { diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/private_copy/inode.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/private_copy/inode.rs index b6afbfbe..22418bf1 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/private_copy/inode.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/private_copy/inode.rs @@ -2,8 +2,8 @@ //! Functions: `inode`, `diagnostic`, `report_io`, `phase_error` and 8 more. use super::{ - SOURCE_FLAGS, File, Inode, InputBindingError, InputResult, IoPhase, LoadPhase, Metadata, MetadataExt, - OpenOptions, OpenOptionsExt, Path, Seek, Write, copy_exact, input_failure, + File, Inode, InputBindingError, InputResult, IoPhase, LoadPhase, Metadata, MetadataExt, OpenOptions, + OpenOptionsExt, Path, SOURCE_FLAGS, Seek, Write, copy_exact, input_failure, }; #[cfg(not(target_os = "linux"))] use super::{Read, checked_reader}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/workspaces.rs b/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/workspaces.rs index 4fe9d212..1ce1c86a 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/workspaces.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/workspaces.rs @@ -2,12 +2,12 @@ //! GDN state buffers), all empty at construction and filled on first use. The fields are declared in the order the //! cache drops them, so the drop order is unchanged. +#[cfg(test)] +use super::Cell; use super::{ DeviceBuffer, GdnInputScratch, GrBatchInjectWorkspace, GrScratch, QkScratch, QsaAttentionScratch, QsaIndexKeyCache, QsaInputScratch, QsaSelectedCache, Rc, RefCell, RouterScratch, }; -#[cfg(test)] -use super::Cell; /// Every scratch owner of the cache that starts empty (`None` or an empty list) and is filled on first use. #[derive(Default)] diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/staged_input_enabled.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/staged_input_enabled.rs index 172eb120..56b18179 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/staged_input_enabled.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/original_prompt/staged_input_enabled.rs @@ -1,6 +1,5 @@ //! The `prefill_staged_input` switch: staged chunk input, or the per-token host path of the KAR inputs (the A/B arm). - /// `LELEKA_PREFILL_STAGED_INPUT=0` keeps the per-token host path of the KAR inputs (the A/B arm). pub(super) fn staged_input_enabled() -> bool { crate::settings::process().kv.prefill_staged_input diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk.rs index c19701ab..bdf57656 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk.rs @@ -6,8 +6,8 @@ use super::super::session::chunk::QwenChunkTxn; use super::{ BoundLayerKind, DenseWeightCache, Dimension, Error, ForwardPhase, GdnStage, GrStage, InjectedResidual, InputStage, KarPleCache, LayerEntry, LayerId, ModelBinding, MoeExpertStage, MoeRouteStage, MoeWeightCache, OutputStage, - Position, QsaAttentionStage, QsaIndexStage, QwenForward, QwenSession, QwenStepTxn, Result, Stage, TargetStepProduct, - TokenId, diagnose, prepare_layer_attention_micro, read_layer_attention, validate_layer_plan, + Position, QsaAttentionStage, QsaIndexStage, QwenForward, QwenSession, QwenStepTxn, Result, Stage, + TargetStepProduct, TokenId, diagnose, prepare_layer_attention_micro, read_layer_attention, validate_layer_plan, }; #[cfg(test)] use super::{StepCaches, StepRequest}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/joint_chunk.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/joint_chunk.rs index 501f8aff..4b2db0cd 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/joint_chunk.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/joint_chunk.rs @@ -1,11 +1,11 @@ //! The inputs and the joint target+draft publication shared by the prefill chunk entry points. +#[cfg(all(test, target_arch = "x86_64"))] +use super::window_numeric; use super::{ ChunkMoePolicy, DenseWeightCache, Error, KarPleCache, ModelBinding, MoeWeightCache, OutputStage, QwenForward, QwenSession, Result, Stage, TargetStepProduct, TokenId, }; -#[cfg(all(test, target_arch = "x86_64"))] -use super::window_numeric; use crate::qwen_forward::mtp_decode::MtpDecoder; #[cfg(test)] use leleka_cuda_driver::Context; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_cached_windowed.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_cached_windowed.rs index 090a2c7a..c5c4bad6 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_cached_windowed.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_cached_windowed.rs @@ -1,12 +1,12 @@ //! Entry points of `QwenForward` for the cached prefill chunk: MMQ joint, cached joint and the private outer256 //! windowed experiments (plain and retained-GR transport). Normal serving stays on outer64 with the host transport. +#[cfg(all(test, target_arch = "x86_64"))] +use super::check_chunk_on_loaded; use super::{ ChunkMoePolicy, MoeWeightCache, PrefillChunkInputs, PrefillChunkPlan, QwenChunkTxn, QwenForward, QwenSession, Result, TargetStepProduct, }; -#[cfg(all(test, target_arch = "x86_64"))] -use super::check_chunk_on_loaded; #[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] use crate::qwen_forward::loaded_target_owners::LoadedTargetOwners; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned.rs index 474fa71a..f8ecf175 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned.rs @@ -2,16 +2,16 @@ //! and the layer loop that ends in the output head. The phases are the child modules (setup, layer, window attention, //! FFN, experts). +#[cfg(all(test, target_arch = "x86_64"))] +use super::window_numeric; use super::{ AttentionHandoff, BoundLayerKind, ChunkMoePolicy, DenseWeightCache, Dimension, Error, ForwardPhase, GdnStage, GrStage, InjectedResidual, InputStage, KarPleCache, LayerEntry, LayerId, MicroEnv, ModelBinding, MoeExpertStage, MoeRouteStage, MoeWeightCache, OutputStage, Position, PrefillChunkInputs, PrefillChunkPlan, QsaAttentionStage, QsaIndexStage, QwenChunkTxn, QwenForward, QwenSession, QwenStepTxn, Result, Stage, TokenId, chunk_diagnostic, - diagnose, prepare_layer_attention_micro, prepare_micro_ffn_rows, prepare_q6_layer_columns, read_chunk_attention_ffn, - read_layer_attention, validate_layer_plan, + diagnose, prepare_layer_attention_micro, prepare_micro_ffn_rows, prepare_q6_layer_columns, + read_chunk_attention_ffn, read_layer_attention, validate_layer_plan, }; -#[cfg(all(test, target_arch = "x86_64"))] -use super::window_numeric; use leleka_cuda_driver::Context; mod chunk_layer; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/chunk_layer.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/chunk_layer.rs index fef33659..ed548294 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/chunk_layer.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/chunk_layer.rs @@ -2,12 +2,12 @@ use super::window_experts::ExpertRun; use super::window_ffn::WindowOwners; +#[cfg(all(test, target_arch = "x86_64"))] +use super::window_numeric; use super::{ BoundLayerKind, ChunkEnv, ChunkRun, Context, Dimension, Error, GdnPlan, InjectedResidual, LayerId, MoeWeightCache, NativeMoe, QwenChunkTxn, QwenForward, Result, }; -#[cfg(all(test, target_arch = "x86_64"))] -use super::window_numeric; use crate::qwen_forward::gdn::chunk_device::GdnChunkDevice; use crate::qwen_forward::moe_expert::ChunkFfnLayer; use crate::qwen_forward::session::chunk::{ChunkFfnRow, ChunkMicroWindow}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/chunk_setup.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/chunk_setup.rs index 0d720bb1..d2e6d6a0 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/chunk_setup.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/chunk_setup.rs @@ -1,12 +1,12 @@ //! Admission, transaction begin, input rows and output head of one prefill chunk. +#[cfg(all(test, target_arch = "x86_64"))] +use super::window_numeric; use super::{ ChunkEnv, ChunkMoePolicy, ChunkOpening, Context, DenseWeightCache, Error, InjectedResidual, InputStage, KarPleCache, ModelBinding, MoeWeightCache, OutputStage, PrefillChunkInputs, PrefillChunkPlan, QwenChunkTxn, QwenForward, QwenSession, QwenStepTxn, Result, Stage, chunk_diagnostic, }; -#[cfg(all(test, target_arch = "x86_64"))] -use super::window_numeric; /// The MMQ actor context, and the contexts of the recurrence and verification GDN owners when they are in use. type ChunkContexts<'ctx, 'driver> = diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/window_attention.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/window_attention.rs index 2fb5da02..b2f5069f 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/window_attention.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/window_attention.rs @@ -1,13 +1,13 @@ //! The attention reads of one window of a prefill layer. +#[cfg(test)] +use super::QwenStepTxn; +#[cfg(all(test, target_arch = "x86_64"))] +use super::window_numeric; use super::{ ChunkEnv, ChunkRun, Error, GrStage, InjectedResidual, InputStage, LayerEntry, LayerId, MicroBank, QwenChunkTxn, QwenForward, Result, Stage, chunk_diagnostic, prepare_layer_attention_micro, read_layer_attention, }; -#[cfg(all(test, target_arch = "x86_64"))] -use super::window_numeric; -#[cfg(test)] -use super::QwenStepTxn; use crate::qwen_forward::session::chunk::ChunkAttentionRow; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] use crate::qwen_forward::{ diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/read_chunk_attention_ffn.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/read_chunk_attention_ffn.rs index 006ebbdb..1d3b104c 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/read_chunk_attention_ffn.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/read_chunk_attention_ffn.rs @@ -2,12 +2,12 @@ //! go to the retained GR bank. Also the layer-0 pair diagnostic, whose four-row chunk must refuse with the executor //! error. -use super::{DenseWeightCache, ForwardPhase, GrStage, ModelBinding, Result, diagnose}; #[cfg(test)] use super::{ ChunkMoePolicy, Dimension, Error, KarPleCache, MoeWeightCache, OutputStage, PrefillChunkInputs, QwenForward, QwenSession, Stage, TokenId, }; +use super::{DenseWeightCache, ForwardPhase, GrStage, ModelBinding, Result, diagnose}; use crate::qwen_forward::gr::AttentionBlockOutput; #[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] use crate::qwen_forward::loaded_target_owners::LoadedTargetOwners; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/qwen_forward.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/qwen_forward.rs index 57f3bebc..f4b9b428 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/qwen_forward.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/qwen_forward.rs @@ -6,6 +6,6 @@ use super::{ Stage, StepCaches, StepCoreResult, StepPurpose, StepRequest, TargetStepProduct, TokenId, }; -mod qwen_forward_reset; mod forward_step_body; +mod qwen_forward_reset; mod step_entries; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/step_layers.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/step_layers.rs index 8947e066..dbb5e1d6 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/step_layers.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/step_layers.rs @@ -11,11 +11,11 @@ use crate::qwen_forward::gdn::GdnLayerInput; use crate::qwen_forward::moe_expert::ExpertRowRequest; use crate::qwen_forward::qsa_attention::QsaReady; -#[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -use crate::qwen_forward::oracle_capture; #[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] use super::step_residual_capture::capture_input; pub(super) use super::step_residual_capture::capture_streams; +#[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] +use crate::qwen_forward::oracle_capture; /// The per-step identity every layer phase validates against. #[derive(Clone, Copy)] diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn.rs index 6783fc0e..86897271 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn.rs @@ -196,7 +196,6 @@ mod tests { } } - #[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] mod four_borrow_gpu; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/cached_step.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/cached_step.rs index a0548099..e60c0a1f 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/cached_step.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/cached_step.rs @@ -2,13 +2,13 @@ //! Runs on a step-local `Chain`, then publishes the next recurrent state through the mirror only if the whole step //! succeeded; on failure the computed candidate is discarded and the chain is cleaned up. +#[cfg(all(test, target_arch = "x86_64"))] +use super::four_borrow_gpu; use super::{ CandidatePair, Context, DEVICE_PEAK, DenseWeightCache, DeviceBuffer, Error, GdnInputLease, GdnLayerInput, GdnMatrixKind, GdnMatrixRole, GdnPrior, GdnReady, GdnStateMirror, GdnWeights, LeaseClaim, LeasedProjection, MirrorStep, ModelBinding, ProjectedQkvSource, QwenStepTxn, ResidualReady, Result, chain, mirror, validate_values, }; -#[cfg(all(test, target_arch = "x86_64"))] -use super::four_borrow_gpu; use crate::qwen_forward::dense_weight_cache::GdnResident; use std::{cell::Cell, rc::Rc}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/gdn_chunk_device_methods.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/gdn_chunk_device_methods.rs index 6ad48c03..4a38a2c2 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/gdn_chunk_device_methods.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/gdn_chunk_device_methods.rs @@ -1,10 +1,11 @@ //! The `GdnChunkDevice` methods by phase: construction and admission, per-row and batch compute, finish and cleanup. use super::{ - BindingIdentity, CHUNK_DEVICE_CHARGE, Cell, ChunkEdge, ChunkReadout, Context, DenseWeightCache, DeviceBuffer, Error, - GdnChunkDevice, GdnChunkMicro, GdnChunkRow, GdnChunkSeal, GdnChunkStart, GdnPrior, GdnRowQueue, HISTORY_ELEMENTS, - ModelBinding, Rc, ReadoutDownload, Result, STATE_ELEMENTS, VALUES, allocate, download, download_unchecked, - driver_error, micro_rows, mirror_reuse_enabled, pool_enabled, preflight_budget, upload, validate_values, + BindingIdentity, CHUNK_DEVICE_CHARGE, Cell, ChunkEdge, ChunkReadout, Context, DenseWeightCache, DeviceBuffer, + Error, GdnChunkDevice, GdnChunkMicro, GdnChunkRow, GdnChunkSeal, GdnChunkStart, GdnPrior, GdnRowQueue, + HISTORY_ELEMENTS, ModelBinding, Rc, ReadoutDownload, Result, STATE_ELEMENTS, VALUES, allocate, download, + download_unchecked, driver_error, micro_rows, mirror_reuse_enabled, pool_enabled, preflight_budget, upload, + validate_values, }; mod chunk_device_batch_compute; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/gdn_chunk_device_methods/chunk_device_batch_compute.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/gdn_chunk_device_methods/chunk_device_batch_compute.rs index 5eca8118..1a76cf5f 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/gdn_chunk_device_methods/chunk_device_batch_compute.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/gdn_chunk_device_methods/chunk_device_batch_compute.rs @@ -2,12 +2,12 @@ //! read the readout back and mint the row edges. The earliest full-state refusal precedes the readout and any user. //! Also adopts the final state of a batch that drained clean. +#[cfg(test)] +use super::upload; use super::{ ChunkEdge, ChunkReadout, DeviceBuffer, Error, GdnChunkDevice, GdnChunkRow, HISTORY_ELEMENTS, Rc, ReadoutDownload, Result, VALUES, allocate, download, driver_error, preflight_budget, validate_values, }; -#[cfg(test)] -use super::upload; impl<'ctx> GdnChunkDevice<'ctx> { /// Adopt the final state of a batch that drained clean: the separate `next` diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/numeric_gpu.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/numeric_gpu.rs index 0f8a3a3e..2b8aae8f 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/numeric_gpu.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/numeric_gpu.rs @@ -4,9 +4,9 @@ use super::super::super::contract::{Dimension, LayerId}; use super::super::super::session::chunk::TestGdnComponentRows; use super::super::{RecurrenceOperands, convolve, recur}; use super::{ - BindingIdentity, CHUNK_DEVICE_CHARGE, Cell, ChunkReadout, Context, DeviceBuffer, Error, GdnChunkDevice, GdnChunkRow, - GdnChunkSeal, GdnChunkStart, GdnPrior, GdnStateFiniteGuard, HISTORY_ELEMENTS, Rc, Result, STATE_ELEMENTS, allocate, - download, driver_error, preflight_budget, upload, validate_values, + BindingIdentity, CHUNK_DEVICE_CHARGE, Cell, ChunkReadout, Context, DeviceBuffer, Error, GdnChunkDevice, + GdnChunkRow, GdnChunkSeal, GdnChunkStart, GdnPrior, GdnStateFiniteGuard, HISTORY_ELEMENTS, Rc, Result, + STATE_ELEMENTS, allocate, download, driver_error, preflight_budget, upload, validate_values, }; use leleka_cuda_driver::Driver; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/driver_error.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/driver_error.rs index c0082b22..81465cae 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/driver_error.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/driver_error.rs @@ -1,9 +1,9 @@ //! Maps CUDA driver errors to the GDN `Error` and holds the GDN state addressing checks (`state_index`, `key_head`). //! The state address is the exact native layout, never a head-major reinterpretation. -use super::{DriverError, Error, KEY_HEADS, Result, Stage, VALUE_HEADS, WIDTH}; #[cfg(test)] use super::CandidateFixture; +use super::{DriverError, Error, KEY_HEADS, Result, Stage, VALUE_HEADS, WIDTH}; #[cfg(test)] use super::{HISTORY_ELEMENTS, STATE_ELEMENTS, TokenLayer, validate_values}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gr/retained_handoff.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gr/retained_handoff.rs index b3621bc8..f2b56769 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gr/retained_handoff.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gr/retained_handoff.rs @@ -2,6 +2,8 @@ //! The actual finite host witness remains canonical; only its duplicate H2D //! is removed. No device-only host proof or changed arithmetic is introduced. use super::read_cached_cuda::borrow_injection; +#[cfg(test)] +use super::{BindingIdentity, inject_cached_cuda, upload_bf16, upload_f32}; use super::{ Cell, Context, DenseWeightCache, DetachedGrRead, DeviceBuffer, Error, GrMicroAttentionBank, GrMicroAttentionBlock, GrPhase, GrRead, GrRole, GrScratch, GrStage, InjectedResidual, LayerId, ModelBinding, QwenStepTxn, @@ -9,8 +11,6 @@ use super::{ copy_cached_f32, diagnose, download_f32, driver_error, read_cached_cuda, validate_layer, validate_streams, validate_values, }; -#[cfg(test)] -use super::{BindingIdentity, inject_cached_cuda, upload_bf16, upload_f32}; /// The attention block output an attention residual is injected with, and the token and layer it was computed for. #[derive(Clone, Copy)] pub(in crate::qwen_forward) struct AttentionBlockOutput<'a> { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/input/ple_transport/ple_inner_composition.rs b/crates/engine-qwen35-cuda/src/qwen_forward/input/ple_transport/ple_inner_composition.rs index faae1d76..2a355e6c 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/input/ple_transport/ple_inner_composition.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/input/ple_transport/ple_inner_composition.rs @@ -1,12 +1,12 @@ //! The composition of one PLE row: project key and value, gate, normalise, convolve the history and finish the //! residual streams. Separate from `ple_transport`, which holds the transport and its row types. +#[cfg(test)] +use super::ObservedOutput; use super::{ Bf16ProjectionShape, Cell, Context, DeviceBuffer, Error, Finite, PLE_HC, PLE_HISTORY, PleCandidate, PleRows, Rc, Result, Role, Transport, admit, at, ple_driver_error, ple_values, }; -#[cfg(test)] -use super::ObservedOutput; use leleka_cuda_driver::PleClosedWeights; pub(super) fn compose_inner( diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/input/ple_transport/ple_key_retained_gpu.rs b/crates/engine-qwen35-cuda/src/qwen_forward/input/ple_transport/ple_key_retained_gpu.rs index 0abad6b0..c54c9c5f 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/input/ple_transport/ple_key_retained_gpu.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/input/ple_transport/ple_key_retained_gpu.rs @@ -2,8 +2,8 @@ #![cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] use super::super::{ple_upload, ple_upload_f32}; use super::{ - Bf16ProjectionShape, Cell, Context, DeviceBuffer, Error, Finite, PleCandidate, PleRows, Rc, Result, Role, Transport, - at, compose, ple_download, ple_driver_error, + Bf16ProjectionShape, Cell, Context, DeviceBuffer, Error, Finite, PleCandidate, PleRows, Rc, Result, Role, + Transport, at, compose, ple_download, ple_driver_error, }; #[cfg(test)] use super::{Observations, compose_observed}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/input/ple_transport/ple_key_retained_gpu/bf16.rs b/crates/engine-qwen35-cuda/src/qwen_forward/input/ple_transport/ple_key_retained_gpu/bf16.rs index 57ab95cc..c35f51ab 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/input/ple_transport/ple_key_retained_gpu/bf16.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/input/ple_transport/ple_key_retained_gpu/bf16.rs @@ -1,12 +1,12 @@ //! Test support for the retained-PLE proof: synthetic BF16 PLE matrices and the legacy chain (one key projection and //! forty ephemeral value tiles) that the whole-matrix retained path must reproduce bit for bit. +#[cfg(test)] +use super::Observations; use super::{ Bf16ProjectionShape, Context, DeviceBuffer, Finite, Matrices, Role, Transport, at, ple_download, ple_driver_error, ple_upload, ple_upload_f32, }; -#[cfg(test)] -use super::Observations; pub(super) fn bf16(rows: usize, columns: usize, seed: usize) -> Vec { (0..rows) diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/expert_matrix_projection.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/expert_matrix_projection.rs index 86e3e2a4..ee97474a 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/expert_matrix_projection.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/expert_matrix_projection.rs @@ -3,16 +3,16 @@ //! routed prepared Q8 or cached MMQ), and a kind without a plan is refused. The uncached diagnostic path uploads the //! raw matrix here. +#[cfg(test)] +use super::TILE; +#[cfg(test)] +use super::validate_values; use super::{ BoundExpert, CachedMoeMatrix, Context, DEVICE_PEAK, DenseFormat, DeviceBuffer, Error, FF, ModelBinding, MoeExpertBlock, MoeExpertSelection, MoeExpertWeights, MoeMatrixKind, MoeMatrixRole, MoeWeightCache, N, ProjectionKind, ProjectionSpec, Q5KProjectionShape, Q6KProjectionShape, Result, RoutedFormat, RoutedGateUpQ8, Stage, binding_error, download_f32, driver_error, upload_bytes, }; -#[cfg(test)] -use super::TILE; -#[cfg(test)] -use super::validate_values; /// Shape and format of one expert matrix as the binding declares it. #[derive(Clone, Copy)] diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/bound_rows.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/bound_rows.rs index d540abb7..1c3d2d5c 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/bound_rows.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/bound_rows.rs @@ -1,5 +1,7 @@ //! The uploaded rows of one chunk and their ungrouped/grouped execution (STRA-338 size: extract-method only). +#[cfg(all(test, target_arch = "x86_64"))] +use super::direct_gpu; use super::direct_packets_fns::PacketRun; use super::finish_shared_with::RowTail; use super::{ @@ -8,8 +10,6 @@ use super::{ TransportBuffer, adaptive, execute_cuda_cached, finish_shared, grouped_pairs, project_group, prompt_finish, use_direct_packets, uses_adaptive, }; -#[cfg(all(test, target_arch = "x86_64"))] -use super::direct_gpu; /// The uploaded rows of one chunk: activations and Q8 owners all alive for the whole execution. pub(super) struct BoundRows<'a, 'ctx> { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu.rs index 082188af..7416d7c9 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu.rs @@ -2,8 +2,8 @@ //! session advancement, standalone Load or full-model qualification is minted. use super::{ ChunkFfnLayer, ChunkFfnRow, Context, DEVICE_PEAK, DeviceBuffer, DownScope, DownSelection, DriverError, Error, - ExpertReady, FF, GrStage, K, LayerId, ModelBinding, MoeExpertStage, MoeWeightCache, N, PreparedMoeRow, QwenChunkTxn, - Rc, Result, Stage, TransportBuffer, download_f32, driver_error, validate_values, + ExpertReady, FF, GrStage, K, LayerId, ModelBinding, MoeExpertStage, MoeWeightCache, N, PreparedMoeRow, + QwenChunkTxn, Rc, Result, Stage, TransportBuffer, download_f32, driver_error, validate_values, }; use crate::qwen_forward::gr::DetachedGrRead; use crate::qwen_forward::session::{QwenStepTxn, ResetReplaySnapshot, chunk::ChunkAttentionRow}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_packets_fns.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_packets_fns.rs index e28173f3..8d843f83 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_packets_fns.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_packets_fns.rs @@ -1,5 +1,7 @@ //! Phases of the direct-packet layer batch (STRA-338 size: extract-method only). +#[cfg(all(test, target_arch = "x86_64"))] +use super::direct_gpu; use super::finish_shared_with::RowTail; use super::ordered_down_refusal::close_packets; use super::packet_run_project_group_direct::DirectRun; @@ -8,8 +10,6 @@ use super::{ Pair, PreparedMoeRow, QwenChunkTxn, Rc, Result, RoutedGateUpQ8, Stage, TransportBuffer, adaptive_packets, finish_shared_queued, finish_shared_with, prompt_finish, use_shared_tail, uses_adaptive, }; -#[cfg(all(test, target_arch = "x86_64"))] -use super::direct_gpu; /// The sealed rows, their origins, expert groups and shared activations of one direct-packet layer batch. pub(super) struct PacketRun<'a, 'session, 'ctx, 'l, 'd, 'q> { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/ordered_down_refusal.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/ordered_down_refusal.rs index 7550d988..f25207c5 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/ordered_down_refusal.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/ordered_down_refusal.rs @@ -3,6 +3,8 @@ //! quantizer refusal must not overtake an earlier column's Down NonFinite, so the refusal is replayed ascending; //! every packet is closed whatever the first failure was. +#[cfg(all(test, target_arch = "x86_64"))] +use super::direct_gpu; use super::finish_shared_with::RowTail; use super::packet_run_project_group_direct::{DownProjection, RefusalReplay}; use super::{ @@ -10,8 +12,6 @@ use super::{ MatrixDims, ModelBinding, MoeWeightCache, N, PackedDown, Pair, QwenChunkTxn, Rc, Result, SharedTailRow, Stage, finish_shared_with, launch_cached_projection, }; -#[cfg(all(test, target_arch = "x86_64"))] -use super::direct_gpu; pub(super) fn ordered_down_refusal( context: &Context<'_>, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/packet_run_project_group_direct.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/packet_run_project_group_direct.rs index d23a38fb..f3afb872 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/packet_run_project_group_direct.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/packet_run_project_group_direct.rs @@ -3,6 +3,8 @@ //! direct and source paths share. Origins of all rows are validated before any packet is mutably loaned, and every //! group buffer is closed whatever the outcome. +#[cfg(all(test, target_arch = "x86_64"))] +use super::direct_gpu; use super::direct_packets_fns::PacketRun; use super::project_group_shared_fns::*; use super::{ @@ -11,8 +13,6 @@ use super::{ MoeWeightCache, PacketGroupMembers, Pair, QwenChunkTxn, Rc, Result, RoutedFormat, RoutedGateUpQ8, Stage, TransportBuffer, binding_error, download_f32, driver_error, ordered_down_refusal, validate_packet_pairs, }; -#[cfg(all(test, target_arch = "x86_64"))] -use super::direct_gpu; impl<'ctx> PacketRun<'_, '_, 'ctx, '_, '_, '_> { /// Project one expert group of the batch through the plain device path (no source fence), filling the slot diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/project_group_source_consumers.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/project_group_source_consumers.rs index d9a78724..cbb20df1 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/project_group_source_consumers.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/project_group_source_consumers.rs @@ -2,6 +2,8 @@ //! The scope ends after the last private consumer and before any packet coverage or group acceptance; a failure //! discards every copied private packet. Also checks that the source members match the group descriptors. +#[cfg(all(test, target_arch = "x86_64"))] +use super::direct_gpu; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] use super::packet_run_project_group_direct::{ DirectGroup, DirectRun, DownBuffers, DownProjection, GroupBuffers, RefusalReplay, @@ -16,8 +18,6 @@ use super::{ PacketGroupMembers, Result, RoutedFormat, RoutedGateUpQ8, SourceMatrix, Stage, TransportBuffer, binding_error, download_f32, driver_error, dual_routed_format, ordered_down_refusal, validate_packet_pairs, }; -#[cfg(all(test, target_arch = "x86_64"))] -use super::direct_gpu; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] use crate::model_binding::qwen4exp_input::MoeRoutedSourceScope; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/tests.rs index 7ccaf69b..d9146f67 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/tests.rs @@ -1,9 +1,9 @@ //! Pins the expert-row collection and finite checks: completed tiles keep all rows, a late failure withholds the //! candidate, and a non-finite last expert output is refused while a signed zero is retained. -use super::{DEVICE_PEAK, Error, FF, N, admit_budget}; #[cfg(test)] use super::collect_rows; +use super::{DEVICE_PEAK, Error, FF, N, admit_budget}; #[test] fn completed_tiles_keep_all_rows_and_late_failure_withholds_candidate() { let values = collect_rows(N, |first, count| { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache.rs index b01ff389..c38846c9 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache.rs @@ -34,10 +34,10 @@ mod cache_routed_outputs; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] mod cache_strata_adaptive; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -pub(in crate::qwen_forward) use cache_original_prompt::PromptWeightOwners; -#[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] #[cfg(test)] pub(crate) use cache_original_prompt::PREFILL_STREAM_OVERRIDE; +#[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] +pub(in crate::qwen_forward) use cache_original_prompt::PromptWeightOwners; #[cfg(test)] pub(crate) use cache_original_prompt::set_span_cache_override; pub(crate) use cache_profile::{LearnedMainWitness, SharedPermanentWitness}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_lru_index/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_lru_index/tests.rs index b6a82219..ae76e405 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_lru_index/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_lru_index/tests.rs @@ -1,9 +1,9 @@ //! Pins the bounded LRU index against a scan oracle: oldest-first order with protected keys, atomic batch refusals, //! descriptor collisions, a full index and long deterministic churn. Literal descriptors carry no model or device //! authority, so these tests run without a GPU. -use super::{LruIndex, MAX_KEYS, MoeWeightDescriptor, PER_LAYER, slot}; #[cfg(any(test))] use super::HOST_LIMIT; +use super::{LruIndex, MAX_KEYS, MoeWeightDescriptor, PER_LAYER, slot}; use std::collections::HashMap; type Oracle = HashMap; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill.rs index dcf4b789..de87e1ac 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill.rs @@ -1,12 +1,12 @@ //! Binding-authenticated constructor; metadata alone cannot produce weights. +#[cfg(test)] +use super::room_fits; use super::{ Context, DeviceBuffer, DeviceRef, EncodedWeight, Entry, Error, HashMap, MAIN_LIMIT, ModelBinding, MoeMatrixRole, MoeWeightCache, MoeWeightDescriptor, Rc, RefCell, Result, WORKING_RESERVE, WeightCacheCounters, binding_error, cache_profile, cache_strata_adaptive, driver_error, }; #[cfg(test)] -use super::room_fits; -#[cfg(test)] use cache_profile::ProfileWitness; use cache_profile::{HOST_CAP, PROFILE_SHA, PinnedPool, PrefixPlan, ProfileLimits, RankedProfile}; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/moe_weight_cache.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/moe_weight_cache.rs index cf672050..37e4e154 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/moe_weight_cache.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/moe_weight_cache.rs @@ -1,13 +1,13 @@ //! The `MoeWeightCache` constructors of the profile fill: the ranked fill with its pinned pool and the pinned triplet //! preload. +#[cfg(test)] +use super::ProfileWitness; use super::{ Context, DeviceRef, EncodedWeight, Entry, Error, HOST_CAP, HashMap, MAIN_LIMIT, ModelBinding, MoeMatrixRole, MoeWeightCache, MoeWeightDescriptor, PROFILE_SHA, PinnedPool, PrefixPlan, ProfileLimits, RankedProfile, Result, WORKING_RESERVE, binding_error, driver_error, profile_window_spill_with_floor, }; -#[cfg(test)] -use super::ProfileWitness; mod pinned_triplet_preload; mod profile_ranked_fill_and_pool; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/moe_weight_cache/pinned_triplet_preload.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/moe_weight_cache/pinned_triplet_preload.rs index 46ddd439..65d186a9 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/moe_weight_cache/pinned_triplet_preload.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/moe_weight_cache/pinned_triplet_preload.rs @@ -2,14 +2,14 @@ //! its three raw blocks from the binding, upload them (dual or mixed layout) and commit them as pinned main entries //! with the traffic counters. Also the profile witness that reads those counters back for tests. +#[cfg(test)] +use super::PinnedPool; +#[cfg(test)] +use super::ProfileWitness; use super::{ DeviceRef, EncodedWeight, Entry, Error, MAIN_LIMIT, ModelBinding, MoeWeightCache, MoeWeightDescriptor, Result, WORKING_RESERVE, binding_error, driver_error, }; -#[cfg(test)] -use super::ProfileWitness; -#[cfg(test)] -use super::PinnedPool; /// Layouts, charges and the checked next counters of one pinned triplet upload. #[derive(Clone, Copy)] diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/profile_build.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/profile_build.rs index 5d90efa4..0485a802 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/profile_build.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/profile_build.rs @@ -1,7 +1,5 @@ -//! The shared-permanent profile build behind the fixed-prefix and learned-main constructors (STRA-338 size: -//! extract-method only). +//! The shared-permanent profile build behind the fixed-prefix and learned-main constructors. -// Stays a glob on purpose: the file is at the 400-line limit and the explicit list would put it over. use super::{ Context, Entry, Error, HOST_CAP, HashMap, MAIN_LIMIT, ModelBinding, MoeMatrixRole, MoeWeightCache, MoeWeightDescriptor, PinnedPool, PrefixPlan, ProfileLimits, RankedProfile, Result, WORKING_RESERVE, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/shared_quartet_preload.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/shared_quartet_preload.rs index 627bff67..9d1d79d4 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/shared_quartet_preload.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/shared_quartet_preload.rs @@ -5,12 +5,12 @@ #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] #[cfg(test)] use super::profile_build::{ProfileFile, ProfileKind, ProfileRequest}; +#[cfg(test)] +use super::{Context, PROFILE_SHA, RankedProfile}; use super::{ DeviceRef, EncodedWeight, Entry, Error, MAIN_LIMIT, ModelBinding, MoeWeightCache, MoeWeightDescriptor, Result, WORKING_RESERVE, binding_error, cache_profile, driver_error, }; -#[cfg(test)] -use super::{Context, PROFILE_SHA, RankedProfile}; /// The room a shared quartet upload must leave free: the spill allowance and the main pool size once the quartet is /// inserted. diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp/kv_only.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp/kv_only.rs index 7f659162..cbf97fc1 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp/kv_only.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp/kv_only.rs @@ -1,7 +1,7 @@ //! Private canonical cell producer. It never represents a ready draft/residual. -use super::{Error, ModelBinding, MoeWeightCache, MtpFrame, MtpInput, QwenSession, Result}; #[cfg(test)] use super::{Cell, MtpSession, Rc}; +use super::{Error, ModelBinding, MoeWeightCache, MtpFrame, MtpInput, QwenSession, Result}; use crate::qwen_forward::session::chunk::{ChunkRowResidual, QwenChunkTxn}; // The same validated frame and canonical packed K/V tuple. diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/prefix_draft_snapshot.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/prefix_draft_snapshot.rs index 74f6aae7..c2ef55a6 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/prefix_draft_snapshot.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/prefix_draft_snapshot.rs @@ -2,9 +2,9 @@ //! the admission checks of its owner and frame. Also keeps the live-checkpoint count honest: dropping an //! `MtpCheckpoint` releases its slot against the cap. -use super::{CellPair, Error, HALF_ROW, MtpCheckpoint, MtpFrame, Rc, Result}; #[cfg(all(test, target_arch = "x86_64"))] use super::PrefixDraftSnapshot; +use super::{CellPair, Error, HALF_ROW, MtpCheckpoint, MtpFrame, Rc, Result}; #[cfg(test)] use super::{ModelBinding, MtpSession}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu/check_loaded.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu/check_loaded.rs index ea9edd93..e0c7f5d1 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu/check_loaded.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu/check_loaded.rs @@ -3,8 +3,8 @@ use super::{ Collection, DenseWeightCache, Dimension, Error, Expected, KarPleCache, ModelBinding, MoeWeightCache, MtpDecoder, - MtpWindowError, MtpWindowSpec, OutputStage, Position, PostcommitCancellation, QwenForward, QwenSession, ROW_CAP, Rc, - Report, ResetReplaySnapshot, Result, SNAPSHOT_CAP, Stage, TRANSACTION_CAP, TargetStepProduct, TokenId, VOCAB, + MtpWindowError, MtpWindowSpec, OutputStage, Position, PostcommitCancellation, QwenForward, QwenSession, ROW_CAP, + Rc, Report, ResetReplaySnapshot, Result, SNAPSHOT_CAP, Stage, TRANSACTION_CAP, TargetStepProduct, TokenId, VOCAB, different_token, mtp, observe, row_matches, }; use crate::qwen_forward::mtp_decode::MtpVerifiedWindow; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/first_seed_reuse_enabled.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/first_seed_reuse_enabled.rs index 16afe095..b5aff2b2 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/first_seed_reuse_enabled.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/first_seed_reuse_enabled.rs @@ -3,9 +3,9 @@ //! adaptive expert policy and no numerical observer active. The seed already fills slot zero, so the bounds change //! speculative work only; verification and accepted-prefix limits are unchanged. -use super::{Error, MoeWeightCache, MtpWindowError, Result}; #[cfg(all(test, target_arch = "x86_64"))] use super::batch_gpu; +use super::{Error, MoeWeightCache, MtpWindowError, Result}; // Only the selected adaptive policy, with numerical observer paths unchanged. pub(super) fn first_seed_reuse_enabled(cache: &MoeWeightCache<'_>) -> bool { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/mtp_decoder.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/mtp_decoder.rs index e7f5b514..54ebfb97 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/mtp_decoder.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/mtp_decoder.rs @@ -1,6 +1,8 @@ //! The methods of `MtpDecoder` that run a window: the batched window (with its plan), the scalar window and the //! draft warm-up. Separate from `mtp_decode`, which holds the decoder itself. +#[cfg(all(test, target_arch = "x86_64"))] +use super::batch_gpu; use super::{ DenseWeightCache, Dimension, DraftHeadOwners, Error, KnownNext, ModelBinding, MoeWeightCache, MtpDecoder, MtpInput, MtpSession, MtpVerifiedWindow, MtpWindowError, MtpWindowRequest, MtpWindowSpec, OutputStage, Position, @@ -8,10 +10,8 @@ use super::{ VerificationSource, WindowCaches, WindowOwners, first_seed_reuse_enabled, kv_prefill_host_charge, mtp, needed_draft_predictions, reserve, window_limit, window_stage_error, }; -#[cfg(all(test, target_arch = "x86_64"))] -use super::batch_gpu; -mod batched_window_plan; mod batched_window; +mod batched_window_plan; mod draft_warm_and_window; mod scalar_window; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/mtp_decoder/batched_window_plan.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/mtp_decoder/batched_window_plan.rs index 98b16cc6..5bb0dbe1 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/mtp_decoder/batched_window_plan.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/mtp_decoder/batched_window_plan.rs @@ -1,12 +1,12 @@ //! The plan, the context and the head of one batched MTP window. Separate from `batched_window`, which runs the //! window, so that what a window is made of reads apart from how it runs. +#[cfg(all(test, target_arch = "x86_64"))] +use super::batch_gpu; use super::{ DenseWeightCache, Error, ModelBinding, MoeWeightCache, MtpInput, MtpWindowError, MtpWindowRequest, MtpWindowSpec, OutputStage, Result, TargetStepProduct, TokenId, mtp, }; -#[cfg(all(test, target_arch = "x86_64"))] -use super::batch_gpu; use crate::qwen_forward::mtp::{MtpCheckpoint, RetainedFirstSeed}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace/fixed_workspace_gpu.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace/fixed_workspace_gpu.rs index 378fdfa5..7b7d6d9e 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace/fixed_workspace_gpu.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace/fixed_workspace_gpu.rs @@ -3,14 +3,14 @@ //! cleanly. use super::super::mtp_expert_transport::{ExpertWeights, FixedReference, SelectedRoute, fixed_reference}; +#[cfg(test)] +use super::Observations; +#[cfg(all(test, target_arch = "x86_64"))] +use super::ObservedOutput; use super::{ ALLOCATED_BYTES, CHARGES, Cell, Context, DeviceBuffer, Error, ExpertInputs, FF, FixedBuffers, K, N, Rc, Result, Role, Slot, Transport, at, compose, compose_inner, download, moe_driver_error, }; -#[cfg(all(test, target_arch = "x86_64"))] -use super::ObservedOutput; -#[cfg(test)] -use super::Observations; use leleka_cuda_driver::Driver; const BANK_BYTES: usize = 707_788_800; const BLOB_BYTES: usize = 1_382_400; @@ -47,9 +47,7 @@ fn bank_fixture() -> Vec { bank } fn fill_blob(blob: &mut [u8], expert: usize) { - for (rows, columns, codes, scales, chunks) in - [(1280, 640, 0, 1_228_800, 40), (2560, 160, 819_200, 1_331_200, 10)] - { + for (rows, columns, codes, scales, chunks) in [(1280, 640, 0, 1_228_800, 40), (2560, 160, 819_200, 1_331_200, 10)] { fill_blob_matrix(blob, expert, &BlobMatrix { rows, columns, codes, scales, chunks }); } } @@ -185,12 +183,8 @@ impl<'ctx> Rig<'ctx> { .produce(Role::RoutedGu(0, IDS[0]), |inputs, out| { let input = leleka_cuda_driver::MtpQuantizedInput { values: at(inputs, q)?, scales: at(inputs, scales)? }; - ctx.mtp_s2_gate_up_full( - leleka_cuda_driver::MtpS2SelectedExpert { bank, expert: IDS[0] }, - input, - out, - ) - .map_err(moe_driver_error) + ctx.mtp_s2_gate_up_full(leleka_cuda_driver::MtpS2SelectedExpert { bank, expert: IDS[0] }, input, out) + .map_err(moe_driver_error) }) .unwrap(); assert_eq!(t.validate(&gu, Role::RoutedGu(1, IDS[1])).err(), Some(Error::IdentityMismatch)); @@ -199,12 +193,7 @@ impl<'ctx> Rig<'ctx> { assert_eq!(t.finish::<()>(Err(Error::IdentityMismatch)), Err(Error::IdentityMismatch)); } // Late actual expert GU nonfinite: both original and fixed must refuse. - fn refuse_late_nonfinite( - &mut self, - storage: &mut FixedBuffers<'ctx>, - corpus: &mut [u8], - mixed: &[f32], - ) -> usize { + fn refuse_late_nonfinite(&mut self, storage: &mut FixedBuffers<'ctx>, corpus: &mut [u8], mixed: &[f32]) -> usize { let at = IDS[9] as usize * BLOB_BYTES + 1_228_800 + (1279 * 40 + 39) * 2; let saved: [u8; 2] = corpus[at..at + 2].try_into().unwrap(); corpus[at..at + 2].copy_from_slice(&0x7c00u16.to_le_bytes()); diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace/role.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace/role.rs index 44c02fc0..213d4123 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace/role.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace/role.rs @@ -3,12 +3,12 @@ //! Also runs the original FP32-scale quantizers, whose completed scales are inspected before any grouped dot uses //! them. +#[cfg(test)] +use super::K; use super::{ Cell, DEVICE_PEAK, DeviceBuffer, Error, FF, Finite, FixedBuffers, N, Rc, Result, Role, Slot, Transport, at, download, moe_driver_error, preflight, validate_values, }; -#[cfg(test)] -use super::K; impl Role { pub(super) fn slot(self) -> Slot { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace/transport_drop.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace/transport_drop.rs index 2c100937..47c14348 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace/transport_drop.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace/transport_drop.rs @@ -2,13 +2,13 @@ //! scaled by its scalar), the packed routed Downs and the final combine in router slot order. Also releases every //! leased buffer when a transport drops; the first failure stops before any later expert runs. +#[cfg(test)] +use super::download; use super::{ CHARGES, Cell, DenseFormat, DeviceBuffer, Error, ExpertInputs, FF, Finite, FixedBuffers, K, N, Packed, ProjectionKind, ProjectionSpec, QuantizedIndices, Rc, Result, Role, RouteSlot, Slot, Transport, moe_driver_error, preflight, validate_route, validate_values, }; -#[cfg(test)] -use super::download; impl Drop for Transport<'_, '_> { fn drop(&mut self) { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/mtp_expert_transport/mtp_expert_transport_gpu.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/mtp_expert_transport/mtp_expert_transport_gpu.rs index c02d7bfb..4ac9e14c 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/mtp_expert_transport/mtp_expert_transport_gpu.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/mtp_expert_transport/mtp_expert_transport_gpu.rs @@ -1,13 +1,13 @@ //! New lossless MTP expert transport proof, not an S2 arithmetic requalification. #![cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] use super::super::super::qsa_index::{allocate, download_bytes, release, upload}; +#[cfg(test)] +use super::compose_observed; use super::{ Cell, Context, DEVICE_PEAK, DenseFormat, DeviceBuffer, Error, ExpertWeights, FF, K, N, Packed, ProjectionKind, ProjectionSpec, Rc, Result, Role, RoutedExpert, SelectedRoute, Transport, compose, download, routed, shared, shared_project, }; -#[cfg(test)] -use super::compose_observed; use leleka_cuda_driver::Driver; const BANK_BYTES: usize = 707_788_800; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/mtp_expert_transport/mtp_expert_transport_gpu/exact.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/mtp_expert_transport/mtp_expert_transport_gpu/exact.rs index e08d9cd4..80bafc0f 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/mtp_expert_transport/mtp_expert_transport_gpu/exact.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/mtp_expert_transport/mtp_expert_transport_gpu/exact.rs @@ -2,13 +2,13 @@ //! Builds a synthetic expert bank, runs each routed expert and the shared expert through the original stages with //! every stage read back, and checks the retained transport matches that baseline bit for bit. +#[cfg(test)] +use super::compose_observed; use super::{ BANK_BYTES, BLOB_BYTES, Cell, Context, DenseFormat, DeviceBuffer, Env, Error, ExpertWeights, FF, IDS, N, Original, ProjectionKind, ProjectionSpec, ROUTE, Result, Role, SelectedRoute, allocate, download, download_bytes, release, upload, }; -#[cfg(test)] -use super::compose_observed; pub(super) fn exact(a: &[f32], b: &[f32]) { assert_eq!(a.len(), b.len()); diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/mtp_expert_transport/shared_project.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/mtp_expert_transport/shared_project.rs index b6041e1a..b0e2acae 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/mtp_expert_transport/shared_project.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/mtp_expert_transport/shared_project.rs @@ -2,16 +2,16 @@ //! the routed Downs packed in slot order, and the weighted combine. Entry points `compose` and `compose_observed` run //! a whole block; the first failure stops before any later expert runs. -use super::{ - Cell, Context, DenseFormat, DeviceBuffer, Error, FF, Finite, K, N, Packed, ProjectionKind, ProjectionSpec, Rc, - Result, Role, RoutedExpert, Transport, at, moe_driver_error, preflight, routed, validate_route, validate_values, -}; #[cfg(all(test, target_arch = "x86_64"))] use super::FixedReference; #[cfg(test)] use super::ObservedOutput; #[cfg(test)] use super::download; +use super::{ + Cell, Context, DenseFormat, DeviceBuffer, Error, FF, Finite, K, N, Packed, ProjectionKind, ProjectionSpec, Rc, + Result, Role, RoutedExpert, Transport, at, moe_driver_error, preflight, routed, validate_route, validate_values, +}; pub(super) fn shared_project( transport: &mut Transport<'_>, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_config/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_config/tests.rs index e5a50f94..d27eb645 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_config/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_config/tests.rs @@ -1,13 +1,13 @@ //! Pins the Mode17 values derived for the Original serve path: pack expert bank and footprint switches, blob sizes, //! rope theta scale, MTP policies, sampler path flags, request parameter mapping and the geometry and prefill carve. +#[cfg(test)] +use super::legacy_footprint_from; use super::{ Error, ExpertBlobSizes, OriginalMtpGrVariant, RopeConstants, SamplerPath, driver_sampler_params, greedy_params, legacy_footprint, mtp_full_policy, mtp_pack_experts_needed, mtp_scalar_policy, prefill_layout_options, sampler_path, verify_geometry, }; -#[cfg(test)] -use super::legacy_footprint_from; #[test] fn the_pack_expert_bank_is_needed_only_without_an_rt_directory() { // pack-driven draft (no RT directory): the pack's experts are the draft layer's experts diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/draft_completion.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/draft_completion.rs index dece4ef9..b33b630e 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/draft_completion.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/draft_completion.rs @@ -7,5 +7,5 @@ use super::{ TargetSeedRow, }; -mod spec_engine_for_serve_engine; mod serve_engine_draft_commit; +mod spec_engine_for_serve_engine; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_host.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_host.rs index 56c0b7b7..2b61a4f7 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_host.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_host.rs @@ -40,8 +40,8 @@ use super::{ use crate::model_binding::qwen4exp_input::{BoundLayerKind, ModelBinding}; use leleka_cuda_driver::{ AcceptedWindow, Context, DeviceBuffer, OriginalGpuEvent, OriginalMtpFullPolicy, OriginalNativeHeadGraphResources, - OriginalVerifier, OriginalVerifyGraphResources, OriginalVerifyQsaJournal, OriginalVerifyWindowResult, SamplerParams, - SamplerPath, + OriginalVerifier, OriginalVerifyGraphResources, OriginalVerifyQsaJournal, OriginalVerifyWindowResult, + SamplerParams, SamplerPath, }; use std::rc::Rc; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_pool/pool_layer_trace.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_pool/pool_layer_trace.rs index 442646fd..6adb94e2 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_pool/pool_layer_trace.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_pool/pool_layer_trace.rs @@ -4,7 +4,7 @@ //! tasks spread over the threads and how long a task took. All times are microseconds from the publication of the //! phase; `[a,b,c,d]` is min, p50, p90, max over the threads (`task`: over the tasks). -use leleka_native_cpu_expert::{PhaseTrace, POOL_TIMING_STAGES}; +use leleka_native_cpu_expert::{POOL_TIMING_STAGES, PhaseTrace}; /// What the engine knows about the group the pool just computed. pub(super) struct GroupTraceInfo { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_pool/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_pool/tests.rs index c5350e6b..c5a7dcf7 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_pool/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_pool/tests.rs @@ -1,9 +1,9 @@ //! Pins the expert group plan: every (row, slot) pair planned once with experts in first-use order, masked GPU //! entries left out but still validated, bad router output refused, and scatter offsets of each output slot. -use super::{Error, ExpertJob, HIDDEN, TOP_K, output_offset, plan_experts_where, scatter, selection}; #[cfg(test)] use super::plan_experts; +use super::{Error, ExpertJob, HIDDEN, TOP_K, output_offset, plan_experts_where, scatter, selection}; fn ids(rows: &[[i32; TOP_K]]) -> Vec { rows.iter().flatten().copied().collect() diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_request.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_request.rs index 48ec360a..07c84687 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_request.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_request.rs @@ -10,9 +10,9 @@ use super::{contract::Error, original_serve_engine::ServeOutcome, original_spec_controller::SpecError}; use leleka_cuda_driver::{SamplerParams, SamplerPath}; -pub(crate) use leleka_engine_core::request::{Admission, original_stop_tokens}; #[cfg(test)] pub(crate) use leleka_engine_core::request::ENDOFTEXT_TOKEN; +pub(crate) use leleka_engine_core::request::{Admission, original_stop_tokens}; /// How a request ended when it did not complete, over this stack's forward error. pub(crate) type ServeError = leleka_engine_core::request::ServeError; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency.rs index 0f01bbbd..f4515ec8 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency.rs @@ -286,21 +286,21 @@ mod split_group_pcie; #[cfg(test)] use split_group_pcie::adapt_decay; use split_group_pcie::adapt_tuning; -pub(in crate::qwen_forward) use split_group_pcie::{choose_swaps, choose_swaps_by}; #[cfg(test)] use split_group_pcie::choose_swaps_reference; pub(in crate::qwen_forward) use split_group_pcie::pcie_locked_only; pub(in crate::qwen_forward) use split_group_pcie::split_group_pcie; pub(in crate::qwen_forward) use split_group_pcie::{PcieSplitPolicy, RoutedGroup}; +pub(in crate::qwen_forward) use split_group_pcie::{choose_swaps, choose_swaps_by}; mod cross_layer_potential; mod swap_tie_order; pub(in crate::qwen_forward) use swap_tie_order::TieOrder; mod strata_pcie_auto; use strata_pcie_auto::StrataPcieAuto; mod pcie_auto_on_window_pool; +mod span_cache_and_pcie_lag; #[cfg(test)] mod strata_pcie_auto_tests; -mod span_cache_and_pcie_lag; use span_cache_and_pcie_lag::span_cache_enabled; mod source_spans; pub(super) use source_spans::source_spans; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/open_tier.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/open_tier.rs index 4c659764..4293ca74 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/open_tier.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/open_tier.rs @@ -1,13 +1,13 @@ //! Functions: `open_tier`, `fill_and_pin`, `read_profile`, `warn_decode_headroom` and 15 more. //! Split out of `original_serve_residency` to keep its files under the line limit. -use super::{ - LOAN_FLOOR, VANILLA_FREE_FLOOR_MIB, VERIFIER_ASSEMBLY_MIB, Context, Error, ExpertTierConfig, ModelBinding, - MoeWeightCache, OriginalCacheOptions, OriginalExpertCache, OriginalRankedExperts, Rc, ResidentExpertBankSpan, - Result, SpanCache, driver_error, original_cache_startup, span_cache_enabled, -}; #[cfg(not(target_os = "linux"))] use super::MappedExpertBank; +use super::{ + Context, Error, ExpertTierConfig, LOAN_FLOOR, ModelBinding, MoeWeightCache, OriginalCacheOptions, + OriginalExpertCache, OriginalRankedExperts, Rc, ResidentExpertBankSpan, Result, SpanCache, VANILLA_FREE_FLOOR_MIB, + VERIFIER_ASSEMBLY_MIB, driver_error, original_cache_startup, span_cache_enabled, +}; use leleka_cuda_driver::RefillBatchOptions; /// generate.cpp startup of the tier for the serve stack: size and open the cache after every other owner, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/conversation/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/conversation/tests.rs index e7617ff2..eb7f65a1 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/conversation/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/conversation/tests.rs @@ -1,5 +1,4 @@ -//! Pins the serve conversation policy over a fake stack: a continuing request resumes at its last turn, a settled -//! session continues live, cancel and failure keep or drop checkpoints, the chain is bounded and reread mode works. +//! Pins the serve conversation policy over a fake stack: resume, settle, cancel, failure, bounded chain, reread. use super::{ConversationConfig, Error, PromptOptions, RequestStart, ResumeDevice, ServeConversation, TURN_TOKEN}; use crate::backend::original_prompt::{PlanLimits, PromptPath, PromptPlan, ResumePoint}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods.rs index ad95b9d4..58ca4811 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods.rs @@ -33,9 +33,10 @@ mod executor_opening; use executor_opening::ExecutorOpening; mod open_phase_steps; use open_phase_steps::{ - Policies, Weights, check_open, load_weights, loan_ladder, log_open_inventory, open_executor, open_expert_cache, - open_prefix, serve_policies, share_rt_dense_roles, + Policies, Weights, check_open, load_weights, open_executor, serve_policies, share_rt_dense_roles, }; +mod open_cache_steps; +use open_cache_steps::{loan_ladder, log_open_inventory, open_expert_cache, open_prefix}; mod serve_request_step; use serve_request_step::{ServeEnv, serve_over_host}; mod original_serve_stack_decode_phase; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/open_cache_steps.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/open_cache_steps.rs new file mode 100644 index 00000000..a37918c3 --- /dev/null +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/open_cache_steps.rs @@ -0,0 +1,157 @@ +//! The caches `open` sizes from what the host has: the cross-session prefix cache (budget from the memory governor), +//! the VRAM expert tier with its loan ladder, and the governor's startup inventory log. + +use super::{ + Context, LOAN_TIER_ROWS, LoanTier, ModelBinding, MoeWeightCache, OriginalExpertCache, PARKED_BYTES_PER_TOKEN, + PARKED_STATE_ESTIMATE, PINNED_MODEL, PrefillLayoutOptions, PrefixServe, ServeFailure, StackBlock, StackConfig, + StackState, at, operator_note, original_serve_residency, prefill_bytes, +}; + +/// The cross-session prefix cache of the config, sized from the memory governor's budget; `None` when it is off or has +/// no budget. +pub(super) fn open_prefix(config: &StackConfig) -> Option> { + let prefix_config = config.prefix.as_ref()?; + let available = crate::conversation::memory::available_memory(); + // the budget comes from the memory governor (what is left above the floors), not from an independent default + let complement_pending = (config.expert_tier.resident_budget_gib.max(0.0) * (1u64 << 30) as f64) as u64; + let bytes = crate::memory_governor::resolve_prefix_budget(prefix_config.budget, available, complement_pending) + .unwrap_or_else(|| prefix_config.resolve_budget(available)); + let mut prefix_config = prefix_config.clone(); + if let Some(g) = leleka_memory::Governor::global() { + // stop admitting before anything has to be shed: soft floor + reserve (the real CRM session sat 4.4 GiB above + // a 3 GiB floor) + prefix_config.memory_floor = prefix_config.memory_floor.max(g.policy().admit_floor()); + } + let prefix_config = &prefix_config; + if bytes == 0 { + operator_note(&format!( + "prefix cache off (budget {:?}, available host memory {:?} MiB)", + prefix_config.budget, + available.map(|b| b >> 20) + )); + return None; + } + let identity = format!("qwen4exp:{PINNED_MODEL}:kv={:?}:resident={}", config.kv_format, config.kv_resident); + let clock = config.clock.clone(); + let serve = PrefixServe::new(prefix_config.clone(), config.capacity, bytes, &identity).with_clock(clock); + note_prefix_on(&serve, bytes, available); + Some(serve) +} + +fn note_prefix_on(serve: &PrefixServe, bytes: u64, available: Option) { + operator_note(&format!( + "prefix cache on: block/grid {} tokens, budget {} MiB, state ~{} MiB + {} B per token, \ + host memory available {:?} MiB, namespace {}", + serve.block_tokens(), + bytes >> 20, + PARKED_STATE_ESTIMATE >> 20, + PARKED_BYTES_PER_TOKEN, + available.map(|b| b >> 20), + crate::prefix_cache::summary::hex(serve.namespace()) + )); +} + +/// The VRAM expert tier and the number of its last slots the prompt path borrows (`None`: it allocates its own +/// buffers). +pub(super) fn open_expert_cache<'ctx>( + binding: &ModelBinding, + context: &'ctx Context<'ctx>, + moe: &MoeWeightCache<'ctx>, + config: &StackConfig, + layout: PrefillLayoutOptions, +) -> std::result::Result<(Option>, Option), ServeFailure> { + let mut loan = None; + let tier_open = staged!( + "expert tier (VRAM slots + profile fill)", + context, + original_serve_residency::open_tier(binding, context, moe, &config.expert_tier, config.capacity) + .map_err(at("expert tier"))? + ); + let expert_cache = match tier_open { + Some((cache, filled)) => { + if config.expert_tier.prefill_borrow && config.expert_tier.profile.is_some() { + loan = + original_serve_residency::loan_slots(&cache, prefill_bytes(layout).map_err(at("prefill bytes"))?) + .map_err(at("expert-cache loan"))?; + } + note_expert_cache(&cache, filled, loan); + note_tier_adaptation(&config.expert_tier); + Some(cache) + } + None => None, + }; + Ok((expert_cache, loan)) +} + +/// The tier's adaptation settings on the operator log (an A/B arm that sets them can show the engine got them). +fn note_tier_adaptation(tier: &original_serve_residency::ExpertTierConfig) { + operator_note(&format!( + "expert tier adaptation: every {} rounds, up to {} swaps", + tier.adapt_every, tier.adapt_swaps + )); +} + +fn note_expert_cache(cache: &OriginalExpertCache<'_>, filled: usize, loan: Option) { + operator_note(&format!( + "expert cache {} slots ({:.2} GiB, {}), {filled} filled from the profile; the prompt path {}; \ + GPU experts round differently from the CPU's (bench/results/2026-09-27-cache-parity)", + cache.slots(), + cache.bytes() as f64 / f64::from(1u32 << 30), + if cache.per_layer_admission() { "per layer" } else { "global" }, + match loan { + Some(k) => format!("borrows its last {k} slots"), + None => "allocates its own buffers".to_owned(), + } + )); +} + +/// Smaller loans for smaller chunks (`LELEKA_PREFILL_LOAN_TIERS=1`), ascending by rows; empty when the ladder is off. +pub(super) fn loan_ladder( + config: &StackConfig, + layout: PrefillLayoutOptions, + loan: Option, + expert_cache: Option<&OriginalExpertCache<'_>>, +) -> std::result::Result, ServeFailure> { + let mut loan_tiers: Vec = Vec::new(); + if let (Some(full), Some(cache), true) = (loan, expert_cache, config.loan_tiers) { + for rows in LOAN_TIER_ROWS.into_iter().filter(|&r| r < config.capacity) { + let tier_layout = PrefillLayoutOptions { capacity: rows, ..layout }; + let slots = original_serve_residency::loan_slots( + cache, + prefill_bytes(tier_layout).map_err(at("prefill bytes (tier)"))?, + ) + .map_err(at("expert-cache loan (tier)"))?; + if let Some(slots) = slots.filter(|&s| s < full && loan_tiers.last().is_none_or(|t| s > t.slots)) { + loan_tiers.push(LoanTier { rows, layout: tier_layout, slots }); + } + } + if !loan_tiers.is_empty() { + note_loan_ladder(&loan_tiers, full, config.capacity); + } + } + Ok(loan_tiers) +} + +fn note_loan_ladder(loan_tiers: &[LoanTier], full: usize, capacity: usize) { + operator_note(&format!( + "prompt loan ladder: {}, up to {capacity} rows {full} slots", + loan_tiers.iter().map(|t| format!("up to {} rows {} slots", t.rows, t.slots)).collect::>().join(", ") + )); +} + +/// The governor's startup log: the inventory of allocation classes and the load ledger. +pub(super) fn log_open_inventory() { + if let Some(governor) = leleka_memory::Governor::global() { + governor.log(&format!( + "stack open; inventory of allocation classes (accounted by their owners): +{}", + governor.inventory().table() + )); + governor.log(&format!( + "load ledger (measured: kernel and driver deltas per opening step): +{}", + governor.ledger().table() + )); + governor.publish(); + } +} diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/open_phase_steps.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/open_phase_steps.rs index 48b42a19..cd6af9b2 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/open_phase_steps.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/open_phase_steps.rs @@ -1,15 +1,12 @@ //! The steps of `OriginalServeStack::open`: check the model shape, resolve the policies, load the weights (KAR, //! embedding), in the order `open` runs them. Each step keeps its stage marks, notes and error context. -// Stays a glob on purpose: the file is at the 400-line limit and the explicit list would put it over. use super::{ Context, DenseWeightCache, DraftAttachmentTables, DraftAttachmentTarget, Error, ExecutorOpening, ExecutorSizing, - ExecutorTarget, KarPleCache, LOAN_TIER_ROWS, LoanTier, ModelBinding, MoeWeightCache, NativeHeadDispatch, - OriginalExpertCache, OriginalMtpFullOwner, OriginalNativeOutput, OriginalPromptEmbedding, OriginalPromptExecutor, - OriginalServeSettings, OriginalSpecController, PARKED_BYTES_PER_TOKEN, PARKED_STATE_ESTIMATE, PINNED_MODEL, - PrefillLayoutOptions, PrefixServe, PromptWeights, QwenSession, Rc, RtMtpLoad, ServeFailure, StackBlock, - StackConfig, StackState, VOCABULARY, at, dbg_el, failure, operator_note, original_serve_residency, prefill_bytes, - vram_note, + ExecutorTarget, KarPleCache, ModelBinding, MoeWeightCache, NativeHeadDispatch, OriginalMtpFullOwner, + OriginalNativeOutput, OriginalPromptEmbedding, OriginalPromptExecutor, OriginalServeSettings, + OriginalSpecController, PrefillLayoutOptions, PromptWeights, QwenSession, Rc, RtMtpLoad, ServeFailure, StackConfig, + VOCABULARY, at, dbg_el, failure, operator_note, vram_note, }; use crate::qwen_forward::session::original_prompt::draft::OriginalDraftSession; @@ -256,152 +253,3 @@ pub(super) fn share_rt_dense_roles<'ctx>( } Ok(()) } - -/// The cross-session prefix cache of the config, sized from the memory governor's budget; `None` when it is off or has -/// no budget. -pub(super) fn open_prefix(config: &StackConfig) -> Option> { - let prefix_config = config.prefix.as_ref()?; - let available = crate::conversation::memory::available_memory(); - // the budget comes from the memory governor (what is left above the floors), not from an independent default - let complement_pending = (config.expert_tier.resident_budget_gib.max(0.0) * (1u64 << 30) as f64) as u64; - let bytes = crate::memory_governor::resolve_prefix_budget(prefix_config.budget, available, complement_pending) - .unwrap_or_else(|| prefix_config.resolve_budget(available)); - let mut prefix_config = prefix_config.clone(); - if let Some(g) = leleka_memory::Governor::global() { - // stop admitting before anything has to be shed: soft floor + reserve (the real CRM session sat 4.4 GiB above - // a 3 GiB floor) - prefix_config.memory_floor = prefix_config.memory_floor.max(g.policy().admit_floor()); - } - let prefix_config = &prefix_config; - if bytes == 0 { - operator_note(&format!( - "prefix cache off (budget {:?}, available host memory {:?} MiB)", - prefix_config.budget, - available.map(|b| b >> 20) - )); - return None; - } - let identity = format!("qwen4exp:{PINNED_MODEL}:kv={:?}:resident={}", config.kv_format, config.kv_resident); - let clock = config.clock.clone(); - let serve = PrefixServe::new(prefix_config.clone(), config.capacity, bytes, &identity).with_clock(clock); - note_prefix_on(&serve, bytes, available); - Some(serve) -} - -fn note_prefix_on(serve: &PrefixServe, bytes: u64, available: Option) { - operator_note(&format!( - "prefix cache on: block/grid {} tokens, budget {} MiB, state ~{} MiB + {} B per token, \ - host memory available {:?} MiB, namespace {}", - serve.block_tokens(), - bytes >> 20, - PARKED_STATE_ESTIMATE >> 20, - PARKED_BYTES_PER_TOKEN, - available.map(|b| b >> 20), - crate::prefix_cache::summary::hex(serve.namespace()) - )); -} - -/// The VRAM expert tier and the number of its last slots the prompt path borrows (`None`: it allocates its own -/// buffers). -pub(super) fn open_expert_cache<'ctx>( - binding: &ModelBinding, - context: &'ctx Context<'ctx>, - moe: &MoeWeightCache<'ctx>, - config: &StackConfig, - layout: PrefillLayoutOptions, -) -> std::result::Result<(Option>, Option), ServeFailure> { - let mut loan = None; - let tier_open = staged!( - "expert tier (VRAM slots + profile fill)", - context, - original_serve_residency::open_tier(binding, context, moe, &config.expert_tier, config.capacity) - .map_err(at("expert tier"))? - ); - let expert_cache = match tier_open { - Some((cache, filled)) => { - if config.expert_tier.prefill_borrow && config.expert_tier.profile.is_some() { - loan = - original_serve_residency::loan_slots(&cache, prefill_bytes(layout).map_err(at("prefill bytes"))?) - .map_err(at("expert-cache loan"))?; - } - note_expert_cache(&cache, filled, loan); - note_tier_adaptation(&config.expert_tier); - Some(cache) - } - None => None, - }; - Ok((expert_cache, loan)) -} - -/// The tier's adaptation settings on the operator log (an A/B arm that sets them can show the engine got them). -fn note_tier_adaptation(tier: &original_serve_residency::ExpertTierConfig) { - operator_note(&format!( - "expert tier adaptation: every {} rounds, up to {} swaps", - tier.adapt_every, tier.adapt_swaps - )); -} - -fn note_expert_cache(cache: &OriginalExpertCache<'_>, filled: usize, loan: Option) { - operator_note(&format!( - "expert cache {} slots ({:.2} GiB, {}), {filled} filled from the profile; the prompt path {}; \ - GPU experts round differently from the CPU's (bench/results/2026-09-27-cache-parity)", - cache.slots(), - cache.bytes() as f64 / f64::from(1u32 << 30), - if cache.per_layer_admission() { "per layer" } else { "global" }, - match loan { - Some(k) => format!("borrows its last {k} slots"), - None => "allocates its own buffers".to_owned(), - } - )); -} - -/// Smaller loans for smaller chunks (`LELEKA_PREFILL_LOAN_TIERS=1`), ascending by rows; empty when the ladder is off. -pub(super) fn loan_ladder( - config: &StackConfig, - layout: PrefillLayoutOptions, - loan: Option, - expert_cache: Option<&OriginalExpertCache<'_>>, -) -> std::result::Result, ServeFailure> { - let mut loan_tiers: Vec = Vec::new(); - if let (Some(full), Some(cache), true) = (loan, expert_cache, config.loan_tiers) { - for rows in LOAN_TIER_ROWS.into_iter().filter(|&r| r < config.capacity) { - let tier_layout = PrefillLayoutOptions { capacity: rows, ..layout }; - let slots = original_serve_residency::loan_slots( - cache, - prefill_bytes(tier_layout).map_err(at("prefill bytes (tier)"))?, - ) - .map_err(at("expert-cache loan (tier)"))?; - if let Some(slots) = slots.filter(|&s| s < full && loan_tiers.last().is_none_or(|t| s > t.slots)) { - loan_tiers.push(LoanTier { rows, layout: tier_layout, slots }); - } - } - if !loan_tiers.is_empty() { - note_loan_ladder(&loan_tiers, full, config.capacity); - } - } - Ok(loan_tiers) -} - -fn note_loan_ladder(loan_tiers: &[LoanTier], full: usize, capacity: usize) { - operator_note(&format!( - "prompt loan ladder: {}, up to {capacity} rows {full} slots", - loan_tiers.iter().map(|t| format!("up to {} rows {} slots", t.rows, t.slots)).collect::>().join(", ") - )); -} - -/// The governor's startup log: the inventory of allocation classes and the load ledger. -pub(super) fn log_open_inventory() { - if let Some(governor) = leleka_memory::Governor::global() { - governor.log(&format!( - "stack open; inventory of allocation classes (accounted by their owners): -{}", - governor.inventory().table() - )); - governor.log(&format!( - "load ledger (measured: kernel and driver deltas per opening step): -{}", - governor.ledger().table() - )); - governor.publish(); - } -} diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/tests.rs index 4b26e395..c447f0a2 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/tests.rs @@ -3,8 +3,8 @@ use super::super::original_spec_draft::{DraftPick, FirstSeedPoint, OriginalFirstDraftEngine, TargetSeedRow}; use super::{ - AdaptiveConfig, DraftPreparation, DraftSampling, Error, NanGuard, OriginalDraftEngine, OriginalSpecController, OriginalSpecEngine, - Result, SpecConfig, SpecError, SpecWindow, + AdaptiveConfig, DraftPreparation, DraftSampling, Error, NanGuard, OriginalDraftEngine, OriginalSpecController, + OriginalSpecEngine, Result, SpecConfig, SpecError, SpecWindow, }; mod golden; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/tests/config_rejects_out_of_range.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/tests/config_rejects_out_of_range.rs index d3224760..f9ee0902 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/tests/config_rejects_out_of_range.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/tests/config_rejects_out_of_range.rs @@ -3,8 +3,8 @@ //! drafter. use super::{ - AdaptiveConfig, EndRunSetup, Error, Fake, NanGuard, OriginalSpecController, SpecConfig, SpecWindow, VOCAB, begin, config, drive, - expected, prompt, run_to_the_end, + AdaptiveConfig, EndRunSetup, Error, Fake, NanGuard, OriginalSpecController, SpecConfig, SpecWindow, VOCAB, begin, + config, drive, expected, prompt, run_to_the_end, }; #[test] diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/output/output_stage_test_replay.rs b/crates/engine-qwen35-cuda/src/qwen_forward/output/output_stage_test_replay.rs index 023dcf37..aeab5ce9 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/output/output_stage_test_replay.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/output/output_stage_test_replay.rs @@ -1,13 +1,13 @@ //! Test-only replay hooks of OutputStage (record logits of a reset or prefix replay, count compact completions) and //! the shared helpers of the stage: greedy pick, activation and logit encoding, weight-owner check and error mapping. +#[cfg(test)] +use super::OutputStage; use super::{ ACTIVATION_BYTES, BindingIdentity, Dimension, EMBEDDING, Error, FiniteF32, FiniteLogits, HeadGreedySelection, LOGIT_BYTES, LogitValues, OUTPUT_WEIGHT_BYTES, OutputBindingError, OutputWeights, Result, Stage, TokenId, VOCABULARY, }; -#[cfg(test)] -use super::OutputStage; // The real ignored reset test opts in explicitly. Other test callers retain // no extra values; production builds have neither this storage nor a reader. diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_attention.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_attention.rs index 90e5ec92..6a0580b1 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_attention.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_attention.rs @@ -100,8 +100,8 @@ pub(super) struct NativePromptAttentionBatch<'source, 'lease, 'ctx> { provider: Rc, } -mod qsa_ready; mod decode_selected_cached; +mod qsa_ready; use decode_selected_cached::SelectedKvBytes; use decode_selected_cached::attend_retained; use decode_selected_cached::attention_driver_error; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/context.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/context.rs index 46505962..a8c3655e 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/context.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/context.rs @@ -2,14 +2,14 @@ //! layer's KV pages, pooled index keys and tail at a position), with their equality, extent and gather checks. //! Also the serving context size and the device headroom a QSA step requires. -use super::{ - BindingIdentity, Directory, Error, KV, LayerId, PackedKv, Position, QsaOwner, QsaPrior, Rc, Result, Stage, State, - reserve, validate_half, validate_ids, validate_values, -}; #[cfg(all(test, target_arch = "x86_64"))] use super::OracleQsaParts; #[cfg(test)] use super::PAGE; +use super::{ + BindingIdentity, Directory, Error, KV, LayerId, PackedKv, Position, QsaOwner, QsaPrior, Rc, Result, Stage, State, + reserve, validate_half, validate_ids, validate_values, +}; /// The serving context in cells (262144 unless configured; see `contract::serving_cells`). pub(super) fn context() -> usize { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/index_resident.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/index_resident.rs index e49029f6..3a7d26da 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/index_resident.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/index_resident.rs @@ -1,13 +1,13 @@ //! Actor-owned bounded index-key mirror; host QsaPrior remains canonical. //! Only exact immutable parent identity permits incremental device publication. +#[cfg(all(test, target_arch = "x86_64"))] +use super::combined_qsa_observer; use super::{ BindingIdentity, BlockQuery, Context, DeviceBuffer, Error, QsaPrior, QsaSelectionRequest, Rc, Result, admit_budget, context, device_peak, driver_error, reserve, select_with_keys, validate_values, }; #[cfg(test)] use super::{Directory, KvPage, LayerId, PAGE, Position, QsaOwner, State, TokenLayer}; -#[cfg(all(test, target_arch = "x86_64"))] -use super::combined_qsa_observer; #[cfg(test)] use super::{KV, QsaPending, select}; use std::cell::Cell; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/index_resident/max_rows.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/index_resident/max_rows.rs index e784d4c2..1536ddc7 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/index_resident/max_rows.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/index_resident/max_rows.rs @@ -2,13 +2,13 @@ //! that brings it from one `QsaPrior` to its successor: reload, append one pooled row, or change only the spare row. //! Reset, replay and speculative branches are misses. A layer's mirror is allocated on its first selection. +#[cfg(all(test, target_arch = "x86_64"))] +use super::combined_qsa_observer; use super::{ BindingIdentity, BlockQuery, Cell, Context, Entry, Error, QsaIndexKeyCache, QsaPrior, QsaSelectionRequest, ROW_BYTES, Rc, Result, Update, admit_budget, context, device_peak, driver_error, reserve, select_with_keys, validate_values, }; -#[cfg(all(test, target_arch = "x86_64"))] -use super::combined_qsa_observer; /// Pooled key rows of the serving context (`65537` at 262144 cells). pub(super) fn max_rows() -> usize { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/qsa_index_stage.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/qsa_index_stage.rs index baaa73bf..8940076d 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/qsa_index_stage.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/qsa_index_stage.rs @@ -2,14 +2,14 @@ //! Projects the host rows or the native prompt row, then builds the next prior as a pending candidate that is //! published only at token commit. Admission checks the binding, layer, position and residual input first. +#[cfg(all(test, target_arch = "x86_64"))] +use super::combined_qsa_observer; use super::{ Context, DenseWeightCache, DeviceBuffer, Error, GrRole, LayerId, ModelBinding, Norm, Position, ProjectionSources, QGate, QsaIndexStage, QsaLayerProjection, QsaMatrixRole, QsaPending, QsaPrepareRequest, QsaPrepared, QsaPrior, QsaSelectionRequest, QsaWeights, QwenStepTxn, Rc, ResidualReady, Result, admit_budget, append, binding_error, context, norm, pack, project_input, rope, select, split, validate_ids, validate_values, }; -#[cfg(all(test, target_arch = "x86_64"))] -use super::combined_qsa_observer; use crate::qwen_forward::prompt_device_rows::PromptWeights; use crate::qwen_forward::q6_attention_columns::{ColumnKey, RowAdmission}; use crate::qwen_forward::qsa_prefill_batch::AttentionRow; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt.rs index 2718068b..92c6c426 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt.rs @@ -7,9 +7,9 @@ use super::super::qsa_index::prompt_device::resident_device::{ ParkedLayerSpan, ParkedPrefix, ResidentQsaLayer, ResidentQsaOwners, ResidentQsaPrior, ResidentQsaSeal, SpanExport, }; use super::{ - BindingIdentity, Context, Dimension, Error, GdnPrior, GrRole, InputReady, LayerId, ModelBinding, PlePrior, Position, - QsaIndexPrior, QsaOwner, QwenSession, QwenStepTxn, Rc, Result, STATE_CAPACITY, Stage, TargetStepOrigin, TokenId, - TokenLayer, + BindingIdentity, Context, Dimension, Error, GdnPrior, GrRole, InputReady, LayerId, ModelBinding, PlePrior, + Position, QsaIndexPrior, QsaOwner, QwenSession, QwenStepTxn, Rc, Result, STATE_CAPACITY, Stage, TargetStepOrigin, + TokenId, TokenLayer, }; use std::cell::{Cell, RefCell}; pub(in crate::qwen_forward) mod draft; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/tests.rs index e5e06d4b..56ff33ff 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/tests.rs @@ -2,8 +2,8 @@ //! the PLE, GDN and QSA priors keep their exact identity (child modules); the helpers build tokens and positions. use super::{ - Error, GdnOwner, GdnPending, GdnPrior, InputReady, LayerId, PleOwner, PlePending, PlePrior, Position, QsaIndexPrior, - QsaOwner, QwenSession, Rc, Stage, TokenId, TokenLayer, + Error, GdnOwner, GdnPending, GdnPrior, InputReady, LayerId, PleOwner, PlePending, PlePrior, Position, + QsaIndexPrior, QsaOwner, QwenSession, Rc, Stage, TokenId, TokenLayer, }; use crate::model_binding::qwen4exp_input::BindingIdentity; use crate::qwen_forward::contract::Dimension; From fbca47bd75250243a93bc5e45b1645fb1f63490c Mon Sep 17 00:00:00 2001 From: Pavlo Ratushnyi Date: Sat, 14 Nov 2026 21:31:39 +0100 Subject: [PATCH 08/10] engine-qwen35-cuda tests: bringup_prints_gated finds test-only children in parent/name.rs (modules no longer use #[path]) Co-Authored-By: Claude Sonnet 5.5 --- crates/engine-qwen35-cuda/tests/bringup_prints_gated.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/engine-qwen35-cuda/tests/bringup_prints_gated.rs b/crates/engine-qwen35-cuda/tests/bringup_prints_gated.rs index c03d7cf8..2836bc78 100644 --- a/crates/engine-qwen35-cuda/tests/bringup_prints_gated.rs +++ b/crates/engine-qwen35-cuda/tests/bringup_prints_gated.rs @@ -92,6 +92,11 @@ fn push_declared_files(gated: &mut Vec, file: &Path, name: &str, above: let dir = file.parent().unwrap(); gated.push(dir.join(format!("{name}.rs"))); gated.push(dir.join(name).join("mod.rs")); + // an ordinary child of `parent.rs` lives in `parent/name.rs` + if let Some(stem) = file.file_stem() { + gated.push(dir.join(stem).join(format!("{name}.rs"))); + gated.push(dir.join(stem).join(name).join("mod.rs")); + } // `#[path = "other_name.rs"] mod name;` if let Some(path) = above.split("#[path = \"").nth(1).and_then(|rest| rest.split('"').next()) { gated.push(dir.join(path)); From 1207415a19909d8a66cafb21bcbf774ff82474ae Mon Sep 17 00:00:00 2001 From: Pavlo Ratushnyi Date: Sat, 14 Nov 2026 21:33:08 +0100 Subject: [PATCH 09/10] Low-level crates: 52 modules named after two things (*_and_*) are named after their responsibility; exception paths, include paths and docs updated Co-Authored-By: Claude Sonnet 5.5 --- architecture.json | 4 +-- crates/context/src/rope_scaling.rs | 4 +-- ...nd_resolve.rs => setup_rope_resolution.rs} | 0 ...ntwise.rs => checked_attention_kernels.rs} | 3 +- crates/cpu-sys/src/lib.rs | 10 +++---- crates/cpu-sys/src/simd.rs | 18 ++++++------ ...s_and_formats.rs => scalar_dot_kernels.rs} | 0 ..._elementwise.rs => scalar_tile_kernels.rs} | 0 crates/cpu-sys/src/simd/x86.rs | 20 ++++++------- ...lementwise.rs => f16_attention_kernels.rs} | 0 ...ons_and_int_dots.rs => int_dot_kernels.rs} | 0 ...and_mxfp4_tiles.rs => q8_0_dot_kernels.rs} | 0 ...avx2_and_avxvnni.rs => x86_dot_kernels.rs} | 0 .../src/closed_kernels_gpu/closed_kernels.rs | 2 +- ...d_s_gemv.rs => closed_kernels_launches.rs} | 0 ...s => context_routed_gate_up_projection.rs} | 0 crates/cuda-driver/src/device_ref/tests.rs | 4 +-- .../src/experimental_gpu/facade_launches.rs | 2 +- ...v_pool_launches.rs => kv_pool_launches.rs} | 0 .../call_shape.rs | 0 .../step_operands.rs | 0 .../stream_keyless_cvec_launches.rs | 4 +-- ..._resolve_launch.rs => q8_gather_launch.rs} | 0 crates/cuda-driver/src/lib.rs | 12 ++++---- .../mapped_expert_bank_operations.rs | 4 +-- ...rs => mapped_expert_bank_device_copies.rs} | 0 ...ng.rs => mapped_expert_bank_host_views.rs} | 0 .../resident/original_group/copy_ring/ring.rs | 2 +- ...ng_gather_and_finish.rs => ring_gather.rs} | 0 .../original_group/original_mmq_layer.rs | 2 +- ...and_quantize.rs => layer_buffer_checks.rs} | 0 .../prefill/original_mtp_prefill.rs | 2 +- ...nd_settle.rs => command_list_execution.rs} | 0 .../prefill/scalar/full_forward.rs | 2 +- ...and_shape.rs => matrix_vector_planning.rs} | 0 .../full_forward_final_gr_stages.rs | 0 .../full_forward_finite_tail_mlp_gr.rs | 0 .../full_forward_moe_block_plan.rs | 0 .../original_mtp_full_forward.rs | 0 .../original_expert_cache_operations.rs | 4 +-- .../original_expert_cache_adaptive_swaps.rs | 2 +- ...lend.rs => original_expert_cache_loans.rs} | 2 +- ...lots.rs => original_expert_cache_slots.rs} | 0 .../src/original_file_expert_source.rs | 6 ++-- .../original_file_expert_source_operations.rs | 2 +- ...d_blobs.rs => file_expert_source_blobs.rs} | 0 ...d_blob.rs => original_file_source_blob.rs} | 0 .../src/original_gpu_schedule/abi/platform.rs | 2 +- ...and_flag_writes.rs => async_copy_flags.rs} | 0 .../original_verify_gdn_journal.rs | 2 +- .../verify_gdn_fused_step.rs | 2 +- ...commit.rs => verify_gdn_journal_commit.rs} | 0 .../src/original_verify/qsa/qsa_window.rs | 2 +- ...nd.rs => qsa_window_attention_launches.rs} | 0 .../original_verify/share_window_modules.rs | 28 +++++++++---------- ...n_open.rs => verify_bank_canonical_gdn.rs} | 0 ...dow_rows.rs => verify_bank_plan_access.rs} | 0 .../src/original_verify/window_ops.rs | 2 +- .../window_ops/window_launches.rs | 2 +- ..._pcie_plan.rs => window_step_recording.rs} | 0 .../src/ple_batch_ffi/driver_backed.rs | 2 +- ...e_launch_and_close.rs => kernel_module.rs} | 0 ...s_and_bounds.rs => projection_geometry.rs} | 0 .../cuda-driver/src/qsa_prompt_attention.rs | 2 +- ...and_passes.rs => attention_launch_plan.rs} | 0 .../attention_passes.rs | 0 .../prompt_attention_owner.rs | 0 .../reject_mutual_alias.rs | 0 .../qsa_prompt_attention/device_attention.rs | 2 +- .../resident_attention.rs | 2 +- crates/cuda-driver/src/qsa_prompt_index.rs | 2 +- ...d_close.rs => qsa_prompt_index_results.rs} | 0 .../original_qsa_mapped_prefix.rs | 4 +-- ...resolve.rs => qsa_mapped_journal_arena.rs} | 0 ...s => qsa_mapped_journal_prefix_lineage.rs} | 0 .../gdn_native_batch/gdn_batch_prefix.rs | 4 +-- ...ojections.rs => gdn_batch_input_stages.rs} | 0 ...tput.rs => gdn_batch_recurrence_stages.rs} | 0 crates/cuda-driver/src/qwen_ffi.rs | 18 ++++++------ ..._and_bf16_layout.rs => asset_admission.rs} | 0 crates/experimental-ref/src/cvec.rs | 4 +-- ...c_reading_and_errors.rs => cvec_reader.rs} | 0 crates/gptoss-npu/src/lib.rs | 2 +- ..._and_estimates.rs => npu_prefill_setup.rs} | 0 .../{state_and_cache.rs => decode_state.rs} | 0 crates/gptoss/src/lib.rs | 8 +++--- .../{bytes_and_errors.rs => model_bytes.rs} | 0 .../src/{error_and_kind.rs => gpu_error.rs} | 2 +- crates/igpu/src/lib.rs | 10 +++---- ...ices_and_moe_plan.rs => matrix_uploads.rs} | 0 ...uting.rs => recorder_activation_passes.rs} | 0 ...on_and_submit.rs => recorder_attention.rs} | 0 crates/igpu/src/shaders.rs | 12 ++++---- ...d_combine.rs => expert_routing_shaders.rs} | 0 ...tize_and_swiglu.rs => quantize_shaders.rs} | 0 ...rm_and_rope.rs => rmsnorm_rope_shaders.rs} | 0 .../src/rust_general_pool.rs | 2 +- ...and_quantize_lanes.rs => phase_handoff.rs} | 0 ...pile_and_infer.rs => inference_runtime.rs} | 0 crates/openvino/src/lib.rs | 4 +-- docs/architecture/size-split-rest.md | 14 +++++----- docs/experiments/ffn-phase-loss-design.md | 6 ++-- docs/experiments/hit-gap-causes-2026-11-11.md | 2 +- docs/experiments/verify-accept-on-device.md | 6 ++-- docs/experiments/verify-gdn-fused-kernels.md | 4 +-- 105 files changed, 132 insertions(+), 131 deletions(-) rename crates/context/src/rope_scaling/{setup_rope_error_and_resolve.rs => setup_rope_resolution.rs} (100%) rename crates/cpu-sys/src/{attention_and_elementwise.rs => checked_attention_kernels.rs} (96%) rename crates/cpu-sys/src/simd/{scalar_dots_and_formats.rs => scalar_dot_kernels.rs} (100%) rename crates/cpu-sys/src/simd/{scalar_tiles_and_elementwise.rs => scalar_tile_kernels.rs} (100%) rename crates/cpu-sys/src/simd/x86/{f16_attention_and_elementwise.rs => f16_attention_kernels.rs} (100%) rename crates/cpu-sys/src/simd/x86/{reductions_and_int_dots.rs => int_dot_kernels.rs} (100%) rename crates/cpu-sys/src/simd/x86/{q8_dots_and_mxfp4_tiles.rs => q8_0_dot_kernels.rs} (100%) rename crates/cpu-sys/src/{avx2_and_avxvnni.rs => x86_dot_kernels.rs} (100%) rename crates/cuda-driver/src/closed_kernels_gpu/closed_kernels/{closed_kernels_flash_and_s_gemv.rs => closed_kernels_launches.rs} (100%) rename crates/cuda-driver/src/{context_q8_1_and_gate_up_projection.rs => context_routed_gate_up_projection.rs} (100%) rename crates/cuda-driver/src/experimental_gpu/facade_launches/{program_and_kv_pool_launches.rs => kv_pool_launches.rs} (100%) rename crates/cuda-driver/src/experimental_gpu/facade_launches/{program_and_kv_pool_launches => kv_pool_launches}/call_shape.rs (100%) rename crates/cuda-driver/src/experimental_gpu/facade_launches/{program_and_kv_pool_launches => kv_pool_launches}/step_operands.rs (100%) rename crates/cuda-driver/src/experimental_gpu/facade_launches/stream_keyless_cvec_launches/{q8_gather_and_resolve_launch.rs => q8_gather_launch.rs} (100%) rename crates/cuda-driver/src/mapped_expert_bank/mapped_expert_bank_operations/{mapped_expert_bank_pcie_and_triplets.rs => mapped_expert_bank_device_copies.rs} (100%) rename crates/cuda-driver/src/mapped_expert_bank/mapped_expert_bank_operations/{mapped_expert_bank_pieces_and_pinning.rs => mapped_expert_bank_host_views.rs} (100%) rename crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring/{ring_gather_and_finish.rs => ring_gather.rs} (100%) rename crates/cuda-driver/src/mmq/resident/original_group/original_mmq_layer/{finite_and_quantize.rs => layer_buffer_checks.rs} (100%) rename crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/{run_and_settle.rs => command_list_execution.rs} (100%) rename crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/{matrix_vector_buffers_and_shape.rs => matrix_vector_planning.rs} (100%) rename crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/{matrix_vector_buffers_and_shape => matrix_vector_planning}/full_forward_final_gr_stages.rs (100%) rename crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/{matrix_vector_buffers_and_shape => matrix_vector_planning}/full_forward_finite_tail_mlp_gr.rs (100%) rename crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/{matrix_vector_buffers_and_shape => matrix_vector_planning}/full_forward_moe_block_plan.rs (100%) rename crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/{matrix_vector_buffers_and_shape => matrix_vector_planning}/original_mtp_full_forward.rs (100%) rename crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations/{original_expert_cache_verify_and_lend.rs => original_expert_cache_loans.rs} (99%) rename crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations/{original_expert_cache_open_and_slots.rs => original_expert_cache_slots.rs} (100%) rename crates/cuda-driver/src/original_file_expert_source/original_file_expert_source_operations/{file_expert_source_stages_and_blobs.rs => file_expert_source_blobs.rs} (100%) rename crates/cuda-driver/src/original_file_expert_source/{original_resident_options_and_blob.rs => original_file_source_blob.rs} (100%) rename crates/cuda-driver/src/original_gpu_schedule/abi/platform/{async_copies_and_flag_writes.rs => async_copy_flags.rs} (100%) rename crates/cuda-driver/src/original_verify/original_verify_gdn_journal/{verify_gdn_journal_stage_and_commit.rs => verify_gdn_journal_commit.rs} (100%) rename crates/cuda-driver/src/original_verify/qsa/qsa_window/{qsa_window_select_and_attend.rs => qsa_window_attention_launches.rs} (100%) rename crates/cuda-driver/src/original_verify/share_window_modules/{verify_bank_and_canonical_gdn_open.rs => verify_bank_canonical_gdn.rs} (100%) rename crates/cuda-driver/src/original_verify/share_window_modules/{verify_bank_plan_and_window_rows.rs => verify_bank_plan_access.rs} (100%) rename crates/cuda-driver/src/original_verify/window_ops/{window_ops_kernels_and_pcie_plan.rs => window_step_recording.rs} (100%) rename crates/cuda-driver/src/ple_batch_ffi/driver_backed/{kernel_module_launch_and_close.rs => kernel_module.rs} (100%) rename crates/cuda-driver/src/{projection_grids_and_bounds.rs => projection_geometry.rs} (100%) rename crates/cuda-driver/src/qsa_prompt_attention/{attention_kernel_plan_and_passes.rs => attention_launch_plan.rs} (100%) rename crates/cuda-driver/src/qsa_prompt_attention/{attention_kernel_plan_and_passes => attention_launch_plan}/attention_passes.rs (100%) rename crates/cuda-driver/src/qsa_prompt_attention/{attention_kernel_plan_and_passes => attention_launch_plan}/prompt_attention_owner.rs (100%) rename crates/cuda-driver/src/qsa_prompt_attention/{attention_kernel_plan_and_passes => attention_launch_plan}/reject_mutual_alias.rs (100%) rename crates/cuda-driver/src/qsa_prompt_index/{qsa_prompt_index_read_and_close.rs => qsa_prompt_index_results.rs} (100%) rename crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_prefix/{qsa_mapped_journal_append_and_resolve.rs => qsa_mapped_journal_arena.rs} (100%) rename crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_prefix/{qsa_mapped_journal_prefix_and_prefetch.rs => qsa_mapped_journal_prefix_lineage.rs} (100%) rename crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix/{qkv_and_z_projections.rs => gdn_batch_input_stages.rs} (100%) rename crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix/{recurrence_and_output.rs => gdn_batch_recurrence_stages.rs} (100%) rename crates/cuda-driver/src/qwen_ffi/{asset_validation_and_bf16_layout.rs => asset_admission.rs} (100%) rename crates/experimental-ref/src/cvec/{cvec_reading_and_errors.rs => cvec_reader.rs} (100%) rename crates/gptoss-npu/src/{construction_and_estimates.rs => npu_prefill_setup.rs} (100%) rename crates/gptoss/src/{state_and_cache.rs => decode_state.rs} (100%) rename crates/gptoss/src/{bytes_and_errors.rs => model_bytes.rs} (100%) rename crates/igpu/src/{error_and_kind.rs => gpu_error.rs} (89%) rename crates/igpu/src/{matrices_and_moe_plan.rs => matrix_uploads.rs} (100%) rename crates/igpu/src/{recorder_norm_and_routing.rs => recorder_activation_passes.rs} (100%) rename crates/igpu/src/{recorder_attention_and_submit.rs => recorder_attention.rs} (100%) rename crates/igpu/src/shaders/{routing_and_combine.rs => expert_routing_shaders.rs} (100%) rename crates/igpu/src/shaders/{quantize_and_swiglu.rs => quantize_shaders.rs} (100%) rename crates/igpu/src/shaders/{tiling_norm_and_rope.rs => rmsnorm_rope_shaders.rs} (100%) rename crates/native-cpu-expert/src/rust_general_pool/{shared_wait_done_and_quantize_lanes.rs => phase_handoff.rs} (100%) rename crates/openvino/src/{compile_and_infer.rs => inference_runtime.rs} (100%) diff --git a/architecture.json b/architecture.json index 2f03f810..7332f757 100644 --- a/architecture.json +++ b/architecture.json @@ -92,7 +92,7 @@ {"crate": "leleka-gptoss-npu", "file": "src/service_transfers.rs", "ratchet": "instant-now", "reason": "measurement timer, not decision logic: transfer wall-time measurement toward the NPU service"}, {"crate": "leleka-gpu-npu-worker", "file": "src/lib.rs", "ratchet": "instant-now", "reason": "measurement timer, not decision logic: wall-time measurement of the split prefill passes, reported in the timing line"}, {"crate": "leleka-gpu-npu-worker", "file": "src/split_run.rs", "ratchet": "instant-now", "reason": "measurement timer, not decision logic: lap timers of the GPU and NPU legs of the split prefill"}, - {"crate": "leleka-igpu", "file": "src/matrices_and_moe_plan.rs", "ratchet": "instant-now", "reason": "measurement timer, not decision logic: wall-time measurement of the weight upload, reported at load"}, + {"crate": "leleka-igpu", "file": "src/matrix_uploads.rs", "ratchet": "instant-now", "reason": "measurement timer, not decision logic: wall-time measurement of the weight upload, reported at load"}, {"crate": "leleka-npu-service", "file": "src/engine/execution.rs", "ratchet": "instant-now", "reason": "measurement timer, not decision logic: lap timers of one NPU execution, summed into the profile report"}, {"crate": "leleka-model-format", "file": "src/bulk_read/for_each_chunk.rs", "ratchet": "instant-now", "reason": "measurement timer, not decision logic: wall-time measurement of the bulk read, reported in the load report"}, {"crate": "leleka-model-format", "file": "src/huge_pages.rs", "ratchet": "instant-now", "reason": "measurement timer, not decision logic: wall-time measurement of the huge-page allocation probe, reported in the load report"}, @@ -111,7 +111,7 @@ {"crate": "leleka-experimental-ref", "file": "src/remote_experts.rs", "ratchet": "dyn-trait", "reason": "parameter struct Candidates borrows the primary's residency test from the caller's table; generic parameters would leak into every caller's signature"}, {"crate": "leleka-cpu-worker", "file": "src/engine.rs", "ratchet": "dyn-trait", "reason": "port boundary: the engine holds the prefill accelerator (iGPU, NPU or split) as Box, chosen by the worker binary"}, {"crate": "leleka-cpu-worker", "file": "src/serve.rs", "ratchet": "dyn-trait", "reason": "dyn-compatible worker trait: the progress callback of a trait method must be a trait object"}, - {"crate": "leleka-gptoss", "file": "src/state_and_cache.rs", "ratchet": "dyn-trait", "reason": "port boundary: PrefillAccelerator and LayerCache are the accelerator seams, chosen by the worker binary; their methods take the progress callback as a trait object"}, + {"crate": "leleka-gptoss", "file": "src/decode_state.rs", "ratchet": "dyn-trait", "reason": "port boundary: PrefillAccelerator and LayerCache are the accelerator seams, chosen by the worker binary; their methods take the progress callback as a trait object"}, {"crate": "leleka-gptoss", "file": "src/model.rs", "ratchet": "dyn-trait", "reason": "port boundary: the model's weights read through Arc (file, memory map or test bytes), chosen when the model is loaded"}, {"crate": "leleka-gptoss", "file": "src/tensor_loading.rs", "ratchet": "dyn-trait", "reason": "port boundary: the model's weights read through Arc (file, memory map or test bytes), chosen when the model is loaded"}, {"crate": "leleka-gptoss", "file": "src/weights.rs", "ratchet": "dyn-trait", "reason": "port boundary: the model's weights read through Arc (file, memory map or test bytes), chosen when the model is loaded"}, diff --git a/crates/context/src/rope_scaling.rs b/crates/context/src/rope_scaling.rs index f0366622..4fc65ec5 100644 --- a/crates/context/src/rope_scaling.rs +++ b/crates/context/src/rope_scaling.rs @@ -169,5 +169,5 @@ mod rope_scaling_type; pub use rope_scaling_type::*; mod rope_table; pub use rope_table::*; -mod setup_rope_error_and_resolve; -pub use setup_rope_error_and_resolve::*; +mod setup_rope_resolution; +pub use setup_rope_resolution::*; diff --git a/crates/context/src/rope_scaling/setup_rope_error_and_resolve.rs b/crates/context/src/rope_scaling/setup_rope_resolution.rs similarity index 100% rename from crates/context/src/rope_scaling/setup_rope_error_and_resolve.rs rename to crates/context/src/rope_scaling/setup_rope_resolution.rs diff --git a/crates/cpu-sys/src/attention_and_elementwise.rs b/crates/cpu-sys/src/checked_attention_kernels.rs similarity index 96% rename from crates/cpu-sys/src/attention_and_elementwise.rs rename to crates/cpu-sys/src/checked_attention_kernels.rs index 88495a46..530ee80e 100644 --- a/crates/cpu-sys/src/attention_and_elementwise.rs +++ b/crates/cpu-sys/src/checked_attention_kernels.rs @@ -1,4 +1,5 @@ -//! Attention score and weighted-sum kernels, SwiGLU, f16 conversion and the softmax exponent sum. +//! The argument-checked scalar and AVX2 entry points of the attention score and weighted-sum kernels; the elementwise +//! kernels (SwiGLU, f16 conversion, the softmax exponent sum) are the second clause of the same checked surface. use super::{AttnShape, KernelError, ScoreSpec, check_scores, check_swiglu, check_weighted_sum, simd}; #[cfg(target_arch="x86_64")] diff --git a/crates/cpu-sys/src/lib.rs b/crates/cpu-sys/src/lib.rs index 019dc521..c3dd4392 100644 --- a/crates/cpu-sys/src/lib.rs +++ b/crates/cpu-sys/src/lib.rs @@ -127,22 +127,22 @@ pub use portable::{ dot_q8_0_q8_0_scalar, dot_q8_0_q8r_multi_scalar, f32_to_f16_bits_scalar, mxfp4_q8_0_isums_scalar, q8_0_q8_0_isums_scalar, quantize_q8_0_scalar, }; -mod avx2_and_avxvnni; +mod x86_dot_kernels; #[cfg(target_arch = "x86_64")] -pub use avx2_and_avxvnni::{ +pub use x86_dot_kernels::{ dot_i4i8_avx2, dot_i4i8_avxvnni, dot_i8i8_avx2, dot_i8i8_avxvnni, dot_mxfp4_q8_0_avx2, dot_mxfp4_q8_0_avxvnni, dot_mxfp4_q8r_avx2, dot_mxfp4_q8r4_avx2, dot_mxfp4_q8r4_avxvnni, dot_mxfp4_q8r4_multi_avx2, dot_mxfp4_q8r4_multi_avxvnni, dot_q8_0_q8_0_avx2, dot_q8_0_q8_0_avxvnni, dot_q8_0_q8r_multi_avx2, dot_q8_0_q8r_multi_avxvnni, f32_to_f16_bits_f16c, mxfp4_q8_0_isums_avx2, mxfp4_q8_0_isums_avxvnni, q8_0_q8_0_isums_avx2, q8_0_q8_0_isums_avxvnni, quantize_q8_0_avx2, }; -mod attention_and_elementwise; +mod checked_attention_kernels; #[cfg(target_arch = "x86_64")] -pub use attention_and_elementwise::{ +pub use checked_attention_kernels::{ attn_scores_avx2, attn_scores_f16_avx2, attn_weighted_sum_avx2, attn_weighted_sum_f16_avx2, exp_shift_sum_avx2, f16_to_f32_slice_avx2, f32_to_f16_slice_avx2, swiglu_oai_avx2, }; -pub use attention_and_elementwise::{ +pub use checked_attention_kernels::{ attn_scores_f16_scalar, attn_scores_scalar, attn_weighted_sum_f16_scalar, attn_weighted_sum_scalar, exp_shift_sum_scalar, f16_to_f32_slice_scalar, f32_to_f16_slice_scalar, swiglu_oai_scalar, }; diff --git a/crates/cpu-sys/src/simd.rs b/crates/cpu-sys/src/simd.rs index f9a829c7..3d5fad1e 100644 --- a/crates/cpu-sys/src/simd.rs +++ b/crates/cpu-sys/src/simd.rs @@ -79,19 +79,19 @@ pub const MULTI_MAX: usize = 16; #[cfg(target_arch = "x86_64")] pub mod x86; -mod scalar_dots_and_formats; -use scalar_dots_and_formats::load_u16; -pub use scalar_dots_and_formats::{ +mod scalar_dot_kernels; +use scalar_dot_kernels::load_u16; +pub use scalar_dot_kernels::{ attn_scores_f16_scalar, attn_scores_scalar, attn_weighted_sum_f16_scalar, attn_weighted_sum_scalar, dot_mxfp4_q8_0_scalar, dot_mxfp4_q8r_scalar, dot_q8_q8r_scalar, mxfp4_q8_0_isums_scalar, }; -pub use scalar_dots_and_formats::{dot_i4i8_scalar, dot_i8i8_scalar}; -pub use scalar_dots_and_formats::{e8m0_half, f16_to_f32, f32_to_f16}; -mod scalar_tiles_and_elementwise; -use scalar_tiles_and_elementwise::dot_i4i8_tail; -pub use scalar_tiles_and_elementwise::{ +pub use scalar_dot_kernels::{dot_i4i8_scalar, dot_i8i8_scalar}; +pub use scalar_dot_kernels::{e8m0_half, f16_to_f32, f32_to_f16}; +mod scalar_tile_kernels; +use scalar_tile_kernels::dot_i4i8_tail; +pub use scalar_tile_kernels::{ dot_mxfp4_q8r_multi_scalar, dot_q8_0_q8r_multi_scalar, exp_shift_sum_scalar, f16_to_f32_slice_scalar, f32_to_f16_slice_scalar, mxfp4_q8r_tile_scalar, prepare_act, q8_q8r_tile_scalar, quantize_q8_0_scalar, swiglu_oai_scalar, }; -pub use scalar_tiles_and_elementwise::{dot_q8_0_q8_0_scalar, q8_0_q8_0_isums_scalar}; +pub use scalar_tile_kernels::{dot_q8_0_q8_0_scalar, q8_0_q8_0_isums_scalar}; diff --git a/crates/cpu-sys/src/simd/scalar_dots_and_formats.rs b/crates/cpu-sys/src/simd/scalar_dot_kernels.rs similarity index 100% rename from crates/cpu-sys/src/simd/scalar_dots_and_formats.rs rename to crates/cpu-sys/src/simd/scalar_dot_kernels.rs diff --git a/crates/cpu-sys/src/simd/scalar_tiles_and_elementwise.rs b/crates/cpu-sys/src/simd/scalar_tile_kernels.rs similarity index 100% rename from crates/cpu-sys/src/simd/scalar_tiles_and_elementwise.rs rename to crates/cpu-sys/src/simd/scalar_tile_kernels.rs diff --git a/crates/cpu-sys/src/simd/x86.rs b/crates/cpu-sys/src/simd/x86.rs index b5618cb2..3baf607f 100644 --- a/crates/cpu-sys/src/simd/x86.rs +++ b/crates/cpu-sys/src/simd/x86.rs @@ -181,30 +181,30 @@ multi_kernel!( |xb, ib| (_mm256_loadu_si256(xb.add(2) as *const __m256i), half_to_f32(xb)) ); -mod reductions_and_int_dots; -use reductions_and_int_dots::{block_p32_avx2, mx_table, mx_values}; -use reductions_and_int_dots::{cvt_f32_f16, half_to_f32, hsum_epi32, hsum_ps}; -pub use reductions_and_int_dots::{dot_i4i8_avx2, dot_i4i8_avxvnni, dot_i8i8_avx2, dot_i8i8_avxvnni}; +mod int_dot_kernels; +use int_dot_kernels::{block_p32_avx2, mx_table, mx_values}; +use int_dot_kernels::{cvt_f32_f16, half_to_f32, hsum_epi32, hsum_ps}; +pub use int_dot_kernels::{dot_i4i8_avx2, dot_i4i8_avxvnni, dot_i8i8_avx2, dot_i8i8_avxvnni}; mod mxfp4_q8_dots; use mxfp4_q8_dots::{block_p32_vnni, mxfp4_scaled_fma}; pub use mxfp4_q8_dots::{ dot_mxfp4_q8_0_avx2, dot_mxfp4_q8_0_avxvnni, dot_mxfp4_q8r_avx2, dot_mxfp4_q8r4_avx2, mxfp4_q8_0_isums_avx2, mxfp4_q8_0_isums_avxvnni, }; -mod q8_dots_and_mxfp4_tiles; -pub use q8_dots_and_mxfp4_tiles::dot_mxfp4_q8r4_avxvnni; -pub use q8_dots_and_mxfp4_tiles::{ +mod q8_0_dot_kernels; +pub use q8_0_dot_kernels::dot_mxfp4_q8r4_avxvnni; +pub use q8_0_dot_kernels::{ dot_q8_0_q8_0_avx2, dot_q8_0_q8_0_avxvnni, q8_0_q8_0_isums_avx2, q8_0_q8_0_isums_avxvnni, }; -use q8_dots_and_mxfp4_tiles::{mx_table_biased, mxfp4_tile_avx2}; +use q8_0_dot_kernels::{mx_table_biased, mxfp4_tile_avx2}; mod tile_kernels; use tile_kernels::{decoded_p32_avx2, decoded_p32_vnni, multi_reduce}; pub use tile_kernels::{mxfp4_q8r_tile_avx2, mxfp4_q8r_tile_avxvnni, q8_q8r_tile_avx2, q8_q8r_tile_avxvnni}; mod attention_kernels; use attention_kernels::{WeightedSum, attn_dot_f16, exp256, load_f16x8}; pub use attention_kernels::{attn_scores_avx2, attn_weighted_sum_avx2}; -mod f16_attention_and_elementwise; -pub use f16_attention_and_elementwise::{ +mod f16_attention_kernels; +pub use f16_attention_kernels::{ attn_scores_f16_avx2, attn_weighted_sum_f16_avx2, exp_shift_sum_avx2, f16_to_f32_slice_avx2, f32_to_f16_f16c, f32_to_f16_slice_avx2, swiglu_oai_avx2, }; diff --git a/crates/cpu-sys/src/simd/x86/f16_attention_and_elementwise.rs b/crates/cpu-sys/src/simd/x86/f16_attention_kernels.rs similarity index 100% rename from crates/cpu-sys/src/simd/x86/f16_attention_and_elementwise.rs rename to crates/cpu-sys/src/simd/x86/f16_attention_kernels.rs diff --git a/crates/cpu-sys/src/simd/x86/reductions_and_int_dots.rs b/crates/cpu-sys/src/simd/x86/int_dot_kernels.rs similarity index 100% rename from crates/cpu-sys/src/simd/x86/reductions_and_int_dots.rs rename to crates/cpu-sys/src/simd/x86/int_dot_kernels.rs diff --git a/crates/cpu-sys/src/simd/x86/q8_dots_and_mxfp4_tiles.rs b/crates/cpu-sys/src/simd/x86/q8_0_dot_kernels.rs similarity index 100% rename from crates/cpu-sys/src/simd/x86/q8_dots_and_mxfp4_tiles.rs rename to crates/cpu-sys/src/simd/x86/q8_0_dot_kernels.rs diff --git a/crates/cpu-sys/src/avx2_and_avxvnni.rs b/crates/cpu-sys/src/x86_dot_kernels.rs similarity index 100% rename from crates/cpu-sys/src/avx2_and_avxvnni.rs rename to crates/cpu-sys/src/x86_dot_kernels.rs diff --git a/crates/cuda-driver/src/closed_kernels_gpu/closed_kernels.rs b/crates/cuda-driver/src/closed_kernels_gpu/closed_kernels.rs index 734ea422..35be303d 100644 --- a/crates/cuda-driver/src/closed_kernels_gpu/closed_kernels.rs +++ b/crates/cuda-driver/src/closed_kernels_gpu/closed_kernels.rs @@ -8,5 +8,5 @@ use super::{ poison_slots, s_gemv_entry_index, s_gemv_slots, s_operand_bytes, }; -mod closed_kernels_flash_and_s_gemv; +mod closed_kernels_launches; mod closed_kernels_open_admit_run; diff --git a/crates/cuda-driver/src/closed_kernels_gpu/closed_kernels/closed_kernels_flash_and_s_gemv.rs b/crates/cuda-driver/src/closed_kernels_gpu/closed_kernels/closed_kernels_launches.rs similarity index 100% rename from crates/cuda-driver/src/closed_kernels_gpu/closed_kernels/closed_kernels_flash_and_s_gemv.rs rename to crates/cuda-driver/src/closed_kernels_gpu/closed_kernels/closed_kernels_launches.rs diff --git a/crates/cuda-driver/src/context_q8_1_and_gate_up_projection.rs b/crates/cuda-driver/src/context_routed_gate_up_projection.rs similarity index 100% rename from crates/cuda-driver/src/context_q8_1_and_gate_up_projection.rs rename to crates/cuda-driver/src/context_routed_gate_up_projection.rs diff --git a/crates/cuda-driver/src/device_ref/tests.rs b/crates/cuda-driver/src/device_ref/tests.rs index ae448b6b..b63f0dd7 100644 --- a/crates/cuda-driver/src/device_ref/tests.rs +++ b/crates/cuda-driver/src/device_ref/tests.rs @@ -67,12 +67,12 @@ fn the_window_and_journal_modules_never_clone_a_handle() { include_str!("../original_verify/window_ops/qsa_prelude_ops.rs"), include_str!("../original_verify/window_ops/side_qsa_branches.rs"), include_str!("../original_verify/window_ops/side_shared_expert.rs"), - include_str!("../original_verify/window_ops/window_ops_kernels_and_pcie_plan.rs"), + include_str!("../original_verify/window_ops/window_step_recording.rs"), ]; let journals = [ include_str!("../original_verify/original_verify_gdn_journal/verify_gdn_fused_step.rs"), include_str!("../original_verify/original_verify_gdn_journal/verify_gdn_journal_ladder_logits_scan.rs"), - include_str!("../original_verify/original_verify_gdn_journal/verify_gdn_journal_stage_and_commit.rs"), + include_str!("../original_verify/original_verify_gdn_journal/verify_gdn_journal_commit.rs"), include_str!("../original_verify/original_verify_gdn_journal/verify_gdn_journal_window_launches.rs"), include_str!("../qsa_prompt_index/resident_index/verification_commit/verify_qsa_journal_capture_commit.rs"), include_str!("../qsa_prompt_index/resident_index/verification_commit/verify_qsa_journal_index_image.rs"), diff --git a/crates/cuda-driver/src/experimental_gpu/facade_launches.rs b/crates/cuda-driver/src/experimental_gpu/facade_launches.rs index fe5561fb..c713509f 100644 --- a/crates/cuda-driver/src/experimental_gpu/facade_launches.rs +++ b/crates/cuda-driver/src/experimental_gpu/facade_launches.rs @@ -10,5 +10,5 @@ use super::{ }; mod attention_launch; -mod program_and_kv_pool_launches; +mod kv_pool_launches; mod stream_keyless_cvec_launches; diff --git a/crates/cuda-driver/src/experimental_gpu/facade_launches/program_and_kv_pool_launches.rs b/crates/cuda-driver/src/experimental_gpu/facade_launches/kv_pool_launches.rs similarity index 100% rename from crates/cuda-driver/src/experimental_gpu/facade_launches/program_and_kv_pool_launches.rs rename to crates/cuda-driver/src/experimental_gpu/facade_launches/kv_pool_launches.rs diff --git a/crates/cuda-driver/src/experimental_gpu/facade_launches/program_and_kv_pool_launches/call_shape.rs b/crates/cuda-driver/src/experimental_gpu/facade_launches/kv_pool_launches/call_shape.rs similarity index 100% rename from crates/cuda-driver/src/experimental_gpu/facade_launches/program_and_kv_pool_launches/call_shape.rs rename to crates/cuda-driver/src/experimental_gpu/facade_launches/kv_pool_launches/call_shape.rs diff --git a/crates/cuda-driver/src/experimental_gpu/facade_launches/program_and_kv_pool_launches/step_operands.rs b/crates/cuda-driver/src/experimental_gpu/facade_launches/kv_pool_launches/step_operands.rs similarity index 100% rename from crates/cuda-driver/src/experimental_gpu/facade_launches/program_and_kv_pool_launches/step_operands.rs rename to crates/cuda-driver/src/experimental_gpu/facade_launches/kv_pool_launches/step_operands.rs diff --git a/crates/cuda-driver/src/experimental_gpu/facade_launches/stream_keyless_cvec_launches.rs b/crates/cuda-driver/src/experimental_gpu/facade_launches/stream_keyless_cvec_launches.rs index 6f6c7224..6f672576 100644 --- a/crates/cuda-driver/src/experimental_gpu/facade_launches/stream_keyless_cvec_launches.rs +++ b/crates/cuda-driver/src/experimental_gpu/facade_launches/stream_keyless_cvec_launches.rs @@ -7,8 +7,8 @@ use super::{ experimental, i32_of, i64_of, invalid, stream_runs, }; -mod q8_gather_and_resolve_launch; -use q8_gather_and_resolve_launch::Q8Gather; +mod q8_gather_launch; +use q8_gather_launch::Q8Gather; impl<'c> Experimental<'c> { /// `kv_gather_q8_step`: dequantize the selected cells into fp16 scratch (K and V of the same pool). diff --git a/crates/cuda-driver/src/experimental_gpu/facade_launches/stream_keyless_cvec_launches/q8_gather_and_resolve_launch.rs b/crates/cuda-driver/src/experimental_gpu/facade_launches/stream_keyless_cvec_launches/q8_gather_launch.rs similarity index 100% rename from crates/cuda-driver/src/experimental_gpu/facade_launches/stream_keyless_cvec_launches/q8_gather_and_resolve_launch.rs rename to crates/cuda-driver/src/experimental_gpu/facade_launches/stream_keyless_cvec_launches/q8_gather_launch.rs diff --git a/crates/cuda-driver/src/lib.rs b/crates/cuda-driver/src/lib.rs index f2f5364c..1fe8a90a 100644 --- a/crates/cuda-driver/src/lib.rs +++ b/crates/cuda-driver/src/lib.rs @@ -257,12 +257,12 @@ mod original_serve_access; mod bringup_trace_enabled; use bringup_trace_enabled::combine; use bringup_trace_enabled::valid_size; -mod projection_grids_and_bounds; -use projection_grids_and_bounds::projection_ranges; -use projection_grids_and_bounds::projection_shape; +mod projection_geometry; +use projection_geometry::projection_ranges; +use projection_geometry::projection_shape; #[cfg(test)] -use projection_grids_and_bounds::q4_k_native_indices_fit; -use projection_grids_and_bounds::q5_k_shape; +use projection_geometry::q4_k_native_indices_fit; +use projection_geometry::q5_k_shape; mod q6_k_shape; use q6_k_shape::matvec_allocations; use q6_k_shape::matvec_shape; @@ -272,7 +272,7 @@ mod context; mod context_gate_up_projection_admission; mod context_matvec_k_quant_projections; mod context_projection_kernel_slots; -mod context_q8_1_and_gate_up_projection; +mod context_routed_gate_up_projection; mod context_unload_close_destroy; mod device_buffer; diff --git a/crates/cuda-driver/src/mapped_expert_bank/mapped_expert_bank_operations.rs b/crates/cuda-driver/src/mapped_expert_bank/mapped_expert_bank_operations.rs index c8c118b6..c8186909 100644 --- a/crates/cuda-driver/src/mapped_expert_bank/mapped_expert_bank_operations.rs +++ b/crates/cuda-driver/src/mapped_expert_bank/mapped_expert_bank_operations.rs @@ -8,5 +8,5 @@ use super::{ }; mod mapped_expert_bank_close; -mod mapped_expert_bank_pcie_and_triplets; -mod mapped_expert_bank_pieces_and_pinning; +mod mapped_expert_bank_device_copies; +mod mapped_expert_bank_host_views; diff --git a/crates/cuda-driver/src/mapped_expert_bank/mapped_expert_bank_operations/mapped_expert_bank_pcie_and_triplets.rs b/crates/cuda-driver/src/mapped_expert_bank/mapped_expert_bank_operations/mapped_expert_bank_device_copies.rs similarity index 100% rename from crates/cuda-driver/src/mapped_expert_bank/mapped_expert_bank_operations/mapped_expert_bank_pcie_and_triplets.rs rename to crates/cuda-driver/src/mapped_expert_bank/mapped_expert_bank_operations/mapped_expert_bank_device_copies.rs diff --git a/crates/cuda-driver/src/mapped_expert_bank/mapped_expert_bank_operations/mapped_expert_bank_pieces_and_pinning.rs b/crates/cuda-driver/src/mapped_expert_bank/mapped_expert_bank_operations/mapped_expert_bank_host_views.rs similarity index 100% rename from crates/cuda-driver/src/mapped_expert_bank/mapped_expert_bank_operations/mapped_expert_bank_pieces_and_pinning.rs rename to crates/cuda-driver/src/mapped_expert_bank/mapped_expert_bank_operations/mapped_expert_bank_host_views.rs diff --git a/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring.rs b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring.rs index 78d57b42..714a24a0 100644 --- a/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring.rs @@ -8,7 +8,7 @@ use super::{ }; mod ring_construction; -mod ring_gather_and_finish; +mod ring_gather; mod ring_init; mod ring_prefetch; pub(super) use ring_prefetch::profile_prefetch; diff --git a/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring/ring_gather_and_finish.rs b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring/ring_gather.rs similarity index 100% rename from crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring/ring_gather_and_finish.rs rename to crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring/ring_gather.rs diff --git a/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_layer.rs b/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_layer.rs index 3f3c0ae1..5eaf2902 100644 --- a/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_layer.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_layer.rs @@ -7,6 +7,6 @@ use super::{ STATUS, TMP, WD, WG, WIDTHS, XQ, commands, ffi, format_index, kind, layout, }; -mod finite_and_quantize; +mod layer_buffer_checks; mod group_projection; mod original_mmq_layer_stage_experts; diff --git a/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_layer/finite_and_quantize.rs b/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_layer/layer_buffer_checks.rs similarity index 100% rename from crates/cuda-driver/src/mmq/resident/original_group/original_mmq_layer/finite_and_quantize.rs rename to crates/cuda-driver/src/mmq/resident/original_group/original_mmq_layer/layer_buffer_checks.rs diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill.rs index b4a3866b..f0775fad 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill.rs @@ -16,7 +16,7 @@ mod original_mtp_prefill_close; mod projection_commands; mod record_operands; mod record_walk; -mod run_and_settle; +mod command_list_execution; use record_operands::{ Admit, AppendBlock, Block, Call, GrBufs, KernelAt, KernelShape, PageRuns, ProjectionAddresses, ProjectionDims, Stage, Staged, WEIGHT_EXTENTS, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/run_and_settle.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/command_list_execution.rs similarity index 100% rename from crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/run_and_settle.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/command_list_execution.rs diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward.rs index 66dc0382..b75c81de 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward.rs @@ -331,6 +331,6 @@ use validate_scalar_prefix::push; use validate_scalar_prefix::validate_scalar_prefix; mod context_original_mtp_shared_layout; mod full_forward_prefix_program; -mod matrix_vector_buffers_and_shape; +mod matrix_vector_planning; mod original_mtp_forward_program; mod original_mtp_forward_program_original_graph; diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_planning.rs similarity index 100% rename from crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_planning.rs diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape/full_forward_final_gr_stages.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_planning/full_forward_final_gr_stages.rs similarity index 100% rename from crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape/full_forward_final_gr_stages.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_planning/full_forward_final_gr_stages.rs diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape/full_forward_finite_tail_mlp_gr.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_planning/full_forward_finite_tail_mlp_gr.rs similarity index 100% rename from crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape/full_forward_finite_tail_mlp_gr.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_planning/full_forward_finite_tail_mlp_gr.rs diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape/full_forward_moe_block_plan.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_planning/full_forward_moe_block_plan.rs similarity index 100% rename from crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape/full_forward_moe_block_plan.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_planning/full_forward_moe_block_plan.rs diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape/original_mtp_full_forward.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_planning/original_mtp_full_forward.rs similarity index 100% rename from crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape/original_mtp_full_forward.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_planning/original_mtp_full_forward.rs diff --git a/crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations.rs b/crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations.rs index 3a015c02..39a27fc5 100644 --- a/crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations.rs +++ b/crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations.rs @@ -12,5 +12,5 @@ mod original_expert_cache_adaptive_swaps; mod original_expert_cache_batched_refill; pub use original_expert_cache_batched_refill::RefillBatchOptions; mod original_expert_cache_file_slot_fill; -mod original_expert_cache_open_and_slots; -mod original_expert_cache_verify_and_lend; +mod original_expert_cache_slots; +mod original_expert_cache_loans; diff --git a/crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations/original_expert_cache_adaptive_swaps.rs b/crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations/original_expert_cache_adaptive_swaps.rs index 7864529b..bf8788ce 100644 --- a/crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations/original_expert_cache_adaptive_swaps.rs +++ b/crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations/original_expert_cache_adaptive_swaps.rs @@ -1,7 +1,7 @@ //! Expert cache: the adaptive swap batch (arm event, poll/wait, publish swapped slots) and the queued fills from a //! mapped bank or probe bytes, with admission checks, the copy stream choice and the liveness guard. -use super::original_expert_cache_open_and_slots::{check_total, span_layer}; +use super::original_expert_cache_slots::{check_total, span_layer}; use super::{ Error, MappedExpertBank, OriginalExpertCache, Rc, ResidentExpertBankSpan, Result, RetainedFill, State, api, combine, ffi, diff --git a/crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations/original_expert_cache_verify_and_lend.rs b/crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations/original_expert_cache_loans.rs similarity index 99% rename from crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations/original_expert_cache_verify_and_lend.rs rename to crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations/original_expert_cache_loans.rs index eb62a26b..bcf983c1 100644 --- a/crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations/original_expert_cache_verify_and_lend.rs +++ b/crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations/original_expert_cache_loans.rs @@ -1,7 +1,7 @@ //! Expert cache audits and loans: read-back byte verification of a filled slot against its source, lending the cache //! tail slots to a prefill (choose_loan, lend_prefill_tail, needs_refill), plus poison, close and leak-all teardown. -use super::original_expert_cache_open_and_slots::span_layer; +use super::original_expert_cache_slots::span_layer; use super::{ Error, MappedExpertBank, OriginalCachePrefix, OriginalExpertCache, OriginalPrefillArena, PrefillLayoutOptions, ResidentExpertBankSpan, Result, State, combine, ffi, diff --git a/crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations/original_expert_cache_open_and_slots.rs b/crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations/original_expert_cache_slots.rs similarity index 100% rename from crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations/original_expert_cache_open_and_slots.rs rename to crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations/original_expert_cache_slots.rs diff --git a/crates/cuda-driver/src/original_file_expert_source.rs b/crates/cuda-driver/src/original_file_expert_source.rs index 810a99d2..92bf4751 100644 --- a/crates/cuda-driver/src/original_file_expert_source.rs +++ b/crates/cuda-driver/src/original_file_expert_source.rs @@ -116,9 +116,9 @@ pub(crate) enum OriginalFileStreamSource<'source, 'ctx> { }, } -mod original_resident_options_and_blob; -use original_resident_options_and_blob::key; -use original_resident_options_and_blob::vec_filled; +mod original_file_source_blob; +use original_file_source_blob::key; +use original_file_source_blob::vec_filled; mod file_expert_source_swap_exchanges; mod original_file_expert_source_operations; #[cfg(windows)] diff --git a/crates/cuda-driver/src/original_file_expert_source/original_file_expert_source_operations.rs b/crates/cuda-driver/src/original_file_expert_source/original_file_expert_source_operations.rs index 63b96dc9..3753d8af 100644 --- a/crates/cuda-driver/src/original_file_expert_source/original_file_expert_source_operations.rs +++ b/crates/cuda-driver/src/original_file_expert_source/original_file_expert_source_operations.rs @@ -12,6 +12,6 @@ use super::{ mod build_phases; mod file_expert_source_cache_complement; mod file_expert_source_prefetch; -mod file_expert_source_stages_and_blobs; +mod file_expert_source_blobs; mod file_expert_source_status_counters; mod fill_workers; diff --git a/crates/cuda-driver/src/original_file_expert_source/original_file_expert_source_operations/file_expert_source_stages_and_blobs.rs b/crates/cuda-driver/src/original_file_expert_source/original_file_expert_source_operations/file_expert_source_blobs.rs similarity index 100% rename from crates/cuda-driver/src/original_file_expert_source/original_file_expert_source_operations/file_expert_source_stages_and_blobs.rs rename to crates/cuda-driver/src/original_file_expert_source/original_file_expert_source_operations/file_expert_source_blobs.rs diff --git a/crates/cuda-driver/src/original_file_expert_source/original_resident_options_and_blob.rs b/crates/cuda-driver/src/original_file_expert_source/original_file_source_blob.rs similarity index 100% rename from crates/cuda-driver/src/original_file_expert_source/original_resident_options_and_blob.rs rename to crates/cuda-driver/src/original_file_expert_source/original_file_source_blob.rs diff --git a/crates/cuda-driver/src/original_gpu_schedule/abi/platform.rs b/crates/cuda-driver/src/original_gpu_schedule/abi/platform.rs index 0763ddac..39d7389c 100644 --- a/crates/cuda-driver/src/original_gpu_schedule/abi/platform.rs +++ b/crates/cuda-driver/src/original_gpu_schedule/abi/platform.rs @@ -80,4 +80,4 @@ use library_drop::check; use library_drop::noop_host_fn; use library_drop::raise_after_copies; mod api; -mod async_copies_and_flag_writes; +mod async_copy_flags; diff --git a/crates/cuda-driver/src/original_gpu_schedule/abi/platform/async_copies_and_flag_writes.rs b/crates/cuda-driver/src/original_gpu_schedule/abi/platform/async_copy_flags.rs similarity index 100% rename from crates/cuda-driver/src/original_gpu_schedule/abi/platform/async_copies_and_flag_writes.rs rename to crates/cuda-driver/src/original_gpu_schedule/abi/platform/async_copy_flags.rs diff --git a/crates/cuda-driver/src/original_verify/original_verify_gdn_journal.rs b/crates/cuda-driver/src/original_verify/original_verify_gdn_journal.rs index ceb53f7e..17890e10 100644 --- a/crates/cuda-driver/src/original_verify/original_verify_gdn_journal.rs +++ b/crates/cuda-driver/src/original_verify/original_verify_gdn_journal.rs @@ -12,6 +12,6 @@ use super::{ mod original_verify_window; mod verify_gdn_fused_step; mod verify_gdn_journal_ladder_logits_scan; -mod verify_gdn_journal_stage_and_commit; +mod verify_gdn_journal_commit; mod verify_gdn_journal_window_launches; pub(crate) use original_verify_window::verify_assets_sealed; diff --git a/crates/cuda-driver/src/original_verify/original_verify_gdn_journal/verify_gdn_fused_step.rs b/crates/cuda-driver/src/original_verify/original_verify_gdn_journal/verify_gdn_fused_step.rs index 2eb0029f..2ac0573b 100644 --- a/crates/cuda-driver/src/original_verify/original_verify_gdn_journal/verify_gdn_fused_step.rs +++ b/crates/cuda-driver/src/original_verify/original_verify_gdn_journal/verify_gdn_fused_step.rs @@ -3,7 +3,7 @@ //! `capture_layer_stage` binds for the three Original kernels. use super::super::gdn_fused::{AbUnrolledStep, FusedGdnBuffers, FusedGdnStep, GateSource, GdnGateOperands, RowSpan}; -use super::verify_gdn_journal_stage_and_commit::StageOperands; +use super::verify_gdn_journal_commit::StageOperands; use super::{EPS, Error, OriginalCapture, OriginalGraphResources, OriginalVerifyGdnJournal, Result, admit}; impl<'ctx> OriginalVerifyGdnJournal<'ctx> { diff --git a/crates/cuda-driver/src/original_verify/original_verify_gdn_journal/verify_gdn_journal_stage_and_commit.rs b/crates/cuda-driver/src/original_verify/original_verify_gdn_journal/verify_gdn_journal_commit.rs similarity index 100% rename from crates/cuda-driver/src/original_verify/original_verify_gdn_journal/verify_gdn_journal_stage_and_commit.rs rename to crates/cuda-driver/src/original_verify/original_verify_gdn_journal/verify_gdn_journal_commit.rs diff --git a/crates/cuda-driver/src/original_verify/qsa/qsa_window.rs b/crates/cuda-driver/src/original_verify/qsa/qsa_window.rs index ae08106f..594e30f9 100644 --- a/crates/cuda-driver/src/original_verify/qsa/qsa_window.rs +++ b/crates/cuda-driver/src/original_verify/qsa/qsa_window.rs @@ -11,4 +11,4 @@ use super::{ mod qsa_window_prelude_rows; mod qsa_window_query_key_paths; -mod qsa_window_select_and_attend; +mod qsa_window_attention_launches; diff --git a/crates/cuda-driver/src/original_verify/qsa/qsa_window/qsa_window_select_and_attend.rs b/crates/cuda-driver/src/original_verify/qsa/qsa_window/qsa_window_attention_launches.rs similarity index 100% rename from crates/cuda-driver/src/original_verify/qsa/qsa_window/qsa_window_select_and_attend.rs rename to crates/cuda-driver/src/original_verify/qsa/qsa_window/qsa_window_attention_launches.rs diff --git a/crates/cuda-driver/src/original_verify/share_window_modules.rs b/crates/cuda-driver/src/original_verify/share_window_modules.rs index 82e1b5b3..9fe3cc2a 100644 --- a/crates/cuda-driver/src/original_verify/share_window_modules.rs +++ b/crates/cuda-driver/src/original_verify/share_window_modules.rs @@ -9,19 +9,19 @@ use super::{ RESERVE, Rc, RefCell, Result, STATE_WORDS, StagedWindow, combine, diag, kernels, profile, resources, }; -mod verify_bank_and_canonical_gdn_open; -pub(super) use verify_bank_and_canonical_gdn_open::admission; -pub(super) use verify_bank_and_canonical_gdn_open::admit; -pub(super) use verify_bank_and_canonical_gdn_open::check_canonical_lengths; -pub(super) use verify_bank_and_canonical_gdn_open::check_commands; -pub(super) use verify_bank_and_canonical_gdn_open::command; -pub(crate) use verify_bank_and_canonical_gdn_open::gather_rows_module; -pub(super) use verify_bank_and_canonical_gdn_open::handle; -pub(super) use verify_bank_and_canonical_gdn_open::poison; -pub(super) use verify_bank_and_canonical_gdn_open::sealed_asset; -pub(super) use verify_bank_and_canonical_gdn_open::share_window_modules; -pub(super) use verify_bank_and_canonical_gdn_open::transport; -pub(super) use verify_bank_and_canonical_gdn_open::zero; +mod verify_bank_canonical_gdn; +pub(super) use verify_bank_canonical_gdn::admission; +pub(super) use verify_bank_canonical_gdn::admit; +pub(super) use verify_bank_canonical_gdn::check_canonical_lengths; +pub(super) use verify_bank_canonical_gdn::check_commands; +pub(super) use verify_bank_canonical_gdn::command; +pub(crate) use verify_bank_canonical_gdn::gather_rows_module; +pub(super) use verify_bank_canonical_gdn::handle; +pub(super) use verify_bank_canonical_gdn::poison; +pub(super) use verify_bank_canonical_gdn::sealed_asset; +pub(super) use verify_bank_canonical_gdn::share_window_modules; +pub(super) use verify_bank_canonical_gdn::transport; +pub(super) use verify_bank_canonical_gdn::zero; mod original_verify_bank; mod physical; -mod verify_bank_plan_and_window_rows; +mod verify_bank_plan_access; diff --git a/crates/cuda-driver/src/original_verify/share_window_modules/verify_bank_and_canonical_gdn_open.rs b/crates/cuda-driver/src/original_verify/share_window_modules/verify_bank_canonical_gdn.rs similarity index 100% rename from crates/cuda-driver/src/original_verify/share_window_modules/verify_bank_and_canonical_gdn_open.rs rename to crates/cuda-driver/src/original_verify/share_window_modules/verify_bank_canonical_gdn.rs diff --git a/crates/cuda-driver/src/original_verify/share_window_modules/verify_bank_plan_and_window_rows.rs b/crates/cuda-driver/src/original_verify/share_window_modules/verify_bank_plan_access.rs similarity index 100% rename from crates/cuda-driver/src/original_verify/share_window_modules/verify_bank_plan_and_window_rows.rs rename to crates/cuda-driver/src/original_verify/share_window_modules/verify_bank_plan_access.rs diff --git a/crates/cuda-driver/src/original_verify/window_ops.rs b/crates/cuda-driver/src/original_verify/window_ops.rs index 7b57ba95..cf36712d 100644 --- a/crates/cuda-driver/src/original_verify/window_ops.rs +++ b/crates/cuda-driver/src/original_verify/window_ops.rs @@ -115,7 +115,7 @@ mod window_launches; mod qsa_prelude_ops; mod side_qsa_branches; mod side_shared_expert; -mod window_ops_kernels_and_pcie_plan; +mod window_step_recording; mod wait_rows; #[cfg(test)] pub(crate) use original_verifier::graph_oom_at; diff --git a/crates/cuda-driver/src/original_verify/window_ops/window_launches.rs b/crates/cuda-driver/src/original_verify/window_ops/window_launches.rs index 2995fe05..7e20a3b0 100644 --- a/crates/cuda-driver/src/original_verify/window_ops/window_launches.rs +++ b/crates/cuda-driver/src/original_verify/window_ops/window_launches.rs @@ -1,6 +1,6 @@ //! The launches and plan words of `OriginalVerifyWindowOps`: the GDN side stream, embedding, the plan and its group //! offsets, the journal and submit. -//! Apart from `window_ops_kernels_and_pcie_plan.rs`, which implements the `WindowOps` kernels. +//! Apart from `window_step_recording.rs`, which implements the `WindowOps` kernels. use super::{ Arg, Command, Error, Launch, OriginalVerifyGdnJournal, OriginalVerifyGeometry, OriginalVerifyWindowOps, PlanLayout, diff --git a/crates/cuda-driver/src/original_verify/window_ops/window_ops_kernels_and_pcie_plan.rs b/crates/cuda-driver/src/original_verify/window_ops/window_step_recording.rs similarity index 100% rename from crates/cuda-driver/src/original_verify/window_ops/window_ops_kernels_and_pcie_plan.rs rename to crates/cuda-driver/src/original_verify/window_ops/window_step_recording.rs diff --git a/crates/cuda-driver/src/ple_batch_ffi/driver_backed.rs b/crates/cuda-driver/src/ple_batch_ffi/driver_backed.rs index 3351a5ff..eb53fc24 100644 --- a/crates/cuda-driver/src/ple_batch_ffi/driver_backed.rs +++ b/crates/cuda-driver/src/ple_batch_ffi/driver_backed.rs @@ -84,4 +84,4 @@ pub(crate) struct KernelModule { mod library; use library::check; mod blas; -mod kernel_module_launch_and_close; +mod kernel_module; diff --git a/crates/cuda-driver/src/ple_batch_ffi/driver_backed/kernel_module_launch_and_close.rs b/crates/cuda-driver/src/ple_batch_ffi/driver_backed/kernel_module.rs similarity index 100% rename from crates/cuda-driver/src/ple_batch_ffi/driver_backed/kernel_module_launch_and_close.rs rename to crates/cuda-driver/src/ple_batch_ffi/driver_backed/kernel_module.rs diff --git a/crates/cuda-driver/src/projection_grids_and_bounds.rs b/crates/cuda-driver/src/projection_geometry.rs similarity index 100% rename from crates/cuda-driver/src/projection_grids_and_bounds.rs rename to crates/cuda-driver/src/projection_geometry.rs diff --git a/crates/cuda-driver/src/qsa_prompt_attention.rs b/crates/cuda-driver/src/qsa_prompt_attention.rs index c6c5a977..efdc676f 100644 --- a/crates/cuda-driver/src/qsa_prompt_attention.rs +++ b/crates/cuda-driver/src/qsa_prompt_attention.rs @@ -49,7 +49,7 @@ mod resident_attention; pub(crate) use resident_attention::OriginalQsaAttendedKv; pub use resident_attention::OriginalQsaResidentAttention; -mod attention_kernel_plan_and_passes; +mod attention_launch_plan; mod qsa_attention_inputs; mod qsa_prompt_attention_drop; pub(crate) use qsa_prompt_attention_drop::guard_grid; diff --git a/crates/cuda-driver/src/qsa_prompt_attention/attention_kernel_plan_and_passes.rs b/crates/cuda-driver/src/qsa_prompt_attention/attention_launch_plan.rs similarity index 100% rename from crates/cuda-driver/src/qsa_prompt_attention/attention_kernel_plan_and_passes.rs rename to crates/cuda-driver/src/qsa_prompt_attention/attention_launch_plan.rs diff --git a/crates/cuda-driver/src/qsa_prompt_attention/attention_kernel_plan_and_passes/attention_passes.rs b/crates/cuda-driver/src/qsa_prompt_attention/attention_launch_plan/attention_passes.rs similarity index 100% rename from crates/cuda-driver/src/qsa_prompt_attention/attention_kernel_plan_and_passes/attention_passes.rs rename to crates/cuda-driver/src/qsa_prompt_attention/attention_launch_plan/attention_passes.rs diff --git a/crates/cuda-driver/src/qsa_prompt_attention/attention_kernel_plan_and_passes/prompt_attention_owner.rs b/crates/cuda-driver/src/qsa_prompt_attention/attention_launch_plan/prompt_attention_owner.rs similarity index 100% rename from crates/cuda-driver/src/qsa_prompt_attention/attention_kernel_plan_and_passes/prompt_attention_owner.rs rename to crates/cuda-driver/src/qsa_prompt_attention/attention_launch_plan/prompt_attention_owner.rs diff --git a/crates/cuda-driver/src/qsa_prompt_attention/attention_kernel_plan_and_passes/reject_mutual_alias.rs b/crates/cuda-driver/src/qsa_prompt_attention/attention_launch_plan/reject_mutual_alias.rs similarity index 100% rename from crates/cuda-driver/src/qsa_prompt_attention/attention_kernel_plan_and_passes/reject_mutual_alias.rs rename to crates/cuda-driver/src/qsa_prompt_attention/attention_launch_plan/reject_mutual_alias.rs diff --git a/crates/cuda-driver/src/qsa_prompt_attention/device_attention.rs b/crates/cuda-driver/src/qsa_prompt_attention/device_attention.rs index bb1f8b37..7d5fed74 100644 --- a/crates/cuda-driver/src/qsa_prompt_attention/device_attention.rs +++ b/crates/cuda-driver/src/qsa_prompt_attention/device_attention.rs @@ -1,5 +1,5 @@ //! Same literal attention on the real selected query/IDs/steps/attn arena. -use super::attention_kernel_plan_and_passes::AttnPasses; +use super::attention_launch_plan::AttnPasses; use super::{Error, NativeBatchWorkspace, QsaAttendedKv, QsaPromptAttention, QsaPromptStage, Result}; impl<'ctx> QsaPromptAttention<'ctx> { pub(crate) fn attend_original_arena( diff --git a/crates/cuda-driver/src/qsa_prompt_attention/resident_attention.rs b/crates/cuda-driver/src/qsa_prompt_attention/resident_attention.rs index 58907c12..bb671be2 100644 --- a/crates/cuda-driver/src/qsa_prompt_attention/resident_attention.rs +++ b/crates/cuda-driver/src/qsa_prompt_attention/resident_attention.rs @@ -1,5 +1,5 @@ //! Same literal attention on the real selected query/IDs/steps/attn arena. -use super::attention_kernel_plan_and_passes::{AttnPasses, KernelEntry, admit_budget}; +use super::attention_launch_plan::{AttnPasses, KernelEntry, admit_budget}; use super::{ Arguments, Context, Error, LaunchGeometry, Module, NativeBatchWorkspace, QsaPromptAttention, Result, SelectSwitches, checked, combine, diff --git a/crates/cuda-driver/src/qsa_prompt_index.rs b/crates/cuda-driver/src/qsa_prompt_index.rs index b1ade19e..b1d06556 100644 --- a/crates/cuda-driver/src/qsa_prompt_index.rs +++ b/crates/cuda-driver/src/qsa_prompt_index.rs @@ -86,7 +86,7 @@ use max_blocks::max_blocks; use max_blocks::sizes; mod append_select; mod index_run; -mod qsa_prompt_index_read_and_close; +mod qsa_prompt_index_results; mod qsa_prompt_index_workspace; mod run_launches; mod run_phases; diff --git a/crates/cuda-driver/src/qsa_prompt_index/qsa_prompt_index_read_and_close.rs b/crates/cuda-driver/src/qsa_prompt_index/qsa_prompt_index_results.rs similarity index 100% rename from crates/cuda-driver/src/qsa_prompt_index/qsa_prompt_index_read_and_close.rs rename to crates/cuda-driver/src/qsa_prompt_index/qsa_prompt_index_results.rs diff --git a/crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_prefix.rs b/crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_prefix.rs index 69c31d14..795c80ca 100644 --- a/crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_prefix.rs +++ b/crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_prefix.rs @@ -7,5 +7,5 @@ use super::{ QsaPromptKv, Rc, Result, SelectedRows, checked, stage_runs, }; -mod qsa_mapped_journal_append_and_resolve; -mod qsa_mapped_journal_prefix_and_prefetch; +mod qsa_mapped_journal_arena; +mod qsa_mapped_journal_prefix_lineage; diff --git a/crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_prefix/qsa_mapped_journal_append_and_resolve.rs b/crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_prefix/qsa_mapped_journal_arena.rs similarity index 100% rename from crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_prefix/qsa_mapped_journal_append_and_resolve.rs rename to crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_prefix/qsa_mapped_journal_arena.rs diff --git a/crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_prefix/qsa_mapped_journal_prefix_and_prefetch.rs b/crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_prefix/qsa_mapped_journal_prefix_lineage.rs similarity index 100% rename from crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_prefix/qsa_mapped_journal_prefix_and_prefetch.rs rename to crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_prefix/qsa_mapped_journal_prefix_lineage.rs diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix.rs index a629a0fa..0a5bb173 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix.rs @@ -8,5 +8,5 @@ use super::{ }; mod native_projection; -mod qkv_and_z_projections; -mod recurrence_and_output; +mod gdn_batch_input_stages; +mod gdn_batch_recurrence_stages; diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix/qkv_and_z_projections.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix/gdn_batch_input_stages.rs similarity index 100% rename from crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix/qkv_and_z_projections.rs rename to crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix/gdn_batch_input_stages.rs diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix/recurrence_and_output.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix/gdn_batch_recurrence_stages.rs similarity index 100% rename from crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix/recurrence_and_output.rs rename to crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix/gdn_batch_recurrence_stages.rs diff --git a/crates/cuda-driver/src/qwen_ffi.rs b/crates/cuda-driver/src/qwen_ffi.rs index 9a4dc440..35c70c09 100644 --- a/crates/cuda-driver/src/qwen_ffi.rs +++ b/crates/cuda-driver/src/qwen_ffi.rs @@ -23,15 +23,15 @@ use qsa_layout::gdn_layout; use qsa_layout::moe_layout; use qsa_layout::ple_layout; pub(super) use qsa_layout::qsa_layout; -mod asset_validation_and_bf16_layout; -pub(super) use asset_validation_and_bf16_layout::bf16_layout; -use asset_validation_and_bf16_layout::gdn_asset; -use asset_validation_and_bf16_layout::gr_asset; -use asset_validation_and_bf16_layout::inspect_ptx; -pub(super) use asset_validation_and_bf16_layout::kar_ple_layout; -use asset_validation_and_bf16_layout::moe_asset; -use asset_validation_and_bf16_layout::ple_asset; -use asset_validation_and_bf16_layout::qsa_asset; +mod asset_admission; +pub(super) use asset_admission::bf16_layout; +use asset_admission::gdn_asset; +use asset_admission::gr_asset; +use asset_admission::inspect_ptx; +pub(super) use asset_admission::kar_ple_layout; +use asset_admission::moe_asset; +use asset_admission::ple_asset; +use asset_admission::qsa_asset; mod asset; pub(super) use asset::asset; pub(crate) use asset::sha256; diff --git a/crates/cuda-driver/src/qwen_ffi/asset_validation_and_bf16_layout.rs b/crates/cuda-driver/src/qwen_ffi/asset_admission.rs similarity index 100% rename from crates/cuda-driver/src/qwen_ffi/asset_validation_and_bf16_layout.rs rename to crates/cuda-driver/src/qwen_ffi/asset_admission.rs diff --git a/crates/experimental-ref/src/cvec.rs b/crates/experimental-ref/src/cvec.rs index d7a4768e..dd3015b9 100644 --- a/crates/experimental-ref/src/cvec.rs +++ b/crates/experimental-ref/src/cvec.rs @@ -108,7 +108,7 @@ pub struct CvecTables { #[cfg(test)] mod tests; -mod cvec_reading_and_errors; -pub use cvec_reading_and_errors::*; +mod cvec_reader; +pub use cvec_reader::*; mod load_control_vectors; pub use load_control_vectors::*; diff --git a/crates/experimental-ref/src/cvec/cvec_reading_and_errors.rs b/crates/experimental-ref/src/cvec/cvec_reader.rs similarity index 100% rename from crates/experimental-ref/src/cvec/cvec_reading_and_errors.rs rename to crates/experimental-ref/src/cvec/cvec_reader.rs diff --git a/crates/gptoss-npu/src/lib.rs b/crates/gptoss-npu/src/lib.rs index 29dafb3a..658b43ad 100644 --- a/crates/gptoss-npu/src/lib.rs +++ b/crates/gptoss-npu/src/lib.rs @@ -110,7 +110,7 @@ fn fail(e: impl std::fmt::Display) -> ModelError { #[cfg(test)] mod tests; -mod construction_and_estimates; +mod npu_prefill_setup; mod service_transfers; mod prefill_batch; mod prefill_part_pass; diff --git a/crates/gptoss-npu/src/construction_and_estimates.rs b/crates/gptoss-npu/src/npu_prefill_setup.rs similarity index 100% rename from crates/gptoss-npu/src/construction_and_estimates.rs rename to crates/gptoss-npu/src/npu_prefill_setup.rs diff --git a/crates/gptoss/src/state_and_cache.rs b/crates/gptoss/src/decode_state.rs similarity index 100% rename from crates/gptoss/src/state_and_cache.rs rename to crates/gptoss/src/decode_state.rs diff --git a/crates/gptoss/src/lib.rs b/crates/gptoss/src/lib.rs index 84c116b1..03f272be 100644 --- a/crates/gptoss/src/lib.rs +++ b/crates/gptoss/src/lib.rs @@ -37,8 +37,8 @@ const DEFAULT_PREFILL_CHUNK: usize = 64; #[cfg(test)] mod tests; -mod bytes_and_errors; -pub use bytes_and_errors::{ModelBytes, ModelError}; +mod model_bytes; +pub use model_bytes::{ModelBytes, ModelError}; mod config; pub use config::Config; mod weights; @@ -54,8 +54,8 @@ mod model; pub use model::Model; mod profile; pub use profile::Profile; -mod state_and_cache; -pub use state_and_cache::{LayerCache, PrefillAccelerator, PrefillJob, PrefillOffload, PrefillSpan, Reuse, State}; +mod decode_state; +pub use decode_state::{LayerCache, PrefillAccelerator, PrefillJob, PrefillOffload, PrefillSpan, Reuse, State}; mod scalar_numerics; use scalar_numerics::{argmax, dequantize_q8_0_row, f32_to_half_bits, half_to_f32}; mod parallel_jobs; diff --git a/crates/gptoss/src/bytes_and_errors.rs b/crates/gptoss/src/model_bytes.rs similarity index 100% rename from crates/gptoss/src/bytes_and_errors.rs rename to crates/gptoss/src/model_bytes.rs diff --git a/crates/igpu/src/error_and_kind.rs b/crates/igpu/src/gpu_error.rs similarity index 89% rename from crates/igpu/src/error_and_kind.rs rename to crates/igpu/src/gpu_error.rs index 9f94a291..c0e52119 100644 --- a/crates/igpu/src/error_and_kind.rs +++ b/crates/igpu/src/gpu_error.rs @@ -1,4 +1,4 @@ -//! The weight kind and the error of the GPU backend. +//! The error of the GPU backend, with the weight kind its upload and shape errors name. use super::fmt; diff --git a/crates/igpu/src/lib.rs b/crates/igpu/src/lib.rs index 912de57e..c1922951 100644 --- a/crates/igpu/src/lib.rs +++ b/crates/igpu/src/lib.rs @@ -22,8 +22,8 @@ const MXFP4_BYTES: usize = 17; #[cfg(test)] mod tests; -mod error_and_kind; -pub use error_and_kind::{GpuError, WeightKind}; +mod gpu_error; +pub use gpu_error::{GpuError, WeightKind}; mod handles; pub use handles::{Buf, GpuActivations, GpuMatrix}; mod params; @@ -43,10 +43,10 @@ pub use repacking::{repack_activations, repack_mxfp4}; mod device; pub use device::Gpu; use device::{entry, groups_1d}; -mod matrices_and_moe_plan; +mod matrix_uploads; mod readback; mod recorder_core; pub use recorder_core::Recorder; -mod recorder_attention_and_submit; +mod recorder_attention; mod recorder_moe; -mod recorder_norm_and_routing; +mod recorder_activation_passes; diff --git a/crates/igpu/src/matrices_and_moe_plan.rs b/crates/igpu/src/matrix_uploads.rs similarity index 100% rename from crates/igpu/src/matrices_and_moe_plan.rs rename to crates/igpu/src/matrix_uploads.rs diff --git a/crates/igpu/src/recorder_norm_and_routing.rs b/crates/igpu/src/recorder_activation_passes.rs similarity index 100% rename from crates/igpu/src/recorder_norm_and_routing.rs rename to crates/igpu/src/recorder_activation_passes.rs diff --git a/crates/igpu/src/recorder_attention_and_submit.rs b/crates/igpu/src/recorder_attention.rs similarity index 100% rename from crates/igpu/src/recorder_attention_and_submit.rs rename to crates/igpu/src/recorder_attention.rs diff --git a/crates/igpu/src/shaders.rs b/crates/igpu/src/shaders.rs index 8d46ac67..fcab6943 100644 --- a/crates/igpu/src/shaders.rs +++ b/crates/igpu/src/shaders.rs @@ -10,15 +10,15 @@ mod gemm; mod gemm_template; pub use gemm::*; -mod tiling_norm_and_rope; -pub use tiling_norm_and_rope::{RMSNORM_QUANT, ROPE, TILE_M, TILE_N}; +mod rmsnorm_rope_shaders; +pub use rmsnorm_rope_shaders::{RMSNORM_QUANT, ROPE, TILE_M, TILE_N}; mod kv_store; pub use kv_store::KV_STORE; mod attention; pub use attention::ATTENTION; -mod quantize_and_swiglu; -pub use quantize_and_swiglu::{QUANTIZE, SWIGLU_QUANT}; -mod routing_and_combine; -pub use routing_and_combine::{MOE_COMBINE, ROUTER}; +mod quantize_shaders; +pub use quantize_shaders::{QUANTIZE, SWIGLU_QUANT}; +mod expert_routing_shaders; +pub use expert_routing_shaders::{MOE_COMBINE, ROUTER}; mod f16_round; use f16_round::F16_ROUND; diff --git a/crates/igpu/src/shaders/routing_and_combine.rs b/crates/igpu/src/shaders/expert_routing_shaders.rs similarity index 100% rename from crates/igpu/src/shaders/routing_and_combine.rs rename to crates/igpu/src/shaders/expert_routing_shaders.rs diff --git a/crates/igpu/src/shaders/quantize_and_swiglu.rs b/crates/igpu/src/shaders/quantize_shaders.rs similarity index 100% rename from crates/igpu/src/shaders/quantize_and_swiglu.rs rename to crates/igpu/src/shaders/quantize_shaders.rs diff --git a/crates/igpu/src/shaders/tiling_norm_and_rope.rs b/crates/igpu/src/shaders/rmsnorm_rope_shaders.rs similarity index 100% rename from crates/igpu/src/shaders/tiling_norm_and_rope.rs rename to crates/igpu/src/shaders/rmsnorm_rope_shaders.rs diff --git a/crates/native-cpu-expert/src/rust_general_pool.rs b/crates/native-cpu-expert/src/rust_general_pool.rs index bdfdd016..46513a5e 100644 --- a/crates/native-cpu-expert/src/rust_general_pool.rs +++ b/crates/native-cpu-expert/src/rust_general_pool.rs @@ -118,4 +118,4 @@ use job_default::now_ms; mod epoch_scheduling; mod expert_pool; mod expert_pool_split_multi_run; -mod shared_wait_done_and_quantize_lanes; +mod phase_handoff; diff --git a/crates/native-cpu-expert/src/rust_general_pool/shared_wait_done_and_quantize_lanes.rs b/crates/native-cpu-expert/src/rust_general_pool/phase_handoff.rs similarity index 100% rename from crates/native-cpu-expert/src/rust_general_pool/shared_wait_done_and_quantize_lanes.rs rename to crates/native-cpu-expert/src/rust_general_pool/phase_handoff.rs diff --git a/crates/openvino/src/compile_and_infer.rs b/crates/openvino/src/inference_runtime.rs similarity index 100% rename from crates/openvino/src/compile_and_infer.rs rename to crates/openvino/src/inference_runtime.rs diff --git a/crates/openvino/src/lib.rs b/crates/openvino/src/lib.rs index 5191ebdc..36216641 100644 --- a/crates/openvino/src/lib.rs +++ b/crates/openvino/src/lib.rs @@ -32,8 +32,8 @@ pub use c_api_types::Element; use c_api_types::{CompileFns, CoreFns, DevicesFns, Fns, ModelFns, RawDevices, RawShape, RequestFns, Status, TensorFns}; mod library; pub use library::OpenVino; -mod compile_and_infer; -pub use compile_and_infer::{Compiled, Core, Request}; +mod inference_runtime; +pub use inference_runtime::{Compiled, Core, Request}; mod tensor; pub use tensor::Tensor; use tensor::cstring; diff --git a/docs/architecture/size-split-rest.md b/docs/architecture/size-split-rest.md index 9c9e0b8f..873d0483 100644 --- a/docs/architecture/size-split-rest.md +++ b/docs/architecture/size-split-rest.md @@ -23,19 +23,19 @@ A test id is `::`. A split changes the module path and n | Was | Now | | --- | --- | -| `gptoss/src/lib.rs` (1788 lines) | `bytes_and_errors`, `config`, `weights`, `tensor_loading`, `quant_probes`, `model`, `profile`, `state_and_cache`, `scalar_numerics`, `parallel_jobs`, `parallel_region`, `prefill`, `forward_pass`, `generation`, `tests` | -| `cpu-sys/src/lib.rs` (1007) | `checks`, `portable`, `avx2_and_avxvnni`, `attention_and_elementwise`, `tiles`, `oracle`, `tests`; the `with_avx2!` and `with_avxvnni!` macros stay in `lib.rs` so every kernel module sees them | -| `cpu-sys/src/simd.rs` (1503) | `simd/scalar_dots_and_formats`, `simd/scalar_tiles_and_elementwise`, `simd/x86` (the former inline module) with `simd/x86/{reductions_and_int_dots, mxfp4_q8_dots, q8_dots_and_mxfp4_tiles, tile_kernels, attention_kernels, f16_attention_and_elementwise, quantize_q8_0}` | -| `igpu/src/lib.rs` (1386) | `error_and_kind`, `handles`, `params`, `repacking`, `device`, `readback`, `matrices_and_moe_plan`, `recorder_core`, `recorder_norm_and_routing`, `recorder_moe`, `recorder_attention_and_submit`, `tests`; the long `impl Gpu` and `impl Recorder` blocks are cut between methods | -| `igpu/src/shaders.rs` (440) | `shaders/{tiling_norm_and_rope, kv_store, attention, quantize_and_swiglu, routing_and_combine, f16_round}` (WGSL text constants) | +| `gptoss/src/lib.rs` (1788 lines) | `model_bytes`, `config`, `weights`, `tensor_loading`, `quant_probes`, `model`, `profile`, `decode_state`, `scalar_numerics`, `parallel_jobs`, `parallel_region`, `prefill`, `forward_pass`, `generation`, `tests` | +| `cpu-sys/src/lib.rs` (1007) | `checks`, `portable`, `x86_dot_kernels`, `checked_attention_kernels`, `tiles`, `oracle`, `tests`; the `with_avx2!` and `with_avxvnni!` macros stay in `lib.rs` so every kernel module sees them | +| `cpu-sys/src/simd.rs` (1503) | `simd/scalar_dot_kernels`, `simd/scalar_tile_kernels`, `simd/x86` (the former inline module) with `simd/x86/{int_dot_kernels, mxfp4_q8_dots, q8_0_dot_kernels, tile_kernels, attention_kernels, f16_attention_kernels, quantize_q8_0}` | +| `igpu/src/lib.rs` (1386) | `gpu_error`, `handles`, `params`, `repacking`, `device`, `readback`, `matrix_uploads`, `recorder_core`, `recorder_activation_passes`, `recorder_moe`, `recorder_attention`, `tests`; the long `impl Gpu` and `impl Recorder` blocks are cut between methods | +| `igpu/src/shaders.rs` (440) | `shaders/{rmsnorm_rope_shaders, kv_store, attention, quantize_shaders, expert_routing_shaders, f16_round}` (WGSL text constants) | | `gguf/src/lib.rs` (560) | `error`, `value`, `tensor_type`, `file`, `reader` | | `tokenizer/src/lib.rs` (840) | `construction`, `encoding`, `decoding`, `bpe_merge`, `vocabulary`, `tests` | | `quant-core/src/iq2s_grid.rs` (1032) | the same table, four entries per line under `#[rustfmt::skip]` (265 lines); the entries and their order are unchanged and the SHA-256 test of the crate still pins them | -| `openvino/src/lib.rs` (676) | `error`, `c_api_types`, `library`, `compile_and_infer`, `tensor`, `tests` | +| `openvino/src/lib.rs` (676) | `error`, `c_api_types`, `library`, `inference_runtime`, `tensor`, `tests` | | `cpu-kernels/src/lib.rs` (464) | `isa`, `dispatch`, `tests` | | `shm/src/lib.rs` (432) | `unix`, `windows` (each loaded as `imp` through a `use ... as imp`), `tests` | | `gptoss-igpu/src/lib.rs` (524) | `prefill_pass`, `tests` | -| `gptoss-npu/src/lib.rs` (809) | `construction_and_estimates`, `service_transfers`, `prefill_part_pass`, `expert_pass`, `accelerator`, `tests` | +| `gptoss-npu/src/lib.rs` (809) | `npu_prefill_setup`, `service_transfers`, `prefill_part_pass`, `expert_pass`, `accelerator`, `tests` | | `gateway-domain/src/responses/render.rs` (405, one function of 385 lines) | `render.rs` (the entry), `render/instructions` (one function per system message), `render/replay` (one method per input item kind) | Every `unsafe` block and its `SAFETY` comment moved verbatim with the code it belongs to (the `unsafe` counts of `cpu-sys` diff --git a/docs/experiments/ffn-phase-loss-design.md b/docs/experiments/ffn-phase-loss-design.md index 26995b69..8ef63d9a 100644 --- a/docs/experiments/ffn-phase-loss-design.md +++ b/docs/experiments/ffn-phase-loss-design.md @@ -192,8 +192,8 @@ No pure stream-structure change is left to propose (bitwise-safe by construction | id | switch | change | where | expected, us per layer averaged over all layers (ms per graph) at T=2 / 3 / 4 | identity | | --- | --- | --- | --- | --- | --- | | D1 | `LELEKA_SM120_DOWN_SUB16` | the down projection of the routed experts with upstream's group-strided sub8/sub16 kernel, grid 80 (type 20) or 160 (type 42) x block rows; the PCIe pass with 4 block rows (`kPcieGroupRows`), the gate/up of the PCIe pass with grid.y 4 (the fused kernel already strides) | new sealed asset `sm120_down_sub16.cu/.ptx` (port of `native_down_multi_kernel`, `iq_kernels.cu:2130`), planner `GroupPlan::down` and `GroupPlan::fused_gate_up` in `original_verify_window_moe/plan_expert_groups.rs` | VRAM pass 1.7 / 2.4 / 2.4 (0.082 / 0.114 / 0.116); PCIe pass down 1.5 / 2.3 / 2.1 (0.072 / 0.108 / 0.101); PCIe pass gate/up grid 0.3 / 0.2 / 0.2 (0.016 / 0.009 / 0.011) | **needs a probe**: a different lane layout (8 lanes for K=40, 16 for Q2_0) than the literal `row_dot` of `window_moe_down_`; bit-equality is upstream's design aim (GU_SWIGLU's sub16 was byte-equal in `sm120_probe gu`) but not shown for down | -| D2 | `LELEKA_SM120_HITS_IN_COMBINE` | `add_hits` folded into the combine (upstream `combine_k10_vec4_hits`, `native_moe.cu:98`, `native_moe_combine_multi_hits_added`), -48 launches per graph | new sealed asset next to `sm120_combine_vec4.cu`; `hit_add` and `combine` in `window_ops_kernels_and_pcie_plan.rs` call a new planner in a new file | 1.2 / 1.3 / 1.3 (0.059 / 0.063 / 0.063), upper bound = the `AH` duration 1.2-1.3 us; the folded combine reads the hit rows and costs a little more | needs a probe: `add_hits` does `parts += hit_out` onto rows the CPU leg zeroed (0 + x = x except x = -0.0); the folded kernel must reproduce the +0.0 | -| D3 | `LELEKA_SM120_WAIT_M_ROWS` | the wait on flag M folded into the copy of the CPU rows (`copy_rows_from_mapped_after`, `verify.cpp:2189`), -48 launches per graph | new entry in a new `.cu` (do not touch `chain_window.cu`); `wait_cpu` and `copy_cpu_rows` in `window_ops_kernels_and_pcie_plan.rs` | 1.3 / 1.1 / 0.9 (0.062 / 0.052 / 0.043): the `WM` floor 1.4-1.6 us in F layers, 0.5 us assumed after a real wait | bitwise by construction (the same copy after the same flag), still a probe for the CPU rows; **risk**: upstream measured -1.5 % decode on a Turing card for this fold ("every row block polls the flag over PCIe"), so it stays OFF until a section delta says otherwise | +| D2 | `LELEKA_SM120_HITS_IN_COMBINE` | `add_hits` folded into the combine (upstream `combine_k10_vec4_hits`, `native_moe.cu:98`, `native_moe_combine_multi_hits_added`), -48 launches per graph | new sealed asset next to `sm120_combine_vec4.cu`; `hit_add` and `combine` in `window_step_recording.rs` call a new planner in a new file | 1.2 / 1.3 / 1.3 (0.059 / 0.063 / 0.063), upper bound = the `AH` duration 1.2-1.3 us; the folded combine reads the hit rows and costs a little more | needs a probe: `add_hits` does `parts += hit_out` onto rows the CPU leg zeroed (0 + x = x except x = -0.0); the folded kernel must reproduce the +0.0 | +| D3 | `LELEKA_SM120_WAIT_M_ROWS` | the wait on flag M folded into the copy of the CPU rows (`copy_rows_from_mapped_after`, `verify.cpp:2189`), -48 launches per graph | new entry in a new `.cu` (do not touch `chain_window.cu`); `wait_cpu` and `copy_cpu_rows` in `window_step_recording.rs` | 1.3 / 1.1 / 0.9 (0.062 / 0.052 / 0.043): the `WM` floor 1.4-1.6 us in F layers, 0.5 us assumed after a real wait | bitwise by construction (the same copy after the same flag), still a probe for the CPU rows; **risk**: upstream measured -1.5 % decode on a Turing card for this fold ("every row block polls the flag over PCIe"), so it stays OFF until a section delta says otherwise | | all | | | | **4.2 / 4.8 / 4.7 (0.199 / 0.231 / 0.227)** with the shared-chain cap; 32 % / 22 % / 8 % of the T-matched gap of 0.613 / 1.043 / 2.960 ms | | Arithmetic of D1 at T=3 (CY.1, GDN): F-layer `V_DN` 19.3 us against 14.2 us in VANL = 5.1 us, F share 52 % -> 2.6 us per layer before the slack model, 2.4 after; the empty PCIe down pass 5.5 us -> 0.7 us (the VANL value) = 4.8 us x 0.52 = 2.5 -> 2.3 us. The row S7 of the ledger (estimate 0.20-0.35 ms) is refined to 0.17-0.23 ms for D1 (VRAM pass 0.08-0.12, PCIe down pass 0.07-0.11, PCIe gate/up 0.01-0.02, T=2..4, before the cap). @@ -210,7 +210,7 @@ If D1 delivers more than the shared chain's slack (4.1 us at T=2), the combine w All in `crates/cuda-driver/src/` unless noted; the hard rules of `verify-step-brief.md` apply (switch resolved in `original_verify_window_sm120.rs`, functions <= 30 lines, files <= 400 lines, `WindowPolicy` grows by the two lines of T0 only, no GPU, PTX that cannot be built here is delivered as `.cu` marked "PTX not built"). -- **T0 (scaffold, one small commit, done first by one agent, then the three tasks start from it):** `original_verify_window_sm120.rs` gets one block: `DEFAULT_ON_DOWN_SUB16`, `DEFAULT_ON_HITS_IN_COMBINE`, `DEFAULT_ON_WAIT_M_ROWS` (all false), the `LELEKA_SM120_*` names in `Sm120Switches`/`from_env`/`resolve` with their tests (pattern: `side_qsa_follows_its_own_variable_and_the_master_switch`); a new DTO file `original_verify_window_ffn.rs` with `FfnSwitches { down_sub16, hits_in_combine, wait_m_rows }` (Copy); one field `pub ffn: super::ffn::FfnSwitches` in `WindowPolicy` (`original_verify_window_record.rs`: 398 lines on this base, 400 in the brief, so the +2 lines with the `mode17()` default are the whole headroom) and the one-line hooks in `window_ops_kernels_and_pcie_plan.rs`: `expert_groups` (tier + switches to the planner), `wait_cpu` + `copy_cpu_rows` (call `self.ffn_wait_rows(...)` when the switch is on) and `hit_add` + `combine` (call `self.ffn_hits_combine(...)`), each defined in the task's own file below as an `impl OriginalVerifyWindowOps` method that is a stub (`Err(Error::UnsupportedQwenOperation)`) until the task fills it in. This is what makes the three tasks disjoint. +- **T0 (scaffold, one small commit, done first by one agent, then the three tasks start from it):** `original_verify_window_sm120.rs` gets one block: `DEFAULT_ON_DOWN_SUB16`, `DEFAULT_ON_HITS_IN_COMBINE`, `DEFAULT_ON_WAIT_M_ROWS` (all false), the `LELEKA_SM120_*` names in `Sm120Switches`/`from_env`/`resolve` with their tests (pattern: `side_qsa_follows_its_own_variable_and_the_master_switch`); a new DTO file `original_verify_window_ffn.rs` with `FfnSwitches { down_sub16, hits_in_combine, wait_m_rows }` (Copy); one field `pub ffn: super::ffn::FfnSwitches` in `WindowPolicy` (`original_verify_window_record.rs`: 398 lines on this base, 400 in the brief, so the +2 lines with the `mode17()` default are the whole headroom) and the one-line hooks in `window_step_recording.rs`: `expert_groups` (tier + switches to the planner), `wait_cpu` + `copy_cpu_rows` (call `self.ffn_wait_rows(...)` when the switch is on) and `hit_add` + `combine` (call `self.ffn_hits_combine(...)`), each defined in the task's own file below as an `impl OriginalVerifyWindowOps` method that is a stub (`Err(Error::UnsupportedQwenOperation)`) until the task fills it in. This is what makes the three tasks disjoint. - **T1, D1 `DOWN_SUB16`:** new `sm120_down_sub16.cu` (+`.ptx`, pinned and sealed like `sm120_gu_swiglu`: `AssetSpec`, `extra-seal-plan.json`, `ptx-sm86/MANIFEST.json` note), new `original_verify_window_down.rs` (asset, entries `sm120_moe_down_20` and `_42` only, the two formats the window uses; `assert_sealed_and_fail_closed` as in `original_verify_window_draft.rs`), edits in `original_verify_window_moe/plan_expert_groups.rs` (`GroupPlan::down`, `fused_gate_up`, `plan_expert_groups`) and `original_verify_window_moe.rs` (`MoeKnobs`, `DOWN_ENTRIES`), probe in `tools/decode-sm120/sm120_probe.cpp` (+`build.sh`): new `down` mode comparing the new kernel with `window_moe_down_` byte for byte on random expert blobs, T 1-8, group counts 0-16, grid.y 4 against cap. The probe decides: if it is not byte-equal the task ends with that finding (no lossy variant). - **T2, D2 `HITS_IN_COMBINE`:** new `sm120_combine_hits.cu/.ptx` (built on `sm120_combine_vec4.cu` and `combine_k10_vec4_hits`), new `original_verify_window_hits_combine.rs` (`ffn_hits_combine`, planner, asset), probe mode `hits` in `sm120_probe.cpp` **(shared file with T1: T1 owns `sm120_probe.cpp`; T2 adds its probe as a new file `tools/decode-sm120/sm120_probe_hits.cpp` and its line in `build.sh` after T1 has merged)**. - **T3, D3 `WAIT_M_ROWS`:** new `sm120_wait_copy_rows.cu/.ptx`, new `original_verify_window_wait_rows.rs` (`ffn_wait_rows`: wait M + copy rows as one launch; grid of the existing copy, `T x 10` blocks), probe or unit test for the copied rows with a flag that rises late. diff --git a/docs/experiments/hit-gap-causes-2026-11-11.md b/docs/experiments/hit-gap-causes-2026-11-11.md index c03f3ff3..48718b6e 100644 --- a/docs/experiments/hit-gap-causes-2026-11-11.md +++ b/docs/experiments/hit-gap-causes-2026-11-11.md @@ -71,7 +71,7 @@ Hit-point sizes are for the shipped replay (-1.5 to -1.6) unless stated. ms/roun | initial fill | global: first N ranked pairs, "PROFILE, ranked by routing frequency, no eviction" (`generate.cpp:6535-6560`; per-layer is the opt-in `--expert-cache-per-layer`, `generate.cpp:577, 6333`) | **per layer**: `fill_ranked` takes each layer's first `quota` pairs and skips the rest of a full layer (`open_tier.rs:98-121`); sizes `quota` x 48 (`original_cache_startup.rs:96-102`, `open_parts.rs:101-102`); `EXPERT_PER_LAYER=yes` in all three 5090 profiles (`deploy/rust-runtime/profiles/rtx5090-32g*.json` line 16/17) | **differs** (cause 3). Log: LEL "12192 slots (23.24 GiB, per layer)", vanilla "12575 slots, 23.87 GiB" | | slot count | auto: free 24.77 GiB - 700 MiB - 218 MiB (draft head) = 23.87 GiB (`VANLP/engine.log:24-25`) | `initial_slots` and `size_per_layer`: (room - reserve 700 - decode reserve 300 ...) in 48-slot steps (`open_parts.rs:24-65`, defaults `tail_skip_rank.rs:76-83`) | differs by 383 (cause 1); account in `vram-footprint-5090.md` section 2 and `vram-footprint3-5090.md` section 1 (decode reserve 300 -> 130 = +48 measured, alias +144 measured, quota step, dense rounding) | | seed from the prompt | none (the "prompt's seed" exists only in `STRATA_RAM_ADAPT2`, `generate.cpp:15116`) | engine default on, **off in the 5090 profiles** (`LELEKA_ORIGINAL_SERVE_SEED=off`, `tail_skip_rank.rs:202-214`) | equal in the compared runs | -| lent slots | last k slots lent, `p.lent` remembers (layer, expert) and `refill` restores the same experts (`generate.cpp:13477-13530, 13450-13475`); `apply_pending(true)` first (`14068`) | `loan_slots`, `refill_lent` through `needs_refill(slot)` = the slot's own expert (`open_tier.rs:188-231`); `begin_prefill` waits for swaps (`original_serve_stack_prefill_phase.rs:51-58`); `needs_refill` returns the slot's recorded owner (`original_expert_cache_verify_and_lend.rs:112-115`) | equal; usage and decay are not touched by the prefill (no seed) | +| lent slots | last k slots lent, `p.lent` remembers (layer, expert) and `refill` restores the same experts (`generate.cpp:13477-13530, 13450-13475`); `apply_pending(true)` first (`14068`) | `loan_slots`, `refill_lent` through `needs_refill(slot)` = the slot's own expert (`open_tier.rs:188-231`); `begin_prefill` waits for swaps (`original_serve_stack_prefill_phase.rs:51-58`); `needs_refill` returns the slot's recorded owner (`original_expert_cache_loans.rs:112-115`) | equal; usage and decay are not touched by the prefill (no seed) | | what is counted into `usage` | every entry of every window row, hit or not, rejected draft rows included (`expert_source.cpp:4824-4826`) | `note_usage`: every id of the group's rows (`source_spans.rs:147-156`) | equal (per entry, not per distinct expert) | | candidates and victims | cand: non-resident with `u >= 2.0`, sorted descending; victims: resident, `partial_sort` ascending; pair while `cand >= vict + 1.5`; sort by gain, cap 96 (`generate.cpp:10443-10458`) | `partition_layer` (`>= min_count`), `trim_victims`, `push_pairs` (`c < v + margin` breaks), truncate (`split_group_pcie.rs:247-314`) | equal; only the order of exact ties is unspecified in vanilla (`std::sort`) and "ascending expert, low layer first" in LEL (`swap_tie_order.rs:22-26`); measured null (cause 6) | | decay | `usage *= 0.7` at the end of every adapt() that ran; no decay when the previous swaps are still in flight (`generate.cpp:10433, 10590`) | `begin_adaptation`: pending swaps return before the decay; then `usage *= decay` (`source_spans.rs:109-131`) | equal | diff --git a/docs/experiments/verify-accept-on-device.md b/docs/experiments/verify-accept-on-device.md index a32e7bed..36135543 100644 --- a/docs/experiments/verify-accept-on-device.md +++ b/docs/experiments/verify-accept-on-device.md @@ -37,7 +37,7 @@ Per round, in call order. File:line refer to this tree (`crates/cuda-driver/src` | hop | what happens | where | host or GPU | figure (source) | | --- | --- | --- | --- | --- | -| 1 | last kernel of the window graph (greedy argmax into the head rows' mapped words) ends | `native_head/original_native_head_rows/original_native_head_rows_greedy_submit.rs:84-104` (`greedy`), captured by `capture_head_greedy` from `original_verify_window_ops/window_ops_kernels_and_pcie_plan.rs:244` | GPU | n/a | +| 1 | last kernel of the window graph (greedy argmax into the head rows' mapped words) ends | `native_head/original_native_head_rows/original_native_head_rows_greedy_submit.rs:84-104` (`greedy`), captured by `capture_head_greedy` from `original_verify_window_ops/window_step_recording.rs:244` | GPU | n/a | | 2 | `compute.synchronize_with_receipt()` returns, then `copy.synchronize()` (already idle), `release_pcie_sources`, `record_window_profile` (off) | `original_verify_schedule/window_phases.rs:277-285` (`drv.sync_compute`, `drv.sync_copy`) | host wake from a blocking sync | not isolated; `drv.sync_compute` + `drv.head` together 0.88 ms incl. the last layer and head on the GPU (`docs/serve-step-costs.md`, job 901) | | 3 | `verifier_head_after_drain`: stream and receipt checks, `resources_after_stream_drain` | `original_gpu_verify_bridge.rs:7-20` | host | below the noise of the spans | | 4 | **post-drain logits scan, launch and stream sync**: `verify_clear_status` + `verify_scan_logits` over all `T x vocab` words are launched on the compute stream, then `stream.synchronize()` | `original_verify/original_verify_gdn_journal/verify_gdn_journal_ladder_logits_scan.rs:116-136` (`head.validate_stream`) | host launch (2 kernels) + a second blocking sync + the scan itself on the GPU | `head.validate_logits` (the whole of hops 4 and 5): 0.05 ms per round, job 901 on `claude/ms-trim` (`docs/serve-step-costs.md`: "head validation scan 0.05") | @@ -112,7 +112,7 @@ Per the brief I stop here. | option | what | files | saves (documented / estimated) | risk | | --- | --- | --- | --- | --- | -| **A. Finite verdict in the verify graph** (vanilla's structure; the "verdict decided on the device") | capture `verify_clear_status` + `verify_scan_logits` (already in the sealed `original_verify.ptx`) after `capture_head_greedy` in `OriginalVerifyWindowOps::head`, the result in a host-mapped word; post-drain code only reads it (no launch, no stream sync, no `cuMemcpyDtoH`, no context sync) | ours: `original_verify_window_ops/window_ops_kernels_and_pcie_plan.rs`, `verify_gdn_journal_ladder_logits_scan.rs`, `original_gpu_verify_bridge.rs`, the mapped-slot list in `original_verify.rs`; one new mapped word; no new PTX | hops 4-5: 0.05 ms per round measured on `ms-trim` (job 901); the GPU part (the scan over `T x 248k` words, 2 extra kernels) moves into the graph's own tail | the scan kernel `atomicOr`s into the status: on a device-arena word that is fine, on host-mapped memory atomics are platform dependent. The safe form is: scan into a device word (as now), then a plain 4-byte store to the mapped word at the end of the graph (the greedy kernel already stores its ids to mapped memory this way). The NaN guard behaviour must stay (`Error::NonFiniteMmqOutput("Original Verifier full logits")` before any token is used); a test with an injected non-finite logit (the vanilla analogue is `STRATA_NAN_INJECT`) is needed on the GPU. No number of the model changes | +| **A. Finite verdict in the verify graph** (vanilla's structure; the "verdict decided on the device") | capture `verify_clear_status` + `verify_scan_logits` (already in the sealed `original_verify.ptx`) after `capture_head_greedy` in `OriginalVerifyWindowOps::head`, the result in a host-mapped word; post-drain code only reads it (no launch, no stream sync, no `cuMemcpyDtoH`, no context sync) | ours: `original_verify_window_ops/window_step_recording.rs`, `verify_gdn_journal_ladder_logits_scan.rs`, `original_gpu_verify_bridge.rs`, the mapped-slot list in `original_verify.rs`; one new mapped word; no new PTX | hops 4-5: 0.05 ms per round measured on `ms-trim` (job 901); the GPU part (the scan over `T x 248k` words, 2 extra kernels) moves into the graph's own tail | the scan kernel `atomicOr`s into the status: on a device-arena word that is fine, on host-mapped memory atomics are platform dependent. The safe form is: scan into a device word (as now), then a plain 4-byte store to the mapped word at the end of the graph (the greedy kernel already stores its ids to mapped memory this way). The NaN guard behaviour must stay (`Error::NonFiniteMmqOutput("Original Verifier full logits")` before any token is used); a test with an injected non-finite logit (the vanilla analogue is `STRATA_NAN_INJECT`) is needed on the GPU. No number of the model changes | | B. Shorten the host chain between the sync and the draft launch | `begin_adaptation` (0.08), `verify_commit` bookkeeping (0.09 at 247k, O(context)), draft staging (0.03-0.04): move off the path or make O(1) | `original_spec_controller*`, `original_serve_native*`, `mtp_original_*`: hex-finish | up to 0.15-0.20 ms of the 0.24 (sum of documented spans) | owned by `hex-finish`; the two earlier trims (`decode-tail`, `draft-round`) already took 0.16 ms and 0.03 ms of it | | C. Commit pre-launched with a device `keep` | section 4, item 3 | ours | 0.01 ms host, 0 on the critical path | breaks `discard_window` unless conditioned on the finite verdict; not recommended | | D. Device-selected draft (conditional graph nodes) | section 4, item 4 | draft chain | host launch of the round graph, potentially most of hop 10 | new design in their files; not a device-part step | @@ -172,7 +172,7 @@ requested set. **Files.** `original_verify/finite_verdict.rs` (new: the commands, the verdict decode, the post-drain dispatch), `original_verify_window_sm120.rs` (switch), `original_verify_window_ops/original_verifier.rs` (marks the head rows), -`original_verify_window_ops/window_ops_kernels_and_pcie_plan.rs` (`head()` records the tail), +`original_verify_window_ops/window_step_recording.rs` (`head()` records the tail), `original_verify/original_verify_gdn_journal/verify_gdn_journal_ladder_logits_scan.rs` (shared operands, the capture), `native_head/...` (the mapped verdict word next to the ids), `original_gpu_verify_bridge.rs` (the post-drain dispatch), `original_verify.rs` (one `mod`). No PTX was added or changed, so no nvcc was needed. diff --git a/docs/experiments/verify-gdn-fused-kernels.md b/docs/experiments/verify-gdn-fused-kernels.md index 5f0c829f..0f398488 100644 --- a/docs/experiments/verify-gdn-fused-kernels.md +++ b/docs/experiments/verify-gdn-fused-kernels.md @@ -132,10 +132,10 @@ options (`original_verify_ffi.rs`). | `crates/cuda-driver/src/sm120_gdn_fused.cu`, `.ptx` | new asset | | `crates/cuda-driver/src/original_verify/original_verify_window_gdn_fused.rs` (+ `/tests.rs`) | switches resolution, asset, launch DTOs, stage plan (`GdnFusedPolicy::stages`), 18 tests | | `crates/cuda-driver/src/original_verify/original_verify_gdn_journal/verify_gdn_fused_step.rs` | `capture_fused_recurrence`, `capture_ab_unrolled` (operand spans as `capture_layer_stage`) | -| `crates/cuda-driver/src/original_verify_window_ops/gdn_stages.rs` | the three `WindowOps` GDN calls (moved out of `window_ops_kernels_and_pcie_plan.rs`) | +| `crates/cuda-driver/src/original_verify_window_ops/gdn_stages.rs` | the three `WindowOps` GDN calls (moved out of `window_step_recording.rs`) | | `original_verify_window_sm120.rs` | `fused_gdn`, `gdn_ab_unroll` in `Sm120Switches`, `DEFAULT_ON_*` (separate block) | | `original_verify.rs`, `original_verify_gdn_journal.rs`, `original_verify_window_ops.rs`, `original_verifier.rs` | one `mod` line each, the `gdn` field of the ops struct and its resolution | -| `verify_gdn_journal_stage_and_commit.rs` | `StageOperands` / `stage_operands` `pub(super)` | +| `verify_gdn_journal_commit.rs` | `StageOperands` / `stage_operands` `pub(super)` | | `ptx-sm86/MANIFEST.json`, `scripts/gpu-bringup/extra-seal-plan.json` | not-built-for-sm_86 note, plan entry | | `tools/gdn-fused/` | probe and build script | From 36ed7713354813e9ad3e1097ea314e33938a050b Mon Sep 17 00:00:00 2001 From: Pavlo Ratushnyi Date: Sat, 14 Nov 2026 21:43:31 +0100 Subject: [PATCH 10/10] tech-debt.md: first c3 table without placeholders --- docs/architecture/tech-debt.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/architecture/tech-debt.md b/docs/architecture/tech-debt.md index 22b71f63..a7bcd47b 100644 --- a/docs/architecture/tech-debt.md +++ b/docs/architecture/tech-debt.md @@ -215,16 +215,16 @@ workers and the small libraries), before -> after, from `scripts/check-architect | Ratchet | Before | After | How | |---|---|---|---| | `allow-unused-imports` | 552 | 0 | `scripts/dev/prune_unused_imports.py`: strips the allow, compiles with one job per feature set (`cuda-driver`, `sm86`, all features), deletes the imports the compiler reports in every compilation unit, puts `#[cfg(test)]` on the ones only the library's unit tests use. Most of the 410 `cuda-driver` allows sat on `pub use` re-exports that needed no allow at all | -| `glob-super-import` | 3 | 2 (cuda-driver, see below) | `root_exports.rs` names its paths (`crate::x`, `leleka_cuda_model::serving_context`) | -| `path-include` | 132 | 0 counted (1 in `cuda-driver`, see below) | `scripts/dev/path_to_layout.py`: walks the module tree (a file loaded by `#[path]` resolves its children next to itself, a default file in a directory of its name), moves the module files to `/.rs` with `git mv`, drops the attribute, rewrites `include_*!` paths and the paths scripts quote (`scripts/dev/update_path_refs.py`). 502 files moved (`cuda-driver` 472, `model-format` 27, `native-cpu-expert` 3); module paths did not change. The gate now treats `#[cfg(test)] #[path = "../tests/x.rs"] mod x;` as test code | -| `env-read` | 30 | 0 outside EXC_ENV exceptions | one reader per crate: new typed `settings.rs` in `cpu-worker`, `tokenizer`, `gptoss-npu`, `gpu-npu-worker`, `igpu`, `npu-service`, `leleka-memory`, `gptoss`, `model-format` (functions named after the variable, returning parsed values); `obs` parses `LELEKA_LOG*` in `level.rs`; `cuda-model` has `env_switch::EnvSwitch` (the name, a typed rule, the answer cached on first read). Exceptions: the readers above, `cpu-kernels` (parses the ISA request), `libc-shim` and `memory-os` (platform adapters), the `npu-worker` and `native-parity-bench` roots | -| `dyn-trait` | 52 outside `cuda-driver` | 0 outside EXC_DYN exceptions | callbacks and probes became generics (`&mut (impl FnMut(..) + ?Sized)`, `&(impl ProcSource + ?Sized)`); what stays is a port boundary (`MemoryPressure`, `ProcSource`, `PageLocking`, `ModelBytes`, `PageSource`, `PrefillAccelerator`, `LayerCache`, the GPU probe closure), a trait method that must be dyn-compatible, `Box` of a library boundary, or the type-erased job of the worker pool | -| `instant-now` | 54 outside the driver and the CPU pool | 0 outside EXC_INSTANT exceptions | the clock adapter (`obs/time/clock.rs`) and measurement timers (stage laps and wall times printed in the workers' timing lines, load reports); each carries a comment that says so. `leleka-memory` reads `SystemClock` | -| `process-global` | 50 outside the driver and the CPU pool | 0 outside EXC_GLOBAL exceptions | immutable tables (regex, half table), operator settings read once, the process-wide logger, the process singletons the S13/S14 injection is for (`Governor::global()`, `Inventory`, the serving context, the verify stamps) | +| `glob-super-import` | 3 | 2 (`cuda-driver`: `head_dispatch` and `copy_ring_layer`, on `claude/debt-hot-low`) | `root_exports.rs` names its paths (`crate::x`, `leleka_cuda_model::serving_context`) | +| `path-include` | 132 | 0 counted (1 in `cuda-driver`: the shared `head_dispatch`, on `claude/debt-hot-low`) | `scripts/dev/path_to_layout.py`: walks the module tree (a file loaded by `#[path]` resolves its children next to itself, a default file in a directory of its name), moves the module files to `/.rs` with `git mv`, drops the attribute, rewrites `include_*!` paths and the paths scripts quote (`scripts/dev/update_path_refs.py`). 502 files moved (`cuda-driver` 472, `model-format` 27, `native-cpu-expert` 3); module paths did not change. The gate now treats `#[cfg(test)] #[path = "../tests/x.rs"] mod x;` as test code | +| `env-read` | 30 | 0 outside the named exceptions | one reader per crate: new typed `settings.rs` in `cpu-worker`, `tokenizer`, `gptoss-npu`, `gpu-npu-worker`, `igpu`, `npu-service`, `leleka-memory`, `gptoss`, `model-format` (functions named after the variable, returning parsed values); `obs` parses `LELEKA_LOG*` in `level.rs`; `cuda-model` has `env_switch::EnvSwitch` (the name, a typed rule, the answer cached on first read). Exceptions: the readers above, `cpu-kernels` (parses the ISA request), `libc-shim` and `memory-os` (platform adapters), the `npu-worker` and `native-parity-bench` roots | +| `dyn-trait` | 52 outside `cuda-driver` | 0 outside the named exceptions | callbacks and probes became generics (`&mut (impl FnMut(..) + ?Sized)`, `&(impl ProcSource + ?Sized)`); what stays is a port boundary (`MemoryPressure`, `ProcSource`, `PageLocking`, `ModelBytes`, `PageSource`, `PrefillAccelerator`, `LayerCache`, the GPU probe closure), a trait method that must be dyn-compatible, `Box` of a library boundary, or the type-erased job of the worker pool | +| `instant-now` | 54 outside the driver and the CPU pool | 0 outside the named exceptions | the clock adapter (`obs/time/clock.rs`) and measurement timers (stage laps and wall times printed in the workers' timing lines, load reports); each carries a comment that says so. `leleka-memory` reads `SystemClock` | +| `process-global` | 50 outside the driver and the CPU pool | 0 outside the named exceptions | immutable tables (regex, half table), operator settings read once, the process-wide logger, the process singletons the S13/S14 injection is for (`Governor::global()`, `Inventory`, the serving context, the verify stamps) | The test run (`cargo test`, slim profile) of `cuda-model`, `obs`, `leleka-memory`, `tokenizer`, `model-format`, `gptoss`, `cpu-worker`, `igpu`, `memory-os`, `experimental-ref` and `npu-service`: all green except the three known `qwen_artifact_binding` tests of `model-format` -(`cargo check --workspace --all-targets` is clean; `cuda-driver` and `native-cpu-expert` follow the hot-path branch, see below). +(`cargo check --workspace --all-targets` is clean). The `dyn-trait`, `instant-now` and `process-global` rows exclude `cuda-driver` and `native-cpu-expert`: their changes and exceptions are on `claude/debt-hot-low`, which waits for the identity gate; the final table replaces this one when it is merged. ### (e) Stage 10 pass: control-plane, desktop-core, deploy and the small crates (owner order 2026-11-14, branch `claude/debt-control`)