Explicit imports in the engine crate (tool-verified per round; full check pending), two at-the-limit files stay globs, baselines lowered

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Pavlo Ratushnyi
2026-11-14 14:32:11 +01:00
co-authored by Claude Sonnet 5.5
parent 88233994e4
commit c0c6b6f2f1
303 changed files with 1544 additions and 493 deletions
+8 -9
View File
@@ -7,7 +7,7 @@
"allow-unused-imports:leleka-cpu-sys": 48,
"allow-unused-imports:leleka-cuda-driver": 863,
"allow-unused-imports:leleka-engine-core": 18,
"allow-unused-imports:leleka-engine-qwen35-cuda": 396,
"allow-unused-imports:leleka-engine-qwen35-cuda": 224,
"allow-unused-imports:leleka-experimental-ref": 1,
"allow-unused-imports:leleka-gateway-text": 4,
"allow-unused-imports:leleka-gguf": 5,
@@ -23,7 +23,7 @@
"allow-unused-imports:leleka-openvino": 5,
"allow-unused-imports:leleka-runtime-client": 3,
"allow-unused-imports:leleka-tokenizer": 3,
"allow-unused-imports:strata-control": 63,
"allow-unused-imports:strata-control": 48,
"allow-unused-imports:strata-desktop-core": 9,
"dyn-trait:leleka-backend-api": 1,
"dyn-trait:leleka-cpu-worker": 4,
@@ -65,15 +65,14 @@
"env-read:leleka-npu-worker": 1,
"env-read:leleka-obs": 2,
"env-read:leleka-tokenizer": 2,
"env-read:strata-control": 19,
"env-read:strata-desktop-core": 15,
"env-read:strata-control": 14,
"env-read:strata-desktop-core": 13,
"glob-super-import:leleka-cpu-kernels": 2,
"glob-super-import:leleka-cpu-sys": 13,
"glob-super-import:leleka-cpu-worker": 1,
"glob-super-import:leleka-cuda-driver": 571,
"glob-super-import:leleka-deploy": 79,
"glob-super-import:leleka-engine-qwen35-cuda": 328,
"glob-super-import:leleka-gateway-domain": 2,
"glob-super-import:leleka-deploy": 15,
"glob-super-import:leleka-engine-qwen35-cuda": 70,
"glob-super-import:leleka-gguf": 5,
"glob-super-import:leleka-gptoss": 17,
"glob-super-import:leleka-gptoss-igpu": 2,
@@ -85,8 +84,8 @@
"glob-super-import:leleka-native-cpu-expert": 15,
"glob-super-import:leleka-openvino": 5,
"glob-super-import:leleka-tokenizer": 1,
"glob-super-import:strata-control": 37,
"glob-super-import:strata-desktop-core": 16,
"glob-super-import:strata-control": 9,
"glob-super-import:strata-desktop-core": 12,
"instant-now:leleka-backend-api": 2,
"instant-now:leleka-cpu-worker": 9,
"instant-now:leleka-cuda-driver": 25,
@@ -1,5 +1,8 @@
//! Pinned model identity, resource limits and the operator-facing configuration types of the CUDA owner.
use super::*;
use super::{
AtomicBool, AtomicU64, Duration, ExperimentalConfig, InheritedKarArchive, KarExpertSourceConfig, ModelDescriptor,
PathBuf, original_serve,
};
pub(super) const SHARD0: &str = "sha256:4c1eb2ceb4915e1192f4f386021897bde56a97f40a0bb78bb86465e0f7d2aca3";
pub(super) const SHARD1: &str = "sha256:316b46f3a2dbd68c900f43136ab9449f9dcc3725dfd8c794847c204bc161e113";
@@ -1,5 +1,9 @@
//! Identity digests of the mode a load publishes (mode, execution policy, KAR expert source).
use super::*;
use super::{
ADAPTIVE_SLOTS_EXECUTION, BackendError, Digest, INTEGER_WINDOWED_EXECUTION, InferenceMode, KAR_PROFILE,
MODE_DIGEST, ModelBinding, OPTIMIZED_EXECUTION, ORIGINAL_SERVE_EXECUTION, QUEUED_OWNERS_EXECUTION,
RESIDENT_OWNERS_EXECUTION, RETAINED_SCRATCH_EXECUTION, STREAMED_SPILL_EXECUTION, Sha256, invalid, requires_kar,
};
/// `sha256:` followed by the lowercase hex of a finished digest: the form of every published identity.
fn hex_digest(digest: Sha256) -> String {
@@ -1,6 +1,11 @@
//! Golden values of every identity digest on fixed inputs, taken from the code as it was before the digest functions
//! were unified (STRA-338 S5a). A change here is a change of the `mode_identity_digest` a running service publishes.
use super::*;
use super::{
KAR_MTP_PROFILE, RANKED_EXPERT_PROFILE_SHA, adaptive_slots_execution_digest, execution_mode_digest,
kar_expert_mode_digest, kar_mode_digest, mtp_mode_digest, optimized_execution_digest,
original_serve_execution_digest, queued_owners_execution_digest, resident_owners_execution_digest,
retained_scratch_execution_digest, streamed_spill_execution_digest,
};
const BOUND: &str = "sha256:0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef";
@@ -1,5 +1,5 @@
//! Constructors of the fixed `BackendError` refusals.
use super::*;
use super::{BackendError, ErrorCode};
pub(super) fn error(code: ErrorCode, message: &'static str) -> BackendError {
BackendError { code, message: message.into(), retryable: false }
@@ -1,6 +1,8 @@
//! The Qwen3.5 CUDA engine as an [`EngineFamily`] of the composition root (STRA-338 S20). Starting it is the existing
//! `spawn_backend*` code; this file only gives the choice between its two product entry points a single typed door.
use super::*;
use super::{
Backend, BackendError, NativeBackendConfig, OriginalServeOptions, spawn_backend, spawn_backend_original_serve,
};
use leleka_engine_core::family::EngineFamily;
/// The product engine: Qwen3.5 on the CUDA owner thread.
@@ -1,5 +1,12 @@
//! The MTP speculative generation loop.
use super::*;
use super::{
Clock, EvaluationExecution, FinishReason, GENERATION_TIMEOUT, Generation, GenerationEvent, GenerationFailure,
MtpContinuation, Ordering, PrefillTile, Usage, Utf8Pending, append_compatible, exhausted, invalid, unavailable,
};
#[cfg(feature = "preview-path")]
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};
@@ -1,8 +1,12 @@
//! The steps the MTP generate loop repeats: start the decoder, prefill the prompt tile by tile, then run, observe and
//! commit each verified window. Kept apart from `generate_mtp` so that loop reads as a sequence of these steps.
#[allow(unused_imports)]
use super::*;
use super::{
Clock, EvaluationExecution, GENERATION_TIMEOUT, Generation, GenerationEvent, GenerationFailure, MtpContinuation,
Ordering, PrefillTile, Utf8Pending, append_compatible, invalid, unavailable,
};
#[cfg(feature = "preview-path")]
use super::{Instant, MtpDecoder, MtpWindowError, MtpWindowSpec, TargetStepProduct, TokenId};
use crate::qwen_forward::mtp_decode::{MtpVerifiedWindow, MtpWindowRequest, WindowOwners};
/// The decoder to continue with, the product of the retained prefix, the tokens reused and the committed tokens so far.
@@ -1,6 +1,6 @@
//! How one generation ends short of a terminal: cancelled by the caller, or failed with a backend error. Shared by the
//! Original serve runner and the preview generation loop.
use super::*;
use super::BackendError;
pub(super) enum GenerationFailure {
Cancelled,
@@ -1,5 +1,5 @@
//! How a request ends other than by completing: client cancel, deadline, device error (STRA-338 S15).
use super::*;
use super::{Ended, ErrorCode, HOUR_MS, NO_EOS, Ordering, Rig, Script, expect, failed, prompt};
const SERVE_FAILED: &str = "Original serve request failed";
const DEADLINE: &str = "generation deadline exceeded";
@@ -2,7 +2,7 @@
//! text as re-recording, costs no recording, and is replaced - never replayed - when anything it was recorded over
//! changed. These scenarios are the ones the real verify bank (`park` / `rearm`) and the journal's owner loan
//! (`lend` / `take_back`) must pass; docs/experiments/decode-graph-reuse.md lists them.
use super::*;
use super::{Ended, NO_EOS, Rig, Script, ServeDevice, expect, prompt, prompt_of};
use crate::qwen_forward::original_serve_stack::decode_graph_reuse::{Armed, DecodeGraphKey, Why};
/// What recording the graph set costs on the manual clock.
@@ -1,6 +1,6 @@
//! The cross-session prefix cache under the lifecycle: reuse, write-back of another session's cells, and what a
//! failed or a cancelled request does to the checkpoints (STRA-338 S15).
use super::*;
use super::{Ended, ErrorCode, NO_EOS, Ordering, Rig, Script, done, expect, failed, prompt, prompt_of};
/// A cache that holds one session (700 tokens), then another: the buffer no longer holds the first one.
fn rig_after_two_sessions() -> Rig {
@@ -1,5 +1,10 @@
//! Load admission: every refusal that needs no model byte, and the start of the memory governor.
use super::*;
use super::{
BackendError, EvaluationExecution, InferenceMode, InheritedKarArchive, KAR_MTP_PROFILE, LoadEnv, LoadPhase,
ModelDescriptor, NATIVE_MTP_PROFILE, NativeBackendConfig, RuntimeConfig, exhausted, experimental_error,
experimental_modes, invalid, load_failure, original_serve, unsupported, validate_kar_selection, validate_load,
validate_mtp_selection,
};
use std::io::Write;
/// Refuse what cannot be served, before any model byte is read. Returns the experimental plan, if any,
@@ -1,5 +1,10 @@
//! The first half of a Load, before any CUDA object exists: sources, binding, identity, the expert bank.
use super::*;
use super::{
BackendError, Identity, InputBindingError, LoadEnv, LoadPhase, ModelBinding, ModelDescriptor, PolicyFlags,
RuntimeConfig, Tokenizer, admit_kar_experts, bind_artifact, bind_selected, check_mtp_context, check_not_cancelled,
effective_identity, exhausted, invalid, load_failure, open_sources, original_serve, policy_digest, read_profile,
unavailable,
};
use leleka_model_format::qwen4exp::ProvisionalExpertSource;
/// The host-side result of binding: what the CUDA half and the serve loop work on.
@@ -1,5 +1,12 @@
//! Load phases that fix the identity a Load publishes: the mode digest chain and the loaded-model handle.
use super::*;
use super::{
BackendError, EvaluationExecution, InferenceMode, LOAD_CONFIG_VERSION, LoadEnv, LoadPhase, LoadedModel,
ModelBinding, ModelDescriptor, OptimizedBackendConfig, Ordering, PolicyFlags, RuntimeConfig, Shared,
adaptive_slots_execution_digest, execution_mode_digest, experimental_modes, invalid, kar_expert_mode_digest,
load_failure, optimized_execution_digest, original_serve_execution_digest, queued_owners_execution_digest,
read_ranked_expert_profile, resident_owners_execution_digest, retained_scratch_execution_digest,
selected_bound_mode, streamed_spill_execution_digest, unavailable,
};
/// The model, the effective mode and the digest that identify what this Load publishes.
pub(super) struct Identity {
@@ -1,5 +1,10 @@
//! The MoE weight cache of a native Load: which constructor each execution selects.
use super::*;
use super::{
BackendError, Bound, EvaluationExecution, LoadEnv, LoadPhase, ModelBinding, PolicyFlags, adaptive_moe, exhausted,
learned_main_moe,
};
#[cfg(feature = "preview-path")]
use super::{DenseWeightCache, MoeWeightCache, load_forward_failure};
use crate::qwen_forward::contract::Error as ForwardError;
use leleka_cuda_driver::Context;
@@ -1,6 +1,8 @@
//! Witness gates of the adaptive-slots and the learned-main MoE caches (CUDA platforms only): a cache is accepted
//! only when its witness shows the state a fresh load must have; otherwise it is closed and refused.
use super::*;
use super::ModelBinding;
#[cfg(feature = "preview-path")]
use super::MoeWeightCache;
use crate::qwen_forward::contract::Error as ForwardError;
use crate::qwen_forward::moe_weight_cache::{AdaptiveWitness, LearnedMainWitness, SharedPermanentWitness};
use leleka_cuda_driver::Context;
@@ -1,5 +1,10 @@
//! Load phases that read the pinned sources: verify the shards, bind the artifact and the selected input providers.
use super::*;
use super::{
BackendError, InferenceMode, InheritedKarArchive, InputBindingError, InputResultKar, KAR_MTP_PROFILE,
KarExpertSource, LoadEnv, LoadPhase, ModelBinding, NativeBackendConfig, PolicyFlags, Qwen4ExpArtifact,
RuntimeConfig, SHARD0, SHARD1, Tokenizer, VerifiedGgufFile, VerifiedSources, invalid, kar_mtp_requested,
load_failure, selected_binding_failure, unsupported, verify_sources_parallel,
};
use leleka_model_format::qwen4exp::ProvisionalExpertSource;
use std::path::Path;
@@ -1,5 +1,9 @@
//! The owner thread loop and the load-failure diagnostics.
use super::*;
use super::{
BackendError, Command, Duration, EvaluationObserver, InputBindingError, LoadEnv, LoadedModel, ModelDescriptor,
NativeBackendConfig, Ordering, OwnerExecution, Receiver, Reply, RuntimeConfig, Shared, SystemClock, clear_active,
invalid, mpsc, serve_load,
};
#[derive(Clone, Copy, Debug)]
pub(super) enum LoadPhase {
@@ -1,5 +1,5 @@
//! Load-time probes of the experimental and KAR level-decode PTX.
use super::*;
use super::{BackendError, ExperimentalConfig, experimental_modes, invalid, unavailable, unsupported};
pub(super) fn experimental_error(error: experimental_modes::ExperimentalError) -> BackendError {
match error {
@@ -1,5 +1,13 @@
//! The caller-side handle of the owner actor: shared state, commands and the `Backend` implementation.
use super::*;
use super::{
ADAPTIVE_SLOTS_EXECUTION, Arc, AtomicBool, BACKEND_API_VERSION, Backend, BackendCapabilities, BackendError,
BackendIdentity, Duration, ErrorCode, EvaluationExecution, GenerationRequest, GenerationStream,
INTEGER_WINDOWED_EXECUTION, LoadedModel, ModelDescriptor, Mutex, OPTIMIZED_EXECUTION, ORIGINAL_SERVE_EXECUTION,
Ordering, QUEUED_OWNERS_EXECUTION, RECONFIGURE_TIMEOUT, RECONFIGURING, REPLY_TIMEOUT, RESIDENT_OWNERS_EXECUTION,
RETAINED_SCRATCH_EXECUTION, Receiver, RecentIds, RuntimeConfig, STREAMED_SPILL_EXECUTION, SupportedModelTuple,
SyncSender, exhausted, invalid, load_reply_timeout, mpsc, original_serve, unavailable, unsupported,
validate_handle, validate_kar_selection, validate_load, validate_mtp_selection, validate_request,
};
pub(super) struct Active {
pub(super) id: String,
@@ -1,5 +1,7 @@
//! Request preparation: sampler plan, prompt tokens, positions.
use super::*;
use super::{BackendError, GenerationRequest, Tokenizer, exhausted, invalid, validate_request};
#[cfg(feature = "preview-path")]
use super::{Dimension, InputConstants, Position};
pub(super) fn request_sampler(
request: &GenerationRequest,
@@ -1,5 +1,5 @@
//! The end of a loaded native model: the weights and the context are closed and the Unload caller is answered.
use super::*;
use super::{BackendError, Conversations, Ordering, Rc, Reply, Shared, Weights, unavailable};
use leleka_cuda_driver::Context;
/// What closing the weights left to settle with the context.
@@ -1,5 +1,13 @@
//! One Generate command of the serve loop: admit it, resume or start a session, generate, publish the terminal.
use super::*;
use super::{
ActiveGuard, Arc, AtomicBool, BackendError, Conversations, Counters, GenerationRequest, GenerationSink,
GenerationStream, LoadedModel, ModelBinding, MtpContinuation, Ordering, Outcome, PrefixSession, QUEUE, Rc, Reply,
Serving, Shared, TerminalGates, append_compatible, deliver_measurement, emit_terminal, invalid,
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.
@@ -1,5 +1,10 @@
//! The command loop of a loaded native model: Load and Reconfigure are refused, Unload ends the loop, Generate runs.
use super::*;
use super::{
BackendError, Bound, Command, Duration, Job, LoadEnv, LoadedModel, Ordering, PrefixSession, Rc, Reply, Weights,
exhausted, handle_generate, invalid, mpsc, unsupported,
};
#[cfg(feature = "preview-path")]
use super::{ResidentConversations, ResidentPolicy};
use leleka_cuda_driver::Context;
/// The resident conversations of one loaded model: the live continuation plus (operator opt-in) parked ones.
@@ -1,5 +1,8 @@
//! What one Generate reports: the weight-cache counters, the terminal verdict and the measurement.
use super::*;
use super::{
CacheCounts, Conversations, Exchange, FinishReason, GenerationFailure, GenerationTerminal, Outcome, Serving,
Weights, measurement,
};
use crate::qwen_forward::dense_weight_cache::DenseCacheCounters;
use crate::qwen_forward::moe_weight_cache::WeightCacheCounters;
@@ -1,5 +1,7 @@
//! The resident numeric prefix kept between generations.
use super::*;
use super::LoadedModel;
#[cfg(feature = "preview-path")]
use super::{MtpDecoder, QwenSession, TargetStepProduct};
/// One actual successful resident numeric prefix. Actor/model lifetime is
/// the lifecycle fence; LoadedModel adds handle/mode/config identity.
@@ -1,5 +1,9 @@
//! Verification of the pinned sources (shards, KAR archive, ranked profile) at load time.
use super::*;
use super::{
BackendError, Clock, Digest, InheritedKarArchive, InputBindingError, NativeBackendConfig, PathBuf,
RANKED_EXPERT_PROFILE_BYTES, RANKED_EXPERT_PROFILE_SHA, RankedExpertProfileSource, SHARD0, SHARD1, Sha256,
SystemClock, VerifiedGgufFile, exhausted, invalid,
};
use leleka_model_format::weight_source::{BackingKind, FileWeightSource, WeightError, WeightSource};
/// What the three source verifications returned. Errors are reduced to text because the verifying threads hand
@@ -1,6 +1,10 @@
//! The common owner-thread spawn of every backend (Original serve and preview alike). The preview factories
//! (Native and evaluation-only backends) live in `spawn_preview.rs`, behind the `preview-path` feature.
use super::*;
use super::{
Arc, AtomicBool, Backend, BackendError, Command, ErrorCode, EvaluationExecution, EvaluationObserver, INSTANCE,
MODE_DIGEST, Mutex, NativeBackendConfig, Ordering, OwnerExecution, OwnerGuard, OwnerThread, PolicyFlags, Proxy,
QUEUE, RecentIds, Shared, SyncSender, invalid, kar_expert_mode_digest, mpsc, thread, unavailable,
};
/// The configuration limits every native spawn checks before any thread or CUDA owner exists.
fn admit_native_resources(config: &NativeBackendConfig) -> Result<(), BackendError> {
@@ -1,5 +1,9 @@
//! Factories of the optimized windowed256 experiments (queued owners .. adaptive slots).
use super::*;
use super::{
Backend, BackendError, EvaluationExecution, EvaluationObserver, NativeBackendConfig, OptimizedBackendConfig,
OptimizedOwnerPolicy, OwnerExecution, RANKED_EXPERT_PROFILE_SHA, RankedExpertProfileSource, invalid,
spawn_backend_configured, unsupported,
};
/// Separately selected optimized experiment. Default and earlier experiment
/// factories remain unchanged; this selection certifies neither speed nor quality.
@@ -1,5 +1,9 @@
//! Choice of the Original-literal mode17 serve path and its factories.
use super::*;
use super::{
Backend, BackendError, EvaluationExecution, NativeBackendConfig, OriginalServeChoice, OriginalServeMode,
OriginalServeOptions, OwnerExecution, RANKED_EXPERT_PROFILE_SHA, RankedExpertProfileSource, invalid,
invalid_dynamic, original_serve, spawn_backend_configured, unsupported,
};
/// The path an operator configuration resolves to for `mode` (see `OriginalServeMode`): pure over the
/// configuration and the build's asset probe. `Auto` picks the Original path only when it can start;
@@ -1,5 +1,8 @@
//! Factories of the Native and the evaluation-only backends: the Rust-native preview decoder chain (`preview-path`).
use super::*;
use super::{
Backend, BackendError, EvaluationExecution, EvaluationObserver, NativeBackendConfig, OwnerExecution, invalid,
spawn_backend_configured,
};
pub fn spawn_backend(config: NativeBackendConfig) -> Result<Box<dyn Backend>, BackendError> {
spawn_backend_inner(config, None, EvaluationExecution::Native)
@@ -1,5 +1,8 @@
//! Incremental UTF-8 publication of generated tokens and the terminal event.
use super::*;
use super::{
BACKPRESSURE_TIMEOUT, BackendError, Clock, ContractError, Duration, FRAME_LIMIT, GenerationEvent,
GenerationFailure, GenerationSink, GenerationTerminal, exhausted, thread, unavailable,
};
#[derive(Default)]
pub(super) struct Utf8Pending(pub(super) Vec<u8>);
@@ -1,5 +1,9 @@
//! Admission checks of loads, handles and generation requests.
use super::*;
use super::{
BackendError, Duration, GenerationRequest, InferenceMode, KAR_LOAD_REPLY_TIMEOUT, KAR_MTP_PROFILE, KAR_PROFILE,
LOAD_CONFIG_VERSION, LoadedModel, MODE_DIGEST, ModelDescriptor, NATIVE_MTP_PROFILE, OUTPUT_LIMIT, PROMPT_LIMIT,
REPLY_TIMEOUT, RuntimeConfig, invalid, pinned_model_descriptor, request_sampler, unsupported,
};
pub(super) fn validate_load(model: &ModelDescriptor, config: &RuntimeConfig) -> Result<(), BackendError> {
config.validate().map_err(|_| invalid("invalid load configuration"))?;
@@ -1,8 +1,10 @@
//! Methods of `OriginalServeMode`: `parse`, `as_str`. Methods of `ExpertSource`: `parse`, `as_str`.
//! Implements `Default for OriginalServeOptions`.
#[allow(unused_imports)]
use super::*;
use super::{
BackendError, ConfigFacts, ExpertSource, OriginalServeChoice, OriginalServeMode, OriginalServeOptions,
PREFIX_SUMMARY, PrefixTail,
};
impl OriginalServeMode {
pub fn parse(value: &str) -> Option<Self> {
@@ -30,7 +30,23 @@
//!
//! Run (inside a holder job): `<test binary> --ignored --nocapture original_serve_replay_smoke`.
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, 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 crate::qwen_forward::{
original_serve_request::{ServeError, ServeRequest},
original_serve_stack::{OriginalServeStack, PrefixBudget, PrefixConfig, StackConfig},
@@ -1,5 +1,22 @@
//! The captured requests and the pinned model of the replay.
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, 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,
};
pub(super) fn number(name: &str, default: usize) -> usize {
env::var(name).ok().map(|v| v.parse().unwrap_or_else(|_| panic!("{name} must be a count"))).unwrap_or(default)
@@ -1,7 +1,24 @@
//! 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::*;
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 crate::qwen_forward::original_serve_engine::ServeOutcome;
use std::time::Duration;
@@ -1,8 +1,24 @@
//! Functions: `required_path`.
//! Split out of `original_serve_replay` to keep its files under the line limit.
#[allow(unused_imports)]
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, 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,
};
pub(super) fn required_path(name: &str) -> PathBuf {
env::var_os(name).map(PathBuf::from).unwrap_or_else(|| panic!("missing operator-owned input {name}"))
@@ -2,7 +2,24 @@
use super::arm_flags::{self, ArmShape};
use super::load::{self, number};
use super::pass::Replay;
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, 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,
};
use crate::qwen_forward::original_serve_stack::TailMode;
fn tail_mode(arm: &str) -> TailMode {
@@ -27,7 +27,25 @@
//!
//! Run: `cargo test -p leleka-engine-qwen35-cuda --features cuda-driver[,sm86] --release -- --ignored --nocapture
//! original_serve_laptop_bench`.
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, request,
};
#[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_engine::ServeOutcome,
original_serve_request::{ServeError, ServeRequest},
@@ -1,5 +1,22 @@
//! The serving passes of the laptop bench: the sequence, the soak limits and the per-request reports.
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, 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,
};
/// The serving sequence and the soak limits.
pub(super) struct Soak {
@@ -1,6 +1,24 @@
//! The inventory scenario: the allocation inventory and the load ledger at idle, after a long request and with the
//! prefix cache full.
use super::*;
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,
};
/// The number after `key` in a prefix metrics line.
fn metric(line: &str, key: &str) -> Option<u64> {
@@ -1,5 +1,22 @@
//! The knobs and the scripted workload of the prefix-cache smoke (identical for every mode).
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, 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,
};
/// What the operator asked for.
pub(super) struct Plan {
@@ -11,7 +11,23 @@
//! 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::*;
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 crate::qwen_forward::{
original_serve_request::ServeRequest,
original_serve_stack::{OriginalServeStack, PrefixBudget, PrefixConfig, StackConfig},
@@ -1,6 +1,12 @@
//! New real Linux seal/FD gate; tiny metadata fixture, no CUDA/model capability.
#![cfg(target_os = "linux")]
use super::*;
use super::{
BindingIdentity, File, InheritedKarArchive, InputBindingError, InputResult, KarError, KarPlePartProvenance,
KarPleProfile, KarPleProfileSpec, PINNED_ARCHIVE_BYTES, PLE_ROWS, PROVENANCE_DIGEST, Path, PathBuf, RefCell,
VerifiedKarPleArtifact,
};
#[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};
use std::{
fs::{self, DirBuilder, OpenOptions},
@@ -1,8 +1,10 @@
//! Methods of `BindingIdentity` and `BoundLayer`, and the `Display` and `Error` impls of `InputBindingError`: what a
//! binding says about itself and how its failures read.
#[allow(unused_imports)]
use super::*;
use super::{
BindingIdentity, BoundLayer, BoundLayerKind, InputBindingError, InputConstants, InputResult, PLE_ROWS,
Qwen4ExpArtifact, Rc, fmt,
};
impl fmt::Display for InputBindingError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
@@ -1,8 +1,11 @@
//! Methods of `ModelBinding`: `bind`, `from_artifact`, `from_artifact_with_kar_ple`, `with_kar_expert_source` and 22...
//! Functions: `bind_expert_counts`.
#[allow(unused_imports)]
use super::*;
use super::{
BindingError, BindingIdentity, BoundLayer, EMBEDDING_VALUES, GlobalRole, InputBindingError, InputConstants,
InputResult, ModelBinding, MtpWeights, PLE_ROW_VALUES, PLE_ROWS, Qwen4ExpArtifact, Rc, RefCell, TensorRole,
VOCABULARY, bind_layers, decode, mtp, validate_ple_descriptor,
};
impl ModelBinding {
pub(crate) fn bind() -> Result<Self, BindingError> {
@@ -1,8 +1,11 @@
//! Groups the submodules `model_binding_moe_descriptors`, `moe_expert_block_reads`.
//! Split out of `moe_expert` to keep its files under the line limit.
#[allow(unused_imports)]
use super::*;
use super::{
E, EXPERTS, FF, InputResult, LayerRole, Matrix, ModelBinding, MoeExpertBlock, MoeExpertSelection, MoeExpertWeights,
MoeMatrixRole, MoeRows, MoeWeightDescriptor, N, SELECTED, TensorRole, descriptor, index, routed_source_role,
validate_range, validate_selected,
};
#[path = "model_binding/model_binding_moe_descriptors.rs"]
mod model_binding_moe_descriptors;
@@ -3,8 +3,10 @@
use super::super::routed_source_descriptor::validate_rows_finite;
use super::super::routed_source_descriptor::{check_matrix_tensor, check_moe_metadata, selected_expert};
#[allow(unused_imports)]
use super::*;
use super::{
E, EXPERTS, FF, InputResult, LayerRole, Matrix, ModelBinding, MoeExpertSelection, MoeExpertWeights, MoeMatrixRole,
MoeWeightDescriptor, N, SELECTED, TensorRole, descriptor, index, routed_source_role, validate_selected,
};
use leleka_model_format::qwen4exp::{Qwen4ExpArtifact, RowRange};
/// One expert matrix of a layer, admitted against its expected kind, shape and extent.
@@ -2,8 +2,10 @@
//! streamed block reads.
use super::super::routed_source_descriptor::{check_matrix_tensor, selected_expert, validate_rows_finite};
#[allow(unused_imports)]
use super::*;
use super::{
E, InputResult, LayerRole, Matrix, ModelBinding, MoeExpertBlock, MoeExpertSelection, MoeExpertWeights,
MoeMatrixRole, MoeRows, MoeWeightDescriptor, N, TensorRole, validate_range,
};
use leleka_model_format::qwen4exp::{Qwen4ExpArtifact, RowRange};
/// A selected expert's rows from the resident bank, finite-checked by the proven encoded validators.
@@ -4,8 +4,10 @@
use super::routed_source_descriptor::check_moe_metadata;
#[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))]
use super::routed_source_descriptor::run_routed_scope;
#[allow(unused_imports)]
use super::*;
use super::{
E, EXPERTS, FF, InputResult, LayerRole, ModelBinding, MoeExpertWeights, MoeMatrixRole, MoeRoutedSourceScope,
MoeWeightDescriptor, N, TensorRole, descriptor, routed_source_descriptor, routed_source_role,
};
#[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))]
impl<'group> MoeRoutedSourceScope<'_, 'group> {
@@ -1,8 +1,11 @@
//! 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`.
#[allow(unused_imports)]
use super::*;
use super::{
BindingIdentity, E, EXPERTS, FF, InputResult, LayerRole, Matrix, ModelBinding, MoeExpertBlock, MoeExpertSelection,
MoeExpertWeights, MoeMatrixRole, MoeRoutedSourceScope, MoeWeightDescriptor, N, SELECTED, descriptor,
encoded_finite, index,
};
/// The model metadata the native MoE path was written for.
pub(super) fn check_moe_metadata(artifact: &leleka_model_format::qwen4exp::Qwen4ExpArtifact) -> InputResult<()> {
@@ -1,5 +1,5 @@
//! Original immutable file-source admission from this actual selected artifact.
use super::*;
use super::{InputBindingError, InputResult, ModelBinding};
use leleka_model_format::qwen4exp::FileExpertSourceLease;
impl ModelBinding {
pub(crate) fn original_file_expert_source(&self) -> InputResult<FileExpertSourceLease> {
@@ -1,5 +1,5 @@
//! Explicit admission on an unpublished selected binding. Raw source bytes only.
use super::*;
use super::{InputBindingError, InputResult, LayerRole, ModelBinding};
use leleka_model_format::qwen4exp::{ResidentExpertSourceError, ResidentExpertSourceReport};
/// EXPERIMENTAL `LELEKA_ORIGINAL_SERVE_GGUF_PLE=1` (profile `rtx5090-32g-gguf-ple`): a binding without a KAR archive
@@ -1,6 +1,6 @@
//! Pure current-age bootstrap policy proof; no binding/device/weight certificate.
use super::super::cache_lru_index::LruIndex;
use super::*;
use super::{MoeWeightDescriptor, learned_main_slot_bound};
fn key(layer: u32, expert: u32, role: u8) -> MoeWeightDescriptor {
MoeWeightDescriptor { layer, expert: Some(expert), role, raw_kind: 18, columns: 2560, rows: 640, bytes: 627_200 }
@@ -1,8 +1,7 @@
//! 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.
#[allow(unused_imports)]
use super::*;
use super::{ABSENT, Error, LruIndex, MAX_KEYS, MoeWeightDescriptor, Node, Result, slot};
impl LruIndex {
/// Seed only the already reserved, empty index from completed actual owners.
@@ -1,5 +1,7 @@
//! Pure metadata proof. Literal descriptors convey no model, weight or device authority.
use super::*;
use super::{LruIndex, MAX_KEYS, MoeWeightDescriptor, PER_LAYER, slot};
#[cfg(any(test))]
use super::HOST_LIMIT;
use std::collections::HashMap;
type Oracle = HashMap<MoeWeightDescriptor, u64>;
@@ -1,7 +1,10 @@
//! Model-lifetime immutable MTP allocations. Cached CUDA graphs own real Rc
//! allocations, so a per-call matrix borrow can never outlive its weight bank.
use super::super::output_native::OriginalMtpNativeHead;
use super::*;
use super::{
BindingIdentity, Cell, Context, Dense, DeviceBuffer, Error, ModelBinding, MoeWeightCache, MtpKind, MtpRole, Rc,
Result, binding_error, driver_error,
};
use crate::model_binding::qwen4exp_input::{pinned_dense_bytes, rt_dense_name, rt_dense_roles, rt_dense_shape};
#[derive(Clone)]
struct RetainedDense<'ctx> {
@@ -1,8 +1,10 @@
//! Methods of `MoeWeightCache`: `share_rt_mtp_dense`, `share_entry`, `device_copies_equal`, `adopt_rt_buffer` and 2 ...
//! Functions: `dense_copies_equal`.
#[allow(unused_imports)]
use super::*;
use super::{
Cell, Context, Dense, Error, ModelBinding, MoeWeightCache, MtpDenseShare, MtpKind, MtpRole, Rc, Result,
RetainedDense, RetainedOriginalMtpWeights, WeightSource, binding_error, driver_error, pinned_dense_bytes,
};
/// Two copies of a dense role may be merged only when kind, shape, length and every byte agree.
pub(super) fn dense_copies_equal(a: (MtpKind, usize, usize, &[u8]), b: (MtpKind, usize, usize, &[u8])) -> bool {
@@ -1,8 +1,11 @@
//! Methods of `RetainedOriginalMtpWeights`: `from_rt_bank`, `rt_dense`, `rt_extras`, `dense_file_bytes` and 11 more.
//! Functions: `rt_kind`. Defines `HeadBinding`.
#[allow(unused_imports)]
use super::*;
use super::{
Context, DeviceBuffer, Error, FULL_FORWARD_ROLES, ModelBinding, MtpHeadSources, MtpKind, MtpRole,
OriginalMtpNativeHead, Rc, Result, RetainedDense, RetainedOriginalMtpWeights, WeightSource, binding_error,
driver_error, rt_dense_name, rt_dense_roles, rt_dense_shape,
};
use leleka_cuda_driver::FullForwardHead;
use leleka_cuda_driver::OriginalMtpRetainedFullWeights as FullWeights;
@@ -2,7 +2,11 @@
//! Reuses the one real MMQ/native owners and immutable encoded shared weights;
//! routed experts come from the actual registered retained model bank.
//! This does not fabricate scalar FFN rows or publish a session checkpoint.
use super::*;
use super::{
Context, DeviceBuffer, EncodedWeight, Entry, Error, HashMap, MmqRoutingPolicy, MmqWorkspace, ModelBinding,
MoeExpertSelection, MoeExpertWeights, MoeMatrixRole, MoeWeightCache, MoeWeightDescriptor, Rc, Result,
binding_error, driver_error, original_dual_layout,
};
use crate::qwen_forward::prefill_profile::{self as prof, Stage as PStage};
use crate::qwen_forward::{contract::LayerId, dense_weight_cache::DenseWeightCache};
use leleka_cuda_driver::{GdnNativeFormat, NativeBatchWorkspace, OriginalDeviceBlock, OriginalDeviceGrRead};
@@ -1,8 +1,11 @@
//! 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`.
#[allow(unused_imports)]
use super::*;
use super::{
Context, Error, LayerId, MmqRoutingPolicy, MmqWorkspace, ModelBinding, MoeExpertSelection, MoeExpertWeights,
MoeMatrixRole, MoeWeightCache, MoeWeightDescriptor, Rc, ResidentExpertBankSpan, Result, binding_error,
driver_error,
};
/// The prefill layout options of the arena and the validated u32 capacity carved from them.
struct ArenaPlan {
@@ -3,7 +3,11 @@
#[allow(unused_imports)]
use super::prompt_layer_fns::{PromptIo, PromptParts, PromptWeightOwners, SpanScan, run_prompt_layer};
use super::*;
use super::{
DenseWeightCache, DeviceBuffer, EncodedWeight, Entry, Error, GdnNativeFormat, HashMap, LayerId, ModelBinding,
MoeWeightCache, MoeWeightDescriptor, NativeBatchWorkspace, OriginalDeviceBlock, OriginalDeviceGrRead, Rc, Result,
driver_error, native_format, span_cache_enabled,
};
impl<'ctx> MoeWeightCache<'ctx> {
/// Genuine device FFN read -> router/shared -> ascending groups of16 ->
@@ -1,7 +1,10 @@
//! One original-prompt MoE layer: expert spans, copy ring and finish (STRA-338 size: extract-method only).
#[allow(unused_imports)]
use super::*;
use super::{
Context, DenseWeightCache, DeviceBuffer, Error, GdnNativeFormat, LayerId, ModelBinding, MoeExpertWeights,
MoeMatrixRole, MoeWeightDescriptor, NativeBatchWorkspace, OriginalDeviceBlock, OriginalDeviceGrRead, PStage, Rc,
ResidentExpertBankSpan, Result, binding_error, driver_error, original_dual_layout, prof, prompt_stream_settings,
};
use crate::model_binding::qwen4exp_input::MoeRoutedSourceScope;
use leleka_cuda_driver::{
MappedExpertBank, MmqFormat, MmqWorkspace, OriginalMmqCopySchedule, OriginalMoePromptDevice, OriginalMoePromptLayer,
@@ -3,8 +3,7 @@
//! miss are copied into its ring's stage slots through this layer's row lease, so the PCIe copies run under this
//! layer's combine and the next layer's mixer instead of after the next router.
#[allow(unused_imports)]
use super::*;
use super::{BITS, LayerId, SpanScan};
use crate::qwen_forward::contract::Dimension;
use leleka_cuda_driver::{OriginalMmqCopySchedule, OriginalMoePromptLayer, PrefetchSource};
@@ -1,8 +1,7 @@
//! 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.
#[allow(unused_imports)]
use super::*;
use super::{Error, GdnNativeFormat, MoeWeightDescriptor, PREFILL_STREAM_OVERRIDE, Result, SPAN_CACHE_OVERRIDE};
/// prefill.cpp `stream_all` order (`begin_prompt_stream`): for chunks of at least `STRATA_PREFILL_STREAM_MIN` rows
/// (default 4096: it copies every expert of every layer, while the per-layer ring copies only the routed ones, about
@@ -7,7 +7,7 @@
//! that loader for every layer and then proves all 192 tensors are resident together (a load of a later layer may
//! not have evicted an earlier one), and `original_verify_moe` hands them out. Nothing is copied or re-encoded: the
//! routed experts are not here (the verifier's expert tier is the pool callback).
use super::*;
use super::{EncodedWeight, Error, ModelBinding, MoeWeightCache, MoeWeightDescriptor, Result, driver_error};
use crate::qwen_forward::original_serve_verifier::VerifyWeights;
use crate::qwen_forward::{
contract::{Dimension, LayerId},
@@ -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::{
Context, Error, HOST_CAP, MAIN_LIMIT, ModelBinding, MoeWeightCache, PROFILE_SHA, RankedProfile, Result,
cache_profile,
};
#[cfg(test)]
use super::ProfileWitness;
#[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))]
impl<'ctx> MoeWeightCache<'ctx> {
@@ -1,8 +1,13 @@
//! Methods of `MoeWeightCache`: `new_native_integer_iq3_mmq_retained_mtp_kv_shared_tail_profile`, `new_native_intege...
//! Functions: `ranked_keys`. Defines `MapReservation`, `ProfileFill`.
#[allow(unused_imports)]
use super::*;
use super::{
Context, 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;
/// Slot count and metadata ceiling proven when the weight map was reserved.
struct MapReservation {
@@ -1,6 +1,7 @@
//! The shared-permanent profile build behind the fixed-prefix and learned-main constructors (STRA-338 size:
//! 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::*;
@@ -1,8 +1,9 @@
//! Functions: `profile_window_spill`, `profile_window_spill_with_floor`.
//! Split out of `cache_profile_fill` to keep its files under the line limit.
#[allow(unused_imports)]
use super::*;
use super::{Error, Result};
#[cfg(test)]
use super::ProfileWitness;
// Complete simultaneously live prefill owners; reserve is additive.
pub(super) fn profile_window_spill() -> Result<usize> {
@@ -3,7 +3,13 @@
#[allow(unused_imports)]
use super::profile_build::ProfileFile;
use super::*;
use super::{
Context, DeviceBuffer, Entry, Error, HOST_CAP, HashMap, MAIN_LIMIT, ModelBinding, MoeMatrixRole, MoeWeightCache,
MoeWeightDescriptor, PROFILE_SHA, ProfileLimits, RankedProfile, Rc, RefCell, Result, WORKING_RESERVE,
binding_error, cache_profile, cache_strata_adaptive, cpu_budget, driver_error, profile_window_spill_with_floor,
};
#[cfg(test)]
use super::ProfileWitness;
#[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))]
impl<'ctx> MoeWeightCache<'ctx> {
@@ -1,5 +1,5 @@
//! Sanitized pure metadata proof, without model/profile files or device owners.
use super::*;
use super::{Digest, Error, HOST_CAP, PrefixPlan, ProfileLimits, RankedProfile, Sha256};
const BASE_BYTES: usize = 24 + 24_576 * 4;
@@ -1,5 +1,8 @@
//! Pure metadata/budget proof; never constructs a ModelBinding or device owner.
use super::*;
use super::{
Error, HOST_CAP, MoeWeightDescriptor, PrefixPlan, ProfileLimits, RankedProfile, SHARED_MAX_BYTES,
SharedPermanentPool, remaining_shared_main,
};
/// Shape, quantisation kind and byte size of one shared-expert weight role, independent of the layer.
struct SharedRoleShape {
@@ -1,6 +1,6 @@
//! Pure source-policy oracle only. No fabricated BindingIdentity, device slot,
//! event completion, CPU expert output, or model acceptance certificate.
use super::*;
use super::{AdaptivePolicy, EXPERTS, Error, LAYERS, MoeWeightDescriptor, ProfileLimits, RankedProfile, Swap};
use sha2::{Digest, Sha256};
fn fixture() -> (RankedProfile, [[MoeWeightDescriptor; 3]; LAYERS]) {
@@ -5,7 +5,10 @@
//! prefill cannot disagree about a weight, and a held assembly keeps them alive without borrowing the cache.
//! Native MMVQ projections are `original_verify_projections`; router and shared experts live in the MoE cache
//! (`cache_original_verify`).
use super::*;
use super::{
BoundLayerKind, DenseWeightCache, DeviceRef, Error, GrResident, GrRole, ModelBinding, QsaMatrixKind, QsaMatrixRole,
Rc, Result, driver_error,
};
use leleka_cuda_driver::{
HcHalfBuffers, HcLayerBuffers, HcOutputBuffers, OriginalVerifyGeometry, OriginalVerifyGrBinding,
OriginalVerifyQsaBinding, OriginalVerifyQsaLayerWeights, PleBuffers, PleKeyBuffer,
@@ -1,8 +1,7 @@
//! Functions: `dense_slab_policy`, `startup_step`.
//! Split out of `dense_weight_cache` to keep its files under the line limit.
#[allow(unused_imports)]
use super::*;
use super::SlabPolicy;
/// `LELEKA_DENSE_SLAB=0` keeps one allocation per weight (the A/B arm and the rollback); otherwise the dense weights
/// are packed into 64 MiB slabs. Both place the same bytes: only buffer addresses move.
@@ -1,8 +1,16 @@
//! 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.
#[allow(unused_imports)]
use super::*;
use super::{
ALL_MIRROR_BYTES, BoundLayerKind, Cell, Context, DenseCacheCounters, DenseWeightCache, DeviceBuffer, DeviceRef,
Error, GdnInputLease, GdnInputScratch, GdnMatrixKind, GdnMatrixRole, GdnResident, GdnStateMirror,
GdnVerificationWorkspace, GrBatchInjectWorkspace, GrResident, GrRole, GrScratch, ModelBinding,
OriginalVerifyGdnProjections, OriginalVerifyGdnWeights, OriginalVerifyGeometry, OriginalVerifyNativeMatrix,
OriginalVerifyProjBinding, OriginalVerifyQsaProjections, PleMatrixRole, PleResident, PleWeights, QkScratch,
QsaAttentionScratch, QsaIndexKeyCache, QsaInputLease, QsaInputScratch, QsaMatrixKind, QsaMatrixRole, QsaResident,
QsaSelectedCache, QsaSelectionRequest, RESERVE, Rc, RefCell, RefMut, Result, RouterLease, RouterScratch,
SlabAllocator, SlabPolicy, Workspaces, binding_error, dense_slab_policy, driver_error, startup_step,
};
mod dense_cache_buffers_and_close;
mod dense_cache_eager_layer_load;
@@ -1,8 +1,10 @@
//! Methods of `DenseWeightCache`: `gr_buffers`, `counters`, `chunk_modules`, `close` and 4 more.
//! Functions: `close_into`.
#[allow(unused_imports)]
use super::*;
use super::{
Context, DenseCacheCounters, DenseWeightCache, DeviceBuffer, Error, GrResident, ModelBinding, QkScratch, Rc,
Result, driver_error,
};
impl<'ctx> DenseWeightCache<'ctx> {
pub(in super::super::super) fn gr_buffers(&self, entry: &GrResident) -> Result<[Option<&DeviceBuffer<'ctx>>; 4]> {
@@ -1,8 +1,12 @@
//! Methods of `DenseWeightCache`: `new_with_selected`, `unloaded`, `load_eager`, `reserve_layer_tables` and 6 more.
//! Functions: `reserve_table`.
#[allow(unused_imports)]
use super::*;
use super::{
ALL_MIRROR_BYTES, BoundLayerKind, Cell, Context, DenseCacheCounters, DenseWeightCache, Error, GdnInputScratch,
GdnMatrixKind, GdnMatrixRole, GdnResident, GdnStateMirror, GrRole, GrScratch, ModelBinding, QsaIndexKeyCache,
QsaInputScratch, QsaMatrixKind, QsaMatrixRole, QsaResident, QsaSelectedCache, Rc, RefCell, Result, SlabAllocator,
Workspaces, binding_error, dense_slab_policy, driver_error,
};
fn reserve_table<T>(table: &mut Vec<T>, count: usize) -> Result<()> {
table.try_reserve_exact(count).map_err(|_| Error::InputAllocation)
@@ -1,8 +1,11 @@
//! 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.
#[allow(unused_imports)]
use super::*;
use super::{
Cell, Context, DenseWeightCache, DeviceBuffer, DeviceRef, Error, GdnInputLease, GdnInputScratch, GdnResident,
GdnStateMirror, GrResident, GrRole, ModelBinding, QkScratch, QsaInputLease, QsaInputScratch, QsaResident,
QsaSelectedCache, QsaSelectionRequest, Rc, RefMut, Result,
};
impl<'ctx> DenseWeightCache<'ctx> {
#[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))]
@@ -1,8 +1,11 @@
//! 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.
#[allow(unused_imports)]
use super::*;
use super::{
Context, DenseWeightCache, DeviceRef, Error, GrBatchInjectWorkspace, GrResident, GrRole, GrScratch, ModelBinding,
PleMatrixRole, PleResident, PleWeights, RESERVE, Rc, RefMut, Result, RouterLease, RouterScratch, binding_error,
driver_error,
};
/// The role, row count and byte size a retained PLE matrix must have; any other matrix is refused.
struct ExpectedPleMatrix {
@@ -1,8 +1,12 @@
//! Methods of `DenseWeightCache`: `ple`, `ple_key`, `ple_value`, `ple_value_tile` and 16 more.
//! Functions: `gdn_native_type`, `qsa_native_type`.
#[allow(unused_imports)]
use super::*;
use super::{
BoundLayerKind, Context, DenseWeightCache, DeviceBuffer, DeviceRef, Error, GdnMatrixKind, GdnMatrixRole,
GdnResident, ModelBinding, OriginalVerifyGdnProjections, OriginalVerifyGdnWeights, OriginalVerifyGeometry,
OriginalVerifyNativeMatrix, OriginalVerifyProjBinding, OriginalVerifyQsaProjections, PleResident, QsaMatrixKind,
QsaMatrixRole, QsaResident, Rc, Result, binding_error, driver_error,
};
impl<'ctx> DenseWeightCache<'ctx> {
pub(in super::super::super) fn ple(&self, binding: &ModelBinding, context: &Context<'_>) -> Result<&PleResident> {
@@ -1,8 +1,10 @@
//! 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.
#[allow(unused_imports)]
use super::*;
use super::{
Context, DenseWeightCache, DeviceBuffer, Error, GdnVerificationWorkspace, ModelBinding, QkScratch, Rc, RefCell,
Result, RouterScratch, SlabPolicy, driver_error, startup_step,
};
impl<'ctx> DenseWeightCache<'ctx> {
#[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))]
@@ -1,8 +1,10 @@
//! 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.
#[allow(unused_imports)]
use super::*;
use super::{
Context, DenseWeightCache, Error, ModelBinding, QkScratch, QsaAttentionScratch, Rc, RefCell, Result, RouterScratch,
driver_error,
};
impl<'ctx> DenseWeightCache<'ctx> {
pub(crate) fn new(binding: &ModelBinding, context: &'ctx Context<'ctx>) -> Result<Self> {
@@ -1,8 +1,10 @@
//! Methods of `PrefillStepProduct`: `mtp_source`.
//! Methods of `TargetStepProduct`: `test_prefix_residual`, `mtp_source`, `predicted`, `position` and 1 more.
#[allow(unused_imports)]
use super::*;
use super::{
Error, ForwardPhase, ModelBinding, Position, PrefillStepProduct, QwenSession, Result, TargetStepOrigin,
TargetStepProduct, TokenId,
};
impl PrefillStepProduct {
pub(in super::super) fn mtp_source<'a>(
@@ -1,8 +1,10 @@
//! The methods of `QwenForward` that run a step: the reset, the shared step body and the entry points that call it.
//! Separate from `executor`, which holds the type they work on.
#[allow(unused_imports)]
use super::*;
use super::{
Error, KarPleCache, ModelBinding, OutputStage, Position, PrefillStepProduct, QwenForward, QwenSession, Result,
Stage, StepCaches, StepCoreResult, StepPurpose, StepRequest, TargetStepProduct, TokenId,
};
#[path = "qwen_forward/qwen_forward_reset.rs"]
mod qwen_forward_reset;
@@ -4,8 +4,9 @@
use super::super::step_layers::{
LayerCtx, capture_streams, finish_step, prepare_step_caches, run_layers, stage_input_row,
};
#[allow(unused_imports)]
use super::*;
use super::{
Error, OutputStage, QwenForward, QwenSession, Result, Stage, StepCaches, StepCoreResult, StepPurpose, StepRequest,
};
impl QwenForward {
/// A forward without its output head can never publish, so it is refused before reading any row or running any
@@ -1,8 +1,7 @@
//! Methods of `QwenForward`: `reset`.
//! Split out of `qwen_forward` to keep its files under the line limit.
#[allow(unused_imports)]
use super::*;
use super::{QwenForward, QwenSession, Result};
impl QwenForward {
pub(crate) fn reset(session: &mut QwenSession<'_>) -> Result<()> {
@@ -1,7 +1,9 @@
//! The forward-step entry points of QwenForward: greedy, KAR, MTP target and MTP prefill steps.
#[allow(unused_imports)]
use super::*;
use super::{
Error, KarPleCache, ModelBinding, OutputStage, Position, PrefillStepProduct, QwenForward, QwenSession, Result,
StepCaches, StepPurpose, StepRequest, TargetStepProduct, TokenId,
};
impl QwenForward {
pub(crate) fn step(
@@ -1,8 +1,10 @@
//! Functions: `read_layer_attention`, `read_layer_one`, `prepare_layer_attention_micro`, `prepare_layer_one_micro` a...
//! Defines `LayerEntry`.
#[allow(unused_imports)]
use super::*;
use super::{
BoundLayerKind, DenseWeightCache, Dimension, Error, ForwardPhase, GrRead, GrStage, InjectedResidual, InputStage,
LayerId, ModelBinding, QwenStepTxn, Result, diagnose,
};
/// The layer-one path consumes and stages the real PLE producer before GR.
/// This helper is also the entry for later layers when their FFN provider is
@@ -1,7 +1,6 @@
//! The residuals a step hands to the oracle capture (test builds) and to an explicit MTP caller.
#[allow(unused_imports)]
use super::*;
use super::{Error, InjectedResidual, Result};
#[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))]
use crate::qwen_forward::oracle_capture;
@@ -1,7 +1,11 @@
//! Closed target verification prerequisite. This is not a serving selector.
//! The caller must rewind speculative draft work and genuinely warm the
//! current committed source before staging this window. No future origin.
use super::*;
use super::{
ChunkMoePolicy, DenseWeightCache, Error, KarPleCache, ModelBinding, MoeWeightCache, OutputStage,
PrefillChunkInputs, PrefillChunkPlan, QwenChunkTxn, QwenForward, QwenSession, Result, Stage, TargetStepProduct,
TokenId,
};
use crate::qwen_forward::{
mtp::{self, MtpChunkStage, MtpSession},
session::chunk::{ChunkRowResidual, VerifiedDraftPublication, VerifiedTargetPrefix},
@@ -23,7 +23,10 @@ use super::super::{
dense_weight_cache::DenseWeightCache,
moe_weight_cache::{MoeWeightCache, RetainedOriginalMtpWeights},
};
use super::*;
use super::{
BindingIdentity, BoundLayerKind, Dimension, Error, InputStage, KarPleCache, LayerId, ModelBinding, QwenSession,
Result, Stage, TargetStepOrigin, TokenId,
};
#[path = "original_prompt_embedding.rs"]
pub(in crate::qwen_forward) mod embedding;
use super::super::input::StagedInput;
@@ -1,5 +1,5 @@
//! The operand groups the construction of `OriginalPromptExecutor` takes.
use super::*;
use super::{Context, PromptWeights, QwenSession};
/// The target model weights, the target session and the device context a prompt executor is built over.
pub(in crate::qwen_forward) struct ExecutorTarget<'a, 'ctx> {
@@ -1,8 +1,19 @@
//! 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.
#[allow(unused_imports)]
use super::*;
use super::{
BoundLayerKind, Carrier, ChunkCaches, ChunkDraft, ChunkInFlight, ChunkRollback, ChunkWork, Context,
DenseWeightCache, Dimension, DraftAttachmentTables, DraftAttachmentTarget, Error, ExecutorSizing, ExecutorTarget,
GrNativeProfile, InputStage, KarPleCache, LayerId, ModelBinding, MoeWeightCache, OpenChunk, OriginalDraftKvPending,
OriginalDraftSession, OriginalMtpFullAssembly, OriginalMtpFullOwner, OriginalMtpLoadError, OriginalMtpPrefill,
OriginalMtpRetainedScalarWeights, OriginalMtpScalarPolicy, OriginalPrefillArena, OriginalPromptDevice,
OriginalPromptDraftOutcome, OriginalPromptEmbedding, OriginalPromptExecutor, OriginalPromptPending,
OriginalPromptSample, OriginalPromptTxn, OriginalSessionCheckpoint, PStage, ParkedBlock, ParkedSession,
PleBf16Mode, PromptChunkSource, PromptChunkTarget, PromptDeviceFinal, PromptDeviceNormedRows, PromptDeviceRows,
PromptDeviceSource, PromptInputStage, PromptWeights, QsaLayerDevices, QsaNativePacking, QwenSession,
ResidentQsaLayer, ResidentQsaOwners, ResidentQsaPrior, Result, RetainedOriginalMtpWeights, RowsUpload, RtMtpLoad,
SpanExport, Stage, StagedInput, TokenId, driver_error, prof, staged_input_enabled,
};
#[path = "original_prompt_executor/construction_and_parking.rs"]
mod construction_and_parking;
@@ -1,8 +1,14 @@
//! Groups the submodules `executor_construction`, `session_park_and_qsa_owners`.
//! Split out of `original_prompt_executor` to keep its files under the line limit.
#[allow(unused_imports)]
use super::*;
use super::{
BoundLayerKind, Context, DenseWeightCache, Dimension, DraftAttachmentTables, DraftAttachmentTarget, Error,
ExecutorSizing, ExecutorTarget, GrNativeProfile, LayerId, ModelBinding, MoeWeightCache, OriginalDraftSession,
OriginalMtpFullAssembly, OriginalMtpFullOwner, OriginalMtpLoadError, OriginalPromptEmbedding,
OriginalPromptExecutor, OriginalSessionCheckpoint, ParkedBlock, ParkedSession, PleBf16Mode, PromptWeights,
QsaNativePacking, QwenSession, ResidentQsaLayer, ResidentQsaOwners, ResidentQsaPrior, Result,
RetainedOriginalMtpWeights, RtMtpLoad, SpanExport, driver_error,
};
#[path = "construction_and_parking/executor_construction.rs"]
mod executor_construction;
@@ -1,8 +1,13 @@
//! 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.
#[allow(unused_imports)]
use super::*;
use super::{
BoundLayerKind, Context, DenseWeightCache, Dimension, DraftAttachmentTables, DraftAttachmentTarget, Error,
ExecutorSizing, ExecutorTarget, GrNativeProfile, LayerId, ModelBinding, MoeWeightCache, OriginalDraftSession,
OriginalMtpFullAssembly, OriginalMtpFullOwner, OriginalMtpLoadError, OriginalPromptEmbedding,
OriginalPromptExecutor, PleBf16Mode, PromptWeights, QsaNativePacking, QwenSession, ResidentQsaLayer,
ResidentQsaOwners, Result, RetainedOriginalMtpWeights, RtMtpLoad, driver_error,
};
use leleka_cuda_driver::{GdnPromptOptions, NativeBatchWorkspace};
impl<'ctx> OriginalPromptExecutor<'ctx> {
@@ -1,8 +1,11 @@
//! Methods of `OriginalPromptExecutor`: `take_qsa_owners`, `adopt_qsa_owners`, `rebuild_qsa_layers`, `checkpoint_ses...
//! Defines `QsaOwners`.
#[allow(unused_imports)]
use super::*;
use super::{
DenseWeightCache, Error, ModelBinding, OriginalPromptExecutor, OriginalSessionCheckpoint, ParkedBlock,
ParkedSession, PromptWeights, QwenSession, ResidentQsaLayer, ResidentQsaOwners, ResidentQsaPrior, Result,
SpanExport,
};
use crate::qwen_forward::session::original_prompt::ParkedPoint;
/// The index image and mapped K/V journal of each of the twelve resident QSA layers, by layer slot.

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