engine crates: 50 modules renamed for what they hold (the *_methods, *_and_*, *_sdet, *_types and qwen4exp_* names), exceptions and script paths follow

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Pavlo Ratushnyi
2026-11-14 21:59:19 +01:00
co-authored by Claude Sonnet 5.5
parent 5b84cd2cf8
commit 4e0bb1dd98
247 changed files with 254 additions and 254 deletions
+10 -10
View File
@@ -165,7 +165,7 @@
{"crate": "leleka-engine-qwen35-cuda", "file": "src/qwen_forward/original_serve_pool/direct_group_steps.rs", "ratchet": "instant-now", "reason": "measurement timer in a hot loop (one reading per CPU expert group of a decode round); a Clock parameter would add a generic to every owner on the path, which is the S14 follow-up; the reading is a Duration that only feeds a log line or a counter"},
{"crate": "leleka-engine-qwen35-cuda", "file": "src/qwen_forward/original_serve_pool/direct_tier.rs", "ratchet": "instant-now", "reason": "measurement timer in a hot loop (one reading per eager admission, once at start-up); a Clock parameter would add a generic to every owner on the path, which is the S14 follow-up; the reading is a Duration that only feeds a log line or a counter"},
{"crate": "leleka-engine-qwen35-cuda", "file": "src/qwen_forward/original_serve_pool.rs", "ratchet": "instant-now", "reason": "measurement timer in a hot loop (one reading per pool phase lap of a decode round); a Clock parameter would add a generic to every owner on the path, which is the S14 follow-up; the reading is a Duration that only feeds a log line or a counter"},
{"crate": "leleka-engine-qwen35-cuda", "file": "src/qwen_forward/original_serve_residency/span_cache_and_pcie_lag.rs", "ratchet": "instant-now", "reason": "measurement timer in a hot loop (one reading per PCIe lag probe and adaptation round); a Clock parameter would add a generic to every owner on the path, which is the S14 follow-up; the reading is a Duration that only feeds a log line or a counter"},
{"crate": "leleka-engine-qwen35-cuda", "file": "src/qwen_forward/original_serve_residency/pcie_share_controllers.rs", "ratchet": "instant-now", "reason": "measurement timer in a hot loop (one reading per PCIe lag probe and adaptation round); a Clock parameter would add a generic to every owner on the path, which is the S14 follow-up; the reading is a Duration that only feeds a log line or a counter"},
{"crate": "leleka-engine-qwen35-cuda", "file": "src/qwen_forward/prefill_profile.rs", "ratchet": "instant-now", "reason": "measurement timer in a hot loop (one reading per prefill stage span, only when the profile switch is on); a Clock parameter would add a generic to every owner on the path, which is the S14 follow-up; the reading is a Duration that only feeds a log line or a counter"},
{"crate": "leleka-engine-qwen35-cuda", "file": "src/qwen_forward/prompt_device_rows/prompt_device_read/produce_original_gdn.rs", "ratchet": "instant-now", "reason": "measurement timer in a hot loop (one reading per GDN layer producer lap, only when the command profile is on); a Clock parameter would add a generic to every owner on the path, which is the S14 follow-up; the reading is a Duration that only feeds a log line or a counter"},
{"crate": "leleka-engine-core", "file": "src/family.rs", "ratchet": "dyn-trait", "reason": "EngineFamily::spawn returns Box<dyn Backend>: the family seam is the process boundary of the engine, called once at start-up"},
@@ -183,9 +183,9 @@
{"crate": "leleka-engine-qwen35-cuda", "file": "src/conversation/memory.rs", "ratchet": "process-global", "reason": "reaches the process-wide memory governor through Governor::global(); the governor is one per process by design (host RAM is process-wide) and the handle is threaded through StackConfig and the request environment in the S13/S14 injection"},
{"crate": "leleka-engine-qwen35-cuda", "file": "src/memory_governor.rs", "ratchet": "process-global", "reason": "reaches the process-wide memory governor through Governor::global(); the governor is one per process by design (host RAM is process-wide) and the handle is threaded through StackConfig and the request environment in the S13/S14 injection"},
{"crate": "leleka-engine-qwen35-cuda", "file": "src/memory_governor/page_cache.rs", "ratchet": "process-global", "reason": "reaches the process-wide memory governor through Governor::global(); the governor is one per process by design (host RAM is process-wide) and the handle is threaded through StackConfig and the request environment in the S13/S14 injection"},
{"crate": "leleka-engine-qwen35-cuda", "file": "src/model_binding/qwen4exp_input.rs", "ratchet": "process-global", "reason": "instance-local lazy cell (std::cell::OnceCell), not a process global: the gate pattern matches the type name"},
{"crate": "leleka-engine-qwen35-cuda", "file": "src/model_binding/qwen4exp_input/binding_identity_and_input_binding_error.rs", "ratchet": "process-global", "reason": "reads the serving context (cells) that the engine configures once at start-up (leleka-cuda-model::serving_context, an immutable bound afterwards); threading it through every position check is the S13/S14 injection"},
{"crate": "leleka-engine-qwen35-cuda", "file": "src/model_binding/qwen4exp_input/model_binding.rs", "ratchet": "process-global", "reason": "instance-local lazy cell (std::cell::OnceCell), not a process global: the gate pattern matches the type name"},
{"crate": "leleka-engine-qwen35-cuda", "file": "src/model_binding/weight_binding.rs", "ratchet": "process-global", "reason": "instance-local lazy cell (std::cell::OnceCell), not a process global: the gate pattern matches the type name"},
{"crate": "leleka-engine-qwen35-cuda", "file": "src/model_binding/weight_binding/binding_identity.rs", "ratchet": "process-global", "reason": "reads the serving context (cells) that the engine configures once at start-up (leleka-cuda-model::serving_context, an immutable bound afterwards); threading it through every position check is the S13/S14 injection"},
{"crate": "leleka-engine-qwen35-cuda", "file": "src/model_binding/weight_binding/model_binding.rs", "ratchet": "process-global", "reason": "instance-local lazy cell (std::cell::OnceCell), not a process global: the gate pattern matches the type name"},
{"crate": "leleka-engine-qwen35-cuda", "file": "src/qwen_forward/contract.rs", "ratchet": "process-global", "reason": "reads the serving context (cells) that the engine configures once at start-up (leleka-cuda-model::serving_context, an immutable bound afterwards); threading it through every position check is the S13/S14 injection"},
{"crate": "leleka-engine-qwen35-cuda", "file": "src/qwen_forward/mtp/mtp_frame.rs", "ratchet": "process-global", "reason": "reads the serving context (cells) that the engine configures once at start-up (leleka-cuda-model::serving_context, an immutable bound afterwards); threading it through every position check is the S13/S14 injection"},
{"crate": "leleka-engine-qwen35-cuda", "file": "src/qwen_forward/mtp/state/chunk/checked_chunk_end.rs", "ratchet": "process-global", "reason": "reads the serving context (cells) that the engine configures once at start-up (leleka-cuda-model::serving_context, an immutable bound afterwards); threading it through every position check is the S13/S14 injection"},
@@ -194,17 +194,17 @@
{"crate": "leleka-engine-qwen35-cuda", "file": "src/qwen_forward/mtp/state/warming.rs", "ratchet": "process-global", "reason": "reads the serving context (cells) that the engine configures once at start-up (leleka-cuda-model::serving_context, an immutable bound afterwards); threading it through every position check is the S13/S14 injection"},
{"crate": "leleka-engine-qwen35-cuda", "file": "src/qwen_forward/mtp_attention/dense_geometry.rs", "ratchet": "process-global", "reason": "reads the serving context (cells) that the engine configures once at start-up (leleka-cuda-model::serving_context, an immutable bound afterwards); threading it through every position check is the S13/S14 injection"},
{"crate": "leleka-engine-qwen35-cuda", "file": "src/qwen_forward/mtp_decode/first_seed_reuse_enabled.rs", "ratchet": "process-global", "reason": "reads the serving context (cells) that the engine configures once at start-up (leleka-cuda-model::serving_context, an immutable bound afterwards); threading it through every position check is the S13/S14 injection"},
{"crate": "leleka-engine-qwen35-cuda", "file": "src/qwen_forward/mtp_decode/mtp_decoder/draft_warm_and_window.rs", "ratchet": "process-global", "reason": "reads the serving context (cells) that the engine configures once at start-up (leleka-cuda-model::serving_context, an immutable bound afterwards); threading it through every position check is the S13/S14 injection"},
{"crate": "leleka-engine-qwen35-cuda", "file": "src/qwen_forward/mtp_decode/mtp_decoder/decoder_entry.rs", "ratchet": "process-global", "reason": "reads the serving context (cells) that the engine configures once at start-up (leleka-cuda-model::serving_context, an immutable bound afterwards); threading it through every position check is the S13/S14 injection"},
{"crate": "leleka-engine-qwen35-cuda", "file": "src/qwen_forward/mtp_decode/mtp_window_spec.rs", "ratchet": "process-global", "reason": "reads the serving context (cells) that the engine configures once at start-up (leleka-cuda-model::serving_context, an immutable bound afterwards); threading it through every position check is the S13/S14 injection"},
{"crate": "leleka-engine-qwen35-cuda", "file": "src/qwen_forward/original_serve_residency/split_group_pcie.rs", "ratchet": "process-global", "reason": "the adaptive-tier tuning constants, derived once from the settings capture (immutable after the first read)"},
{"crate": "leleka-engine-qwen35-cuda", "file": "src/qwen_forward/original_serve_stack.rs", "ratchet": "process-global", "reason": "the epoch of the bring-up trace timestamps (DBG_T0), set once; diagnostics only"},
{"crate": "leleka-engine-qwen35-cuda", "file": "src/qwen_forward/original_serve_stack/original_serve_stack_methods/open_cache_steps.rs", "ratchet": "process-global", "reason": "reaches the process-wide memory governor through Governor::global(); the governor is one per process by design (host RAM is process-wide) and the handle is threaded through StackConfig and the request environment in the S13/S14 injection"},
{"crate": "leleka-engine-qwen35-cuda", "file": "src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_memory_classes.rs", "ratchet": "process-global", "reason": "reaches the process-wide memory governor through Governor::global(); the governor is one per process by design (host RAM is process-wide) and the handle is threaded through StackConfig and the request environment in the S13/S14 injection"},
{"crate": "leleka-engine-qwen35-cuda", "file": "src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_open/assemble.rs", "ratchet": "process-global", "reason": "reads the serving context (cells) that the engine configures once at start-up (leleka-cuda-model::serving_context, an immutable bound afterwards); threading it through every position check is the S13/S14 injection"},
{"crate": "leleka-engine-qwen35-cuda", "file": "src/qwen_forward/original_serve_stack/original_serve_stack_methods/original_serve_stack_prefill_phase.rs", "ratchet": "process-global", "reason": "reads the serving context (cells) that the engine configures once at start-up (leleka-cuda-model::serving_context, an immutable bound afterwards); threading it through every position check is the S13/S14 injection"},
{"crate": "leleka-engine-qwen35-cuda", "file": "src/qwen_forward/original_serve_stack/stack_phases/open_cache_steps.rs", "ratchet": "process-global", "reason": "reaches the process-wide memory governor through Governor::global(); the governor is one per process by design (host RAM is process-wide) and the handle is threaded through StackConfig and the request environment in the S13/S14 injection"},
{"crate": "leleka-engine-qwen35-cuda", "file": "src/qwen_forward/original_serve_stack/stack_phases/original_serve_stack_memory_classes.rs", "ratchet": "process-global", "reason": "reaches the process-wide memory governor through Governor::global(); the governor is one per process by design (host RAM is process-wide) and the handle is threaded through StackConfig and the request environment in the S13/S14 injection"},
{"crate": "leleka-engine-qwen35-cuda", "file": "src/qwen_forward/original_serve_stack/stack_phases/original_serve_stack_open/assemble.rs", "ratchet": "process-global", "reason": "reads the serving context (cells) that the engine configures once at start-up (leleka-cuda-model::serving_context, an immutable bound afterwards); threading it through every position check is the S13/S14 injection"},
{"crate": "leleka-engine-qwen35-cuda", "file": "src/qwen_forward/original_serve_stack/stack_phases/original_serve_stack_prefill_phase.rs", "ratchet": "process-global", "reason": "reads the serving context (cells) that the engine configures once at start-up (leleka-cuda-model::serving_context, an immutable bound afterwards); threading it through every position check is the S13/S14 injection"},
{"crate": "leleka-engine-qwen35-cuda", "file": "src/qwen_forward/original_serve_stack/prefix/prefix_config.rs", "ratchet": "process-global", "reason": "reaches the process-wide memory governor through Governor::global(); the governor is one per process by design (host RAM is process-wide) and the handle is threaded through StackConfig and the request environment in the S13/S14 injection"},
{"crate": "leleka-engine-qwen35-cuda", "file": "src/qwen_forward/original_serve_stack/prefix/prefix_serve/prefix_serve_after_phase_parking.rs", "ratchet": "process-global", "reason": "reaches the process-wide memory governor through Governor::global(); the governor is one per process by design (host RAM is process-wide) and the handle is threaded through StackConfig and the request environment in the S13/S14 injection"},
{"crate": "leleka-engine-qwen35-cuda", "file": "src/qwen_forward/original_serve_stack/stack_config_and_ttft_marks.rs", "ratchet": "process-global", "reason": "reads the serving context (cells) that the engine configures once at start-up (leleka-cuda-model::serving_context, an immutable bound afterwards); threading it through every position check is the S13/S14 injection"},
{"crate": "leleka-engine-qwen35-cuda", "file": "src/qwen_forward/original_serve_stack/stack_config.rs", "ratchet": "process-global", "reason": "reads the serving context (cells) that the engine configures once at start-up (leleka-cuda-model::serving_context, an immutable bound afterwards); threading it through every position check is the S13/S14 injection"},
{"crate": "leleka-engine-qwen35-cuda", "file": "src/qwen_forward/original_spec_controller/trace_enabled.rs", "ratchet": "process-global", "reason": "reads the serving context (cells) that the engine configures once at start-up (leleka-cuda-model::serving_context, an immutable bound afterwards); threading it through every position check is the S13/S14 injection"},
{"crate": "leleka-engine-qwen35-cuda", "file": "src/qwen_forward/original_spec_draft.rs", "ratchet": "process-global", "reason": "reads the serving context (cells) that the engine configures once at start-up (leleka-cuda-model::serving_context, an immutable bound afterwards); threading it through every position check is the S13/S14 injection"},
{"crate": "leleka-engine-qwen35-cuda", "file": "src/qwen_forward/original_spec_draft/prefill_records.rs", "ratchet": "process-global", "reason": "reads the serving context (cells) that the engine configures once at start-up (leleka-cuda-model::serving_context, an immutable bound afterwards); threading it through every position check is the S13/S14 injection"},
@@ -53,8 +53,8 @@ struct Run {
/// Deterministic xorshift for the property test.
struct Rng(u64);
#[path = "manager_tests/byte_budget_and_slot.rs"]
mod byte_budget_and_slot;
#[path = "manager_tests/budget_and_failure_rules.rs"]
mod budget_and_failure_rules;
#[path = "manager_tests/continuing_chat_reuses.rs"]
mod continuing_chat_reuses;
#[path = "manager_tests/random_traffic_resumes_into_exact_prefix_state.rs"]
@@ -8,6 +8,6 @@ use super::{
mod admit;
mod prefix_store_consider_commit;
mod prefix_store_evict_and_budget;
mod prefix_store_stats_and_clock;
mod eviction;
mod lookup_clock;
mod scoring;
+5 -5
View File
@@ -5,17 +5,17 @@ mod original_serve;
use crate::experimental::{self as experimental_modes, ExperimentalConfig};
use crate::model_binding::kar_expert_source::KarExpertSource;
pub use crate::model_binding::kar_expert_source::{KarArchiveRef, KarExpertLevels, KarExpertSourceConfig};
pub use crate::model_binding::qwen4exp_kar_ple::InheritedKarArchive;
pub use crate::model_binding::kar_ple_source::InheritedKarArchive;
pub use original_serve::{
ExpertSource, OriginalServeChoice, OriginalServeMode, OriginalServeOptions, PrefixCacheOptions, PrefixTail,
};
mod measurement;
use crate::model_binding::qwen4exp_input::{InputBindingError, ModelBinding};
use crate::model_binding::weight_binding::{InputBindingError, ModelBinding};
// What only the preview serve path (generation loop, weight caches, resident conversations) works with.
#[cfg(feature = "preview-path")]
use crate::{
conversation::resident::{ResidentConversations, ResidentPolicy},
model_binding::qwen4exp_input::InputConstants,
model_binding::weight_binding::InputConstants,
qwen_forward::{
contract::{Dimension, Position, TokenId},
dense_weight_cache::DenseWeightCache,
@@ -153,14 +153,14 @@ mod lifecycle_tests;
mod tests;
#[cfg(test)]
mod backend_measurement_sdet;
mod measurement_bookkeeping_proof;
#[cfg(feature = "preview-path")]
#[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))]
mod combined_prefix_numeric;
#[cfg(feature = "preview-path")]
#[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))]
mod combined_prefix_numeric_sdet;
mod prefix_equivalence_gate;
#[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))]
mod original_serve_arms;
#[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))]
@@ -8,8 +8,8 @@ use super::{
Dimension, Instant, MtpDecoder, MtpWindowError, MtpWindowSpec, TargetStepProduct, TokenId, native_position,
};
use crate::qwen_forward::mtp::KnownNext;
mod prefill_tiles_and_windows;
use prefill_tiles_and_windows::{begin_decoder, commit_window, emit_token_text, prefill_tiles, verified_window};
mod mtp_loop_steps;
use mtp_loop_steps::{begin_decoder, commit_window, emit_token_text, prefill_tiles, verified_window};
pub(super) fn generate_mtp<C: Clock>(
run: Generation<'_, '_, '_, C>,
@@ -93,17 +93,17 @@ mod capture_tests {
}
}
mod stack_config_and_reports;
use stack_config_and_reports::CapturedIds;
use stack_config_and_reports::PhaseDurations;
use stack_config_and_reports::admission_error;
use stack_config_and_reports::capture_request;
use stack_config_and_reports::gpu_probe;
use stack_config_and_reports::log_request_end;
use stack_config_and_reports::meta_facts;
use stack_config_and_reports::open_error;
use stack_config_and_reports::publish_prefix_summary;
use stack_config_and_reports::stack_config;
mod stack_reports;
use stack_reports::CapturedIds;
use stack_reports::PhaseDurations;
use stack_reports::admission_error;
use stack_reports::capture_request;
use stack_reports::gpu_probe;
use stack_reports::log_request_end;
use stack_reports::meta_facts;
use stack_reports::open_error;
use stack_reports::publish_prefix_summary;
use stack_reports::stack_config;
mod request_generation;
pub(in super::super) use request_generation::generate;
pub(in super::super) use request_generation::{ClientLink, RequestToServe, TokenVocabulary};
@@ -26,7 +26,7 @@ fn verify_shard1(config: &NativeBackendConfig, clock: &impl Clock) -> Result<Ver
fn verify_kar_archive(archive: &InheritedKarArchive, clock: &impl Clock) -> InputResultKar {
let started = clock.now();
let result = crate::model_binding::qwen4exp_kar_ple::load_pinned_inherited_archive(archive);
let result = crate::model_binding::kar_ple_source::load_pinned_inherited_archive(archive);
crate::load_clock::span("kar_inspect_verify", started);
result
}
@@ -140,9 +140,9 @@ fn fixed_items(g: &Governor, args: &StartArgs, settings: &Settings) -> Vec<Fixed
fn kar_form(args: &StartArgs) -> KarForm {
match args.kar_file_backed {
Some(true) => KarForm::File { bytes: crate::model_binding::qwen4exp_kar_ple::PINNED_ARCHIVE_BYTES },
Some(true) => KarForm::File { bytes: crate::model_binding::kar_ple_source::PINNED_ARCHIVE_BYTES },
_ => KarForm::MemfdInherited {
bytes: args.kar_sparse_bytes.unwrap_or(crate::model_binding::qwen4exp_kar_ple::PINNED_ARCHIVE_BYTES),
bytes: args.kar_sparse_bytes.unwrap_or(crate::model_binding::kar_ple_source::PINNED_ARCHIVE_BYTES),
},
}
}
@@ -190,7 +190,7 @@ pub(crate) fn startup(args: &StartArgs, settings: &Settings) -> Result<&'static
#[cfg(all(target_os = "linux", target_arch = "x86_64"))]
pub(crate) fn guard_archive(
g: &Governor,
archive: &crate::model_binding::qwen4exp_kar_ple::InheritedKarArchive,
archive: &crate::model_binding::kar_ple_source::InheritedKarArchive,
) -> Result<(), BackendError> {
use std::os::fd::AsFd;
if archive.file_backed() {
@@ -201,7 +201,7 @@ pub(crate) fn guard_archive(
let extents = archive.sparse_extents();
g.guard_archive_extents(
archive.archive_handle().as_fd(),
crate::model_binding::qwen4exp_kar_ple::PINNED_ARCHIVE_BYTES,
crate::model_binding::kar_ple_source::PINNED_ARCHIVE_BYTES,
extents.as_deref(),
)
.map(|_| ())
@@ -225,7 +225,7 @@ fn archive_inventory(extents: Option<&[(u64, u64)]>) -> (u64, &'static str) {
(PLE rows, header, directory); the rest is a hole",
),
None => (
crate::model_binding::qwen4exp_kar_ple::PINNED_ARCHIVE_BYTES,
crate::model_binding::kar_ple_source::PINNED_ARCHIVE_BYTES,
"the pinned level-2 archive, sealed memfd (55,295,529,472 B), shared with the holder",
),
}
@@ -389,7 +389,7 @@ pub(crate) fn complement_room(available: u64) -> u64 {
#[cfg(target_os = "windows")]
pub(crate) fn guard_archive(
_g: &Governor,
_archive: &crate::model_binding::qwen4exp_kar_ple::InheritedKarArchive,
_archive: &crate::model_binding::kar_ple_source::InheritedKarArchive,
) -> Result<(), BackendError> {
Ok(())
}
@@ -1,6 +1,6 @@
//! Explicit, immutable experimental PLE source. This module never owns CUDA or sessions.
#![allow(dead_code)]
use super::qwen4exp_input::{BindingIdentity, InputBindingError, InputResult, PLE_ROWS};
use super::weight_binding::{BindingIdentity, InputBindingError, InputResult, PLE_ROWS};
use leleka_model_format::kar::{
KarError, KarPlePartProvenance, KarPleProfile, KarPleProfileSpec, VerifiedKarPleArtifact,
};
@@ -3,8 +3,8 @@
pub(crate) mod kar_expert_source;
pub(crate) mod kar_levels;
pub(crate) mod qwen4exp_input;
pub(crate) mod qwen4exp_kar_ple;
pub(crate) mod weight_binding;
pub(crate) mod kar_ple_source;
#[cfg(test)]
#[path = "../../tests/stra161_reference.rs"]
@@ -103,7 +103,7 @@ pub(crate) struct ModelBinding {
layers: Box<[BoundLayer]>,
expert_count: u32,
expert_used_count: u32,
kar_ple: Option<super::qwen4exp_kar_ple::KarPleBinding>,
kar_ple: Option<super::kar_ple_source::KarPleBinding>,
kar_experts: Option<super::kar_expert_source::KarExpertSource>,
mtp: Option<MtpWeights>,
/// Lazily opened batched PLE reader; `None` inside means synchronous reads.
@@ -145,7 +145,7 @@ mod native_output;
#[cfg(all(any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))]
pub(crate) use native_output::NativeOutputRole;
mod binding_identity_and_input_binding_error;
mod binding_identity;
mod model_binding;
mod validate_ple_descriptor;
use validate_ple_descriptor::bind_layers;
@@ -45,7 +45,7 @@ impl ModelBinding {
kar: leleka_model_format::kar::VerifiedKarPleArtifact,
) -> InputResult<Self> {
let mut binding = Self::from_artifact(artifact)?;
binding.kar_ple = Some(super::super::qwen4exp_kar_ple::KarPleBinding::new(&binding.identity, kar)?);
binding.kar_ple = Some(super::super::kar_ple_source::KarPleBinding::new(&binding.identity, kar)?);
Ok(binding)
}
/// Select the KAR routed-expert weight source before publishing the
@@ -68,7 +68,7 @@ impl ModelBinding {
pub(crate) fn kar_expert_source(&self) -> Option<&super::super::kar_expert_source::KarExpertSource> {
self.kar_experts.as_ref()
}
pub(crate) fn kar_ple_binding(&self) -> Option<&super::super::qwen4exp_kar_ple::KarPleBinding> {
pub(crate) fn kar_ple_binding(&self) -> Option<&super::super::kar_ple_source::KarPleBinding> {
self.kar_ple.as_ref()
}
/// Operator paths are consumed inside model binding, never from a request.
@@ -78,7 +78,7 @@ impl ModelBinding {
source: &std::path::Path,
owner_root: &std::path::Path,
) -> InputResult<Self> {
let kar = super::super::qwen4exp_kar_ple::load_pinned_archive(source, owner_root)?;
let kar = super::super::kar_ple_source::load_pinned_archive(source, owner_root)?;
Self::from_artifact_with_kar_ple(artifact, kar)
}
pub(crate) fn expert_count(&self) -> u32 {
@@ -87,9 +87,9 @@ impl ModelBinding {
pub(crate) fn from_artifact_with_inherited_kar_ple(
artifact: Qwen4ExpArtifact,
source: &super::super::qwen4exp_kar_ple::InheritedKarArchive,
source: &super::super::kar_ple_source::InheritedKarArchive,
) -> InputResult<Self> {
let kar = super::super::qwen4exp_kar_ple::load_pinned_inherited_archive(source)?;
let kar = super::super::kar_ple_source::load_pinned_inherited_archive(source)?;
Self::from_artifact_with_kar_ple(artifact, kar)
}
@@ -140,7 +140,7 @@ impl ModelBinding {
/// Both providers are fully admitted before publishing this fresh binding.
pub(crate) fn from_artifact_with_inherited_kar_mtp(
artifact: Qwen4ExpArtifact,
source: &super::super::qwen4exp_kar_ple::InheritedKarArchive,
source: &super::super::kar_ple_source::InheritedKarArchive,
mtp_source: &std::path::Path,
mtp_root: &std::path::Path,
) -> InputResult<Self> {
@@ -37,24 +37,24 @@ use read_expert_rows::read_expert_rows;
use read_expert_rows::row_range;
use read_expert_rows::validate_numeric;
mod mtp_kind_types;
use mtp_kind_types::Dense;
use mtp_kind_types::Descriptor;
pub(crate) use mtp_kind_types::MtpExpertMatrix;
pub(crate) use mtp_kind_types::MtpExpertRef;
pub(crate) use mtp_kind_types::MtpKind;
pub(crate) use mtp_kind_types::MtpRole;
mod descriptors_types;
use descriptors_types::DESCRIPTORS;
mod dense_bytes_types;
use dense_bytes_types::DENSE_BYTES;
use dense_bytes_types::EXPERT_BLOB;
use dense_bytes_types::EXPERT_BYTES;
use dense_bytes_types::FILE_PINS;
use dense_bytes_types::INDEX_BYTES;
use dense_bytes_types::INDEX_LIMIT;
use dense_bytes_types::MAX_READ;
use dense_bytes_types::MAX_ROWS;
use dense_bytes_types::MtpIndex;
pub(crate) use dense_bytes_types::MtpRows;
pub(crate) use dense_bytes_types::MtpWeights;
mod pack_vocabulary;
use pack_vocabulary::Dense;
use pack_vocabulary::Descriptor;
pub(crate) use pack_vocabulary::MtpExpertMatrix;
pub(crate) use pack_vocabulary::MtpExpertRef;
pub(crate) use pack_vocabulary::MtpKind;
pub(crate) use pack_vocabulary::MtpRole;
mod tensor_table;
use tensor_table::DESCRIPTORS;
mod pack_pins;
use pack_pins::DENSE_BYTES;
use pack_pins::EXPERT_BLOB;
use pack_pins::EXPERT_BYTES;
use pack_pins::FILE_PINS;
use pack_pins::INDEX_BYTES;
use pack_pins::INDEX_LIMIT;
use pack_pins::MAX_READ;
use pack_pins::MAX_ROWS;
use pack_pins::MtpIndex;
pub(crate) use pack_pins::MtpRows;
pub(crate) use pack_pins::MtpWeights;
@@ -1,5 +1,5 @@
//! The expert a projection, a cache fill or a loan refers to.
use crate::model_binding::qwen4exp_input::{ModelBinding, MoeExpertSelection, MoeExpertWeights};
use crate::model_binding::weight_binding::{ModelBinding, MoeExpertSelection, MoeExpertWeights};
/// One expert (a routed slot or the shared expert) of validated expert weights, under the binding that admitted
/// them. The three always travel together: weights are only meaningful for their binding, and the selection says
@@ -2,7 +2,7 @@
// These declarations intentionally have no production caller until leaf handoff.
#![allow(dead_code)]
use crate::model_binding::qwen4exp_input::BindingError;
use crate::model_binding::weight_binding::BindingError;
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub(crate) enum Stage {
@@ -238,7 +238,7 @@ impl TokenLayer {
#[cfg(test)]
mod tests {
use super::*;
use crate::model_binding::qwen4exp_input::ModelBinding;
use crate::model_binding::weight_binding::ModelBinding;
#[test]
fn positive_dimensions_have_checked_driver_representations() {
@@ -1,6 +1,6 @@
//! Safe actor-side source association; native ownership lives in the leaf crate.
//! Returned bytes are NOT source/current-row/Context/publication certificates.
use crate::model_binding::qwen4exp_input::{
use crate::model_binding::weight_binding::{
BindingIdentity, InputBindingError, ModelBinding, MoeMatrixRole, MoeRoutedSourceScope, MoeWeightDescriptor,
};
use leleka_native_cpu_expert::{
@@ -8,7 +8,7 @@ use super::qsa_index::{QsaIndexKeyCache, QsaPrior, QsaSelectedCache};
use super::qsa_index::{QsaInputLease, QsaInputScratch};
use super::qsa_index::{binding_error, driver_error};
use super::router_scratch::{RouterLease, RouterScratch};
use crate::model_binding::qwen4exp_input::{
use crate::model_binding::weight_binding::{
BindingIdentity, BoundLayerKind, GdnMatrixKind, GdnMatrixRole, GdnWeights, GrRole, GrWeights, ModelBinding,
PleMatrixRole, PleWeights, QsaMatrixKind, QsaMatrixRole, QsaWeights,
};
@@ -96,7 +96,7 @@ pub(crate) struct DenseWeightCache<'ctx> {
mod dense_slab_policy;
mod workspaces;
use workspaces::Workspaces;
mod dense_weight_cache_methods;
mod dense_cache_ops;
use dense_slab_policy::dense_slab_policy;
#[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))]
use dense_slab_policy::startup_step;
@@ -12,10 +12,10 @@ use super::{
SlabAllocator, SlabPolicy, Workspaces, binding_error, dense_slab_policy, driver_error, startup_step,
};
mod dense_cache_buffers_and_close;
mod dense_cache_teardown;
mod dense_cache_eager_layer_load;
mod dense_cache_gdn_qsa_workspaces;
mod dense_cache_matrix_registration;
mod dense_cache_ple_and_verify_weights;
mod dense_cache_prompt_and_gdn_scratch;
mod dense_cache_weight_views;
mod dense_cache_prompt_capacity;
mod dense_weight_cache_constructors;
@@ -16,7 +16,7 @@ use super::{
qsa_index::{QsaIndexStage, QsaPrepareRequest},
session::{QwenSession, QwenStepTxn, TargetStepOrigin},
};
use crate::model_binding::qwen4exp_input::{BindingIdentity, BoundLayerKind, ModelBinding};
use crate::model_binding::weight_binding::{BindingIdentity, BoundLayerKind, ModelBinding};
type StepCoreResult = (Option<TokenId>, Option<Box<[f32]>>);
@@ -51,7 +51,7 @@ pub(crate) struct PrefillStepProduct {
/// All helpers disappear from serving builds. No tensor words enter logs or
/// assertion formatting; only equality and bounded counts are reported.
#[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))]
mod reset_replay_sdet;
mod reset_replay_proof;
/// Fixed operator labels only; diagnostics never contain request/model data.
#[derive(Debug)]
@@ -16,6 +16,6 @@ use super::{
SpanExport, Stage, StagedInput, TokenId, driver_error, prof, staged_input_enabled,
};
mod construction_and_parking;
mod prompt_executor_forward_and_close;
mod executor_lifecycle;
mod chunk_run;
mod prompt_executor_retire_owners;
@@ -5,7 +5,7 @@ use super::{
OriginalPromptExecutor, OriginalPromptTxn, PStage, PromptDeviceNormedRows, PromptDeviceRows, PromptWeights,
QsaLayerDevices, Result, prof,
};
use crate::model_binding::qwen4exp_input::BoundLayer;
use crate::model_binding::weight_binding::BoundLayer;
use crate::qwen_forward::gr::GrRole;
use crate::qwen_forward::prompt_device_rows::PromptDeviceRead;
@@ -2,7 +2,7 @@
//! 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};
use crate::model_binding::weight_binding::{GdnMatrixKind, GdnMatrixRole, QsaMatrixKind, QsaMatrixRole};
use crate::qwen_forward::gr::ResidualReady;
use crate::qwen_forward::prompt_device_rows::PromptWeights;
use crate::qwen_forward::q6_attention_columns::{self, ColumnKey, ColumnTarget, ProjectionRow, Role};
@@ -86,7 +86,7 @@ fn assert_topology(binding: &ModelBinding) -> usize {
fn fixed_dimensions(binding: &ModelBinding) -> Fixed {
// The verified closed artifact/binder fixes the main vocabulary; PLE
// hash-table vocabularies are separate and must not be used here.
let vocabulary = Dimension::new(u64::from(crate::model_binding::qwen4exp_input::VOCABULARY))
let vocabulary = Dimension::new(u64::from(crate::model_binding::weight_binding::VOCABULARY))
.expect("verified vocabulary refused");
assert_eq!(vocabulary.get(), VOCABULARY as u32);
let context_length =
@@ -33,7 +33,7 @@ fn topology_validation_requires_the_exact_contiguous_closed_sequence() {
#[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))]
mod pinned {
use super::*;
use crate::model_binding::qwen4exp_input::ModelBinding;
use crate::model_binding::weight_binding::ModelBinding;
use leleka_model_format::{gguf::VerifiedGgufFile, qwen4exp::Qwen4ExpArtifact};
use std::{env, path::PathBuf};
@@ -5,7 +5,7 @@ use super::contract::{Dimension, Error, LayerId, Result, Stage, TokenLayer};
use super::dense_weight_cache::DenseWeightCache;
use super::gr::ResidualReady;
use super::session::QwenStepTxn;
use crate::model_binding::qwen4exp_input::{
use crate::model_binding::weight_binding::{
BindingIdentity, BoundLayerKind, GdnMatrixKind, GdnMatrixRole, GdnWeights, GrRole, InputBindingError, ModelBinding,
};
use leleka_cuda_driver::{
@@ -8,7 +8,7 @@ use super::{
allocate, dispatch_projection, download, driver_error, normalize_retained_qk, validate_values,
};
mod chain_construction_and_buffers;
mod chain_slots;
mod chain_projection_convolution;
mod chain_readout_and_finish;
mod readout_drain;
mod chain_row_queue;
@@ -60,5 +60,5 @@ mod mirror_reuse_enabled;
#[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))]
use mirror_reuse_enabled::micro_rows;
use mirror_reuse_enabled::mirror_reuse_enabled;
mod gdn_chunk_device_methods;
mod chunk_device_phases;
mod native_fused_step;
@@ -71,7 +71,7 @@ pub(super) struct MirrorReadout<'ctx> {
#[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))]
mod gpu_tests;
mod gdn_state_mirror_methods;
mod state_mirror_phases;
mod mirror_readout;
mod upload_checked;
use upload_checked::upload_checked;
@@ -7,5 +7,5 @@ use super::{
upload_checked, validate_values,
};
mod state_mirror_compute_and_admit;
mod state_mirror_publish_and_close;
mod mirror_compute;
mod mirror_publish;

Some files were not shown because too many files have changed in this diff Show More